get_results("SELECT programs.program_id, programs.daisycon_program_id, programs.name, programs.date, categories.rename, programs.product_count, categories.name AS categoryName, programs.productfeed, programs.productfeed_date, programs.program_id FROM `programs` INNER JOIN categories ON programs.category = categories.name ORDER BY programs.name ASC"); $view = self::adminProgramView($results); } if ($_GET['action'] == "edit"){ $view = self::adminProgramEdit(); if (isset($_POST['save'])){ if($_POST['visible'] == 'on'){ $visible = 1; }else{ $visible = 0; } $date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day']; $wpdb->update('programs',array( 'description' => stripslashes($_POST['description']), 'category' => $_POST['category'], 'url' => $_POST['url'], 'more' => stripslashes($_POST['more']), 'date' => $date, 'visible' => $visible, 'subid' => $_POST['subid'], 'productfeed' => $_POST['productfeed']), array('program_id' => $_GET['product'])); $rCategories = $wpdb->get_results("SELECT * FROM categories ORDER BY categories.rename ASC"); $rprograms = $wpdb->get_results("SELECT programs.name, programs.date, programs.ecpc, programs.category, programs.url, programs.more, programs.productfeed, programs.image, programs.subid, programs.description, programs.visible, categories.rename, categories.name AS categoryName FROM programs INNER JOIN categories ON programs.category = categories.name WHERE programs.program_id = '".$_GET['product']."'"); $view = self::adminProgramEdit($rprograms, $rCategories); echo '

'.__('Het programma is bijgewerkt!','DaisyconPlugin').'

'; } elseif(isset($_GET['update'])){ if($_GET['update'] == "true"){ include('cron/importProducts.php'); } } elseif(isset($_POST['products'])){ if($_POST['visible'] == 'on'){ $visible = 1; }else{ $visible = 0; } $date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day']; $wpdb->update('programs',array( 'description' => stripslashes($_POST['description']), 'category' => $_POST['category'], 'url' => $_POST['url'], 'more' => stripslashes($_POST['more']), 'date' => $date, 'visible' => $visible, 'subid' => $_POST['subid'], 'productfeed' => $_POST['productfeed']), array('program_id' => $_GET['product'])); $rCategories = $wpdb->get_results("SELECT * FROM categories ORDER BY categories.rename ASC"); $rprograms = $wpdb->get_results("SELECT programs.name, programs.date, programs.ecpc, programs.category, programs.url, programs.more, programs.productfeed, programs.image, programs.description, programs.visible, programs.subid, categories.rename, categories.name AS categoryName FROM programs INNER JOIN categories ON programs.category = categories.name WHERE programs.program_id = '".$_GET['product']."'"); $view = self::adminProgramEdit($rprograms, $rCategories); include('cron/importProducts.php'); } } }else{ $publisher = $wpdb->get_row("SELECT * FROM publisher"); $wi = explode('/media/', $publisher->feed); $wi = explode('/', $wi[1]); echo ' '; if (isset($_POST['sCategory'])){ $results = $wpdb->get_results("SELECT programs.program_id, programs.daisycon_program_id, programs.name, programs.date, categories.rename, programs.product_count, categories.name AS categoryName, programs.productfeed, programs.productfeed_date, programs.program_id FROM `programs` INNER JOIN categories ON programs.category = categories.name WHERE categories.rename = '".$_POST['category']."' ORDER BY programs.name ASC"); $view = self::adminProgramView($results); } else{ $results = $wpdb->get_results("SELECT programs.program_id, programs.daisycon_program_id, programs.name, programs.date, categories.rename, programs.product_count, categories.name AS categoryName, programs.productfeed, programs.productfeed_date, programs.program_id FROM `programs` INNER JOIN categories ON programs.category = categories.name ORDER BY programs.name ASC"); $view = self::adminProgramView($results); } } echo $view; } public function adminProgramView($results){ global $wpdb; //wp_enqueue_script('tablesorter', plugins_url('/files/js/jquery.tablesorter.min.js',__FILE__) ); wp_enqueue_script('functions', plugins_url('/files/js/functions.js',__FILE__) ); wp_enqueue_script('tipjquerymin', plugins_url('/files/js/jquery.tipTip.minified.js',__FILE__) ); $output = '

'.__( 'Programma‘s','DaisyconPlugin' ).'

'.__('Plak de shorttag(s) in een pagina of blogpost. Het programma wordt automatisch op deze pagina getoond. Je kan per programma kiezen tussen een shorttag met de lange of met een korte omschrijving. Die kan je zelf invullen door op het programma te klikken. Hier kan je ook links aanpassen, de categorie wijzigen of het programma uit het overzicht halen.

Gebruik de "shorttag voor actiecode" om alle actiecodes van die adverteerder direct op je website te plaatsen.

Druk op "Producten ophalen" om de producten uit de productfeed van deze adverteerder op te halen. Hier kan je ook de individuele feeds updaten.

','DaisyconPlugin').'
'; $Productfeed = $wpdb->get_row("SELECT * FROM publisher LIMIT 1"); if ($Productfeed->feed != NULL && $Productfeed->programsproductfeed != NULL && $rCategories != NULL){ $output .= '
'; } $output .= '
'; foreach ($results as $array) { $cActioncode = $wpdb->get_row("SELECT * FROM actioncodes WHERE program_id = '".$array->program_id."'"); $output.= ' '; $dCount = ''; $dCount = $wpdb->get_var("SELECT COUNT(*) FROM productfeed WHERE productfeed.program_id = '".$array->program_id."' "); if($array->product_count > 0){ if(count($dCount) > 0){ $date = explode('-', $array->productfeed_date); if($array->productfeed_date != '0000-00-00'){ $output .= ' '; }else{ $output .= ' '; } } else{ $output .= ' '; } $output .= ' '; } if($array->product_count > 0){ $output .=''; }else{ $output .= ''; } $output .= ' '; } $output .= '
'.__('Programma','DaisyconPlugin').' '.__('Shorttag voor korte omschrijving','DaisyconPlugin').' '.__('Shorttag voor Actiecode','DaisyconPlugin').' '.__('Datum producten opgehaald','DaisyconPlugin').' '.__('Producten ophalen','DaisyconPlugin').' [?]
'.$array->name.'
[moreProgram id="'.$array->program_id.'"]
'; if(count($cActioncode) > 0){ $output.= '[actioncodesProgram id="'.$array->program_id.'"]';} $output.= '
'.$date[2].'-'.$date[1].'-'.$date[0].' '.__('Niet opgehaald','DaisyconPlugin').' '.__('Niet opgehaald','DaisyconPlugin').' '; if($dCount > 0){ $output .= __('Producten updaten','DaisyconPlugin'); }else{ $output .= __('Producten ophalen','DaisyconPlugin'); } $output .= ' '; }else{ $output .= ' z '.__('Geen producten','DaisyconPlugin').' daisycon_program_id == 0){$output .= ' checked'; } $output .= '/> 
'; return($output); } public function adminProgramEdit(){ global $wpdb; $rCategories = $wpdb->get_results("SELECT * FROM categories ORDER BY categories.rename ASC"); $result = $wpdb->get_results("SELECT programs.name, programs.daisycon_program_id, programs.date, programs.ecpc, programs.category, programs.url, programs.more, programs.productfeed, programs.image, programs.description, programs.visible, programs.subid, programs.productfeed_date, categories.rename, categories.name AS categoryName FROM programs INNER JOIN categories ON programs.category = categories.name WHERE programs.program_id = '".$_GET['product']."'"); if (isset($_POST['save'])){ if($_POST['visible'] == 'on'){ $visible = 1; }else{ $visible = 0; } if($_POST['get'] == 'on'){ $get = 1; }else{ $get = 0; } $date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day']; $wpdb->update('programs',array( 'description' => stripslashes($_POST['description']), 'category' => $_POST['category'], 'url' => $_POST['url'], 'more' => stripslashes($_POST['more']), 'date' => $date, 'visible' => $visible, 'daisycon_program_id' => $get, 'subid' => $_POST['subid'], 'productfeed' => $_POST['productfeed']), array('program_id' => $_GET['product'])); } foreach($result as $array){ if($array->productfeed_date != "0000-00-00"){ $productfeed_date = explode('-', $array->productfeed_date); $productfeed_date = $productfeed_date[2].'-'.$productfeed_date[1].'-'.$productfeed_date[0]; }else{ $productfeed_date = __('Nog niet volledig geüpdatet'); } $products_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(product_id) FROM productfeed WHERE program_id = '".$_GET['product']."' ")); $output = '

'.__( 'Programma wijzigen','DaisyconPlugin' ).'

Daisycon > '.__('Programma‘s','DaisyconPlugin').' > '.$array->name.'

'.$array->name.'
'.__('Ga naar website','DaisyconPlugin').'

'; if(strlen($array->productfeed)>0){ $output .= ' '.__('Aantal producten opgehaald:','DaisyconPlugin').' '.$products_count.'
'.__('Laatst producten opgehaald:','DaisyconPlugin').' '.$productfeed_date.' '; }else{ $output .= ' '.__('Niet mogelijk om producten te importeren','DaisyconPlugin').' '; } $output .='

'.__('Deze tekst komt op de categoriepagina. Je kan zelf de link aanpassen en bijvoorbeeld ook naar een pagina binnen je site linken.','DaisyconPlugin').'

'.__('Deze tekst komt op de programmapagina','DaisyconPlugin').'

'.__('Hier kan je dit programma in een andere categorie plaatsen.','DaisyconPlugin').'

'.__('Deze link wordt gebruikt om via het logo naar de adverteerder te linken. Je kan zelf een SubID toevoegen.','DaisyconPlugin').'

'.__('De productfeed link wordt gebruikt om de producten op te halen en in de database te zetten. Vul indien gewenst in het tweede veld de SubID in.','DaisyconPlugin').'

'.__('De eCPC wordt berekend op basis de omzet van de laatste twee maanden in jouw account.','DaisyconPlugin').'

'.__('Gebruik deze optie om een programma niet zichtbaar te maken. Indien deze optie is aangevinkt zal er een tekst weergegeven worden dat het programma niet meer beschikbaar is.','DaisyconPlugin').'
visible == 1){$output .= ' checked'; } $output .= ' />

