Version Description
Download this release
Release Info
Developer | namith.jawahar |
Plugin | Wp-Insert |
Version | 2.4.4 |
Comparing to | |
See all releases |
Code changes from version 2.4.3 to 2.4.4
- includes/modules/core/controlpanel/module.php +2 -2
- includes/modules/core/gutenberg/js/gutenberg.js +92 -0
- includes/modules/core/gutenberg/module.php +74 -0
- includes/modules/core/modules.php +1 -0
- includes/modules/core/units/module.php +2 -2
- includes/modules/general/inpost/module.php +107 -66
- includes/modules/general/shortcode/module.php +3 -2
- readme.txt +3 -1
- wp-insert.php +1 -1
includes/modules/core/controlpanel/module.php
CHANGED
@@ -52,11 +52,11 @@ add_action('wp_insert_plugin_card', 'wp_insert_title_plugin_card', 0);
|
|
52 |
function wp_insert_title_plugin_card() {
|
53 |
echo '<div class="plugin-card">';
|
54 |
echo '<div class="plugin-card-top">';
|
55 |
-
echo '<a id="wpInsertLogo" href="
|
56 |
echo '</div>';
|
57 |
echo '<div class="plugin-card-bottom">';
|
58 |
echo '<div id="wpInsertMeta">';
|
59 |
-
echo '<p><b>Donate :</b><br /><a target="_blank" href="
|
60 |
echo '<p><b>Like Us :</b><br /><a target="_blank" href="https://www.facebook.com/SmartLogix/">Click here</a> to like and support us on Facebook</p>';
|
61 |
echo '<div style="font-size: 16px; font-weight: 600; background: #FFFFAA; display: block; padding: 10px; text-align: justify; border: 1px dashed #FF0000; margin: 10px 0 0; border-radius: 5px;">Thanks for using Wp-Insert. Positive <a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/wp-insert#postform">reviews</a> are a great motivation for us to add new features, fix bugs and spend more time working on Wp-Insert.<br />Looking forward to your continued support and patronage - <i>Namith Jawahar</i>.</div>';
|
62 |
echo '</div>';
|
52 |
function wp_insert_title_plugin_card() {
|
53 |
echo '<div class="plugin-card">';
|
54 |
echo '<div class="plugin-card-top">';
|
55 |
+
echo '<a id="wpInsertLogo" href="https://www.wpinsert.smartlogix.co.in"><img src="'.WP_INSERT_URL.'/includes/assets/images/header-banner.png?'.WP_INSERT_VERSION.'" /></a>';
|
56 |
echo '</div>';
|
57 |
echo '<div class="plugin-card-bottom">';
|
58 |
echo '<div id="wpInsertMeta">';
|
59 |
+
echo '<p><b>Donate :</b><br /><a target="_blank" href="https://wpinsert.smartlogix.co.in/support/">Click Here</a> to Donate and Promote further development of this plugin.</p>';
|
60 |
echo '<p><b>Like Us :</b><br /><a target="_blank" href="https://www.facebook.com/SmartLogix/">Click here</a> to like and support us on Facebook</p>';
|
61 |
echo '<div style="font-size: 16px; font-weight: 600; background: #FFFFAA; display: block; padding: 10px; text-align: justify; border: 1px dashed #FF0000; margin: 10px 0 0; border-radius: 5px;">Thanks for using Wp-Insert. Positive <a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/wp-insert#postform">reviews</a> are a great motivation for us to add new features, fix bugs and spend more time working on Wp-Insert.<br />Looking forward to your continued support and patronage - <i>Namith Jawahar</i>.</div>';
|
62 |
echo '</div>';
|
includes/modules/core/gutenberg/js/gutenberg.js
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var wpInsertIconData = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUAgMAAADw5/WeAAAABGdBTUEAALGPC/xhBQAAACBjSFJN AAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAADFBMVEX/////AAAAAAD///+x fSgUAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElN RQfiCwMTIix5N7k8AAAAVElEQVQI102NsQ3AMAzDmAI5IU/0ipzgIf6np2gMfGXtdKkHQpAAGqBR 1yd37GFEyBeb5o7omTWHGzL3iTzr4jo0FechP35NralW2riU5nTnl4jnBSBgIy0jtaVeAAAAJXRF WHRkYXRlOmNyZWF0ZQAyMDE4LTExLTA0VDAyOjM0OjQ0LTA3OjAwblAMKwAAACV0RVh0ZGF0ZTpt b2RpZnkAMjAxOC0xMS0wNFQwMjozNDo0NC0wNzowMB8NtJcAAAAASUVORK5CYII=';
|
2 |
+
var wpInsertAdData = [];
|
3 |
+
wp.blocks.registerBlockType('wp-insert/wp-insert-gutenberg', {
|
4 |
+
title: 'Wp-Insert Ad Unit',
|
5 |
+
icon: wp.element.createElement('img', { width: 20, height: 20, src: wpInsertIconData}),
|
6 |
+
category: 'embed',
|
7 |
+
attributes: {
|
8 |
+
adID: {
|
9 |
+
type: 'string',
|
10 |
+
},
|
11 |
+
adType: {
|
12 |
+
type: 'string',
|
13 |
+
},
|
14 |
+
},
|
15 |
+
edit: function(props) {
|
16 |
+
wp_insert_gutenberg_get_data();
|
17 |
+
var options = {
|
18 |
+
'inpostads': [],
|
19 |
+
'shortcodeads': []
|
20 |
+
};
|
21 |
+
var inpostadsCount = 0, shortcodeadsCount = 0;
|
22 |
+
for(var i = 0; i < wpInsertAdData.length; i++) {
|
23 |
+
options[wpInsertAdData[i].type].push(wp.element.createElement('option', {value: wpInsertAdData[i].id, 'data-type': wpInsertAdData[i].type}, wpInsertAdData[i].title));
|
24 |
+
if(wpInsertAdData[i].type == 'inpostads') {
|
25 |
+
inpostadsCount++;
|
26 |
+
} else if(wpInsertAdData[i].type == 'shortcodeads') {
|
27 |
+
shortcodeadsCount++;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
if((inpostadsCount > 0) || (shortcodeadsCount > 0)) {
|
31 |
+
var optGroup = [];
|
32 |
+
if(inpostadsCount > 0) {
|
33 |
+
optGroup[0] = wp.element.createElement('optgroup', {label: 'In-Post Ads'}, options['inpostads']);
|
34 |
+
}
|
35 |
+
if(shortcodeadsCount > 0) {
|
36 |
+
optGroup[1] = wp.element.createElement('optgroup', {label: 'Shortcode Ads'}, options['shortcodeads']);
|
37 |
+
};
|
38 |
+
return wp.element.createElement('div', {
|
39 |
+
className: props.className,
|
40 |
+
style: {border: '1px solid #dddddd', backgroundColor: '#fafafa', padding: '20px'},
|
41 |
+
value: props.attributes.adID,
|
42 |
+
}, wp.element.createElement('img', {width: 20, height: 20, style: {cssFloat: 'left'}, src: wpInsertIconData}),
|
43 |
+
wp.element.createElement('p', {style: {cssFloat: 'left', fontSize: '18px', fontWeight: 'bold', margin: '0 0 10px 8px', lineHeight: '20px', fontFamily: 'arial'}}, 'Wp-Insert'),
|
44 |
+
wp.element.createElement('p', {style: {clear: 'both', fontSize: '12px', fontFamily: 'arial', margin: '0 0 5px'}}, 'Select your Ad Unit'),
|
45 |
+
wp.element.createElement('select', {
|
46 |
+
value: props.attributes.adID,
|
47 |
+
className: 'input widefat',
|
48 |
+
style: {height: '44px', fontSize: '18px', padding: '5px'},
|
49 |
+
onChange: function(element) {
|
50 |
+
props.setAttributes({adID: element.target[element.target.selectedIndex].value});
|
51 |
+
props.setAttributes({adType: element.target[element.target.selectedIndex].getAttribute('data-type')});
|
52 |
+
}
|
53 |
+
}, optGroup),
|
54 |
+
);
|
55 |
+
} else {
|
56 |
+
return wp.element.createElement('div', {
|
57 |
+
className: props.className,
|
58 |
+
style: {border: '1px solid #dddddd', backgroundColor: '#fafafa', padding: '20px'},
|
59 |
+
value: props.attributes.adID,
|
60 |
+
}, wp.element.createElement('img', {width: 20, height: 20, style: {cssFloat: 'left'}, src: wpInsertIconData}),
|
61 |
+
wp.element.createElement('p', {style: {cssFloat: 'left', fontSize: '18px', fontWeight: 'bold', margin: '0 0 10px 8px', lineHeight: '20px', fontFamily: 'arial'}}, 'Wp-Insert'),
|
62 |
+
wp.element.createElement('p', {style: {clear: 'both', fontSize: '12px', fontFamily: 'arial', margin: '0 0 5px'}}, 'Please create an Ad Unit from Wp-Insert settings page to use this feature.'),
|
63 |
+
);
|
64 |
+
}
|
65 |
+
},
|
66 |
+
save: function(props) {
|
67 |
+
if(props.attributes.adType == 'inpostads') {
|
68 |
+
return '[wpinsertinpostad id="'+props.attributes.adID+'"]';
|
69 |
+
} else if(props.attributes.adType == 'shortcodeads') {
|
70 |
+
return '[wpinsertshortcodead id="'+props.attributes.adID+'"]';
|
71 |
+
} else {
|
72 |
+
return '';
|
73 |
+
}
|
74 |
+
}
|
75 |
+
});
|
76 |
+
|
77 |
+
jQuery(document).ready(function() {
|
78 |
+
wp_insert_gutenberg_get_data();
|
79 |
+
});
|
80 |
+
|
81 |
+
function wp_insert_gutenberg_get_data() {
|
82 |
+
jQuery.post(
|
83 |
+
jQuery('#wp_insert_gutenberg_admin_ajax').val(), {
|
84 |
+
'action': 'wp_insert_gutenberg_get_ad_data',
|
85 |
+
'wp_insert_gutenberg_nonce': jQuery('#wp_insert_gutenberg_nonce').val()
|
86 |
+
}, function(response) {
|
87 |
+
if(response.indexOf('###SUCCESS###') !== -1) {
|
88 |
+
wpInsertAdData = jQuery.parseJSON(response.replace('###SUCCESS###', ''));
|
89 |
+
}
|
90 |
+
}
|
91 |
+
);
|
92 |
+
}
|
includes/modules/core/gutenberg/module.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
add_action('init', 'wp_insert_gutenberg_block_init');
|
3 |
+
function wp_insert_gutenberg_block_init() {
|
4 |
+
if(function_exists('register_block_type')) {
|
5 |
+
wp_register_script('wp_insert_gutenberg', WP_INSERT_URL.'includes/modules/core/gutenberg/js/gutenberg.js', array('wp-blocks', 'wp-editor', 'wp-element'), WP_INSERT_VERSION.rand(0,9999));
|
6 |
+
register_block_type('wp-insert/wp-insert-gutenberg', array('editor_script' => 'wp_insert_gutenberg',));
|
7 |
+
}
|
8 |
+
}
|
9 |
+
|
10 |
+
add_action('admin_footer-post-new.php', 'wp_insert_gutenberg_admin_footer');
|
11 |
+
add_action('admin_footer-post.php', 'wp_insert_gutenberg_admin_footer');
|
12 |
+
function wp_insert_gutenberg_admin_footer() {
|
13 |
+
echo '<input type="hidden" id="wp_insert_gutenberg_admin_ajax" name="wp_insert_admin_ajax" value="'.admin_url('admin-ajax.php').'" />';
|
14 |
+
echo '<input type="hidden" id="wp_insert_gutenberg_nonce" name="wp_insert_nonce" value="'.wp_create_nonce('wp-insert-gutenberg').'" />';
|
15 |
+
}
|
16 |
+
|
17 |
+
add_action('wp_ajax_wp_insert_gutenberg_get_ad_data', 'wp_insert_gutenberg_get_ad_data');
|
18 |
+
function wp_insert_gutenberg_get_ad_data() {
|
19 |
+
check_ajax_referer('wp-insert-gutenberg', 'wp_insert_gutenberg_nonce');
|
20 |
+
$adData = array();
|
21 |
+
$inpostads = get_option('wp_insert_inpostads');
|
22 |
+
if(isset($inpostads) && is_array($inpostads)) {
|
23 |
+
foreach($inpostads as $key => $inpostad) {
|
24 |
+
/* Begin Workaround for migrating old users to new system (can be removed in a later version) */
|
25 |
+
$title = $key;
|
26 |
+
if(!isset($inpostad['title']) || ($inpostad['title'] == '')) {
|
27 |
+
switch($key) {
|
28 |
+
case 'above':
|
29 |
+
$title = 'Above Post Content';
|
30 |
+
break;
|
31 |
+
case 'middle':
|
32 |
+
$title = 'Middle of Post Content';
|
33 |
+
break;
|
34 |
+
case 'below':
|
35 |
+
$title = 'Below Post Content';
|
36 |
+
break;
|
37 |
+
case 'left':
|
38 |
+
$title = 'To the Left of Post Content';
|
39 |
+
break;
|
40 |
+
case 'right':
|
41 |
+
$title = 'To the Right of Post Content';
|
42 |
+
break;
|
43 |
+
}
|
44 |
+
} else {
|
45 |
+
$title = $inpostad['title'];
|
46 |
+
}
|
47 |
+
/* End Workaround for migrating old users to new system (can be removed in a later version) */
|
48 |
+
$adData[] = array(
|
49 |
+
'type' => 'inpostads',
|
50 |
+
'id' => $key,
|
51 |
+
'title' => 'In-Post Ad : '.$title,
|
52 |
+
);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
$shortcodeads = get_option('wp_insert_shortcodeads');
|
57 |
+
if(isset($shortcodeads) && is_array($shortcodeads)) {
|
58 |
+
foreach($shortcodeads as $key => $shortcodead) {
|
59 |
+
$title = $shortcodead['title'];
|
60 |
+
if(!isset($shortcodead['title']) || ($shortcodead['title'] == '')) {
|
61 |
+
$title = $key;
|
62 |
+
}
|
63 |
+
$adData[] = array(
|
64 |
+
'type' => 'shortcodeads',
|
65 |
+
'id' => $key,
|
66 |
+
'title' => 'Shortcode Ad : '.$title,
|
67 |
+
);
|
68 |
+
}
|
69 |
+
}
|
70 |
+
echo '###SUCCESS###';
|
71 |
+
echo json_encode($adData);
|
72 |
+
die();
|
73 |
+
}
|
74 |
+
?>
|
includes/modules/core/modules.php
CHANGED
@@ -5,4 +5,5 @@ require_once(dirname(__FILE__).'/controlpanel/module.php');
|
|
5 |
require_once(dirname(__FILE__).'/units/module.php');
|
6 |
require_once(dirname(__FILE__).'/abtesting/module.php');
|
7 |
require_once(dirname(__FILE__).'/misc/module.php');
|
|
|
8 |
?>
|
5 |
require_once(dirname(__FILE__).'/units/module.php');
|
6 |
require_once(dirname(__FILE__).'/abtesting/module.php');
|
7 |
require_once(dirname(__FILE__).'/misc/module.php');
|
8 |
+
require_once(dirname(__FILE__).'/gutenberg/module.php');
|
9 |
?>
|
includes/modules/core/units/module.php
CHANGED
@@ -52,9 +52,9 @@ function wp_insert_get_plugin_card($title, $description, $type, $preTitle) {
|
|
52 |
}
|
53 |
/* End Workaround for migrating old users to new system (can be removed in a later version) */
|
54 |
echo '<p>';
|
55 |
-
echo '<a class="wp_insert_ad_unit_title" title="Edit Ad Unit" id="wp_insert_'.$type.'_ad_'.$key.'" href="javascript:;" data-pre-title="'.$preTitle.'" onclick="wp_insert_ads_click_handler(\''.$type.'\', \''.$key.'\', \''.$
|
56 |
echo '<span class="dashicons dashicons-no wp_insert_delete_icon" title="Delete Ad Unit" onclick="wp_insert_ad_delete_handler(\''.$type.'\', \''.$key.'\')"></span>';
|
57 |
-
echo '<span class="dashicons dashicons-format-gallery wp_insert_duplicate_icon" title="Duplicate Ad Unit" onclick="wp_insert_ads_click_handler(\''.$type.'\', \'###DUPLICATE###'.$key.'\', \''.$
|
58 |
echo '</p>';
|
59 |
}
|
60 |
}
|
52 |
}
|
53 |
/* End Workaround for migrating old users to new system (can be removed in a later version) */
|
54 |
echo '<p>';
|
55 |
+
echo '<a class="wp_insert_ad_unit_title" title="Edit Ad Unit" id="wp_insert_'.$type.'_ad_'.$key.'" href="javascript:;" data-pre-title="'.$preTitle.'" onclick="wp_insert_ads_click_handler(\''.$type.'\', \''.$key.'\', \''.$title.'\', false)">'.$preTitle.' : '.$title.'</a>';
|
56 |
echo '<span class="dashicons dashicons-no wp_insert_delete_icon" title="Delete Ad Unit" onclick="wp_insert_ad_delete_handler(\''.$type.'\', \''.$key.'\')"></span>';
|
57 |
+
echo '<span class="dashicons dashicons-format-gallery wp_insert_duplicate_icon" title="Duplicate Ad Unit" onclick="wp_insert_ads_click_handler(\''.$type.'\', \'###DUPLICATE###'.$key.'\', \''.$title.' Duplicate\', true)"></span>';
|
58 |
echo '</p>';
|
59 |
}
|
60 |
}
|
includes/modules/general/inpost/module.php
CHANGED
@@ -94,7 +94,20 @@ add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_
|
|
94 |
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_geo_targeting', 40, 3);
|
95 |
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_devices_styles', 50, 3);
|
96 |
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_notes', 60, 3);
|
97 |
-
add_filter('wp_insert_inpostads_form_accordion_tabs', '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
function wp_insert_inpostads_form_accordion_tabs_positioning($control, $identifier, $location) {
|
99 |
echo '<h3 class="wp_insert_inpostads_location_middle_panel">Positioning</h3>';
|
100 |
echo '<div>';
|
@@ -111,85 +124,100 @@ function wp_insert_inpostads_form_accordion_tabs_positioning($control, $identifi
|
|
111 |
/* Begin In-Post Ads Ad Insertion */
|
112 |
add_filter('the_content', 'wp_insert_inpostads_the_content', 100);
|
113 |
function wp_insert_inpostads_the_content($content) {
|
|
|
114 |
if(!is_feed() && is_main_query()) {
|
115 |
$inpostads = get_option('wp_insert_inpostads');
|
116 |
if(isset($inpostads) && is_array($inpostads)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
$paragraphCount = wp_insert_inpostads_get_paragraph_count($content);
|
118 |
foreach($inpostads as $key => $inpostad) {
|
119 |
-
if(!
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
139 |
}
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
if(($inpostad['minimum_character_count'] == 0) || ($inpostad['minimum_character_count'] == '')) {
|
156 |
-
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
157 |
-
} else {
|
158 |
-
if(strlen(strip_tags($content)) > $inpostad['minimum_character_count']) {
|
159 |
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
|
|
|
|
|
|
|
|
160 |
}
|
161 |
}
|
162 |
}
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $inpostad['paragraphtopposition']);
|
177 |
-
if($position) {
|
178 |
-
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
179 |
-
}
|
180 |
-
}
|
181 |
-
break;
|
182 |
-
case 'paragraphbottom':
|
183 |
-
if($paragraphCount > 1) {
|
184 |
-
$paragraphbottomposition = ($paragraphCount - (int)$inpostad['paragraphbottomposition']);
|
185 |
-
if(($paragraphbottomposition > 0) && ($paragraphbottomposition < $paragraphCount)) {
|
186 |
-
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $paragraphbottomposition);
|
187 |
if($position) {
|
188 |
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
189 |
}
|
190 |
}
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
}
|
194 |
}
|
195 |
}
|
@@ -226,4 +254,17 @@ function wp_insert_inpostads_get_insertion_position($search, $string, $offset) {
|
|
226 |
}
|
227 |
}
|
228 |
/* End In-Post Ads Ad Insertion */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
?>
|
94 |
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_geo_targeting', 40, 3);
|
95 |
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_devices_styles', 50, 3);
|
96 |
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_notes', 60, 3);
|
97 |
+
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_inpostads_form_accordion_tabs_manual_override', 70, 3);
|
98 |
+
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_inpostads_form_accordion_tabs_positioning', 80, 3);
|
99 |
+
|
100 |
+
function wp_insert_inpostads_form_accordion_tabs_manual_override($control, $identifier, $location) {
|
101 |
+
echo '<h3 class="wp_insert_inpostads_location_manual_override_panel">Manual Override</h3>';
|
102 |
+
echo '<div>';
|
103 |
+
$control->set_HTML('<p class="codeSnippet"><code>[wpinsertinpostad id="'.$identifier.'"]</code></p><p>For those extreme cases when auto positioning just doesnt work out the way you want, use the shortcode above to precisely position your ad unit inside your post content.<br>Gutenberg users can utilize "Wp-Insert" blocks for manual positioning within post content.</p>');
|
104 |
+
$control->create_section('Code to add to your post/page content');
|
105 |
+
echo $control->HTML;
|
106 |
+
$control->clear_controls();
|
107 |
+
echo '</div>';
|
108 |
+
return $control;
|
109 |
+
}
|
110 |
+
|
111 |
function wp_insert_inpostads_form_accordion_tabs_positioning($control, $identifier, $location) {
|
112 |
echo '<h3 class="wp_insert_inpostads_location_middle_panel">Positioning</h3>';
|
113 |
echo '<div>';
|
124 |
/* Begin In-Post Ads Ad Insertion */
|
125 |
add_filter('the_content', 'wp_insert_inpostads_the_content', 100);
|
126 |
function wp_insert_inpostads_the_content($content) {
|
127 |
+
global $post;
|
128 |
if(!is_feed() && is_main_query()) {
|
129 |
$inpostads = get_option('wp_insert_inpostads');
|
130 |
if(isset($inpostads) && is_array($inpostads)) {
|
131 |
+
$shortcodeInsertions = array();
|
132 |
+
if(preg_match_all('/'.get_shortcode_regex().'/s', $post->post_content, $matches) && array_key_exists(2, $matches) && in_array('wpinsertinpostad', $matches[2])) {
|
133 |
+
foreach($matches[2] as $key => $value) {
|
134 |
+
if('wpinsertinpostad' === $value) {
|
135 |
+
$shortcodeAtts = shortcode_parse_atts($matches[3][$key]);
|
136 |
+
if(isset($shortcodeAtts) && isset($shortcodeAtts['id']) && ($shortcodeAtts['id'] != '')) {
|
137 |
+
$shortcodeInsertions[] = $shortcodeAtts['id'];
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
$paragraphCount = wp_insert_inpostads_get_paragraph_count($content);
|
144 |
foreach($inpostads as $key => $inpostad) {
|
145 |
+
if(!in_array($key, $shortcodeInsertions)) {
|
146 |
+
if(!isset($inpostad['location'])) { //Get the location value from the key for old users who doesnt have a location saved.
|
147 |
+
switch($key) {
|
148 |
+
case 'above':
|
149 |
+
$inpostad['location'] = 'above';
|
150 |
+
break;
|
151 |
+
case 'middle':
|
152 |
+
$inpostad['location'] = 'middle';
|
153 |
+
break;
|
154 |
+
case 'below':
|
155 |
+
$inpostad['location'] = 'below';
|
156 |
+
break;
|
157 |
+
case 'left':
|
158 |
+
$inpostad['location'] = 'left';
|
159 |
+
break;
|
160 |
+
case 'right':
|
161 |
+
$inpostad['location'] = 'right';
|
162 |
+
break;
|
163 |
+
default:
|
164 |
+
$inpostad['location'] = 'above';
|
165 |
+
break;
|
166 |
+
}
|
167 |
}
|
168 |
+
|
169 |
+
if(wp_insert_get_ad_status($inpostad)) {
|
170 |
+
switch($inpostad['location']) {
|
171 |
+
case 'above':
|
172 |
+
$content = wp_insert_get_ad_unit($inpostad).$content;
|
173 |
+
break;
|
174 |
+
case 'middle':
|
175 |
+
if($paragraphCount > 1) {
|
176 |
+
if(($inpostad['paragraph_buffer_count'] == 0) || ($inpostad['paragraph_buffer_count'] == '')) {
|
177 |
+
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, round($paragraphCount / 2));
|
178 |
+
} else {
|
179 |
+
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $inpostad['paragraph_buffer_count']);
|
180 |
+
}
|
181 |
+
if($position) {
|
182 |
+
if(($inpostad['minimum_character_count'] == 0) || ($inpostad['minimum_character_count'] == '')) {
|
|
|
|
|
|
|
|
|
183 |
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
184 |
+
} else {
|
185 |
+
if(strlen(strip_tags($content)) > $inpostad['minimum_character_count']) {
|
186 |
+
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
187 |
+
}
|
188 |
}
|
189 |
}
|
190 |
}
|
191 |
+
break;
|
192 |
+
case 'below':
|
193 |
+
$content = $content.wp_insert_get_ad_unit($inpostad);
|
194 |
+
break;
|
195 |
+
case 'left':
|
196 |
+
$content = wp_insert_get_ad_unit($inpostad, 'float: left;').$content;
|
197 |
+
break;
|
198 |
+
case 'right':
|
199 |
+
$content = wp_insert_get_ad_unit($inpostad, 'float: right;').$content;
|
200 |
+
break;
|
201 |
+
case 'paragraphtop':
|
202 |
+
if($paragraphCount > 1) {
|
203 |
+
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $inpostad['paragraphtopposition']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
if($position) {
|
205 |
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
206 |
}
|
207 |
}
|
208 |
+
break;
|
209 |
+
case 'paragraphbottom':
|
210 |
+
if($paragraphCount > 1) {
|
211 |
+
$paragraphbottomposition = ($paragraphCount - (int)$inpostad['paragraphbottomposition']);
|
212 |
+
if(($paragraphbottomposition > 0) && ($paragraphbottomposition < $paragraphCount)) {
|
213 |
+
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $paragraphbottomposition);
|
214 |
+
if($position) {
|
215 |
+
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
break;
|
220 |
+
}
|
221 |
}
|
222 |
}
|
223 |
}
|
254 |
}
|
255 |
}
|
256 |
/* End In-Post Ads Ad Insertion */
|
257 |
+
|
258 |
+
/* Begin In-Post Ads Shortcode Ad Insertion */
|
259 |
+
add_shortcode('wpinsertinpostad', 'wp_insert_inpostads_get_shortcode');
|
260 |
+
function wp_insert_inpostads_get_shortcode($atts) {
|
261 |
+
$atts = shortcode_atts(array('id' => ''), $atts, 'wpinsertinpostad');
|
262 |
+
if(isset($atts['id']) && ($atts['id'] != '')) {
|
263 |
+
$adunit = get_option('wp_insert_inpostads');
|
264 |
+
if(isset($adunit) && isset($adunit[$atts['id']]) && is_array($adunit[$atts['id']]) && wp_insert_get_ad_status($adunit[$atts['id']])) {
|
265 |
+
return wp_insert_get_ad_unit($adunit[$atts['id']]);
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
269 |
+
/* End In-Post Ads Shortcode Ad Insertion */
|
270 |
?>
|
includes/modules/general/shortcode/module.php
CHANGED
@@ -18,7 +18,7 @@ add_filter('wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_shortcodeads
|
|
18 |
function wp_insert_shortcodeads_form_accordion_tabs_shortcode($control, $identifier, $location) {
|
19 |
echo '<h3>Shortcode</h3>';
|
20 |
echo '<div>';
|
21 |
-
$control->set_HTML('<p class="codeSnippet"><code>[
|
22 |
$control->create_section('Code to add to your post/page content');
|
23 |
echo $control->HTML;
|
24 |
$control->clear_controls();
|
@@ -34,8 +34,9 @@ add_filter('wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordi
|
|
34 |
|
35 |
/* Begin Shortcode Ad Insertion */
|
36 |
add_shortcode('wpshortcodead', 'wp_insert_shortcodeads_shortcode');
|
|
|
37 |
function wp_insert_shortcodeads_shortcode($atts) {
|
38 |
-
$atts = shortcode_atts(array('id' => ''), $atts, '
|
39 |
if(isset($atts['id']) && ($atts['id'] != '')) {
|
40 |
$shortcodeads = get_option('wp_insert_shortcodeads');
|
41 |
if(isset($shortcodeads[$atts['id']]) && is_array($shortcodeads[$atts['id']]) && wp_insert_get_ad_status($shortcodeads[$atts['id']])) {
|
18 |
function wp_insert_shortcodeads_form_accordion_tabs_shortcode($control, $identifier, $location) {
|
19 |
echo '<h3>Shortcode</h3>';
|
20 |
echo '<div>';
|
21 |
+
$control->set_HTML('<p class="codeSnippet"><code>[wpinsertshortcodead id="'.$identifier.'"]</code></p>');
|
22 |
$control->create_section('Code to add to your post/page content');
|
23 |
echo $control->HTML;
|
24 |
$control->clear_controls();
|
34 |
|
35 |
/* Begin Shortcode Ad Insertion */
|
36 |
add_shortcode('wpshortcodead', 'wp_insert_shortcodeads_shortcode');
|
37 |
+
add_shortcode('wpinsertshortcodead', 'wp_insert_shortcodeads_shortcode');
|
38 |
function wp_insert_shortcodeads_shortcode($atts) {
|
39 |
+
$atts = shortcode_atts(array('id' => ''), $atts, 'wpinsertshortcodead');
|
40 |
if(isset($atts['id']) && ($atts['id'] != '')) {
|
41 |
$shortcodeads = get_option('wp_insert_shortcodeads');
|
42 |
if(isset($shortcodeads[$atts['id']]) && is_array($shortcodeads[$atts['id']]) && wp_insert_get_ad_status($shortcodeads[$atts['id']])) {
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: google adsense, adsense, google ads, google analytics, privacy policy, bes
|
|
4 |
Donate link: http://wpinsert.smartlogix.co.in/support/
|
5 |
Requires at least: 4.1.0
|
6 |
Tested up to: 4.9.8
|
7 |
-
Stable tag: 2.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -18,6 +18,7 @@ Wp-Insert is the most powerful yet easiest to use wordpress ad management / ad i
|
|
18 |
= Features =
|
19 |
|
20 |
* Adsense Optimized
|
|
|
21 |
* Builtin support for Google Page-Level Ads
|
22 |
* Builtin support for Google Adsnese Auto Ads
|
23 |
* Unlimited Adblocks (No restrictions placed on you)
|
@@ -28,6 +29,7 @@ Wp-Insert is the most powerful yet easiest to use wordpress ad management / ad i
|
|
28 |
* Insert Ads into post content using shortcodes is required
|
29 |
* GUI Driven Rules based System to control when and where to display Ads
|
30 |
* Use the GUI to easily exclude ads from any specific post, pages, archives etc
|
|
|
31 |
* Hide ads for Loggedin users
|
32 |
* Hide ads for Mobile users
|
33 |
* Builtin support for AMP plugin by Automattic
|
4 |
Donate link: http://wpinsert.smartlogix.co.in/support/
|
5 |
Requires at least: 4.1.0
|
6 |
Tested up to: 4.9.8
|
7 |
+
Stable tag: 2.4.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
18 |
= Features =
|
19 |
|
20 |
* Adsense Optimized
|
21 |
+
* Gutenberg Support
|
22 |
* Builtin support for Google Page-Level Ads
|
23 |
* Builtin support for Google Adsnese Auto Ads
|
24 |
* Unlimited Adblocks (No restrictions placed on you)
|
29 |
* Insert Ads into post content using shortcodes is required
|
30 |
* GUI Driven Rules based System to control when and where to display Ads
|
31 |
* Use the GUI to easily exclude ads from any specific post, pages, archives etc
|
32 |
+
* Manually override auto positioning on a per post basis
|
33 |
* Hide ads for Loggedin users
|
34 |
* Hide ads for Mobile users
|
35 |
* Builtin support for AMP plugin by Automattic
|
wp-insert.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Wp-Insert
|
4 |
Plugin URI: http://www.wp-insert.smartlogix.co.in/
|
5 |
Description: WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
6 |
-
Version: 2.4.
|
7 |
Author: Namith Jawahar
|
8 |
Author URI: http://www.smartlogix.co.in/
|
9 |
WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
3 |
Plugin Name: Wp-Insert
|
4 |
Plugin URI: http://www.wp-insert.smartlogix.co.in/
|
5 |
Description: WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
6 |
+
Version: 2.4.4
|
7 |
Author: Namith Jawahar
|
8 |
Author URI: http://www.smartlogix.co.in/
|
9 |
WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|