| @@ -1,18 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Taboola |
| 4 | - * Plugin URI: https://developers.taboola.com/web-integrations/discuss | |
| 4 | + * Plugin URI: https://developers.taboola.com/web-integrations/docs/wordpress-plugin | |
| 5 | 5 | * Description: Taboola |
| 6 | - * Version: 2.0.2 | |
| 6 | + * Version: 2.1.0 | |
| 7 | 7 | * Author: Taboola |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -define ("TABOOLA_PLUGIN_VERSION","2.0.2"); // => UPDATE FOR *EVERY* RELEASE (USED FOR TRACKING) | |
| 11 | -define ("TABOOLA_MIN_VER","2.0.1"); // => UPDATE *ONLY* IF THIS RELEASE HAS *DB CHANGES* | |
| 12 | -define ("TABOOLA_DEBUG_MODE", false); // => SET TO 'FALSE' FOR *EVERY* RELEASE (USED TO SUPRESS DEBUGGING LOGS) | |
| 10 | +define ("TABOOLA_PLUGIN_VERSION","2.1.0"); // => UPDATE THIS FOR *EVERY* RELEASE (USED FOR TRACKING) | |
| 11 | +define ("TABOOLA_MIN_VER","2.0.1"); // => UPDATE THIS *ONLY* IF THIS RELEASE HAS *DB CHANGES* | |
| 12 | +define ("TABOOLA_DEBUG_MODE", false); // => SET THIS TO 'FALSE' FOR *EVERY* RELEASE (USED TO SUPRESS DEBUGGING LOGS) | |
| 13 | 13 | |
| 14 | -define ("TABOOLA_OPTION_NAME","taboola_plugin_version"); // *If* this release has DB changes, then the min version will be saved under 'taboola_plugin_version' in 'wp_options'. | |
| 14 | +define ("TABOOLA_OPTION_NAME","taboola_plugin_version"); // Note: if this release has DB changes, then the min version will be saved under 'taboola_plugin_version' in 'wp_options'. | |
| 15 | 15 | |
| 16 | 16 | define ("TABOOLA_XPATH_MARKER","/"); |
| 17 | 17 | define ("TABOOLA_JS_INDICATOR","{JS}"); |
| 18 | 18 | define ("TABOOLA_JS_MARKER","{"); |
| @@ -141,9 +141,9 @@ | ||
| 141 | 141 | |
| 142 | 142 | // Only adding the loader if a widget is going to be placed on the page. |
| 143 | 143 | if ($this->is_widget_on_page()){ |
| 144 | 144 | // PC - since these params will be inserted in 'loaderInjectionScript.js' via search and replace, |
| 145 | - // double brackets are used to ensure that each key is a unique string. | |
| 145 | + // double brackets are used to ensure that each key is a unique string. | |
| 146 | 146 | $stringParams = array( |
| 147 | 147 | '{{PUBLISHER_ID}}' => $this->settings->publisher_id, |
| 148 | 148 | '{{PAGE_TYPE}}' => $this->get_page_type(), |
| 149 | 149 | '{{WORDPRESS_VERSION}}' => get_bloginfo('version'), |
| @@ -447,29 +447,29 @@ | ||
| 447 | 447 | $settings = $wpdb->get_row("select * from ".$wpdb->prefix."_taboola_settings limit 1"); |
| 448 | 448 | $taboola_errors = array(); |
| 449 | 449 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
| 450 | 450 | |
| 451 | - if(trim($_POST['publisher_id']) == ''){ | |
| 451 | + if(trim(strip_tags($_POST['publisher_id'])) == ''){ | |
| 452 | 452 | $taboola_errors[] = "Publisher ID"; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | if(isset($_POST['first_bc_enabled'])) { |
| 456 | - if (trim($_POST['first_bc_widget_id']) == '') { | |
| 456 | + if (trim(strip_tags($_POST['first_bc_widget_id'])) == '') { | |
| 457 | 457 | $taboola_errors[] = "Below-article > Widget ID"; |
| 458 | 458 | } |
| 459 | - if (trim($_POST['first_bc_placement']) == '') { | |
| 459 | + if (trim(strip_tags($_POST['first_bc_placement'])) == '') { | |
| 460 | 460 | $taboola_errors[] = "Below-article > Placement Name"; |
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | if(isset($_POST['mid_enabled'])) { |
| 465 | - if (trim($_POST['mid_widget_id']) == '') { | |
| 465 | + if (trim(strip_tags($_POST['mid_widget_id'])) == '') { | |
| 466 | 466 | $taboola_errors[] = "Mid-article > Widget ID"; |
| 467 | 467 | } |
| 468 | - if (trim($_POST['mid_placement']) == '') { | |
| 468 | + if (trim(strip_tags($_POST['mid_placement'])) == '') { | |
| 469 | 469 | $taboola_errors[] = "Mid-article > Placement Name"; |
| 470 | 470 | } |
| 471 | - if (trim($_POST['mid_location_string']) == '') { | |
| 471 | + if (trim(strip_tags($_POST['mid_location_string'])) == '') { | |
| 472 | 472 | $taboola_errors[] = "Mid-article > CSS selector"; |
| 473 | 473 | } |
| 474 | 474 | else { |
| 475 | 475 | // If the 'location' WAS filled in, then... |
| @@ -489,16 +489,16 @@ | ||
| 489 | 489 | |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | if(isset($_POST['home_enabled'])) { |
| 493 | - if (trim($_POST['home_widget_id']) == '') { | |
| 493 | + if (trim(strip_tags($_POST['home_widget_id'])) == '') { | |
| 494 | 494 | $taboola_errors[] = "Homepage > Widget ID"; |
| 495 | 495 | } |
| 496 | - if (trim($_POST['home_placement']) == '') { | |
| 496 | + if (trim(strip_tags($_POST['home_placement'])) == '') { | |
| 497 | 497 | $taboola_errors[] = "Homepage > Placement Name"; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if (trim($_POST['home_location_string']) == '') { | |
| 500 | + if (trim(strip_tags($_POST['home_location_string'])) == '') { | |
| 501 | 501 | $taboola_errors[] = "Homepage > CSS selector"; |
| 502 | 502 | } |
| 503 | 503 | else { |
| 504 | 504 | // If the 'location' WAS filled in, then... |
| @@ -694,9 +694,9 @@ | ||
| 694 | 694 | require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 695 | 695 | |
| 696 | 696 | |
| 697 | 697 | //check mysql version |
| 698 | - if (function_exists('mysql_get_server_info') && version_compare(mysql_get_server_info(), '4.1.0', '>=')) { | |
| 698 | + if (function_exists('mysqli_get_server_info') && version_compare(mysqli_get_server_info(), '4.1.0', '>=')) { | |
| 699 | 699 | if (!empty($wpdb->charset)) |
| 700 | 700 | $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
| 701 | 701 | if (!empty($wpdb->collate)) |
| 702 | 702 | $charset_collate .= " COLLATE $wpdb->collate"; |