'.__('Gebruik deze optie om de producten van het programma op te halen als de actie "Alle producten van alle programmas" wordt gekozen.','DaisyconPlugin').'
daisycon_program_id == 1){$output .= ' checked'; } $output .= ' />

<-- '.__('Terug','DaisyconPlugin').'

'; } return($output); } public function adminCategorie(){ global $post,$wpdb; if (isset($_GET['action'])){ if($_GET['action'] == "edit"){ $view = self::adminCategoryEdit(); if(isset($_POST['save'])){ if($_POST['visible'] == 'on'){ $visible = 1; }else{ $visible = 0; } if($_POST['visible'] == 'on'){ $visible = 1; }else{ $visible = 0; } $wpdb->update('categories',array('rename' => stripslashes($_POST['rename']), 'visible' => $visible, 'visible' => $visible), array('category_id' => $_GET['category'])); $view = self::adminCategoryEdit(); echo '

'.__('De categorie is bijgewerkt!','DaisyconPlugin').'

'; } } }else{ $view = self::adminCategoryView(); } echo $view; } public function adminCategoryEdit(){ global $wpdb; $result = $wpdb->get_results("SELECT * FROM categories WHERE category_id = '".$_GET['category']."'"); foreach($result as $array){ $output = '

'.__( 'Categorie wijzigen','DaisyconPlugin').'

visible == 1){$output.=' checked';}$output.=' />

<-- '.__('Terug','DaisyconPlugin').'

'; } return($output); } public function adminCategoryView(){ wp_enqueue_script('tablesorter', plugins_url('/files/js/jquery.tablesorter.min.js',__FILE__) ); wp_enqueue_script('functions', plugins_url('/files/js/functions.js',__FILE__) ); global $wpdb; $publisher = $wpdb->get_row("SELECT * FROM publisher"); $wi = explode('/media/', $publisher->feed); $wi = explode('/', $wi[1]); $output = '

