| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Taboola |
| 4 | - * Plugin URI: http://taboola.com | |
| 4 | + * Plugin URI: https://developers.taboola.com/web-integrations/discuss | |
| 5 | 5 | * Description: Taboola |
| 6 | - * Version: 1.0.11 | |
| 6 | + * Version: 1.0.15 | |
| 7 | 7 | * Author: Taboola |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | define ("XPATH_MARKER","/"); |
| @@ -12,9 +12,9 @@ | ||
| 12 | 12 | define ("JS_MARKER","{"); |
| 13 | 13 | define ("TABOOLA_CONTENT_FORMAT_STRING",'string'); |
| 14 | 14 | define ("TABOOLA_CONTENT_FORMAT_SCRIPT",'script'); |
| 15 | 15 | define ("TABOOLA_CONTENT_FORMAT_HTML",'html'); |
| 16 | -define ("TABOOLA_PLUGIN_VERSION","1.0.11"); | |
| 16 | +define ("TABOOLA_PLUGIN_VERSION","1.0.15"); | |
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | include_once('widget.php'); |
| 20 | 20 | require_once('JavaScriptWrapper.php'); |
| @@ -57,9 +57,9 @@ | ||
| 57 | 57 | } |
| 58 | 58 | ); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $this->should_place_tag_outside_of_content = $this->settings->out_of_content_enabled; | |
| 61 | + //$this->should_place_tag_outside_of_content = $this->settings->out_of_content_enabled; | |
| 62 | 62 | |
| 63 | 63 | if (is_admin()) { |
| 64 | 64 | //add menu for plugin |
| 65 | 65 | add_action( 'admin_menu', array(&$this, 'admin_generate_menu') ); |
| @@ -127,9 +127,11 @@ | ||
| 127 | 127 | $stringParams = array( |
| 128 | 128 | '{{PUBLISHER_ID}}' => $this->settings->publisher_id, |
| 129 | 129 | '{{PAGE_TYPE}}' => $this->get_page_type(), |
| 130 | 130 | '{{WORDPRESS_VERSION}}' => get_bloginfo('version'), |
| 131 | - '{{PLUGIN_VERSION}}' => TABOOLA_PLUGIN_VERSION | |
| 131 | + '{{PHP_VERSION}}' => phpversion(), | |
| 132 | + '{{PLUGIN_VERSION}}' => TABOOLA_PLUGIN_VERSION, | |
| 133 | + '{{LOCATION}}' => $this->settings->location_string | |
| 132 | 134 | ); |
| 133 | 135 | |
| 134 | 136 | $scriptWrapper = new JavaScriptWrapper("loaderInjectionScript.js",$stringParams); |
| 135 | 137 | $head_string = $scriptWrapper->getScripMarkupString(); |
| @@ -233,9 +235,9 @@ | ||
| 233 | 235 | |
| 234 | 236 | $do_default = false; |
| 235 | 237 | } |
| 236 | 238 | |
| 237 | - // server side selector provided (see simple_html_dom selectors http://simplehtmldom.sourceforge.net/manual.htm) | |
| 239 | + // server side selector provided (see simple_html_dom selectors https://simplehtmldom.sourceforge.net/manual.htm) | |
| 238 | 240 | // basically it's CSS selectors like in jQuery |
| 239 | 241 | } else{ |
| 240 | 242 | |
| 241 | 243 | require_once('simple_html_dom.php'); |
| @@ -253,9 +255,9 @@ | ||
| 253 | 255 | } |
| 254 | 256 | } |
| 255 | 257 | |
| 256 | 258 | // tag is placed outside of content in order to allow "read more" functionality. |
| 257 | - }elseif ($this->should_place_tag_outside_of_content){ | |
| 259 | + }elseif ($this->settings->out_of_content_enabled){ | |
| 258 | 260 | |
| 259 | 261 | $scriptWrapper = new JavaScriptWrapper("js_inject.min.js",array( |
| 260 | 262 | "{{HTML}}" => $this->format_taboola_content($taboola_content,TABOOLA_CONTENT_FORMAT_HTML), |
| 261 | 263 | "{{SCRIPT}}" => $this->format_taboola_content($taboola_content,TABOOLA_CONTENT_FORMAT_SCRIPT)) |
| @@ -287,10 +289,10 @@ | ||
| 287 | 289 | |
| 288 | 290 | if(trim($_POST['publisher_id']) == ''){ |
| 289 | 291 | $taboola_errors[] = "Please add a 'Publisher ID' in order to apply changes to your widgets"; |
| 290 | 292 | } |
| 291 | - if(($_POST['first_bc_enabled'] == 'on' && trim($_POST['first_bc_widget_id']) == '') || | |
| 292 | - ($_POST['second_bc_enabled'] == 'on' && trim($_POST['second_bc_widget_id']) == '') | |
| 293 | + if((isset($_POST['first_bc_enabled']) && trim($_POST['first_bc_widget_id']) == '') || | |
| 294 | + (isset($_POST['second_bc_enabled']) && trim($_POST['second_bc_widget_id']) == '') | |
| 293 | 295 | ){ |
| 294 | 296 | $taboola_errors[] = "Please add a 'Widget ID' in order to apply changes to your widgets"; |
| 295 | 297 | } |
| 296 | 298 | if (trim($_POST['location_string']) != '' && !$this->is_location_string_valid($_POST['location_string'])){ |
| @@ -299,14 +301,14 @@ | ||
| 299 | 301 | if(count($taboola_errors) == 0){ |
| 300 | 302 | |
| 301 | 303 | $data = array( |
| 302 | 304 | "publisher_id" => trim($_POST['publisher_id']), |
| 303 | - "first_bc_enabled" => $_POST['first_bc_enabled'] == 'on' ? true : false, | |
| 305 | + "first_bc_enabled" => isset($_POST['first_bc_enabled']) ? true : false, | |
| 304 | 306 | "first_bc_widget_id" => trim($_POST['first_bc_widget_id']), |
| 305 | - "second_bc_enabled" => $_POST['second_bc_enabled'] == 'on' ? true : false, | |
| 307 | + "second_bc_enabled" => isset($_POST['second_bc_enabled']) ? true : false, | |
| 306 | 308 | "second_bc_widget_id" => trim($_POST['second_bc_widget_id']), |
| 307 | 309 | "location_string" => trim($_POST['location_string']), |
| 308 | - "out_of_content_enabled" => $_POST['out_of_content_enabled'] == 'on' ? true : false | |
| 310 | + "out_of_content_enabled" => isset($_POST['out_of_content_enabled']) ? true : false | |
| 309 | 311 | ); |
| 310 | 312 | |
| 311 | 313 | //var_dump($settings); |
| 312 | 314 | if($settings == NULL){ |