Ad Inserter – WordPress Ads Management with AdSense Header Integration - Version 2.3.16

Version Description

  • Added option to insert block only when WP loop is currently active
  • Added support for Better AMP plugin
  • Code generator for placeholders on https sites now generates https urls
  • Optimized loading of plugin settings
  • Few minor bug fixes, cosmetic changes and code improvements
Download this release

Release Info

Developer spacetime
Plugin Icon 128x128 Ad Inserter – WordPress Ads Management with AdSense Header Integration
Version 2.3.16
Comparing to
See all releases

Code changes from version 2.3.15 to 2.3.16

ad-inserter.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
- Version: 2.3.15
6
  Description: Ad management plugin with advanced advertising options to automatically insert ad codes on your website
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
@@ -13,6 +13,13 @@ Plugin URI: http://adinserter.pro/documentation
13
 
14
  Change Log
15
 
 
 
 
 
 
 
 
16
  Ad Inserter 2.3.15 - 2018-07-18
17
  - Fix for insertion on AMP pages
18
 
@@ -648,6 +655,7 @@ require_once AD_INSERTER_PLUGIN_DIR.'class.php';
648
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
649
  require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
650
 
 
651
  $version_array = explode (".", AD_INSERTER_VERSION);
652
  $version_string = "";
653
  foreach ($version_array as $number) {
@@ -677,6 +685,7 @@ $ai_wp_data [AI_DISABLE_CACHING] = false;
677
  $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = false;
678
  $ai_wp_data [AI_LAZY_LOADING] = false;
679
  $ai_wp_data [AI_PAGE_BLOCKS] = 0;
 
680
 
681
  ai_load_settings ();
682
 
@@ -743,10 +752,10 @@ if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC) {
743
  }
744
 
745
 