'.__( 'Categorieën','DaisyconPlugin').'

'.__('Plak onderstaande shorttag op een pagina of in een blogpost en de categorie wordt getoond. Vul achter ‘amount‘ tussen de aanhalingstekens het aantal programma‘s in dat je wil tonen. Vul je niets in, dan worden alle programma‘s getoond. De volgorde wordt bepaald obv eCPC (dit moet je wel aanzetten bij Instellingen).','DaisyconPlugin').'

'; global $post,$wpdb; $results = $wpdb->get_results("SELECT * FROM `categories` ORDER BY categories.rename ASC"); $result = '
'.__('Categorie','DaisyconPlugin').' '.__('Shorttag','DaisyconPlugin').' '.__('Naam','DaisyconPlugin').' '.__('Programma‘s','DaisyconPlugin').'
'; foreach($results as $array){ $results_prd = $wpdb->get_results("SELECT * FROM `programs` WHERE `category` = '".$array->name."'"); $count = count($results_prd); $link = str_replace(" ", "_", $array->rename); $link = str_replace("&", "en", $link); $output .= ' '; } $output .= '
'.$array->name.'
[category id="'.$array->category_id.'" amount=""]
'.$array->rename.' '.$count.'
'; return($output); } public function adminFeeds(){ global $post,$wpdb; if(isset($_POST['toevoegen'])){ $daisycon = $wpdb->get_row("SELECT * FROM publisher LIMIT 1"); $url = 'http://publishers.daisycon.com/en/affiliatemarketing/feed/'; $username = $_POST['username']; $password = $_POST['password']; if( ini_get('allow_url_fopen') ){ $args = array( 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( $username . ':' . $password )) ); $result = wp_remote_request( $url, $args ); $body = wp_remote_retrieve_body($result); }else{ $context = stream_context_create(array( 'http' => array( 'header' => "Authorization: Basic " . base64_encode("$username:$password") ) )); $body = file_get_contents($url, false, $context); } $jsonData = json_decode($body); if(!empty($jsonData) && !isset($jsonData->errors)){ echo '
'.__('Stap 2: Website ophalen!','DaisyconPlugin').'

'.__('Voor bovenstaand account heb je de volgende websites bij Daisycon aangemeld. Kies nu de website waarop je deze plugin hebt geïnstalleerd, en klik op 'Toevoegen'.','DaisyconPlugin').'

'; echo '
'; foreach ($jsonData as $publisherId => $feed) { echo ''; break; } echo ' '; echo ''; echo ''; echo ''; echo '
'; $wpdb->query("DELETE FROM programs"); $wpdb->query("DELETE FROM categories"); $wpdb->query("DELETE FROM productfeed"); $wpdb->query("DELETE FROM actioncodes"); if (count($daisycon) == 0){ $wpdb->insert('publisher', array('username' => $_POST['username'], 'password' => md5($_POST['password']))); }else{ $wpdb->update('publisher', array('username' => $_POST['username'], 'password' => md5($_POST['password'])), array('daisycon_id' => 1)); } }else{ $rFeeds = $wpdb->get_row("SELECT * FROM publisher"); if(strlen($rFeeds->feed) > 0 && strlen($rFeeds->programsproductfeed) > 0){ echo '

'.__('Vul je gegevens even opnieuw in.','DaisyconPlugin').'

'; echo ' '; }else{ echo ' '; echo '

'.__('Je moet even de (juiste) gegevens invullen.','DaisyconPlugin').'

'; } } }elseif(isset($_POST['getfeeds'])){ $cFeeds = $wpdb->get_row("SELECT * FROM publisher"); $getPublisherId = $_POST['publisher']; $username = $cFeeds->username; $password = $_POST['password']; $url = 'http://publishers.daisycon.com/en/affiliatemarketing/feed/fetch/media/'. $_POST['mediaId'] .'/publisher/'. $getPublisherId .''; echo '
'; if( ini_get('allow_url_fopen') ){ $args = array( 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( $username . ':' . $password )) ); $result = wp_remote_request( $url, $args ); $body = wp_remote_retrieve_body($result); }else{ $context = stream_context_create(array( 'http' => array( 'header' => "Authorization: Basic " . base64_encode("$username:$password") ) )); $body = file_get_contents($url, false, $context); } $jsonData = json_decode($body); $wpdb->update('publisher', array('actiecodefeed' => $jsonData->promotioncodes_export, 'feed' => $jsonData->program_export, 'programsproductfeed' => $jsonData->productfeeds_export, 'actioncode_status' => 'delete', 'api' => '0', 'program_date' => '0000-00-00 00:00:00', 'actioncode_date' => '0000-00-00 00:00:00'), array('daisycon_id' => 1)); } if (isset($_POST['savehere'])){ $wpdb->update('publisher', array( 'actioncode_status' => $_POST['actioncodestatus'], 'subid' => $_POST['subid'], 'api' => $_POST['api'], 'feed_timeout' => $_POST['feed_timeout'], 'subid' => $_POST['urlreplacer']), array('daisycon_id' => 1)); echo '

'.__('Gegevens zijn bijgewerkt!','DaisyconPlugin').'

'; } if (isset($_POST['save'])){ $cFeeds = $wpdb->get_row("SELECT * FROM publisher"); if (count($cFeeds) == 0){ $wpdb->insert('publisher', array('actiecodefeed' => $_POST['actiecode'], 'actioncode_status' => $_POST['actioncodestatus'], 'feed' => $_POST['url'], 'programsproductfeed' => $_POST['prodfeed'], 'subid' => $_POST['subid'], 'username' => $_POST['username'], 'password' => md5($_POST['password']), 'api' => $_POST['api'], 'feed_timeout' => $_POST['feed_timeout'], 'subid' => $_POST['urlreplacer'])); }else{ if($cFeeds->password == $_POST['password']){ $password = $cFeeds->password; }else{ $password = md5($_POST['password']); } $wpdb->update('publisher', array( 'actiecodefeed' => $_POST['actiecode'], 'actioncode_status' => $_POST['actioncodestatus'], 'feed' => $_POST['url'], 'programsproductfeed' => $_POST['prodfeed'], 'subid' => $_POST['subid'], 'username' => $_POST['username'], 'password' => $password, 'api' => $_POST['api'], 'feed_timeout' => $_POST['feed_timeout'], 'subid' => $_POST['urlreplacer']), array('daisycon_id' => $_POST['id'])); } echo '

