| @@ -2,13 +2,13 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Taboola |
| 4 | 4 | * Plugin URI: https://developers.taboola.com/web-integrations/discuss |
| 5 | 5 | * Description: Taboola |
| 6 | - * Version: 2.0.2 | |
| 6 | + * Version: 2.0.1 | |
| 7 | 7 | * Author: Taboola |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -define ("TABOOLA_PLUGIN_VERSION","2.0.2"); // => UPDATE FOR *EVERY* RELEASE (USED FOR TRACKING) | |
| 10 | +define ("TABOOLA_PLUGIN_VERSION","2.0.1"); // => UPDATE FOR *EVERY* RELEASE (USED FOR TRACKING) | |
| 11 | 11 | define ("TABOOLA_MIN_VER","2.0.1"); // => UPDATE *ONLY* IF THIS RELEASE HAS *DB CHANGES* |
| 12 | 12 | define ("TABOOLA_DEBUG_MODE", false); // => SET TO 'FALSE' FOR *EVERY* RELEASE (USED TO SUPRESS DEBUGGING LOGS) |
| 13 | 13 | |
| 14 | 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'. |
| @@ -23,9 +23,8 @@ | ||
| 23 | 23 | |
| 24 | 24 | include_once('widget.php'); |
| 25 | 25 | require_once('JavaScriptWrapper.php'); |
| 26 | 26 | |
| 27 | - | |
| 28 | 27 | if (!class_exists('TaboolaWP')) { |
| 29 | 28 | class TaboolaWP |
| 30 | 29 | { |
| 31 | 30 | //save internal data |
| @@ -140,10 +139,9 @@ | ||
| 140 | 139 | $head_string = ""; |
| 141 | 140 | |
| 142 | 141 | // Only adding the loader if a widget is going to be placed on the page. |
| 143 | 142 | if ($this->is_widget_on_page()){ |
| 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. | |
| 143 | + | |
| 146 | 144 | $stringParams = array( |
| 147 | 145 | '{{PUBLISHER_ID}}' => $this->settings->publisher_id, |
| 148 | 146 | '{{PAGE_TYPE}}' => $this->get_page_type(), |
| 149 | 147 | '{{WORDPRESS_VERSION}}' => get_bloginfo('version'), |
| @@ -441,9 +439,8 @@ | ||
| 441 | 439 | add_menu_page('Taboola', 'Taboola', 'manage_options', 'taboola_widget', array(&$this, 'admin_taboola_settings'), $this->plugin_url.'img/taboola_icon.png', 110); |
| 442 | 440 | } |
| 443 | 441 | |
| 444 | 442 | function admin_taboola_settings(){ |
| 445 | - | |
| 446 | 443 | global $wpdb; |
| 447 | 444 | $settings = $wpdb->get_row("select * from ".$wpdb->prefix."_taboola_settings limit 1"); |
| 448 | 445 | $taboola_errors = array(); |
| 449 | 446 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
| @@ -544,23 +541,13 @@ | ||
| 544 | 541 | "home_location_string" => !empty($_POST['home_location_string']) ? trim($_POST['home_location_string']) : '' |
| 545 | 542 | ); |
| 546 | 543 | |
| 547 | 544 | //var_dump($settings); |
| 548 | - | |
| 549 | - $is_valid_nonce = false; | |
| 550 | - | |
| 551 | - if (isset( $_POST['my_plugin_nonce']) && wp_verify_nonce( $_POST['my_plugin_nonce'], 'my_plugin_update_field_action' ) ) { | |
| 552 | - $is_valid_nonce = true; | |
| 545 | + if($settings == NULL){ | |
| 546 | + $wpdb->insert($this->tbl_taboola_settings, $data, null, null); | |
| 547 | + } else { | |
| 548 | + $wpdb->update($this->tbl_taboola_settings, $data, array('id' => $settings->id)); | |
| 553 | 549 | } |
| 554 | - | |
| 555 | - if ($is_valid_nonce) { | |
| 556 | - if($settings == NULL){ | |
| 557 | - $wpdb->insert($this->tbl_taboola_settings, $data, null, null); | |
| 558 | - } else { | |
| 559 | - $wpdb->update($this->tbl_taboola_settings, $data, array('id' => $settings->id)); | |
| 560 | - } | |
| 561 | - } | |
| 562 | - | |
| 563 | 550 | } |
| 564 | 551 | $settings = $wpdb->get_row("select * from ".$wpdb->prefix."_taboola_settings limit 1"); |
| 565 | 552 | } |
| 566 | 553 | |
| @@ -680,9 +667,9 @@ | ||
| 680 | 667 | } |
| 681 | 668 | } |
| 682 | 669 | |
| 683 | 670 | function update_db(){ |
| 684 | - | |
| 671 | + | |
| 685 | 672 | // If we are up to date, then skip this method... |
| 686 | 673 | if ($this->is_db_updated_for_min_ver(TABOOLA_MIN_VER)) { |
| 687 | 674 | //tb_write_log("All up to date!"); |
| 688 | 675 | return; |