Version Description
- Snippet selection support in classic editor block of Gutenberg
- Support for Search Snippet by name
- Navigation Improvements
Download this release
Release Info
Developer | f1logic |
Plugin | Insert Html Snippet |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2.5 to 1.3
- add_shortcode_tynimce.php +30 -3
- admin/about.php +8 -1
- admin/snippet-add.php +18 -7
- admin/snippet-edit.php +19 -7
- admin/snippets.php +109 -63
- editor_plugin.js.php +63 -21
- insert-html-snippet.php +2 -2
- readme.txt +7 -2
add_shortcode_tynimce.php
CHANGED
@@ -1,8 +1,35 @@
|
|
1 |
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) )
|
3 |
exit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
class XYZ_Insert_Html_TinyMCESelector{
|
8 |
var $buttonName = 'xyz_ihs_snippet_selector';
|
@@ -38,5 +65,5 @@ endif;
|
|
38 |
if(!isset($shortcodesXYZEH)){
|
39 |
$shortcodesXYZEH = new XYZ_Insert_Html_TinyMCESelector();
|
40 |
add_action('admin_head', array($shortcodesXYZEH, 'addSelector'));
|
41 |
-
}
|
42 |
?>
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) )
|
3 |
exit;
|
4 |
+
|
5 |
+
add_action( 'admin_init', 'xyz_ihs_tinymce_button' );
|
6 |
+
|
7 |
+
function xyz_ihs_tinymce_button() {
|
8 |
+
if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
|
9 |
+
|
10 |
+
if ( get_user_option('rich_editing') == 'true') {
|
11 |
+
|
12 |
+
add_filter( 'mce_buttons', 'xyz_ihs_register_tinymce_button' );
|
13 |
+
add_filter( 'mce_external_plugins', 'xyz_ihs_add_tinymce_button' );
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
function xyz_ihs_register_tinymce_button( $buttons ) {
|
19 |
+
|
20 |
+
$buttonName = 'xyz_ihs_snippet_selector';
|
21 |
+
|
22 |
+
array_push( $buttons, $buttonName);
|
23 |
+
return $buttons;
|
24 |
+
}
|
25 |
+
|
26 |
+
function xyz_ihs_add_tinymce_button( $plugin_array ) {
|
27 |
+
$plugin_array['xyz_ihs_buttons'] = get_site_url() . '/index.php?wp_ihs=editor_plugin_js';
|
28 |
+
return $plugin_array;
|
29 |
+
}
|
30 |
|
31 |
+
|
32 |
+
/*if(!class_exists('XYZ_Insert_Html_TinyMCESelector')):
|
33 |
|
34 |
class XYZ_Insert_Html_TinyMCESelector{
|
35 |
var $buttonName = 'xyz_ihs_snippet_selector';
|
65 |
if(!isset($shortcodesXYZEH)){
|
66 |
$shortcodesXYZEH = new XYZ_Insert_Html_TinyMCESelector();
|
67 |
add_action('admin_head', array($shortcodesXYZEH, 'addSelector'));
|
68 |
+
}*/
|
69 |
?>
|
admin/about.php
CHANGED
@@ -153,7 +153,7 @@ can be used in your pages, posts and widgets. Insert HTML Snippet is developed
|
|
153 |
</tr>
|
154 |
<!-- Snippet Targeting -->
|
155 |
<tr>
|
156 |
-
<td rowspan="
|
157 |
<td><b>Geographic Targeting</b></td>
|
158 |
<td><img src="<?php echo plugins_url('images/cross.png',XYZ_INSERT_HTML_PLUGIN_FILE);?>">
|
159 |
</td>
|
@@ -174,6 +174,13 @@ can be used in your pages, posts and widgets. Insert HTML Snippet is developed
|
|
174 |
<td><img src="<?php echo plugins_url('images/tick.png',XYZ_INSERT_HTML_PLUGIN_FILE);?>">
|
175 |
</td>
|
176 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
<!-- Integration -->
|
179 |
|
153 |
</tr>
|
154 |
<!-- Snippet Targeting -->
|
155 |
<tr>
|
156 |
+
<td rowspan="4"><h4>Snippet Targeting</h4></td>
|
157 |
<td><b>Geographic Targeting</b></td>
|
158 |
<td><img src="<?php echo plugins_url('images/cross.png',XYZ_INSERT_HTML_PLUGIN_FILE);?>">
|
159 |
</td>
|
174 |
<td><img src="<?php echo plugins_url('images/tick.png',XYZ_INSERT_HTML_PLUGIN_FILE);?>">
|
175 |
</td>
|
176 |
</tr>
|
177 |
+
<tr>
|
178 |
+
<td><b>Date & Time Targeting</b></td>
|
179 |
+
<td><img src="<?php echo plugins_url('images/cross.png',XYZ_INSERT_HTML_PLUGIN_FILE);?>">
|
180 |
+
</td>
|
181 |
+
<td><img src="<?php echo plugins_url('images/tick.png',XYZ_INSERT_HTML_PLUGIN_FILE);?>">
|
182 |
+
</td>
|
183 |
+
</tr>
|
184 |
|
185 |
<!-- Integration -->
|
186 |
|
admin/snippet-add.php
CHANGED
@@ -2,14 +2,16 @@
|
|
2 |
if ( ! defined( 'ABSPATH' ) )
|
3 |
exit;
|
4 |
global $wpdb;
|
|
|
5 |
$_POST = stripslashes_deep($_POST);
|
6 |
$_POST = xyz_trim_deep($_POST);
|
7 |
-
if($_POST){
|
8 |
if(!isset($_REQUEST['_wpnonce'])||!wp_verify_nonce($_REQUEST['_wpnonce'],'ihs-add_')){
|
9 |
wp_nonce_ays( 'ihs-add_' );
|
10 |
exit;
|
11 |
}
|
12 |
-
|
|
|
13 |
$temp_xyz_ihs_title = str_replace(' ', '', $_POST['snippetTitle']);
|
14 |
$temp_xyz_ihs_title = str_replace('-', '', $temp_xyz_ihs_title);
|
15 |
$xyz_ihs_title = str_replace(' ', '-', $_POST['snippetTitle']);
|
@@ -66,6 +68,7 @@ if($_POST){
|
|
66 |
wp_nonce_field('ihs-add_');
|
67 |
?>
|
68 |
<div>
|
|
|
69 |
<table
|
70 |
style="width: 99%; background-color: #F9F9F9; border: 1px solid #E4E4E4; border-width: 1px;margin: 0 auto">
|
71 |
<tr>
|
@@ -108,14 +111,22 @@ wp_nonce_field('ihs-add_');
|
|
108 |
</td>
|
109 |
</tr>
|
110 |
<tr>
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
114 |
</td>
|
115 |
<td>
|
116 |
<input class="button-primary" style="cursor: pointer;"
|
117 |
-
type="submit" name="addSubmit" value="Create">
|
118 |
-
|
|
|
|
|
|
|
119 |
</tr>
|
120 |
<tr>
|
121 |
<td>
|
2 |
if ( ! defined( 'ABSPATH' ) )
|
3 |
exit;
|
4 |
global $wpdb;
|
5 |
+
$goback=1;
|
6 |
$_POST = stripslashes_deep($_POST);
|
7 |
$_POST = xyz_trim_deep($_POST);
|
8 |
+
if(isset($_POST) && isset($_POST['addSubmit'])){
|
9 |
if(!isset($_REQUEST['_wpnonce'])||!wp_verify_nonce($_REQUEST['_wpnonce'],'ihs-add_')){
|
10 |
wp_nonce_ays( 'ihs-add_' );
|
11 |
exit;
|
12 |
}
|
13 |
+
$goback=intval($_POST['goback']);
|
14 |
+
$goback++;
|
15 |
$temp_xyz_ihs_title = str_replace(' ', '', $_POST['snippetTitle']);
|
16 |
$temp_xyz_ihs_title = str_replace('-', '', $temp_xyz_ihs_title);
|
17 |
$xyz_ihs_title = str_replace(' ', '-', $_POST['snippetTitle']);
|
68 |
wp_nonce_field('ihs-add_');
|
69 |
?>
|
70 |
<div>
|
71 |
+
<input type="hidden" name="goback" value=<?php echo $goback;?>>
|
72 |
<table
|
73 |
style="width: 99%; background-color: #F9F9F9; border: 1px solid #E4E4E4; border-width: 1px;margin: 0 auto">
|
74 |
<tr>
|
111 |
</td>
|
112 |
</tr>
|
113 |
<tr>
|
114 |
+
<td></td>
|
115 |
+
|
116 |
+
|
117 |
+
<td>
|
118 |
+
|
119 |
+
|
120 |
+
<input class="button-primary" style="cursor: pointer;"
|
121 |
+
type="button" name="back" value="back" onclick=" window.history.go(-<?php echo $goback;?>);" >
|
122 |
</td>
|
123 |
<td>
|
124 |
<input class="button-primary" style="cursor: pointer;"
|
125 |
+
type="submit" name="addSubmit" value="Create" >
|
126 |
+
</td>
|
127 |
+
|
128 |
+
|
129 |
+
|
130 |
</tr>
|
131 |
<tr>
|
132 |
<td>
|
admin/snippet-edit.php
CHANGED
@@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) )
|
|
3 |
exit;
|
4 |
|
5 |
global $wpdb;
|
6 |
-
|
7 |
$xyz_ihs_snippetId = intval($_GET['snippetId']);
|
8 |
|
9 |
$xyz_ihs_message = '';
|
@@ -20,16 +20,19 @@ id="xyz_system_notice_area_dismiss">Dismiss</span>
|
|
20 |
<?php
|
21 |
}
|
22 |
|
|
|
|
|
23 |
|
24 |
-
|
25 |
$xyz_ihs_snippetId = intval($_GET['snippetId']);
|
26 |
-
if($_POST){
|
27 |
if (!isset($_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'ihs-edit_'.$xyz_ihs_snippetId )) {
|
28 |
wp_nonce_ays( 'ihs-edit_'.$xyz_ihs_snippetId );
|
29 |
exit;
|
30 |
}
|
31 |
-
|
32 |
-
|
|
|
33 |
$_POST = stripslashes_deep($_POST);
|
34 |
$_POST = xyz_trim_deep($_POST);
|
35 |
|
@@ -52,7 +55,7 @@ if($_POST){
|
|
52 |
|
53 |
$wpdb->update($wpdb->prefix.'xyz_ihs_short_code', array('title'=>$xyz_ihs_title,'content'=>$xyz_ihs_content,'short_code'=>$xyz_shortCode,), array('id'=>$xyz_ihs_snippetId));
|
54 |
|
55 |
-
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&action=snippet-edit&snippetId='.$xyz_ihs_snippetId.'&xyz_ihs_msg=1'));
|
56 |
|
57 |
}
|
58 |
else{
|
@@ -102,9 +105,11 @@ $snippetDetails = $snippetDetails[0];
|
|
102 |
</legend>
|
103 |
<form name="frmmainForm" id="frmmainForm" method="post">
|
104 |
<?php wp_nonce_field( 'ihs-edit_'.$xyz_ihs_snippetId ); ?>
|
|
|
105 |
<input type="hidden" id="snippetId" name="snippetId"
|
106 |
value="<?php if(isset($_POST['snippetId'])){ echo esc_attr($_POST['snippetId']);}else{ echo esc_attr($snippetDetails->id); }?>">
|
107 |
<div>
|
|
|
108 |
<table
|
109 |
style="width: 99%; background-color: #F9F9F9; border: 1px solid #E4E4E4; border-width: 1px;margin: 0 auto">
|
110 |
<tr><td><br/>
|
@@ -126,8 +131,15 @@ $snippetDetails = $snippetDetails[0];
|
|
126 |
</tr>
|
127 |
|
128 |
<tr>
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
<td><input class="button-primary" style="cursor: pointer;" type="submit" name="updateSubmit" value="Update"></td>
|
|
|
131 |
</tr>
|
132 |
<tr><td><br/></td></tr>
|
133 |
</table>
|
3 |
exit;
|
4 |
|
5 |
global $wpdb;
|
6 |
+
$goback=1;
|
7 |
$xyz_ihs_snippetId = intval($_GET['snippetId']);
|
8 |
|
9 |
$xyz_ihs_message = '';
|
20 |
<?php
|
21 |
}
|
22 |
|
23 |
+
if($_GET['goback'])
|
24 |
+
$goback= intval($_GET['goback']);
|
25 |
|
26 |
+
|
27 |
$xyz_ihs_snippetId = intval($_GET['snippetId']);
|
28 |
+
if(isset($_POST) && isset($_POST['updateSubmit'])){
|
29 |
if (!isset($_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'ihs-edit_'.$xyz_ihs_snippetId )) {
|
30 |
wp_nonce_ays( 'ihs-edit_'.$xyz_ihs_snippetId );
|
31 |
exit;
|
32 |
}
|
33 |
+
$goback=intval($_POST['goback']);
|
34 |
+
$goback++;
|
35 |
+
|
36 |
$_POST = stripslashes_deep($_POST);
|
37 |
$_POST = xyz_trim_deep($_POST);
|
38 |
|
55 |
|
56 |
$wpdb->update($wpdb->prefix.'xyz_ihs_short_code', array('title'=>$xyz_ihs_title,'content'=>$xyz_ihs_content,'short_code'=>$xyz_shortCode,), array('id'=>$xyz_ihs_snippetId));
|
57 |
|
58 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&action=snippet-edit&snippetId='.$xyz_ihs_snippetId.'&xyz_ihs_msg=1'.'&goback='.$goback));
|
59 |
|
60 |
}
|
61 |
else{
|
105 |
</legend>
|
106 |
<form name="frmmainForm" id="frmmainForm" method="post">
|
107 |
<?php wp_nonce_field( 'ihs-edit_'.$xyz_ihs_snippetId ); ?>
|
108 |
+
|
109 |
<input type="hidden" id="snippetId" name="snippetId"
|
110 |
value="<?php if(isset($_POST['snippetId'])){ echo esc_attr($_POST['snippetId']);}else{ echo esc_attr($snippetDetails->id); }?>">
|
111 |
<div>
|
112 |
+
<input type="hidden" name="goback" value= <?php echo $goback;?>>
|
113 |
<table
|
114 |
style="width: 99%; background-color: #F9F9F9; border: 1px solid #E4E4E4; border-width: 1px;margin: 0 auto">
|
115 |
<tr><td><br/>
|
131 |
</tr>
|
132 |
|
133 |
<tr>
|
134 |
+
<td></td>
|
135 |
+
<td>
|
136 |
+
|
137 |
+
|
138 |
+
<input class="button-primary" style="cursor: pointer;"
|
139 |
+
type="button" name="back" onclick=" window.history.go(-<?php echo $goback;?>);" value="back" >
|
140 |
+
</td>
|
141 |
<td><input class="button-primary" style="cursor: pointer;" type="submit" name="updateSubmit" value="Update"></td>
|
142 |
+
|
143 |
</tr>
|
144 |
<tr><td><br/></td></tr>
|
145 |
</table>
|
admin/snippets.php
CHANGED
@@ -1,66 +1,85 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) )
|
3 |
-
|
4 |
-
|
5 |
-
global $wpdb;
|
6 |
-
$_GET = stripslashes_deep($_GET);
|
7 |
-
$xyz_ihs_message = '';
|
8 |
-
if(isset($_GET['xyz_ihs_msg'])){
|
9 |
-
|
10 |
-
}
|
11 |
-
if($_POST)
|
12 |
-
{
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
<div class="xyz_system_notice_area_style1" id="xyz_system_notice_area">
|
65 |
HTML Snippet successfully added. <span
|
66 |
id="xyz_system_notice_area_dismiss">Dismiss</span>
|
@@ -142,11 +161,21 @@ if($xyz_ihs_message == 8)
|
|
142 |
$field=get_option('xyz_ihs_sort_field_name');
|
143 |
$order=get_option('xyz_ihs_sort_order');
|
144 |
|
145 |
-
|
|
|
|
|
146 |
|
147 |
?>
|
|
|
|
|
|
|
148 |
<input id="xyz_ihs_submit" style="cursor: pointer; margin-bottom:10px; margin-left:8px;" type="button" name="textFieldButton2" value="Add New HTML Snippet" onClick='document.location.href="<?php echo admin_url('admin.php?page=insert-html-snippet-manage&action=snippet-add');?>"'>
|
149 |
<br>
|
|
|
|
|
|
|
|
|
|
|
150 |
<span style="padding-left: 6px;color:#21759B;">With Selected : </span>
|
151 |
<select name="ihs_bulk_actions_snippet" id="ihs_bulk_actions_snippet" style="width:130px;height:29px;">
|
152 |
<option value="-1">Bulk Actions</option>
|
@@ -156,6 +185,23 @@ if($xyz_ihs_message == 8)
|
|
156 |
</select>
|
157 |
<input type="submit" title="Apply" name="apply_ihs_bulk_actions" value="Apply" style="color:#21759B;cursor:pointer;padding: 5px;background:linear-gradient(to top, #ECECEC, #F9F9F9) repeat scroll 0 0 #F1F1F1;border: 2px solid #DFDFDF;">
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
<table class="widefat" style="width: 99%; margin: 0 auto; border-bottom:none;">
|
160 |
<thead>
|
161 |
<tr>
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) )
|
3 |
+
exit;
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
$_GET = stripslashes_deep($_GET);
|
7 |
+
$xyz_ihs_message = '';
|
8 |
+
if(isset($_GET['xyz_ihs_msg'])){
|
9 |
+
$xyz_ihs_message = intval($_GET['xyz_ihs_msg']);
|
10 |
+
}
|
11 |
+
if($_POST)
|
12 |
+
{
|
13 |
+
if(isset($_POST['search']))
|
14 |
+
{
|
15 |
+
if(!isset($_REQUEST['_wpnonce'])||!wp_verify_nonce($_REQUEST['_wpnonce'],'snipp-manage_') ){
|
16 |
+
wp_nonce_ays( 'snipp-manage_' );
|
17 |
+
exit;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
if(isset($_POST['textFieldButton2']))
|
21 |
+
{
|
22 |
+
if(!isset($_REQUEST['_wpnonce'])||!wp_verify_nonce($_REQUEST['_wpnonce'],'bulk_actions_ihs') ){
|
23 |
+
wp_nonce_ays( 'bulk_actions_ihs' );
|
24 |
+
exit;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
if (isset($_POST['apply_ihs_bulk_actions'])){
|
28 |
+
if (isset($_POST['ihs_bulk_actions_snippet'])){
|
29 |
+
$ihs_bulk_actions_snippet=$_POST['ihs_bulk_actions_snippet'];
|
30 |
+
if (isset($_POST['xyz_ihs_snippet_ids']))
|
31 |
+
$xyz_ihs_snippet_ids = $_POST['xyz_ihs_snippet_ids'];
|
32 |
+
$xyz_ihs_pageno = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
|
33 |
+
|
34 |
+
if (empty($xyz_ihs_snippet_ids))
|
35 |
+
{
|
36 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=8&pagenum='.$xyz_ihs_pageno));
|
37 |
+
exit();
|
38 |
+
}
|
39 |
+
if ($ihs_bulk_actions_snippet==2)//bulk-delete
|
40 |
+
{
|
41 |
+
foreach ($xyz_ihs_snippet_ids as $snippet_id)
|
42 |
+
{
|
43 |
+
$wpdb->query($wpdb->prepare( 'DELETE FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id=%d',$snippet_id)) ;
|
44 |
+
}
|
45 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=3&pagenum='.$xyz_ihs_pageno));
|
46 |
+
exit();
|
47 |
+
}
|
48 |
+
elseif ($ihs_bulk_actions_snippet==0)//bulk-Deactivate
|
49 |
+
{
|
50 |
+
foreach ($xyz_ihs_snippet_ids as $xyz_ihs_snippetId)
|
51 |
+
$wpdb->update($wpdb->prefix.'xyz_ihs_short_code', array('status'=>2), array('id'=>$xyz_ihs_snippetId));
|
52 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=4&pagenum='.$xyz_ihs_pageno));
|
53 |
+
exit();
|
54 |
+
}
|
55 |
+
elseif ($ihs_bulk_actions_snippet==1)//bulk-activate
|
56 |
+
{
|
57 |
+
foreach ($xyz_ihs_snippet_ids as $xyz_ihs_snippetId)
|
58 |
+
$wpdb->update($wpdb->prefix.'xyz_ihs_short_code', array('status'=>1), array('id'=>$xyz_ihs_snippetId));
|
59 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=4&pagenum='.$xyz_ihs_pageno));
|
60 |
+
exit();
|
61 |
+
}
|
62 |
+
elseif ($ihs_bulk_actions_snippet==-1)//no action selected
|
63 |
+
{
|
64 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=7&pagenum='.$xyz_ihs_pageno));
|
65 |
+
exit();
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
}
|
70 |
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
}
|
81 |
+
if($xyz_ihs_message == 1){
|
82 |
+
?>
|
83 |
<div class="xyz_system_notice_area_style1" id="xyz_system_notice_area">
|
84 |
HTML Snippet successfully added. <span
|
85 |
id="xyz_system_notice_area_dismiss">Dismiss</span>
|
161 |
$field=get_option('xyz_ihs_sort_field_name');
|
162 |
$order=get_option('xyz_ihs_sort_order');
|
163 |
|
164 |
+
$search_name=sanitize_text_field($_POST['snippet_name']);
|
165 |
+
$search_name_db=esc_sql($search_name);
|
166 |
+
$entries = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE title like '%".$search_name_db."%'"." ORDER BY $field $order LIMIT $offset,$limit" );
|
167 |
|
168 |
?>
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
<input id="xyz_ihs_submit" style="cursor: pointer; margin-bottom:10px; margin-left:8px;" type="button" name="textFieldButton2" value="Add New HTML Snippet" onClick='document.location.href="<?php echo admin_url('admin.php?page=insert-html-snippet-manage&action=snippet-add');?>"'>
|
173 |
<br>
|
174 |
+
|
175 |
+
|
176 |
+
|
177 |
+
|
178 |
+
|
179 |
<span style="padding-left: 6px;color:#21759B;">With Selected : </span>
|
180 |
<select name="ihs_bulk_actions_snippet" id="ihs_bulk_actions_snippet" style="width:130px;height:29px;">
|
181 |
<option value="-1">Bulk Actions</option>
|
185 |
</select>
|
186 |
<input type="submit" title="Apply" name="apply_ihs_bulk_actions" value="Apply" style="color:#21759B;cursor:pointer;padding: 5px;background:linear-gradient(to top, #ECECEC, #F9F9F9) repeat scroll 0 0 #F1F1F1;border: 2px solid #DFDFDF;">
|
187 |
|
188 |
+
|
189 |
+
<form name="manage_snippets" action="" method="post">
|
190 |
+
<?php wp_nonce_field('snipp-manage_');?>
|
191 |
+
<div class="xyz_ics_search_div" style="float:right;">
|
192 |
+
<table class="xyz_ics_search_div_table" style="width:100%;">
|
193 |
+
<tr>
|
194 |
+
|
195 |
+
|
196 |
+
<input type="text" name="snippet_name" value= "<?php if(isset($search_name)){echo esc_attr($search_name);}?>" placeholder="Search" >
|
197 |
+
<input type="submit" name="search" value="Go" />
|
198 |
+
|
199 |
+
</tr>
|
200 |
+
</table>
|
201 |
+
</div>
|
202 |
+
</form>
|
203 |
+
|
204 |
+
|
205 |
<table class="widefat" style="width: 99%; margin: 0 auto; border-bottom:none;">
|
206 |
<thead>
|
207 |
<tr>
|
editor_plugin.js.php
CHANGED
@@ -6,24 +6,66 @@ header( 'Content-Type: text/javascript' );
|
|
6 |
if ( ! is_user_logged_in() )
|
7 |
die('You must be logged in to access this script.');
|
8 |
|
9 |
-
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
|
14 |
|
15 |
$xyz_snippets_arr=$wpdb->get_results($wpdb->prepare( "SELECT id,title FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE status=%d ORDER BY id DESC",1),ARRAY_A );
|
16 |
// print_r($xyz_snippets_arr);
|
17 |
if(count($xyz_snippets_arr)==0)
|
18 |
die;
|
19 |
|
20 |
-
if(floatval(get_bloginfo('version'))>=3.9)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
?>
|
23 |
(function() {
|
24 |
|
25 |
-
tinymce.PluginManager.add('<?php echo $
|
26 |
-
editor.addButton( '<?php echo $
|
27 |
title: 'Insert HTML Snippet',
|
28 |
type: 'menubutton',
|
29 |
icon: 'icon xyz-ihs-own-icon',
|
@@ -42,7 +84,7 @@ if(floatval(get_bloginfo('version'))>=3.9)
|
|
42 |
});
|
43 |
|
44 |
})();
|
45 |
-
<?php } else {
|
46 |
|
47 |
$xyz_snippets = array(
|
48 |
'title' =>'Insert HTML Snippet',
|
@@ -51,13 +93,13 @@ if(floatval(get_bloginfo('version'))>=3.9)
|
|
51 |
);
|
52 |
?>
|
53 |
|
54 |
-
var tinymce_<?php echo $
|
55 |
|
56 |
|
57 |
(function() {
|
58 |
//******* Load plugin specific language pack
|
59 |
|
60 |
-
tinymce.create('tinymce.plugins.<?php echo $
|
61 |
/**
|
62 |
* Initializes the plugin, this will be executed after the plugin has been created.
|
63 |
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
@@ -68,9 +110,9 @@ var tinymce_<?php echo $shortcodesXYZEH->buttonName; ?> =<?php echo json_encode(
|
|
68 |
*/
|
69 |
init : function(ed, url) {
|
70 |
|
71 |
-
tinymce_<?php echo $
|
72 |
if(this.v && this.v != ''){
|
73 |
-
tinymce.execCommand('mceInsertContent', false, '[xyz-ihs snippet="'+tinymce_<?php echo $
|
74 |
}
|
75 |
};
|
76 |
|
@@ -87,22 +129,22 @@ var tinymce_<?php echo $shortcodesXYZEH->buttonName; ?> =<?php echo json_encode(
|
|
87 |
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
88 |
*/
|
89 |
createControl : function(n, cm) {
|
90 |
-
if(n=='<?php echo $
|
91 |
-
var c = cm.createSplitButton('<?php echo $
|
92 |
-
title : tinymce_<?php echo $
|
93 |
-
image : tinymce_<?php echo $
|
94 |
-
onclick : tinymce_<?php echo $
|
95 |
});
|
96 |
|
97 |
// Add some values to the list box
|
98 |
|
99 |
|
100 |
c.onRenderMenu.add(function(c, m){
|
101 |
-
for (var id in tinymce_<?php echo $
|
102 |
m.add({
|
103 |
v : id,
|
104 |
-
title : tinymce_<?php echo $
|
105 |
-
onclick : tinymce_<?php echo $
|
106 |
});
|
107 |
}
|
108 |
});
|
@@ -119,7 +161,7 @@ var tinymce_<?php echo $shortcodesXYZEH->buttonName; ?> =<?php echo json_encode(
|
|
119 |
});
|
120 |
|
121 |
// Register plugin
|
122 |
-
tinymce.PluginManager.add('<?php echo $
|
123 |
})();
|
124 |
|
125 |
<?php } ?>
|
6 |
if ( ! is_user_logged_in() )
|
7 |
die('You must be logged in to access this script.');
|
8 |
|
9 |
+
/*if(!isset($shortcodesXYZEH))
|
10 |
+
$shortcodesXYZEH = new XYZ_Insert_Html_TinyMCESelector();*/
|
11 |
|
12 |
+
global $wpdb;
|
13 |
+
$buttonName = 'xyz_ihs_snippet_selector';
|
14 |
|
15 |
$xyz_snippets_arr=$wpdb->get_results($wpdb->prepare( "SELECT id,title FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE status=%d ORDER BY id DESC",1),ARRAY_A );
|
16 |
// print_r($xyz_snippets_arr);
|
17 |
if(count($xyz_snippets_arr)==0)
|
18 |
die;
|
19 |
|
20 |
+
if(floatval(get_bloginfo('version'))>=3.9) //version 5 updation
|
21 |
+
{
|
22 |
+
?>
|
23 |
+
(function() {
|
24 |
+
/* Register the buttons */
|
25 |
+
tinymce.create('tinymce.plugins.xyz_ihs_snippet', {
|
26 |
+
init : function(ed, url) {
|
27 |
+
/**
|
28 |
+
* Inserts shortcode content
|
29 |
+
*/
|
30 |
+
ed.addButton( '<?php echo $buttonName;?>', {
|
31 |
+
title: 'Insert HTML Snippet',
|
32 |
+
type: 'menubutton',
|
33 |
+
icon: 'icon xyz-ihs-own-icon',
|
34 |
+
menu: [
|
35 |
+
|
36 |
+
<?php foreach ($xyz_snippets_arr as $key=>$val) { ?>
|
37 |
+
{
|
38 |
+
text: '<?php echo addslashes($val['title']); ?>',
|
39 |
+
value: '[xyz-ihs snippet="<?php echo addslashes($val['title']); ?>"]',
|
40 |
+
onclick: function() {
|
41 |
+
ed.selection.setContent(this.value());
|
42 |
+
}
|
43 |
+
},
|
44 |
+
<?php } ?>
|
45 |
+
|
46 |
+
]
|
47 |
+
|
48 |
+
});
|
49 |
+
|
50 |
+
|
51 |
+
},
|
52 |
+
createControl : function(n, cm) {
|
53 |
+
return null;
|
54 |
+
},
|
55 |
+
});
|
56 |
+
/* Start the buttons */
|
57 |
+
tinymce.PluginManager.add( 'xyz_ihs_buttons', tinymce.plugins.xyz_ihs_snippet );
|
58 |
+
})();
|
59 |
+
|
60 |
+
<?php
|
61 |
+
}
|
62 |
+
/*else if(floatval(get_bloginfo('version'))>=3.9)
|
63 |
{
|
64 |
?>
|
65 |
(function() {
|
66 |
|
67 |
+
tinymce.PluginManager.add('<?php echo $buttonName; ?>', function( editor, url ) {
|
68 |
+
editor.addButton( '<?php echo $buttonName; ?>', {
|
69 |
title: 'Insert HTML Snippet',
|
70 |
type: 'menubutton',
|
71 |
icon: 'icon xyz-ihs-own-icon',
|
84 |
});
|
85 |
|
86 |
})();
|
87 |
+
<?php }*/ else {
|
88 |
|
89 |
$xyz_snippets = array(
|
90 |
'title' =>'Insert HTML Snippet',
|
93 |
);
|
94 |
?>
|
95 |
|
96 |
+
var tinymce_<?php echo $buttonName; ?> =<?php echo json_encode($xyz_snippets) ?>;
|
97 |
|
98 |
|
99 |
(function() {
|
100 |
//******* Load plugin specific language pack
|
101 |
|
102 |
+
tinymce.create('tinymce.plugins.<?php echo $buttonName; ?>', {
|
103 |
/**
|
104 |
* Initializes the plugin, this will be executed after the plugin has been created.
|
105 |
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
110 |
*/
|
111 |
init : function(ed, url) {
|
112 |
|
113 |
+
tinymce_<?php echo $buttonName; ?>.insert = function(){
|
114 |
if(this.v && this.v != ''){
|
115 |
+
tinymce.execCommand('mceInsertContent', false, '[xyz-ihs snippet="'+tinymce_<?php echo $buttonName; ?>.xyz_ihs_snippets[this.v]['title']+'"]');
|
116 |
}
|
117 |
};
|
118 |
|
129 |
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
130 |
*/
|
131 |
createControl : function(n, cm) {
|
132 |
+
if(n=='<?php echo $buttonName; ?>'){
|
133 |
+
var c = cm.createSplitButton('<?php echo $buttonName; ?>', {
|
134 |
+
title : tinymce_<?php echo $buttonName; ?>.title,
|
135 |
+
image : tinymce_<?php echo $buttonName; ?>.url,
|
136 |
+
onclick : tinymce_<?php echo $buttonName; ?>.insert
|
137 |
});
|
138 |
|
139 |
// Add some values to the list box
|
140 |
|
141 |
|
142 |
c.onRenderMenu.add(function(c, m){
|
143 |
+
for (var id in tinymce_<?php echo $buttonName; ?>.xyz_ihs_snippets){
|
144 |
m.add({
|
145 |
v : id,
|
146 |
+
title : tinymce_<?php echo $buttonName; ?>.xyz_ihs_snippets[id]['title'],
|
147 |
+
onclick : tinymce_<?php echo $buttonName; ?>.insert
|
148 |
});
|
149 |
}
|
150 |
});
|
161 |
});
|
162 |
|
163 |
// Register plugin
|
164 |
+
tinymce.PluginManager.add('<?php echo $buttonName; ?>', tinymce.plugins.<?php echo $buttonName; ?>);
|
165 |
})();
|
166 |
|
167 |
<?php } ?>
|
insert-html-snippet.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Insert HTML Snippet
|
4 |
Plugin URI: http://xyzscripts.com/wordpress-plugins/insert-html-snippet/
|
5 |
Description: Add HTML code to your pages and posts easily using shortcodes. This plugin lets you create a shortcode corresponding to any random HTML code such as ad codes, javascript, video embedding, etc. and use the same in your posts, pages or widgets.
|
6 |
-
Version: 1.
|
7 |
Author: xyzscripts.com
|
8 |
Author URI: http://xyzscripts.com/
|
9 |
Text Domain: insert-html-snippet
|
@@ -64,4 +64,4 @@ function xyz_ihs_credit() {
|
|
64 |
echo $content;
|
65 |
}
|
66 |
|
67 |
-
?>
|
3 |
Plugin Name: Insert HTML Snippet
|
4 |
Plugin URI: http://xyzscripts.com/wordpress-plugins/insert-html-snippet/
|
5 |
Description: Add HTML code to your pages and posts easily using shortcodes. This plugin lets you create a shortcode corresponding to any random HTML code such as ad codes, javascript, video embedding, etc. and use the same in your posts, pages or widgets.
|
6 |
+
Version: 1.3
|
7 |
Author: xyzscripts.com
|
8 |
Author URI: http://xyzscripts.com/
|
9 |
Text Domain: insert-html-snippet
|
64 |
echo $content;
|
65 |
}
|
66 |
|
67 |
+
?>
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: f1logic
|
|
3 |
Donate link: http://xyzscripts.com/donate/
|
4 |
Tags: insert HTML, add HTML, insert adsense, insert ads, insert addthis code, insert flash , insert javascript, add javascript, insert css, add css, HTML to shortcode, integrate ad codes, raw html, embed html, html inserter, ad inserter, css inserter
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Add HTML, CSS and javascript code to your pages and posts easily using shortcodes.
|
@@ -74,6 +74,11 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
|
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
|
|
|
|
77 |
= 1.2.5 =
|
78 |
* Support for Bulk Actions(activate,deactivate,delete)
|
79 |
|
3 |
Donate link: http://xyzscripts.com/donate/
|
4 |
Tags: insert HTML, add HTML, insert adsense, insert ads, insert addthis code, insert flash , insert javascript, add javascript, insert css, add css, HTML to shortcode, integrate ad codes, raw html, embed html, html inserter, ad inserter, css inserter
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 5.2.1
|
7 |
+
Stable tag: 1.3
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Add HTML, CSS and javascript code to your pages and posts easily using shortcodes.
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 1.3 =
|
78 |
+
* Snippet selection support in classic editor block of Gutenberg
|
79 |
+
* Support for Search Snippet by name
|
80 |
+
* Navigation Improvements
|
81 |
+
|
82 |
= 1.2.5 =
|
83 |
* Support for Bulk Actions(activate,deactivate,delete)
|
84 |
|