'.__('Gegevens zijn bijgewerkt!','DaisyconPlugin').'

'; $view = self::adminFeedsView(); }elseif(isset($_POST['update'])){ $cFeeds = $wpdb->get_row("SELECT * FROM publisher"); if (count($cFeeds) == 0){ $wpdb->insert('publisher', array('feed' => $_POST['url'])); }else{ if($cFeeds->password == $_POST['password']){ $password = $cFeeds->password; }else{ $password = md5($_POST['password']); } $date = date("Y-m-d H:i:s"); $wpdb->update('publisher', array('actioncode_status' => $_POST['actioncodestatus'], 'program_date' => $date), array('daisycon_id' => '1')); } include('cron/API.php'); }elseif(isset($_POST['updateactiecodes'])){ $date = date("Y-m-d H:i:s"); $wpdb->update('publisher', array('actioncode_date' => $date), array('daisycon_id' => '1')); include('cron/importActioncodes.php'); }elseif(isset($_POST['importallproducts'])){ include('cron/importProducts.php'); } if($_GET['subpage'] == 'getfeeds'){ $view = self::adminFeedsView(); echo $view; }else{ $view = self::adminGetFeedsView(); echo $view; } } public function adminFeedsView(){ global $post,$wpdb; wp_enqueue_script('functions', plugins_url('/files/js/functions.js',__FILE__) ); wp_enqueue_script('tiptip', plugins_url('/files/js/jquery.tipTip.minified.js',__FILE__) ); $rFeeds = $wpdb->get_row("SELECT * FROM publisher"); $rPrograms = $wpdb->get_results("SELECT * FROM programs"); $rActioncodes = $wpdb->get_results("SELECT * FROM actioncodes"); $output = '

'.__('Inloggen (automatisch feeds toevoegen)','DaisyconPlugin').'

'.__('Handmatig feeds toevoegen','DaisyconPlugin').'

 

 

'.__( 'Handmatig feeds toevoegen','DaisyconPlugin').'

'.__('Gebruik deze functie alleen als je wil filteren in de feeds die je gebruikt. Deze optie geeft jou als gebruiker de vrijheid om zelf in het Daisyconsysteem de feeds op te halen en te filteren. Wij raden alleen meer ervaren gebruikers aan deze optie toe te passen. Gebruik anders 'Automatisch feeds toevoegen' in het vorige tabblad.','DaisyconPlugin').'

'.__('Om deze plugin te gebruiken moet je eerst aangemeld zijn als publisher bij Daisycon. Vul hieronder eerst je gegevens en vervolgens de feeds in. De feeds moet je uit het Daisycon systeem halen. Na het invullen van de gegevens en de feeds moet er eerst op Opslaan geklikt worden. Vervolgens moeten eerst de Programma‘s opgehaald worden en daarna de Actiecodes. De producten kan je in een keer allemaal ophalen, maar dit kan enkele uren duren. We raden je aan eerst de producten van de programma‘s die je wil gebruiken op te halen. Dit kan je doen bij "Programma‘s".

Klik hier voor een uitgebreide handleiding.','DaisyconPlugin').'





'; $output .= ' '; if($rFeeds->username != NULL && count($rPrograms) == 0){ $output .= '

'.__('De publishergegevens zijn nu toegevoegd. Haal nu de programma‘s op om af te ronden en aan de slag te gaan.','DaisyconPlugin').'

'; } $output .= '
'.__('Stap 1: Daisycon gegevens','DaisyconPlugin').'
'.__('E-mailadres van publisheraccount','DaisyconPlugin').'
'.__('Wachtwoord publisheraccount','DaisyconPlugin').'
'.__('Programmalijst (feed met programma's)','DaisyconPlugin').'
'.__('Productfeedlijst (feed met beschikbare productfeeds)','DaisyconPlugin').'
'.__('Actiecodelijst (feed met actiecodes)','DaisyconPlugin').'
'.__('Verlopen actiecodes weergeven','DaisyconPlugin').'
'.__('eCPC voor programmalijst gebruiken JA / NEE','DaisyconPlugin').' api == "1"){ $output .= ' checked';} $output .=' />
'.__('Automatisch links omzetten naar Daisycon affiliatelinks','DaisyconPlugin').' subid == "1"){ $output .= ' checked';} $output .=' style="margin-right: 10px;">'.__('Lees info','DaisyconPlugin').'
'.__('Time-out producten ophalen','DaisyconPlugin').' [?]

