Version Description
- Added icons for Automatic insertion and alignment
- Automatic insertion None changed to Disabled
- Alignment None changed to Default
- Changed database option data for Automatic insertion and Alignment settings
- Improved CSS 3 code for Left, Center and Right alignment
- Click on CSS code starts editing
- Page/Post exceptions listed in debug output
- Different plugin slug for Pro version
- Few minor bug fixes and cosmetic changes
Download this release
Release Info
Developer | spacetime |
Plugin | Ad Inserter – WordPress Ads Management with AdSense Header Integration |
Version | 2.0.13 |
Comparing to | |
See all releases |
Code changes from version 2.0.12 to 2.0.13
- ad-inserter.php +134 -51
- class.php +187 -97
- constants.php +44 -5
- css/ad-inserter.css +29 -2
- css/image-picker.css +30 -0
- images/after-content.png +0 -0
- images/after-excerpt.png +0 -0
- images/after-paragraph.png +0 -0
- images/after-post.png +0 -0
- images/align-left.png +0 -0
- images/align-right.png +0 -0
- images/before-content.png +0 -0
- images/before-excerpt.png +0 -0
- images/before-paragraph.png +0 -0
- images/before-post.png +0 -0
- images/between-posts.png +0 -0
- images/center.png +0 -0
- images/custom-css.png +0 -0
- images/default.png +0 -0
- images/disabled.png +0 -0
- images/float-left.png +0 -0
- images/float-right.png +0 -0
- images/no-wrapping.png +0 -0
- includes/js/image-picker.js +317 -0
- includes/js/image-picker.min.js +13 -0
- index.php +12 -5
- js/ad-inserter.js +75 -41
- preview.php +62 -50
- readme.txt +35 -4
- settings.php +38 -36
ad-inserter.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Ad Inserter
|
4 |
-
Version: 2.0.
|
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,17 @@ Plugin URI: http://adinserter.pro/documentation
|
|
11 |
/*
|
12 |
Change Log
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
Ad Inserter 2.0.12 - 29 January 2017
|
15 |
- Bug fix for page/post exceptions list
|
16 |
|
@@ -518,8 +529,8 @@ function ai_toolbar ($wp_admin_bar) {
|
|
518 |
$paragraph_blocks = array ();
|
519 |
for ($block = 0; $block <= AD_INSERTER_BLOCKS; $block ++) {
|
520 |
$obj = $block_object [$block];
|
521 |
-
$
|
522 |
-
if ($block == 0 || $
|
523 |
|
524 |
$block_tags = trim ($block_object [$block]->get_paragraph_tags ());
|
525 |
$direction = $block_object [$block]->get_direction_type() == AD_DIRECTION_FROM_TOP ? 't' : 'b';
|
@@ -885,12 +896,16 @@ function ai_admin_enqueue_scripts ($hook_suffix) {
|
|
885 |
|
886 |
if (function_exists ('ai_admin_enqueue_scripts_1')) ai_admin_enqueue_scripts_1 ();
|
887 |
|
|
|
|
|
888 |
wp_enqueue_style ('ai-admin', plugins_url ('css/ad-inserter.css', __FILE__), array (), AD_INSERTER_VERSION);
|
889 |
|
890 |
-
wp_add_inline_style ('ai-admin', '.notice {
|
891 |
|
892 |
if (function_exists ('ai_admin_enqueue_scripts_2')) ai_admin_enqueue_scripts_2 ();
|
893 |
|
|
|
|
|
894 |
if (AI_SYNTAX_HIGHLIGHTING) {
|
895 |
wp_enqueue_script ('ai-ace', plugins_url ('includes/ace/src-min-noconflict/ace.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
896 |
wp_enqueue_script ('ai-ace-ext-modelist', plugins_url ('includes/ace/src-min-noconflict/ext-modelist.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
@@ -1118,7 +1133,7 @@ function ai_admin_notice_hook () {
|
|
1118 |
// foreach ($sidebar_widget as $widget) {
|
1119 |
// if (preg_match ("/ai_widget([\d]+)/", $widget, $widget_number)) {
|
1120 |
// if (isset ($widget_number [1]) && is_numeric ($widget_number [1])) {
|
1121 |
-
// $is_widget = $ai_db_options [$widget_number [1]][
|
1122 |
// } else $is_widget = false;
|
1123 |
// $sidebar_name = $GLOBALS ['wp_registered_sidebars'][$sidebar_widget_index]['name'];
|
1124 |
// if ($is_widget && $sidebar_name != "")
|
@@ -1256,13 +1271,12 @@ function ai_meta_box_callback ($post) {
|
|
1256 |
$individual_option_enabled = $general_enabled && ($enabled_on_text == AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED || $enabled_on_text == AD_ENABLED_ONLY_ON_SELECTED);
|
1257 |
$individual_text_enabled = $enabled_on_text == AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED;
|
1258 |
|
1259 |
-
$display_type = $obj->get_display_type();
|
1260 |
if ($rows % 2 != 0) $background = "#F0F0F0"; else $background = "#FFF";
|
1261 |
echo '<tr style="background: ', $background, ';">';
|
1262 |
echo ' <td style="text-align: right;">', $obj->number, '</td>';
|
1263 |
if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($block); else $url_parameters = "";
|
1264 |
echo ' <td style="padding: 0 10px 0 10px;"><a href="', admin_url ('options-general.php?page=ad-inserter.php'), $url_parameters, '&tab=', $block, '" target="_blank">', $obj->get_ad_name(), '</a></td>';
|
1265 |
-
echo ' <td style="padding: 0 10px 0 10px;">', $
|
1266 |
|
1267 |
echo ' <td style="padding: 0 10px 0 10px; text-align: center;">';
|
1268 |
if ($obj->get_display_settings_post ()) echo '✓';
|
@@ -1483,10 +1497,10 @@ function ai_write_debug_info ($write_processing_log = false) {
|
|
1483 |
$obj = $block_object [$block];
|
1484 |
|
1485 |
$settings = "";
|
1486 |
-
$
|
1487 |
$alignment_settings = '';
|
1488 |
$default_settings = true;
|
1489 |
-
$display_type = '';
|
1490 |
foreach (array_keys ($default->wp_options) as $key){
|
1491 |
switch ($key) {
|
1492 |
case AI_OPTION_CODE:
|
@@ -1509,35 +1523,35 @@ function ai_write_debug_info ($write_processing_log = false) {
|
|
1509 |
if ($obj->wp_options [$key] != $default->wp_options [$key]) {
|
1510 |
$default_settings = false;
|
1511 |
switch ($key) {
|
1512 |
-
case
|
1513 |
-
$
|
1514 |
break;
|
1515 |
case AI_OPTION_ALIGNMENT_TYPE:
|
1516 |
-
$alignment_settings =
|
1517 |
break;
|
1518 |
case AI_OPTION_PARAGRAPH_TEXT:
|
1519 |
case AI_OPTION_AVOID_TEXT_ABOVE:
|
1520 |
case AI_OPTION_AVOID_TEXT_BELOW:
|
1521 |
if ($write_processing_log)
|
1522 |
-
$settings .= "
|
1523 |
-
$settings .= "
|
1524 |
break;
|
1525 |
default:
|
1526 |
-
$settings .= "
|
1527 |
break;
|
1528 |
}
|
1529 |
} else
|
1530 |
switch ($key) {
|
1531 |
-
case
|
1532 |
-
$
|
1533 |
break;
|
1534 |
case AI_OPTION_ALIGNMENT_TYPE:
|
1535 |
-
$alignment_settings =
|
1536 |
break;
|
1537 |
}
|
1538 |
}
|
1539 |
if ($default_settings && $settings == '') continue;
|
1540 |
-
$settings = $
|
1541 |
|
1542 |
echo sprintf ("%2d %-21s ", $block, substr ($obj->get_ad_name(), 0, 21));
|
1543 |
|
@@ -1557,6 +1571,37 @@ function ai_write_debug_info ($write_processing_log = false) {
|
|
1557 |
}
|
1558 |
echo "\n";
|
1559 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1560 |
echo "TOTAL BLOCKS\n";
|
1561 |
if (count ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][AI_PT_ANY]))
|
1562 |
echo "CONTENT HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [CONTENT_HOOK_BLOCKS][AI_PT_ANY]), "\n";
|
@@ -1742,7 +1787,6 @@ function ai_load_options () {
|
|
1742 |
if (is_multisite()) {
|
1743 |
$ai_db_options_multisite = get_site_option (WP_OPTION_NAME);
|
1744 |
option_stripslashes ($ai_db_options_multisite);
|
1745 |
-
|
1746 |
}
|
1747 |
|
1748 |
if (is_multisite() && multisite_main_for_all_blogs () && defined ('BLOG_ID_CURRENT_SITE')) {
|
@@ -2161,28 +2205,28 @@ function ai_generate_extract (&$settings) {
|
|
2161 |
if ($obj->get_enable_404()) $page_types []= AI_PT_404;
|
2162 |
|
2163 |
if ($page_types) {
|
2164 |
-
switch ($obj->
|
2165 |
-
case
|
2166 |
-
case
|
2167 |
-
case
|
2168 |
-
case
|
2169 |
foreach ($page_types as $block_page_type) $content_hook_blocks [$block_page_type][]= $block;
|
2170 |
$content_hook_blocks [AI_PT_ANY][]= $block;
|
2171 |
break;
|
2172 |
-
case
|
2173 |
-
case
|
2174 |
foreach ($page_types as $block_page_type) $excerpt_hook_blocks [$block_page_type][]= $block;
|
2175 |
$excerpt_hook_blocks [AI_PT_ANY][]= $block;
|
2176 |
break;
|
2177 |
-
case
|
2178 |
foreach ($page_types as $block_page_type) $loop_start_hook_blocks [$block_page_type][]= $block;
|
2179 |
$loop_start_hook_blocks [AI_PT_ANY][]= $block;
|
2180 |
break;
|
2181 |
-
case
|
2182 |
foreach ($page_types as $block_page_type) $loop_end_hook_blocks [$block_page_type][]= $block;
|
2183 |
$loop_end_hook_blocks [AI_PT_ANY][]= $block;
|
2184 |
break;
|
2185 |
-
case
|
2186 |
foreach ($page_types as $block_page_type) $post_hook_blocks [$block_page_type][]= $block;
|
2187 |
$post_hook_blocks [AI_PT_ANY][]= $block;
|
2188 |
break;
|
@@ -2454,9 +2498,28 @@ function ai_settings () {
|
|
2454 |
delete_site_option (WP_OPTION_NAME, $options);
|
2455 |
}
|
2456 |
|
2457 |
-
$args = array (
|
2458 |
-
|
2459 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2460 |
delete_post_meta ($page->ID, '_adinserter_block_exceptions');
|
2461 |
}
|
2462 |
|
@@ -2466,10 +2529,30 @@ function ai_settings () {
|
|
2466 |
|
2467 |
echo "<div class='notice notice-warning is-dismissible' style='margin: 5px 15px 2px 0px;'><p><strong>Settings cleared.</p></div>";
|
2468 |
} elseif (isset ($_POST [AI_FORM_CLEAR_EXCEPTIONS])) {
|
2469 |
-
|
2470 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2471 |
if ($_POST [AI_FORM_CLEAR_EXCEPTIONS] == "\xe2\x9d\x8c") {
|
2472 |
-
foreach ($
|
2473 |
delete_post_meta ($page->ID, '_adinserter_block_exceptions');
|
2474 |
}
|
2475 |
}
|
@@ -2480,7 +2563,7 @@ function ai_settings () {
|
|
2480 |
}
|
2481 |
}
|
2482 |
elseif (is_numeric ($_POST [AI_FORM_CLEAR_EXCEPTIONS])) {
|
2483 |
-
foreach ($
|
2484 |
$post_meta = get_post_meta ($page->ID, '_adinserter_block_exceptions', true);
|
2485 |
$selected_blocks = explode (",", $post_meta);
|
2486 |
if (($key = array_search ($_POST [AI_FORM_CLEAR_EXCEPTIONS], $selected_blocks)) !== false) {
|
@@ -2639,17 +2722,17 @@ function ai_content_hook ($content = '') {
|
|
2639 |
// Last check before insertion
|
2640 |
if (!$obj->check_block_counter ()) continue;
|
2641 |
|
2642 |
-
$
|
2643 |
|
2644 |
-
if ($
|
2645 |
$ai_last_check = AI_CHECK_PARAGRAPH_COUNTING;
|
2646 |
$content = $obj->before_paragraph ($content);
|
2647 |
}
|
2648 |
-
elseif ($
|
2649 |
$ai_last_check = AI_CHECK_PARAGRAPH_COUNTING;
|
2650 |
$content = $obj->after_paragraph ($content);
|
2651 |
}
|
2652 |
-
elseif ($
|
2653 |
$obj->increment_block_counter ();
|
2654 |
|
2655 |
$ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
|
@@ -2658,7 +2741,7 @@ function ai_content_hook ($content = '') {
|
|
2658 |
$ai_last_check = AI_CHECK_INSERTED;
|
2659 |
}
|
2660 |
}
|
2661 |
-
elseif ($
|
2662 |
$obj->increment_block_counter ();
|
2663 |
|
2664 |
$ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
|
@@ -2771,8 +2854,8 @@ function ai_excerpt_hook ($content = '') {
|
|
2771 |
$ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
|
2772 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
|
2773 |
|
2774 |
-
$
|
2775 |
-
if ($
|
2776 |
$content = $obj->get_code_for_insertion () . $content; else
|
2777 |
$content = $content . $obj->get_code_for_insertion ();
|
2778 |
|
@@ -2815,7 +2898,7 @@ function ai_excerpt_hook ($content = '') {
|
|
2815 |
|
2816 |
// Process Before / After Post postion
|
2817 |
|
2818 |
-
function ai_before_after_post ($query, $
|
2819 |
global $block_object, $ad_inserter_globals, $ai_db_options_extract, $ai_wp_data, $ai_last_check;
|
2820 |
|
2821 |
$debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
|
@@ -2825,13 +2908,13 @@ function ai_before_after_post ($query, $display_type) {
|
|
2825 |
if (!method_exists ($query, 'is_main_query')) return;
|
2826 |
if (!$query->is_main_query()) return;
|
2827 |
|
2828 |
-
$globals_name = $
|
2829 |
|
2830 |
if (!isset ($ad_inserter_globals [$globals_name])) {
|
2831 |
$ad_inserter_globals [$globals_name] = 1;
|
2832 |
} else $ad_inserter_globals [$globals_name] ++;
|
2833 |
|
2834 |
-
$ai_wp_data [AI_CONTEXT] = $
|
2835 |
|
2836 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
|
2837 |
|
@@ -2840,7 +2923,7 @@ function ai_before_after_post ($query, $display_type) {
|
|
2840 |
$counter = $ad_inserter_globals [$globals_name];
|
2841 |
if ($counter == 1) $counter = '';
|
2842 |
|
2843 |
-
echo "<section style='$style'>".($
|
2844 |
}
|
2845 |
|
2846 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
@@ -2853,7 +2936,7 @@ function ai_before_after_post ($query, $display_type) {
|
|
2853 |
$ai_last_check = AI_CHECK_NONE;
|
2854 |
$current_block = 0;
|
2855 |
|
2856 |
-
foreach ($ai_db_options_extract [$
|
2857 |
if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
|
2858 |
|
2859 |
if (!isset ($block_object [$block])) continue;
|
@@ -2890,7 +2973,7 @@ function ai_loop_start_hook ($query) {
|
|
2890 |
ai_log ("LOOP START HOOK START");
|
2891 |
$start_time = microtime ();
|
2892 |
}
|
2893 |
-
ai_before_after_post ($query,
|
2894 |
if ($debug_processing) {
|
2895 |
$ai_total_plugin_time += microtime () - $start_time;
|
2896 |
ai_log ("LOOP START HOOK END\n");
|
@@ -2906,7 +2989,7 @@ function ai_loop_end_hook ($query){
|
|
2906 |
ai_log ("LOOP END HOOK START");
|
2907 |
$start_time = microtime ();
|
2908 |
}
|
2909 |
-
ai_before_after_post ($query,
|
2910 |
if ($debug_processing) {
|
2911 |
$ai_total_plugin_time += microtime () - $start_time;
|
2912 |
ai_log ("LOOP END HOOK END\n");
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Ad Inserter
|
4 |
+
Version: 2.0.13
|
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.0 - 1 February 2017
|
15 |
+
- Added icons for Automatic insertion and alignment
|
16 |
+
- Automatic insertion None changed to Disabled
|
17 |
+
- Alignment None changed to Default
|
18 |
+
- Changed database option data for Automatic insertion and Alignment settings
|
19 |
+
- Improved CSS 3 code for Left, Center and Right alignment
|
20 |
+
- Click on CSS code starts editing
|
21 |
+
- Page/Post exceptions listed in debug output
|
22 |
+
- Different plugin slug for Pro version
|
23 |
+
- Few minor bug fixes and cosmetic changes
|
24 |
+
|
25 |
Ad Inserter 2.0.12 - 29 January 2017
|
26 |
- Bug fix for page/post exceptions list
|
27 |
|
529 |
$paragraph_blocks = array ();
|
530 |
for ($block = 0; $block <= AD_INSERTER_BLOCKS; $block ++) {
|
531 |
$obj = $block_object [$block];
|
532 |
+
$automatic_insertion = $obj->get_automatic_insertion();
|
533 |
+
if ($block == 0 || $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH || $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH) {
|
534 |
|
535 |
$block_tags = trim ($block_object [$block]->get_paragraph_tags ());
|
536 |
$direction = $block_object [$block]->get_direction_type() == AD_DIRECTION_FROM_TOP ? 't' : 'b';
|
896 |
|
897 |
if (function_exists ('ai_admin_enqueue_scripts_1')) ai_admin_enqueue_scripts_1 ();
|
898 |
|
899 |
+
wp_enqueue_style ('ai-image-picker', plugins_url ('css/image-picker.css', __FILE__), array (), AD_INSERTER_VERSION);
|
900 |
+
wp_add_inline_style ('ai-image-picker', '.thumbnail {border-radius: 6px;}');
|
901 |
wp_enqueue_style ('ai-admin', plugins_url ('css/ad-inserter.css', __FILE__), array (), AD_INSERTER_VERSION);
|
902 |
|
903 |
+
wp_add_inline_style ('ai-admin', '.notice {margin: 5px 0 15px;}');
|
904 |
|
905 |
if (function_exists ('ai_admin_enqueue_scripts_2')) ai_admin_enqueue_scripts_2 ();
|
906 |
|
907 |
+
wp_enqueue_script ('ai-image-picker-js', plugins_url ('includes/js/image-picker.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
908 |
+
|
909 |
if (AI_SYNTAX_HIGHLIGHTING) {
|
910 |
wp_enqueue_script ('ai-ace', plugins_url ('includes/ace/src-min-noconflict/ace.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
911 |
wp_enqueue_script ('ai-ace-ext-modelist', plugins_url ('includes/ace/src-min-noconflict/ext-modelist.js', __FILE__ ), array (), AD_INSERTER_VERSION, true);
|
1133 |
// foreach ($sidebar_widget as $widget) {
|
1134 |
// if (preg_match ("/ai_widget([\d]+)/", $widget, $widget_number)) {
|
1135 |
// if (isset ($widget_number [1]) && is_numeric ($widget_number [1])) {
|
1136 |
+
// $is_widget = $ai_db_options [$widget_number [1]][AI_OPTION_AUTOMATIC_INSERTION] == AD_SELECT_WIDGET;
|
1137 |
// } else $is_widget = false;
|
1138 |
// $sidebar_name = $GLOBALS ['wp_registered_sidebars'][$sidebar_widget_index]['name'];
|
1139 |
// if ($is_widget && $sidebar_name != "")
|
1271 |
$individual_option_enabled = $general_enabled && ($enabled_on_text == AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED || $enabled_on_text == AD_ENABLED_ONLY_ON_SELECTED);
|
1272 |
$individual_text_enabled = $enabled_on_text == AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED;
|
1273 |
|
|
|
1274 |
if ($rows % 2 != 0) $background = "#F0F0F0"; else $background = "#FFF";
|
1275 |
echo '<tr style="background: ', $background, ';">';
|
1276 |
echo ' <td style="text-align: right;">', $obj->number, '</td>';
|
1277 |
if (function_exists ('ai_settings_url_parameters')) $url_parameters = ai_settings_url_parameters ($block); else $url_parameters = "";
|
1278 |
echo ' <td style="padding: 0 10px 0 10px;"><a href="', admin_url ('options-general.php?page=ad-inserter.php'), $url_parameters, '&tab=', $block, '" target="_blank">', $obj->get_ad_name(), '</a></td>';
|
1279 |
+
echo ' <td style="padding: 0 10px 0 10px;">', $obj->get_automatic_insertion_text(), '</td>';
|
1280 |
|
1281 |
echo ' <td style="padding: 0 10px 0 10px; text-align: center;">';
|
1282 |
if ($obj->get_display_settings_post ()) echo '✓';
|
1497 |
$obj = $block_object [$block];
|
1498 |
|
1499 |
$settings = "";
|
1500 |
+
$insertion_settings = '';
|
1501 |
$alignment_settings = '';
|
1502 |
$default_settings = true;
|
1503 |
+
// $display_type = '';
|
1504 |
foreach (array_keys ($default->wp_options) as $key){
|
1505 |
switch ($key) {
|
1506 |
case AI_OPTION_CODE:
|
1523 |
if ($obj->wp_options [$key] != $default->wp_options [$key]) {
|
1524 |
$default_settings = false;
|
1525 |
switch ($key) {
|
1526 |
+
case AI_OPTION_AUTOMATIC_INSERTION:
|
1527 |
+
$insertion_settings = $obj->get_automatic_insertion_text();
|
1528 |
break;
|
1529 |
case AI_OPTION_ALIGNMENT_TYPE:
|
1530 |
+
$alignment_settings = $obj->get_alignment_type_text ();
|
1531 |
break;
|
1532 |
case AI_OPTION_PARAGRAPH_TEXT:
|
1533 |
case AI_OPTION_AVOID_TEXT_ABOVE:
|
1534 |
case AI_OPTION_AVOID_TEXT_BELOW:
|
1535 |
if ($write_processing_log)
|
1536 |
+
$settings .= "[" . $key . ": " . ai_log_filter_content (html_entity_decode ($obj->wp_options [$key])) . ']'; else
|
1537 |
+
$settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
|
1538 |
break;
|
1539 |
default:
|
1540 |
+
$settings .= "[" . $key . ": " . $obj->wp_options [$key] . ']';
|
1541 |
break;
|
1542 |
}
|
1543 |
} else
|
1544 |
switch ($key) {
|
1545 |
+
case AI_OPTION_AUTOMATIC_INSERTION:
|
1546 |
+
$insertion_settings = $obj->get_automatic_insertion_text ();
|
1547 |
break;
|
1548 |
case AI_OPTION_ALIGNMENT_TYPE:
|
1549 |
+
$alignment_settings = $obj->get_alignment_type_text ();
|
1550 |
break;
|
1551 |
}
|
1552 |
}
|
1553 |
if ($default_settings && $settings == '') continue;
|
1554 |
+
$settings = ' [' . $insertion_settings . '][' . $alignment_settings . ']' . $settings;
|
1555 |
|
1556 |
echo sprintf ("%2d %-21s ", $block, substr ($obj->get_ad_name(), 0, 21));
|
1557 |
|
1571 |
}
|
1572 |
echo "\n";
|
1573 |
|
1574 |
+
$args = array (
|
1575 |
+
'posts_per_page' => 100,
|
1576 |
+
'offset' => 0,
|
1577 |
+
'category' => '',
|
1578 |
+
'category_name' => '',
|
1579 |
+
'orderby' => 'type',
|
1580 |
+
'order' => 'ASC',
|
1581 |
+
'include' => '',
|
1582 |
+
'exclude' => '',
|
1583 |
+
'meta_key' => '_adinserter_block_exceptions',
|
1584 |
+
'meta_value' => '',
|
1585 |
+
'post_type' => array ('post', 'page'),
|
1586 |
+
'post_mime_type' => '',
|
1587 |
+
'post_parent' => '',
|
1588 |
+
'author' => '',
|
1589 |
+
'author_name' => '',
|
1590 |
+
'post_status' => '',
|
1591 |
+
'suppress_filters' => true
|
1592 |
+
);
|
1593 |
+
$posts_pages = get_posts ($args);
|
1594 |
+
|
1595 |
+
if (count ($posts_pages) != 0) {
|
1596 |
+
echo "EXCEPTIONS FOR BLOCKS ID TYPE TITLE URL\n";
|
1597 |
+
foreach ($posts_pages as $page) {
|
1598 |
+
$post_meta = get_post_meta ($page->ID, '_adinserter_block_exceptions', true);
|
1599 |
+
if ($post_meta == '') continue;
|
1600 |
+
echo sprintf ("%-24s %-6s %s %-64s %s", $post_meta, $page->ID, $page->post_type, $page->post_title, get_permalink ($page->ID)), "\n";
|
1601 |
+
}
|
1602 |
+
echo "\n";
|
1603 |
+
}
|
1604 |
+
|
1605 |
echo "TOTAL BLOCKS\n";
|
1606 |
if (count ($ai_db_options_extract [CONTENT_HOOK_BLOCKS][AI_PT_ANY]))
|
1607 |
echo "CONTENT HOOK BLOCKS: ", implode (", ", $ai_db_options_extract [CONTENT_HOOK_BLOCKS][AI_PT_ANY]), "\n";
|
1787 |
if (is_multisite()) {
|
1788 |
$ai_db_options_multisite = get_site_option (WP_OPTION_NAME);
|
1789 |
option_stripslashes ($ai_db_options_multisite);
|
|
|
1790 |
}
|
1791 |
|
1792 |
if (is_multisite() && multisite_main_for_all_blogs () && defined ('BLOG_ID_CURRENT_SITE')) {
|
2205 |
if ($obj->get_enable_404()) $page_types []= AI_PT_404;
|
2206 |
|
2207 |
if ($page_types) {
|
2208 |
+
switch ($obj->get_automatic_insertion()) {
|
2209 |
+
case AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH:
|
2210 |
+
case AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH:
|
2211 |
+
case AI_AUTOMATIC_INSERTION_BEFORE_CONTENT:
|
2212 |
+
case AI_AUTOMATIC_INSERTION_AFTER_CONTENT:
|
2213 |
foreach ($page_types as $block_page_type) $content_hook_blocks [$block_page_type][]= $block;
|
2214 |
$content_hook_blocks [AI_PT_ANY][]= $block;
|
2215 |
break;
|
2216 |
+
case AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT:
|
2217 |
+
case AI_AUTOMATIC_INSERTION_AFTER_EXCERPT:
|
2218 |
foreach ($page_types as $block_page_type) $excerpt_hook_blocks [$block_page_type][]= $block;
|
2219 |
$excerpt_hook_blocks [AI_PT_ANY][]= $block;
|
2220 |
break;
|
2221 |
+
case AI_AUTOMATIC_INSERTION_BEFORE_POST:
|
2222 |
foreach ($page_types as $block_page_type) $loop_start_hook_blocks [$block_page_type][]= $block;
|
2223 |
$loop_start_hook_blocks [AI_PT_ANY][]= $block;
|
2224 |
break;
|
2225 |
+
case AI_AUTOMATIC_INSERTION_AFTER_POST:
|
2226 |
foreach ($page_types as $block_page_type) $loop_end_hook_blocks [$block_page_type][]= $block;
|
2227 |
$loop_end_hook_blocks [AI_PT_ANY][]= $block;
|
2228 |
break;
|
2229 |
+
case AI_AUTOMATIC_INSERTION_BETWEEN_POSTS:
|
2230 |
foreach ($page_types as $block_page_type) $post_hook_blocks [$block_page_type][]= $block;
|
2231 |
$post_hook_blocks [AI_PT_ANY][]= $block;
|
2232 |
break;
|
2498 |
delete_site_option (WP_OPTION_NAME, $options);
|
2499 |
}
|
2500 |
|
2501 |
+
$args = array (
|
2502 |
+
'posts_per_page' => 100,
|
2503 |
+
'offset' => 0,
|
2504 |
+
'category' => '',
|
2505 |
+
'category_name' => '',
|
2506 |
+
'orderby' => 'type',
|
2507 |
+
'order' => 'ASC',
|
2508 |
+
'include' => '',
|
2509 |
+
'exclude' => '',
|
2510 |
+
'meta_key' => '_adinserter_block_exceptions',
|
2511 |
+
'meta_value' => '',
|
2512 |
+
'post_type' => array ('post', 'page'),
|
2513 |
+
'post_mime_type' => '',
|
2514 |
+
'post_parent' => '',
|
2515 |
+
'author' => '',
|
2516 |
+
'author_name' => '',
|
2517 |
+
'post_status' => '',
|
2518 |
+
'suppress_filters' => true
|
2519 |
+
);
|
2520 |
+
$posts_pages = get_posts ($args);
|
2521 |
+
|
2522 |
+
foreach ($posts_pages as $page) {
|
2523 |
delete_post_meta ($page->ID, '_adinserter_block_exceptions');
|
2524 |
}
|
2525 |
|
2529 |
|
2530 |
echo "<div class='notice notice-warning is-dismissible' style='margin: 5px 15px 2px 0px;'><p><strong>Settings cleared.</p></div>";
|
2531 |
} elseif (isset ($_POST [AI_FORM_CLEAR_EXCEPTIONS])) {
|
2532 |
+
|
2533 |
+
$args = array (
|
2534 |
+
'posts_per_page' => 100,
|
2535 |
+
'offset' => 0,
|
2536 |
+
'category' => '',
|
2537 |
+
'category_name' => '',
|
2538 |
+
'orderby' => 'type',
|
2539 |
+
'order' => 'ASC',
|
2540 |
+
'include' => '',
|
2541 |
+
'exclude' => '',
|
2542 |
+
'meta_key' => '_adinserter_block_exceptions',
|
2543 |
+
'meta_value' => '',
|
2544 |
+
'post_type' => array ('post', 'page'),
|
2545 |
+
'post_mime_type' => '',
|
2546 |
+
'post_parent' => '',
|
2547 |
+
'author' => '',
|
2548 |
+
'author_name' => '',
|
2549 |
+
'post_status' => '',
|
2550 |
+
'suppress_filters' => true
|
2551 |
+
);
|
2552 |
+
$posts_pages = get_posts ($args);
|
2553 |
+
|
2554 |
if ($_POST [AI_FORM_CLEAR_EXCEPTIONS] == "\xe2\x9d\x8c") {
|
2555 |
+
foreach ($posts_pages as $page) {
|
2556 |
delete_post_meta ($page->ID, '_adinserter_block_exceptions');
|
2557 |
}
|
2558 |
}
|
2563 |
}
|
2564 |
}
|
2565 |
elseif (is_numeric ($_POST [AI_FORM_CLEAR_EXCEPTIONS])) {
|
2566 |
+
foreach ($posts_pages as $page) {
|
2567 |
$post_meta = get_post_meta ($page->ID, '_adinserter_block_exceptions', true);
|
2568 |
$selected_blocks = explode (",", $post_meta);
|
2569 |
if (($key = array_search ($_POST [AI_FORM_CLEAR_EXCEPTIONS], $selected_blocks)) !== false) {
|
2722 |
// Last check before insertion
|
2723 |
if (!$obj->check_block_counter ()) continue;
|
2724 |
|
2725 |
+
$automatic_insertion = $obj->get_automatic_insertion();
|
2726 |
|
2727 |
+
if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH) {
|
2728 |
$ai_last_check = AI_CHECK_PARAGRAPH_COUNTING;
|
2729 |
$content = $obj->before_paragraph ($content);
|
2730 |
}
|
2731 |
+
elseif ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH) {
|
2732 |
$ai_last_check = AI_CHECK_PARAGRAPH_COUNTING;
|
2733 |
$content = $obj->after_paragraph ($content);
|
2734 |
}
|
2735 |
+
elseif ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT) {
|
2736 |
$obj->increment_block_counter ();
|
2737 |
|
2738 |
$ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
|
2741 |
$ai_last_check = AI_CHECK_INSERTED;
|
2742 |
}
|
2743 |
}
|
2744 |
+
elseif ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT) {
|
2745 |
$obj->increment_block_counter ();
|
2746 |
|
2747 |
$ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
|
2854 |
$ai_last_check = AI_CHECK_DEBUG_NO_INSERTION;
|
2855 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_NO_INSERTION) == 0) {
|
2856 |
|
2857 |
+
$automatic_insertion = $obj->get_automatic_insertion ();
|
2858 |
+
if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT)
|
2859 |
$content = $obj->get_code_for_insertion () . $content; else
|
2860 |
$content = $content . $obj->get_code_for_insertion ();
|
2861 |
|
2898 |
|
2899 |
// Process Before / After Post postion
|
2900 |
|
2901 |
+
function ai_before_after_post ($query, $automatic_insertion) {
|
2902 |
global $block_object, $ad_inserter_globals, $ai_db_options_extract, $ai_wp_data, $ai_last_check;
|
2903 |
|
2904 |
$debug_processing = ($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0;
|
2908 |
if (!method_exists ($query, 'is_main_query')) return;
|
2909 |
if (!$query->is_main_query()) return;
|
2910 |
|
2911 |
+
$globals_name = $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? AI_LOOP_BEFORE_COUNTER_NAME : AI_LOOP_AFTER_COUNTER_NAME;
|
2912 |
|
2913 |
if (!isset ($ad_inserter_globals [$globals_name])) {
|
2914 |
$ad_inserter_globals [$globals_name] = 1;
|
2915 |
} else $ad_inserter_globals [$globals_name] ++;
|
2916 |
|
2917 |
+
$ai_wp_data [AI_CONTEXT] = $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? AI_CONTEXT_BEFORE_POST : AI_CONTEXT_AFTER_POST;
|
2918 |
|
2919 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_POSITIONS) != 0) {
|
2920 |
|
2923 |
$counter = $ad_inserter_globals [$globals_name];
|
2924 |
if ($counter == 1) $counter = '';
|
2925 |
|
2926 |
+
echo "<section style='$style'>".($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? "BEFORE" : "AFTER")." POST ".$counter."</section>";
|
2927 |
}
|
2928 |
|
2929 |
if ($ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_POST || $ai_wp_data [AI_WP_PAGE_TYPE] == AI_PT_STATIC) {
|
2936 |
$ai_last_check = AI_CHECK_NONE;
|
2937 |
$current_block = 0;
|
2938 |
|
2939 |
+
foreach ($ai_db_options_extract [$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST ? LOOP_START_HOOK_BLOCKS : LOOP_END_HOOK_BLOCKS][$ai_wp_data [AI_WP_PAGE_TYPE]] as $block) {
|
2940 |
if ($debug_processing && $ai_last_check != AI_CHECK_NONE) ai_log (ai_log_block_status ($current_block, $ai_last_check));
|
2941 |
|
2942 |
if (!isset ($block_object [$block])) continue;
|
2973 |
ai_log ("LOOP START HOOK START");
|
2974 |
$start_time = microtime ();
|
2975 |
}
|
2976 |
+
ai_before_after_post ($query, AI_AUTOMATIC_INSERTION_BEFORE_POST);
|
2977 |
if ($debug_processing) {
|
2978 |
$ai_total_plugin_time += microtime () - $start_time;
|
2979 |
ai_log ("LOOP START HOOK END\n");
|
2989 |
ai_log ("LOOP END HOOK START");
|
2990 |
$start_time = microtime ();
|
2991 |
}
|
2992 |
+
ai_before_after_post ($query, AI_AUTOMATIC_INSERTION_AFTER_POST);
|
2993 |
if ($debug_processing) {
|
2994 |
$ai_total_plugin_time += microtime () - $start_time;
|
2995 |
ai_log ("LOOP END HOOK END\n");
|
class.php
CHANGED
@@ -91,7 +91,7 @@ abstract class ai_BaseCodeBlock {
|
|
91 |
}
|
92 |
$old_name = "ad" . $block . "_displayType";
|
93 |
if (isset ($options [$old_name])) {
|
94 |
-
$options [
|
95 |
unset ($options [$old_name]);
|
96 |
}
|
97 |
$old_name = "ad" . $block . "_paragraphNumber";
|
@@ -350,7 +350,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
350 |
parent::__construct();
|
351 |
|
352 |
$this->wp_options [AI_OPTION_NAME] = AD_NAME;
|
353 |
-
$this->wp_options [
|
354 |
$this->wp_options [AI_OPTION_PARAGRAPH_NUMBER] = AD_ONE;
|
355 |
$this->wp_options [AI_OPTION_MIN_PARAGRAPHS] = AD_EMPTY_DATA;
|
356 |
$this->wp_options [AI_OPTION_MIN_WORDS] = AD_EMPTY_DATA;
|
@@ -369,7 +369,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
369 |
$this->wp_options [AI_OPTION_EXCERPT_NUMBER] = AD_EMPTY_DATA;
|
370 |
$this->wp_options [AI_OPTION_FILTER_TYPE] = AI_OPTION_FILTER_AUTO;
|
371 |
$this->wp_options [AI_OPTION_DIRECTION_TYPE] = AD_DIRECTION_FROM_TOP;
|
372 |
-
$this->wp_options [AI_OPTION_ALIGNMENT_TYPE] =
|
373 |
$this->wp_options [AI_OPTION_GENERAL_TAG] = AD_GENERAL_TAG;
|
374 |
$this->wp_options [AI_OPTION_SCHEDULING] = AI_SCHEDULING_OFF;
|
375 |
$this->wp_options [AI_OPTION_AFTER_DAYS] = AD_EMPTY_DATA;
|
@@ -414,15 +414,156 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
414 |
}
|
415 |
}
|
416 |
|
417 |
-
public function
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
return $option;
|
424 |
}
|
425 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
426 |
public function get_paragraph_number(){
|
427 |
$option = isset ($this->wp_options [AI_OPTION_PARAGRAPH_NUMBER]) ? $this->wp_options [AI_OPTION_PARAGRAPH_NUMBER] : "";
|
428 |
if ($option == '') $option = AD_ZERO;
|
@@ -520,57 +661,6 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
520 |
return $option;
|
521 |
}
|
522 |
|
523 |
-
public function get_alignment_type(){
|
524 |
-
// Update old field names
|
525 |
-
$option = isset ($this->wp_options [AI_OPTION_ALIGNMENT_TYPE]) ? $this->wp_options [AI_OPTION_ALIGNMENT_TYPE] : "";
|
526 |
-
if ($option == 'Left'){
|
527 |
-
$option = AD_ALIGNMENT_FLOAT_LEFT;
|
528 |
-
$this->wp_options [AI_OPTION_ALIGNMENT_TYPE] = $option;
|
529 |
-
}
|
530 |
-
elseif ($option == 'Right'){
|
531 |
-
$option = AD_ALIGNMENT_FLOAT_RIGHT;
|
532 |
-
$this->wp_options [AI_OPTION_ALIGNMENT_TYPE] = $option;
|
533 |
-
}
|
534 |
-
elseif ($option == '') $option = AD_ALIGNMENT_NONE;
|
535 |
-
return $option;
|
536 |
-
}
|
537 |
-
|
538 |
-
public function alignmet_style ($alignment_type, $margin = DEFAULT_MARGIN){
|
539 |
-
if ($margin < 0) $margin = 0;
|
540 |
-
|
541 |
-
|
542 |
-
if ($alignment_type == AD_ALIGNMENT_NONE) {
|
543 |
-
$style = "margin: ".$margin."px 0px;";
|
544 |
-
}
|
545 |
-
elseif ($alignment_type == AD_ALIGNMENT_LEFT) {
|
546 |
-
$style = "text-align: left; margin: ".$margin."px 0px;";
|
547 |
-
}
|
548 |
-
elseif ($alignment_type == AD_ALIGNMENT_RIGHT) {
|
549 |
-
$style = "text-align: right; margin: ".$margin."px 0px;";
|
550 |
-
}
|
551 |
-
elseif ($alignment_type == AD_ALIGNMENT_CENTER) {
|
552 |
-
$style = "text-align: center; margin: ".$margin."px auto;";
|
553 |
-
}
|
554 |
-
elseif ($alignment_type == AD_ALIGNMENT_FLOAT_LEFT) {
|
555 |
-
$style = "float: left; margin: ".$margin."px ".$margin."px ".$margin."px 0px;";
|
556 |
-
}
|
557 |
-
elseif ($alignment_type == AD_ALIGNMENT_FLOAT_RIGHT) {
|
558 |
-
$style = "float: right; margin: ".$margin."px 0px ".$margin."px ".$margin."px;";
|
559 |
-
}
|
560 |
-
elseif ($alignment_type == AD_ALIGNMENT_CUSTOM_CSS) {
|
561 |
-
$style = $this->get_custom_css ();
|
562 |
-
}
|
563 |
-
else {
|
564 |
-
$style = "";
|
565 |
-
}
|
566 |
-
|
567 |
-
return $style;
|
568 |
-
}
|
569 |
-
|
570 |
-
public function get_alignmet_style ($margin = DEFAULT_MARGIN){
|
571 |
-
return $this->alignmet_style ($this->get_alignment_type(), $margin);
|
572 |
-
}
|
573 |
-
|
574 |
public function get_display_settings_post(){
|
575 |
$option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_POSTS]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_POSTS] : "";
|
576 |
if ($option == '') $option = AD_SETTINGS_CHECKED;
|
@@ -590,14 +680,14 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
590 |
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
591 |
|
592 |
if ($ai_db_options ['global']['VERSION'] < '010605') {
|
593 |
-
if (isset ($this->wp_options [
|
594 |
-
$
|
595 |
-
} else $
|
596 |
-
|
597 |
-
if ($
|
598 |
-
$
|
599 |
-
$
|
600 |
-
$
|
601 |
$option = AD_SETTINGS_NOT_CHECKED;
|
602 |
}
|
603 |
|
@@ -611,14 +701,14 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
611 |
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
612 |
|
613 |
if ($ai_db_options ['global']['VERSION'] < '010605') {
|
614 |
-
if (isset ($this->wp_options [
|
615 |
-
$
|
616 |
-
} else $
|
617 |
-
|
618 |
-
if ($
|
619 |
-
$
|
620 |
-
$
|
621 |
-
$
|
622 |
$option = AD_SETTINGS_NOT_CHECKED;
|
623 |
}
|
624 |
|
@@ -632,14 +722,14 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
632 |
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
633 |
|
634 |
if ($ai_db_options ['global']['VERSION'] < '010605') {
|
635 |
-
if (isset ($this->wp_options [
|
636 |
-
$
|
637 |
-
} else $
|
638 |
-
|
639 |
-
if ($
|
640 |
-
$
|
641 |
-
$
|
642 |
-
$
|
643 |
$option = AD_SETTINGS_NOT_CHECKED;
|
644 |
}
|
645 |
|
@@ -653,14 +743,14 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
653 |
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
654 |
|
655 |
if ($ai_db_options ['global']['VERSION'] < '010605') {
|
656 |
-
if (isset ($this->wp_options [
|
657 |
-
$
|
658 |
-
} else $
|
659 |
-
|
660 |
-
if ($
|
661 |
-
$
|
662 |
-
$
|
663 |
-
$
|
664 |
$option = AD_SETTINGS_NOT_CHECKED;
|
665 |
}
|
666 |
|
@@ -676,9 +766,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
676 |
public function get_enable_manual (){
|
677 |
$option = isset ($this->wp_options [AI_OPTION_ENABLE_MANUAL]) ? $this->wp_options [AI_OPTION_ENABLE_MANUAL] : "";
|
678 |
if ($option == '') {
|
679 |
-
$display_option = $this->
|
680 |
-
if ($display_option == AD_SELECT_MANUAL)
|
681 |
-
$option = AD_SETTINGS_CHECKED; else
|
682 |
$option = AD_SETTINGS_NOT_CHECKED;
|
683 |
}
|
684 |
return $option;
|
@@ -1125,7 +1215,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1125 |
public function get_code_for_insertion ($viewport_classes = true, $hidden_widgets = false) {
|
1126 |
global $ai_wp_data;
|
1127 |
|
1128 |
-
if ($this->get_alignment_type() ==
|
1129 |
|
1130 |
$block_class_name = get_block_class_name ();
|
1131 |
|
@@ -1717,7 +1807,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
1717 |
$ad_tag = strtolower (trim ($tag));
|
1718 |
$ad_name = strtolower (trim ($this->get_ad_name()));
|
1719 |
if ($ad_tag == $ad_name || $ad_tag == $this->number) {
|
1720 |
-
if ($this->get_alignment_type() ==
|
1721 |
$ad_code = "<div class='" . $block_class_name . " " . $block_class_name . "-" . $this->number . $this->get_viewport_classes () . "' style='" . $this->get_alignmet_style() . "'>" . $this->ai_getProcessedCode () . "</div>";
|
1722 |
$content = preg_replace ("/{adinserter " . $tag . "}/", $ad_code, $content);
|
1723 |
}
|
91 |
}
|
92 |
$old_name = "ad" . $block . "_displayType";
|
93 |
if (isset ($options [$old_name])) {
|
94 |
+
$options [AI_OPTION_AUTOMATIC_INSERTION] = $options [$old_name];
|
95 |
unset ($options [$old_name]);
|
96 |
}
|
97 |
$old_name = "ad" . $block . "_paragraphNumber";
|
350 |
parent::__construct();
|
351 |
|
352 |
$this->wp_options [AI_OPTION_NAME] = AD_NAME;
|
353 |
+
$this->wp_options [AI_OPTION_AUTOMATIC_INSERTION] = AI_AUTOMATIC_INSERTION_DISABLED;
|
354 |
$this->wp_options [AI_OPTION_PARAGRAPH_NUMBER] = AD_ONE;
|
355 |
$this->wp_options [AI_OPTION_MIN_PARAGRAPHS] = AD_EMPTY_DATA;
|
356 |
$this->wp_options [AI_OPTION_MIN_WORDS] = AD_EMPTY_DATA;
|
369 |
$this->wp_options [AI_OPTION_EXCERPT_NUMBER] = AD_EMPTY_DATA;
|
370 |
$this->wp_options [AI_OPTION_FILTER_TYPE] = AI_OPTION_FILTER_AUTO;
|
371 |
$this->wp_options [AI_OPTION_DIRECTION_TYPE] = AD_DIRECTION_FROM_TOP;
|
372 |
+
$this->wp_options [AI_OPTION_ALIGNMENT_TYPE] = AI_ALIGNMENT_DEFAULT;
|
373 |
$this->wp_options [AI_OPTION_GENERAL_TAG] = AD_GENERAL_TAG;
|
374 |
$this->wp_options [AI_OPTION_SCHEDULING] = AI_SCHEDULING_OFF;
|
375 |
$this->wp_options [AI_OPTION_AFTER_DAYS] = AD_EMPTY_DATA;
|
414 |
}
|
415 |
}
|
416 |
|
417 |
+
public function get_automatic_insertion (){
|
418 |
+
global $ai_db_options;
|
419 |
+
|
420 |
+
$option = isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION]) ? $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION] : AI_AUTOMATIC_INSERTION_DISABLED;
|
421 |
+
|
422 |
+
if ($option == '') $option = AI_AUTOMATIC_INSERTION_DISABLED;
|
423 |
+
elseif ($option == AD_SELECT_MANUAL) $option = AI_AUTOMATIC_INSERTION_DISABLED;
|
424 |
+
elseif ($option == AD_SELECT_BEFORE_TITLE) $option = AI_AUTOMATIC_INSERTION_BEFORE_POST;
|
425 |
+
elseif ($option == AD_SELECT_WIDGET) $option = AI_AUTOMATIC_INSERTION_DISABLED;
|
426 |
+
|
427 |
+
if ($option == AD_SELECT_NONE) $option = AI_AUTOMATIC_INSERTION_DISABLED;
|
428 |
+
elseif ($option == AD_SELECT_BEFORE_POST) $option = AI_AUTOMATIC_INSERTION_BEFORE_POST;
|
429 |
+
elseif ($option == AD_SELECT_AFTER_POST) $option = AI_AUTOMATIC_INSERTION_AFTER_POST;
|
430 |
+
elseif ($option == AD_SELECT_BEFORE_PARAGRAPH) $option = AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH;
|
431 |
+
elseif ($option == AD_SELECT_AFTER_PARAGRAPH) $option = AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH;
|
432 |
+
elseif ($option == AD_SELECT_BEFORE_CONTENT) $option = AI_AUTOMATIC_INSERTION_BEFORE_CONTENT;
|
433 |
+
elseif ($option == AD_SELECT_AFTER_CONTENT) $option = AI_AUTOMATIC_INSERTION_AFTER_CONTENT;
|
434 |
+
elseif ($option == AD_SELECT_BEFORE_EXCERPT) $option = AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT;
|
435 |
+
elseif ($option == AD_SELECT_AFTER_EXCERPT) $option = AI_AUTOMATIC_INSERTION_AFTER_EXCERPT;
|
436 |
+
elseif ($option == AD_SELECT_BETWEEN_POSTS) $option = AI_AUTOMATIC_INSERTION_BETWEEN_POSTS;
|
437 |
+
|
438 |
+
return $option;
|
439 |
+
}
|
440 |
+
|
441 |
+
public function get_automatic_insertion_text (){
|
442 |
+
switch ($this->get_automatic_insertion()) {
|
443 |
+
case AI_AUTOMATIC_INSERTION_DISABLED:
|
444 |
+
return AI_TEXT_DISABLED;
|
445 |
+
break;
|
446 |
+
case AI_AUTOMATIC_INSERTION_BEFORE_POST:
|
447 |
+
return AI_TEXT_BEFORE_POST;
|
448 |
+
break;
|
449 |
+
case AI_AUTOMATIC_INSERTION_AFTER_POST:
|
450 |
+
return AI_TEXT_AFTER_POST;
|
451 |
+
break;
|
452 |
+
case AI_AUTOMATIC_INSERTION_BEFORE_CONTENT:
|
453 |
+
return AI_TEXT_BEFORE_CONTENT;
|
454 |
+
break;
|
455 |
+
case AI_AUTOMATIC_INSERTION_AFTER_CONTENT:
|
456 |
+
return AI_TEXT_AFTER_CONTENT;
|
457 |
+
break;
|
458 |
+
case AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH:
|
459 |
+
return AI_TEXT_BEFORE_PARAGRAPH;
|
460 |
+
break;
|
461 |
+
case AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH:
|
462 |
+
return AI_TEXT_AFTER_PARAGRAPH;
|
463 |
+
break;
|
464 |
+
case AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT:
|
465 |
+
return AI_TEXT_BEFORE_EXCERPT;
|
466 |
+
break;
|
467 |
+
case AI_AUTOMATIC_INSERTION_AFTER_EXCERPT:
|
468 |
+
return AI_TEXT_AFTER_EXCERPT;
|
469 |
+
break;
|
470 |
+
case AI_AUTOMATIC_INSERTION_BETWEEN_POSTS:
|
471 |
+
return AI_TEXT_BETWEEN_POSTS;
|
472 |
+
break;
|
473 |
+
default:
|
474 |
+
return '';
|
475 |
+
break;
|
476 |
+
}
|
477 |
+
}
|
478 |
+
|
479 |
+
public function get_alignment_type (){
|
480 |
+
// Update old field names
|
481 |
+
$option = isset ($this->wp_options [AI_OPTION_ALIGNMENT_TYPE]) ? $this->wp_options [AI_OPTION_ALIGNMENT_TYPE] : AI_ALIGNMENT_DEFAULT;
|
482 |
+
|
483 |
+
if ($option == '') $option = AI_ALIGNMENT_DEFAULT;
|
484 |
+
|
485 |
+
if ($option == AD_ALIGNMENT_NONE) $option = AI_ALIGNMENT_DEFAULT;
|
486 |
+
elseif ($option == AD_ALIGNMENT_LEFT) $option = AI_ALIGNMENT_LEFT;
|
487 |
+
elseif ($option == AD_ALIGNMENT_RIGHT) $option = AI_ALIGNMENT_RIGHT;
|
488 |
+
elseif ($option == AD_ALIGNMENT_CENTER) $option = AI_ALIGNMENT_CENTER;
|
489 |
+
elseif ($option == AD_ALIGNMENT_FLOAT_LEFT) $option = AI_ALIGNMENT_FLOAT_LEFT;
|
490 |
+
elseif ($option == AD_ALIGNMENT_FLOAT_RIGHT) $option = AI_ALIGNMENT_FLOAT_RIGHT;
|
491 |
+
elseif ($option == AD_ALIGNMENT_NO_WRAPPING) $option = AI_ALIGNMENT_NO_WRAPPING;
|
492 |
+
elseif ($option == AD_ALIGNMENT_CUSTOM_CSS) $option = AI_ALIGNMENT_CUSTOM_CSS;
|
493 |
+
|
494 |
return $option;
|
495 |
}
|
496 |
|
497 |
+
public function get_alignment_type_text (){
|
498 |
+
switch ($this->get_alignment_type ()) {
|
499 |
+
case AI_ALIGNMENT_DEFAULT:
|
500 |
+
return AI_TEXT_DEFAULT;
|
501 |
+
break;
|
502 |
+
case AI_ALIGNMENT_LEFT:
|
503 |
+
return AI_TEXT_LEFT;
|
504 |
+
break;
|
505 |
+
case AI_ALIGNMENT_RIGHT:
|
506 |
+
return AI_TEXT_RIGHT;
|
507 |
+
break;
|
508 |
+
case AI_ALIGNMENT_CENTER:
|
509 |
+
return AI_TEXT_CENTER;
|
510 |
+
break;
|
511 |
+
case AI_ALIGNMENT_FLOAT_LEFT:
|
512 |
+
return AI_TEXT_FLOAT_LEFT;
|
513 |
+
break;
|
514 |
+
case AI_ALIGNMENT_FLOAT_RIGHT:
|
515 |
+
return AI_TEXT_FLOAT_RIGHT;
|
516 |
+
break;
|
517 |
+
case AI_ALIGNMENT_NO_WRAPPING:
|
518 |
+
return AI_TEXT_NO_WRAPPING;
|
519 |
+
break;
|
520 |
+
case AI_ALIGNMENT_CUSTOM_CSS:
|
521 |
+
return AI_TEXT_CUSTOM_CSS;
|
522 |
+
break;
|
523 |
+
default:
|
524 |
+
return '';
|
525 |
+
break;
|
526 |
+
}
|
527 |
+
}
|
528 |
+
|
529 |
+
public function alignmet_style ($alignment_type, $margin = DEFAULT_MARGIN) {
|
530 |
+
if ($margin < 0) $margin = 0;
|
531 |
+
|
532 |
+
if ($alignment_type == AI_ALIGNMENT_DEFAULT) {
|
533 |
+
$style = "margin: ".$margin."px 0px;";
|
534 |
+
}
|
535 |
+
elseif ($alignment_type == AI_ALIGNMENT_LEFT) {
|
536 |
+
// $style = "text-align: left; display: table; margin: ".$margin."px auto ".$margin."px 0;";
|
537 |
+
$style = "text-align: left; display: flex; justify-content: flex-start; margin: ".$margin."px 0;";
|
538 |
+
}
|
539 |
+
elseif ($alignment_type == AI_ALIGNMENT_RIGHT) {
|
540 |
+
// $style = "text-align: right; display: table; margin: ".$margin."px 0 ".$margin."px auto;";
|
541 |
+
$style = "text-align: right; display: flex; justify-content: flex-end; margin: ".$margin."px 0;";
|
542 |
+
}
|
543 |
+
elseif ($alignment_type == AI_ALIGNMENT_CENTER) {
|
544 |
+
// $style = "text-align: center; display: table; margin: ".$margin."px auto;";
|
545 |
+
$style = "text-align: center; display: flex; justify-content: center; margin: ".$margin."px 0;";
|
546 |
+
}
|
547 |
+
elseif ($alignment_type == AI_ALIGNMENT_FLOAT_LEFT) {
|
548 |
+
$style = "float: left; margin: ".$margin."px ".$margin."px ".$margin."px 0;";
|
549 |
+
}
|
550 |
+
elseif ($alignment_type == AI_ALIGNMENT_FLOAT_RIGHT) {
|
551 |
+
$style = "float: right; margin: ".$margin."px 0px ".$margin."px ".$margin."px;";
|
552 |
+
}
|
553 |
+
elseif ($alignment_type == AI_ALIGNMENT_CUSTOM_CSS) {
|
554 |
+
$style = $this->get_custom_css ();
|
555 |
+
}
|
556 |
+
else {
|
557 |
+
$style = "";
|
558 |
+
}
|
559 |
+
|
560 |
+
return $style;
|
561 |
+
}
|
562 |
+
|
563 |
+
public function get_alignmet_style ($margin = DEFAULT_MARGIN){
|
564 |
+
return $this->alignmet_style ($this->get_alignment_type(), $margin);
|
565 |
+
}
|
566 |
+
|
567 |
public function get_paragraph_number(){
|
568 |
$option = isset ($this->wp_options [AI_OPTION_PARAGRAPH_NUMBER]) ? $this->wp_options [AI_OPTION_PARAGRAPH_NUMBER] : "";
|
569 |
if ($option == '') $option = AD_ZERO;
|
661 |
return $option;
|
662 |
}
|
663 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
664 |
public function get_display_settings_post(){
|
665 |
$option = isset ($this->wp_options [AI_OPTION_DISPLAY_ON_POSTS]) ? $this->wp_options [AI_OPTION_DISPLAY_ON_POSTS] : "";
|
666 |
if ($option == '') $option = AD_SETTINGS_CHECKED;
|
680 |
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
681 |
|
682 |
if ($ai_db_options ['global']['VERSION'] < '010605') {
|
683 |
+
if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
|
684 |
+
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
685 |
+
} else $automatic_insertion = '';
|
686 |
+
|
687 |
+
if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH ||
|
688 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH ||
|
689 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT ||
|
690 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT)
|
691 |
$option = AD_SETTINGS_NOT_CHECKED;
|
692 |
}
|
693 |
|
701 |
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
702 |
|
703 |
if ($ai_db_options ['global']['VERSION'] < '010605') {
|
704 |
+
if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
|
705 |
+
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
706 |
+
} else $automatic_insertion = '';
|
707 |
+
|
708 |
+
if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH ||
|
709 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH ||
|
710 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT ||
|
711 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT)
|
712 |
$option = AD_SETTINGS_NOT_CHECKED;
|
713 |
}
|
714 |
|
722 |
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
723 |
|
724 |
if ($ai_db_options ['global']['VERSION'] < '010605') {
|
725 |
+
if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
|
726 |
+
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
727 |
+
} else $automatic_insertion = '';
|
728 |
+
|
729 |
+
if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH ||
|
730 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH ||
|
731 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT ||
|
732 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT)
|
733 |
$option = AD_SETTINGS_NOT_CHECKED;
|
734 |
}
|
735 |
|
743 |
if ($option == '') $option = AD_SETTINGS_NOT_CHECKED;
|
744 |
|
745 |
if ($ai_db_options ['global']['VERSION'] < '010605') {
|
746 |
+
if (isset ($this->wp_options [AI_OPTION_AUTOMATIC_INSERTION])) {
|
747 |
+
$automatic_insertion = $this->wp_options [AI_OPTION_AUTOMATIC_INSERTION];
|
748 |
+
} else $automatic_insertion = '';
|
749 |
+
|
750 |
+
if ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH ||
|
751 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH ||
|
752 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT ||
|
753 |
+
$automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT)
|
754 |
$option = AD_SETTINGS_NOT_CHECKED;
|
755 |
}
|
756 |
|
766 |
public function get_enable_manual (){
|
767 |
$option = isset ($this->wp_options [AI_OPTION_ENABLE_MANUAL]) ? $this->wp_options [AI_OPTION_ENABLE_MANUAL] : "";
|
768 |
if ($option == '') {
|
769 |
+
// $display_option = $this->get_automatic_insertion ();
|
770 |
+
// if ($display_option == AD_SELECT_MANUAL)
|
771 |
+
// $option = AD_SETTINGS_CHECKED; else
|
772 |
$option = AD_SETTINGS_NOT_CHECKED;
|
773 |
}
|
774 |
return $option;
|
1215 |
public function get_code_for_insertion ($viewport_classes = true, $hidden_widgets = false) {
|
1216 |
global $ai_wp_data;
|
1217 |
|
1218 |
+
if ($this->get_alignment_type() == AI_ALIGNMENT_NO_WRAPPING) return $this->ai_getProcessedCode ();
|
1219 |
|
1220 |
$block_class_name = get_block_class_name ();
|
1221 |
|
1807 |
$ad_tag = strtolower (trim ($tag));
|
1808 |
$ad_name = strtolower (trim ($this->get_ad_name()));
|
1809 |
if ($ad_tag == $ad_name || $ad_tag == $this->number) {
|
1810 |
+
if ($this->get_alignment_type() == AI_ALIGNMENT_NO_WRAPPING) $ad_code = $this->ai_getProcessedCode (); else
|
1811 |
$ad_code = "<div class='" . $block_class_name . " " . $block_class_name . "-" . $this->number . $this->get_viewport_classes () . "' style='" . $this->get_alignmet_style() . "'>" . $this->ai_getProcessedCode () . "</div>";
|
1812 |
$content = preg_replace ("/{adinserter " . $tag . "}/", $ad_code, $content);
|
1813 |
}
|
constants.php
CHANGED
@@ -11,7 +11,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.0.
|
15 |
|
16 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
17 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
@@ -51,7 +51,7 @@ define ('AI_OPTION_PROCESS_PHP', 'process_php');
|
|
51 |
define ('AI_OPTION_ENABLE_FEED', 'enable_feed');
|
52 |
define ('AI_OPTION_ENABLE_404', 'enable_404');
|
53 |
define ('AI_OPTION_NAME', 'name');
|
54 |
-
define ('
|
55 |
define ('AI_OPTION_PARAGRAPH_NUMBER', 'paragraph_number');
|
56 |
define ('AI_OPTION_MIN_PARAGRAPHS', 'min_paragraphs');
|
57 |
define ('AI_OPTION_COUNT_INSIDE_BLOCKQUOTE', 'count_inside_blockquote');
|
@@ -131,7 +131,7 @@ define('AD_ROTATE_SEPARATOR', '|rotate|');
|
|
131 |
//form select options
|
132 |
define('AD_SELECT_SELECTED','selected');
|
133 |
|
134 |
-
//
|
135 |
define('AD_SELECT_NONE','None');
|
136 |
define('AD_SELECT_BEFORE_POST','Before Post');
|
137 |
define('AD_SELECT_AFTER_POST','After Post');
|
@@ -142,11 +142,32 @@ define('AD_SELECT_AFTER_CONTENT','After Content');
|
|
142 |
define('AD_SELECT_BEFORE_EXCERPT','Before Excerpt');
|
143 |
define('AD_SELECT_AFTER_EXCERPT','After Excerpt');
|
144 |
define('AD_SELECT_BETWEEN_POSTS','Between Posts');
|
145 |
-
|
146 |
define('AD_SELECT_WIDGET','Widget'); // Deprecated
|
147 |
define('AD_SELECT_BEFORE_TITLE','Before Title'); // Deprecated
|
148 |
define('AD_SELECT_MANUAL','Manual'); // Deprecated
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
//Display options
|
151 |
define('AD_DISPLAY_ALL_USERS','all users');
|
152 |
define('AD_DISPLAY_LOGGED_IN_USERS','logged in users');
|
@@ -170,7 +191,7 @@ define('AD_ENABLED_ON_ALL', 'On all');
|
|
170 |
define('AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED', 'On all except selected');
|
171 |
define('AD_ENABLED_ONLY_ON_SELECTED', 'Only on selected');
|
172 |
|
173 |
-
//Alignment options
|
174 |
define('AD_ALIGNMENT_NO_WRAPPING','No Wrapping');
|
175 |
define('AD_ALIGNMENT_CUSTOM_CSS','Custom CSS');
|
176 |
define('AD_ALIGNMENT_NONE','None');
|
@@ -180,6 +201,24 @@ define('AD_ALIGNMENT_CENTER','Center');
|
|
180 |
define('AD_ALIGNMENT_FLOAT_LEFT','Float Left');
|
181 |
define('AD_ALIGNMENT_FLOAT_RIGHT','Float Right');
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
//List Type
|
184 |
define('AD_BLACK_LIST','Black List');
|
185 |
define('AD_WHITE_LIST','White List');
|
11 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
12 |
|
13 |
if (!defined( 'AD_INSERTER_VERSION'))
|
14 |
+
define ('AD_INSERTER_VERSION', '2.0.13');
|
15 |
|
16 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
17 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
51 |
define ('AI_OPTION_ENABLE_FEED', 'enable_feed');
|
52 |
define ('AI_OPTION_ENABLE_404', 'enable_404');
|
53 |
define ('AI_OPTION_NAME', 'name');
|
54 |
+
define ('AI_OPTION_AUTOMATIC_INSERTION', 'display_type');
|
55 |
define ('AI_OPTION_PARAGRAPH_NUMBER', 'paragraph_number');
|
56 |
define ('AI_OPTION_MIN_PARAGRAPHS', 'min_paragraphs');
|
57 |
define ('AI_OPTION_COUNT_INSIDE_BLOCKQUOTE', 'count_inside_blockquote');
|
131 |
//form select options
|
132 |
define('AD_SELECT_SELECTED','selected');
|
133 |
|
134 |
+
//Automatic insertion options - Deprecated
|
135 |
define('AD_SELECT_NONE','None');
|
136 |
define('AD_SELECT_BEFORE_POST','Before Post');
|
137 |
define('AD_SELECT_AFTER_POST','After Post');
|
142 |
define('AD_SELECT_BEFORE_EXCERPT','Before Excerpt');
|
143 |
define('AD_SELECT_AFTER_EXCERPT','After Excerpt');
|
144 |
define('AD_SELECT_BETWEEN_POSTS','Between Posts');
|
|
|
145 |
define('AD_SELECT_WIDGET','Widget'); // Deprecated
|
146 |
define('AD_SELECT_BEFORE_TITLE','Before Title'); // Deprecated
|
147 |
define('AD_SELECT_MANUAL','Manual'); // Deprecated
|
148 |
|
149 |
+
define('AI_AUTOMATIC_INSERTION_DISABLED', 0);
|
150 |
+
define('AI_AUTOMATIC_INSERTION_BEFORE_POST', 1);
|
151 |
+
define('AI_AUTOMATIC_INSERTION_AFTER_POST', 2);
|
152 |
+
define('AI_AUTOMATIC_INSERTION_BEFORE_CONTENT', 3);
|
153 |
+
define('AI_AUTOMATIC_INSERTION_AFTER_CONTENT', 4);
|
154 |
+
define('AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH', 5);
|
155 |
+
define('AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH', 6);
|
156 |
+
define('AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT', 7);
|
157 |
+
define('AI_AUTOMATIC_INSERTION_AFTER_EXCERPT', 8);
|
158 |
+
define('AI_AUTOMATIC_INSERTION_BETWEEN_POSTS', 9);
|
159 |
+
|
160 |
+
define('AI_TEXT_DISABLED', 'Disabled');
|
161 |
+
define('AI_TEXT_BEFORE_POST', 'Before Post');
|
162 |
+
define('AI_TEXT_AFTER_POST', 'After Post');
|
163 |
+
define('AI_TEXT_BEFORE_CONTENT', 'Before Content');
|
164 |
+
define('AI_TEXT_AFTER_CONTENT', 'After Content');
|
165 |
+
define('AI_TEXT_BEFORE_PARAGRAPH', 'Before Paragraph');
|
166 |
+
define('AI_TEXT_AFTER_PARAGRAPH', 'After Paragraph');
|
167 |
+
define('AI_TEXT_BEFORE_EXCERPT', 'Before Excerpt');
|
168 |
+
define('AI_TEXT_AFTER_EXCERPT', 'After Excerpt');
|
169 |
+
define('AI_TEXT_BETWEEN_POSTS', 'Between Posts');
|
170 |
+
|
171 |
//Display options
|
172 |
define('AD_DISPLAY_ALL_USERS','all users');
|
173 |
define('AD_DISPLAY_LOGGED_IN_USERS','logged in users');
|
191 |
define('AD_ENABLED_ON_ALL_EXCEPT_ON_SELECTED', 'On all except selected');
|
192 |
define('AD_ENABLED_ONLY_ON_SELECTED', 'Only on selected');
|
193 |
|
194 |
+
//Alignment options - Deprecated
|
195 |
define('AD_ALIGNMENT_NO_WRAPPING','No Wrapping');
|
196 |
define('AD_ALIGNMENT_CUSTOM_CSS','Custom CSS');
|
197 |
define('AD_ALIGNMENT_NONE','None');
|
201 |
define('AD_ALIGNMENT_FLOAT_LEFT','Float Left');
|
202 |
define('AD_ALIGNMENT_FLOAT_RIGHT','Float Right');
|
203 |
|
204 |
+
define('AI_ALIGNMENT_DEFAULT', 0);
|
205 |
+
define('AI_ALIGNMENT_LEFT', 1);
|
206 |
+
define('AI_ALIGNMENT_RIGHT', 2);
|
207 |
+
define('AI_ALIGNMENT_CENTER', 3);
|
208 |
+
define('AI_ALIGNMENT_FLOAT_LEFT', 4);
|
209 |
+
define('AI_ALIGNMENT_FLOAT_RIGHT', 5);
|
210 |
+
define('AI_ALIGNMENT_NO_WRAPPING', 6);
|
211 |
+
define('AI_ALIGNMENT_CUSTOM_CSS', 7);
|
212 |
+
|
213 |
+
define('AI_TEXT_DEFAULT', 'Default');
|
214 |
+
define('AI_TEXT_LEFT', 'Align Left');
|
215 |
+
define('AI_TEXT_RIGHT', 'Align Right');
|
216 |
+
define('AI_TEXT_CENTER', 'Center');
|
217 |
+
define('AI_TEXT_FLOAT_LEFT', 'Float Left');
|
218 |
+
define('AI_TEXT_FLOAT_RIGHT', 'Float Right');
|
219 |
+
define('AI_TEXT_NO_WRAPPING', 'No Wrapping');
|
220 |
+
define('AI_TEXT_CUSTOM_CSS', 'Custom CSS');
|
221 |
+
|
222 |
//List Type
|
223 |
define('AD_BLACK_LIST','Black List');
|
224 |
define('AD_WHITE_LIST','White List');
|
css/ad-inserter.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#data {
|
2 |
-
font-family: "2.0.
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
@@ -65,7 +65,7 @@
|
|
65 |
.exceptions th.page, .exceptions td.page {
|
66 |
width: 90%;
|
67 |
overflow: hidden;
|
68 |
-
max-width:
|
69 |
}
|
70 |
.exceptions th.page-only, .exceptions td.page-only {
|
71 |
width: 100%;
|
@@ -207,3 +207,30 @@
|
|
207 |
.flag-icon, .flag-icon-background {
|
208 |
background-position: initial;
|
209 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
#data {
|
2 |
+
font-family: "2.0.13"; /* Used for version number of the file */
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
65 |
.exceptions th.page, .exceptions td.page {
|
66 |
width: 90%;
|
67 |
overflow: hidden;
|
68 |
+
max-width: 240px;
|
69 |
}
|
70 |
.exceptions th.page-only, .exceptions td.page-only {
|
71 |
width: 100%;
|
207 |
.flag-icon, .flag-icon-background {
|
208 |
background-position: initial;
|
209 |
}
|
210 |
+
|
211 |
+
div.automatic-insertion {
|
212 |
+
width: 56px;
|
213 |
+
height: 56px;
|
214 |
+
}
|
215 |
+
|
216 |
+
ul.thumbnails.image_picker_selector li {
|
217 |
+
margin: 0px 5px 4px 0px;
|
218 |
+
}
|
219 |
+
|
220 |
+
ul.thumbnails.image_picker_selector li .thumbnail {
|
221 |
+
padding: 4px;
|
222 |
+
}
|
223 |
+
|
224 |
+
ul.thumbnails.image_picker_selector li .thumbnail.selected {
|
225 |
+
background: #666;
|
226 |
+
}
|
227 |
+
li.automatic-insertion p {
|
228 |
+
width: 57px;
|
229 |
+
font-size: inherit;
|
230 |
+
margin: 4px 0;
|
231 |
+
}
|
232 |
+
|
233 |
+
div.automatic-insertion img {
|
234 |
+
width: 56px;
|
235 |
+
}
|
236 |
+
|
css/image-picker.css
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ul.thumbnails.image_picker_selector {
|
2 |
+
overflow: auto;
|
3 |
+
list-style-image: none;
|
4 |
+
list-style-position: outside;
|
5 |
+
list-style-type: none;
|
6 |
+
padding: 0px;
|
7 |
+
margin: 0px; }
|
8 |
+
ul.thumbnails.image_picker_selector ul {
|
9 |
+
overflow: auto;
|
10 |
+
list-style-image: none;
|
11 |
+
list-style-position: outside;
|
12 |
+
list-style-type: none;
|
13 |
+
padding: 0px;
|
14 |
+
margin: 0px; }
|
15 |
+
ul.thumbnails.image_picker_selector li.group {width:100%;}
|
16 |
+
ul.thumbnails.image_picker_selector li.group_title {
|
17 |
+
float: none; }
|
18 |
+
ul.thumbnails.image_picker_selector li {
|
19 |
+
margin: 0px 12px 12px 0px;
|
20 |
+
float: left; }
|
21 |
+
ul.thumbnails.image_picker_selector li .thumbnail {
|
22 |
+
padding: 6px;
|
23 |
+
border: 1px solid #dddddd;
|
24 |
+
-webkit-user-select: none;
|
25 |
+
-moz-user-select: none;
|
26 |
+
-ms-user-select: none; }
|
27 |
+
ul.thumbnails.image_picker_selector li .thumbnail img {
|
28 |
+
-webkit-user-drag: none; }
|
29 |
+
ul.thumbnails.image_picker_selector li .thumbnail.selected {
|
30 |
+
background: #0088cc; }
|
images/after-content.png
ADDED
Binary file
|
images/after-excerpt.png
ADDED
Binary file
|
images/after-paragraph.png
ADDED
Binary file
|
images/after-post.png
ADDED
Binary file
|
images/align-left.png
ADDED
Binary file
|
images/align-right.png
ADDED
Binary file
|
images/before-content.png
ADDED
Binary file
|
images/before-excerpt.png
ADDED
Binary file
|
images/before-paragraph.png
ADDED
Binary file
|
images/before-post.png
ADDED
Binary file
|
images/between-posts.png
ADDED
Binary file
|
images/center.png
ADDED
Binary file
|
images/custom-css.png
ADDED
Binary file
|
images/default.png
ADDED
Binary file
|
images/disabled.png
ADDED
Binary file
|
images/float-left.png
ADDED
Binary file
|
images/float-right.png
ADDED
Binary file
|
images/no-wrapping.png
ADDED
Binary file
|
includes/js/image-picker.js
ADDED
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Image Picker
|
2 |
+
// by Rodrigo Vera
|
3 |
+
//
|
4 |
+
// Version 0.3.1
|
5 |
+
// Full source at https://github.com/rvera/image-picker
|
6 |
+
// MIT License, https://github.com/rvera/image-picker/blob/master/LICENSE
|
7 |
+
// Generated by CoffeeScript 1.11.0
|
8 |
+
(function() {
|
9 |
+
var ImagePicker, ImagePickerOption, both_array_are_equal, sanitized_options,
|
10 |
+
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
11 |
+
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
12 |
+
|
13 |
+
jQuery.fn.extend({
|
14 |
+
imagepicker: function(opts) {
|
15 |
+
if (opts == null) {
|
16 |
+
opts = {};
|
17 |
+
}
|
18 |
+
return this.each(function() {
|
19 |
+
var select;
|
20 |
+
select = jQuery(this);
|
21 |
+
if (select.data("picker")) {
|
22 |
+
select.data("picker").destroy();
|
23 |
+
}
|
24 |
+
select.data("picker", new ImagePicker(this, sanitized_options(opts)));
|
25 |
+
if (opts.initialized != null) {
|
26 |
+
return opts.initialized.call(select.data("picker"));
|
27 |
+
}
|
28 |
+
});
|
29 |
+
}
|
30 |
+
});
|
31 |
+
|
32 |
+
sanitized_options = function(opts) {
|
33 |
+
var default_options;
|
34 |
+
default_options = {
|
35 |
+
hide_select: true,
|
36 |
+
show_label: false,
|
37 |
+
initialized: void 0,
|
38 |
+
changed: void 0,
|
39 |
+
clicked: void 0,
|
40 |
+
selected: void 0,
|
41 |
+
limit: void 0,
|
42 |
+
limit_reached: void 0
|
43 |
+
};
|
44 |
+
return jQuery.extend(default_options, opts);
|
45 |
+
};
|
46 |
+
|
47 |
+
both_array_are_equal = function(a, b) {
|
48 |
+
var i, j, len, x;
|
49 |
+
if ((!a || !b) || (a.length !== b.length)) {
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
a = a.slice(0);
|
53 |
+
b = b.slice(0);
|
54 |
+
a.sort();
|
55 |
+
b.sort();
|
56 |
+
for (i = j = 0, len = a.length; j < len; i = ++j) {
|
57 |
+
x = a[i];
|
58 |
+
if (b[i] !== x) {
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
return true;
|
63 |
+
};
|
64 |
+
|
65 |
+
ImagePicker = (function() {
|
66 |
+
function ImagePicker(select_element, opts1) {
|
67 |
+
this.opts = opts1 != null ? opts1 : {};
|
68 |
+
this.sync_picker_with_select = bind(this.sync_picker_with_select, this);
|
69 |
+
this.select = jQuery(select_element);
|
70 |
+
this.multiple = this.select.attr("multiple") === "multiple";
|
71 |
+
if (this.select.data("limit") != null) {
|
72 |
+
this.opts.limit = parseInt(this.select.data("limit"));
|
73 |
+
}
|
74 |
+
this.build_and_append_picker();
|
75 |
+
}
|
76 |
+
|
77 |
+
ImagePicker.prototype.destroy = function() {
|
78 |
+
var j, len, option, ref;
|
79 |
+
ref = this.picker_options;
|
80 |
+
for (j = 0, len = ref.length; j < len; j++) {
|
81 |
+
option = ref[j];
|
82 |
+
option.destroy();
|
83 |
+
}
|
84 |
+
this.picker.remove();
|
85 |
+
this.select.off("change", this.sync_picker_with_select);
|
86 |
+
this.select.removeData("picker");
|
87 |
+
return this.select.show();
|
88 |
+
};
|
89 |
+
|
90 |
+
ImagePicker.prototype.build_and_append_picker = function() {
|
91 |
+
if (this.opts.hide_select) {
|
92 |
+
this.select.hide();
|
93 |
+
}
|
94 |
+
this.select.on("change", this.sync_picker_with_select);
|
95 |
+
if (this.picker != null) {
|
96 |
+
this.picker.remove();
|
97 |
+
}
|
98 |
+
this.create_picker();
|
99 |
+
this.select.after(this.picker);
|
100 |
+
return this.sync_picker_with_select();
|
101 |
+
};
|
102 |
+
|
103 |
+
ImagePicker.prototype.sync_picker_with_select = function() {
|
104 |
+
var j, len, option, ref, results;
|
105 |
+
ref = this.picker_options;
|
106 |
+
results = [];
|
107 |
+
for (j = 0, len = ref.length; j < len; j++) {
|
108 |
+
option = ref[j];
|
109 |
+
if (option.is_selected()) {
|
110 |
+
results.push(option.mark_as_selected());
|
111 |
+
} else {
|
112 |
+
results.push(option.unmark_as_selected());
|
113 |
+
}
|
114 |
+
}
|
115 |
+
return results;
|
116 |
+
};
|
117 |
+
|
118 |
+
ImagePicker.prototype.create_picker = function() {
|
119 |
+
this.picker = jQuery("<ul class='thumbnails image_picker_selector'></ul>");
|
120 |
+
this.picker_options = [];
|
121 |
+
this.recursively_parse_option_groups(this.select, this.picker);
|
122 |
+
return this.picker;
|
123 |
+
};
|
124 |
+
|
125 |
+
ImagePicker.prototype.recursively_parse_option_groups = function(scoped_dom, target_container) {
|
126 |
+
var container, j, k, len, len1, option, option_group, ref, ref1, results;
|
127 |
+
ref = scoped_dom.children("optgroup");
|
128 |
+
for (j = 0, len = ref.length; j < len; j++) {
|
129 |
+
option_group = ref[j];
|
130 |
+
option_group = jQuery(option_group);
|
131 |
+
container = jQuery("<ul></ul>");
|
132 |
+
container.append(jQuery("<li class='group_title'>" + (option_group.attr("label")) + "</li>"));
|
133 |
+
target_container.append(jQuery("<li class='group'>").append(container));
|
134 |
+
this.recursively_parse_option_groups(option_group, container);
|
135 |
+
}
|
136 |
+
ref1 = (function() {
|
137 |
+
var l, len1, ref1, results1;
|
138 |
+
ref1 = scoped_dom.children("option");
|
139 |
+
results1 = [];
|
140 |
+
for (l = 0, len1 = ref1.length; l < len1; l++) {
|
141 |
+
option = ref1[l];
|
142 |
+
results1.push(new ImagePickerOption(option, this, this.opts));
|
143 |
+
}
|
144 |
+
return results1;
|
145 |
+
}).call(this);
|
146 |
+
results = [];
|
147 |
+
for (k = 0, len1 = ref1.length; k < len1; k++) {
|
148 |
+
option = ref1[k];
|
149 |
+
this.picker_options.push(option);
|
150 |
+
if (!option.has_image()) {
|
151 |
+
continue;
|
152 |
+
}
|
153 |
+
results.push(target_container.append(option.node));
|
154 |
+
}
|
155 |
+
return results;
|
156 |
+
};
|
157 |
+
|
158 |
+
ImagePicker.prototype.has_implicit_blanks = function() {
|
159 |
+
var option;
|
160 |
+
return ((function() {
|
161 |
+
var j, len, ref, results;
|
162 |
+
ref = this.picker_options;
|
163 |
+
results = [];
|
164 |
+
for (j = 0, len = ref.length; j < len; j++) {
|
165 |
+
option = ref[j];
|
166 |
+
if (option.is_blank() && !option.has_image()) {
|
167 |
+
results.push(option);
|
168 |
+
}
|
169 |
+
}
|
170 |
+
return results;
|
171 |
+
}).call(this)).length > 0;
|
172 |
+
};
|
173 |
+
|
174 |
+
ImagePicker.prototype.selected_values = function() {
|
175 |
+
if (this.multiple) {
|
176 |
+
return this.select.val() || [];
|
177 |
+
} else {
|
178 |
+
return [this.select.val()];
|
179 |
+
}
|
180 |
+
};
|
181 |
+
|
182 |
+
ImagePicker.prototype.toggle = function(imagepicker_option, original_event) {
|
183 |
+
var new_values, old_values, selected_value;
|
184 |
+
old_values = this.selected_values();
|
185 |
+
selected_value = imagepicker_option.value().toString();
|
186 |
+
if (this.multiple) {
|
187 |
+
if (indexOf.call(this.selected_values(), selected_value) >= 0) {
|
188 |
+
new_values = this.selected_values();
|
189 |
+
new_values.splice(jQuery.inArray(selected_value, old_values), 1);
|
190 |
+
this.select.val([]);
|
191 |
+
this.select.val(new_values);
|
192 |
+
} else {
|
193 |
+
if ((this.opts.limit != null) && this.selected_values().length >= this.opts.limit) {
|
194 |
+
if (this.opts.limit_reached != null) {
|
195 |
+
this.opts.limit_reached.call(this.select);
|
196 |
+
}
|
197 |
+
} else {
|
198 |
+
this.select.val(this.selected_values().concat(selected_value));
|
199 |
+
}
|
200 |
+
}
|
201 |
+
} else {
|
202 |
+
if (this.has_implicit_blanks() && imagepicker_option.is_selected()) {
|
203 |
+
this.select.val("");
|
204 |
+
} else {
|
205 |
+
this.select.val(selected_value);
|
206 |
+
}
|
207 |
+
}
|
208 |
+
if (!both_array_are_equal(old_values, this.selected_values())) {
|
209 |
+
this.select.change();
|
210 |
+
if (this.opts.changed != null) {
|
211 |
+
return this.opts.changed.call(this.select, old_values, this.selected_values(), original_event);
|
212 |
+
}
|
213 |
+
}
|
214 |
+
};
|
215 |
+
|
216 |
+
return ImagePicker;
|
217 |
+
|
218 |
+
})();
|
219 |
+
|
220 |
+
ImagePickerOption = (function() {
|
221 |
+
function ImagePickerOption(option_element, picker, opts1) {
|
222 |
+
this.picker = picker;
|
223 |
+
this.opts = opts1 != null ? opts1 : {};
|
224 |
+
this.clicked = bind(this.clicked, this);
|
225 |
+
this.option = jQuery(option_element);
|
226 |
+
this.create_node();
|
227 |
+
}
|
228 |
+
|
229 |
+
ImagePickerOption.prototype.destroy = function() {
|
230 |
+
return this.node.find(".thumbnail").off("click", this.clicked);
|
231 |
+
};
|
232 |
+
|
233 |
+
ImagePickerOption.prototype.has_image = function() {
|
234 |
+
return this.option.data("img-src") != null;
|
235 |
+
};
|
236 |
+
|
237 |
+
ImagePickerOption.prototype.is_blank = function() {
|
238 |
+
return !((this.value() != null) && this.value() !== "");
|
239 |
+
};
|
240 |
+
|
241 |
+
ImagePickerOption.prototype.is_selected = function() {
|
242 |
+
var select_value;
|
243 |
+
select_value = this.picker.select.val();
|
244 |
+
if (this.picker.multiple) {
|
245 |
+
return jQuery.inArray(this.value(), select_value) >= 0;
|
246 |
+
} else {
|
247 |
+
return this.value() === select_value;
|
248 |
+
}
|
249 |
+
};
|
250 |
+
|
251 |
+
ImagePickerOption.prototype.mark_as_selected = function() {
|
252 |
+
return this.node.find(".thumbnail").addClass("selected");
|
253 |
+
};
|
254 |
+
|
255 |
+
ImagePickerOption.prototype.unmark_as_selected = function() {
|
256 |
+
return this.node.find(".thumbnail").removeClass("selected");
|
257 |
+
};
|
258 |
+
|
259 |
+
ImagePickerOption.prototype.value = function() {
|
260 |
+
return this.option.val();
|
261 |
+
};
|
262 |
+
|
263 |
+
ImagePickerOption.prototype.label = function() {
|
264 |
+
if (this.option.data("img-label")) {
|
265 |
+
return this.option.data("img-label");
|
266 |
+
} else {
|
267 |
+
return this.option.text();
|
268 |
+
}
|
269 |
+
};
|
270 |
+
|
271 |
+
ImagePickerOption.prototype.clicked = function(event) {
|
272 |
+
this.picker.toggle(this, event);
|
273 |
+
if (this.opts.clicked != null) {
|
274 |
+
this.opts.clicked.call(this.picker.select, this, event);
|
275 |
+
}
|
276 |
+
if ((this.opts.selected != null) && this.is_selected()) {
|
277 |
+
return this.opts.selected.call(this.picker.select, this, event);
|
278 |
+
}
|
279 |
+
};
|
280 |
+
|
281 |
+
ImagePickerOption.prototype.create_node = function() {
|
282 |
+
var image, imgAlt, imgClass, thumbnail;
|
283 |
+
this.node = jQuery("<li/>");
|
284 |
+
image = jQuery("<img class='image_picker_image'/>");
|
285 |
+
image.attr("src", this.option.data("img-src"));
|
286 |
+
thumbnail = jQuery("<div class='thumbnail'>");
|
287 |
+
imgClass = this.option.data("img-class");
|
288 |
+
if (imgClass) {
|
289 |
+
this.node.addClass(imgClass);
|
290 |
+
image.addClass(imgClass);
|
291 |
+
thumbnail.addClass(imgClass);
|
292 |
+
}
|
293 |
+
imgAlt = this.option.data("img-alt");
|
294 |
+
if (imgAlt) {
|
295 |
+
image.attr('alt', imgAlt);
|
296 |
+
}
|
297 |
+
imgTitle = this.option.data("img-title");
|
298 |
+
if (imgTitle) {
|
299 |
+
image.attr('title', imgTitle);
|
300 |
+
}
|
301 |
+
thumbnail.on("click", this.clicked);
|
302 |
+
thumbnail.append(image);
|
303 |
+
// if (this.opts.show_label) {
|
304 |
+
// thumbnail.append(jQuery("<p/>").html(this.label()));
|
305 |
+
// }
|
306 |
+
this.node.append(thumbnail);
|
307 |
+
if (this.opts.show_label) {
|
308 |
+
this.node.append(jQuery("<p/>").html(this.label()));
|
309 |
+
}
|
310 |
+
return this.node;
|
311 |
+
};
|
312 |
+
|
313 |
+
return ImagePickerOption;
|
314 |
+
|
315 |
+
})();
|
316 |
+
|
317 |
+
}).call(this);
|
includes/js/image-picker.min.js
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Image Picker
|
2 |
+
// by Rodrigo Vera
|
3 |
+
//
|
4 |
+
// Version 0.3.1
|
5 |
+
// Full source at https://github.com/rvera/image-picker
|
6 |
+
// MIT License, https://github.com/rvera/image-picker/blob/master/LICENSE
|
7 |
+
// Image Picker
|
8 |
+
// by Rodrigo Vera
|
9 |
+
//
|
10 |
+
// Version 0.3.0
|
11 |
+
// Full source at https://github.com/rvera/image-picker
|
12 |
+
// MIT License, https://github.com/rvera/image-picker/blob/master/LICENSE
|
13 |
+
(function(){var t,e,i,s,l=function(t,e){return function(){return t.apply(e,arguments)}},n=[].indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(e in this&&this[e]===t)return e;return-1};jQuery.fn.extend({imagepicker:function(e){return null==e&&(e={}),this.each(function(){var i;return i=jQuery(this),i.data("picker")&&i.data("picker").destroy(),i.data("picker",new t(this,s(e))),null!=e.initialized?e.initialized.call(i.data("picker")):void 0})}}),s=function(t){var e;return e={hide_select:!0,show_label:!1,initialized:void 0,changed:void 0,clicked:void 0,selected:void 0,limit:void 0,limit_reached:void 0},jQuery.extend(e,t)},i=function(t,e){return 0===jQuery(t).not(e).length&&0===jQuery(e).not(t).length},t=function(){function t(t,e){this.opts=null!=e?e:{},this.sync_picker_with_select=l(this.sync_picker_with_select,this),this.select=jQuery(t),this.multiple="multiple"===this.select.attr("multiple"),null!=this.select.data("limit")&&(this.opts.limit=parseInt(this.select.data("limit"))),this.build_and_append_picker()}return t.prototype.destroy=function(){var t,e,i,s;for(s=this.picker_options,e=0,i=s.length;i>e;e++)t=s[e],t.destroy();return this.picker.remove(),this.select.unbind("change"),this.select.removeData("picker"),this.select.show()},t.prototype.build_and_append_picker=function(){var t=this;return this.opts.hide_select&&this.select.hide(),this.select.change(function(){return t.sync_picker_with_select()}),null!=this.picker&&this.picker.remove(),this.create_picker(),this.select.after(this.picker),this.sync_picker_with_select()},t.prototype.sync_picker_with_select=function(){var t,e,i,s,l;for(s=this.picker_options,l=[],e=0,i=s.length;i>e;e++)t=s[e],t.is_selected()?l.push(t.mark_as_selected()):l.push(t.unmark_as_selected());return l},t.prototype.create_picker=function(){return this.picker=jQuery("<ul class='thumbnails image_picker_selector'></ul>"),this.picker_options=[],this.recursively_parse_option_groups(this.select,this.picker),this.picker},t.prototype.recursively_parse_option_groups=function(t,i){var s,l,n,r,c,o,h,a,p,u;for(a=t.children("optgroup"),r=0,o=a.length;o>r;r++)n=a[r],n=jQuery(n),s=jQuery("<ul></ul>"),s.append(jQuery("<li class='group_title'>"+n.attr("label")+"</li>")),i.append(jQuery("<li>").append(s)),this.recursively_parse_option_groups(n,s);for(p=function(){var i,s,n,r;for(n=t.children("option"),r=[],i=0,s=n.length;s>i;i++)l=n[i],r.push(new e(l,this,this.opts));return r}.call(this),u=[],c=0,h=p.length;h>c;c++)l=p[c],this.picker_options.push(l),l.has_image()&&u.push(i.append(l.node));return u},t.prototype.has_implicit_blanks=function(){var t;return function(){var e,i,s,l;for(s=this.picker_options,l=[],e=0,i=s.length;i>e;e++)t=s[e],t.is_blank()&&!t.has_image()&&l.push(t);return l}.call(this).length>0},t.prototype.selected_values=function(){return this.multiple?this.select.val()||[]:[this.select.val()]},t.prototype.toggle=function(t){var e,s,l;return s=this.selected_values(),l=""+t.value(),this.multiple?n.call(this.selected_values(),l)>=0?(e=this.selected_values(),e.splice(jQuery.inArray(l,s),1),this.select.val([]),this.select.val(e)):null!=this.opts.limit&&this.selected_values().length>=this.opts.limit?null!=this.opts.limit_reached&&this.opts.limit_reached.call(this.select):this.select.val(this.selected_values().concat(l)):this.has_implicit_blanks()&&t.is_selected()?this.select.val(""):this.select.val(l),i(s,this.selected_values())||(this.select.change(),null==this.opts.changed)?void 0:this.opts.changed.call(this.select,s,this.selected_values())},t}(),e=function(){function t(t,e,i){this.picker=e,this.opts=null!=i?i:{},this.clicked=l(this.clicked,this),this.option=jQuery(t),this.create_node()}return t.prototype.destroy=function(){return this.node.find(".thumbnail").unbind()},t.prototype.has_image=function(){return null!=this.option.data("img-src")},t.prototype.is_blank=function(){return!(null!=this.value()&&""!==this.value())},t.prototype.is_selected=function(){var t;return t=this.picker.select.val(),this.picker.multiple?jQuery.inArray(this.value(),t)>=0:this.value()===t},t.prototype.mark_as_selected=function(){return this.node.find(".thumbnail").addClass("selected")},t.prototype.unmark_as_selected=function(){return this.node.find(".thumbnail").removeClass("selected")},t.prototype.value=function(){return this.option.val()},t.prototype.label=function(){return this.option.data("img-label")?this.option.data("img-label"):this.option.text()},t.prototype.clicked=function(){return this.picker.toggle(this),null!=this.opts.clicked&&this.opts.clicked.call(this.picker.select,this),null!=this.opts.selected&&this.is_selected()?this.opts.selected.call(this.picker.select,this):void 0},t.prototype.create_node=function(){var t,e;return this.node=jQuery("<li/>"),t=jQuery("<img class='image_picker_image'/>"),t.attr("src",this.option.data("img-src")),e=jQuery("<div class='thumbnail'>"),e.click({option:this},function(t){return t.data.option.clicked()}),e.append(t),this.opts.show_label&&e.append(jQuery("<p/>").html(this.label())),this.node.append(e),this.node},t}()}).call(this);
|
index.php
CHANGED
@@ -26,32 +26,39 @@
|
|
26 |
64 blocks, 6 viewports, import/export settings and has additional multisite support.
|
27 |
</p>
|
28 |
<div>
|
29 |
-
<a href="http://adinserter.pro/documentation" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="screenshot-1.jpg" /></a>
|
30 |
</div>
|
31 |
<p>
|
32 |
Settings for one code block. Up to 16 blocks can be configured.
|
33 |
</p>
|
34 |
<hr />
|
35 |
<div>
|
36 |
-
<img style="display: block;margin: 0 auto;" src="screenshot-
|
37 |
</div>
|
38 |
<p>
|
39 |
-
|
40 |
</p>
|
41 |
<hr />
|
42 |
<div>
|
43 |
-
<img style="display: block;margin: 0 auto;" src="screenshot-
|
44 |
</div>
|
45 |
<p>
|
46 |
Code preview with visual CSS editor
|
47 |
</p>
|
48 |
<hr />
|
49 |
<div>
|
50 |
-
<img style="display: block;margin: 0 auto;" src="screenshot-
|
51 |
</div>
|
52 |
<p>
|
53 |
Code preview with visual CSS editor - highlighted code
|
54 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
</div>
|
56 |
</div>
|
57 |
|
26 |
64 blocks, 6 viewports, import/export settings and has additional multisite support.
|
27 |
</p>
|
28 |
<div>
|
29 |
+
<a href="http://adinserter.pro/documentation" target="_blank" rel="nofollow"><img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-1.jpg" /></a>
|
30 |
</div>
|
31 |
<p>
|
32 |
Settings for one code block. Up to 16 blocks can be configured.
|
33 |
</p>
|
34 |
<hr />
|
35 |
<div>
|
36 |
+
<img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-5.jpg" />
|
37 |
</div>
|
38 |
<p>
|
39 |
+
Some <a href="http://adinserter.pro/" rel="nofollow" class="seoquake-nofollow">Ad Inserter Pro</a> features: IP address and country lists, Scheduling between dates with fallback
|
40 |
</p>
|
41 |
<hr />
|
42 |
<div>
|
43 |
+
<img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-2.jpg" />
|
44 |
</div>
|
45 |
<p>
|
46 |
Code preview with visual CSS editor
|
47 |
</p>
|
48 |
<hr />
|
49 |
<div>
|
50 |
+
<img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-3.jpg" width="800"/>
|
51 |
</div>
|
52 |
<p>
|
53 |
Code preview with visual CSS editor - highlighted code
|
54 |
</p>
|
55 |
+
<hr />
|
56 |
+
<div>
|
57 |
+
<img style="display: block;margin: 0 auto;" src="https://ps.w.org/ad-inserter/assets/screenshot-17.png" />
|
58 |
+
</div>
|
59 |
+
<p>
|
60 |
+
Complete settings for one code block (Before Paragraph)
|
61 |
+
</p>
|
62 |
</div>
|
63 |
</div>
|
64 |
|
js/ad-inserter.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
var javascript_version = "2.0.
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
@@ -13,6 +13,26 @@ var settings_page = "";
|
|
13 |
|
14 |
var dateFormat = "yy-mm-dd";
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
var shSettings = {
|
17 |
"tab_size":"4",
|
18 |
"use_soft_tabs":"1",
|
@@ -251,16 +271,17 @@ jQuery(document).ready(function($) {
|
|
251 |
// $("select#display-type-"+block+" option:selected").each(function() {
|
252 |
// display_type += $(this).text();
|
253 |
// });
|
254 |
-
var display_type = $("select#display-type-"+block+" option:selected").text();
|
255 |
|
256 |
-
|
|
|
|
|
257 |
$("#paragraph-settings-"+block).show();
|
258 |
} else {
|
259 |
$("#paragraph-counting-"+block).hide();
|
260 |
$("#paragraph-clearance-"+block).hide();
|
261 |
}
|
262 |
|
263 |
-
var content_settings =
|
264 |
if (content_settings) {
|
265 |
$("#content-settings-"+block).show();
|
266 |
}
|
@@ -279,9 +300,9 @@ jQuery(document).ready(function($) {
|
|
279 |
|
280 |
$("#no-wrapping-warning-"+block).hide();
|
281 |
|
282 |
-
var alignment = $("select#block-alignment-"+block+" option:selected").
|
283 |
|
284 |
-
if (alignment ==
|
285 |
$("#css-no-wrapping-"+block).css('display', 'table-cell');
|
286 |
$("#css-label-"+block).hide();
|
287 |
$("#edit-css-button-"+block).hide();
|
@@ -289,33 +310,33 @@ jQuery(document).ready(function($) {
|
|
289 |
$("#no-wrapping-warning-"+block).show();
|
290 |
}
|
291 |
} else
|
292 |
-
if (alignment ==
|
293 |
$("#css-none-"+block).css('display', 'table-cell');
|
294 |
} else
|
295 |
-
if (alignment ==
|
296 |
$("#css-code-" + block).show();
|
297 |
$("#custom-css-"+block).show();
|
298 |
} else
|
299 |
-
if (alignment ==
|
300 |
$("#css-left-"+block).css('display', 'table-cell');
|
301 |
} else
|
302 |
-
if (alignment ==
|
303 |
$("#css-right-"+block).css('display', 'table-cell');
|
304 |
} else
|
305 |
-
if (alignment ==
|
306 |
$("#css-center-"+block).css('display', 'table-cell');
|
307 |
} else
|
308 |
-
if (alignment ==
|
309 |
$("#css-float-left-"+block).css('display', 'table-cell');
|
310 |
} else
|
311 |
-
if (alignment ==
|
312 |
$("#css-float-right-"+block).css('display', 'table-cell');
|
313 |
}
|
314 |
|
315 |
if ($('#css-code-'+block).is(':visible')) {
|
316 |
-
$("#show-css-button-"+block+" span").text ("Hide
|
317 |
} else {
|
318 |
-
$("#show-css-button-"+block+" span").text ("Show
|
319 |
}
|
320 |
|
321 |
var avoid_action = $("select#avoid-action-"+block+" option:selected").text();
|
@@ -445,6 +466,12 @@ jQuery(document).ready(function($) {
|
|
445 |
|
446 |
configure_editor (tab);
|
447 |
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
$("select#display-type-"+tab).change (function() {
|
449 |
var block = $(this).attr('id').replace ("display-type-", "");
|
450 |
process_display_elements (block);
|
@@ -530,9 +557,9 @@ jQuery(document).ready(function($) {
|
|
530 |
$("#css-code-" + block).toggle ();
|
531 |
|
532 |
if ($('#css-code-'+block).is(':visible')) {
|
533 |
-
$("#show-css-button-"+block+" span").text ("Hide
|
534 |
} else {
|
535 |
-
$("#show-css-button-"+block+" span").text ("Show
|
536 |
}
|
537 |
});
|
538 |
|
@@ -551,6 +578,13 @@ jQuery(document).ready(function($) {
|
|
551 |
$("#scheduling-on-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
|
552 |
$("#scheduling-off-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
|
553 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
$("#edit-css-button-"+tab).button ({
|
555 |
}).click (function () {
|
556 |
var block = $(this).attr('id').replace ("edit-css-button-", "");
|
@@ -561,37 +595,37 @@ jQuery(document).ready(function($) {
|
|
561 |
$("#css-float-left-"+block).hide();
|
562 |
$("#css-float-right-"+block).hide();
|
563 |
|
564 |
-
var alignment = $("select#block-alignment-"+block+" option:selected").
|
565 |
|
566 |
-
if (alignment ==
|
567 |
$("#css-none-"+block).hide();
|
568 |
$("#custom-css-"+block).show().val ($("#css-none-"+block).text ());
|
569 |
-
$("select#block-alignment-"+block).val (
|
570 |
} else
|
571 |
-
if (alignment ==
|
572 |
$("#css-left-"+block).hide();
|
573 |
$("#custom-css-"+block).show().val ($("#css-left-"+block).text ());
|
574 |
-
$("select#block-alignment-"+block).val (
|
575 |
} else
|
576 |
-
if (alignment ==
|
577 |
$("#css-right-"+block).hide();
|
578 |
$("#custom-css-"+block).show().val ($("#css-right-"+block).text ());
|
579 |
-
$("select#block-alignment-"+block).val (
|
580 |
} else
|
581 |
-
if (alignment ==
|
582 |
$("#css-center-"+block).hide();
|
583 |
$("#custom-css-"+block).show().val ($("#css-center-"+block).text ());
|
584 |
-
$("select#block-alignment-"+block).val (
|
585 |
} else
|
586 |
-
if (alignment ==
|
587 |
$("#css-float-left-"+block).hide();
|
588 |
$("#custom-css-"+block).show().val ($("#css-float-left-"+block).text ());
|
589 |
-
$("select#block-alignment-"+block).val (
|
590 |
} else
|
591 |
-
if (alignment ==
|
592 |
$("#css-float-right-"+block).hide();
|
593 |
$("#custom-css-"+block).show().val ($("#css-float-right-"+block).text ());
|
594 |
-
$("select#block-alignment-"+block).val (
|
595 |
}
|
596 |
});
|
597 |
|
@@ -699,28 +733,28 @@ jQuery(document).ready(function($) {
|
|
699 |
$(this).blur ();
|
700 |
|
701 |
|
702 |
-
var alignment = $("select#block-alignment-"+block+" option:selected").
|
703 |
|
704 |
var css = "";
|
705 |
-
if (alignment ==
|
706 |
css = $("#css-none-"+block).text ();
|
707 |
} else
|
708 |
-
if (alignment ==
|
709 |
css = $("#custom-css-"+block).val();
|
710 |
} else
|
711 |
-
if (alignment ==
|
712 |
css = $("#css-left-"+block).text ();
|
713 |
} else
|
714 |
-
if (alignment ==
|
715 |
css = $("#css-right-"+block).text ();
|
716 |
} else
|
717 |
-
if (alignment ==
|
718 |
css = $("#css-center-"+block).text ();
|
719 |
} else
|
720 |
-
if (alignment ==
|
721 |
css = $("#css-float-left-"+block).text ();
|
722 |
} else
|
723 |
-
if (alignment ==
|
724 |
css = $("#css-float-right-"+block).text ();
|
725 |
}
|
726 |
|
@@ -730,7 +764,7 @@ jQuery(document).ready(function($) {
|
|
730 |
var window_height = 820;
|
731 |
var nonce = $(this).attr ('nonce');
|
732 |
var site_url = $(this).attr ('site-url');
|
733 |
-
var page = site_url+"/wp-admin/admin-ajax.php?action=ai_data&preview=" + block + "&ai_check=" + nonce + "&alignment=" +
|
734 |
var window_left = 120;
|
735 |
var window_top = (screen.height / 2) - (820 / 2);
|
736 |
var preview_window = window.open (page, 'preview','width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');
|
@@ -782,7 +816,7 @@ jQuery(document).ready(function($) {
|
|
782 |
}
|
783 |
update_country_selection ($(this), element_name_prefix, true)
|
784 |
}).focusout (function () {
|
785 |
-
update_country_selection ($(this), element_name_prefix)
|
786 |
});
|
787 |
}
|
788 |
}
|
@@ -796,7 +830,7 @@ jQuery(document).ready(function($) {
|
|
796 |
select_element.qs2.cache();
|
797 |
}
|
798 |
|
799 |
-
function update_country_selection (select_element, element_name_prefix, toggle
|
800 |
var index = select_element.attr ('id');
|
801 |
var index = index.replace (element_name_prefix+'-list-','');
|
802 |
if (toggle) $('#ms-'+element_name_prefix+'-select-'+index).toggle();
|
1 |
+
var javascript_version = "2.0.13";
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
13 |
|
14 |
var dateFormat = "yy-mm-dd";
|
15 |
|
16 |
+
var AI_DISABLED = 0;
|
17 |
+
var AI_BEFORE_POST = 1;
|
18 |
+
var AI_AFTER_POST = 2;
|
19 |
+
var AI_BEFORE_CONTENT = 3;
|
20 |
+
var AI_AFTER_CONTENT = 4;
|
21 |
+
var AI_BEFORE_PARAGRAPH = 5;
|
22 |
+
var AI_AFTER_PARAGRAPH = 6;
|
23 |
+
var AI_BEFORE_EXCERPT = 7;
|
24 |
+
var AI_AFTER_EXCERPT = 8;
|
25 |
+
var AI_BETWEEN_POSTS = 9;
|
26 |
+
|
27 |
+
var AI_ALIGNMENT_DEFAULT = 0;
|
28 |
+
var AI_ALIGNMENT_LEFT = 1;
|
29 |
+
var AI_ALIGNMENT_RIGHT = 2;
|
30 |
+
var AI_ALIGNMENT_CENTER = 3;
|
31 |
+
var AI_ALIGNMENT_FLOAT_LEFT = 4;
|
32 |
+
var AI_ALIGNMENT_FLOAT_RIGHT = 5;
|
33 |
+
var AI_ALIGNMENT_NO_WRAPPING = 6;
|
34 |
+
var AI_ALIGNMENT_CUSTOM_CSS = 7;
|
35 |
+
|
36 |
var shSettings = {
|
37 |
"tab_size":"4",
|
38 |
"use_soft_tabs":"1",
|
271 |
// $("select#display-type-"+block+" option:selected").each(function() {
|
272 |
// display_type += $(this).text();
|
273 |
// });
|
|
|
274 |
|
275 |
+
var automatic_insertion = $("select#display-type-"+block+" option:selected").attr('value');
|
276 |
+
|
277 |
+
if (automatic_insertion == AI_BEFORE_PARAGRAPH || automatic_insertion == AI_AFTER_PARAGRAPH) {
|
278 |
$("#paragraph-settings-"+block).show();
|
279 |
} else {
|
280 |
$("#paragraph-counting-"+block).hide();
|
281 |
$("#paragraph-clearance-"+block).hide();
|
282 |
}
|
283 |
|
284 |
+
var content_settings = automatic_insertion == AI_BEFORE_PARAGRAPH || automatic_insertion == AI_AFTER_PARAGRAPH || automatic_insertion == AI_BEFORE_CONTENT || automatic_insertion == AI_AFTER_CONTENT;
|
285 |
if (content_settings) {
|
286 |
$("#content-settings-"+block).show();
|
287 |
}
|
300 |
|
301 |
$("#no-wrapping-warning-"+block).hide();
|
302 |
|
303 |
+
var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
|
304 |
|
305 |
+
if (alignment == AI_ALIGNMENT_NO_WRAPPING) {
|
306 |
$("#css-no-wrapping-"+block).css('display', 'table-cell');
|
307 |
$("#css-label-"+block).hide();
|
308 |
$("#edit-css-button-"+block).hide();
|
310 |
$("#no-wrapping-warning-"+block).show();
|
311 |
}
|
312 |
} else
|
313 |
+
if (alignment == AI_ALIGNMENT_DEFAULT) {
|
314 |
$("#css-none-"+block).css('display', 'table-cell');
|
315 |
} else
|
316 |
+
if (alignment == AI_ALIGNMENT_CUSTOM_CSS) {
|
317 |
$("#css-code-" + block).show();
|
318 |
$("#custom-css-"+block).show();
|
319 |
} else
|
320 |
+
if (alignment == AI_ALIGNMENT_LEFT) {
|
321 |
$("#css-left-"+block).css('display', 'table-cell');
|
322 |
} else
|
323 |
+
if (alignment == AI_ALIGNMENT_RIGHT) {
|
324 |
$("#css-right-"+block).css('display', 'table-cell');
|
325 |
} else
|
326 |
+
if (alignment == AI_ALIGNMENT_CENTER) {
|
327 |
$("#css-center-"+block).css('display', 'table-cell');
|
328 |
} else
|
329 |
+
if (alignment == AI_ALIGNMENT_FLOAT_LEFT) {
|
330 |
$("#css-float-left-"+block).css('display', 'table-cell');
|
331 |
} else
|
332 |
+
if (alignment == AI_ALIGNMENT_FLOAT_RIGHT) {
|
333 |
$("#css-float-right-"+block).css('display', 'table-cell');
|
334 |
}
|
335 |
|
336 |
if ($('#css-code-'+block).is(':visible')) {
|
337 |
+
$("#show-css-button-"+block+" span").text ("Hide");
|
338 |
} else {
|
339 |
+
$("#show-css-button-"+block+" span").text ("Show");
|
340 |
}
|
341 |
|
342 |
var avoid_action = $("select#avoid-action-"+block+" option:selected").text();
|
466 |
|
467 |
configure_editor (tab);
|
468 |
|
469 |
+
$("select#display-type-"+tab).imagepicker({hide_select: false});
|
470 |
+
$("select#display-type-"+tab+" + ul").appendTo("#automatic-insertion-"+tab).css ('padding-top', '10px');
|
471 |
+
|
472 |
+
$("select#block-alignment-"+tab).imagepicker({hide_select: false});
|
473 |
+
$("select#block-alignment-"+tab+" + ul").appendTo("#alignment-style-"+tab).css ('padding-top', '10px');
|
474 |
+
|
475 |
$("select#display-type-"+tab).change (function() {
|
476 |
var block = $(this).attr('id').replace ("display-type-", "");
|
477 |
process_display_elements (block);
|
557 |
$("#css-code-" + block).toggle ();
|
558 |
|
559 |
if ($('#css-code-'+block).is(':visible')) {
|
560 |
+
$("#show-css-button-"+block+" span").text ("Hide");
|
561 |
} else {
|
562 |
+
$("#show-css-button-"+block+" span").text ("Show");
|
563 |
}
|
564 |
});
|
565 |
|
578 |
$("#scheduling-on-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
|
579 |
$("#scheduling-off-"+tab).datepicker ({dateFormat: dateFormat, autoSize: true});
|
580 |
|
581 |
+
$(".css-code-"+tab).click (function () {
|
582 |
+
var block = $(this).attr('class').replace ("css-code-", "");
|
583 |
+
if (!$('#custom-css-'+block).is(':visible')) {
|
584 |
+
$("#edit-css-button-"+block).click ();
|
585 |
+
}
|
586 |
+
});
|
587 |
+
|
588 |
$("#edit-css-button-"+tab).button ({
|
589 |
}).click (function () {
|
590 |
var block = $(this).attr('id').replace ("edit-css-button-", "");
|
595 |
$("#css-float-left-"+block).hide();
|
596 |
$("#css-float-right-"+block).hide();
|
597 |
|
598 |
+
var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
|
599 |
|
600 |
+
if (alignment == AI_ALIGNMENT_DEFAULT) {
|
601 |
$("#css-none-"+block).hide();
|
602 |
$("#custom-css-"+block).show().val ($("#css-none-"+block).text ());
|
603 |
+
$("select#block-alignment-"+block).val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
604 |
} else
|
605 |
+
if (alignment == AI_ALIGNMENT_LEFT) {
|
606 |
$("#css-left-"+block).hide();
|
607 |
$("#custom-css-"+block).show().val ($("#css-left-"+block).text ());
|
608 |
+
$("select#block-alignment-"+block).val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
609 |
} else
|
610 |
+
if (alignment == AI_ALIGNMENT_RIGHT) {
|
611 |
$("#css-right-"+block).hide();
|
612 |
$("#custom-css-"+block).show().val ($("#css-right-"+block).text ());
|
613 |
+
$("select#block-alignment-"+block).val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
614 |
} else
|
615 |
+
if (alignment == AI_ALIGNMENT_CENTER) {
|
616 |
$("#css-center-"+block).hide();
|
617 |
$("#custom-css-"+block).show().val ($("#css-center-"+block).text ());
|
618 |
+
$("select#block-alignment-"+block).val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
619 |
} else
|
620 |
+
if (alignment == AI_ALIGNMENT_FLOAT_LEFT) {
|
621 |
$("#css-float-left-"+block).hide();
|
622 |
$("#custom-css-"+block).show().val ($("#css-float-left-"+block).text ());
|
623 |
+
$("select#block-alignment-"+block).val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
624 |
} else
|
625 |
+
if (alignment == AI_ALIGNMENT_FLOAT_RIGHT) {
|
626 |
$("#css-float-right-"+block).hide();
|
627 |
$("#custom-css-"+block).show().val ($("#css-float-right-"+block).text ());
|
628 |
+
$("select#block-alignment-"+block).val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
629 |
}
|
630 |
});
|
631 |
|
733 |
$(this).blur ();
|
734 |
|
735 |
|
736 |
+
var alignment = $("select#block-alignment-"+block+" option:selected").attr('value');
|
737 |
|
738 |
var css = "";
|
739 |
+
if (alignment == AI_ALIGNMENT_DEFAULT) {
|
740 |
css = $("#css-none-"+block).text ();
|
741 |
} else
|
742 |
+
if (alignment == AI_ALIGNMENT_CUSTOM_CSS) {
|
743 |
css = $("#custom-css-"+block).val();
|
744 |
} else
|
745 |
+
if (alignment == AI_ALIGNMENT_LEFT) {
|
746 |
css = $("#css-left-"+block).text ();
|
747 |
} else
|
748 |
+
if (alignment == AI_ALIGNMENT_RIGHT) {
|
749 |
css = $("#css-right-"+block).text ();
|
750 |
} else
|
751 |
+
if (alignment == AI_ALIGNMENT_CENTER) {
|
752 |
css = $("#css-center-"+block).text ();
|
753 |
} else
|
754 |
+
if (alignment == AI_ALIGNMENT_FLOAT_LEFT) {
|
755 |
css = $("#css-float-left-"+block).text ();
|
756 |
} else
|
757 |
+
if (alignment == AI_ALIGNMENT_FLOAT_RIGHT) {
|
758 |
css = $("#css-float-right-"+block).text ();
|
759 |
}
|
760 |
|
764 |
var window_height = 820;
|
765 |
var nonce = $(this).attr ('nonce');
|
766 |
var site_url = $(this).attr ('site-url');
|
767 |
+
var page = site_url+"/wp-admin/admin-ajax.php?action=ai_data&preview=" + block + "&ai_check=" + nonce + "&alignment=" + alignment + "&css=" + encodeURI (css) + "&name=" + encodeURI (name);
|
768 |
var window_left = 120;
|
769 |
var window_top = (screen.height / 2) - (820 / 2);
|
770 |
var preview_window = window.open (page, 'preview','width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');
|
816 |
}
|
817 |
update_country_selection ($(this), element_name_prefix, true)
|
818 |
}).focusout (function () {
|
819 |
+
update_country_selection ($(this), element_name_prefix, false)
|
820 |
});
|
821 |
}
|
822 |
}
|
830 |
select_element.qs2.cache();
|
831 |
}
|
832 |
|
833 |
+
function update_country_selection (select_element, element_name_prefix, toggle) {
|
834 |
var index = select_element.attr ('id');
|
835 |
var index = index.replace (element_name_prefix+'-list-','');
|
836 |
if (toggle) $('#ms-'+element_name_prefix+'-select-'+index).toggle();
|
preview.php
CHANGED
@@ -16,13 +16,13 @@ function generate_code_preview ($block) {
|
|
16 |
<head>
|
17 |
<title><?php echo AD_INSERTER_NAME; ?> Code Preview</title>
|
18 |
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
19 |
-
<link rel='stylesheet' href='<?php echo
|
20 |
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
|
21 |
<script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js'></script>
|
22 |
<link rel='stylesheet' href='https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css'>
|
23 |
-
<script src='<?php echo
|
24 |
-
<script src='<?php echo
|
25 |
-
<link rel='stylesheet' href='<?php echo
|
26 |
<script>
|
27 |
|
28 |
// initialize_preview ();
|
@@ -52,6 +52,15 @@ function generate_code_preview ($block) {
|
|
52 |
var spinner_padding_left;
|
53 |
var spinner_padding_right;
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
function update_highlighting () {
|
56 |
if ($('body').hasClass ("highlighted")) {
|
57 |
$("#highlight-button").click ();
|
@@ -106,7 +115,7 @@ function generate_code_preview ($block) {
|
|
106 |
// }, 1000);
|
107 |
|
108 |
|
109 |
-
$("select#block-alignment").val (settings.find ("select#block-alignment-" + block + " option:selected").
|
110 |
$("#custom-css").val (settings.find ("#custom-css-" + block).val ());
|
111 |
$("#block-name").text (settings.find ("#name-label-" + block).text ());
|
112 |
|
@@ -118,7 +127,7 @@ function generate_code_preview ($block) {
|
|
118 |
if (window.opener != null && !window.opener.closed) {
|
119 |
var settings = $(window.opener.document).contents ();
|
120 |
|
121 |
-
settings.find ("select#block-alignment-" + block).val ($("select#block-alignment option:selected").
|
122 |
settings.find ("#custom-css-" + block).val ($("#custom-css").val ());
|
123 |
window.opener.change_block_alignment (block);
|
124 |
}
|
@@ -158,7 +167,7 @@ function generate_code_preview ($block) {
|
|
158 |
update_highlighting ();
|
159 |
update_wrapper_size ();
|
160 |
}
|
161 |
-
}).spinner ("option", "mouseWheel", true).spinner ("option", "min", 0).spinner ("option", "max",
|
162 |
|
163 |
return spinner_element;
|
164 |
}
|
@@ -183,9 +192,9 @@ function generate_code_preview ($block) {
|
|
183 |
$("#demo-box-no-wrapping").hide ();
|
184 |
wrapping = true;
|
185 |
|
186 |
-
var alignment = $("select#block-alignment option:selected").
|
187 |
|
188 |
-
if (alignment ==
|
189 |
$("#css-no-wrapping").css('display', 'inline-block');
|
190 |
$("#css-label").hide();
|
191 |
$("#edit-css-button").hide();
|
@@ -197,32 +206,32 @@ function generate_code_preview ($block) {
|
|
197 |
$("#demo-box-no-wrapping").show ();
|
198 |
|
199 |
} else
|
200 |
-
if (alignment ==
|
201 |
$("#css-none").css('display', 'inline-block');
|
202 |
style = $("#css-none").text ();
|
203 |
} else
|
204 |
-
if (alignment ==
|
205 |
$("#css-code").show();
|
206 |
$("#custom-css").show();
|
207 |
style = $("#custom-css").val ();
|
208 |
} else
|
209 |
-
if (alignment ==
|
210 |
$("#css-left").css('display', 'inline-block');
|
211 |
style = $("#css-left").text ();
|
212 |
} else
|
213 |
-
if (alignment ==
|
214 |
$("#css-right").css('display', 'inline-block');
|
215 |
style = $("#css-right").text ();
|
216 |
} else
|
217 |
-
if (alignment ==
|
218 |
$("#css-center").css('display', 'inline-block');
|
219 |
style = $("#css-center").text ();
|
220 |
} else
|
221 |
-
if (alignment ==
|
222 |
$("#css-float-left").css('display', 'inline-block');
|
223 |
style = $("#css-float-left").text ();
|
224 |
} else
|
225 |
-
if (alignment ==
|
226 |
$("#css-float-right").css('display', 'inline-block');
|
227 |
style = $("#css-float-right").text ();
|
228 |
}
|
@@ -235,7 +244,7 @@ function generate_code_preview ($block) {
|
|
235 |
|
236 |
function update_custom_css () {
|
237 |
$("#custom-css").val ($("#wrapper").attr ("style"));
|
238 |
-
$("select#block-alignment").val (
|
239 |
$("#edit-css-button").click ();
|
240 |
}
|
241 |
|
@@ -256,8 +265,8 @@ function generate_code_preview ($block) {
|
|
256 |
|
257 |
spinner_margin_top = create_spinner ("#spinner-margin-top", "margin-top", "horizontal").spinner ("option", "min", - $("#p1").outerHeight (true));
|
258 |
spinner_margin_bottom = create_spinner ("#spinner-margin-bottom", "margin-bottom", "horizontal").spinner ("option", "min", - $("#p1").outerHeight (true));
|
259 |
-
spinner_margin_left = create_spinner ("#spinner-margin-left", "margin-left", "vertical").spinner ("option", "min", -
|
260 |
-
spinner_margin_right = create_spinner ("#spinner-margin-right", "margin-right", "vertical").spinner ("option", "min", -
|
261 |
spinner_padding_top = create_spinner ("#spinner-padding-top", "padding-top", "horizontal");
|
262 |
spinner_padding_bottom = create_spinner ("#spinner-padding-bottom", "padding-bottom", "horizontal");
|
263 |
spinner_padding_left = create_spinner ("#spinner-padding-left", "padding-left", "vertical");
|
@@ -267,6 +276,12 @@ function generate_code_preview ($block) {
|
|
267 |
process_display_elements ();
|
268 |
});
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
$("#edit-css-button").button ({
|
271 |
}).click (function () {
|
272 |
|
@@ -276,40 +291,37 @@ function generate_code_preview ($block) {
|
|
276 |
$("#css-float-left").hide();
|
277 |
$("#css-float-right").hide();
|
278 |
|
279 |
-
var alignment = '';
|
280 |
-
$("select#block-alignment"+" option:selected").each(function() {
|
281 |
-
alignment += $(this).text();
|
282 |
-
});
|
283 |
|
284 |
-
if (alignment ==
|
285 |
$("#css-none").hide();
|
286 |
$("#custom-css").show().val ($("#css-none").text ());
|
287 |
-
$("select#block-alignment").val (
|
288 |
} else
|
289 |
-
if (alignment ==
|
290 |
$("#css-left").hide();
|
291 |
$("#custom-css").show().val ($("#css-left").text ());
|
292 |
-
$("select#block-alignment").val (
|
293 |
} else
|
294 |
-
if (alignment ==
|
295 |
$("#css-right").hide();
|
296 |
$("#custom-css").show().val ($("#css-right").text ());
|
297 |
-
$("select#block-alignment").val (
|
298 |
} else
|
299 |
-
if (alignment ==
|
300 |
$("#css-center").hide();
|
301 |
$("#custom-css").show().val ($("#css-center").text ());
|
302 |
-
$("select#block-alignment").val (
|
303 |
} else
|
304 |
-
if (alignment ==
|
305 |
$("#css-float-left").hide();
|
306 |
$("#custom-css").show().val ($("#css-float-left").text ());
|
307 |
-
$("select#block-alignment").val (
|
308 |
} else
|
309 |
-
if (alignment ==
|
310 |
$("#css-float-right").hide();
|
311 |
$("#custom-css").show().val ($("#css-float-right").text ());
|
312 |
-
$("select#block-alignment").val (
|
313 |
}
|
314 |
});
|
315 |
|
@@ -760,14 +772,14 @@ td.demo-wrapper-background {
|
|
760 |
</td>
|
761 |
<td style="width: 100%; height: 32px; padding:0;">
|
762 |
<input id="custom-css" style="width: 100%; display: inline-block; padding: 5px 0 0 0; border-radius: 4px; display: none; font-size: 12px; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" value="<?php echo $custom_css; ?>" size="70" maxlength="160" title="Custom CSS code for wrapping div" />
|
763 |
-
<span style="width: 100%; display: inline-block; padding: 5px 0 0 2px; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold;">
|
764 |
<span id="css-no-wrapping" style="vertical-align: middle; display: none;"></span>
|
765 |
-
<span id="css-none" style="vertical-align: middle; display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
766 |
-
<span id="css-left" style="vertical-align: middle;display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
767 |
-
<span id="css-right" style="vertical-align: middle;display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
768 |
-
<span id="css-center" style="vertical-align: middle;display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
769 |
-
<span id="css-float-left" style="vertical-align: middle;display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
770 |
-
<span id="css-float-right" style="vertical-align: middle;display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
771 |
</span>
|
772 |
</td>
|
773 |
<td padding:0;>
|
@@ -779,14 +791,14 @@ td.demo-wrapper-background {
|
|
779 |
<div style="margin: 20px 0;">
|
780 |
Block Alignment and Style:
|
781 |
<select style="border-radius: 5px; width:120px; height: 25px;" id="block-alignment">
|
782 |
-
<option value="<?php echo
|
783 |
-
<option value="<?php echo
|
784 |
-
<option value="<?php echo
|
785 |
-
<option value="<?php echo
|
786 |
-
<option value="<?php echo
|
787 |
-
<option value="<?php echo
|
788 |
-
<option value="<?php echo
|
789 |
-
<option value="<?php echo
|
790 |
</select>
|
791 |
</div>
|
792 |
</div>
|
16 |
<head>
|
17 |
<title><?php echo AD_INSERTER_NAME; ?> Code Preview</title>
|
18 |
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
19 |
+
<link rel='stylesheet' href='<?php echo plugins_url ('css/ad-inserter.css', __FILE__); ?>?ver=<?php echo AD_INSERTER_VERSION; ?>'>
|
20 |
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
|
21 |
<script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js'></script>
|
22 |
<link rel='stylesheet' href='https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css'>
|
23 |
+
<script src='<?php echo plugins_url ('includes/js/jquery.mousewheel.min.js', __FILE__); ?>?ver=<?php echo AD_INSERTER_VERSION; ?>'></script>
|
24 |
+
<script src='<?php echo plugins_url ('includes/js/jquery.ui.spinner.js', __FILE__); ?>?ver=<?php echo AD_INSERTER_VERSION; ?>'></script>
|
25 |
+
<link rel='stylesheet' href='<?php echo plugins_url ('css/jquery.ui.spinner.css', __FILE__); ?>?ver=<?php echo AD_INSERTER_VERSION; ?>'>
|
26 |
<script>
|
27 |
|
28 |
// initialize_preview ();
|
52 |
var spinner_padding_left;
|
53 |
var spinner_padding_right;
|
54 |
|
55 |
+
var AI_ALIGNMENT_DEFAULT = 0;
|
56 |
+
var AI_ALIGNMENT_LEFT = 1;
|
57 |
+
var AI_ALIGNMENT_RIGHT = 2;
|
58 |
+
var AI_ALIGNMENT_CENTER = 3;
|
59 |
+
var AI_ALIGNMENT_FLOAT_LEFT = 4;
|
60 |
+
var AI_ALIGNMENT_FLOAT_RIGHT = 5;
|
61 |
+
var AI_ALIGNMENT_NO_WRAPPING = 6;
|
62 |
+
var AI_ALIGNMENT_CUSTOM_CSS = 7;
|
63 |
+
|
64 |
function update_highlighting () {
|
65 |
if ($('body').hasClass ("highlighted")) {
|
66 |
$("#highlight-button").click ();
|
115 |
// }, 1000);
|
116 |
|
117 |
|
118 |
+
$("select#block-alignment").val (settings.find ("select#block-alignment-" + block + " option:selected").attr('value')).change();
|
119 |
$("#custom-css").val (settings.find ("#custom-css-" + block).val ());
|
120 |
$("#block-name").text (settings.find ("#name-label-" + block).text ());
|
121 |
|
127 |
if (window.opener != null && !window.opener.closed) {
|
128 |
var settings = $(window.opener.document).contents ();
|
129 |
|
130 |
+
settings.find ("select#block-alignment-" + block).val ($("select#block-alignment option:selected").attr('value')).change ();
|
131 |
settings.find ("#custom-css-" + block).val ($("#custom-css").val ());
|
132 |
window.opener.change_block_alignment (block);
|
133 |
}
|
167 |
update_highlighting ();
|
168 |
update_wrapper_size ();
|
169 |
}
|
170 |
+
}).spinner ("option", "mouseWheel", true).spinner ("option", "min", 0).spinner ("option", "max", 600).spinner ("value", parseInt (wrapper.css (css_parameter))).show ();
|
171 |
|
172 |
return spinner_element;
|
173 |
}
|
192 |
$("#demo-box-no-wrapping").hide ();
|
193 |
wrapping = true;
|
194 |
|
195 |
+
var alignment = $("select#block-alignment option:selected").attr('value');
|
196 |
|
197 |
+
if (alignment == AI_ALIGNMENT_NO_WRAPPING) {
|
198 |
$("#css-no-wrapping").css('display', 'inline-block');
|
199 |
$("#css-label").hide();
|
200 |
$("#edit-css-button").hide();
|
206 |
$("#demo-box-no-wrapping").show ();
|
207 |
|
208 |
} else
|
209 |
+
if (alignment == AI_ALIGNMENT_DEFAULT) {
|
210 |
$("#css-none").css('display', 'inline-block');
|
211 |
style = $("#css-none").text ();
|
212 |
} else
|
213 |
+
if (alignment == AI_ALIGNMENT_CUSTOM_CSS) {
|
214 |
$("#css-code").show();
|
215 |
$("#custom-css").show();
|
216 |
style = $("#custom-css").val ();
|
217 |
} else
|
218 |
+
if (alignment == AI_ALIGNMENT_LEFT) {
|
219 |
$("#css-left").css('display', 'inline-block');
|
220 |
style = $("#css-left").text ();
|
221 |
} else
|
222 |
+
if (alignment == AI_ALIGNMENT_RIGHT) {
|
223 |
$("#css-right").css('display', 'inline-block');
|
224 |
style = $("#css-right").text ();
|
225 |
} else
|
226 |
+
if (alignment == AI_ALIGNMENT_CENTER) {
|
227 |
$("#css-center").css('display', 'inline-block');
|
228 |
style = $("#css-center").text ();
|
229 |
} else
|
230 |
+
if (alignment == AI_ALIGNMENT_FLOAT_LEFT) {
|
231 |
$("#css-float-left").css('display', 'inline-block');
|
232 |
style = $("#css-float-left").text ();
|
233 |
} else
|
234 |
+
if (alignment == AI_ALIGNMENT_FLOAT_RIGHT) {
|
235 |
$("#css-float-right").css('display', 'inline-block');
|
236 |
style = $("#css-float-right").text ();
|
237 |
}
|
244 |
|
245 |
function update_custom_css () {
|
246 |
$("#custom-css").val ($("#wrapper").attr ("style"));
|
247 |
+
$("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
248 |
$("#edit-css-button").click ();
|
249 |
}
|
250 |
|
265 |
|
266 |
spinner_margin_top = create_spinner ("#spinner-margin-top", "margin-top", "horizontal").spinner ("option", "min", - $("#p1").outerHeight (true));
|
267 |
spinner_margin_bottom = create_spinner ("#spinner-margin-bottom", "margin-bottom", "horizontal").spinner ("option", "min", - $("#p1").outerHeight (true));
|
268 |
+
spinner_margin_left = create_spinner ("#spinner-margin-left", "margin-left", "vertical").spinner ("option", "min", - 600);
|
269 |
+
spinner_margin_right = create_spinner ("#spinner-margin-right", "margin-right", "vertical").spinner ("option", "min", - 600);
|
270 |
spinner_padding_top = create_spinner ("#spinner-padding-top", "padding-top", "horizontal");
|
271 |
spinner_padding_bottom = create_spinner ("#spinner-padding-bottom", "padding-bottom", "horizontal");
|
272 |
spinner_padding_left = create_spinner ("#spinner-padding-left", "padding-left", "vertical");
|
276 |
process_display_elements ();
|
277 |
});
|
278 |
|
279 |
+
$(".css-code").click (function () {
|
280 |
+
if (!$('#custom-css').is(':visible')) {
|
281 |
+
$("#edit-css-button").click ();
|
282 |
+
}
|
283 |
+
});
|
284 |
+
|
285 |
$("#edit-css-button").button ({
|
286 |
}).click (function () {
|
287 |
|
291 |
$("#css-float-left").hide();
|
292 |
$("#css-float-right").hide();
|
293 |
|
294 |
+
var alignment = $("select#block-alignment"+" option:selected").attr('value');
|
|
|
|
|
|
|
295 |
|
296 |
+
if (alignment == AI_ALIGNMENT_DEFAULT) {
|
297 |
$("#css-none").hide();
|
298 |
$("#custom-css").show().val ($("#css-none").text ());
|
299 |
+
$("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
300 |
} else
|
301 |
+
if (alignment == AI_ALIGNMENT_LEFT) {
|
302 |
$("#css-left").hide();
|
303 |
$("#custom-css").show().val ($("#css-left").text ());
|
304 |
+
$("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
305 |
} else
|
306 |
+
if (alignment == AI_ALIGNMENT_RIGHT) {
|
307 |
$("#css-right").hide();
|
308 |
$("#custom-css").show().val ($("#css-right").text ());
|
309 |
+
$("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
310 |
} else
|
311 |
+
if (alignment == AI_ALIGNMENT_CENTER) {
|
312 |
$("#css-center").hide();
|
313 |
$("#custom-css").show().val ($("#css-center").text ());
|
314 |
+
$("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
315 |
} else
|
316 |
+
if (alignment == AI_ALIGNMENT_FLOAT_LEFT) {
|
317 |
$("#css-float-left").hide();
|
318 |
$("#custom-css").show().val ($("#css-float-left").text ());
|
319 |
+
$("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
320 |
} else
|
321 |
+
if (alignment == AI_ALIGNMENT_FLOAT_RIGHT) {
|
322 |
$("#css-float-right").hide();
|
323 |
$("#custom-css").show().val ($("#css-float-right").text ());
|
324 |
+
$("select#block-alignment").val (AI_ALIGNMENT_CUSTOM_CSS).change();
|
325 |
}
|
326 |
});
|
327 |
|
772 |
</td>
|
773 |
<td style="width: 100%; height: 32px; padding:0;">
|
774 |
<input id="custom-css" style="width: 100%; display: inline-block; padding: 5px 0 0 0; border-radius: 4px; display: none; font-size: 12px; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" value="<?php echo $custom_css; ?>" size="70" maxlength="160" title="Custom CSS code for wrapping div" />
|
775 |
+
<span style="width: 100%; display: inline-block; padding: 5px 0 0 2px; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
|
776 |
<span id="css-no-wrapping" style="vertical-align: middle; display: none;"></span>
|
777 |
+
<span id="css-none" class="css-code" style="vertical-align: middle; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_DEFAULT); ?></span>
|
778 |
+
<span id="css-left" class="css-code" style="vertical-align: middle;display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_LEFT); ?></span>
|
779 |
+
<span id="css-right" class="css-code" style="vertical-align: middle;display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_RIGHT); ?></span>
|
780 |
+
<span id="css-center" class="css-code" style="vertical-align: middle;display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_CENTER); ?></span>
|
781 |
+
<span id="css-float-left" class="css-code" style="vertical-align: middle;display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_FLOAT_LEFT); ?></span>
|
782 |
+
<span id="css-float-right" class="css-code" style="vertical-align: middle;display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_FLOAT_RIGHT); ?></span>
|
783 |
</span>
|
784 |
</td>
|
785 |
<td padding:0;>
|
791 |
<div style="margin: 20px 0;">
|
792 |
Block Alignment and Style:
|
793 |
<select style="border-radius: 5px; width:120px; height: 25px;" id="block-alignment">
|
794 |
+
<option value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
|
795 |
+
<option value="<?php echo AI_ALIGNMENT_LEFT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
|
796 |
+
<option value="<?php echo AI_ALIGNMENT_CENTER; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
|
797 |
+
<option value="<?php echo AI_ALIGNMENT_RIGHT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
|
798 |
+
<option value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
|
799 |
+
<option value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
|
800 |
+
<option value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
|
801 |
+
<option value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" <?php echo ($alignment_type == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
|
802 |
</select>
|
803 |
</div>
|
804 |
</div>
|
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.
|
@@ -100,15 +100,31 @@ Please *support the plugin* if you like it:
|
|
100 |
= Using FTP =
|
101 |
|
102 |
1. Download `ad-inserter.zip`
|
103 |
-
2. Extract
|
104 |
-
3. Upload
|
105 |
4. Activate Ad Inserter in the Plugin dashboard
|
106 |
|
107 |
**Ad Inserter Pro Installation**
|
108 |
|
109 |
If you are using free Ad Inserter simply uninstall it. The Pro version will automatically import existing settings from the free version.
|
110 |
After you receive the email with download link for the Ad Inserter Pro plugin, download it, go to Wordpress Plugins, Add New, Upload Plugin, Choose file, click on Install Now,
|
111 |
-
activate it and then click "Enter License Key" and enter license key you got in the email.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
**Uninstall**
|
114 |
|
@@ -655,6 +671,17 @@ AD CODE RIGHT
|
|
655 |
|
656 |
== Changelog ==
|
657 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
= 2.0.12 =
|
659 |
- Bug fix for page/post exceptions list
|
660 |
|
@@ -957,6 +984,10 @@ AD CODE RIGHT
|
|
957 |
|
958 |
== Upgrade Notice ==
|
959 |
|
|
|
|
|
|
|
|
|
960 |
= 2.0.12 =
|
961 |
Bug fix for page/post exceptions list
|
962 |
|
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.12
|
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.
|
100 |
= Using FTP =
|
101 |
|
102 |
1. Download `ad-inserter.zip`
|
103 |
+
2. Extract `ad-inserter` directory to your computer
|
104 |
+
3. Upload `ad-inserter` directory to the `/wp-content/plugins/` directory
|
105 |
4. Activate Ad Inserter in the Plugin dashboard
|
106 |
|
107 |
**Ad Inserter Pro Installation**
|
108 |
|
109 |
If you are using free Ad Inserter simply uninstall it. The Pro version will automatically import existing settings from the free version.
|
110 |
After you receive the email with download link for the Ad Inserter Pro plugin, download it, go to Wordpress Plugins, Add New, Upload Plugin, Choose file, click on Install Now,
|
111 |
+
activate it and then click "Enter License Key" and enter license key you got in the email.
|
112 |
+
|
113 |
+
= Uploading plugin file =
|
114 |
+
|
115 |
+
1. Go to Wordpress Plugins menu, click Add New button
|
116 |
+
2. Click Upload Plugin
|
117 |
+
3. Select `ad-inserter-pro.zip` from your computer
|
118 |
+
4. Click 'Install Now'
|
119 |
+
5. Activate Ad Inserter Pro in the Plugin dashboard
|
120 |
+
|
121 |
+
= Using FTP =
|
122 |
+
|
123 |
+
1. Download `ad-inserter-pro.zip`
|
124 |
+
2. Extract `ad-inserter-pro` directory to your computer
|
125 |
+
3. Upload `ad-inserter-pro` directory to the `/wp-content/plugins/` directory
|
126 |
+
4. Activate Ad Inserter Pro in the Plugin dashboard
|
127 |
+
|
128 |
|
129 |
**Uninstall**
|
130 |
|
671 |
|
672 |
== Changelog ==
|
673 |
|
674 |
+
= 2.0.13 =
|
675 |
+
- Added icons for Automatic insertion and alignment
|
676 |
+
- Automatic insertion None changed to Disabled
|
677 |
+
- Alignment None changed to Default
|
678 |
+
- Changed database option data for Automatic insertion and Alignment settings
|
679 |
+
- Improved CSS 3 code for Left, Center and Right alignment
|
680 |
+
- Click on CSS code starts editing
|
681 |
+
- Page/Post exceptions listed in debug output
|
682 |
+
- Different plugin slug for Pro version
|
683 |
+
- Few minor bug fixes and cosmetic changes
|
684 |
+
|
685 |
= 2.0.12 =
|
686 |
- Bug fix for page/post exceptions list
|
687 |
|
984 |
|
985 |
== Upgrade Notice ==
|
986 |
|
987 |
+
= 2.0.13 =
|
988 |
+
Added icons for Automatic insertion and alignment; Changed database option data for Automatic insertion and Alignment settings;
|
989 |
+
Improved CSS 3 code for Left, Center and Right alignment; Few minor bug fixes and cosmetic changes;
|
990 |
+
|
991 |
= 2.0.12 =
|
992 |
Bug fix for page/post exceptions list
|
993 |
|
settings.php
CHANGED
@@ -35,7 +35,7 @@ function generate_settings_form (){
|
|
35 |
$default = $block_object [0];
|
36 |
|
37 |
$args = array (
|
38 |
-
'posts_per_page' =>
|
39 |
'offset' => 0,
|
40 |
'category' => '',
|
41 |
'category_name' => '',
|
@@ -184,11 +184,11 @@ function generate_settings_form (){
|
|
184 |
$manual [$ad_number] = ($manual_widget [$ad_number] && !empty ($sidebars_with_widget [$ad_number])) || $manual_shortcode [$ad_number] || $manual_php_function [$ad_number];
|
185 |
|
186 |
$ad_name = $obj->get_ad_name();
|
187 |
-
$automatic = $obj->
|
188 |
|
189 |
$ad_name_functions = false;
|
190 |
if ($automatic) {
|
191 |
-
$ad_name .= ": ".$obj->
|
192 |
$ad_name_functions = true;
|
193 |
}
|
194 |
|
@@ -271,10 +271,10 @@ function generate_settings_form (){
|
|
271 |
$show_misc = $scheduling_active || intval ($obj->get_maximum_insertions ()) != 0 || intval ($obj->get_call_filter()) != 0 || $obj->get_display_for_users() != AD_DISPLAY_ALL_USERS || $obj->get_enable_404 () == AD_SETTINGS_CHECKED || $obj->get_enable_feed () == AD_SETTINGS_CHECKED;
|
272 |
if ($show_misc) $misc_style = "font-weight: bold; color: #66f;"; else $misc_style = "";
|
273 |
|
274 |
-
$
|
275 |
|
276 |
-
$paragraph_settings = $
|
277 |
-
$content_settings = $
|
278 |
|
279 |
$paragraph_counting =
|
280 |
$obj->get_direction_type() != $default->get_direction_type() ||
|
@@ -336,49 +336,51 @@ function generate_settings_form (){
|
|
336 |
<div style="padding:8px 8px 6px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
|
337 |
<div style="float: left;">
|
338 |
Automatic Insertion:
|
339 |
-
<select style="border-radius: 5px; margin-bottom: 3px;" id="display-type-<?php echo $ad_number; ?>" name="<?php echo
|
340 |
-
<option value="<?php echo
|
341 |
-
<option value="<?php echo
|
342 |
-
<option value="<?php echo
|
343 |
-
<option value="<?php echo
|
344 |
-
<option value="<?php echo
|
345 |
-
<option value="<?php echo
|
346 |
-
<option value="<?php echo
|
347 |
-
<option value="<?php echo
|
348 |
-
<option value="<?php echo
|
349 |
-
<option value="<?php echo
|
350 |
</select>
|
351 |
</div>
|
352 |
|
353 |
<div style="float: right;">
|
354 |
-
|
355 |
<select style="border-radius: 5px; width:120px;" id="block-alignment-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ALIGNMENT_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_alignment_type(); ?>">
|
356 |
-
<option value="<?php echo
|
357 |
-
<option value="<?php echo
|
358 |
-
<option value="<?php echo
|
359 |
-
<option value="<?php echo
|
360 |
-
<option value="<?php echo
|
361 |
-
<option value="<?php echo
|
362 |
-
<option value="<?php echo
|
363 |
-
<option value="<?php echo
|
364 |
</select>
|
365 |
|
366 |
-
<button id="show-css-button-<?php echo $ad_number; ?>" type="button" style="min-width:
|
367 |
</div>
|
368 |
<div style="clear: both;"></div>
|
369 |
|
370 |
-
<div id="css-code-<?php echo $ad_number; ?>" style="height:
|
|
|
|
|
371 |
<div class="max-input">
|
372 |
<span id="css-label-<?php echo $ad_number; ?>" style="display: table-cell; width: 34px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0;">CSS </span>
|
373 |
<input id="custom-css-<?php echo $ad_number; ?>" style="width: 100%; border-radius: 4px; display: none; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" name="<?php echo AI_OPTION_CUSTOM_CSS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_custom_css(); ?>" value="<?php echo $obj->get_custom_css(); ?>" maxlength="160" title="Custom CSS code for wrapping div" />
|
374 |
-
<span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold;">
|
375 |
-
<span id="css-no-wrapping-<?php echo $ad_number; ?>" style="height: 18px; padding-left: 7px; display: none;"></span>
|
376 |
-
<span id="css-none-<?php echo $ad_number; ?>" style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
377 |
-
<span id="css-left-<?php echo $ad_number; ?>" style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
378 |
-
<span id="css-right-<?php echo $ad_number; ?>" style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
379 |
-
<span id="css-center-<?php echo $ad_number; ?>" style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
380 |
-
<span id="css-float-left-<?php echo $ad_number; ?>" style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
381 |
-
<span id="css-float-right-<?php echo $ad_number; ?>" style="height: 18px; padding-right: 7px; display: none;" title="CSS code for wrapping div"><?php echo $obj->alignmet_style (
|
382 |
</span>
|
383 |
<span style="display:table-cell; width: 46px;" ><button id="edit-css-button-<?php echo $ad_number; ?>" type="button" style="display: table-cell; padding: 0; margin: 0 0 0 8px;">Edit</button></span>
|
384 |
</div>
|
35 |
$default = $block_object [0];
|
36 |
|
37 |
$args = array (
|
38 |
+
'posts_per_page' => 100,
|
39 |
'offset' => 0,
|
40 |
'category' => '',
|
41 |
'category_name' => '',
|
184 |
$manual [$ad_number] = ($manual_widget [$ad_number] && !empty ($sidebars_with_widget [$ad_number])) || $manual_shortcode [$ad_number] || $manual_php_function [$ad_number];
|
185 |
|
186 |
$ad_name = $obj->get_ad_name();
|
187 |
+
$automatic = $obj->get_automatic_insertion() != AI_AUTOMATIC_INSERTION_DISABLED;
|
188 |
|
189 |
$ad_name_functions = false;
|
190 |
if ($automatic) {
|
191 |
+
$ad_name .= ": ".$obj->get_automatic_insertion_text ();
|
192 |
$ad_name_functions = true;
|
193 |
}
|
194 |
|
271 |
$show_misc = $scheduling_active || intval ($obj->get_maximum_insertions ()) != 0 || intval ($obj->get_call_filter()) != 0 || $obj->get_display_for_users() != AD_DISPLAY_ALL_USERS || $obj->get_enable_404 () == AD_SETTINGS_CHECKED || $obj->get_enable_feed () == AD_SETTINGS_CHECKED;
|
272 |
if ($show_misc) $misc_style = "font-weight: bold; color: #66f;"; else $misc_style = "";
|
273 |
|
274 |
+
$automatic_insertion = $obj->get_automatic_insertion();
|
275 |
|
276 |
+
$paragraph_settings = $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH || $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH;
|
277 |
+
$content_settings = $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH || $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH || $automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT || $automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT;
|
278 |
|
279 |
$paragraph_counting =
|
280 |
$obj->get_direction_type() != $default->get_direction_type() ||
|
336 |
<div style="padding:8px 8px 6px 8px; margin: 8px 0; border: 1px solid #ddd; border-radius: 5px;">
|
337 |
<div style="float: left;">
|
338 |
Automatic Insertion:
|
339 |
+
<select style="border-radius: 5px; margin-bottom: 3px;" id="display-type-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_AUTOMATIC_INSERTION, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_automatic_insertion(); ?>" style="width:200px;">
|
340 |
+
<option data-img-src="<?php echo plugins_url ('images/disabled.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_DISABLED; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_DISABLED) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DISABLED; ?></option>
|
341 |
+
<option data-img-src="<?php echo plugins_url ('images/before-post.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_POST; ?></option>
|
342 |
+
<option data-img-src="<?php echo plugins_url ('images/before-content.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_CONTENT; ?></option>
|
343 |
+
<option data-img-src="<?php echo plugins_url ('images/before-paragraph.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_PARAGRAPH) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_PARAGRAPH; ?></option>
|
344 |
+
<option data-img-src="<?php echo plugins_url ('images/after-paragraph.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_PARAGRAPH) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_PARAGRAPH; ?></option>
|
345 |
+
<option data-img-src="<?php echo plugins_url ('images/after-content.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_CONTENT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_CONTENT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_CONTENT; ?></option>
|
346 |
+
<option data-img-src="<?php echo plugins_url ('images/after-post.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_POST; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_POST) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_POST; ?></option>
|
347 |
+
<option data-img-src="<?php echo plugins_url ('images/before-excerpt.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BEFORE_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BEFORE_EXCERPT; ?></option>
|
348 |
+
<option data-img-src="<?php echo plugins_url ('images/after-excerpt.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_AFTER_EXCERPT; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_AFTER_EXCERPT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_AFTER_EXCERPT; ?></option>
|
349 |
+
<option data-img-src="<?php echo plugins_url ('images/between-posts.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_AUTOMATIC_INSERTION_BETWEEN_POSTS; ?>" <?php echo ($automatic_insertion == AI_AUTOMATIC_INSERTION_BETWEEN_POSTS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_BETWEEN_POSTS; ?></option>
|
350 |
</select>
|
351 |
</div>
|
352 |
|
353 |
<div style="float: right;">
|
354 |
+
Alignment and Style:
|
355 |
<select style="border-radius: 5px; width:120px;" id="block-alignment-<?php echo $ad_number; ?>" name="<?php echo AI_OPTION_ALIGNMENT_TYPE, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_alignment_type(); ?>">
|
356 |
+
<option data-img-src="<?php echo plugins_url ('images/default.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_DEFAULT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_DEFAULT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_DEFAULT; ?></option>
|
357 |
+
<option data-img-src="<?php echo plugins_url ('images/align-left.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_LEFT; ?></option>
|
358 |
+
<option data-img-src="<?php echo plugins_url ('images/center.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_CENTER; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CENTER) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CENTER; ?></option>
|
359 |
+
<option data-img-src="<?php echo plugins_url ('images/align-right.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_RIGHT; ?></option>
|
360 |
+
<option data-img-src="<?php echo plugins_url ('images/float-left.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_FLOAT_LEFT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_LEFT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_LEFT; ?></option>
|
361 |
+
<option data-img-src="<?php echo plugins_url ('images/float-right.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_FLOAT_RIGHT; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_FLOAT_RIGHT) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_FLOAT_RIGHT; ?></option>
|
362 |
+
<option data-img-src="<?php echo plugins_url ('images/custom-css.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_CUSTOM_CSS; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_CUSTOM_CSS) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_CUSTOM_CSS; ?></option>
|
363 |
+
<option data-img-src="<?php echo plugins_url ('images/no-wrapping.png', __FILE__); ?>" data-img-class="automatic-insertion" value="<?php echo AI_ALIGNMENT_NO_WRAPPING; ?>" <?php echo ($obj->get_alignment_type() == AI_ALIGNMENT_NO_WRAPPING) ? AD_SELECT_SELECTED : AD_EMPTY_VALUE; ?>><?php echo AI_TEXT_NO_WRAPPING; ?></option>
|
364 |
</select>
|
365 |
|
366 |
+
<button id="show-css-button-<?php echo $ad_number; ?>" type="button" style="min-width: 60px; margin-right: 0px;">Show</button>
|
367 |
</div>
|
368 |
<div style="clear: both;"></div>
|
369 |
|
370 |
+
<div id="css-code-<?php echo $ad_number; ?>" style="height: 190px; margin: 4px 0 2px; display: none;">
|
371 |
+
<div id="automatic-insertion-<?php echo $ad_number; ?>"></div>
|
372 |
+
<div id="alignment-style-<?php echo $ad_number; ?>" style="margin-bottom: 4px;"></div>
|
373 |
<div class="max-input">
|
374 |
<span id="css-label-<?php echo $ad_number; ?>" style="display: table-cell; width: 34px; padding: 0; height: 26px; vertical-align: middle; margin: 4px 0 0 0;">CSS </span>
|
375 |
<input id="custom-css-<?php echo $ad_number; ?>" style="width: 100%; border-radius: 4px; display: none; font-family: Courier, 'Courier New', monospace; font-weight: bold;" type="text" name="<?php echo AI_OPTION_CUSTOM_CSS, WP_FORM_FIELD_POSTFIX, $ad_number; ?>" default="<?php echo $default->get_custom_css(); ?>" value="<?php echo $obj->get_custom_css(); ?>" maxlength="160" title="Custom CSS code for wrapping div" />
|
376 |
+
<span style="display: table-cell; vertical-align: middle; font-family: Courier, 'Courier New', monospace; font-size: 12px; font-weight: bold; cursor: pointer;">
|
377 |
+
<span id="css-no-wrapping-<?php echo $ad_number; ?>" class='css-code' style="height: 18px; padding-left: 7px; display: none;"></span>
|
378 |
+
<span id="css-none-<?php echo $ad_number; ?>" class='css-code-<?php echo $ad_number; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_DEFAULT); ?></span>
|
379 |
+
<span id="css-left-<?php echo $ad_number; ?>" class='css-code-<?php echo $ad_number; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_LEFT); ?></span>
|
380 |
+
<span id="css-right-<?php echo $ad_number; ?>" class='css-code-<?php echo $ad_number; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_RIGHT); ?></span>
|
381 |
+
<span id="css-center-<?php echo $ad_number; ?>" class='css-code-<?php echo $ad_number; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_CENTER); ?></span>
|
382 |
+
<span id="css-float-left-<?php echo $ad_number; ?>" class='css-code-<?php echo $ad_number; ?>' style="height: 18px; padding-left: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_FLOAT_LEFT); ?></span>
|
383 |
+
<span id="css-float-right-<?php echo $ad_number; ?>" class='css-code-<?php echo $ad_number; ?>' style="height: 18px; padding-right: 7px; display: none;" title="CSS code for wrapping div, click to edit"><?php echo $obj->alignmet_style (AI_ALIGNMENT_FLOAT_RIGHT); ?></span>
|
384 |
</span>
|
385 |
<span style="display:table-cell; width: 46px;" ><button id="edit-css-button-<?php echo $ad_number; ?>" type="button" style="display: table-cell; padding: 0; margin: 0 0 0 8px;">Edit</button></span>
|
386 |
</div>
|