Version Description
- Changes for compatibility with PHP 7.1
- Automatic rename of old pro plugin slug (Pro only)
- Added support for additional Pro features (Pro only)
- Few bug fixes and cosmetic changes
Download this release
Release Info
Developer | spacetime |
Plugin | Ad Inserter – WordPress Ads Management with AdSense Header Integration |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
- ad-inserter.php +130 -161
- class.php +186 -209
- constants.php +5 -3
- css/ad-inserter.css +1 -1
- js/ad-inserter.js +10 -2
- readme.txt +16 -2
- settings.php +4 -1
ad-inserter.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Ad Inserter
|
4 |
-
Version: 2.1.
|
5 |
Description: Insert any ad or code into Wordpress. Perfect for all kinds of ads. Simply enter any ad or HTML/Javascript/PHP code and select where and how you want to display it.
|
6 |
Author: Igor Funa
|
7 |
Author URI: http://igorfuna.com/
|
@@ -11,6 +11,12 @@ Plugin URI: http://adinserter.pro/documentation
|
|
11 |
/*
|
12 |
Change Log
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
Ad Inserter 2.1.0 - 10 February 2017
|
15 |
- Added support to insert ads in Ajax requests (e.g. in infinite scroll)
|
16 |
- Added support to not include block classes when class name is empty
|
@@ -450,7 +456,7 @@ if ($ai_wp_data [SERVER_SIDE_DETECTION]) {
|
|
450 |
|
451 |
if (isset ($_POST [AI_FORM_SAVE]))
|
452 |
define ('AI_SYNTAX_HIGHLIGHTING', isset ($_POST ["syntax-highlighter-theme"]) && $_POST ["syntax-highlighter-theme"] != AI_OPTION_DISABLED); else
|
453 |
-
define ('AI_SYNTAX_HIGHLIGHTING',
|
454 |
|
455 |
add_action ('admin_menu', 'ai_admin_menu_hook');
|
456 |
|
@@ -718,6 +724,7 @@ function ai_log_block_status ($block, $ai_last_check) {
|
|
718 |
case AI_CHECK_PARAGRAPHS_AFTER_TEXT: $status .= "PARAGRAPHS AFTER TEXT"; break;
|
719 |
case AI_CHECK_PARAGRAPHS_AFTER_CLEARANCE: $status .= "PARAGRAPHS AFTER CLEARANCE"; break;
|
720 |
case AI_CHECK_PARAGRAPHS_MIN_NUMBER: $status .= "PARAGRAPHS MIN NUMBER"; break;
|
|
|
721 |
|
722 |
case AI_CHECK_DO_NOT_INSERT: $status .= "PARAGRAPH CLEARANCE"; break;
|
723 |
case AI_CHECK_AD_ABOVE: $status .= "PARAGRAPH CLEARANCE ABOVE"; break;
|
@@ -1003,7 +1010,7 @@ function add_footer_inline_scripts () {
|
|
1003 |
|
1004 |
echo 'jQuery(function($){$("div.ai-rotate").each(function(){var rotate_options=$(".ai-rotate-option",this);var random_index=Math.floor(Math.random()*rotate_options.length);rotate_options.hide();$(rotate_options[random_index]).css({"display":"","visibility":"","position":"","width":"","height":"","top":"","left":""});$(this).css({"position":""})})});';
|
1005 |
|
1006 |
-
//
|
1007 |
// function getParameterByName (name, url) {
|
1008 |
// if (!url) {
|
1009 |
// url = window.location.href;
|
@@ -1016,6 +1023,7 @@ function add_footer_inline_scripts () {
|
|
1016 |
// return decodeURIComponent(results[2].replace(/\+/g, " "));
|
1017 |
// }
|
1018 |
|
|
|
1019 |
// var nonce = "'.wp_create_nonce ("adinserter_data").'";
|
1020 |
// var site_url = "'.wp_make_link_relative (get_site_url()).'";
|
1021 |
// var page = site_url+"/wp-admin/admin-ajax.php?action=ai_data&ip-data=ip-address-country&ai_check=" + nonce;
|
@@ -1029,6 +1037,8 @@ function add_footer_inline_scripts () {
|
|
1029 |
|
1030 |
// $.get (page, function (ip_data) {
|
1031 |
|
|
|
|
|
1032 |
// $("div.ai-ip-data").each (function () {
|
1033 |
// var ip_data_array = ip_data.split (",");
|
1034 |
// var ip_address = ip_data_array [0];
|
@@ -1119,7 +1129,8 @@ function add_footer_inline_scripts () {
|
|
1119 |
// block_div.hide ();
|
1120 |
// }
|
1121 |
// });
|
1122 |
-
// }).fail (function() {
|
|
|
1123 |
// $("div.ai-ip-data").each (function () {
|
1124 |
// $(this).css ({"display": "none", "visibility": "", "position": "", "width": "", "height": "", "z-index": ""});
|
1125 |
// });
|
@@ -1127,12 +1138,12 @@ function add_footer_inline_scripts () {
|
|
1127 |
// });
|
1128 |
//';
|
1129 |
|
1130 |
-
echo 'jQuery(function($){function getParameterByName(name,url){if(!url)url=window.location.href;name=name.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)"),results=regex.exec(url);if(!results)return null;if(!results[2])return"";return decodeURIComponent(results[2].replace(/\+/g," "))}var nonce="'.wp_create_nonce ("adinserter_data").'";var site_url="'.wp_make_link_relative (get_site_url()).'";var page=site_url+"/wp-admin/admin-ajax.php?action=ai_data&ip-data=ip-address-country&ai_check="+
|
1131 |
-
if(debug_ip_address!=null)page+="&ai-debug-ip-address="+debug_ip_address;var debug_ip_address=getParameterByName("ai-debug-country");if(debug_ip_address!=null)page+="&ai-debug-country="+debug_ip_address;var enable_block=false;$.get(page,function(ip_data){
|
1132 |
-
if(typeof ip_addresses_list!="undefined"){var ip_address_array=ip_addresses_list.split(",");var ip_address_list_type=$(this).attr("ip-address-list");$.each(ip_address_array,function(index,list_ip_address){if(list_ip_address.charAt(0)=="*")if(list_ip_address.charAt(list_ip_address.length-1)=="*"){list_ip_address=list_ip_address.substr(1,list_ip_address.length-
|
1133 |
-
list_ip_address){found=true;return false}}else if(list_ip_address.charAt(list_ip_address.length-1)=="*"){list_ip_address=list_ip_address.substr(0,list_ip_address.length-1);if(ip_address.indexOf(list_ip_address)==0){found=true;return false}}else if(list_ip_address=="#"&&ip_address==""){found=true;return false}else if(list_ip_address==
|
1134 |
-
|
1135 |
-
"position":"","z-index":""});if(!enable_block){$(this).hide();block_div.hide()}})}).fail(function(){
|
1136 |
|
1137 |
echo "\n</script>\n";
|
1138 |
}
|
@@ -1451,14 +1462,14 @@ function ai_write_debug_info ($write_processing_log = false) {
|
|
1451 |
echo "TOTAL PROCESSING TIME: ", number_format ($ai_total_plugin_time * 1000, 2), " ms\n";
|
1452 |
|
1453 |
echo "SETTINGS: ";
|
1454 |
-
if (isset ($ai_db_options [
|
1455 |
-
echo (int) ($ai_db_options [
|
1456 |
-
(int) ($ai_db_options [
|
1457 |
-
(int) ($ai_db_options [
|
1458 |
|
1459 |
echo "\n";
|
1460 |
echo "SETTINGS TIMESTAMP: ";
|
1461 |
-
echo isset ($ai_db_options [
|
1462 |
echo "MULTISITE: ", is_multisite() ? "YES" : "NO", "\n";
|
1463 |
if (is_multisite()) {
|
1464 |
echo "MAIN SITE: ", is_main_site () ? "YES" : "NO", "\n";
|
@@ -1508,7 +1519,7 @@ function ai_write_debug_info ($write_processing_log = false) {
|
|
1508 |
|
1509 |
$default = new ai_Block (1);
|
1510 |
|
1511 |
-
echo "BLOCK SETTINGS Po Pa Hp Cp Ap Sp Fe 404 Wi Sh PHP\n";
|
1512 |
for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
|
1513 |
$obj = $block_object [$block];
|
1514 |
|
@@ -1571,17 +1582,18 @@ function ai_write_debug_info ($write_processing_log = false) {
|
|
1571 |
|
1572 |
echo sprintf ("%2d %-21s ", $block, substr ($obj->get_ad_name(), 0, 21));
|
1573 |
|
1574 |
-
echo $obj->get_display_settings_post()
|
1575 |
-
echo $obj->get_display_settings_page()
|
1576 |
-
echo $obj->get_display_settings_home()
|
1577 |
echo $obj->get_display_settings_category() ? "o" : ".", " ";
|
1578 |
-
echo $obj->get_display_settings_archive()
|
1579 |
-
echo $obj->get_display_settings_search()
|
1580 |
-
echo $obj->
|
1581 |
-
echo $obj->
|
1582 |
-
echo $obj->
|
1583 |
-
echo $obj->
|
1584 |
-
echo $obj->
|
|
|
1585 |
|
1586 |
echo $settings, "\n";
|
1587 |
}
|
@@ -1613,7 +1625,7 @@ function ai_write_debug_info ($write_processing_log = false) {
|
|
1613 |
foreach ($posts_pages as $page) {
|
1614 |
$post_meta = get_post_meta ($page->ID, '_adinserter_block_exceptions', true);
|
1615 |
if ($post_meta == '') continue;
|
1616 |
-
echo sprintf ("%-24s %-6s %s %-64s %s", $post_meta, $page->ID, $page->post_type, $page->post_title, get_permalink ($page->ID)), "\n";
|
1617 |
}
|
1618 |
echo "\n";
|
1619 |
}
|
@@ -1818,122 +1830,118 @@ function ai_load_options () {
|
|
1818 |
function get_viewport_css () {
|
1819 |
global $ai_db_options;
|
1820 |
|
1821 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $
|
1822 |
-
if (!$plugin_db_options) $plugin_db_options = get_option (AD_OPTIONS); // Old options
|
1823 |
|
1824 |
-
|
1825 |
-
|
1826 |
-
return ($plugin_db_options ['VIEWPORT_CSS']);
|
1827 |
}
|
1828 |
|
1829 |
function get_syntax_highlighter_theme () {
|
1830 |
global $ai_db_options;
|
1831 |
|
1832 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $
|
1833 |
-
if (!$plugin_db_options) $plugin_db_options = get_option (AD_OPTIONS);
|
1834 |
|
1835 |
-
|
1836 |
-
$plugin_db_options ['SYNTAX_HIGHLIGHTER_THEME'] = DEFAULT_SYNTAX_HIGHLIGHTER_THEME;
|
1837 |
-
}
|
1838 |
-
|
1839 |
-
return ($plugin_db_options ['SYNTAX_HIGHLIGHTER_THEME']);
|
1840 |
}
|
1841 |
|
1842 |
function get_block_class_name () {
|
1843 |
global $ai_db_options;
|
1844 |
|
1845 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $
|
1846 |
-
if (!$plugin_db_options) $plugin_db_options = get_option (AD_OPTIONS);
|
1847 |
-
|
1848 |
-
if (!isset ($plugin_db_options ['BLOCK_CLASS_NAME'])) {
|
1849 |
-
$plugin_db_options ['BLOCK_CLASS_NAME'] = DEFAULT_BLOCK_CLASS_NAME;
|
1850 |
-
}
|
1851 |
|
1852 |
-
return ($
|
1853 |
}
|
1854 |
|
1855 |
function get_minimum_user_role () {
|
1856 |
global $ai_db_options;
|
1857 |
|
1858 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $
|
1859 |
-
if (!$plugin_db_options) $plugin_db_options = get_option (AD_OPTIONS);
|
1860 |
|
1861 |
-
|
1862 |
-
$plugin_db_options ['MINIMUM_USER_ROLE'] = DEFAULT_MINIMUM_USER_ROLE;
|
1863 |
-
}
|
1864 |
-
|
1865 |
-
return ($plugin_db_options ['MINIMUM_USER_ROLE']);
|
1866 |
}
|
1867 |
|
1868 |
function get_plugin_priority () {
|
1869 |
global $ai_db_options;
|
1870 |
|
1871 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $
|
1872 |
-
if (!$plugin_db_options) $plugin_db_options = get_option (AD_OPTIONS);
|
1873 |
-
|
1874 |
-
if (!isset ($plugin_db_options ['PLUGIN_PRIORITY']) || $plugin_db_options ['PLUGIN_PRIORITY'] == '') {
|
1875 |
-
$plugin_db_options ['PLUGIN_PRIORITY'] = DEFAULT_PLUGIN_PRIORITY;
|
1876 |
-
}
|
1877 |
|
1878 |
-
return ($
|
1879 |
}
|
1880 |
|
1881 |
function get_dynamic_blocks(){
|
1882 |
global $ai_db_options;
|
1883 |
|
1884 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $
|
1885 |
-
if (!$plugin_db_options) $plugin_db_options = get_option (AD_OPTIONS);
|
1886 |
-
|
1887 |
-
if (!isset ($plugin_db_options ['DYNAMIC_BLOCKS']) || $plugin_db_options ['DYNAMIC_BLOCKS'] == '') {
|
1888 |
-
$plugin_db_options ['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
|
1889 |
-
}
|
1890 |
|
1891 |
-
return ($
|
1892 |
}
|
1893 |
|
1894 |
function get_admin_toolbar_debugging () {
|
1895 |
global $ai_db_options;
|
1896 |
|
1897 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $
|
1898 |
|
1899 |
-
|
1900 |
-
$plugin_db_options ['ADMIN_TOOLBAR_DEBUGGING'] = DEFAULT_ADMIN_TOOLBAR_DEBUGGING;
|
1901 |
-
}
|
1902 |
-
|
1903 |
-
return ($plugin_db_options ['ADMIN_TOOLBAR_DEBUGGING']);
|
1904 |
}
|
1905 |
|
1906 |
function get_remote_debugging () {
|
1907 |
global $ai_db_options;
|
1908 |
|
1909 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $
|
1910 |
-
|
1911 |
-
if (!isset ($plugin_db_options ['REMOTE_DEBUGGING']) || $plugin_db_options ['REMOTE_DEBUGGING'] == '') {
|
1912 |
-
$plugin_db_options ['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
|
1913 |
-
}
|
1914 |
|
1915 |
-
return ($
|
1916 |
}
|
1917 |
|
1918 |
function get_javascript_debugging () {
|
1919 |
global $ai_db_options;
|
1920 |
|
1921 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $
|
1922 |
|
1923 |
-
|
1924 |
-
|
1925 |
-
}
|
1926 |
|
1927 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1928 |
}
|
1929 |
|
1930 |
function multisite_settings_page_enabled () {
|
1931 |
global $ai_db_options_multisite;
|
1932 |
|
1933 |
if (is_multisite()) {
|
1934 |
-
if (!isset ($ai_db_options_multisite ['MULTISITE_SETTINGS_PAGE'])
|
1935 |
-
$ai_db_options_multisite ['MULTISITE_SETTINGS_PAGE'] = DEFAULT_MULTISITE_SETTINGS_PAGE;
|
1936 |
-
}
|
1937 |
|
1938 |
if (multisite_main_for_all_blogs ()) $ai_db_options_multisite ['MULTISITE_SETTINGS_PAGE'] = AD_SETTINGS_NOT_CHECKED;
|
1939 |
|
@@ -1947,9 +1955,7 @@ function multisite_widgets_enabled () {
|
|
1947 |
global $ai_db_options_multisite;
|
1948 |
|
1949 |
if (is_multisite()) {
|
1950 |
-
if (!isset ($ai_db_options_multisite ['MULTISITE_WIDGETS'])
|
1951 |
-
$ai_db_options_multisite ['MULTISITE_WIDGETS'] = DEFAULT_MULTISITE_WIDGETS;
|
1952 |
-
}
|
1953 |
|
1954 |
return ($ai_db_options_multisite ['MULTISITE_WIDGETS']);
|
1955 |
}
|
@@ -1961,9 +1967,7 @@ function multisite_php_processing () {
|
|
1961 |
global $ai_db_options_multisite;
|
1962 |
|
1963 |
if (is_multisite()) {
|
1964 |
-
if (!isset ($ai_db_options_multisite ['MULTISITE_PHP_PROCESSING'])
|
1965 |
-
$ai_db_options_multisite ['MULTISITE_PHP_PROCESSING'] = DEFAULT_MULTISITE_PHP_PROCESSING;
|
1966 |
-
}
|
1967 |
|
1968 |
return ($ai_db_options_multisite ['MULTISITE_PHP_PROCESSING']);
|
1969 |
}
|
@@ -1975,9 +1979,7 @@ function multisite_exceptions_enabled () {
|
|
1975 |
global $ai_db_options_multisite;
|
1976 |
|
1977 |
if (is_multisite()) {
|
1978 |
-
if (!isset ($ai_db_options_multisite ['MULTISITE_EXCEPTIONS'])
|
1979 |
-
$ai_db_options_multisite ['MULTISITE_EXCEPTIONS'] = DEFAULT_MULTISITE_EXCEPTIONS;
|
1980 |
-
}
|
1981 |
|
1982 |
return ($ai_db_options_multisite ['MULTISITE_EXCEPTIONS']);
|
1983 |
}
|
@@ -1989,9 +1991,7 @@ function multisite_main_for_all_blogs () {
|
|
1989 |
global $ai_db_options_multisite;
|
1990 |
|
1991 |
if (is_multisite()) {
|
1992 |
-
if (!isset ($ai_db_options_multisite ['MULTISITE_MAIN_FOR_ALL_BLOGS'])
|
1993 |
-
$ai_db_options_multisite ['MULTISITE_MAIN_FOR_ALL_BLOGS'] = DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS;
|
1994 |
-
}
|
1995 |
|
1996 |
return ($ai_db_options_multisite ['MULTISITE_MAIN_FOR_ALL_BLOGS']);
|
1997 |
}
|
@@ -1999,66 +1999,6 @@ function multisite_main_for_all_blogs () {
|
|
1999 |
return DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS;
|
2000 |
}
|
2001 |
|
2002 |
-
function get_viewport_name ($viewport_number) {
|
2003 |
-
global $ai_db_options;
|
2004 |
-
|
2005 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $plugin_db_options = $ai_db_options [AI_GLOBAL_OPTION_NAME]; else $plugin_db_options = '';
|
2006 |
-
if (!$plugin_db_options) $plugin_db_options = get_option (AD_OPTIONS);
|
2007 |
-
|
2008 |
-
$viewport_settins_name = 'VIEWPORT_NAME_' . $viewport_number;
|
2009 |
-
|
2010 |
-
if (!isset ($plugin_db_options [$viewport_settins_name])) {
|
2011 |
-
$plugin_db_options [$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) : "";
|
2012 |
-
}
|
2013 |
-
|
2014 |
-
return ($plugin_db_options [$viewport_settins_name]);
|
2015 |
-
}
|
2016 |
-
|
2017 |
-
function get_viewport_width ($viewport_number) {
|
2018 |
-
global $ai_db_options;
|
2019 |
-
|
2020 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $plugin_db_options = $ai_db_options [AI_GLOBAL_OPTION_NAME]; else $plugin_db_options = '';
|
2021 |
-
if (!$plugin_db_options) $plugin_db_options = get_option (AD_OPTIONS);
|
2022 |
-
|
2023 |
-
$viewport_settins_name = 'VIEWPORT_WIDTH_' . $viewport_number;
|
2024 |
-
|
2025 |
-
if (!isset ($plugin_db_options [$viewport_settins_name])) {
|
2026 |
-
$plugin_db_options [$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) : 0;
|
2027 |
-
}
|
2028 |
-
|
2029 |
-
return ($plugin_db_options [$viewport_settins_name]);
|
2030 |
-
}
|
2031 |
-
|
2032 |
-
function get_country_group_name ($group_number) {
|
2033 |
-
global $ai_db_options;
|
2034 |
-
|
2035 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $plugin_db_options = $ai_db_options [AI_GLOBAL_OPTION_NAME]; else $plugin_db_options = '';
|
2036 |
-
if (!$plugin_db_options) $plugin_db_options = get_option (AD_OPTIONS);
|
2037 |
-
|
2038 |
-
$country_group_settins_name = 'COUNTRY_GROUP_NAME_' . $group_number;
|
2039 |
-
|
2040 |
-
if (!isset ($plugin_db_options [$country_group_settins_name])) {
|
2041 |
-
$plugin_db_options [$country_group_settins_name] = DEFAULT_COUNTRY_GROUP_NAME . ' ' . $group_number;
|
2042 |
-
}
|
2043 |
-
|
2044 |
-
return ($plugin_db_options [$country_group_settins_name]);
|
2045 |
-
}
|
2046 |
-
|
2047 |
-
function get_group_country_list ($group_number) {
|
2048 |
-
global $ai_db_options;
|
2049 |
-
|
2050 |
-
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME])) $plugin_db_options = $ai_db_options [AI_GLOBAL_OPTION_NAME]; else $plugin_db_options = '';
|
2051 |
-
if (!$plugin_db_options) $plugin_db_options = get_option (AD_OPTIONS);
|
2052 |
-
|
2053 |
-
$group_countries_settins_name = 'GROUP_COUNTRIES_' . $group_number;
|
2054 |
-
|
2055 |
-
if (!isset ($plugin_db_options [$group_countries_settins_name])) {
|
2056 |
-
$plugin_db_options [$group_countries_settins_name] = '';
|
2057 |
-
}
|
2058 |
-
|
2059 |
-
return ($plugin_db_options [$group_countries_settins_name]);
|
2060 |
-
}
|
2061 |
-
|
2062 |
function filter_html_class ($str){
|
2063 |
|
2064 |
$str = str_replace (array ("\\\""), array ("\""), $str);
|
@@ -2266,7 +2206,8 @@ function ai_load_settings () {
|
|
2266 |
|
2267 |
ai_load_options ();
|
2268 |
|
2269 |
-
if (isset ($ai_db_options [AI_EXTRACT_OPTION_NAME]) &&
|
|
|
2270 |
isset ($ai_db_options_extract [POST_HOOK_BLOCKS]) &&
|
2271 |
isset ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_AJAX]))
|
2272 |
$ai_db_options_extract = $ai_db_options [AI_EXTRACT_OPTION_NAME]; else
|
@@ -2547,7 +2488,7 @@ function ai_settings () {
|
|
2547 |
|
2548 |
if (function_exists ('ai_load_globals')) ai_load_globals ();
|
2549 |
|
2550 |
-
echo "<div class='notice notice-warning is-dismissible' style='margin: 5px 15px 2px 0px;'><p><strong>Settings cleared.</p></div>";
|
2551 |
} elseif (isset ($_POST [AI_FORM_CLEAR_EXCEPTIONS])) {
|
2552 |
if (ai_current_user_role_ok () && (!is_multisite() || is_main_site () || multisite_exceptions_enabled ())) {
|
2553 |
$args = array (
|
@@ -2640,6 +2581,10 @@ function ai_adinserter ($ad_number = '', $ignore = ''){
|
|
2640 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) return "";
|
2641 |
}
|
2642 |
|
|
|
|
|
|
|
|
|
2643 |
// Last check before insertion
|
2644 |
if (!$obj->check_and_increment_block_counter ()) return "";
|
2645 |
|
@@ -2739,6 +2684,10 @@ function ai_content_hook ($content = '') {
|
|
2739 |
$ai_last_check = AI_CHECK_DISABLED_MANUALLY;
|
2740 |
if ($obj->display_disabled ($content)) continue;
|
2741 |
|
|
|
|
|
|
|
|
|
2742 |
// Last check before insertion
|
2743 |
if (!$obj->check_block_counter ()) continue;
|
2744 |
|
@@ -2868,6 +2817,10 @@ function ai_excerpt_hook ($content = '') {
|
|
2868 |
$ai_last_check = AI_CHECK_DISABLED_MANUALLY;
|
2869 |
if ($obj->display_disabled ($content)) continue;
|
2870 |
|
|
|
|
|
|
|
|
|
2871 |
// Last check before insertion
|
2872 |
if (!$obj->check_and_increment_block_counter ()) continue;
|
2873 |
|
@@ -2971,6 +2924,10 @@ function ai_before_after_post ($query, $automatic_insertion) {
|
|
2971 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) continue;
|
2972 |
if (!$obj->check_filter ($ad_inserter_globals [$globals_name])) continue;
|
2973 |
|
|
|
|
|
|
|
|
|
2974 |
// Last check before insertion
|
2975 |
if (!$obj->check_and_increment_block_counter ()) continue;
|
2976 |
|
@@ -3069,6 +3026,10 @@ function ai_post_hook ($post) {
|
|
3069 |
if (!$obj->check_page_types_lists_users ()) continue;
|
3070 |
if (!$obj->check_filter ($ad_inserter_globals [AI_POST_COUNTER_NAME])) continue;
|
3071 |
|
|
|
|
|
|
|
|
|
3072 |
// Last check before insertion
|
3073 |
if (!$obj->check_and_increment_block_counter ()) continue;
|
3074 |
|
@@ -3152,6 +3113,10 @@ function process_shortcode (&$block, $atts) {
|
|
3152 |
if (!$obj->check_server_side_detection ()) return "";
|
3153 |
if (!$obj->check_page_types_lists_users (in_array ("page_type", $ignore_array))) return "";
|
3154 |
|
|
|
|
|
|
|
|
|
3155 |
// Last check before insertion
|
3156 |
if (!$obj->check_and_increment_block_counter ()) return "";
|
3157 |
|
@@ -3318,6 +3283,10 @@ function ai_widget_draw ($args, $instance, &$block) {
|
|
3318 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) return;
|
3319 |
}
|
3320 |
|
|
|
|
|
|
|
|
|
3321 |
// Last check before insertion
|
3322 |
if (!$obj->check_and_increment_block_counter ()) return;
|
3323 |
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Ad Inserter
|
4 |
+
Version: 2.1.1
|
5 |
Description: Insert any ad or code into Wordpress. Perfect for all kinds of ads. Simply enter any ad or HTML/Javascript/PHP code and select where and how you want to display it.
|
6 |
Author: Igor Funa
|
7 |
Author URI: http://igorfuna.com/
|
11 |
/*
|
12 |
Change Log
|
13 |
|
14 |
+
Ad Inserter 2.1.1 - 26 February 2017
|
15 |
+
- Changes for compatibility with PHP 7.1
|
16 |
+
- Automatic rename of old pro plugin slug (Pro only)
|
17 |
+
- Added support for additional Pro features (Pro only)
|
18 |
+
- Few bug fixes and cosmetic changes
|
19 |
+
|
20 |
Ad Inserter 2.1.0 - 10 February 2017
|
21 |
- Added support to insert ads in Ajax requests (e.g. in infinite scroll)
|
22 |
- Added support to not include block classes when class name is empty
|
456 |
|
457 |
if (isset ($_POST [AI_FORM_SAVE]))
|
458 |
define ('AI_SYNTAX_HIGHLIGHTING', isset ($_POST ["syntax-highlighter-theme"]) && $_POST ["syntax-highlighter-theme"] != AI_OPTION_DISABLED); else
|
459 |
+
define ('AI_SYNTAX_HIGHLIGHTING', get_syntax_highlighter_theme () != AI_OPTION_DISABLED);
|
460 |
|
461 |
add_action ('admin_menu', 'ai_admin_menu_hook');
|
462 |
|
724 |
case AI_CHECK_PARAGRAPHS_AFTER_TEXT: $status .= "PARAGRAPHS AFTER TEXT"; break;
|
725 |
case AI_CHECK_PARAGRAPHS_AFTER_CLEARANCE: $status .= "PARAGRAPHS AFTER CLEARANCE"; break;
|
726 |
case AI_CHECK_PARAGRAPHS_MIN_NUMBER: $status .= "PARAGRAPHS MIN NUMBER"; break;
|
727 |
+
case AI_CHECK_PARAGRAPH_NUMBER: $status .= "PARAGRAPH NUMBER " . $obj->get_paragraph_number(); break;
|
728 |
|
729 |
case AI_CHECK_DO_NOT_INSERT: $status .= "PARAGRAPH CLEARANCE"; break;
|
730 |
case AI_CHECK_AD_ABOVE: $status .= "PARAGRAPH CLEARANCE ABOVE"; break;
|
1010 |
|
1011 |
echo 'jQuery(function($){$("div.ai-rotate").each(function(){var rotate_options=$(".ai-rotate-option",this);var random_index=Math.floor(Math.random()*rotate_options.length);rotate_options.hide();$(rotate_options[random_index]).css({"display":"","visibility":"","position":"","width":"","height":"","top":"","left":""});$(this).css({"position":""})})});';
|
1012 |
|
1013 |
+
// echo 'jQuery (function ($) {
|
1014 |
// function getParameterByName (name, url) {
|
1015 |
// if (!url) {
|
1016 |
// url = window.location.href;
|
1023 |
// return decodeURIComponent(results[2].replace(/\+/g, " "));
|
1024 |
// }
|
1025 |
|
1026 |
+
// var javascript_debugging = '.(get_javascript_debugging () ? "true" : "false").';
|
1027 |
// var nonce = "'.wp_create_nonce ("adinserter_data").'";
|
1028 |
// var site_url = "'.wp_make_link_relative (get_site_url()).'";
|
1029 |
// var page = site_url+"/wp-admin/admin-ajax.php?action=ai_data&ip-data=ip-address-country&ai_check=" + nonce;
|
1037 |
|
1038 |
// $.get (page, function (ip_data) {
|
1039 |
|
1040 |
+
// if (javascript_debugging) console.log ("Ajax call data: " + ip_data);
|
1041 |
+
|
1042 |
// $("div.ai-ip-data").each (function () {
|
1043 |
// var ip_data_array = ip_data.split (",");
|
1044 |
// var ip_address = ip_data_array [0];
|
1129 |
// block_div.hide ();
|
1130 |
// }
|
1131 |
// });
|
1132 |
+
// }).fail (function(jqXHR, status, err) {
|
1133 |
+
// if (javascript_debugging) console.log ("Ajax call failed, Status: " + status + ", Error: " + err);
|
1134 |
// $("div.ai-ip-data").each (function () {
|
1135 |
// $(this).css ({"display": "none", "visibility": "", "position": "", "width": "", "height": "", "z-index": ""});
|
1136 |
// });
|
1138 |
// });
|
1139 |
//';
|
1140 |
|
1141 |
+
echo 'jQuery(function($){function getParameterByName(name,url){if(!url)url=window.location.href;name=name.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)"),results=regex.exec(url);if(!results)return null;if(!results[2])return"";return decodeURIComponent(results[2].replace(/\+/g," "))}var javascript_debugging='.(get_javascript_debugging () ? "true" : "false").';var nonce="'.wp_create_nonce ("adinserter_data").'";var site_url="'.wp_make_link_relative (get_site_url()).'";var page=site_url+"/wp-admin/admin-ajax.php?action=ai_data&ip-data=ip-address-country&ai_check="+
|
1142 |
+
nonce;var debug_ip_address=getParameterByName("ai-debug-ip-address");if(debug_ip_address!=null)page+="&ai-debug-ip-address="+debug_ip_address;var debug_ip_address=getParameterByName("ai-debug-country");if(debug_ip_address!=null)page+="&ai-debug-country="+debug_ip_address;var enable_block=false;$.get(page,function(ip_data){if(javascript_debugging)console.log("Ajax call data: "+ip_data);$("div.ai-ip-data").each(function(){var ip_data_array=ip_data.split(",");var ip_address=ip_data_array[0];var country=
|
1143 |
+
ip_data_array[1];var block_div=$("."+$(this).attr("class-name"));enable_block=true;var found=false;var ip_addresses_list=$(this).attr("ip-addresses");if(typeof ip_addresses_list!="undefined"){var ip_address_array=ip_addresses_list.split(",");var ip_address_list_type=$(this).attr("ip-address-list");$.each(ip_address_array,function(index,list_ip_address){if(list_ip_address.charAt(0)=="*")if(list_ip_address.charAt(list_ip_address.length-1)=="*"){list_ip_address=list_ip_address.substr(1,list_ip_address.length-
|
1144 |
+
2);if(ip_address.indexOf(list_ip_address)!=-1){found=true;return false}}else{list_ip_address=list_ip_address.substr(1);if(ip_address.substr(-list_ip_address.length)==list_ip_address){found=true;return false}}else if(list_ip_address.charAt(list_ip_address.length-1)=="*"){list_ip_address=list_ip_address.substr(0,list_ip_address.length-1);if(ip_address.indexOf(list_ip_address)==0){found=true;return false}}else if(list_ip_address=="#"&&ip_address==""){found=true;return false}else if(list_ip_address==
|
1145 |
+
ip_address){found=true;return false}});switch(ip_address_list_type){case "B":if(found)enable_block=false;break;case "W":if(!found)enable_block=false;break}}if(enable_block){var countries_list=$(this).attr("countries");if(typeof countries_list!="undefined"){var country_array=countries_list.split(",");var country_list_type=$(this).attr("country-list");var found=false;$.each(country_array,function(index,list_country){if(list_country==country){found=true;return false}});switch(country_list_type){case "B":if(found)enable_block=
|
1146 |
+
false;break;case "W":if(!found)enable_block=false;break}}}$(this).css({"visibility":"","position":"","width":"","height":"","z-index":""});block_div.css({"visibility":"","position":"","z-index":""});if(!enable_block){$(this).hide();block_div.hide()}})}).fail(function(jqXHR,status,err){if(javascript_debugging)console.log("Ajax call failed, Status: "+status+", Error: "+err);$("div.ai-ip-data").each(function(){$(this).css({"display":"none","visibility":"","position":"","width":"","height":"","z-index":""})})})});';
|
1147 |
|
1148 |
echo "\n</script>\n";
|
1149 |
}
|
1462 |
echo "TOTAL PROCESSING TIME: ", number_format ($ai_total_plugin_time * 1000, 2), " ms\n";
|
1463 |
|
1464 |
echo "SETTINGS: ";
|
1465 |
+
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']))
|
1466 |
+
echo (int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][0].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][1]), '.',
|
1467 |
+
(int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][2].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][3]), '.',
|
1468 |
+
(int) ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][4].$ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'][5]);
|
1469 |
|
1470 |
echo "\n";
|
1471 |
echo "SETTINGS TIMESTAMP: ";
|
1472 |
+
echo isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['TIMESTAMP']) ? date ("Y-m-d H:i:s", $ai_db_options [AI_GLOBAL_OPTION_NAME]['TIMESTAMP'] + get_option ('gmt_offset') * 3600) : "", "\n";
|
1473 |
echo "MULTISITE: ", is_multisite() ? "YES" : "NO", "\n";
|
1474 |
if (is_multisite()) {
|
1475 |
echo "MAIN SITE: ", is_main_site () ? "YES" : "NO", "\n";
|
1519 |
|
1520 |
$default = new ai_Block (1);
|
1521 |
|
1522 |
+
echo "BLOCK SETTINGS Po Pa Hp Cp Ap Sp Aj Fe 404 Wi Sh PHP\n";
|
1523 |
for ($block = 1; $block <= AD_INSERTER_BLOCKS; $block ++) {
|
1524 |
$obj = $block_object [$block];
|
1525 |
|
1582 |
|
1583 |
echo sprintf ("%2d %-21s ", $block, substr ($obj->get_ad_name(), 0, 21));
|
1584 |
|
1585 |
+
echo $obj->get_display_settings_post() ? "o" : ".", " ";
|
1586 |
+
echo $obj->get_display_settings_page() ? "o" : ".", " ";
|
1587 |
+
echo $obj->get_display_settings_home() ? "o" : ".", " ";
|
1588 |
echo $obj->get_display_settings_category() ? "o" : ".", " ";
|
1589 |
+
echo $obj->get_display_settings_archive() ? "o" : ".", " ";
|
1590 |
+
echo $obj->get_display_settings_search() ? "o" : ".", " ";
|
1591 |
+
echo $obj->get_enable_ajax() ? "o" : ".", " ";
|
1592 |
+
echo $obj->get_enable_feed() ? "o" : ".", " ";
|
1593 |
+
echo $obj->get_enable_404() ? "o" : ".", " ";
|
1594 |
+
echo $obj->get_enable_widget() ? "x" : ".", " ";
|
1595 |
+
echo $obj->get_enable_manual() ? "x" : ".", " ";
|
1596 |
+
echo $obj->get_enable_php_call() ? "x" : ".", " ";
|
1597 |
|
1598 |
echo $settings, "\n";
|
1599 |
}
|
1625 |
foreach ($posts_pages as $page) {
|
1626 |
$post_meta = get_post_meta ($page->ID, '_adinserter_block_exceptions', true);
|
1627 |
if ($post_meta == '') continue;
|
1628 |
+
echo sprintf ("%-24s %-6s %s %-64s %s", $post_meta, $page->ID, $page->post_type, substr ($page->post_title, 0, 64), get_permalink ($page->ID)), "\n";
|
1629 |
}
|
1630 |
echo "\n";
|
1631 |
}
|
1830 |
function get_viewport_css () {
|
1831 |
global $ai_db_options;
|
1832 |
|
1833 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS'] = generate_viewport_css ();
|
|
|
1834 |
|
1835 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VIEWPORT_CSS']);
|
|
|
|
|
1836 |
}
|
1837 |
|
1838 |
function get_syntax_highlighter_theme () {
|
1839 |
global $ai_db_options;
|
1840 |
|
1841 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['SYNTAX_HIGHLIGHTER_THEME'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['SYNTAX_HIGHLIGHTER_THEME'] = DEFAULT_SYNTAX_HIGHLIGHTER_THEME;
|
|
|
1842 |
|
1843 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['SYNTAX_HIGHLIGHTER_THEME']);
|
|
|
|
|
|
|
|
|
1844 |
}
|
1845 |
|
1846 |
function get_block_class_name () {
|
1847 |
global $ai_db_options;
|
1848 |
|
1849 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['BLOCK_CLASS_NAM!E'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['BLOCK_CLASS_NAME'] = DEFAULT_BLOCK_CLASS_NAME;
|
|
|
|
|
|
|
|
|
|
|
1850 |
|
1851 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['BLOCK_CLASS_NAME']);
|
1852 |
}
|
1853 |
|
1854 |
function get_minimum_user_role () {
|
1855 |
global $ai_db_options;
|
1856 |
|
1857 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['MINIMUM_USER_ROLE'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['MINIMUM_USER_ROLE'] = DEFAULT_MINIMUM_USER_ROLE;
|
|
|
1858 |
|
1859 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['MINIMUM_USER_ROLE']);
|
|
|
|
|
|
|
|
|
1860 |
}
|
1861 |
|
1862 |
function get_plugin_priority () {
|
1863 |
global $ai_db_options;
|
1864 |
|
1865 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY'] = DEFAULT_PLUGIN_PRIORITY;
|
|
|
|
|
|
|
|
|
|
|
1866 |
|
1867 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['PLUGIN_PRIORITY']);
|
1868 |
}
|
1869 |
|
1870 |
function get_dynamic_blocks(){
|
1871 |
global $ai_db_options;
|
1872 |
|
1873 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS'] = DEFAULT_DYNAMIC_BLOCKS;
|
|
|
|
|
|
|
|
|
|
|
1874 |
|
1875 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['DYNAMIC_BLOCKS']);
|
1876 |
}
|
1877 |
|
1878 |
function get_admin_toolbar_debugging () {
|
1879 |
global $ai_db_options;
|
1880 |
|
1881 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['ADMIN_TOOLBAR_DEBUGGING'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['ADMIN_TOOLBAR_DEBUGGING'] = DEFAULT_ADMIN_TOOLBAR_DEBUGGING;
|
1882 |
|
1883 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['ADMIN_TOOLBAR_DEBUGGING']);
|
|
|
|
|
|
|
|
|
1884 |
}
|
1885 |
|
1886 |
function get_remote_debugging () {
|
1887 |
global $ai_db_options;
|
1888 |
|
1889 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING'] = DEFAULT_REMOTE_DEBUGGING;
|
|
|
|
|
|
|
|
|
1890 |
|
1891 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['REMOTE_DEBUGGING']);
|
1892 |
}
|
1893 |
|
1894 |
function get_javascript_debugging () {
|
1895 |
global $ai_db_options;
|
1896 |
|
1897 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING'])) $ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING'] = DEFAULT_JAVASCRIPT_DEBUGGING;
|
1898 |
|
1899 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME]['JAVASCRIPT_DEBUGGING']);
|
1900 |
+
}
|
|
|
1901 |
|
1902 |
+
function get_viewport_name ($viewport_number) {
|
1903 |
+
global $ai_db_options;
|
1904 |
+
|
1905 |
+
$viewport_settins_name = 'VIEWPORT_NAME_' . $viewport_number;
|
1906 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]))
|
1907 |
+
$ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_NAME_" . $viewport_number) : "";
|
1908 |
+
|
1909 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]);
|
1910 |
+
}
|
1911 |
+
|
1912 |
+
function get_viewport_width ($viewport_number) {
|
1913 |
+
global $ai_db_options;
|
1914 |
+
|
1915 |
+
$viewport_settins_name = 'VIEWPORT_WIDTH_' . $viewport_number;
|
1916 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]))
|
1917 |
+
$ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name] = defined ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) ? constant ("DEFAULT_VIEWPORT_WIDTH_" . $viewport_number) : "";
|
1918 |
+
|
1919 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$viewport_settins_name]);
|
1920 |
+
}
|
1921 |
+
|
1922 |
+
function get_country_group_name ($group_number) {
|
1923 |
+
global $ai_db_options;
|
1924 |
+
|
1925 |
+
$country_group_settins_name = 'COUNTRY_GROUP_NAME_' . $group_number;
|
1926 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$country_group_settins_name])) $ai_db_options [AI_GLOBAL_OPTION_NAME][$country_group_settins_name] = DEFAULT_COUNTRY_GROUP_NAME . ' ' . $group_number;
|
1927 |
+
|
1928 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$country_group_settins_name]);
|
1929 |
+
}
|
1930 |
+
|
1931 |
+
function get_group_country_list ($group_number) {
|
1932 |
+
global $ai_db_options;
|
1933 |
+
|
1934 |
+
$group_countries_settins_name = 'GROUP_COUNTRIES_' . $group_number;
|
1935 |
+
if (!isset ($ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name])) $ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name] = '';
|
1936 |
+
|
1937 |
+
return ($ai_db_options [AI_GLOBAL_OPTION_NAME][$group_countries_settins_name]);
|
1938 |
}
|
1939 |
|
1940 |
function multisite_settings_page_enabled () {
|
1941 |
global $ai_db_options_multisite;
|
1942 |
|
1943 |
if (is_multisite()) {
|
1944 |
+
if (!isset ($ai_db_options_multisite ['MULTISITE_SETTINGS_PAGE'])) $ai_db_options_multisite ['MULTISITE_SETTINGS_PAGE'] = DEFAULT_MULTISITE_SETTINGS_PAGE;
|
|
|
|
|
1945 |
|
1946 |
if (multisite_main_for_all_blogs ()) $ai_db_options_multisite ['MULTISITE_SETTINGS_PAGE'] = AD_SETTINGS_NOT_CHECKED;
|
1947 |
|
1955 |
global $ai_db_options_multisite;
|
1956 |
|
1957 |
if (is_multisite()) {
|
1958 |
+
if (!isset ($ai_db_options_multisite ['MULTISITE_WIDGETS'])) $ai_db_options_multisite ['MULTISITE_WIDGETS'] = DEFAULT_MULTISITE_WIDGETS;
|
|
|
|
|
1959 |
|
1960 |
return ($ai_db_options_multisite ['MULTISITE_WIDGETS']);
|
1961 |
}
|
1967 |
global $ai_db_options_multisite;
|
1968 |
|
1969 |
if (is_multisite()) {
|
1970 |
+
if (!isset ($ai_db_options_multisite ['MULTISITE_PHP_PROCESSING'])) $ai_db_options_multisite ['MULTISITE_PHP_PROCESSING'] = DEFAULT_MULTISITE_PHP_PROCESSING;
|
|
|
|
|
1971 |
|
1972 |
return ($ai_db_options_multisite ['MULTISITE_PHP_PROCESSING']);
|
1973 |
}
|
1979 |
global $ai_db_options_multisite;
|
1980 |
|
1981 |
if (is_multisite()) {
|
1982 |
+
if (!isset ($ai_db_options_multisite ['MULTISITE_EXCEPTIONS'])) $ai_db_options_multisite ['MULTISITE_EXCEPTIONS'] = DEFAULT_MULTISITE_EXCEPTIONS;
|
|
|
|
|
1983 |
|
1984 |
return ($ai_db_options_multisite ['MULTISITE_EXCEPTIONS']);
|
1985 |
}
|
1991 |
global $ai_db_options_multisite;
|
1992 |
|
1993 |
if (is_multisite()) {
|
1994 |
+
if (!isset ($ai_db_options_multisite ['MULTISITE_MAIN_FOR_ALL_BLOGS'])) $ai_db_options_multisite ['MULTISITE_MAIN_FOR_ALL_BLOGS'] = DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS;
|
|
|
|
|
1995 |
|
1996 |
return ($ai_db_options_multisite ['MULTISITE_MAIN_FOR_ALL_BLOGS']);
|
1997 |
}
|
1999 |
return DEFAULT_MULTISITE_MAIN_FOR_ALL_BLOGS;
|
2000 |
}
|
2001 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002 |
function filter_html_class ($str){
|
2003 |
|
2004 |
$str = str_replace (array ("\\\""), array ("\""), $str);
|
2206 |
|
2207 |
ai_load_options ();
|
2208 |
|
2209 |
+
if (isset ($ai_db_options [AI_EXTRACT_OPTION_NAME]) &&
|
2210 |
+
isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] == $version_string &&
|
2211 |
isset ($ai_db_options_extract [POST_HOOK_BLOCKS]) &&
|
2212 |
isset ($ai_db_options_extract [POST_HOOK_BLOCKS][AI_PT_AJAX]))
|
2213 |
$ai_db_options_extract = $ai_db_options [AI_EXTRACT_OPTION_NAME]; else
|
2488 |
|
2489 |
if (function_exists ('ai_load_globals')) ai_load_globals ();
|
2490 |
|
2491 |
+
echo "<div class='notice notice-warning is-dismissible' style='margin: 5px 15px 2px 0px;'><p><strong>Settings cleared.</strong></p></div>";
|
2492 |
} elseif (isset ($_POST [AI_FORM_CLEAR_EXCEPTIONS])) {
|
2493 |
if (ai_current_user_role_ok () && (!is_multisite() || is_main_site () || multisite_exceptions_enabled ())) {
|
2494 |
$args = array (
|
2581 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) return "";
|
2582 |
}
|
2583 |
|
2584 |
+
// Last check before counter check before insertion
|
2585 |
+
$ai_last_check = AI_CHECK_CODE;
|
2586 |
+
if ($obj->ai_getCode () == '') return "";
|
2587 |
+
|
2588 |
// Last check before insertion
|
2589 |
if (!$obj->check_and_increment_block_counter ()) return "";
|
2590 |
|
2684 |
$ai_last_check = AI_CHECK_DISABLED_MANUALLY;
|
2685 |
if ($obj->display_disabled ($content)) continue;
|
2686 |
|
2687 |
+
// Last check before counter check before insertion
|
2688 |
+
$ai_last_check = AI_CHECK_CODE;
|
2689 |
+
if ($obj->ai_getCode () == '') continue;
|
2690 |
+
|
2691 |
// Last check before insertion
|
2692 |
if (!$obj->check_block_counter ()) continue;
|
2693 |
|
2817 |
$ai_last_check = AI_CHECK_DISABLED_MANUALLY;
|
2818 |
if ($obj->display_disabled ($content)) continue;
|
2819 |
|
2820 |
+
// Last check before counter check before insertion
|
2821 |
+
$ai_last_check = AI_CHECK_CODE;
|
2822 |
+
if ($obj->ai_getCode () == '') continue;
|
2823 |
+
|
2824 |
// Last check before insertion
|
2825 |
if (!$obj->check_and_increment_block_counter ()) continue;
|
2826 |
|
2924 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) continue;
|
2925 |
if (!$obj->check_filter ($ad_inserter_globals [$globals_name])) continue;
|
2926 |
|
2927 |
+
// Last check before counter check before insertion
|
2928 |
+
$ai_last_check = AI_CHECK_CODE;
|
2929 |
+
if ($obj->ai_getCode () == '') continue;
|
2930 |
+
|
2931 |
// Last check before insertion
|
2932 |
if (!$obj->check_and_increment_block_counter ()) continue;
|
2933 |
|
3026 |
if (!$obj->check_page_types_lists_users ()) continue;
|
3027 |
if (!$obj->check_filter ($ad_inserter_globals [AI_POST_COUNTER_NAME])) continue;
|
3028 |
|
3029 |
+
// Last check before counter check before insertion
|
3030 |
+
$ai_last_check = AI_CHECK_CODE;
|
3031 |
+
if ($obj->ai_getCode () == '') continue;
|
3032 |
+
|
3033 |
// Last check before insertion
|
3034 |
if (!$obj->check_and_increment_block_counter ()) continue;
|
3035 |
|
3113 |
if (!$obj->check_server_side_detection ()) return "";
|
3114 |
if (!$obj->check_page_types_lists_users (in_array ("page_type", $ignore_array))) return "";
|
3115 |
|
3116 |
+
// Last check before counter check before insertion
|
3117 |
+
$ai_last_check = AI_CHECK_CODE;
|
3118 |
+
if ($obj->ai_getCode () == '') return "";
|
3119 |
+
|
3120 |
// Last check before insertion
|
3121 |
if (!$obj->check_and_increment_block_counter ()) return "";
|
3122 |
|
3283 |
if (!$obj->check_post_page_exceptions ($selected_blocks)) return;
|
3284 |
}
|
3285 |
|
3286 |
+
// Last check before counter check before insertion
|
3287 |
+
$ai_last_check = AI_CHECK_CODE;
|
3288 |
+
if ($obj->ai_getCode () == '') return;
|
3289 |
+
|
3290 |
// Last check before insertion
|
3291 |
if (!$obj->check_and_increment_block_counter ()) return;
|
3292 |
|
class.php
CHANGED
@@ -239,24 +239,24 @@ abstract class ai_BaseCodeBlock {
|
|
239 |
}
|
240 |
|
241 |
public function get_ad_data(){
|
242 |
-
$ad_data = isset ($this->wp_options [AI_OPTION_CODE]) ? $this->wp_options [AI_OPTION_CODE] :
|
243 |
return $ad_data;
|
244 |
}
|
245 |
|
246 |
public function get_enable_manual (){
|
247 |
-
$enable_manual = isset ($this->wp_options [AI_OPTION_ENABLE_MANUAL]) ? $this->wp_options [AI_OPTION_ENABLE_MANUAL] :
|
248 |
if ($enable_manual == '') $enable_manual = AD_SETTINGS_NOT_CHECKED;
|
249 |
return $enable_manual;
|
250 |
}
|
251 |
|
252 |
public function get_process_php (){
|
253 |
-
$process_php = isset ($this->wp_options [AI_OPTION_PROCESS_PHP]) ? $this->wp_options [AI_OPTION_PROCESS_PHP] :
|
254 |
if ($process_php == '') $process_php = AD_SETTINGS_NOT_CHECKED;
|
255 |
return $process_php;
|
256 |
}
|
257 |
|
258 |
public function get_enable_404 (){
|
259 |
-
$enable_404 = isset ($this->wp_options [AI_OPTION_ENABLE_404]) ? $this->wp_options [AI_OPTION_ENABLE_404] :
|
260 |
if ($enable_404 == '') $enable_404 = AD_SETTINGS_NOT_CHECKED;
|
261 |
return $enable_404;
|
262 |
}
|
@@ -586,32 +586,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
586 |
}
|
587 |
}
|
588 |
|
589 |
-
|
590 |
-
// if ($alignment_type == AI_ALIGNMENT_DEFAULT) {
|
591 |
-
// $style = "margin: 8px 0px;";
|
592 |
-
// }
|
593 |
-
// elseif ($alignment_type == AI_ALIGNMENT_LEFT) {
|
594 |
-
// $style = "text-align: left; margin: 8px 0px;";
|
595 |
-
// }
|
596 |
-
// elseif ($alignment_type == AI_ALIGNMENT_RIGHT) {
|
597 |
-
// $style = "text-align: right; margin: 8px 0px;";
|
598 |
-
// }
|
599 |
-
// elseif ($alignment_type == AI_ALIGNMENT_CENTER) {
|
600 |
-
// $style = "text-align: center; margin: 8px auto;";
|
601 |
-
// }
|
602 |
-
// elseif ($alignment_type == AI_ALIGNMENT_FLOAT_LEFT) {
|
603 |
-
// $style = "float: left; margin: 8px 8px 8px 0;";
|
604 |
-
// }
|
605 |
-
// elseif ($alignment_type == AI_ALIGNMENT_FLOAT_RIGHT) {
|
606 |
-
// $style = "float: right; margin: 8px 0px 8px 8px;";
|
607 |
-
// }
|
608 |
-
// elseif ($alignment_type == AI_ALIGNMENT_CUSTOM_CSS) {
|
609 |
-
// $style = $this->get_custom_css ();
|
610 |
-
// }
|
611 |
-
// else {
|
612 |
-
// $style = "";
|
613 |
-
// }
|
614 |
-
|
615 |
return $style;
|
616 |
}
|
617 |
|
@@ -619,199 +593,199 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
619 |
return $this->alignment_style ($this->get_alignment_type());
|
620 |
}
|
621 |
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
|
643 |
public function get_paragraph_tags(){
|
644 |
$option = isset ($this->wp_options [AI_OPTION_PARAGRAPH_TAGS]) ? $this->wp_options [AI_OPTION_PARAGRAPH_TAGS] : DEFAULT_PARAGRAPH_TAGS;
|
645 |
return $option;
|
646 |
}
|
647 |
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
public function get_maximum_paragraph_words(){
|
654 |
-
$option = isset ($this->wp_options [AI_OPTION_MAX_PARAGRAPH_WORDS]) ? $this->wp_options [AI_OPTION_MAX_PARAGRAPH_WORDS] : "";
|
655 |
-
return $option;
|
656 |
-
}
|
657 |
-
|
658 |
-
public function get_count_inside_blockquote(){
|
659 |
-
$option = isset ($this->wp_options [AI_OPTION_COUNT_INSIDE_BLOCKQUOTE]) ? $this->wp_options [AI_OPTION_COUNT_INSIDE_BLOCKQUOTE] : "";
|
660 |
-
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
661 |
-
return $option;
|
662 |
-
}
|
663 |
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
|
|
673 |
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
}
|
689 |
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
}
|
695 |
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
|
|
706 |
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
}
|
718 |
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
}
|
724 |
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
}
|
730 |
|
731 |
-
|
732 |
-
|
|
|
|
|
|
|
733 |
|
734 |
-
|
735 |
-
|
|
|
|
|
|
|
736 |
|
737 |
-
|
738 |
-
|
739 |
-
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
740 |
-
} else $automatic_insertion = '';
|
741 |
|
742 |
-
|
743 |
-
|
744 |
-
$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT ||
|
745 |
-
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT)
|
746 |
-
$option = AD_SETTINGS_NOT_CHECKED;
|
747 |
-
}
|
748 |
|
749 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
750 |
}
|
751 |
|
752 |
-
|
753 |
-
|
754 |
|
755 |
-
|
756 |
-
|
757 |
|
758 |
-
|
759 |
-
|
760 |
-
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
761 |
-
} else $automatic_insertion = '';
|
762 |
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
$option = AD_SETTINGS_NOT_CHECKED;
|
768 |
-
}
|
769 |
|
770 |
-
|
|
|
|
|
|
|
|
|
771 |
}
|
772 |
|
773 |
-
|
774 |
-
|
775 |
|
776 |
-
|
777 |
-
|
778 |
|
779 |
-
|
780 |
-
|
781 |
-
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
782 |
-
} else $automatic_insertion = '';
|
783 |
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
$option = AD_SETTINGS_NOT_CHECKED;
|
789 |
-
}
|
790 |
|
791 |
-
|
|
|
|
|
|
|
|
|
792 |
}
|
793 |
|
794 |
-
|
795 |
-
|
796 |
|
797 |
-
|
798 |
-
|
799 |
|
800 |
-
|
801 |
-
|
802 |
-
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
803 |
-
} else $automatic_insertion = '';
|
804 |
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
$option = AD_SETTINGS_NOT_CHECKED;
|
810 |
-
}
|
811 |
|
812 |
-
|
|
|
|
|
|
|
|
|
813 |
}
|
814 |
|
|
|
|
|
|
|
815 |
public function get_enable_feed (){
|
816 |
$enable_feed = isset ($this->wp_options [AI_OPTION_ENABLE_FEED]) ? $this->wp_options [AI_OPTION_ENABLE_FEED] : "";
|
817 |
if ($enable_feed == '') $enable_feed = AD_SETTINGS_NOT_CHECKED;
|
@@ -827,22 +801,19 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
827 |
public function get_enable_manual (){
|
828 |
$option = isset ($this->wp_options [AI_OPTION_ENABLE_MANUAL]) ? $this->wp_options [AI_OPTION_ENABLE_MANUAL] : "";
|
829 |
if ($option == '') {
|
830 |
-
|
831 |
-
// if ($display_option == AD_SELECT_MANUAL)
|
832 |
-
// $option = AD_SETTINGS_CHECKED; else
|
833 |
-
$option = AD_SETTINGS_NOT_CHECKED;
|
834 |
}
|
835 |
return $option;
|
836 |
}
|
837 |
|
838 |
-
|
839 |
-
|
840 |
|
841 |
-
|
842 |
-
|
843 |
|
844 |
-
|
845 |
-
|
846 |
|
847 |
public function get_enable_php_call (){
|
848 |
$option = isset ($this->wp_options [AI_OPTION_ENABLE_PHP_CALL]) ? $this->wp_options [AI_OPTION_ENABLE_PHP_CALL] : "";
|
@@ -867,7 +838,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
867 |
$option = isset ($this->wp_options [AI_OPTION_CUSTOM_CSS]) ? $this->wp_options [AI_OPTION_CUSTOM_CSS] : "";
|
868 |
|
869 |
// Fix for old bug
|
870 |
-
if ($ai_db_options ['
|
871 |
|
872 |
return $option;
|
873 |
}
|
@@ -890,7 +861,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
890 |
|
891 |
$option = isset ($this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE]) ? $this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE] : AD_SETTINGS_NOT_CHECKED;
|
892 |
|
893 |
-
if ($ai_db_options ['
|
894 |
if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
|
895 |
$display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
|
896 |
} else $display_for_devices = '';
|
@@ -907,7 +878,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
907 |
$option_name = AI_OPTION_DETECT_VIEWPORT . '_' . $viewport;
|
908 |
$option = isset ($this->wp_options [$option_name]) ? $this->wp_options [$option_name] : AD_SETTINGS_NOT_CHECKED;
|
909 |
|
910 |
-
if ($ai_db_options ['
|
911 |
if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
|
912 |
$display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
|
913 |
} else $display_for_devices = '';
|
@@ -1581,13 +1552,16 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1581 |
}
|
1582 |
|
1583 |
$ai_last_check = AI_CHECK_PARAGRAPHS_MIN_NUMBER;
|
1584 |
-
if (count ($paragraph_positions)
|
1585 |
-
$
|
1586 |
-
$
|
1587 |
-
|
1588 |
-
$
|
1589 |
-
|
1590 |
-
|
|
|
|
|
|
|
1591 |
}
|
1592 |
}
|
1593 |
|
@@ -1849,15 +1823,18 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1849 |
}
|
1850 |
|
1851 |
$ai_last_check = AI_CHECK_PARAGRAPHS_MIN_NUMBER;
|
1852 |
-
if (count ($paragraph_positions)
|
1853 |
-
$
|
1854 |
-
$
|
1855 |
-
|
1856 |
-
$
|
1857 |
-
if ($
|
1858 |
-
$
|
1859 |
-
|
1860 |
-
|
|
|
|
|
|
|
1861 |
}
|
1862 |
}
|
1863 |
|
@@ -2268,17 +2245,17 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2268 |
$ai_last_check = AI_CHECK_SCHEDULING;
|
2269 |
if (!$this->check_scheduling ()) return false;
|
2270 |
|
2271 |
-
$ai_last_check = AI_CHECK_CODE;
|
2272 |
-
if ($this->ai_getCode () == '') return false;
|
2273 |
|
2274 |
$display_for_users = $this->get_display_for_users ();
|
2275 |
|
2276 |
$ai_last_check = AI_CHECK_LOGGED_IN_USER;
|
2277 |
-
if ($display_for_users == AD_DISPLAY_LOGGED_IN_USERS && ($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) != AI_USER_LOGGED_IN) return
|
2278 |
$ai_last_check = AI_CHECK_NOT_LOGGED_IN_USER;
|
2279 |
-
if ($display_for_users == AD_DISPLAY_NOT_LOGGED_IN_USERS && ($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) == AI_USER_LOGGED_IN) return
|
2280 |
$ai_last_check = AI_CHECK_ADMINISTRATOR;
|
2281 |
-
if ($display_for_users == AD_DISPLAY_ADMINISTRATORS && ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != AI_USER_ADMINISTRATOR) return
|
2282 |
|
2283 |
return true;
|
2284 |
}
|
239 |
}
|
240 |
|
241 |
public function get_ad_data(){
|
242 |
+
$ad_data = isset ($this->wp_options [AI_OPTION_CODE]) ? $this->wp_options [AI_OPTION_CODE] : '';
|
243 |
return $ad_data;
|
244 |
}
|
245 |
|
246 |
public function get_enable_manual (){
|
247 |
+
$enable_manual = isset ($this->wp_options [AI_OPTION_ENABLE_MANUAL]) ? $this->wp_options [AI_OPTION_ENABLE_MANUAL] : '';
|
248 |
if ($enable_manual == '') $enable_manual = AD_SETTINGS_NOT_CHECKED;
|
249 |
return $enable_manual;
|
250 |
}
|
251 |
|
252 |
public function get_process_php (){
|
253 |
+
$process_php = isset ($this->wp_options [AI_OPTION_PROCESS_PHP]) ? $this->wp_options [AI_OPTION_PROCESS_PHP] : '';
|
254 |
if ($process_php == '') $process_php = AD_SETTINGS_NOT_CHECKED;
|
255 |
return $process_php;
|
256 |
}
|
257 |
|
258 |
public function get_enable_404 (){
|
259 |
+
$enable_404 = isset ($this->wp_options [AI_OPTION_ENABLE_404]) ? $this->wp_options [AI_OPTION_ENABLE_404] : '';
|
260 |
if ($enable_404 == '') $enable_404 = AD_SETTINGS_NOT_CHECKED;
|
261 |
return $enable_404;
|
262 |
}
|
586 |
}
|
587 |
}
|
588 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
return $style;
|
590 |
}
|
591 |
|
593 |
return $this->alignment_style ($this->get_alignment_type());
|
594 |
}
|
595 |
|
596 |
+
public function get_paragraph_number(){
|
597 |
+
$option = isset ($this->wp_options [AI_OPTION_PARAGRAPH_NUMBER]) ? $this->wp_options [AI_OPTION_PARAGRAPH_NUMBER] : "";
|
598 |
+
if ($option == '') $option = AD_ZERO;
|
599 |
+
return $option;
|
600 |
+
}
|
601 |
|
602 |
+
public function get_paragraph_number_minimum(){
|
603 |
+
$option = isset ($this->wp_options [AI_OPTION_MIN_PARAGRAPHS]) ? $this->wp_options [AI_OPTION_MIN_PARAGRAPHS] : "";
|
604 |
+
return $option;
|
605 |
+
}
|
606 |
|
607 |
+
public function get_minimum_words(){
|
608 |
+
$option = isset ($this->wp_options [AI_OPTION_MIN_WORDS]) ? $this->wp_options [AI_OPTION_MIN_WORDS] : "";
|
609 |
+
return $option;
|
610 |
+
}
|
611 |
|
612 |
+
public function get_maximum_words(){
|
613 |
+
$option = isset ($this->wp_options [AI_OPTION_MAX_WORDS]) ? $this->wp_options [AI_OPTION_MAX_WORDS] : "";
|
614 |
+
return $option;
|
615 |
+
}
|
616 |
|
617 |
public function get_paragraph_tags(){
|
618 |
$option = isset ($this->wp_options [AI_OPTION_PARAGRAPH_TAGS]) ? $this->wp_options [AI_OPTION_PARAGRAPH_TAGS] : DEFAULT_PARAGRAPH_TAGS;
|
619 |
return $option;
|
620 |
}
|
621 |
|
622 |
+
public function get_minimum_paragraph_words(){
|
623 |
+
$option = isset ($this->wp_options [AI_OPTION_MIN_PARAGRAPH_WORDS]) ? $this->wp_options [AI_OPTION_MIN_PARAGRAPH_WORDS] : "";
|
624 |
+
return $option;
|
625 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
626 |
|
627 |
+
public function get_maximum_paragraph_words(){
|
628 |
+
$option = isset ($this->wp_options [AI_OPTION_MAX_PARAGRAPH_WORDS]) ? $this->wp_options [AI_OPTION_MAX_PARAGRAPH_WORDS] : "";
|
629 |
+
return $option;
|
630 |
+
}
|
631 |
|
632 |
+
public function get_count_inside_blockquote(){
|
633 |
+
$option = isset ($this->wp_options [AI_OPTION_COUNT_INSIDE_BLOCKQUOTE]) ? $this->wp_options [AI_OPTION_COUNT_INSIDE_BLOCKQUOTE] : "";
|
634 |
+
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
635 |
+
return $option;
|
636 |
+
}
|
637 |
|
638 |
+
public function get_avoid_paragraphs_above(){
|
639 |
+
$option = isset ($this->wp_options [AI_OPTION_AVOID_PARAGRAPHS_ABOVE]) ? $this->wp_options [AI_OPTION_AVOID_PARAGRAPHS_ABOVE] : "";
|
640 |
+
return $option;
|
641 |
+
}
|
642 |
|
643 |
+
public function get_avoid_paragraphs_below(){
|
644 |
+
$option = isset ($this->wp_options [AI_OPTION_AVOID_PARAGRAPHS_BELOW]) ? $this->wp_options [AI_OPTION_AVOID_PARAGRAPHS_BELOW] : "";
|
645 |
+
return $option;
|
646 |
+
}
|
647 |
|
648 |
+
public function get_avoid_text_above(){
|
649 |
+
$option = isset ($this->wp_options [AI_OPTION_AVOID_TEXT_ABOVE]) ? $this->wp_options [AI_OPTION_AVOID_TEXT_ABOVE] : "";
|
650 |
+
return $option;
|
651 |
+
}
|
|
|
652 |
|
653 |
+
public function get_avoid_text_below(){
|
654 |
+
$option = isset ($this->wp_options [AI_OPTION_AVOID_TEXT_BELOW]) ? $this->wp_options [AI_OPTION_AVOID_TEXT_BELOW] : "";
|
655 |
+
return $option;
|
656 |
+
}
|
|
|
657 |
|
658 |
+
public function get_avoid_action(){
|
659 |
+
$option = isset ($this->wp_options [AI_OPTION_AVOID_ACTION]) ? $this->wp_options [AI_OPTION_AVOID_ACTION] : "";
|
660 |
+
if ($option == '') $option = AD_TRY_TO_SHIFT_POSITION;
|
661 |
+
return $option;
|
662 |
+
}
|
663 |
|
664 |
+
public function get_avoid_try_limit(){
|
665 |
+
$option = isset ($this->wp_options [AI_OPTION_AVOID_TRY_LIMIT]) ? $this->wp_options [AI_OPTION_AVOID_TRY_LIMIT] : "";
|
666 |
+
if ($option == '') $option = AD_ZERO;
|
667 |
+
return $option;
|
668 |
+
}
|
669 |
|
670 |
+
public function get_avoid_direction(){
|
671 |
+
$option = isset ($this->wp_options [AI_OPTION_AVOID_DIRECTION]) ? $this->wp_options [AI_OPTION_AVOID_DIRECTION] : "";
|
672 |
+
if ($option == '') $option = AD_BELOW_AND_THEN_ABOVE;
|
673 |
+
return $option;
|
674 |
+
}
|
675 |
|
676 |
+
public function get_call_filter(){
|
677 |
+
$option = isset ($this->wp_options [AI_OPTION_EXCERPT_NUMBER]) ? $this->wp_options [AI_OPTION_EXCERPT_NUMBER] : "";
|
678 |
+
return $option;
|
679 |
+
}
|
|
|
680 |
|
681 |
+
public function get_filter_type(){
|
682 |
+
$option = isset ($this->wp_options [AI_OPTION_FILTER_TYPE]) ? $this->wp_options [AI_OPTION_FILTER_TYPE] : "";
|
683 |
+
if ($option == '') $option = AI_OPTION_FILTER_AUTO;
|
684 |
+
return $option;
|
685 |
}
|
686 |
|
687 |
+
public function get_direction_type(){
|
688 |
+
$option = isset ($this->wp_options [AI_OPTION_DIRECTION_TYPE]) ? $this->wp_options [AI_OPTION_DIRECTION_TYPE] : "";
|
689 |
+
if ($option == '') $option = AD_DIRECTION_FROM_TOP;
|
690 |
+
return $option;
|
691 |
}
|
692 |
|
693 |
+
public function get_display_settings_post(){
|
694 |
+
$option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_POSTS]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_POSTS] : "";
|
695 |
+
if ($option == '') $option = AD_SETTINGS_CHECKED;
|
696 |
+
return $option;
|
697 |
+
}
|
698 |
|
699 |
+
public function get_display_settings_page(){
|
700 |
+
$option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_PAGES] : "";
|
701 |
+
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
702 |
+
return $option;
|
703 |
+
}
|
704 |
|
705 |
+
public function get_display_settings_home(){
|
706 |
+
global $ai_db_options;
|
|
|
|
|
707 |
|
708 |
+
$option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_HOMEPAGE] : "";
|
709 |
+
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
|
|
|
|
|
|
|
|
710 |
|
711 |
+
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
|
712 |
+
if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
|
713 |
+
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
714 |
+
} else $automatic_insertion = '';
|
715 |
+
|
716 |
+
if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH ||
|
717 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH ||
|
718 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT ||
|
719 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT)
|
720 |
+
$option = AD_SETTINGS_NOT_CHECKED;
|
721 |
}
|
722 |
|
723 |
+
return $option;
|
724 |
+
}
|
725 |
|
726 |
+
public function get_display_settings_category(){
|
727 |
+
global $ai_db_options;
|
728 |
|
729 |
+
$option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_CATEGORY_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_CATEGORY_PAGES] : "";
|
730 |
+
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
|
|
|
|
731 |
|
732 |
+
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
|
733 |
+
if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
|
734 |
+
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
735 |
+
} else $automatic_insertion = '';
|
|
|
|
|
736 |
|
737 |
+
if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH ||
|
738 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH ||
|
739 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT ||
|
740 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT)
|
741 |
+
$option = AD_SETTINGS_NOT_CHECKED;
|
742 |
}
|
743 |
|
744 |
+
return $option;
|
745 |
+
}
|
746 |
|
747 |
+
public function get_display_settings_search(){
|
748 |
+
global $ai_db_options;
|
749 |
|
750 |
+
$option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_SEARCH_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_SEARCH_PAGES] : "";
|
751 |
+
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
|
|
|
|
752 |
|
753 |
+
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
|
754 |
+
if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
|
755 |
+
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
756 |
+
} else $automatic_insertion = '';
|
|
|
|
|
757 |
|
758 |
+
if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH ||
|
759 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH ||
|
760 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT ||
|
761 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT)
|
762 |
+
$option = AD_SETTINGS_NOT_CHECKED;
|
763 |
}
|
764 |
|
765 |
+
return $option;
|
766 |
+
}
|
767 |
|
768 |
+
public function get_display_settings_archive(){
|
769 |
+
global $ai_db_options;
|
770 |
|
771 |
+
$option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_ARCHIVE_PAGES] : "";
|
772 |
+
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
|
|
|
|
773 |
|
774 |
+
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
|
775 |
+
if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
|
776 |
+
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
777 |
+
} else $automatic_insertion = '';
|
|
|
|
|
778 |
|
779 |
+
if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH ||
|
780 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH ||
|
781 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT ||
|
782 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT)
|
783 |
+
$option = AD_SETTINGS_NOT_CHECKED;
|
784 |
}
|
785 |
|
786 |
+
return $option;
|
787 |
+
}
|
788 |
+
|
789 |
public function get_enable_feed (){
|
790 |
$enable_feed = isset ($this->wp_options [AI_OPTION_ENABLE_FEED]) ? $this->wp_options [AI_OPTION_ENABLE_FEED] : "";
|
791 |
if ($enable_feed == '') $enable_feed = AD_SETTINGS_NOT_CHECKED;
|
801 |
public function get_enable_manual (){
|
802 |
$option = isset ($this->wp_options [AI_OPTION_ENABLE_MANUAL]) ? $this->wp_options [AI_OPTION_ENABLE_MANUAL] : "";
|
803 |
if ($option == '') {
|
804 |
+
$option = AD_SETTINGS_NOT_CHECKED;
|
|
|
|
|
|
|
805 |
}
|
806 |
return $option;
|
807 |
}
|
808 |
|
809 |
+
public function get_enable_widget (){
|
810 |
+
global $ai_db_options;
|
811 |
|
812 |
+
$enable_widget = isset ($this->wp_options [AI_OPTION_ENABLE_WIDGET]) ? $this->wp_options [AI_OPTION_ENABLE_WIDGET] : "";
|
813 |
+
if ($enable_widget == '') $enable_widget = AD_SETTINGS_CHECKED;
|
814 |
|
815 |
+
return $enable_widget;
|
816 |
+
}
|
817 |
|
818 |
public function get_enable_php_call (){
|
819 |
$option = isset ($this->wp_options [AI_OPTION_ENABLE_PHP_CALL]) ? $this->wp_options [AI_OPTION_ENABLE_PHP_CALL] : "";
|
838 |
$option = isset ($this->wp_options [AI_OPTION_CUSTOM_CSS]) ? $this->wp_options [AI_OPTION_CUSTOM_CSS] : "";
|
839 |
|
840 |
// Fix for old bug
|
841 |
+
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605' && strpos ($option, "Undefined index")) $option = "";
|
842 |
|
843 |
return $option;
|
844 |
}
|
861 |
|
862 |
$option = isset ($this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE]) ? $this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE] : AD_SETTINGS_NOT_CHECKED;
|
863 |
|
864 |
+
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605') {
|
865 |
if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
|
866 |
$display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
|
867 |
} else $display_for_devices = '';
|
878 |
$option_name = AI_OPTION_DETECT_VIEWPORT . '_' . $viewport;
|
879 |
$option = isset ($this->wp_options [$option_name]) ? $this->wp_options [$option_name] : AD_SETTINGS_NOT_CHECKED;
|
880 |
|
881 |
+
if (isset ($ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION']) && $ai_db_options [AI_GLOBAL_OPTION_NAME]['VERSION'] < '010605' && $this->get_detection_client_side()) {
|
882 |
if (isset ($this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES])) {
|
883 |
$display_for_devices = $this->wp_options [AI_OPTION_DISPLAY_FOR_DEVICES];
|
884 |
} else $display_for_devices = '';
|
1552 |
}
|
1553 |
|
1554 |
$ai_last_check = AI_CHECK_PARAGRAPHS_MIN_NUMBER;
|
1555 |
+
if (count ($paragraph_positions) >= intval ($this->get_paragraph_number_minimum())) {
|
1556 |
+
$ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
|
1557 |
+
if (count ($paragraph_positions) > $position) {
|
1558 |
+
$this->increment_block_counter ();
|
1559 |
+
$ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
|
1560 |
+
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
|
1561 |
+
$content_position = $paragraph_positions [$position];
|
1562 |
+
$content = substr_replace ($content, $this->get_code_for_insertion (), $content_position, 0);
|
1563 |
+
$ai_last_check = AI_CHECK_INSERTED;
|
1564 |
+
}
|
1565 |
}
|
1566 |
}
|
1567 |
|
1823 |
}
|
1824 |
|
1825 |
$ai_last_check = AI_CHECK_PARAGRAPHS_MIN_NUMBER;
|
1826 |
+
if (count ($paragraph_positions) >= intval ($this->get_paragraph_number_minimum())) {
|
1827 |
+
$ai_last_check = AI_CHECK_PARAGRAPH_NUMBER;
|
1828 |
+
if (count ($paragraph_positions) > $position) {
|
1829 |
+
$this->increment_block_counter ();
|
1830 |
+
$ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
|
1831 |
+
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
|
1832 |
+
$content_position = $paragraph_positions [$position];
|
1833 |
+
if ($content_position >= strlen ($content) - 1)
|
1834 |
+
$content = $content . $this->get_code_for_insertion (); else
|
1835 |
+
$content = substr_replace ($content, $this->get_code_for_insertion (), $content_position + 1, 0);
|
1836 |
+
$ai_last_check = AI_CHECK_INSERTED;
|
1837 |
+
}
|
1838 |
}
|
1839 |
}
|
1840 |
|
2245 |
$ai_last_check = AI_CHECK_SCHEDULING;
|
2246 |
if (!$this->check_scheduling ()) return false;
|
2247 |
|
2248 |
+
// $ai_last_check = AI_CHECK_CODE;
|
2249 |
+
// if ($this->ai_getCode () == '') return false;
|
2250 |
|
2251 |
$display_for_users = $this->get_display_for_users ();
|
2252 |
|
2253 |
$ai_last_check = AI_CHECK_LOGGED_IN_USER;
|
2254 |
+
if ($display_for_users == AD_DISPLAY_LOGGED_IN_USERS && ($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) != AI_USER_LOGGED_IN) return false;
|
2255 |
$ai_last_check = AI_CHECK_NOT_LOGGED_IN_USER;
|
2256 |
+
if ($display_for_users == AD_DISPLAY_NOT_LOGGED_IN_USERS && ($ai_wp_data [AI_WP_USER] & AI_USER_LOGGED_IN) == AI_USER_LOGGED_IN) return false;
|
2257 |
$ai_last_check = AI_CHECK_ADMINISTRATOR;
|
2258 |
+
if ($display_for_users == AD_DISPLAY_ADMINISTRATORS && ($ai_wp_data [AI_WP_USER] & AI_USER_ADMINISTRATOR) != AI_USER_ADMINISTRATOR) return false;
|
2259 |
|
2260 |
return true;
|
2261 |
}
|
constants.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
3 |
if (!defined ('AD_INSERTER_PLUGIN_DIR'))
|
4 |
define ('AD_INSERTER_PLUGIN_DIR', plugin_dir_path (__FILE__));
|
5 |
|
@@ -11,7 +14,7 @@ if (!defined( 'AD_INSERTER_NAME'))
|
|
11 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
12 |
|
13 |
if (!defined( 'AD_INSERTER_VERSION'))
|
14 |
-
define ('AD_INSERTER_VERSION', '2.1.
|
15 |
|
16 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
17 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
@@ -37,8 +40,6 @@ define ('AD_OPTIONS', 'AdInserterOptions'); // general plugin options
|
|
37 |
define ('AD_ADx_OPTIONS', 'AdInserter#Options');
|
38 |
|
39 |
// Options
|
40 |
-
define ('WP_OPTION_NAME', 'ad_inserter');
|
41 |
-
define ('AI_GLOBAL_OPTION_NAME', 'global');
|
42 |
define ('AI_EXTRACT_OPTION_NAME', 'extract');
|
43 |
define ('WP_FORM_FIELD_POSTFIX', '_block_');
|
44 |
define ('AI_HEADER_OPTION_NAME', 'h');
|
@@ -385,6 +386,7 @@ define ('AI_CHECK_AD_BELOW', 44);
|
|
385 |
define ('AI_CHECK_SHORTCODE_ATTRIBUTES', 45);
|
386 |
define ('AI_CHECK_COUNTRY', 46);
|
387 |
define ('AI_CHECK_IP_ADDRESS', 47);
|
|
|
388 |
|
389 |
define ('AI_PT_NONE', - 1);
|
390 |
define ('AI_PT_ANY', 0);
|
1 |
<?php
|
2 |
|
3 |
+
define ('WP_OPTION_NAME', 'ad_inserter');
|
4 |
+
define ('AI_GLOBAL_OPTION_NAME', 'global');
|
5 |
+
|
6 |
if (!defined ('AD_INSERTER_PLUGIN_DIR'))
|
7 |
define ('AD_INSERTER_PLUGIN_DIR', plugin_dir_path (__FILE__));
|
8 |
|
14 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
15 |
|
16 |
if (!defined( 'AD_INSERTER_VERSION'))
|
17 |
+
define ('AD_INSERTER_VERSION', '2.1.1');
|
18 |
|
19 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
20 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
40 |
define ('AD_ADx_OPTIONS', 'AdInserter#Options');
|
41 |
|
42 |
// Options
|
|
|
|
|
43 |
define ('AI_EXTRACT_OPTION_NAME', 'extract');
|
44 |
define ('WP_FORM_FIELD_POSTFIX', '_block_');
|
45 |
define ('AI_HEADER_OPTION_NAME', 'h');
|
386 |
define ('AI_CHECK_SHORTCODE_ATTRIBUTES', 45);
|
387 |
define ('AI_CHECK_COUNTRY', 46);
|
388 |
define ('AI_CHECK_IP_ADDRESS', 47);
|
389 |
+
define ('AI_CHECK_PARAGRAPH_NUMBER', 48);
|
390 |
|
391 |
define ('AI_PT_NONE', - 1);
|
392 |
define ('AI_PT_ANY', 0);
|
css/ad-inserter.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#data {
|
2 |
-
font-family: "2.1.
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
1 |
#data {
|
2 |
+
font-family: "2.1.1"; /* Used for version number of the file */
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
js/ad-inserter.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
var javascript_version = "2.1.
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
@@ -115,6 +115,12 @@ jQuery(document).ready(function($) {
|
|
115 |
|
116 |
shSettings ['theme'] = $('#data').attr ('theme');
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
var debug = parseInt ($('#data').attr ('javascript_debugging'));
|
119 |
var debug_title = false;
|
120 |
|
@@ -474,7 +480,7 @@ jQuery(document).ready(function($) {
|
|
474 |
if (syntax_highlighting) configure_editor_language ('h');
|
475 |
if (syntax_highlighting) configure_editor_language ('f');
|
476 |
|
477 |
-
for (var index = 1; index <=
|
478 |
generate_country_list ('group-country', index);
|
479 |
}
|
480 |
}
|
@@ -839,6 +845,7 @@ jQuery(document).ready(function($) {
|
|
839 |
if ($('#'+element_name_prefix+'-select-'+index).length !== 0) {
|
840 |
|
841 |
$('#'+element_name_prefix+'-list-'+index).click (function () {
|
|
|
842 |
if (!$('#'+element_name_prefix+'-select-'+index).hasClass ('multi-select')) {
|
843 |
$('#'+element_name_prefix+'-select-'+index).addClass ('multi-select');
|
844 |
$('#'+element_name_prefix+'-select-'+index).multiSelect({
|
@@ -877,6 +884,7 @@ jQuery(document).ready(function($) {
|
|
877 |
$('#ms-'+element_name_prefix+'-select-'+index).hide();
|
878 |
}
|
879 |
update_country_selection ($(this), element_name_prefix, true)
|
|
|
880 |
}).focusout (function () {
|
881 |
update_country_selection ($(this), element_name_prefix, false)
|
882 |
});
|
1 |
+
var javascript_version = "2.1.1";
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
115 |
|
116 |
shSettings ['theme'] = $('#data').attr ('theme');
|
117 |
|
118 |
+
var geo_groups = 0;
|
119 |
+
var geo_groups_text = $('#data-2').attr ('geo_groups');
|
120 |
+
if (typeof geo_groups_text != 'undefined') {
|
121 |
+
geo_groups = parseInt (geo_groups_text);
|
122 |
+
}
|
123 |
+
|
124 |
var debug = parseInt ($('#data').attr ('javascript_debugging'));
|
125 |
var debug_title = false;
|
126 |
|
480 |
if (syntax_highlighting) configure_editor_language ('h');
|
481 |
if (syntax_highlighting) configure_editor_language ('f');
|
482 |
|
483 |
+
for (var index = 1; index <= geo_groups; index ++) {
|
484 |
generate_country_list ('group-country', index);
|
485 |
}
|
486 |
}
|
845 |
if ($('#'+element_name_prefix+'-select-'+index).length !== 0) {
|
846 |
|
847 |
$('#'+element_name_prefix+'-list-'+index).click (function () {
|
848 |
+
|
849 |
if (!$('#'+element_name_prefix+'-select-'+index).hasClass ('multi-select')) {
|
850 |
$('#'+element_name_prefix+'-select-'+index).addClass ('multi-select');
|
851 |
$('#'+element_name_prefix+'-select-'+index).multiSelect({
|
884 |
$('#ms-'+element_name_prefix+'-select-'+index).hide();
|
885 |
}
|
886 |
update_country_selection ($(this), element_name_prefix, true)
|
887 |
+
// $(this).focus ();
|
888 |
}).focusout (function () {
|
889 |
update_country_selection ($(this), element_name_prefix, false)
|
890 |
});
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: adsense, amazon, advertising, ad, advert, html, javascript, php, code, widget, sidebar, responsive, viewport, rotating, banner, ad rotation, geo targeting, multisite, contextual, shortcodes, widgets, header, footer, mobile, desktop, phone, tablet, custom css, category, tag, filter, url, caching support
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.7.2
|
7 |
-
Stable tag: 2.0
|
8 |
License: GPLv3
|
9 |
|
10 |
Insert any advert or code into Wordpress. Perfect for all kinds of banners and ads including AdSense and Amazon. Powerful features, simple use.
|
@@ -55,6 +55,7 @@ There is also <a href="http://adinserter.pro/" target="_blank">Ad Inserter Pro</
|
|
55 |
> * 64 code blocks
|
56 |
> * GEO targeting (works also with caching)
|
57 |
> * Black/White-list IP addresses or countries
|
|
|
58 |
> * Scheduling with fallback option
|
59 |
> * Export and import of settings
|
60 |
> * Multisite options to limit settings on the sites
|
@@ -374,7 +375,8 @@ amzn_assoc_linkid = "cf1873f027a57f63cede634cfd444bea";
|
|
374 |
</script>
|
375 |
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>`
|
376 |
|
377 |
-
Use your own tracking id! Please note `{smart_tag}` as default search phrase. This makes this widget contextual.
|
|
|
378 |
|
379 |
|
380 |
= Settings for ad before the second paragraph on all posts, but on the homepage only three ads in the first three post =
|
@@ -589,6 +591,8 @@ Some HTML/Javascript code
|
|
589 |
* {author} - Post author username (**works only inside posts**)
|
590 |
* {author_name} Post author name (**works only inside posts**)
|
591 |
|
|
|
|
|
592 |
|
593 |
= How can I rotate few versions of the same ad? =
|
594 |
|
@@ -671,6 +675,12 @@ AD CODE RIGHT
|
|
671 |
|
672 |
== Changelog ==
|
673 |
|
|
|
|
|
|
|
|
|
|
|
|
|
674 |
= 2.1.0 =
|
675 |
- Added support to insert ads in Ajax requests (e.g. in infinite scroll)
|
676 |
- Added support to not include block classes when class name is empty
|
@@ -994,6 +1004,10 @@ AD CODE RIGHT
|
|
994 |
|
995 |
== Upgrade Notice ==
|
996 |
|
|
|
|
|
|
|
|
|
997 |
= 2.1.0 =
|
998 |
Support for ads in Ajax requests (e.g. in infinite scroll); Added sticky positions (Pro only);
|
999 |
Bug fix for minimum user role for exceptions list; Bug fix for IP database update cron event (Pro only)
|
4 |
Tags: adsense, amazon, advertising, ad, advert, html, javascript, php, code, widget, sidebar, responsive, viewport, rotating, banner, ad rotation, geo targeting, multisite, contextual, shortcodes, widgets, header, footer, mobile, desktop, phone, tablet, custom css, category, tag, filter, url, caching support
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.7.2
|
7 |
+
Stable tag: 2.1.0
|
8 |
License: GPLv3
|
9 |
|
10 |
Insert any advert or code into Wordpress. Perfect for all kinds of banners and ads including AdSense and Amazon. Powerful features, simple use.
|
55 |
> * 64 code blocks
|
56 |
> * GEO targeting (works also with caching)
|
57 |
> * Black/White-list IP addresses or countries
|
58 |
+
> * Sticky positions
|
59 |
> * Scheduling with fallback option
|
60 |
> * Export and import of settings
|
61 |
> * Multisite options to limit settings on the sites
|
375 |
</script>
|
376 |
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>`
|
377 |
|
378 |
+
Use your own tracking id! Please note `{smart_tag}` as default search phrase. This makes this widget contextual. It will show products related to the tags for this post.
|
379 |
+
You can also try with `{tag}', `{short_title}`, `{category}` or `{short_category}`. For more options check <a href="http://adinserter.pro/documentation#code-block-options" target="_blank">Ad Inserter documentation page</a>.
|
380 |
|
381 |
|
382 |
= Settings for ad before the second paragraph on all posts, but on the homepage only three ads in the first three post =
|
591 |
* {author} - Post author username (**works only inside posts**)
|
592 |
* {author_name} Post author name (**works only inside posts**)
|
593 |
|
594 |
+
For all options check <a href="http://adinserter.pro/documentation#code-block-options" target="_blank">Ad Inserter documentation page</a>.
|
595 |
+
|
596 |
|
597 |
= How can I rotate few versions of the same ad? =
|
598 |
|
675 |
|
676 |
== Changelog ==
|
677 |
|
678 |
+
= 2.1.1 =
|
679 |
+
- Changes for compatibility with PHP 7.1
|
680 |
+
- Automatic rename of old pro plugin slug (Pro only)
|
681 |
+
- Added support for additional Pro features (Pro only)
|
682 |
+
- Few bug fixes and cosmetic changes
|
683 |
+
|
684 |
= 2.1.0 =
|
685 |
- Added support to insert ads in Ajax requests (e.g. in infinite scroll)
|
686 |
- Added support to not include block classes when class name is empty
|
1004 |
|
1005 |
== Upgrade Notice ==
|
1006 |
|
1007 |
+
= 2.1.1 =
|
1008 |
+
Changes for compatibility with PHP 7.1;
|
1009 |
+
Few bug fixes and cosmetic changes
|
1010 |
+
|
1011 |
= 2.1.0 =
|
1012 |
Support for ads in Ajax requests (e.g. in infinite scroll); Added sticky positions (Pro only);
|
1013 |
Bug fix for minimum user role for exceptions list; Bug fix for IP database update cron event (Pro only)
|
settings.php
CHANGED
@@ -74,6 +74,9 @@ function generate_settings_form (){
|
|
74 |
?>
|
75 |
|
76 |
<div id="data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" javascript_debugging="<?php echo get_javascript_debugging () ? '1' : '0'; ?>" ></div>
|
|
|
|
|
|
|
77 |
|
78 |
<div style="clear: both;"></div>
|
79 |
|
@@ -242,7 +245,7 @@ function generate_settings_form (){
|
|
242 |
$enabled_f = $adF->get_enable_manual () && $adF->get_ad_data() != "";
|
243 |
if ($enabled_h || $enabled_f) $class_hf = " on"; else $class_hf = "";
|
244 |
?>
|
245 |
-
<li id="ai-tab0" class="ai-tab" title="<?php echo AD_INSERTER_NAME ?> Settings<?php echo $title_hf ?>"><a href="#tab-0" style="padding: 5px 14px 6px 12px;"><div class="ai-icon-gear<?php echo $class_hf ?>"
|
246 |
</ul>
|
247 |
|
248 |
<?php
|
74 |
?>
|
75 |
|
76 |
<div id="data" style="display: none;" version="<?php echo AD_INSERTER_VERSION; ?>" theme="<?php echo $syntax_highlighter_theme; ?>" javascript_debugging="<?php echo get_javascript_debugging () ? '1' : '0'; ?>" ></div>
|
77 |
+
<?php
|
78 |
+
if (function_exists ('ai_data_2')) ai_data_2 ();
|
79 |
+
?>
|
80 |
|
81 |
<div style="clear: both;"></div>
|
82 |
|
245 |
$enabled_f = $adF->get_enable_manual () && $adF->get_ad_data() != "";
|
246 |
if ($enabled_h || $enabled_f) $class_hf = " on"; else $class_hf = "";
|
247 |
?>
|
248 |
+
<li id="ai-tab0" class="ai-tab" title="<?php echo AD_INSERTER_NAME ?> Settings<?php echo $title_hf ?>"><a href="#tab-0" style="padding: 5px 14px 6px 12px;"><div class="ai-icon-gear<?php echo $class_hf ?>"></div></a></li>
|
249 |
</ul>
|
250 |
|
251 |
<?php
|