'; $check = $wpdb->get_row("SELECT * FROM publisher"); if(count($check) > 0){ $output .= '
'.__('Stap 2: Alles ophalen!','DaisyconPlugin').'
'; if(strlen($rFeeds->feed) > 0 && strlen($rFeeds->programsproductfeed) > 0){ if($rFeeds->program_date == '0000-00-00 00:00:00' && count($rPrograms) == 0){ $output .= ' '.__('Druk op de button om de programma‘s waarbij je bent aangemeld op te halen.','DaisyconPlugin').' '; }elseif($rFeeds->program_date != '0000-00-00 00:00:00' && count($rPrograms) > 0){ $output .= ' '.__('Laatste update','DaisyconPlugin').': '.self::makeDate($rFeeds->program_date).' '; }else{ $output .= ' '.__('Nog niet opgehaald.','DaisyconPlugin').' '; } }else{ $output .= __('Sla eerst je programmalijst en productlijst op!'); } $output .= '
'; if(strlen($rFeeds->actiecodefeed) > 0){ if($rFeeds->program_date != '0000-00-00 00:00:00' && $rFeeds->actioncode_date == '0000-00-00 00:00:00' && count($rActioncodes) == 0){ $output .= ' '.__('Druk op de button om de actiecodes waarbij je bent aangemeld op te halen. ','DaisyconPlugin').' '; }elseif($rFeeds->actioncode_date != '0000-00-00 00:00:00' && count($rActioncodes) > 0){ $output .= ' '.__('Laatste update','DaisyconPlugin').': '.self::makeDate($rFeeds->actioncode_date).' '; }elseif($rFeeds->actioncode_date != '0000-00-00 00:00:00' && count($rActioncodes) == 0){ $output .= ' '.__('Geen actiecodes gevonden bij de opgehaalde programma's.','DaisyconPlugin').' '; }else{ $output .= ' '.__('Haal eerst je programma's op.','DaisyconPlugin').' '; } }else{ $output .= __('Sla eerst je actiecodelijst op!'); } $output .= '
'; if(strlen($rFeeds->feed) > 0 && strlen($rFeeds->programsproductfeed) > 0){ if($rFeeds->program_date != '0000-00-00 00:00:00'){ $output .= '
'.__('Druk op de button om alle producten van de programma‘s op te halen (Let op: dit kan enkele uren duren).','DaisyconPlugin').' '; }else{ $output .= ' '.__('Haal eerst je programma's op.','DaisyconPlugin').' '; } }else{ $output .= __('Sla eerst je programmalijst en productlijst op!'); } $output .= '

 

'; } return($output); } public function makeDate($date){ $explode = explode(" ", $date); $date = explode("-", $explode[0]); $time = explode(":", $explode[1]); if($explode[0] == date("Y-m-d")){ $date = __('Vandaag','DaisyconPlugin'); } elseif(date('Y-m-d', strtotime(date("Y-m-d", strtotime(date("Y-m-d"))) . " -1 day")) == $explode[0]){ $date = __('Gisteren','DaisyconPlugin'); } elseif(date('Y-m-d', strtotime(date("Y-m-d", strtotime(date("Y-m-d"))) . " -2 day")) == $explode[0]){ $date = __('Eergisteren','DaisyconPlugin'); } else{ $date = $date[2].'-'.$date[1].'-'.$date[0]; } $time = __('om ','DaisyconPlugin') . $time[0] . ':' . $time[1] . __(' uur','DaisyconPlugin'); return($date.' '.$time); } public function adminProduct(){ if(!isset($_GET['action'])){ $view = self::adminProductView(); echo $view; } } public function adminProductView(){ global $wpdb; $publisher = $wpdb->get_row("SELECT * FROM publisher"); $wi = explode('/media/', $publisher->feed); $wi = explode('/', $wi[1]); echo ''; wp_enqueue_script('functions', plugins_url('/files/js/functions.js',__FILE__) ); wp_enqueue_script('widget', includes_url('js/jquery/ui/jquery.ui.widget.min.js',__FILE__)); wp_enqueue_script('mouse', includes_url('js/jquery/ui/jquery.ui.mouse.min.js',__FILE__)); wp_enqueue_script('accor', includes_url('js/jquery/ui/jquery.ui.accordion.min.js',__FILE__)); wp_enqueue_script('cor', includes_url('js/jquery/ui/jquery.ui.core.min.js',__FILE__)); wp_enqueue_script('dragg', includes_url('js/jquery/ui/jquery.ui.draggable.min.js',__FILE__)); wp_enqueue_script('droppa', includes_url('js/jquery/ui/jquery.ui.droppable.min.js',__FILE__)); wp_enqueue_script('sorta', includes_url('js/jquery/ui/jquery.ui.sortable.min.js',__FILE__)); $Aprograms = $wpdb->get_results("SELECT Distinct programs.name, programs.program_id FROM programs INNER JOIN productfeed ON programs.program_id = productfeed.program_id"); $Asheets = $wpdb->get_results("SELECT * FROM stylesheets"); $output = ' '; $output .= '

'.__( 'Handmatig Producten genereren','DaisyconPlugin' ).'

'.__( 'Automatisch Producten genereren','DaisyconPlugin' ).'


'.__('Genereer een shorttag door middel van de onderstaande velden. De gegenereerde shorttag is vervolgens te gebruiken in een pagina of blogpost om een lijst met producten te tonen.','DaisyconPlugin').'