746
- $adH = $block_object [AI_HEADER_OPTION_NAME];
747
- $adF = $block_object [AI_FOOTER_OPTION_NAME];
748
- if ($adH->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
749
- if ($adF->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
750
 
751
  if ($ai_wp_data [AI_SERVER_SIDE_DETECTION]) {
752
  require_once AD_INSERTER_PLUGIN_DIR.'includes/Mobile_Detect.php';
@@ -868,7 +877,8 @@ function ai_toolbar_menu_items () {
868
  $debug_settings_on = $debug_blocks == 0 || $debug_positions === '' || $debug_tags == 0 || $debug_processing == 0 || $debug_no_insertion == 0 || $debug_ad_blocking == 0 || $debug_ad_blocking_status == 0;
869
 
870
  $debug_settings_class = $debug_settings_on ? ' on' : '';
871
- $top_menu_url = $debug_settings_on ? add_query_arg (AI_URL_DEBUG, '0', remove_debug_parameters_from_url ()) :
 
872
  add_query_arg (array (AI_URL_DEBUG_BLOCKS => '1', AI_URL_DEBUG_POSITIONS => '0'), remove_debug_parameters_from_url ());
873
 
874
  $ai_wp_data [AI_DEBUG_MENU_ITEMS][] = array (
@@ -879,7 +889,7 @@ function ai_toolbar_menu_items () {
879
  $ai_wp_data [AI_DEBUG_MENU_ITEMS][] = array (
880
  'id' => 'ai-toolbar-settings',
881
  // 'parent' => 'ai-toolbar',
882
- 'title' => '<span class="ab-icon'.$debug_settings_class.'"></span>'.AD_INSERTER_NAME . ($debug_settings_on ? ' Debugging' : ''),
883
  'href' => $top_menu_url,
884
  // 'meta' => $debug_settings_on ? array ('title' => 'Turn Debugging Off') : array (),
885
  );
@@ -902,7 +912,7 @@ function ai_toolbar_menu_items () {
902
  for ($block = 0; $block <= AD_INSERTER_BLOCKS; $block ++) {
903
  $obj = $block_object [$block];
904
  $automatic_insertion = $obj->get_automatic_insertion();
905
- if ($block == 0 || $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH || $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH) {
906
 
907
  $block_tags = trim ($block_object [$block]->get_paragraph_tags ());
908
  $direction = $block_object [$block]->get_direction_type() == AD_DIRECTION_FROM_TOP ? 't' : 'b';
@@ -994,12 +1004,14 @@ function ai_toolbar_menu_items () {
994
  }
995
  }
996
 
997
- $ai_wp_data [AI_DEBUG_MENU_ITEMS][] = array (
998
- 'id' => 'ai-toolbar-processing',
999
- 'parent' => 'ai-toolbar-settings',
1000
- 'title' => '<span class="ab-icon'.$debug_processing_class.'"></span>Log Processing',
1001
- 'href' => set_url_parameter (AI_URL_DEBUG_PROCESSING, $debug_processing),
1002
- );
 
 
1003
  }
1004
 
1005
  function ai_toolbar ($wp_admin_bar) {
@@ -1050,7 +1062,10 @@ function set_page_type () {
1050
  isset ($_GET ['wpamp']) ||
1051
 
1052
  // WP AMP - Accelerated Mobile Pages for WordPress
1053
- function_exists ('is_wp_amp') && is_wp_amp ()
 
 
 
1054
  ) {
1055
  $ai_wp_data [AI_WP_AMP_PAGE] = true;
1056
  define ('AI_AMP_PAGE', true);
@@ -1176,10 +1191,14 @@ function ai_log ($message = "") {
1176
  }
1177
 
1178
  function remove_debug_parameters_from_url ($url = false) {
1179
- if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
1180
- $parameters = array (AI_URL_DEBUG, AI_URL_DEBUG_PROCESSING, AI_URL_DEBUG_BLOCKS, AI_URL_DEBUG_USER, AI_URL_DEBUG_TAGS, AI_URL_DEBUG_POSITIONS, AI_URL_DEBUG_NO_INSERTION, AI_URL_DEBUG_AD_BLOCKING, AI_URL_DEBUG_AD_BLOCKING_STATUS);
1181
- } else
1182
- $parameters = array (AI_URL_DEBUG, AI_URL_DEBUG_PROCESSING, AI_URL_DEBUG_BLOCKS, AI_URL_DEBUG_USER, AI_URL_DEBUG_TAGS, AI_URL_DEBUG_POSITIONS, AI_URL_DEBUG_NO_INSERTION);
 
 
 
 
1183
 
1184
  return remove_query_arg ($parameters, $url);
1185
  }
@@ -1225,7 +1244,7 @@ function ai_buffering_start () {
1225
  }
1226
 
1227
  ob_start ();
1228
- define ('AI_BUFFERING_START', true);
1229
  }
1230
 
1231
  function ai_buffering_end () {
@@ -1491,9 +1510,9 @@ function ai_wp_hook () {
1491
  (!is_multisite() || is_main_site () || multisite_settings_page_enabled ()))
1492
  add_action ('admin_bar_menu', 'ai_toolbar', 9920);
1493
 
1494
- $url_debugging = get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0;
1495
 
1496
- if (!is_admin() || defined ('DOING_AJAX')) {
1497
  if (isset ($_GET [AI_URL_DEBUG]) && $_GET [AI_URL_DEBUG] == 0) {
1498
  if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) {
1499
  unset ($_COOKIE ['AI_WP_DEBUGGING']);
@@ -1528,13 +1547,19 @@ function ai_wp_hook () {
1528
  if ($ai_wp_data [AI_WP_DEBUG_BLOCK] < 0 || $ai_wp_data [AI_WP_DEBUG_BLOCK] > AD_INSERTER_BLOCKS) $ai_wp_data [AI_WP_DEBUG_BLOCK] = 0;
1529
  }
1530
 
1531
- if ($ai_wp_data [AI_WP_DEBUGGING] != 0)
1532
- setcookie ('AI_WP_DEBUGGING', $ai_wp_data [AI_WP_DEBUGGING], time() + AI_COOKIE_TIME, COOKIEPATH); else
1533
- if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) setcookie ('AI_WP_DEBUGGING', '', time() - (15 * 60), COOKIEPATH);
 
1534
 
1535
- if ($ai_wp_data [AI_WP_DEBUG_BLOCK] != 0)
1536
- setcookie ('AI_WP_DEBUG_BLOCK', $ai_wp_data [AI_WP_DEBUG_BLOCK], time() + AI_COOKIE_TIME, COOKIEPATH); else
1537
- if (isset ($_COOKIE ['AI_WP_DEBUG_BLOCK'])) setcookie ('AI_WP_DEBUG_BLOCK', '', time() - (15 * 60), COOKIEPATH);
 
 
 
 
 
1538
  }
1539
  }
1540
 
@@ -1600,9 +1625,11 @@ function ai_wp_hook () {
1600
  }
1601
 
1602
  if ($ai_wp_data [AI_STICK_TO_THE_CONTENT]) {
1603
- add_action ('loop_start', 'ai_content_marker');
1604
- add_action ('loop_end', 'ai_content_marker');
1605
- add_action ('get_sidebar', 'ai_content_marker');
 
 
1606
  }
1607
 
1608
  if ($ai_wp_data [AI_WP_AMP_PAGE] ) {
@@ -1618,6 +1645,11 @@ function ai_wp_hook () {
1618
  // WP AMP - Accelerated Mobile Pages for WordPress
1619
  add_action ('amphtml_template_head', 'ai_amp_head_hook', 99999);
1620
  add_action ('amphtml_template_css', 'ai_amp_css_hook', 99999);
 
 
 
 
 
1621
  } else
1622
  // WP
1623
  add_action ('wp_head', 'ai_wp_head_hook', 99999);
@@ -1638,6 +1670,12 @@ function ai_wp_hook () {
1638
  if ($automatic_insertion_footer_hook)
1639
  add_action ('amphtml_after_footer', 'ai_hook_function_footer', 5);
1640
  add_action ('amphtml_after_footer', 'ai_amp_footer_hook', 5);
 
 
 
 
 
 
1641
  } else {
1642
  // WP
1643
  if ($automatic_insertion_footer_hook)
@@ -1675,7 +1713,12 @@ function ai_init_hook() {
1675
  }
1676
 
1677
  function ai_wp_loaded_hook () {
1678
- global $ai_db_options, $ai_db_options_extract, $version_string;
 
 
 
 
 
1679
 
1680
  if (isset ($ai_db_options [AI_OPTION_EXTRACT]) &&
1681
  isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] == $version_string &&
@@ -1687,6 +1730,12 @@ function ai_wp_loaded_hook () {
1687
  isset ($ai_db_options [AI_OPTION_EXTRACT][FOOTER_HOOK_BLOCKS]))
1688
  $ai_db_options_extract = $ai_db_options [AI_OPTION_EXTRACT]; else
1689
  $ai_db_options_extract = ai_generate_extract ($ai_db_options);
 
 
 
 
 
 
1690
  }
1691
 
1692
  function ai_admin_menu_hook () {
@@ -2681,7 +2730,7 @@ function ai_amp_head_hook () {
2681
  global $block_object, $ai_wp_data, $ai_total_plugin_time;
2682
 
2683
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2684
- ai_log ("HEAD HOOK START");
2685
  $start_time = microtime (true);
2686
  }
2687
 
@@ -2721,7 +2770,7 @@ function ai_amp_head_hook () {
2721
 
2722
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2723
  $ai_total_plugin_time += microtime (true) - $start_time;
2724
- ai_log ("HEAD HOOK END\n");
2725
  }
2726
  }
2727
 
@@ -2807,7 +2856,7 @@ function ai_amp_footer_hook () {
2807
  global $block_object, $ai_wp_data, $ai_total_plugin_time;
2808
 
2809
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2810
- ai_log ("FOOTER HOOK START");
2811
  $start_time = microtime (true);
2812
  }
2813
 
@@ -2848,7 +2897,7 @@ function ai_amp_footer_hook () {
2848
 
2849
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2850
  $ai_total_plugin_time += microtime (true) - $start_time;
2851
- ai_log ("FOOTER HOOK END\n");
2852
  }
2853
  }
2854
 
@@ -2980,8 +3029,7 @@ function ai_write_debug_info ($write_processing_log = false) {
2980
  echo 'URL: ', $ai_wp_data [AI_WP_URL], "\n";
2981
  echo 'REFERER: ', isset ($_SERVER['HTTP_REFERER']) ? strtolower (parse_url ($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) . ' ('. remove_debug_parameters_from_url ($_SERVER['HTTP_REFERER']).')' : "", "\n";
2982
  if (function_exists ('ai_debug')) ai_debug ();
2983
- echo 'CLIENT-SIDE DETECTION: ', $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ? 'USED' : "NOT USED", "\n";
2984
- echo 'CLIENT-SIDE INSERTION: ', $ai_wp_data [AI_CLIENT_SIDE_INSERTION] ? 'USED' : "NOT USED", "\n";
2985
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION] || 1) {
2986
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
2987
  $viewport_name = get_viewport_name ($viewport);
@@ -2991,6 +3039,7 @@ function ai_write_debug_info ($write_processing_log = false) {
2991
  }
2992
  }
2993
  }
 
2994
  echo 'SERVER-SIDE DETECTION: ', $ai_wp_data [AI_SERVER_SIDE_DETECTION] ? 'USED' : "NOT USED", "\n";
2995
  if ($ai_wp_data [AI_SERVER_SIDE_DETECTION]) {
2996
  echo 'SERVER-SIDE DEVICE: ';
@@ -2999,6 +3048,9 @@ function ai_write_debug_info ($write_processing_log = false) {
2999
  elseif (AI_PHONE) echo "PHONE\n";
3000
  else echo "?\n";
3001
  }
 
 
 
3002
 
3003
  $enabled_custom_hooks = array ();
3004
  foreach ($ai_custom_hooks as $ai_custom_hook) {
@@ -4359,7 +4411,7 @@ function ai_ajax_backend () {
4359
  }
4360
 
4361
  function ai_generate_extract (&$settings) {
4362
- global $ai_custom_hooks;
4363
 
4364
  if (!defined ('AI_GENERATE_EXTRACT'))
4365
  define ('AI_GENERATE_EXTRACT', true);
@@ -4414,6 +4466,19 @@ function ai_generate_extract (&$settings) {
4414
 
4415
  // Generate extracted data
4416
  $active_blocks = array ();
 
 
 
 
 
 
 
 
 
 
 
 
 
4417
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
4418
 
4419
  if (!isset ($settings [$block])) continue;
@@ -4521,16 +4586,39 @@ function ai_generate_extract (&$settings) {
4521
  $manual_php_function = $obj->get_enable_php_call() == AI_ENABLED;
4522
  if ($enabled_insertion && ($automatic || ($manual_widget && in_array ($block, $widget_blocks)) || $manual_shortcode || $manual_php_function)) {
4523
  $active_blocks []= $block;
 
 
4524
  }
4525
  }
4526
 
4527
- $extract [AI_EXTRACT_USED_BLOCKS] = serialize ($active_blocks);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4528
 
4529
 
4530
  if (defined ('AI_BUFFERING')) {
4531
- $extract [ABOVE_HEADER_HOOK_BLOCKS] = $above_header_hook_blocks;
4532
- $extract [HTML_ELEMENT_HOOK_BLOCKS] = $html_element_hook_blocks;
4533
  }
 
4534
  $extract [CONTENT_HOOK_BLOCKS] = $content_hook_blocks;
4535
  $extract [EXCERPT_HOOK_BLOCKS] = $excerpt_hook_blocks;
4536
  $extract [LOOP_START_HOOK_BLOCKS] = $loop_start_hook_blocks;
@@ -4579,45 +4667,23 @@ function ai_load_settings () {
4579
  }
4580
  }
4581
 
4582
- // Sidebars and widgets not loaded yet - moved to ai_wp_loaded_hook
4583
- // if (isset ($ai_db_options [AI_OPTION_EXTRACT]) &&
4584
- // isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] == $version_string &&
4585
- // isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS]) &&
4586
- // isset ($ai_db_options [AI_OPTION_EXTRACT][POST_HOOK_BLOCKS][AI_PT_AJAX]) &&
4587
- // isset ($ai_db_options [AI_OPTION_EXTRACT][BETWEEN_COMMENTS_HOOK_BLOCKS]) &&
4588
- // isset ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) &&
4589
- // @unserialize ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]) !== false &&
4590
- // isset ($ai_db_options [AI_OPTION_EXTRACT][FOOTER_HOOK_BLOCKS]))
4591
- // $ai_db_options_extract = $ai_db_options [AI_OPTION_EXTRACT]; else
4592
- // $ai_db_options_extract = ai_generate_extract ($ai_db_options);
4593
 
4594
  $obj = new ai_Block (0);
4595
  $obj->wp_options [AI_OPTION_BLOCK_NAME] = 'Default';
4596
  $block_object [0] = $obj;
 
4597
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
4598
  $obj = new ai_Block ($block);
 
4599
  $obj->load_options ($block);
4600
  $block_object [$block] = $obj;
4601
 
4602
- if ($obj->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
4603
- if ($obj->get_detection_client_side ()) {
4604
- $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = true;
4605
-
4606
- if ($obj->get_client_side_action () == AI_CLIENT_SIDE_ACTION_INSERT) {
4607
- $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = true;
4608
- }
4609
- }
4610
-
4611
- if (function_exists ('ai_load_settings_2')) ai_load_settings_2 ($obj);
4612
-
4613
- if ($obj->stick_to_the_content_class () != '') $ai_wp_data [AI_STICK_TO_THE_CONTENT] = true;
4614
-
4615
- switch ($obj->get_automatic_insertion()) {
4616
- case AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT:
4617
- case AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT:
4618
- if ($obj->get_html_element_insertion () != AI_HTML_INSERTION_SEREVR_SIDE) $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = true;
4619
- break;
4620
- }
4621
  }
4622
 
4623
  $adH = new ai_AdH();
@@ -4627,6 +4693,21 @@ function ai_load_settings () {
4627
  $block_object [AI_HEADER_OPTION_NAME] = $adH;
4628
  $block_object [AI_FOOTER_OPTION_NAME] = $adF;
4629
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4630
  if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
4631
  $adA = new ai_AdA();
4632
  $adA->load_options (AI_ADB_MESSAGE_OPTION_NAME);
@@ -5119,14 +5200,26 @@ function ai_settings () {
5119
  delete_site_option (AI_OPTION_NAME, $options);
5120
  }
5121
 
 
5122
  delete_option (AI_ADSENSE_AUTH_CODE);
 
5123
 
5124
  delete_transient (AI_TRANSIENT_ADSENSE_TOKEN);
5125
  delete_transient (AI_TRANSIENT_ADSENSE_ADS);
5126
 
 
 
5127
  if (function_exists ('ai_load_globals')) {
5128
  delete_option (WP_AD_INSERTER_PRO_LICENSE);
5129
  $wpdb->query ("DROP TABLE IF EXISTS " . AI_STATISTICS_DB_TABLE);
 
 
 
 
 
 
 
 
5130
  }
5131
 
5132
  if (ai_current_user_role_ok () && (!is_multisite() || is_main_site () || multisite_exceptions_enabled ())) {
@@ -5370,6 +5463,7 @@ function ai_content_hook ($content = '') {
5370
 
5371
  $ai_last_check = AI_CHECK_NONE;
5372
  $current_block = 0;
 
5373
 
5374
  if (isset ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
5375
  foreach ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
@@ -5383,12 +5477,7 @@ function ai_content_hook ($content = '') {
5383
  $obj = $block_object [$block];
5384
  $obj->clear_code_cache ();
5385
 
5386
- // Process content hook only if in_the_loop or filter is set
5387
- $filter_type = $obj->get_filter_type ();
5388
- // $process_content = $ai_wp_data [AI_WP_AMP_PAGE] || in_the_loop () || (($filter_type == AI_FILTER_AUTO || $filter_type == AI_FILTER_CONTENT_PROCESSING) && trim ($obj->get_call_filter()) != '');
5389
- $process_content = true;
5390
-
5391
- if ($process_content) {
5392
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0 && !$positions_inserted && $ai_wp_data [AI_WP_DEBUG_BLOCK] <= $block) {
5393
  $preview = $block_object [$ai_wp_data [AI_WP_DEBUG_BLOCK]];
5394
  $content = $preview->before_paragraph ($content, true);
@@ -6157,8 +6246,10 @@ function ai_process_shortcode (&$block, $atts) {
6157
  }
6158
  return "";
6159
  case 'debugging-tools':
6160
- if (/*get_remote_debugging () ||*/ ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0) {
 
6161
  ai_write_debugging_tools ();
 
6162
  }
6163
  return "";
6164
  }
@@ -6389,7 +6480,7 @@ function ai_widget_draw ($args, $instance, &$block) {
6389
  $sticky = isset ($instance ['sticky']) ? $instance ['sticky'] : 0;
6390
 
6391
  if ($block == 0 || $block == - 2) {
6392
- if (/*get_remote_debugging () ||*/ ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0) {
6393
  ai_special_widget ($args, $instance, $block);
6394
  }
6395
  return;
2
 
3
  /*
4
  Plugin Name: Ad Inserter
5
+ Version: 2.3.16
6
  Description: Ad management plugin with advanced advertising options to automatically insert ad codes on your website
7
  Author: Igor Funa
8
  Author URI: http://igorfuna.com/
13
 
14
  Change Log
15
 
16
+ Ad Inserter 2.3.16 - 2018-07-25
17
+ - Added option to insert block only when WP loop is currently active
18
+ - Added support for Better AMP plugin
19
+ - Code generator for placeholders on https sites now generates https urls
20
+ - Optimized loading of plugin settings
21
+ - Few minor bug fixes, cosmetic changes and code improvements
22
+
23
  Ad Inserter 2.3.15 - 2018-07-18
24
  - Fix for insertion on AMP pages
25
 
655
  require_once AD_INSERTER_PLUGIN_DIR.'constants.php';
656
  require_once AD_INSERTER_PLUGIN_DIR.'settings.php';
657
 
658
+
659
  $version_array = explode (".", AD_INSERTER_VERSION);
660
  $version_string = "";
661
  foreach ($version_array as $number) {
685
  $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = false;
686
  $ai_wp_data [AI_LAZY_LOADING] = false;
687
  $ai_wp_data [AI_PAGE_BLOCKS] = 0;
688
+ $ai_wp_data [AI_GEOLOCATION] = false;
689
 
690
  ai_load_settings ();
691
 
752
  }
753
 
754
 
755
+ //$adH = $block_object [AI_HEADER_OPTION_NAME];
756
+ //$adF = $block_object [AI_FOOTER_OPTION_NAME];
757
+ //if ($adH->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
758
+ //if ($adF->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
759
 
760
  if ($ai_wp_data [AI_SERVER_SIDE_DETECTION]) {
761
  require_once AD_INSERTER_PLUGIN_DIR.'includes/Mobile_Detect.php';
877
  $debug_settings_on = $debug_blocks == 0 || $debug_positions === '' || $debug_tags == 0 || $debug_processing == 0 || $debug_no_insertion == 0 || $debug_ad_blocking == 0 || $debug_ad_blocking_status == 0;
878
 
879
  $debug_settings_class = $debug_settings_on ? ' on' : '';
880
+
881
+ $top_menu_url = $debug_settings_on ? (defined ('AI_DEBUGGING_DEMO') ? get_permalink () : add_query_arg (AI_URL_DEBUG, '0', remove_debug_parameters_from_url ())) :
882
  add_query_arg (array (AI_URL_DEBUG_BLOCKS => '1', AI_URL_DEBUG_POSITIONS => '0'), remove_debug_parameters_from_url ());
883
 
884
  $ai_wp_data [AI_DEBUG_MENU_ITEMS][] = array (
889
  $ai_wp_data [AI_DEBUG_MENU_ITEMS][] = array (
890
  'id' => 'ai-toolbar-settings',
891
  // 'parent' => 'ai-toolbar',
892
+ 'title' => '<span class="ab-icon'.$debug_settings_class.'"></span>'.AD_INSERTER_NAME . (defined ('AI_DEBUGGING_DEMO') ? ' Debugging DEMO' : ($debug_settings_on ? ' Debugging' : '')),
893
  'href' => $top_menu_url,
894
  // 'meta' => $debug_settings_on ? array ('title' => 'Turn Debugging Off') : array (),
895
  );
912
  for ($block = 0; $block <= AD_INSERTER_BLOCKS; $block ++) {
913
  $obj = $block_object [$block];
914
  $automatic_insertion = $obj->get_automatic_insertion();
915
+ if ($block == 0 || !$obj->get_disable_insertion () && ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH || $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH)) {
916
 
917
  $block_tags = trim ($block_object [$block]->get_paragraph_tags ());
918
  $direction = $block_object [$block]->get_direction_type() == AD_DIRECTION_FROM_TOP ? 't' : 'b';
1004
  }
1005
  }
1006
 
1007
+ if (!defined ('AI_DEBUGGING_DEMO')) {
1008
+ $ai_wp_data [AI_DEBUG_MENU_ITEMS][] = array (
1009
+ 'id' => 'ai-toolbar-processing',
1010
+ 'parent' => 'ai-toolbar-settings',
1011
+ 'title' => '<span class="ab-icon'.$debug_processing_class.'"></span>Log Processing',
1012
+ 'href' => set_url_parameter (AI_URL_DEBUG_PROCESSING, $debug_processing),
1013
+ );
1014
+ }
1015
  }
1016
 
1017
  function ai_toolbar ($wp_admin_bar) {
1062
  isset ($_GET ['wpamp']) ||
1063
 
1064
  // WP AMP - Accelerated Mobile Pages for WordPress
1065
+ function_exists ('is_wp_amp') && is_wp_amp () ||
1066
+
1067
+ // Better AMP - WordPress Complete AMP
1068
+ function_exists ('is_better_amp') && is_better_amp ()
1069
  ) {
1070
  $ai_wp_data [AI_WP_AMP_PAGE] = true;
1071
  define ('AI_AMP_PAGE', true);
1191
  }
1192
 
1193
  function remove_debug_parameters_from_url ($url = false) {
1194
+ if (defined ('AI_DEBUGGING_DEMO')) {
1195
+ $parameters = array (AI_URL_DEBUG, AI_URL_DEBUG_PROCESSING);
1196
+ } else {
1197
+ if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
1198
+ $parameters = array (AI_URL_DEBUG, AI_URL_DEBUG_PROCESSING, AI_URL_DEBUG_BLOCKS, AI_URL_DEBUG_USER, AI_URL_DEBUG_TAGS, AI_URL_DEBUG_POSITIONS, AI_URL_DEBUG_NO_INSERTION, AI_URL_DEBUG_AD_BLOCKING, AI_URL_DEBUG_AD_BLOCKING_STATUS);
1199
+ } else
1200
+ $parameters = array (AI_URL_DEBUG, AI_URL_DEBUG_PROCESSING, AI_URL_DEBUG_BLOCKS, AI_URL_DEBUG_USER, AI_URL_DEBUG_TAGS, AI_URL_DEBUG_POSITIONS, AI_URL_DEBUG_NO_INSERTION);
1201
+ }
1202
 
1203
  return remove_query_arg ($parameters, $url);
1204
  }
1244
  }
1245
 
1246
  ob_start ();
1247
+ if (!defined ('AI_BUFFERING_START')) define ('AI_BUFFERING_START', true);
1248
  }
1249
 
1250
  function ai_buffering_end () {
1510
  (!is_multisite() || is_main_site () || multisite_settings_page_enabled ()))
1511
  add_action ('admin_bar_menu', 'ai_toolbar', 9920);
1512
 
1513
+ $url_debugging = get_remote_debugging () || ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 || defined ('AI_DEBUGGING_DEMO');
1514
 
1515
+ if (!is_admin() || defined ('DOING_AJAX') || defined ('AI_DEBUGGING_DEMO')) {
1516
  if (isset ($_GET [AI_URL_DEBUG]) && $_GET [AI_URL_DEBUG] == 0) {
1517
  if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) {
1518
  unset ($_COOKIE ['AI_WP_DEBUGGING']);
1547
  if ($ai_wp_data [AI_WP_DEBUG_BLOCK] < 0 || $ai_wp_data [AI_WP_DEBUG_BLOCK] > AD_INSERTER_BLOCKS) $ai_wp_data [AI_WP_DEBUG_BLOCK] = 0;
1548
  }
1549
 
1550
+ if (!defined ('AI_DEBUGGING_DEMO')) {
1551
+ if ($ai_wp_data [AI_WP_DEBUGGING] != 0)
1552
+ setcookie ('AI_WP_DEBUGGING', $ai_wp_data [AI_WP_DEBUGGING], time() + AI_COOKIE_TIME, COOKIEPATH); else
1553
+ if (isset ($_COOKIE ['AI_WP_DEBUGGING'])) setcookie ('AI_WP_DEBUGGING', '', time() - (15 * 60), COOKIEPATH);
1554
 
1555
+ if ($ai_wp_data [AI_WP_DEBUG_BLOCK] != 0)
1556
+ setcookie ('AI_WP_DEBUG_BLOCK', $ai_wp_data [AI_WP_DEBUG_BLOCK], time() + AI_COOKIE_TIME, COOKIEPATH); else
1557
+ if (isset ($_COOKIE ['AI_WP_DEBUG_BLOCK'])) setcookie ('AI_WP_DEBUG_BLOCK', '', time() - (15 * 60), COOKIEPATH);
1558
+ } else {
1559
+ if ($ai_wp_data [AI_WP_DEBUGGING] != 0) {
1560
+ ai_disable_caching ();
1561
+ }
1562
+ }
1563
  }
1564
  }
1565
 
1625
  }
1626
 
1627
  if ($ai_wp_data [AI_STICK_TO_THE_CONTENT]) {
1628
+ if (trim (get_main_content_element () == '')) {
1629
+ add_action ('loop_start', 'ai_content_marker');
1630
+ add_action ('loop_end', 'ai_content_marker');
1631
+ add_action ('get_sidebar', 'ai_content_marker');
1632
+ }
1633
  }
1634
 
1635
  if ($ai_wp_data [AI_WP_AMP_PAGE] ) {
1645
  // WP AMP - Accelerated Mobile Pages for WordPress
1646
  add_action ('amphtml_template_head', 'ai_amp_head_hook', 99999);
1647
  add_action ('amphtml_template_css', 'ai_amp_css_hook', 99999);
1648
+
1649
+ // Better AMP - WordPress Complete AMP
1650
+ add_action ('better-amp/template/head', 'ai_amp_head_hook', 99999);
1651
+ // No usable hook for custom CSS
1652
+ // add_action ('better-amp/template/css', 'ai_amp_css_hook', 99999);
1653
  } else
1654
  // WP
1655
  add_action ('wp_head', 'ai_wp_head_hook', 99999);
1670
  if ($automatic_insertion_footer_hook)
1671
  add_action ('amphtml_after_footer', 'ai_hook_function_footer', 5);
1672
  add_action ('amphtml_after_footer', 'ai_amp_footer_hook', 5);
1673
+
1674
+ // Better AMP - WordPress Complete AMP
1675
+ if ($automatic_insertion_footer_hook)
1676
+ add_action ('better-amp/template/footer', 'ai_hook_function_footer', 5);
1677
+ add_action ('better-amp/template/footer', 'ai_amp_footer_hook', 5);
1678
+
1679
  } else {
1680
  // WP
1681
  if ($automatic_insertion_footer_hook)
1713
  }
1714
 
1715
  function ai_wp_loaded_hook () {
1716
+ global $ai_db_options, $ai_db_options_extract, $version_string, $ai_total_plugin_time, $ai_wp_data;
1717
+
1718
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1719
+ ai_log ("WP LOADED HOOK START");
1720
+ $start_time = microtime (true);
1721
+ }
1722
 
1723
  if (isset ($ai_db_options [AI_OPTION_EXTRACT]) &&
1724
  isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION']) && $ai_db_options [AI_OPTION_GLOBAL]['VERSION'] == $version_string &&
1730
  isset ($ai_db_options [AI_OPTION_EXTRACT][FOOTER_HOOK_BLOCKS]))
1731
  $ai_db_options_extract = $ai_db_options [AI_OPTION_EXTRACT]; else
1732
  $ai_db_options_extract = ai_generate_extract ($ai_db_options);
1733
+
1734
+ if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
1735
+ $ai_total_plugin_time += microtime (true) - $start_time;
1736
+ if (defined ('AI_GENERATE_EXTRACT')) ai_log ("EXTRACT GENERATED");
1737
+ ai_log ("WP LOADED HOOK END\n");
1738
+ }
1739
  }
1740
 
1741
  function ai_admin_menu_hook () {
2730
  global $block_object, $ai_wp_data, $ai_total_plugin_time;
2731
 
2732
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2733
+ ai_log ("AMP HEAD HOOK START");
2734
  $start_time = microtime (true);
2735
  }
2736
 
2770
 
2771
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2772
  $ai_total_plugin_time += microtime (true) - $start_time;
2773
+ ai_log ("AMP HEAD HOOK END\n");
2774
  }
2775
  }
2776
 
2856
  global $block_object, $ai_wp_data, $ai_total_plugin_time;
2857
 
2858
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2859
+ ai_log ("AMP FOOTER HOOK START");
2860
  $start_time = microtime (true);
2861
  }
2862
 
2897
 
2898
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0) {
2899
  $ai_total_plugin_time += microtime (true) - $start_time;
2900
+ ai_log ("AMP FOOTER HOOK END\n");
2901
  }
2902
  }
2903
 
3029
  echo 'URL: ', $ai_wp_data [AI_WP_URL], "\n";
3030
  echo 'REFERER: ', isset ($_SERVER['HTTP_REFERER']) ? strtolower (parse_url ($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) . ' ('. remove_debug_parameters_from_url ($_SERVER['HTTP_REFERER']).')' : "", "\n";
3031
  if (function_exists ('ai_debug')) ai_debug ();
3032
+
 
3033
  if ($ai_wp_data [AI_CLIENT_SIDE_DETECTION] || 1) {
3034
  for ($viewport = 1; $viewport <= AD_INSERTER_VIEWPORTS; $viewport ++) {
3035
  $viewport_name = get_viewport_name ($viewport);
3039
  }
3040
  }
3041
  }
3042
+
3043
  echo 'SERVER-SIDE DETECTION: ', $ai_wp_data [AI_SERVER_SIDE_DETECTION] ? 'USED' : "NOT USED", "\n";
3044
  if ($ai_wp_data [AI_SERVER_SIDE_DETECTION]) {
3045
  echo 'SERVER-SIDE DEVICE: ';
3048
  elseif (AI_PHONE) echo "PHONE\n";
3049
  else echo "?\n";
3050
  }
3051
+ echo 'CLIENT-SIDE DETECTION: ', $ai_wp_data [AI_CLIENT_SIDE_DETECTION] ? 'USED' : "NOT USED", "\n";
3052
+ echo 'CLIENT-SIDE INSERTION: ', $ai_wp_data [AI_CLIENT_SIDE_INSERTION] ? 'USED' : "NOT USED", "\n";
3053
+ if (function_exists ('ai_debug_features')) ai_debug_features ();
3054
 
3055
  $enabled_custom_hooks = array ();
3056
  foreach ($ai_custom_hooks as $ai_custom_hook) {
4411
  }
4412
 
4413
  function ai_generate_extract (&$settings) {
4414
+ global $ai_custom_hooks, $ai_wp_data;
4415
 
4416
  if (!defined ('AI_GENERATE_EXTRACT'))
4417
  define ('AI_GENERATE_EXTRACT', true);
4466
 
4467
  // Generate extracted data
4468
  $active_blocks = array ();
4469
+
4470
+ $temp_ai_wp_data = $ai_wp_data;
4471
+
4472
+ $ai_wp_data [AI_SERVER_SIDE_DETECTION] = false;
4473
+ $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = false;
4474
+ $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = false;
4475
+ $ai_wp_data [AI_STICK_TO_THE_CONTENT] = false;
4476
+ $ai_wp_data [AI_TRACKING] = false;
4477
+ $ai_wp_data [AI_CLOSE_BUTTONS] = false;
4478
+ $ai_wp_data [AI_ANIMATION] = false;
4479
+ $ai_wp_data [AI_LAZY_LOADING] = false;
4480
+ $ai_wp_data [AI_GEOLOCATION] = false;
4481
+
4482
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
4483
 
4484
  if (!isset ($settings [$block])) continue;
4586
  $manual_php_function = $obj->get_enable_php_call() == AI_ENABLED;
4587
  if ($enabled_insertion && ($automatic || ($manual_widget && in_array ($block, $widget_blocks)) || $manual_shortcode || $manual_php_function)) {
4588
  $active_blocks []= $block;
4589
+
4590
+ $obj->extract_features ();
4591
  }
4592
  }
4593
 
4594
+ $extract [AI_EXTRACT_USED_BLOCKS] = serialize ($active_blocks);
4595
+
4596
+ $obj->wp_options = $settings [AI_HEADER_OPTION_NAME];
4597
+ if ($obj->get_enable_manual () && $obj->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
4598
+
4599
+ $obj->wp_options = $settings [AI_FOOTER_OPTION_NAME];
4600
+ if ($obj->get_enable_manual () && $obj->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
4601
+
4602
+ $extract [AI_EXTRACT_FEATURES] = array (
4603
+ AI_SERVER_SIDE_DETECTION => $ai_wp_data [AI_SERVER_SIDE_DETECTION],
4604
+ AI_CLIENT_SIDE_DETECTION => $ai_wp_data [AI_CLIENT_SIDE_DETECTION],
4605
+ AI_CLIENT_SIDE_INSERTION => $ai_wp_data [AI_CLIENT_SIDE_INSERTION],
4606
+ AI_STICK_TO_THE_CONTENT => $ai_wp_data [AI_STICK_TO_THE_CONTENT],
4607
+ AI_TRACKING => $ai_wp_data [AI_TRACKING],
4608
+ AI_CLOSE_BUTTONS => $ai_wp_data [AI_CLOSE_BUTTONS],
4609
+ AI_ANIMATION => $ai_wp_data [AI_ANIMATION],
4610
+ AI_LAZY_LOADING => $ai_wp_data [AI_LAZY_LOADING],
4611
+ AI_GEOLOCATION => $ai_wp_data [AI_GEOLOCATION]
4612
+ );
4613
+
4614
+ $ai_wp_data = $temp_ai_wp_data;
4615
 
4616
 
4617
  if (defined ('AI_BUFFERING')) {
4618
+ $extract [ABOVE_HEADER_HOOK_BLOCKS] = $above_header_hook_blocks;
4619
+ $extract [HTML_ELEMENT_HOOK_BLOCKS] = $html_element_hook_blocks;
4620
  }
4621
+
4622
  $extract [CONTENT_HOOK_BLOCKS] = $content_hook_blocks;
4623
  $extract [EXCERPT_HOOK_BLOCKS] = $excerpt_hook_blocks;
4624
  $extract [LOOP_START_HOOK_BLOCKS] = $loop_start_hook_blocks;
4667
  }
4668
  }
4669
 
4670
+ $features_in_extract = isset ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_FEATURES]);
4671
+
4672
+ if (isset ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS])) {
4673
+ $used_blocks = @unserialize ($ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_USED_BLOCKS]);
4674
+ } else $used_blocks = false;
 
 
 
 
 
 
4675
 
4676
  $obj = new ai_Block (0);
4677
  $obj->wp_options [AI_OPTION_BLOCK_NAME] = 'Default';
4678
  $block_object [0] = $obj;
4679
+
4680
  for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
4681
  $obj = new ai_Block ($block);
4682
+
4683
  $obj->load_options ($block);
4684
  $block_object [$block] = $obj;
4685
 
4686
+ if (!$features_in_extract && (!is_array ($used_blocks) || in_array ($block, $used_blocks))) $obj->extract_features ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4687
  }
4688
 
4689
  $adH = new ai_AdH();
4693
  $block_object [AI_HEADER_OPTION_NAME] = $adH;
4694
  $block_object [AI_FOOTER_OPTION_NAME] = $adF;
4695
 
4696
+ if ($features_in_extract) {
4697
+ $ai_wp_data [AI_SERVER_SIDE_DETECTION] = $ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_FEATURES][AI_SERVER_SIDE_DETECTION];
4698
+ $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = $ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_FEATURES][AI_CLIENT_SIDE_DETECTION];
4699
+ $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = $ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_FEATURES][AI_CLIENT_SIDE_INSERTION];
4700
+ $ai_wp_data [AI_STICK_TO_THE_CONTENT] = $ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_FEATURES][AI_STICK_TO_THE_CONTENT];
4701
+ $ai_wp_data [AI_TRACKING] = $ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_FEATURES][AI_TRACKING];
4702
+ $ai_wp_data [AI_CLOSE_BUTTONS] = $ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_FEATURES][AI_CLOSE_BUTTONS];
4703
+ $ai_wp_data [AI_ANIMATION] = $ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_FEATURES][AI_ANIMATION];
4704
+ $ai_wp_data [AI_LAZY_LOADING] = $ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_FEATURES][AI_LAZY_LOADING];
4705
+ $ai_wp_data [AI_GEOLOCATION] = $ai_db_options [AI_OPTION_EXTRACT][AI_EXTRACT_FEATURES][AI_GEOLOCATION];
4706
+ } else {
4707
+ if ($adH->get_enable_manual () && $adH->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
4708
+ if ($adF->get_enable_manual () && $adF->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
4709
+ }
4710
+
4711
  if (defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION) {
4712
  $adA = new ai_AdA();
4713
  $adA->load_options (AI_ADB_MESSAGE_OPTION_NAME);
5200
  delete_site_option (AI_OPTION_NAME, $options);
5201
  }
5202
 
5203
+ delete_option (AI_ADSENSE_CLIENT_IDS);
5204
  delete_option (AI_ADSENSE_AUTH_CODE);
5205
+ delete_option (AI_ADSENSE_OWN_IDS);
5206
 
5207
  delete_transient (AI_TRANSIENT_ADSENSE_TOKEN);
5208
  delete_transient (AI_TRANSIENT_ADSENSE_ADS);
5209
 
5210
+ delete_transient ('ai-close');
5211
+
5212
  if (function_exists ('ai_load_globals')) {
5213
  delete_option (WP_AD_INSERTER_PRO_LICENSE);
5214
  $wpdb->query ("DROP TABLE IF EXISTS " . AI_STATISTICS_DB_TABLE);
5215
+
5216
+ delete_transient (AI_TRANSIENT_ADB_CLASS_1);
5217
+ delete_transient (AI_TRANSIENT_ADB_CLASS_2);
5218
+ delete_transient (AI_TRANSIENT_ADB_CLASS_3);
5219
+ delete_transient (AI_TRANSIENT_ADB_CLASS_4);
5220
+ delete_transient (AI_TRANSIENT_ADB_CLASS_5);
5221
+ delete_transient (AI_TRANSIENT_ADB_CLASS_6);
5222
+ delete_transient (AI_TRANSIENT_ADB_FILES_VERSION);
5223
  }
5224
 
5225
  if (ai_current_user_role_ok () && (!is_multisite() || is_main_site () || multisite_exceptions_enabled ())) {
5463
 
5464
  $ai_last_check = AI_CHECK_NONE;
5465
  $current_block = 0;
5466
+ $in_the_loop = in_the_loop ();
5467
 
5468
  if (isset ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]]))
5469
  foreach ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
5477
  $obj = $block_object [$block];
5478
  $obj->clear_code_cache ();
5479
 
5480
+ if ($in_the_loop || !$obj->get_only_in_the_loop ()) {
 
 
 
 
 
5481
  if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0 && !$positions_inserted && $ai_wp_data [AI_WP_DEBUG_BLOCK] <= $block) {
5482
  $preview = $block_object [$ai_wp_data [AI_WP_DEBUG_BLOCK]];
5483
  $content = $preview->before_paragraph ($content, true);
6246
  }
6247
  return "";
6248
  case 'debugging-tools':
6249
+ if (($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 || defined ('AI_DEBUGGING_DEMO')) {
6250
+ ob_start ();
6251
  ai_write_debugging_tools ();
6252
+ return ob_get_clean ();
6253
  }
6254
  return "";
6255
  }
6480
  $sticky = isset ($instance ['sticky']) ? $instance ['sticky'] : 0;
6481
 
6482
  if ($block == 0 || $block == - 2) {
6483
+ if (($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != 0 || defined ('AI_DEBUGGING_DEMO')) {
6484
  ai_special_widget ($args, $instance, $block);
6485
  }
6486
  return;
class.php CHANGED
@@ -15,6 +15,8 @@ abstract class ai_BaseCodeBlock {
15
  var $additional_code_before; // For server-side dynamic PHP code
16
  var $additional_code_after; // For server-side dynamic PHP code
17
  var $counters;
 
 
18
 
19
  var $label;
20
 
@@ -35,6 +37,7 @@ abstract class ai_BaseCodeBlock {
35
  $this->additional_code_after = '';
36
  $this->counters = '';
37
  $this->client_side_cookie_check = false;
 
38
 
39
  $this->labels = new ai_block_labels ();
40
 
@@ -50,10 +53,11 @@ abstract class ai_BaseCodeBlock {
50
  public function load_options ($block) {
51
  global $ai_db_options;
52
 
53
- if (isset ($ai_db_options [$block])) $options = $ai_db_options [$block]; else $options = '';
54
 
55
  // Convert old options
56
- if (!$options) {
 
57
  if ($block == "h") $options = ai_get_option (str_replace ("#", "Header", AD_ADx_OPTIONS));
58
  elseif ($block == "f") $options = ai_get_option (str_replace ("#", "Footer", AD_ADx_OPTIONS));
59
  else $options = ai_get_option (str_replace ("#", $block, AD_ADx_OPTIONS));
@@ -256,7 +260,7 @@ abstract class ai_BaseCodeBlock {
256
  }
257
  }
258
 
259
- if ($options != '') $this->wp_options = array_merge ($this->wp_options, $options);
260
  unset ($this->wp_options ['']);
261
  }
262
 
@@ -485,6 +489,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
485
  $this->wp_options [AI_OPTION_ENABLE_AJAX] = AI_ENABLED;
486
  $this->wp_options [AI_OPTION_DISABLE_CACHING] = AI_DISABLED;
487
  $this->wp_options [AI_OPTION_MAX_PAGE_BLOCKS_ENABLED] = AI_DISABLED;
 
488
  $this->wp_options [AI_OPTION_ENABLE_FEED] = AI_DISABLED;
489
  $this->wp_options [AI_OPTION_ENABLED_ON_WHICH_PAGES] = AI_NO_INDIVIDUAL_EXCEPTIONS;
490
  $this->wp_options [AI_OPTION_ENABLED_ON_WHICH_POSTS] = AI_NO_INDIVIDUAL_EXCEPTIONS;
@@ -1422,6 +1427,11 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
1422
  return $option;
1423
  }
1424
 
 
 
 
 
 
1425
  // Used for shortcodes
1426
  public function get_enable_manual (){
1427
  $option = isset ($this->wp_options [AI_OPTION_ENABLE_MANUAL]) ? $this->wp_options [AI_OPTION_ENABLE_MANUAL] : AI_DISABLED;
@@ -2045,12 +2055,14 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
2045
  $version_name = $this->version_name == '' ? '' : ' - ' . $this->version_name;
2046
  $block_name = $this->number . ' &nbsp; ' . $this->get_ad_name () . '<kbd data-separator=" - " class="ai-option-name">' . $version_name . '</kbd>' . $fallback_block_name;
2047
 
2048
- $this->additional_code_before =
2049
- $this->labels->block_start () .
2050
- $this->labels->bar ($block_name, '', '<kbd class="ai-debug-name ai-main"></kbd>', $counters, $title) .
2051
- $this->additional_code_before;
 
2052
 
2053
- $this->additional_code_after .= $this->labels->block_end ();
 
2054
  }
2055
 
2056
  return $this->additional_code_before . $processed_code . $this->additional_code_after;
@@ -5026,6 +5038,44 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
5026
 
5027
  return $ad_data;
5028
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5029
  }
5030
 
5031
 
15
  var $additional_code_before; // For server-side dynamic PHP code
16
  var $additional_code_after; // For server-side dynamic PHP code
17
  var $counters;
18
+ var $client_side_cookie_check;
19
+ var $demo_debugging;
20
 
21
  var $label;
22
 
37
  $this->additional_code_after = '';
38
  $this->counters = '';
39
  $this->client_side_cookie_check = false;
40
+ $this->demo_debugging = false;
41
 
42
  $this->labels = new ai_block_labels ();
43
 
53
  public function load_options ($block) {
54
  global $ai_db_options;
55
 
56
+ if (isset ($ai_db_options [$block])) $options = $ai_db_options [$block]; else $options = array ();
57
 
58
  // Convert old options
59
+ if (empty ($options) && !isset ($ai_db_options [AI_OPTION_GLOBAL]['VERSION'])) {
60
+
61
  if ($block == "h") $options = ai_get_option (str_replace ("#", "Header", AD_ADx_OPTIONS));
62
  elseif ($block == "f") $options = ai_get_option (str_replace ("#", "Footer", AD_ADx_OPTIONS));
63
  else $options = ai_get_option (str_replace ("#", $block, AD_ADx_OPTIONS));
260
  }
261
  }
262
 
263
+ if (!empty ($options)) $this->wp_options = array_merge ($this->wp_options, $options);
264
  unset ($this->wp_options ['']);
265
  }
266
 
489
  $this->wp_options [AI_OPTION_ENABLE_AJAX] = AI_ENABLED;
490
  $this->wp_options [AI_OPTION_DISABLE_CACHING] = AI_DISABLED;
491
  $this->wp_options [AI_OPTION_MAX_PAGE_BLOCKS_ENABLED] = AI_DISABLED;
492
+ $this->wp_options [AI_OPTION_ONLY_IN_THE_LOOP] = AI_DISABLED;
493
  $this->wp_options [AI_OPTION_ENABLE_FEED] = AI_DISABLED;
494
  $this->wp_options [AI_OPTION_ENABLED_ON_WHICH_PAGES] = AI_NO_INDIVIDUAL_EXCEPTIONS;
495
  $this->wp_options [AI_OPTION_ENABLED_ON_WHICH_POSTS] = AI_NO_INDIVIDUAL_EXCEPTIONS;
1427
  return $option;
1428
  }
1429
 
1430
+ public function get_only_in_the_loop (){
1431
+ $option = isset ($this->wp_options [AI_OPTION_ONLY_IN_THE_LOOP]) ? $this->wp_options [AI_OPTION_ONLY_IN_THE_LOOP] : AI_DISABLED;
1432
+ return $option;
1433
+ }
1434
+
1435
  // Used for shortcodes
1436
  public function get_enable_manual (){
1437
  $option = isset ($this->wp_options [AI_OPTION_ENABLE_MANUAL]) ? $this->wp_options [AI_OPTION_ENABLE_MANUAL] : AI_DISABLED;
2055
  $version_name = $this->version_name == '' ? '' : ' - ' . $this->version_name;
2056
  $block_name = $this->number . ' &nbsp; ' . $this->get_ad_name () . '<kbd data-separator=" - " class="ai-option-name">' . $version_name . '</kbd>' . $fallback_block_name;
2057
 
2058
+ if (!defined ('AI_DEBUGGING_DEMO') || $this->demo_debugging) {
2059
+ $this->additional_code_before =
2060
+ $this->labels->block_start () .
2061
+ $this->labels->bar ($block_name, '', '<kbd class="ai-debug-name ai-main"></kbd>', $counters, $title) .
2062
+ $this->additional_code_before;
2063
 
2064
+ $this->additional_code_after .= $this->labels->block_end ();
2065
+ }
2066
  }
2067
 
2068
  return $this->additional_code_before . $processed_code . $this->additional_code_after;
5038
 
5039
  return $ad_data;
5040
  }
5041
+
5042
+ function extract_features (){
5043
+ global $ai_wp_data;
5044
+
5045
+ // AI_SERVER_SIDE_DETECTION
5046
+ // AI_CLIENT_SIDE_DETECTION
5047
+ // AI_CLIENT_SIDE_INSERTION
5048
+ // AI_STICK_TO_THE_CONTENT
5049
+ // AI_TRACKING
5050
+ // AI_CLOSE_BUTTONS
5051
+ // AI_ANIMATION
5052
+ // AI_LAZY_LOADING
5053
+ // AI_GEOLOCATION
5054
+
5055
+ // if ($this->get_detection_server_side()) echo "#", $this->number;
5056
+ // echo "#", $this->number;
5057
+ // return;
5058
+
5059
+ if ($this->get_detection_server_side()) $ai_wp_data [AI_SERVER_SIDE_DETECTION] = true;
5060
+ if ($this->get_detection_client_side ()) {
5061
+ $ai_wp_data [AI_CLIENT_SIDE_DETECTION] = true;
5062
+
5063
+ if ($this->get_client_side_action () == AI_CLIENT_SIDE_ACTION_INSERT) {
5064
+ $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = true;
5065
+ }
5066
+ }
5067
+
5068
+ if (function_exists ('ai_extract_features_2')) ai_extract_features_2 ($this);
5069
+
5070
+ if ($this->stick_to_the_content_class () != '') $ai_wp_data [AI_STICK_TO_THE_CONTENT] = true;
5071
+
5072
+ switch ($this->get_automatic_insertion()) {
5073
+ case AI_AUTOMATIC_INSERTION_BEFORE_HTML_ELEMENT:
5074
+ case AI_AUTOMATIC_INSERTION_AFTER_HTML_ELEMENT:
5075
+ if ($this->get_html_element_insertion () != AI_HTML_INSERTION_SEREVR_SIDE) $ai_wp_data [AI_CLIENT_SIDE_INSERTION] = true;
5076
+ break;
5077
+ }
5078
+ }
5079
  }
5080
 
5081
 
constants.php CHANGED
@@ -26,7 +26,7 @@ if (!defined( 'AD_INSERTER_NAME'))
26
  define ('AD_INSERTER_NAME', 'Ad Inserter');
27
 
28
  if (!defined( 'AD_INSERTER_VERSION'))
29
- define ('AD_INSERTER_VERSION', '2.3.15');
30
 
31
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
32
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
@@ -71,6 +71,7 @@ define ('AI_OPTION_ENABLE_FEED', 'enable_feed');
71
  define ('AI_OPTION_ENABLE_404', 'enable_404');
72
  define ('AI_OPTION_DISABLE_CACHING', 'disable_caching');
73
  define ('AI_OPTION_MAX_PAGE_BLOCKS_ENABLED', 'max_page_blocks');
 
74
  define ('AI_OPTION_BLOCK_NAME', 'name');
75
  define ('AI_OPTION_AUTOMATIC_INSERTION', 'display_type');
76
  define ('AI_OPTION_PARAGRAPH_NUMBER', 'paragraph_number');
@@ -705,6 +706,7 @@ define ('ABOVE_HEADER_HOOK_BLOCKS', 'above_header_hook');
705
  define ('HTML_ELEMENT_HOOK_BLOCKS', 'html_element_hook');
706
  define ('CUSTOM_HOOK_BLOCKS', '_hook');
707
  define ('AI_EXTRACT_USED_BLOCKS', 'used_blocks');
 
708
 
709
  define ('AI_CHECK_NONE', - 1);
710
  define ('AI_CHECK_INSERTED', 0);
@@ -824,6 +826,7 @@ define ('AI_CLIENT_SIDE_ROTATION', 35);
824
  define ('AI_CLIENT_SIDE_CSS', 36);
825
  define ('AI_LAZY_LOADING', 37);
826
  define ('AI_PAGE_BLOCKS', 38);
 
827
 
828
  define ('AI_CONTEXT_NONE', 0);
829
  define ('AI_CONTEXT_CONTENT', 1);
26
  define ('AD_INSERTER_NAME', 'Ad Inserter');
27
 
28
  if (!defined( 'AD_INSERTER_VERSION'))
29
+ define ('AD_INSERTER_VERSION', '2.3.16');
30
 
31
  if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
32
  define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
71
  define ('AI_OPTION_ENABLE_404', 'enable_404');
72
  define ('AI_OPTION_DISABLE_CACHING', 'disable_caching');
73
  define ('AI_OPTION_MAX_PAGE_BLOCKS_ENABLED', 'max_page_blocks');
74
+ define ('AI_OPTION_ONLY_IN_THE_LOOP', 'only_in_the_loop');
75
  define ('AI_OPTION_BLOCK_NAME', 'name');
76
  define ('AI_OPTION_AUTOMATIC_INSERTION', 'display_type');
77
  define ('AI_OPTION_PARAGRAPH_NUMBER', 'paragraph_number');
706
  define ('HTML_ELEMENT_HOOK_BLOCKS', 'html_element_hook');
707
  define ('CUSTOM_HOOK_BLOCKS', '_hook');
708
  define ('AI_EXTRACT_USED_BLOCKS', 'used_blocks');
709
+ define ('AI_EXTRACT_FEATURES', 'features');
710
 
711
  define ('AI_CHECK_NONE', - 1);
712
  define ('AI_CHECK_INSERTED', 0);
826
  define ('AI_CLIENT_SIDE_CSS', 36);
827
  define ('AI_LAZY_LOADING', 37);
828
  define ('AI_PAGE_BLOCKS', 38);
829
+ define ('AI_GEOLOCATION', 39);
830
 
831
  define ('AI_CONTEXT_NONE', 0);
832
  define ('AI_CONTEXT_CONTENT', 1);
css/ad-inserter.css CHANGED
@@ -1,5 +1,5 @@
1
  #ai-data {
2
- font-family: "2.3.15"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
@@ -1223,4 +1223,7 @@ img.automatic-insertion.preview {
1223
  }
1224
 
1225
 
1226
-
 
 
 
1
  #ai-data {
2
+ font-family: "2.3.16"; /* Used for version number of the file */
3
  }
4
 
5
  #blocked-warning {
1223
  }
1224
 
1225
 
1226
+ /* Fix for some themes */
1227
+ #ai-settings select {
1228
+ padding: 2px;
1229
+ }
images/info-1.jpg ADDED
Binary file
images/info-2.jpg ADDED
Binary file
images/info-3.jpg ADDED
Binary file
includes/Mobile_Detect.php CHANGED
@@ -1,30 +1,25 @@
1
  <?php
2
  /**
3
  * Mobile Detect Library
4
- * =====================
5
- *
6
  * Motto: "Every business should have a mobile detection script to detect mobile readers"
7
  *
8
  * Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets).
9
  * It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
10
  *
11
- * @author Current authors: Serban Ghita <serbanghita@gmail.com>
12
- * Nick Ilyin <nick.ilyin@gmail.com>
13
- *
14
- * Original author: Victor Stanciu <vic.stanciu@gmail.com>
15
- *
16
- * @license Code and contributions have 'MIT License'
17
- * More details: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
18
  *
19
- * @link Homepage: http://mobiledetect.net
20
- * GitHub Repo: https://github.com/serbanghita/Mobile-Detect
21
- * Google Code: http://code.google.com/p/php-mobile-detect/
22
- * README: https://github.com/serbanghita/Mobile-Detect/blob/master/README.md
23
- * HOWTO: https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples
24
  *
25
- * @version 2.8.30
26
  */
27
-
28
  class ai_Mobile_Detect
29
  {
30
  /**
@@ -66,7 +61,7 @@ class ai_Mobile_Detect
66
  /**
67
  * Stores the version number of the current release.
68
  */
69
- const VERSION = '2.8.30';
70
 
71
  /**
72
  * A type for the version() method indicating a string return value.
@@ -112,6 +107,7 @@ class ai_Mobile_Detect
112
  /**
113
  * The matches extracted from the regex expression.
114
  * This is good for debug.
 
115
  * @var string
116
  */
117
  protected $matchesArray = null;
@@ -173,9 +169,9 @@ class ai_Mobile_Detect
173
  'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 6',
174
  // @todo: Is 'Dell Streak' a tablet or a phone? ;)
175
  'Dell' => 'Dell[;]? (Streak|Aero|Venue|Venue Pro|Flash|Smoke|Mini 3iX)|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b',
176
- 'Motorola' => 'Motorola|DROIDX|DROID BIONIC|\bDroid\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\bMoto E\b|XT1068|XT1092',
177
- 'Samsung' => '\bSamsung\b|SM-G950F|SM-G955F|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205|SM-G9350|SM-J120F|SM-G920F|SM-G920V|SM-G930F|SM-N910C|SM-A310F|GT-I9190|SM-J500FN|SM-G903F',
178
- 'LG' => '\bLG\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802|MS323)',
179
  'Sony' => 'SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533',
180
  'Asus' => 'Asus.*Galaxy|PadFone.*Mobile',
181
  'NokiaLumia' => 'Lumia [0-9]{3,4}',
@@ -200,7 +196,7 @@ class ai_Mobile_Detect
200
  // http://www.wolfgangmobile.com/
201
  'Wolfgang' => 'AT-B24D|AT-AS50HD|AT-AS40W|AT-AS55HD|AT-AS45q2|AT-B26D|AT-AS50Q',
202
  'Alcatel' => 'Alcatel',
203
- 'Nintendo' => 'Nintendo 3DS',
204
  // http://en.wikipedia.org/wiki/Amoi
205
  'Amoi' => 'Amoi',
206
  // http://en.wikipedia.org/wiki/INQ
@@ -219,8 +215,11 @@ class ai_Mobile_Detect
219
  'iPad' => 'iPad|iPad.*Mobile',
220
  // Removed |^.*Android.*Nexus(?!(?:Mobile).)*$
221
  // @see #442
 
222
  'NexusTablet' => 'Android.*Nexus[\s]+(7|9|10)',
223
- 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-T116BU|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561|SM-T713|SM-T719|SM-T813|SM-T819|SM-T580|SM-T355Y?|SM-T280|SM-T817A|SM-T820|SM-W700|SM-P580|SM-T587|SM-P350|SM-P555M|SM-P355M|SM-T113NU|SM-T815Y', // SCH-P709|SCH-P729|SM-T2558|GT-I9205 - Samsung Mega - treat them like a regular phone.
 
 
224
  // http://docs.aws.amazon.com/silk/latest/developerguide/user-agent.html
225
  'Kindle' => 'Kindle|Silk.*Accelerated|Android.*\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI|KFFOWI|KFGIWI|KFMEWI)\b|Android.*Silk/[0-9.]+ like Chrome/[0-9.]+ (?!Mobile)',
226
  // Only the Surface tablets with Windows RT are considered mobile.
@@ -230,7 +229,7 @@ class ai_Mobile_Detect
230
  'HPTablet' => 'HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10',
231
  // Watch out for PadFone, see #132.
232
  // http://www.asus.com/de/Tablets_Mobile/Memo_Pad_Products/
233
- 'AsusTablet' => '^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\bK00F\b|\bK00C\b|\bK00E\b|\bK00L\b|TX201LA|ME176C|ME102A|\bM80TA\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K011 | K017 | K01E |ME572C|ME103K|ME170C|ME171C|\bME70C\b|ME581C|ME581CL|ME8510C|ME181C|P01Y|PO1MA|P01Z|\bP027\b',
234
  'BlackBerryTablet' => 'PlayBook|RIM Tablet',
235
  'HTCtablet' => 'HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410',
236
  'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617',
@@ -252,7 +251,7 @@ class ai_Mobile_Detect
252
  // Prestigio Tablets http://www.prestigio.com/support
253
  'PrestigioTablet' => 'PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD|PMP812E|PMP812E3G|PMP812F|PMP810E|PMP880TD|PMT3017|PMT3037|PMT3047|PMT3057|PMT7008|PMT5887|PMT5001|PMT5002',
254
  // http://support.lenovo.com/en_GB/downloads/default.page?#
255
- 'LenovoTablet' => 'Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-850M|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)|TB-X103F|TB-X304F|TB-8703F',
256
  // http://www.dell.com/support/home/us/en/04/Products/tab_mob/tablets
257
  'DellTablet' => 'Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7',
258
  // http://www.yarvik.com/en/matrix/tablets/
@@ -305,7 +304,7 @@ class ai_Mobile_Detect
305
  'bqTablet' => 'Android.*(bq)?.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris ([E|M]10|M8))|Maxwell.*Lite|Maxwell.*Plus',
306
  // http://www.huaweidevice.com/worldwide/productFamily.do?method=index&directoryId=5011&treeId=3290
307
  // http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index&directoryId=3372&treeId=0&tb=1&type=software (including legacy tablets)
308
- 'HuaweiTablet' => 'MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim|M2-A01L',
309
  // Nec or Medias Tab
310
  'NecTablet' => '\bN-06D|\bN-08D',
311
  // Pantech Tablets: http://www.pantechusa.com/phones/
@@ -405,7 +404,7 @@ class ai_Mobile_Detect
405
  // Skk Mobile - http://skkmobile.com.ph/product_tablets.php
406
  'SkkTablet' => 'Android.* (SKYPAD|PHOENIX|CYCLOPS)',
407
  // Tecno Mobile (only tablet) - http://www.tecno-mobile.com/index.php/product?filterby=smart&list_order=all&page=1
408
- 'TecnoTablet' => 'TECNO P9',
409
  // JXD (consoles & tablets) - http://jxd.hk/products.asp?selectclassid=009008&clsid=3
410
  'JXDTablet' => 'Android.* \b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\b',
411
  // i-Joy tablets - http://www.i-joy.es/en/cat/products/tablets/
@@ -448,6 +447,7 @@ class ai_Mobile_Detect
448
  'CelkonTablet' => 'CT695|CT888|CT[\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\bCT-1\b',
449
  // http://www.wolderelectronics.com/productos/manuales-y-guias-rapidas/categoria-2-miTab
450
  'WolderTablet' => 'miTab \b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\b',
 
451
  // http://www.mi.com/en
452
  'MiTablet' => '\bMI PAD\b|\bHM NOTE 1W\b',
453
  // http://www.nbru.cn/index.html
@@ -470,7 +470,7 @@ class ai_Mobile_Detect
470
  'Hudl' => 'Hudl HT7S3|Hudl 2',
471
  // http://www.telstra.com.au/home-phone/thub-2/
472
  'TelstraTablet' => 'T-Hub2',
473
- 'GenericTablet' => 'Android.*\b97D\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b|rk30sdk|\bEVOTAB\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\bM6pro\b|CT1020W|arc 10HD|\bTP750\b|\bQTAQZ3\b'
474
  );
475
 
476
  /**
@@ -568,7 +568,7 @@ class ai_Mobile_Detect
568
  'TV' => 'SonyDTV|HbbTV', // experimental
569
  'WebKit' => '(webkit)[ /]([\w.]+)',
570
  // @todo: Include JXD consoles.
571
- 'Console' => '\b(Nintendo|Nintendo WiiU|Nintendo 3DS|PLAYSTATION|Xbox)\b',
572
  'Watch' => 'SM-V700',
573
  );
574
 
1
  <?php
2
  /**
3
  * Mobile Detect Library
 
 
4
  * Motto: "Every business should have a mobile detection script to detect mobile readers"
5
  *
6
  * Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets).
7
  * It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
8
  *
9
+ * Homepage: http://mobiledetect.net
10
+ * GitHub: https://github.com/serbanghita/Mobile-Detect
11
+ * README: https://github.com/serbanghita/Mobile-Detect/blob/master/README.md
12
+ * CONTRIBUTING: https://github.com/serbanghita/Mobile-Detect/blob/master/docs/CONTRIBUTING.md
13
+ * KNOWN LIMITATIONS: https://github.com/serbanghita/Mobile-Detect/blob/master/docs/KNOWN_LIMITATIONS.md
14
+ * EXAMPLES: https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples
 
15
  *
16
+ * @license https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt MIT License
17
+ * @author Serban Ghita <serbanghita@gmail.com>
18
+ * @author Nick Ilyin <nick.ilyin@gmail.com>
19
+ * Original author: Victor Stanciu <vic.stanciu@gmail.com>
 
20
  *
21
+ * @version 2.8.32
22
  */
 
23
  class ai_Mobile_Detect
24
  {
25
  /**
61
  /**
62
  * Stores the version number of the current release.
63
  */
64
+ const VERSION = '2.8.32';
65
 
66
  /**
67
  * A type for the version() method indicating a string return value.
107
  /**
108
  * The matches extracted from the regex expression.
109
  * This is good for debug.
110
+ *
111
  * @var string
112
  */
113
  protected $matchesArray = null;
169
  'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 6',
170
  // @todo: Is 'Dell Streak' a tablet or a phone? ;)
171
  'Dell' => 'Dell[;]? (Streak|Aero|Venue|Venue Pro|Flash|Smoke|Mini 3iX)|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b',
172
+ 'Motorola' => 'Motorola|DROIDX|DROID BIONIC|\bDroid\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\bMoto E\b|XT1068|XT1092|XT1052',
173
+ 'Samsung' => '\bSamsung\b|SM-G950F|SM-G955F|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205|SM-G9350|SM-J120F|SM-G920F|SM-G920V|SM-G930F|SM-N910C|SM-A310F|GT-I9190|SM-J500FN|SM-G903F|SM-J330F',
174
+ 'LG' => '\bLG\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802|MS323|M257)',
175
  'Sony' => 'SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533',
176
  'Asus' => 'Asus.*Galaxy|PadFone.*Mobile',
177
  'NokiaLumia' => 'Lumia [0-9]{3,4}',
196
  // http://www.wolfgangmobile.com/
197
  'Wolfgang' => 'AT-B24D|AT-AS50HD|AT-AS40W|AT-AS55HD|AT-AS45q2|AT-B26D|AT-AS50Q',
198
  'Alcatel' => 'Alcatel',
199
+ 'Nintendo' => 'Nintendo (3DS|Switch)',
200
  // http://en.wikipedia.org/wiki/Amoi
201
  'Amoi' => 'Amoi',
202
  // http://en.wikipedia.org/wiki/INQ
215
  'iPad' => 'iPad|iPad.*Mobile',
216
  // Removed |^.*Android.*Nexus(?!(?:Mobile).)*$
217
  // @see #442
218
+ // @todo Merge NexusTablet into GoogleTablet.
219
  'NexusTablet' => 'Android.*Nexus[\s]+(7|9|10)',
220
+ // https://en.wikipedia.org/wiki/Pixel_C
221
+ 'GoogleTablet' => 'Android.*Pixel C',
222
+ 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-T116BU|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561|SM-T713|SM-T719|SM-T813|SM-T819|SM-T580|SM-T355Y?|SM-T280|SM-T817A|SM-T820|SM-W700|SM-P580|SM-T587|SM-P350|SM-P555M|SM-P355M|SM-T113NU|SM-T815Y|SM-T585|SM-T285|SM-T825|SM-W708', // SCH-P709|SCH-P729|SM-T2558|GT-I9205 - Samsung Mega - treat them like a regular phone.
223
  // http://docs.aws.amazon.com/silk/latest/developerguide/user-agent.html
224
  'Kindle' => 'Kindle|Silk.*Accelerated|Android.*\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI|KFFOWI|KFGIWI|KFMEWI)\b|Android.*Silk/[0-9.]+ like Chrome/[0-9.]+ (?!Mobile)',
225
  // Only the Surface tablets with Windows RT are considered mobile.
229
  'HPTablet' => 'HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10',
230
  // Watch out for PadFone, see #132.
231
  // http://www.asus.com/de/Tablets_Mobile/Memo_Pad_Products/
232
+ 'AsusTablet' => '^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\bK00F\b|\bK00C\b|\bK00E\b|\bK00L\b|TX201LA|ME176C|ME102A|\bM80TA\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K011 | K017 | K01E |ME572C|ME103K|ME170C|ME171C|\bME70C\b|ME581C|ME581CL|ME8510C|ME181C|P01Y|PO1MA|P01Z|\bP027\b|\bP024\b|\bP00C\b',
233
  'BlackBerryTablet' => 'PlayBook|RIM Tablet',
234
  'HTCtablet' => 'HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410',
235
  'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617',
251
  // Prestigio Tablets http://www.prestigio.com/support
252
  'PrestigioTablet' => 'PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD|PMP812E|PMP812E3G|PMP812F|PMP810E|PMP880TD|PMT3017|PMT3037|PMT3047|PMT3057|PMT7008|PMT5887|PMT5001|PMT5002',
253
  // http://support.lenovo.com/en_GB/downloads/default.page?#
254
+ 'LenovoTablet' => 'Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-850M|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)|TB-X103F|TB-X304F|TB-X304L|TB-8703F|Tab2A7-10F',
255
  // http://www.dell.com/support/home/us/en/04/Products/tab_mob/tablets
256
  'DellTablet' => 'Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7',
257
  // http://www.yarvik.com/en/matrix/tablets/
304
  'bqTablet' => 'Android.*(bq)?.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris ([E|M]10|M8))|Maxwell.*Lite|Maxwell.*Plus',
305
  // http://www.huaweidevice.com/worldwide/productFamily.do?method=index&directoryId=5011&treeId=3290
306
  // http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index&directoryId=3372&treeId=0&tb=1&type=software (including legacy tablets)
307
+ 'HuaweiTablet' => 'MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim|M2-A01L|BAH-L09|BAH-W09',
308
  // Nec or Medias Tab
309
  'NecTablet' => '\bN-06D|\bN-08D',
310
  // Pantech Tablets: http://www.pantechusa.com/phones/
404
  // Skk Mobile - http://skkmobile.com.ph/product_tablets.php
405
  'SkkTablet' => 'Android.* (SKYPAD|PHOENIX|CYCLOPS)',
406
  // Tecno Mobile (only tablet) - http://www.tecno-mobile.com/index.php/product?filterby=smart&list_order=all&page=1
407
+ 'TecnoTablet' => 'TECNO P9|TECNO DP8D',
408
  // JXD (consoles & tablets) - http://jxd.hk/products.asp?selectclassid=009008&clsid=3
409
  'JXDTablet' => 'Android.* \b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\b',
410
  // i-Joy tablets - http://www.i-joy.es/en/cat/products/tablets/
447
  'CelkonTablet' => 'CT695|CT888|CT[\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\bCT-1\b',
448
  // http://www.wolderelectronics.com/productos/manuales-y-guias-rapidas/categoria-2-miTab
449
  'WolderTablet' => 'miTab \b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\b',
450
+ 'MediacomTablet' => 'M-MPI10C3G|M-SP10EG|M-SP10EGP|M-SP10HXAH|M-SP7HXAH|M-SP10HXBH|M-SP8HXAH|M-SP8MXA',
451
  // http://www.mi.com/en
452
  'MiTablet' => '\bMI PAD\b|\bHM NOTE 1W\b',
453
  // http://www.nbru.cn/index.html
470
  'Hudl' => 'Hudl HT7S3|Hudl 2',
471
  // http://www.telstra.com.au/home-phone/thub-2/
472
  'TelstraTablet' => 'T-Hub2',
473
+ 'GenericTablet' => 'Android.*\b97D\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b|rk30sdk|\bEVOTAB\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\bM6pro\b|CT1020W|arc 10HD|\bTP750\b|\bQTAQZ3\b|WVT101|TM1088|KT107'
474
  );
475
 
476
  /**
568
  'TV' => 'SonyDTV|HbbTV', // experimental
569
  'WebKit' => '(webkit)[ /]([\w.]+)',
570
  // @todo: Include JXD consoles.
571
+ 'Console' => '\b(Nintendo|Nintendo WiiU|Nintendo 3DS|Nintendo Switch|PLAYSTATION|Xbox)\b',
572
  'Watch' => 'SM-V700',
573
  );
574
 
includes/placeholders.php CHANGED
@@ -5,7 +5,15 @@
5
 
6
  function generate_placeholder_editor ($placeholder_url, $block) {
7
 
8
- $base_placeholder_url = 'http://via.placeholder.com/';
 
 
 
 
 
 
 
 
9
 
10
  $standard_placeholders = array (
11
  'Custom',
@@ -32,9 +40,9 @@ function generate_placeholder_editor ($placeholder_url, $block) {
32
  $initial_placeholder_url = $base_placeholder_url . $initial_placeholder_size;
33
 
34
  $parameters = array ();
35
- if (strpos ($placeholder_url, $base_placeholder_url) === 0) {
36
  $initial_placeholder_url = $placeholder_url;
37
- $url = str_replace ($base_placeholder_url, '', $placeholder_url);
38
 
39
  $query = '';
40
  if (strpos ($url, '?') !== false) {
5
 
6
  function generate_placeholder_editor ($placeholder_url, $block) {
7
 
8
+ $placeholder_protocol = 'http://';
9
+ $placeholder_domain = 'via.placeholder.com';
10
+
11
+ $base_placeholder_url = $placeholder_protocol . $placeholder_domain . '/';
12
+
13
+ if (is_ssl()) {
14
+ $base_placeholder_url = str_replace ('http://', 'https://', $base_placeholder_url);
15
+ }
16
+
17
 
18
  $standard_placeholders = array (
19
  'Custom',
40
  $initial_placeholder_url = $base_placeholder_url . $initial_placeholder_size;
41
 
42
  $parameters = array ();
43
+ if (strpos ($placeholder_url, $placeholder_domain) !== false) {
44
  $initial_placeholder_url = $placeholder_url;
45
+ $url = str_replace (array ('http://', 'https://', $placeholder_domain . '/'), '', $placeholder_url);
46
 
47
  $query = '';
48
  if (strpos ($url, '?') !== false) {
includes/preview.php CHANGED
@@ -73,7 +73,7 @@ function generate_code_preview (
73
  $sticky = false;
74
  $class = '';
75
  $sticky_parameters = '';
76
- $functions = function_exists ('ai_load_settings_2');
77
 
78
  if (!$adsense) {
79
  switch ($alignment_type) {
@@ -2128,7 +2128,7 @@ Single pages (posts and static pages) have also additional setting for individua
2128
 
2129
  <?php ai_wp_footer_hook (); ?>
2130
  <script>
2131
- <?php if (function_exists ('ai_load_settings_2')) echo ai_get_js ('ai-close'); ?>
2132
  <?php
2133
  if ($sticky) echo ai_get_js ('ai-sticky');
2134
  echo ai_get_js ('ai-rotate');
73
  $sticky = false;
74
  $class = '';
75
  $sticky_parameters = '';
76
+ $functions = function_exists ('ai_extract_features_2');
77
 
78
  if (!$adsense) {
79
  switch ($alignment_type) {
2128
 
2129
  <?php ai_wp_footer_hook (); ?>
2130
  <script>
2131
+ <?php if (function_exists ('ai_extract_features_2')) echo ai_get_js ('ai-close'); ?>
2132
  <?php
2133
  if ($sticky) echo ai_get_js ('ai-sticky');
2134
  echo ai_get_js ('ai-rotate');
js/ad-inserter.js CHANGED
@@ -1,4 +1,4 @@
1
- var javascript_version = "2.3.15";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
@@ -1681,8 +1681,10 @@ jQuery(document).ready(function($) {
1681
  if ($('#icons-css-code-'+block).is(':visible')) {
1682
  $("#show-css-button-"+block+" span").text ("Hide");
1683
  configure_selection_icons (block);
 
1684
  } else {
1685
  $("#show-css-button-"+block+" span").text ("Show");
 
1686
  }
1687
  });
1688
 
1
+ var javascript_version = "2.3.16";
2
  var ignore_key = true;
3
  var start = 1;
4
  var end = 16;
1681
  if ($('#icons-css-code-'+block).is(':visible')) {
1682
  $("#show-css-button-"+block+" span").text ("Hide");
1683
  configure_selection_icons (block);
1684
+ process_display_elements (block);
1685
  } else {
1686
  $("#show-css-button-"+block+" span").text ("Show");
1687
+ $("#sticky-animation-"+block).hide ();
1688
  }
1689
  });
1690
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: ads, adsense, header footer code, ad management, sticky fixed widgets, adv
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.6
9
- Stable tag: 2.3.14
10
  License: GPLv3
11
 
12
  Insert and manage ads: Amazon, Google AdSense ads, banner rotation, sticky widget ads, AMP, PHP, HTML, CSS, Javascript, tracking, footer, header code
@@ -676,6 +676,13 @@ AD CODE RIGHT
676
 
677
  == Changelog ==
678
 
 
 
 
 
 
 
 
679
  = 2.3.15 =
680
  - Fix for insertion on AMP pages
681
 
@@ -773,6 +780,13 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
773
 
774
  == Upgrade Notice ==
775
 
 
 
 
 
 
 
 
776
  = 2.3.15 =
777
  Fix for insertion on AMP pages
778
 
6
  Requires at least: 4.0
7
  Tested up to: 4.9
8
  Requires PHP: 5.6
9
+ Stable tag: 2.3.15
10
  License: GPLv3
11
 
12
  Insert and manage ads: Amazon, Google AdSense ads, banner rotation, sticky widget ads, AMP, PHP, HTML, CSS, Javascript, tracking, footer, header code
676
 
677
  == Changelog ==
678
 
679
+ = 2.3.16 =
680
+ - Added option to insert block only when WP loop is currently active
681
+ - Added support for Better AMP plugin
682
+ - Code generator for placeholders on https sites now generates https urls
683
+ - Optimized loading of plugin settings
684
+ - Few minor bug fixes, cosmetic changes and code improvements
685
+
686
  = 2.3.15 =
687
  - Fix for insertion on AMP pages
688
 
780
 
781
  == Upgrade Notice ==
782
 
783
+ = 2.3.16 =
784
+ Added option to insert block only when WP loop is currently active;
785
+ Added support for Better AMP plugin;
786
+ Code generator for placeholders on https sites now generates https urls;
787
+ Optimized loading of plugin settings;
788
+ Few minor bug fixes, cosmetic changes and code improvements;
789
+
790
  = 2.3.15 =
791
  Fix for insertion on AMP pages
792
 
settings.php CHANGED
@@ -413,7 +413,29 @@ function generate_settings_form (){
413
  $url_parameter_list = $obj->get_url_parameter_list();
414
  $domain_list = $obj->get_ad_domain_list();
415
  if (function_exists ('ai_lists')) $lists = ai_lists ($obj); else $lists = false;
416
- $show_lists = $cat_list != '' || $tag_list != '' || $taxonomy_list != '' || $id_list != '' || $url_list != '' || $url_parameter_list != '' || $domain_list != '' || $lists;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
417
  if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
418
 
419
  $show_manual = $manual [$block];
@@ -427,6 +449,7 @@ function generate_settings_form (){
427
  $obj->get_enable_404 () == AI_ENABLED ||
428
  $obj->get_enable_feed () == AI_ENABLED ||
429
  $obj->get_max_page_blocks_enabled () ||
 
430
  $obj->get_disable_caching ();
431
 
432
  $word_count_options =
@@ -865,7 +888,7 @@ function generate_settings_form (){
865
 
866
  <div style="padding: 0; min-height: 28px;">
867
  <div style="float: left;">
868
- <button id="lists-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="White/Black-list Category, Tag, Url, Referer (domain) or Country"><span style="<?php echo $lists_style; ?>">Lists</span></button>
869
  <button id="manual-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="Widget, Shortcode and PHP function call"><span style="<?php echo $manual_style; ?>">Manual</span></button>
870
  <button id="device-detection-button-<?php echo $block; ?>" class='ai-button2' type="button" style="display: none; margin-right: 4px;" title="Client/Server-side Device Detection (Desktop, Tablet, Phone,...)"><span style="<?php echo $devices_style; ?>">Devices</span></button>
871
  <button id="misc-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="Check for user status, Limit insertions, [error 404 page, Ajax requests, RSS feeds], Filter, Scheduling, General tag"><span style="<?php echo $misc_style; ?>">Misc</span></button>
@@ -1665,10 +1688,26 @@ function generate_settings_form (){
1665
  </tr>
1666
  </tbody>
1667
  </table>
1668
-
1669
  </div>
 
1670
  <div class="rounded">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1671
 
 
1672
  <table class="responsive-table" style="width: 100%">
1673
  <tbody>
1674
  <tr>
@@ -1681,15 +1720,12 @@ function generate_settings_form (){
1681
  <option value="<?php echo AD_DISPLAY_ADMINISTRATORS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_ADMINISTRATORS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_ADMINISTRATORS; ?></option>
1682
  </select>
1683
  </td>
1684
- <td>
1685
- Max <input type="text" style="width: 32px;" name="<?php echo AI_OPTION_MAXIMUM_INSERTIONS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_maximum_insertions (); ?>" value="<?php echo $obj->get_maximum_insertions (); ?>" size="1" maxlength="3" title="Maximum number of insertion of this block. Empty or 0 means no limit" /> insertions
 
 
1686
  </td>
1687
- <td>
1688
- <input type="hidden" name="<?php echo AI_OPTION_MAX_PAGE_BLOCKS_ENABLED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
1689
- <input id="max-page-blocks-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_MAX_PAGE_BLOCKS_ENABLED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" title="Count this block for Max blocks per page limit (defined on the tab &#9881; / tab General)" default="<?php echo $default->get_max_page_blocks_enabled (); ?>" <?php if ($obj->get_max_page_blocks_enabled () == AI_ENABLED) echo 'checked '; ?> />
1690
- <label for="max-page-blocks-<?php echo $block; ?>" title="Count this block for Max blocks per page limit (defined on the tab &#9881; / tab General)">Max blocks per page</label>
1691
- </td>
1692
- <td style="width: 30%">
1693
  <span style="float: right;">
1694
  <input type="hidden" name="<?php echo AI_OPTION_DISABLE_CACHING, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
1695
  <input id="disable-caching-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_DISABLE_CACHING, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_disable_caching (); ?>" <?php if ($obj->get_disable_caching () == AI_ENABLED) echo 'checked '; ?> />
@@ -2587,6 +2623,9 @@ function generate_settings_form (){
2587
  var blocking_counter = 0;
2588
  replace_blocked_image ('ai-media-1', 'contextual-1.gif', 'block');
2589
  replace_blocked_image ('ai-media-2', 'contextual-2.jpg', 'block');
 
 
 
2590
  replace_blocked_image ('ai-pro-1', 'icon-256x256.jpg', 'block');
2591
  replace_blocked_image ('ai-pro-2', 'ai-charts-250.png', 'block');
2592
  replace_blocked_image ('ai-pro-3', 'ai-countries-250.png', 'block');
@@ -3227,7 +3266,8 @@ function generate_list_options ($options) {
3227
 
3228
  switch ($options) {
3229
  case 'category':
3230
- $category_data = get_categories ();
 
3231
  $category_data = array_slice ($category_data, 0, $max_items);
3232
  foreach ($category_data as $category) {
3233
  echo " <option value='{$category->slug}'>{$category->slug} ({$category->name})</option>\n";
@@ -3335,10 +3375,32 @@ function sidebar_addense_alternative () { ?>
3335
  </div>
3336
  <div style="clear: both;"></div>
3337
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3338
 
3339
  <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3340
- <a href='http://bit.ly/2oF81Oh' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>
3341
  </div>
 
 
 
 
3342
 
3343
  <?php
3344
  }
@@ -3432,9 +3494,10 @@ function sidebar_pro () {
3432
  <div>
3433
  <?php switch ($version) {
3434
  case 0: ?>
3435
- <a href="http://adinserter.pro/" class="clear-link" title="Automate ad placement on posts and pages" target="_blank"><img id="ai-pro-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="margin-top: 10px;" /></a>
 
3436
  <?php break; case 1: ?>
3437
- <a href='http://bit.ly/2oF81Oh' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3438
  <?php break;
3439
  } ?>
3440
  </div>
@@ -3450,9 +3513,10 @@ function sidebar_pro () {
3450
  <div>
3451
  <?php switch ($version) {
3452
  case 0: ?>
3453
- <a href='http://bit.ly/2oF81Oh' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3454
  <?php break; case 1: ?>
3455
- <a href="https://adinserter.pro/lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" style="margin-top: 10px;" /></a>
 
3456
  <?php break;
3457
  } ?>
3458
  </div>
413
  $url_parameter_list = $obj->get_url_parameter_list();
414
  $domain_list = $obj->get_ad_domain_list();
415
  if (function_exists ('ai_lists')) $lists = ai_lists ($obj); else $lists = false;
416
+ $show_lists =
417
+ $cat_list != '' ||
418
+ $obj->get_ad_block_cat_type() == AD_WHITE_LIST ||
419
+
420
+ $tag_list != '' ||
421
+ $obj->get_ad_block_tag_type() == AD_WHITE_LIST ||
422
+
423
+ $taxonomy_list != '' ||
424
+ $obj->get_ad_block_taxonomy_type() == AD_WHITE_LIST ||
425
+
426
+ $id_list != '' ||
427
+ $obj->get_id_list_type() == AD_WHITE_LIST ||
428
+
429
+ $url_list != '' ||
430
+ $obj->get_ad_url_list_type() == AD_WHITE_LIST ||
431
+
432
+ $url_parameter_list != '' ||
433
+ $obj->get_url_parameter_list_type() == AD_WHITE_LIST ||
434
+
435
+ $domain_list != '' ||
436
+ $obj->get_ad_domain_list_type() == AD_WHITE_LIST ||
437
+
438
+ $lists;
439
  if ($show_lists) $lists_style = "font-weight: bold; color: #66f;"; else $lists_style = "";
440
 
441
  $show_manual = $manual [$block];
449
  $obj->get_enable_404 () == AI_ENABLED ||
450
  $obj->get_enable_feed () == AI_ENABLED ||
451
  $obj->get_max_page_blocks_enabled () ||
452
+ $obj->get_only_in_the_loop () ||
453
  $obj->get_disable_caching ();
454
 
455
  $word_count_options =
888
 
889
  <div style="padding: 0; min-height: 28px;">
890
  <div style="float: left;">
891
+ <button id="lists-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="White/Black-list Category, Tag, Taxonomy, Post ID, Url, Url parameter, Cookie or Referer (domain)"><span style="<?php echo $lists_style; ?>">Lists</span></button>
892
  <button id="manual-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="Widget, Shortcode and PHP function call"><span style="<?php echo $manual_style; ?>">Manual</span></button>
893
  <button id="device-detection-button-<?php echo $block; ?>" class='ai-button2' type="button" style="display: none; margin-right: 4px;" title="Client/Server-side Device Detection (Desktop, Tablet, Phone,...)"><span style="<?php echo $devices_style; ?>">Devices</span></button>
894
  <button id="misc-button-<?php echo $block; ?>" type="button" class='ai-button2' style="display: none; margin-right: 4px;" title="Check for user status, Limit insertions, [error 404 page, Ajax requests, RSS feeds], Filter, Scheduling, General tag"><span style="<?php echo $misc_style; ?>">Misc</span></button>
1688
  </tr>
1689
  </tbody>
1690
  </table>
 
1691
  </div>
1692
+
1693
  <div class="rounded">
1694
+ <table class="responsive-table" style="width: 100%">
1695
+ <tbody>
1696
+ <tr>
1697
+ <td style="width: 20%" title="Maximum number of insertion of this block. Empty or 0 means no limit">
1698
+ Max <input type="text" style="width: 32px;" name="<?php echo AI_OPTION_MAXIMUM_INSERTIONS, WP_FORM_FIELD_POSTFIX, $block; ?>" default="<?php echo $default->get_maximum_insertions (); ?>" value="<?php echo $obj->get_maximum_insertions (); ?>" size="1" maxlength="3" /> insertions
1699
+ </td>
1700
+ <td title="Count this block for Max blocks per page limit (defined on the tab &#9881; / tab General)">
1701
+ <input type="hidden" name="<?php echo AI_OPTION_MAX_PAGE_BLOCKS_ENABLED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
1702
+ <input id="max-page-blocks-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_MAX_PAGE_BLOCKS_ENABLED, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_max_page_blocks_enabled (); ?>" <?php if ($obj->get_max_page_blocks_enabled () == AI_ENABLED) echo 'checked '; ?> />
1703
+ <label for="max-page-blocks-<?php echo $block; ?>">Max blocks per page</label>
1704
+ </td>
1705
+ </tr>
1706
+ </tbody>
1707
+ </table>
1708
+ </div>
1709
 
1710
+ <div class="rounded">
1711
  <table class="responsive-table" style="width: 100%">
1712
  <tbody>
1713
  <tr>
1720
  <option value="<?php echo AD_DISPLAY_ADMINISTRATORS; ?>" <?php echo ($obj->get_display_for_users()==AD_DISPLAY_ADMINISTRATORS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AD_DISPLAY_ADMINISTRATORS; ?></option>
1721
  </select>
1722
  </td>
1723
+ <td title="Insert block only when WP function in_the_loop () returns true (WP loop is currently active). Might speed up insertion on content pages when the_content filter is called multiple times." >
1724
+ <input type="hidden" name="<?php echo AI_OPTION_ONLY_IN_THE_LOOP, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
1725
+ <input id="only-in-the-loop-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_ONLY_IN_THE_LOOP, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_only_in_the_loop (); ?>" <?php if ($obj->get_only_in_the_loop () == AI_ENABLED) echo 'checked '; ?> />
1726
+ <label for="only-in-the-loop-<?php echo $block; ?>">Insert only in the loop</label>
1727
  </td>
1728
+ <td style="width: 45%">
 
 
 
 
 
1729
  <span style="float: right;">
1730
  <input type="hidden" name="<?php echo AI_OPTION_DISABLE_CACHING, WP_FORM_FIELD_POSTFIX, $block; ?>" value="0" />
1731
  <input id="disable-caching-<?php echo $block; ?>" type="checkbox" name="<?php echo AI_OPTION_DISABLE_CACHING, WP_FORM_FIELD_POSTFIX, $block; ?>" value="1" default="<?php echo $default->get_disable_caching (); ?>" <?php if ($obj->get_disable_caching () == AI_ENABLED) echo 'checked '; ?> />
2623
  var blocking_counter = 0;
2624
  replace_blocked_image ('ai-media-1', 'contextual-1.gif', 'block');
2625
  replace_blocked_image ('ai-media-2', 'contextual-2.jpg', 'block');
2626
+ replace_blocked_image ('ai-info-1', 'info-1.jpg', 'block');
2627
+ replace_blocked_image ('ai-info-2', 'info-2.jpg', 'block');
2628
+ replace_blocked_image ('ai-info-3', 'info-3.jpg', 'block');
2629
  replace_blocked_image ('ai-pro-1', 'icon-256x256.jpg', 'block');
2630
  replace_blocked_image ('ai-pro-2', 'ai-charts-250.png', 'block');
2631
  replace_blocked_image ('ai-pro-3', 'ai-countries-250.png', 'block');
3266
 
3267
  switch ($options) {
3268
  case 'category':
3269
+ $args = array("hide_empty" => 0);
3270
+ $category_data = get_categories ($args);
3271
  $category_data = array_slice ($category_data, 0, $max_items);
3272
  foreach ($category_data as $category) {
3273
  echo " <option value='{$category->slug}'>{$category->slug} ({$category->name})</option>\n";
3375
  </div>
3376
  <div style="clear: both;"></div>
3377
  </div>
3378
+ <?php
3379
+ switch (rand (1, 2)) {
3380
+ case 1:
3381
+ ?>
3382
+ <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3383
+ <a href='http://bit.ly/Media-net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>
3384
+ </div>
3385
+
3386
+ <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3387
+ <a href='http://bit.ly/Info-links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-1.jpg" /></a>
3388
+ </div>
3389
+ <?php
3390
+ break;
3391
+ case 2:
3392
+ ?>
3393
+ <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3394
+ <a href='http://bit.ly/Info-links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-1.jpg" /></a>
3395
+ </div>
3396
 
3397
  <div class="ai-form rounded" style="height: 90px; padding: 8px 4px 8px 12px;">
3398
+ <a href='http://bit.ly/Media-net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-1.gif" /></a>
3399
  </div>
3400
+ <?php
3401
+ break;
3402
+ }
3403
+ ?>
3404
 
3405
  <?php
3406
  }
3494
  <div>
3495
  <?php switch ($version) {
3496
  case 0: ?>
3497
+ <!-- <a href="http://adinserter.pro/" class="clear-link" title="Automate ad placement on posts and pages" target="_blank"><img id="ai-pro-1" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>icon-256x256.jpg" style="margin-top: 10px;" /></a>-->
3498
+ <a href='http://bit.ly/info_links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-3.jpg" style="margin-top: 10px;" /></a>
3499
  <?php break; case 1: ?>
3500
+ <a href='http://bit.ly/media_net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3501
  <?php break;
3502
  } ?>
3503
  </div>
3513
  <div>
3514
  <?php switch ($version) {
3515
  case 0: ?>
3516
+ <a href='http://bit.ly/media_net' class="clear-link" title="Looking for AdSense alternative?" target="_blank"><img id="ai-media-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>contextual-2.jpg" style="margin-top: 10px;" /></a>
3517
  <?php break; case 1: ?>
3518
+ <!-- <a href="https://adinserter.pro/lists#geo-targeting" class="clear-link" title="Geotargeting - black/white-list countries" target="_blank"><img id="ai-pro-3" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>ai-countries-250.png" style="margin-top: 10px;" /></a>-->
3519
+ <a href='http://bit.ly/info_links' class="clear-link" title="Add Infolinks Ads with Adsense to earn More Money" target="_blank"><img id="ai-info-2" src="<?php echo AD_INSERTER_PLUGIN_IMAGES_URL; ?>info-2.jpg" style="margin-top: 10px;" /></a>
3520
  <?php break;
3521
  } ?>
3522
  </div>