'; $output .= ' '; $output .= '
'.__('Producten ophalen','DaisyconPlugin').'
'.__('Stylesheet','DaisyconPlugin').'
'.__('Programma','DaisyconPlugin').'
'.__('Categorie','DaisyconPlugin').' ('.__('Optioneel','DaisyconPlugin').')
'.__('Subcategorie','DaisyconPlugin').' ('.__('Optioneel','DaisyconPlugin').')
'.__('Zoeken','DaisyconPlugin').' '.__('Zet * voor het woord om exact te zoeken (*voorbeeld) en spatie om op meerder woorden te zoeken (zoekwoord1 zoekwoord2).','DaisyconPlugin').'
'.__('Zoek en sleep de producten die je op je site wil zetten in het rechtervlak. Klik daarna op "Genereer shorttag" om hier de shorttag te genereren die je in de HTML van je website kan plaatsen.','DaisyconPlugin').'
'; $output .= ' '; return($output); } public function adminStylesheets(){ global $wpdb; $publisher = $wpdb->get_row("SELECT * FROM publisher"); $wi = explode('/media/', $publisher->feed); $wi = explode('/', $wi[1]); echo ''; wp_enqueue_script('color', plugins_url('/files/js/functions.js',__FILE__) ); wp_enqueue_script('functions', plugins_url('/files/js/jscolor.js',__FILE__) ); wp_enqueue_script('widget', includes_url('js/jquery/ui/jquery.ui.widget.min.js',__FILE__)); wp_enqueue_script('mouse', includes_url('js/jquery/ui/jquery.ui.mouse.min.js',__FILE__)); wp_enqueue_script('accor', includes_url('js/jquery/ui/jquery.ui.accordion.min.js',__FILE__)); wp_enqueue_script('cor', includes_url('js/jquery/ui/jquery.ui.core.min.js',__FILE__)); wp_enqueue_script('dragg', includes_url('js/jquery/ui/jquery.ui.draggable.min.js',__FILE__)); wp_enqueue_script('droppa', includes_url('js/jquery/ui/jquery.ui.droppable.min.js',__FILE__)); wp_enqueue_script('sorta', includes_url('js/jquery/ui/jquery.ui.sortable.min.js',__FILE__)); if (isset($_POST['delete'])){ $Asheet = $wpdb->query("DELETE FROM stylesheets WHERE stylesheet_id = '".$_POST['stylesheet_id']."'"); } if (isset($_POST['getdefault'])){ $dropSheet = $wpdb->query("TRUNCATE TABLE stylesheets;"); $Asheet = $wpdb->query("INSERT IGNORE INTO `stylesheets` (`stylesheet_id`, `name`, `bordercolor`, `backgroundcolor`, `textcolor`, `align`, `store`, `store_before`, `store_button_program`, `price`, `price_before`, `size`, `width`, `height`, `button_store`, `buttoncolor`, `buttonbordercolor`, `buttontextcolor`, `view`, `float`, `price_button`, `moreproducts_color`, `moreproducts_font`, `moreproducts_text`) VALUES (1, 'Tabelweergave (voorbeeld 1)', 'E3E3E3', 'FFFFFF', '000000', 'left', 1, '', 'before', 1, 'Prijs: ', 70, '400', '80', 0, 'E86400', 'FFFFFF', 'FFFFFF', '0', 0, 1, 000000, FFFFFF, 'Klik hier om meer producten te laden'), (2, 'Tegelweergave (voorbeeld 2)', 'CEC9D1', 'FFFFFF', '000000', 'center', 1, '', 'before', 1, '', 50, '100', '300', 0, 'FA8F02', '332B1F', 'FFFFFF', '1', 1, 1, 000000, FFFFFF, 'Klik hier om meer producten te laden');"); echo '

'.__('De voorbeeld stylesheets zijn gedownload! Deze zijn te vinden onder de namen Tabelweergave en Tegelweergave.','DaisyconPlugin').'

'; } $view = self::adminStyleView(); echo $view; } public function adminActiecodes(){ global $wpdb; if(isset($_POST['updateactiecodes'])){ include('cron/importActioncodes.php'); $date = date("Y-m-d H:i:s"); $wpdb->update('publisher', array('actioncode_date' => $date), array('daisycon_id' => '1')); } $view = self::adminActiecodesView(); echo $view; } public function adminStyleView(){ global $wpdb; $publisher = $wpdb->get_row("SELECT * FROM publisher"); $wi = explode('/media/', $publisher->feed); $wi = explode('/', $wi[1]); $height = "150"; $width = "400"; $name = ""; $view = "0"; $float = "1"; $background = ""; $border = ""; $text = ""; $size = "70"; $align = "center"; $store = ""; $store_before = ""; $button_store = "disabled"; $button_color = ""; $button_border_color = ""; $button_text_color = ""; $price = ""; $price_button = ""; $price_before = ""; $store_button_program = ""; $result = $wpdb->get_row("SELECT * FROM products ORDER BY RAND()"); if(isset($_POST['save'])){ $stylesheet_id = $_POST['stylesheet']; $name = $_POST['name']; $bordercolor = $_POST['border']; $backgroundcolor = $_POST['background']; $textcolor = $_POST['textcolor']; $align = $_POST['align']; $store = $_POST['store']; $price = $_POST['price']; $view = $_POST['view']; $size = $_POST['size']; $width = $_POST['width']; $height = $_POST['height']; $store_before = $_POST['before_store']; $price_before = $_POST['before-price']; $button_store = $_POST['button_store_']; $buttoncolor = $_POST['buttoncolor']; $buttonbordercolor = $_POST['buttonbordercolor']; $buttontextcolor = $_POST['buttontextcolor']; $float = $_POST['float']; $price_button = $_POST['price_button']; $store_button_program = $_POST['store_button_program']; $moreproducts_color = $_POST['moreproducts_color']; $moreproducts_text = $_POST['moreproducts_text']; $moreproducts_font = $_POST['moreproducts_font']; }elseif(isset($_POST['load'])){ $stylesheet_id = $_POST['stylesheet']; if(!empty($stylesheet_id)){ $Asheet = $wpdb->get_row("SELECT * FROM stylesheets WHERE stylesheet_id = '".$stylesheet_id."'"); $name = $Asheet->name; $background = $Asheet->backgroundcolor; $border = $Asheet->bordercolor; $text = $Asheet->textcolor; $view = $Asheet->view; $float = $Asheet->float; $size = $Asheet->size; $width = $Asheet->width; $height = $Asheet->height; $align = $Asheet->align; $store = $Asheet->store; $store_before = $Asheet->store_before; $price = $Asheet->price; $price_before = $Asheet->price_before; $price_button = $Asheet->price_button; $button_store = $Asheet->button_store; $button_color = $Asheet->buttoncolor; $button_border_color = $Asheet->buttonbordercolor; $button_text_color = $Asheet->buttontextcolor; $store_button_program = $Asheet->store_button_program; $moreproducts_text = $Asheet->moreproducts_text; $moreproducts_color = $Asheet->moreproducts_color; $moreproducts_font = $Asheet->moreproducts_font; } } if (isset($_POST['load'])){ if($Asheet->width == NULL){ $Asheet->width = 400; } if($Asheet->height == NULL){ $Asheet->height = 150; } if($Asheet->size == NULL){ $Asheet->size = 70; } echo' '; } $output = ' '; $Asheets = $wpdb->get_results("SELECT * FROM stylesheets"); $output .= '

'.( 'Stylesheets' ).'

'.__('Door middel van Stylesheets is het mogelijk om de output van de shorttags aan te passen naar eigen voorkeur. Bij het maken en wijzigen van de stylesheets zullen de wijzigingen in de vorm van een preview zichtbaar worden.','DaisyconPlugin').'
'; $output .= '
'.__('Kom je er even niet meer uit? Klik op de button om alle stylesheets te verwijderen en de voorbeeld stylesheets opnieuw te laden:','DaisyconPlugin').'

'.__('We raden je aan om de voorbeeld stylesheets te gebruiken, en aan te passen naar je voorkeur.','DaisyconPlugin').'

 
'.__('Selecteer een stylesheet...','DaisyconPlugin').'
'; if(isset($_POST['load'])){ $output .= ' '; if(empty($stylesheet_id)){ $output .= ' '; }else{ $output .= ' '; } $output .= ' '; $output .= '
'.__('Naam nieuwe stylesheet','DaisyconPlugin').'
'.__('Je bewerkt nu:','DaisyconPlugin').' '.$name.'
Design
'.__('Float (naast elkaar of onder elkaar)','DaisyconPlugin').'
'.__('Border','DaisyconPlugin').'
'.__('Tekstkleur','DaisyconPlugin').'
'.__('Hoogte in pixels (tabel)','DaisyconPlugin').'
'.__('Breedte in pixels (tabel)','DaisyconPlugin').'
'.__('Grootte product image in pixels','DaisyconPlugin').'
'.__('Uitlijnen / align','DaisyconPlugin').'
'.__('Instellingen','DaisyconPlugin').'
'.__('Adverteerder logo tonen','DaisyconPlugin').'
'.__('Button om linktekst heen zetten','DaisyconPlugin').'
'.__('Button borderkleur','DaisyconPlugin').'
'.__('Button tekstkleur','DaisyconPlugin').'
'.__('Prijs','DaisyconPlugin').'
'.__('Prijs tonen (ja/nee)','DaisyconPlugin').'
'.__('Meer producten tonen button (optioneel)','DaisyconPlugin').'
'.__('Button kleur','DaisyconPlugin').'
'.__('Button testkleur','DaisyconPlugin').'
'.__('Button tekst','DaisyconPlugin').'
'; if($Asheet->view == 0){ $output .= ''; } $output .= '
    '.__('Hier komt het voorbeeld van de stylesheet','DaisyconPlugin').'

'; } return($output); } public function adminActiecodesView(){ global $wpdb; $publisher = $wpdb->get_row("SELECT * FROM publisher"); $wi = explode('/media/', $publisher->feed); $wi = explode('/', $wi[1]); wp_enqueue_script('tablesorter', plugins_url('/files/js/jquery.tablesorter.min.js',__FILE__) ); wp_enqueue_script('functions', plugins_url('/files/js/functions.js',__FILE__) ); echo '

'.__('Actiecodes','DaisyconPlugin').'

'.__('Plak de shorttag(s) in een pagina of blogpost. De actiecode wordt vervolgens automatisch op deze pagina getoond. Klik hier om in te stellen wat er moet gebeuren als een actiecode verlopen is.','DaisyconPlugin').'

'; $Actioncodefeed = $wpdb->get_row("SELECT * FROM publisher"); $Actioncodefeed = $wpdb->get_row("SELECT * FROM publisher"); $rActioncodes = $wpdb->get_results("SELECT * FROM actioncodes"); if(strlen($Actioncodefeed->actiecodefeed) > 0){ echo '
'; if($Actioncodefeed->program_date != '0000-00-00 00:00:00' && $Actioncodefeed->actioncode_date == '0000-00-00 00:00:00' && count($rActioncodes) == 0){ $output .= ' '.__('Druk op de button om de actiecodes waarbij je bent aangemeld op te halen.','DaisyconPlugin').' '; }elseif($Actioncodefeed->actioncode_date != '0000-00-00 00:00:00' && count($rActioncodes) > 0){ $output .= ' '.__('Laatste update','DaisyconPlugin').': '.self::makeDate($Actioncodefeed->actioncode_date).' '; }elseif($Actioncodefeed->actioncode_date != '0000-00-00 00:00:00' && count($rActioncodes) == 0){ $output .= ' '.__('Geen actiecodes gevonden bij de opgehaalde programma's.','DaisyconPlugin').' '; }else{ $output .= ' '.__('Haal eerst je programma's op.','DaisyconPlugin').' '; } }else{ $output .= ''.__('Sla eerst je actiecodelijst op!','DaisyconPlugin').''; } echo $output; echo ''; $Aactiecodes = $wpdb->get_results("SELECT * FROM actioncodes INNER JOIN programs ON actioncodes.program_id = programs.program_id ORDER BY actioncodes.date_end DESC"); echo '

'; foreach($Aactiecodes as $Ractie){ if($Ractie->date_end == "0000-00-00"){ $date_end = __('Geen einddatum'); }else{ $date_end = $Ractie->date_end; } $ex = explode('-', $Ractie->date_end); echo ' '; } echo '
'.__('Adverteerder','DaisyconPlugin').' '.__('Omschrijving','DaisyconPlugin').' '.__('Geldig van','DaisyconPlugin').' '.__('Geldig tot','DaisyconPlugin').' '.__('Actiecode','DaisyconPlugin').' '.__('Shorttag','DaisyconPlugin').'
date_end != "0000-00-00"){echo ' style="color:#CC0000"';} echo'> '.$Ractie->name.''; echo ' date_end != "0000-00-00"){echo ' style="color:#CC0000"';} echo'> '.$Ractie->actioncode_title.' date_end != "0000-00-00"){echo ' style="color:#CC0000"';} echo'> '.$Ractie->date_start.' date_end != "0000-00-00"){echo ' style="color:#CC0000"';} echo'> '.$date_end.' date_end != "0000-00-00"){echo ' style="color:#CC0000"';} echo'> '.$Ractie->actioncode.' date_end != "0000-00-00"){echo ' style="color:#CC0000"';} echo'>
[daisycon_actioncode id='.$Ractie->actioncode_id.']
'; if(isset($_POST['updateactiecodes'])){ $date = date("Y-m-d H:i:s"); $wpdb->update('publisher', array('actioncode_date' => $date), array('daisycon_id' => '1')); include('cron/importActioncodes.php'); } } public function adminGetFeeds(){ $view = self::adminGetFeedsView(); echo $view; } public function adminAccountDetailsView(){ global $wpdb; wp_enqueue_script('functions', plugins_url('/files/js/functions.js',__FILE__) ); $rFeeds = $wpdb->get_row("SELECT * FROM publisher"); $rPrograms = $wpdb->get_results("SELECT * FROM programs"); $rActioncodes = $wpdb->get_results("SELECT * FROM actioncodes"); if(strlen($rFeeds->feed) > 0 && strlen($rFeeds->programsproductfeed) > 0){ if (isset($_POST['toevoegen'])){ echo ''; }else{ $output = '
'.__('Stap 3: Alles ophalen!','DaisyconPlugin').'
'; if(strlen($rFeeds->feed) > 0 && strlen($rFeeds->programsproductfeed) > 0){ if($rFeeds->program_date == '0000-00-00 00:00:00' && count($rPrograms) == 0){ $output .= ' '.__('Druk op de button om de programma‘s waarbij je bent aangemeld op te halen.','DaisyconPlugin').' '; }elseif($rFeeds->program_date != '0000-00-00 00:00:00' && count($rPrograms) > 0){ $output .= ' '.__('Laatste update:','DaisyconPlugin').' '.self::makeDate($rFeeds->program_date).' '; }else{ $output .= ' '.__('Nog niet opgehaald.','DaisyconPlugin').' '; } }else{ $output .= __('Sla eerst je programmalijst en productlijst op!'); } $output .= '
'; if(strlen($rFeeds->actiecodefeed) > 0){ if($rFeeds->program_date != '0000-00-00 00:00:00' && $rFeeds->actioncode_date == '0000-00-00 00:00:00' && count($rActioncodes) == 0){ $output .= ' '.__('Druk op de button om de actiecodes waarbij je bent aangemeld op te halen.','DaisyconPlugin').' '; }elseif($rFeeds->actioncode_date != '0000-00-00 00:00:00' && count($rActioncodes) > 0){ $output .= ' '.__('Laatste update:','DaisyconPlugin').' '.self::makeDate($rFeeds->actioncode_date).' '; }elseif($rFeeds->actioncode_date != '0000-00-00 00:00:00' && count($rActioncodes) == 0){ $output .= ' '.__('Geen actiecodes gevonden bij de opgehaalde programma's.','DaisyconPlugin').' '; }else{ $output .= ' '.__('Haal eerst je programma's op.','DaisyconPlugin').' '; } }else{ $output .= __('Sla eerst je actiecodelijst op!'); } $output .= '
'; if(strlen($rFeeds->feed) > 0 && strlen($rFeeds->programsproductfeed) > 0){ if($rFeeds->program_date != '0000-00-00 00:00:00'){ $output .= '
'.__('Druk op de button om alle producten van de programma‘s op te halen (Let op: dit kan enkele uren duren).','DaisyconPlugin').' '; }else{ $output .= ' '.__('Haal eerst je programma's op.','DaisyconPlugin').' '; } }else{ $output .= __('Sla eerst je programmalijst en productlijst op!'); } $output .= '

 

'; $output .= '
'.__('Optionele instellingen','DaisyconPlugin').'
'.__('Verlopen actiecodes weergeven','DaisyconPlugin').' [?]
'.__('eCPC voor programmalijst gebruiken JA / NEE (Nadat je dit hebt aangevinkt moet je opnieuw de programma's ophalen.)','DaisyconPlugin').' [?] api == "1"){ $output .= ' checked';} $output .=' />
'.__('Automatisch links omzetten naar Daisycon affiliatelinks','DaisyconPlugin').' subid == "1"){ $output .= ' checked';} $output .=' style="margin-right: 10px;">'.__('Lees info','DaisyconPlugin').'
'.__('Sneller producten ophalen? Hier kunt u de time-out verkorten. Let op! Dit is alleen voor snelle servers en op eigen risico.','DaisyconPlugin').' [?]
'; $output .= '
'; if(strlen($rFeeds->feed) > 0 && strlen($rFeeds->programsproductfeed) > 0){ $output .= '

'.__('Wil je opnieuw beginnen? Klik alleen op de volgende button als je terug wilt gaan naar de begininstellingen:','DaisyconPlugin').'
'; } } } return($output); } public function adminGetFeedsView(){ global $wpdb; $publisher = $wpdb->get_row("SELECT * FROM publisher"); $wi = explode('/media/', $publisher->feed); $wi = explode('/', $wi[1]); echo ''; wp_enqueue_script('functions', plugins_url('/files/js/functions.js',__FILE__) ); wp_enqueue_script('tiptip', plugins_url('/files/js/jquery.tipTip.minified.js',__FILE__) ); //require('files/languages/fr.php'); $rFeeds = $wpdb->get_row("SELECT * FROM publisher"); echo '

 

 

'; _e('

Starten met de Daisycon plugin

', 'DaisyconPlugin'); echo '
'.__('intro-text', 'DaisyconPlugin').'
'; $rFeeds = $wpdb->get_row("SELECT * FROM publisher LIMIT 1"); if((strlen($rFeeds->feed) == 0 || strlen($rFeeds->programsproductfeed) == 0) || (isset($_POST['toevoegen']) && empty($jsonData))){ echo '
'.__('Stap 1: Daisycon gegevens','DaisyconPlugin').'
'. __('E-mail', 'DaisyconPlugin').'
'.__('Wachtwoord publisheraccount','DaisyconPlugin').'

'; } $rFeeds = $wpdb->get_row("SELECT * FROM publisher LIMIT 1"); if(strlen($rFeeds->feed) > 0 && strlen($rFeeds->programsproductfeed) > 0){ if($_POST['toevoegen']){ echo ''; } }else{ echo ''; } echo ' '; $test = self::adminAccountDetailsView(); echo $test; } } ?>