Version Description
- Option to enable exception handling
- Option to preview snippet
- Database collation issue fixed
- Minor bugs fixed
Download this release
Release Info
Developer | f1logic |
Plugin | Insert PHP Code Snippet |
Version | 1.3.2 |
Comparing to | |
See all releases |
Code changes from version 1.3.1 to 1.3.2
- add_shortcode_tynimce.php +69 -69
- admin/about.php +0 -0
- admin/footer.php +167 -167
- admin/header.php +0 -0
- admin/install.php +31 -4
- admin/menu.php +5 -17
- admin/settings.php +14 -0
- admin/snippet-add.php +0 -0
- admin/snippet-delete.php +0 -0
- admin/snippet-edit.php +0 -0
- admin/snippet-status.php +0 -0
- admin/snippets.php +101 -96
- admin/uninstall.php +0 -0
- ajax-handler.php +0 -0
- css/xyz_ips_styles.css +0 -0
- direct_call.php +0 -0
- editor_plugin.js.php +166 -166
- images/activate.png +0 -0
- images/delete.png +0 -0
- images/edit.png +0 -0
- images/facebook.png +0 -0
- images/gplus.png +0 -0
- images/linkedin.png +0 -0
- images/logo.png +0 -0
- images/pause.png +0 -0
- images/preview.png +0 -0
- images/suggest.png +0 -0
- images/support.png +0 -0
- images/twitter.png +0 -0
- images/xyz_logo.png +0 -0
- insert-php-code-snippet.php +1 -1
- js/notice.js +0 -0
- readme.txt +9 -3
- shortcode-handler.php +118 -86
- widget.php +0 -0
- xyz-functions.php +102 -53
add_shortcode_tynimce.php
CHANGED
@@ -1,69 +1,69 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) )
|
3 |
-
exit;
|
4 |
-
|
5 |
-
add_action( 'admin_init', 'xyz_ips_tinymce_button' );
|
6 |
-
|
7 |
-
function xyz_ips_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_ips_register_tinymce_button' );
|
13 |
-
add_filter( 'mce_external_plugins', 'xyz_ips_add_tinymce_button' );
|
14 |
-
}
|
15 |
-
}
|
16 |
-
}
|
17 |
-
|
18 |
-
function xyz_ips_register_tinymce_button( $buttons ) {
|
19 |
-
|
20 |
-
$buttonName = 'xyz_ips_snippet_selecter';
|
21 |
-
|
22 |
-
array_push( $buttons, $buttonName);
|
23 |
-
return $buttons;
|
24 |
-
}
|
25 |
-
|
26 |
-
function xyz_ips_add_tinymce_button( $plugin_array ) {
|
27 |
-
$plugin_array['xyz_ips_buttons'] = get_site_url() . '/index.php?wp_ips=editor_plugin_js';
|
28 |
-
return $plugin_array;
|
29 |
-
}
|
30 |
-
|
31 |
-
/*if(!class_exists('XYZ_Insert_Php_TinyMCESelector')):
|
32 |
-
|
33 |
-
class XYZ_Insert_Php_TinyMCESelector{
|
34 |
-
var $buttonName = 'xyz_ips_snippet_selecter';
|
35 |
-
function addSelector(){
|
36 |
-
// Don't bother doing this stuff if the current user lacks permissions
|
37 |
-
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
|
38 |
-
return;
|
39 |
-
|
40 |
-
// Add only in Rich Editor mode
|
41 |
-
if ( get_user_option('rich_editing') == 'true') {
|
42 |
-
add_filter('mce_external_plugins', array($this, 'registerTmcePlugin'));
|
43 |
-
//you can use the filters mce_buttons_2, mce_buttons_3 and mce_buttons_4
|
44 |
-
//to add your button to other toolbars of your tinymce
|
45 |
-
add_filter('mce_buttons', array($this, 'registerButton'));
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
function registerButton($buttons){
|
50 |
-
array_push($buttons, "separator", $this->buttonName);
|
51 |
-
return $buttons;
|
52 |
-
}
|
53 |
-
|
54 |
-
function registerTmcePlugin($plugin_array){
|
55 |
-
$plugin_array[$this->buttonName] =get_site_url() . '/index.php?wp_ips=editor_plugin_js';
|
56 |
-
if ( get_user_option('rich_editing') == 'true')
|
57 |
-
//var_dump($plugin_array);
|
58 |
-
return $plugin_array;
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
endif;
|
63 |
-
|
64 |
-
if(!isset($shortcodesXYZEP)){
|
65 |
-
$shortcodesXYZEP = new XYZ_Insert_Php_TinyMCESelector();
|
66 |
-
add_action('admin_head', array($shortcodesXYZEP, 'addSelector'));
|
67 |
-
}*/
|
68 |
-
|
69 |
-
?>
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) )
|
3 |
+
exit;
|
4 |
+
|
5 |
+
add_action( 'admin_init', 'xyz_ips_tinymce_button' );
|
6 |
+
|
7 |
+
function xyz_ips_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_ips_register_tinymce_button' );
|
13 |
+
add_filter( 'mce_external_plugins', 'xyz_ips_add_tinymce_button' );
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
function xyz_ips_register_tinymce_button( $buttons ) {
|
19 |
+
|
20 |
+
$buttonName = 'xyz_ips_snippet_selecter';
|
21 |
+
|
22 |
+
array_push( $buttons, $buttonName);
|
23 |
+
return $buttons;
|
24 |
+
}
|
25 |
+
|
26 |
+
function xyz_ips_add_tinymce_button( $plugin_array ) {
|
27 |
+
$plugin_array['xyz_ips_buttons'] = get_site_url() . '/index.php?wp_ips=editor_plugin_js';
|
28 |
+
return $plugin_array;
|
29 |
+
}
|
30 |
+
|
31 |
+
/*if(!class_exists('XYZ_Insert_Php_TinyMCESelector')):
|
32 |
+
|
33 |
+
class XYZ_Insert_Php_TinyMCESelector{
|
34 |
+
var $buttonName = 'xyz_ips_snippet_selecter';
|
35 |
+
function addSelector(){
|
36 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
37 |
+
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
|
38 |
+
return;
|
39 |
+
|
40 |
+
// Add only in Rich Editor mode
|
41 |
+
if ( get_user_option('rich_editing') == 'true') {
|
42 |
+
add_filter('mce_external_plugins', array($this, 'registerTmcePlugin'));
|
43 |
+
//you can use the filters mce_buttons_2, mce_buttons_3 and mce_buttons_4
|
44 |
+
//to add your button to other toolbars of your tinymce
|
45 |
+
add_filter('mce_buttons', array($this, 'registerButton'));
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
function registerButton($buttons){
|
50 |
+
array_push($buttons, "separator", $this->buttonName);
|
51 |
+
return $buttons;
|
52 |
+
}
|
53 |
+
|
54 |
+
function registerTmcePlugin($plugin_array){
|
55 |
+
$plugin_array[$this->buttonName] =get_site_url() . '/index.php?wp_ips=editor_plugin_js';
|
56 |
+
if ( get_user_option('rich_editing') == 'true')
|
57 |
+
//var_dump($plugin_array);
|
58 |
+
return $plugin_array;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
endif;
|
63 |
+
|
64 |
+
if(!isset($shortcodesXYZEP)){
|
65 |
+
$shortcodesXYZEP = new XYZ_Insert_Php_TinyMCESelector();
|
66 |
+
add_action('admin_head', array($shortcodesXYZEP, 'addSelector'));
|
67 |
+
}*/
|
68 |
+
|
69 |
+
?>
|
admin/about.php
CHANGED
File without changes
|
admin/footer.php
CHANGED
@@ -1,167 +1,167 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) )
|
3 |
-
exit;
|
4 |
-
if(get_option('xyz_ips_premium_version_ads')==1){ ?>
|
5 |
-
<div id="xyz-ips-premium">
|
6 |
-
|
7 |
-
<div style="float: left; padding: 0 5px">
|
8 |
-
<h2 style="vertical-align: middle;">
|
9 |
-
<a target="_blank"
|
10 |
-
href="https://xyzscripts.com/wordpress-plugins/xyz-wp-insert-code-snippet/details">Fully Featured XYZ WP Insert Code Snippet Premium Plugin</a>
|
11 |
-
- Just 19 USD
|
12 |
-
</h2>
|
13 |
-
</div>
|
14 |
-
<div style="float: left; margin-top: 3px">
|
15 |
-
<a target="_blank"
|
16 |
-
href="https://xyzscripts.com/members/product/purchase/XYZWPICSPRE"><img
|
17 |
-
src="<?php echo plugins_url("images/orange_buynow.png",XYZ_INSERT_PHP_PLUGIN_FILE); ?>">
|
18 |
-
</a>
|
19 |
-
</div>
|
20 |
-
<div style="float: left; padding: 0 5px">
|
21 |
-
<h2 style="vertical-align: middle;text-shadow: 1px 1px 1px #686868">
|
22 |
-
( <a href="<?php echo admin_url('admin.php?page=insert-php-code-snippet-about');?>">Compare Features</a> )
|
23 |
-
</h2>
|
24 |
-
</div>
|
25 |
-
</div>
|
26 |
-
<?php
|
27 |
-
}
|
28 |
-
?>
|
29 |
-
<div style="clear: both;">
|
30 |
-
</div>
|
31 |
-
<div style="width: 100%">
|
32 |
-
<div class="xyz_ips_social_media">
|
33 |
-
<h3 class="xyz_ips_inner_head">
|
34 |
-
Follow Us
|
35 |
-
</h3>
|
36 |
-
<a target="_blank" href="http://facebook.com/xyzscripts" class="xyz_home_fbook"></a>
|
37 |
-
<a target="_blank" href="http://twitter.com/xyzscripts" class="xyz_home_twitt"></a>
|
38 |
-
<a target="_blank" href="https://plus.google.com/+Xyzscripts/" class="xyz_home_gplus"></a>
|
39 |
-
<a style="margin-right:0px;" target="_blank" href="https://www.linkedin.com/company/xyzscripts" class="xyz_home_linkedin"></a>
|
40 |
-
</div>
|
41 |
-
<div class="xyz_ips_sugession">
|
42 |
-
<h3 class="xyz_ips_inner_head"> Support</h3>
|
43 |
-
<p style="width:100%;"><a target="_blank" href="https://xyzscripts.com/donate/5" >Donate</a></p>
|
44 |
-
<p style="width:100%;"><a target="_blank" href="https://xyzscripts.com/support/" >Contact Us</a></p>
|
45 |
-
<p ><a target="_blank" href="https://wordpress.org/support/plugin/insert-php-code-snippet/reviews/" >Please Rate Us
|
46 |
-
</a></p>
|
47 |
-
<a target="_blank" href="https://wordpress.org/support/plugin/insert-php-code-snippet/reviews/" ><span class="xyz_new_star"></span></a>
|
48 |
-
<p style="width:100%;"><a target="_blank" href="https://wordpress.org/support/plugin/insert-php-code-snippet/" >Create a ticket at Wordpress forum</a>
|
49 |
-
</p>
|
50 |
-
</div>
|
51 |
-
<div class="xyz_ips_new_subscribe">
|
52 |
-
<h3 class="xyz_ips_inner_head">
|
53 |
-
Stay tuned for our updates
|
54 |
-
</h3>
|
55 |
-
<script language="javascript">
|
56 |
-
function check_email(emailString)
|
57 |
-
{
|
58 |
-
var mailPattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,})$/;
|
59 |
-
var matchArray = emailString.match(mailPattern);
|
60 |
-
if (emailString.length == 0)
|
61 |
-
return false;
|
62 |
-
if (matchArray == null) {
|
63 |
-
return false;
|
64 |
-
}else{
|
65 |
-
return true;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
function verify_lists(form)
|
69 |
-
{
|
70 |
-
var total=0;
|
71 |
-
var checkBox=form['chk[]'];
|
72 |
-
if(checkBox.length){
|
73 |
-
for(var i=0;i<checkBox.length;i++){
|
74 |
-
checkBox[i].checked?total++:null;
|
75 |
-
}
|
76 |
-
}
|
77 |
-
else{
|
78 |
-
checkBox.checked?total++:null;
|
79 |
-
}
|
80 |
-
if(total>0){
|
81 |
-
return true;
|
82 |
-
}
|
83 |
-
else{
|
84 |
-
return false;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
function verify_fields()
|
88 |
-
{
|
89 |
-
if(check_email(document.email_subscription.email.value) == false){
|
90 |
-
alert("Please check whether the email is correct.");
|
91 |
-
document.email_subscription.email.select();
|
92 |
-
return false;
|
93 |
-
}
|
94 |
-
else if(verify_lists(document.email_subscription)==false){
|
95 |
-
alert("Select atleast one list.");
|
96 |
-
}
|
97 |
-
else{
|
98 |
-
document.email_subscription.submit();
|
99 |
-
}
|
100 |
-
}
|
101 |
-
</script>
|
102 |
-
<?php global $current_user; wp_get_current_user();?>
|
103 |
-
<form action="https://xyzscripts.com/newsletter/index.php?page=list/subscribe" method="post" name="email_subscription" id="email_subscription" target="_blank">
|
104 |
-
<input type="hidden" name="fieldNameIds" value="1,">
|
105 |
-
<input type="hidden" name="redirActive" value="http://xyzscripts.com/subscription/pending/XYZWPIPSFRE">
|
106 |
-
<input type="hidden" name="redirPending" value="http://xyzscripts.com/subscription/active/XYZWPIPSFRE">
|
107 |
-
<input type="hidden" name="mode" value="1">
|
108 |
-
|
109 |
-
<input class="xyz_ips_name" type="text" placeholder="Name" name="field1" value="<?php
|
110 |
-
if ($current_user->user_firstname != "" || $current_user->user_lastname != "")
|
111 |
-
{
|
112 |
-
echo $current_user->user_firstname . " " . $current_user->user_lastname;
|
113 |
-
}
|
114 |
-
else if (strcasecmp($current_user->display_name, 'admin')!=0 && strcasecmp($current_user->display_name , "administrator")!=0 )
|
115 |
-
{
|
116 |
-
echo $current_user->display_name;
|
117 |
-
}
|
118 |
-
else if (strcasecmp($current_user->user_login ,"admin")!=0 && strcasecmp($current_user->user_login , "administrator")!=0 )
|
119 |
-
{
|
120 |
-
echo $current_user->user_login;
|
121 |
-
}
|
122 |
-
?>" >
|
123 |
-
|
124 |
-
<input class="xyz_ips_email" name="email"
|
125 |
-
type="text" placeholder="Email" value="<?php echo $current_user->user_email; ?>" />
|
126 |
-
|
127 |
-
<input id="xyz_ips_submit_ips_btn" type="submit" class="xyz_ips_sbmt_btn" value="Subscribe" name="Submit" onclick="javascript: if(!verify_fields()) return false; " />
|
128 |
-
|
129 |
-
<input type="hidden" name="listName" value="6,1,"/>
|
130 |
-
</form>
|
131 |
-
</div>
|
132 |
-
<div class="xyz_ips_inmotion" >
|
133 |
-
<a target="_blank" href="http://inmotion-hosting.evyy.net/c/1150074/260033/4222">
|
134 |
-
<img src="<?php echo plugins_url()?>/insert-php-code-snippet/images/xyz.png" class="xyz_inmotion_label"></a>
|
135 |
-
</div>
|
136 |
-
</div>
|
137 |
-
<div style="clear: both;">
|
138 |
-
</div>
|
139 |
-
<div style="width: 100%">
|
140 |
-
<div class="xyz_our_plugins_new">
|
141 |
-
<p class="xyz_plugin_head">
|
142 |
-
Our Plugins :
|
143 |
-
</p>
|
144 |
-
<a target="_blank" href="https://wordpress.org/plugins/social-media-auto-publish/"><span>1</span>Social Media Auto Publish</a>
|
145 |
-
<a target="_blank" href="https://wordpress.org/plugins/facebook-auto-publish/"><span>2</span>Facebook Auto Publish</a>
|
146 |
-
<a target="_blank" href="https://wordpress.org/plugins/twitter-auto-publish/"><span>3</span>Twitter Auto Publish</a>
|
147 |
-
<a target="_blank" href="https://wordpress.org/plugins/linkedin-auto-publish/"><span>4</span>LinkedIn Auto Publish</a>
|
148 |
-
<a target="_blank" href="https://wordpress.org/plugins/insert-html-snippet/"><span>5</span>Insert HTML Snippet</a>
|
149 |
-
<a target="_blank" href="https://wordpress.org/plugins/insert-php-code-snippet/"><span>6</span>Insert PHP Code Snippet</a>
|
150 |
-
<a target="_blank" href="https://wordpress.org/plugins/contact-form-manager/"><span>7</span>Contact Form Manager</a>
|
151 |
-
<a target="_blank" href="https://wordpress.org/plugins/newsletter-manager/"><span>8</span>Newsletter Manager</a>
|
152 |
-
<a target="_blank" href="https://wordpress.org/plugins/lightbox-pop/"><span>9</span>Lightbox Pop</a>
|
153 |
-
<a target="_blank" href="https://wordpress.org/plugins/full-screen-popup/"><span>10</span>Full Screen Popup</a>
|
154 |
-
<a target="_blank" href="https://wordpress.org/plugins/popup-dialog-box/"><span>11</span>Popup Dialog Box</a>
|
155 |
-
<a target="_blank" href="https://wordpress.org/plugins/quick-bar/"><span>12</span>Quick Bar</a>
|
156 |
-
<a target="_blank" href="https://wordpress.org/plugins/quick-box-popup/"><span>13</span>Quick Box Popup</a>
|
157 |
-
<a target="_blank" href="https://wordpress.org/plugins/custom-field-manager/"><span>14</span> Custom Field Manager</a>
|
158 |
-
<a target="_blank" href="https://wordpress.org/plugins/wp-filter-posts/"><span>15</span> WP Filter Posts</a>
|
159 |
-
<a target="_blank" href="https://wordpress.org/plugins/wp-gallery-manager/"><span>16</span> WP Gallery Manager</a>
|
160 |
-
</div>
|
161 |
-
</div>
|
162 |
-
<div class="xyz_poweredBy">
|
163 |
-
Powered by
|
164 |
-
<a href="http://xyzscripts.com" target="_blank">XYZScripts</a>
|
165 |
-
</div>
|
166 |
-
<div style="clear: both;"></div>
|
167 |
-
<p style="clear: both;"></p>
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) )
|
3 |
+
exit;
|
4 |
+
if(get_option('xyz_ips_premium_version_ads')==1){ ?>
|
5 |
+
<div id="xyz-ips-premium">
|
6 |
+
|
7 |
+
<div style="float: left; padding: 0 5px">
|
8 |
+
<h2 style="vertical-align: middle;">
|
9 |
+
<a target="_blank"
|
10 |
+
href="https://xyzscripts.com/wordpress-plugins/xyz-wp-insert-code-snippet/details">Fully Featured XYZ WP Insert Code Snippet Premium Plugin</a>
|
11 |
+
- Just 19 USD
|
12 |
+
</h2>
|
13 |
+
</div>
|
14 |
+
<div style="float: left; margin-top: 3px">
|
15 |
+
<a target="_blank"
|
16 |
+
href="https://xyzscripts.com/members/product/purchase/XYZWPICSPRE"><img
|
17 |
+
src="<?php echo plugins_url("images/orange_buynow.png",XYZ_INSERT_PHP_PLUGIN_FILE); ?>">
|
18 |
+
</a>
|
19 |
+
</div>
|
20 |
+
<div style="float: left; padding: 0 5px">
|
21 |
+
<h2 style="vertical-align: middle;text-shadow: 1px 1px 1px #686868">
|
22 |
+
( <a href="<?php echo admin_url('admin.php?page=insert-php-code-snippet-about');?>">Compare Features</a> )
|
23 |
+
</h2>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
<?php
|
27 |
+
}
|
28 |
+
?>
|
29 |
+
<div style="clear: both;">
|
30 |
+
</div>
|
31 |
+
<div style="width: 100%">
|
32 |
+
<div class="xyz_ips_social_media">
|
33 |
+
<h3 class="xyz_ips_inner_head">
|
34 |
+
Follow Us
|
35 |
+
</h3>
|
36 |
+
<a target="_blank" href="http://facebook.com/xyzscripts" class="xyz_home_fbook"></a>
|
37 |
+
<a target="_blank" href="http://twitter.com/xyzscripts" class="xyz_home_twitt"></a>
|
38 |
+
<a target="_blank" href="https://plus.google.com/+Xyzscripts/" class="xyz_home_gplus"></a>
|
39 |
+
<a style="margin-right:0px;" target="_blank" href="https://www.linkedin.com/company/xyzscripts" class="xyz_home_linkedin"></a>
|
40 |
+
</div>
|
41 |
+
<div class="xyz_ips_sugession">
|
42 |
+
<h3 class="xyz_ips_inner_head"> Support</h3>
|
43 |
+
<p style="width:100%;"><a target="_blank" href="https://xyzscripts.com/donate/5" >Donate</a></p>
|
44 |
+
<p style="width:100%;"><a target="_blank" href="https://xyzscripts.com/support/" >Contact Us</a></p>
|
45 |
+
<p ><a target="_blank" href="https://wordpress.org/support/plugin/insert-php-code-snippet/reviews/" >Please Rate Us
|
46 |
+
</a></p>
|
47 |
+
<a target="_blank" href="https://wordpress.org/support/plugin/insert-php-code-snippet/reviews/" ><span class="xyz_new_star"></span></a>
|
48 |
+
<p style="width:100%;"><a target="_blank" href="https://wordpress.org/support/plugin/insert-php-code-snippet/" >Create a ticket at Wordpress forum</a>
|
49 |
+
</p>
|
50 |
+
</div>
|
51 |
+
<div class="xyz_ips_new_subscribe">
|
52 |
+
<h3 class="xyz_ips_inner_head">
|
53 |
+
Stay tuned for our updates
|
54 |
+
</h3>
|
55 |
+
<script language="javascript">
|
56 |
+
function check_email(emailString)
|
57 |
+
{
|
58 |
+
var mailPattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,})$/;
|
59 |
+
var matchArray = emailString.match(mailPattern);
|
60 |
+
if (emailString.length == 0)
|
61 |
+
return false;
|
62 |
+
if (matchArray == null) {
|
63 |
+
return false;
|
64 |
+
}else{
|
65 |
+
return true;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
function verify_lists(form)
|
69 |
+
{
|
70 |
+
var total=0;
|
71 |
+
var checkBox=form['chk[]'];
|
72 |
+
if(checkBox.length){
|
73 |
+
for(var i=0;i<checkBox.length;i++){
|
74 |
+
checkBox[i].checked?total++:null;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
else{
|
78 |
+
checkBox.checked?total++:null;
|
79 |
+
}
|
80 |
+
if(total>0){
|
81 |
+
return true;
|
82 |
+
}
|
83 |
+
else{
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
function verify_fields()
|
88 |
+
{
|
89 |
+
if(check_email(document.email_subscription.email.value) == false){
|
90 |
+
alert("Please check whether the email is correct.");
|
91 |
+
document.email_subscription.email.select();
|
92 |
+
return false;
|
93 |
+
}
|
94 |
+
else if(verify_lists(document.email_subscription)==false){
|
95 |
+
alert("Select atleast one list.");
|
96 |
+
}
|
97 |
+
else{
|
98 |
+
document.email_subscription.submit();
|
99 |
+
}
|
100 |
+
}
|
101 |
+
</script>
|
102 |
+
<?php global $current_user; wp_get_current_user();?>
|
103 |
+
<form action="https://xyzscripts.com/newsletter/index.php?page=list/subscribe" method="post" name="email_subscription" id="email_subscription" target="_blank">
|
104 |
+
<input type="hidden" name="fieldNameIds" value="1,">
|
105 |
+
<input type="hidden" name="redirActive" value="http://xyzscripts.com/subscription/pending/XYZWPIPSFRE">
|
106 |
+
<input type="hidden" name="redirPending" value="http://xyzscripts.com/subscription/active/XYZWPIPSFRE">
|
107 |
+
<input type="hidden" name="mode" value="1">
|
108 |
+
|
109 |
+
<input class="xyz_ips_name" type="text" placeholder="Name" name="field1" value="<?php
|
110 |
+
if ($current_user->user_firstname != "" || $current_user->user_lastname != "")
|
111 |
+
{
|
112 |
+
echo $current_user->user_firstname . " " . $current_user->user_lastname;
|
113 |
+
}
|
114 |
+
else if (strcasecmp($current_user->display_name, 'admin')!=0 && strcasecmp($current_user->display_name , "administrator")!=0 )
|
115 |
+
{
|
116 |
+
echo $current_user->display_name;
|
117 |
+
}
|
118 |
+
else if (strcasecmp($current_user->user_login ,"admin")!=0 && strcasecmp($current_user->user_login , "administrator")!=0 )
|
119 |
+
{
|
120 |
+
echo $current_user->user_login;
|
121 |
+
}
|
122 |
+
?>" >
|
123 |
+
|
124 |
+
<input class="xyz_ips_email" name="email"
|
125 |
+
type="text" placeholder="Email" value="<?php echo $current_user->user_email; ?>" />
|
126 |
+
|
127 |
+
<input id="xyz_ips_submit_ips_btn" type="submit" class="xyz_ips_sbmt_btn" value="Subscribe" name="Submit" onclick="javascript: if(!verify_fields()) return false; " />
|
128 |
+
|
129 |
+
<input type="hidden" name="listName" value="6,1,"/>
|
130 |
+
</form>
|
131 |
+
</div>
|
132 |
+
<div class="xyz_ips_inmotion" >
|
133 |
+
<a target="_blank" href="http://inmotion-hosting.evyy.net/c/1150074/260033/4222">
|
134 |
+
<img src="<?php echo plugins_url()?>/insert-php-code-snippet/images/xyz.png" class="xyz_inmotion_label"></a>
|
135 |
+
</div>
|
136 |
+
</div>
|
137 |
+
<div style="clear: both;">
|
138 |
+
</div>
|
139 |
+
<div style="width: 100%">
|
140 |
+
<div class="xyz_our_plugins_new">
|
141 |
+
<p class="xyz_plugin_head">
|
142 |
+
Our Plugins :
|
143 |
+
</p>
|
144 |
+
<a target="_blank" href="https://wordpress.org/plugins/social-media-auto-publish/"><span>1</span>Social Media Auto Publish</a>
|
145 |
+
<a target="_blank" href="https://wordpress.org/plugins/facebook-auto-publish/"><span>2</span>Facebook Auto Publish</a>
|
146 |
+
<a target="_blank" href="https://wordpress.org/plugins/twitter-auto-publish/"><span>3</span>Twitter Auto Publish</a>
|
147 |
+
<a target="_blank" href="https://wordpress.org/plugins/linkedin-auto-publish/"><span>4</span>LinkedIn Auto Publish</a>
|
148 |
+
<a target="_blank" href="https://wordpress.org/plugins/insert-html-snippet/"><span>5</span>Insert HTML Snippet</a>
|
149 |
+
<a target="_blank" href="https://wordpress.org/plugins/insert-php-code-snippet/"><span>6</span>Insert PHP Code Snippet</a>
|
150 |
+
<a target="_blank" href="https://wordpress.org/plugins/contact-form-manager/"><span>7</span>Contact Form Manager</a>
|
151 |
+
<a target="_blank" href="https://wordpress.org/plugins/newsletter-manager/"><span>8</span>Newsletter Manager</a>
|
152 |
+
<a target="_blank" href="https://wordpress.org/plugins/lightbox-pop/"><span>9</span>Lightbox Pop</a>
|
153 |
+
<a target="_blank" href="https://wordpress.org/plugins/full-screen-popup/"><span>10</span>Full Screen Popup</a>
|
154 |
+
<a target="_blank" href="https://wordpress.org/plugins/popup-dialog-box/"><span>11</span>Popup Dialog Box</a>
|
155 |
+
<a target="_blank" href="https://wordpress.org/plugins/quick-bar/"><span>12</span>Quick Bar</a>
|
156 |
+
<a target="_blank" href="https://wordpress.org/plugins/quick-box-popup/"><span>13</span>Quick Box Popup</a>
|
157 |
+
<a target="_blank" href="https://wordpress.org/plugins/custom-field-manager/"><span>14</span> Custom Field Manager</a>
|
158 |
+
<a target="_blank" href="https://wordpress.org/plugins/wp-filter-posts/"><span>15</span> WP Filter Posts</a>
|
159 |
+
<a target="_blank" href="https://wordpress.org/plugins/wp-gallery-manager/"><span>16</span> WP Gallery Manager</a>
|
160 |
+
</div>
|
161 |
+
</div>
|
162 |
+
<div class="xyz_poweredBy">
|
163 |
+
Powered by
|
164 |
+
<a href="http://xyzscripts.com" target="_blank">XYZScripts</a>
|
165 |
+
</div>
|
166 |
+
<div style="clear: both;"></div>
|
167 |
+
<p style="clear: both;"></p>
|
admin/header.php
CHANGED
File without changes
|
admin/install.php
CHANGED
@@ -54,21 +54,48 @@ if (is_plugin_active($pluginName)) {
|
|
54 |
add_option('xyz_ips_auto_insert',1);
|
55 |
}
|
56 |
|
|
|
|
|
|
|
|
|
57 |
$xyz_ips_installed_date = get_option('xyz_ips_installed_date');
|
58 |
if ($xyz_ips_installed_date=="") {
|
59 |
$xyz_ips_installed_date = time();
|
60 |
update_option('xyz_ips_installed_date', $xyz_ips_installed_date);
|
61 |
}
|
62 |
add_option('xyz_ips_limit',20);
|
|
|
|
|
63 |
$queryInsertPhp = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."xyz_ips_short_code (
|
64 |
`id` int NOT NULL AUTO_INCREMENT,
|
65 |
-
`title` varchar(1000)
|
66 |
-
`content` longtext
|
67 |
-
`short_code` varchar(2000)
|
68 |
`status` int NOT NULL,
|
69 |
PRIMARY KEY (`id`)
|
70 |
-
) ENGINE=InnoDB
|
71 |
$wpdb->query($queryInsertPhp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
register_activation_hook( XYZ_INSERT_PHP_PLUGIN_FILE ,'xyz_ips_network_install');
|
74 |
?>
|
54 |
add_option('xyz_ips_auto_insert',1);
|
55 |
}
|
56 |
|
57 |
+
if(get_option('xyz_ips_auto_exception')==""){
|
58 |
+
add_option('xyz_ips_auto_exception',1);
|
59 |
+
}
|
60 |
+
|
61 |
$xyz_ips_installed_date = get_option('xyz_ips_installed_date');
|
62 |
if ($xyz_ips_installed_date=="") {
|
63 |
$xyz_ips_installed_date = time();
|
64 |
update_option('xyz_ips_installed_date', $xyz_ips_installed_date);
|
65 |
}
|
66 |
add_option('xyz_ips_limit',20);
|
67 |
+
|
68 |
+
$charset_collate = $wpdb->get_charset_collate();
|
69 |
$queryInsertPhp = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."xyz_ips_short_code (
|
70 |
`id` int NOT NULL AUTO_INCREMENT,
|
71 |
+
`title` varchar(1000) NOT NULL,
|
72 |
+
`content` longtext NOT NULL,
|
73 |
+
`short_code` varchar(2000) NOT NULL,
|
74 |
`status` int NOT NULL,
|
75 |
PRIMARY KEY (`id`)
|
76 |
+
) ENGINE=InnoDB ".$charset_collate." AUTO_INCREMENT=1";
|
77 |
$wpdb->query($queryInsertPhp);
|
78 |
+
|
79 |
+
|
80 |
+
//preview page
|
81 |
+
$user_ID = get_current_user_id();
|
82 |
+
$slug = 'xyz-ics-preview-page';
|
83 |
+
$title = 'Snippet Preview';
|
84 |
+
$content = '';
|
85 |
+
// Cheks if doen't exists a post with slug "wordpress-post-created-with-code".
|
86 |
+
if( !xyz_ips_page_exists_by_slug( $slug ) ) {
|
87 |
+
// Set the post ID
|
88 |
+
$post_id = wp_insert_post(
|
89 |
+
array(
|
90 |
+
'post_author' => $user_ID,
|
91 |
+
'post_name' => $slug,
|
92 |
+
'post_title' => $title,
|
93 |
+
'post_content' => $content,
|
94 |
+
'post_status' => 'draft',
|
95 |
+
'post_type' => 'page'
|
96 |
+
)
|
97 |
+
);
|
98 |
+
}
|
99 |
}
|
100 |
register_activation_hook( XYZ_INSERT_PHP_PLUGIN_FILE ,'xyz_ips_network_install');
|
101 |
?>
|
admin/menu.php
CHANGED
@@ -2,22 +2,10 @@
|
|
2 |
if ( ! defined( 'ABSPATH' ) )
|
3 |
exit;
|
4 |
|
5 |
-
if(isset($_GET['
|
6 |
-
|
7 |
-
}
|
8 |
-
|
9 |
-
if(isset($_GET['action']) && $_GET['action']=='snippet-add' ){
|
10 |
-
ob_start();
|
11 |
-
}
|
12 |
-
|
13 |
-
if(isset($_GET['action']) && $_GET['action']=='snippet-delete' ){
|
14 |
-
ob_start();
|
15 |
-
}
|
16 |
-
|
17 |
-
if(isset($_GET['action']) && $_GET['action']=='snippet-edit' ){
|
18 |
-
ob_start();
|
19 |
-
}
|
20 |
-
|
21 |
if(isset($_GET['page']) && $_GET['page']=='insert-php-code-snippet-suggest-features' ){
|
22 |
ob_start();
|
23 |
}
|
@@ -99,4 +87,4 @@ function xyz_ips_add_style_script(){
|
|
99 |
}
|
100 |
add_action('admin_enqueue_scripts', 'xyz_ips_add_style_script');
|
101 |
|
102 |
-
?>
|
2 |
if ( ! defined( 'ABSPATH' ) )
|
3 |
exit;
|
4 |
|
5 |
+
if(isset($_GET['page']) && $_GET['page']=='insert-php-code-snippet-manage' ){
|
6 |
+
ob_start();
|
7 |
+
}
|
8 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
if(isset($_GET['page']) && $_GET['page']=='insert-php-code-snippet-suggest-features' ){
|
10 |
ob_start();
|
11 |
}
|
87 |
}
|
88 |
add_action('admin_enqueue_scripts', 'xyz_ips_add_style_script');
|
89 |
|
90 |
+
?>
|
admin/settings.php
CHANGED
@@ -45,6 +45,9 @@ if($_POST){
|
|
45 |
$xyz_ips_auto_insert = intval($_POST['xyz_ips_auto_insert']);
|
46 |
update_option('xyz_ips_auto_insert',$xyz_ips_auto_insert);
|
47 |
|
|
|
|
|
|
|
48 |
$xyz_ips_sortfield=sanitize_text_field($_POST['xyz_ips_sort_by_field']);
|
49 |
|
50 |
if(($xyz_ips_sortfield=="id")||($xyz_ips_sortfield=="title"))
|
@@ -123,6 +126,17 @@ if($_POST){
|
|
123 |
</select>
|
124 |
</td>
|
125 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
<tr valign="top">
|
127 |
<td scope="row">
|
128 |
<label for="xyz_ips_pre_ads">Premium Version Ads</label>
|
45 |
$xyz_ips_auto_insert = intval($_POST['xyz_ips_auto_insert']);
|
46 |
update_option('xyz_ips_auto_insert',$xyz_ips_auto_insert);
|
47 |
|
48 |
+
$xyz_ips_auto_exception = intval($_POST['xyz_ips_auto_exception']);
|
49 |
+
update_option('xyz_ips_auto_exception',$xyz_ips_auto_exception);
|
50 |
+
|
51 |
$xyz_ips_sortfield=sanitize_text_field($_POST['xyz_ips_sort_by_field']);
|
52 |
|
53 |
if(($xyz_ips_sortfield=="id")||($xyz_ips_sortfield=="title"))
|
126 |
</select>
|
127 |
</td>
|
128 |
</tr>
|
129 |
+
<tr valign="top">
|
130 |
+
<td scope="row">
|
131 |
+
<label for="xyz_ips_auto_exception">Enabling automatic exception handling for PHP snippets</label>
|
132 |
+
</td>
|
133 |
+
<td>
|
134 |
+
<select name="xyz_ips_auto_exception" id="xyz_ips_auto_exception">
|
135 |
+
<option value="0" <?php selected(get_option('xyz_ips_auto_exception'),0);?>>Disable</option>
|
136 |
+
<option value="1" <?php selected(get_option('xyz_ips_auto_exception'),1);?>>Enable</option>
|
137 |
+
</select>
|
138 |
+
</td>
|
139 |
+
</tr>
|
140 |
<tr valign="top">
|
141 |
<td scope="row">
|
142 |
<label for="xyz_ips_pre_ads">Premium Version Ads</label>
|
admin/snippet-add.php
CHANGED
File without changes
|
admin/snippet-delete.php
CHANGED
File without changes
|
admin/snippet-edit.php
CHANGED
File without changes
|
admin/snippet-status.php
CHANGED
File without changes
|
admin/snippets.php
CHANGED
@@ -178,7 +178,7 @@ if($xyz_ips_message == 8)
|
|
178 |
<option value="2">Delete</option>
|
179 |
</select>
|
180 |
<input type="submit" title="Apply" name="apply_ips_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;">
|
181 |
-
|
182 |
|
183 |
|
184 |
<form name="manage_snippets" action="" method="post">
|
@@ -186,111 +186,116 @@ if($xyz_ips_message == 8)
|
|
186 |
<div class="xyz_ips_search_div" style="float:right;">
|
187 |
<table class="xyz_ips_search_div_table" style="width:100%;">
|
188 |
<tr>
|
189 |
-
|
190 |
-
|
191 |
<input type="text" name="snippet_name" value= "<?php if(isset($search_name)){echo esc_attr($search_name);}?>" placeholder="Search" >
|
192 |
<input type="submit" name="search" value="Go" />
|
193 |
-
|
194 |
</tr>
|
195 |
</table>
|
196 |
</div>
|
197 |
</form>
|
198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
|
|
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
</
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
</td>
|
226 |
-
<td id="xyz_ips_vAlign"><?php
|
227 |
-
echo esc_html($entry->title);
|
228 |
-
?></td>
|
229 |
-
<td id="xyz_ips_vAlign"><?php
|
230 |
-
if($entry->status == 2){echo 'NA';}
|
231 |
-
else
|
232 |
-
echo '[xyz-ips snippet="'.esc_html($entry->title).'"]';
|
233 |
-
?></td>
|
234 |
-
<td id="xyz_ips_vAlign">
|
235 |
-
<?php
|
236 |
-
if($entry->status == 2){
|
237 |
-
echo "Inactive";
|
238 |
-
}elseif ($entry->status == 1){
|
239 |
-
echo "Active";
|
240 |
-
}
|
241 |
-
|
242 |
-
?>
|
243 |
-
</td>
|
244 |
-
<?php
|
245 |
-
if($entry->status == 2){
|
246 |
-
$stat1 = admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-status&snippetId='.$snippetId.'&status=1&pageno='.$pagenum);
|
247 |
-
?>
|
248 |
-
<td style="text-align: center;"><a
|
249 |
-
href='<?php echo wp_nonce_url($stat1,'ips-pstat_'.$snippetId); ?>'><img
|
250 |
-
id="xyz_ips_img" title="Activate"
|
251 |
-
src="<?php echo plugins_url('images/activate.png',XYZ_INSERT_PHP_PLUGIN_FILE)?>">
|
252 |
-
</a>
|
253 |
-
</td>
|
254 |
-
<?php
|
255 |
-
}elseif ($entry->status == 1){
|
256 |
-
$stat2 = admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-status&snippetId='.$snippetId.'&status=2&pageno='.$pagenum);
|
257 |
-
?>
|
258 |
-
<td style="text-align: center;"><a
|
259 |
-
href='<?php echo wp_nonce_url($stat2,'ips-pstat_'.$snippetId); ?>'><img
|
260 |
-
id="xyz_ips_img" title="Deactivate"
|
261 |
-
src="<?php echo plugins_url('images/pause.png',XYZ_INSERT_PHP_PLUGIN_FILE)?>">
|
262 |
-
</a>
|
263 |
-
</td>
|
264 |
-
<?php
|
265 |
-
}
|
266 |
-
|
267 |
-
?>
|
268 |
-
|
269 |
-
<td style="text-align: center;"><a
|
270 |
-
href='<?php echo admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-edit&snippetId='.$snippetId.'&pageno='.$pagenum); ?>'><img
|
271 |
-
id="xyz_ips_img" title="Edit Snippet"
|
272 |
-
src="<?php echo plugins_url('images/edit.png',XYZ_INSERT_PHP_PLUGIN_FILE)?>">
|
273 |
-
</a>
|
274 |
-
</td>
|
275 |
-
|
276 |
-
<?php $delurl = admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-delete&snippetId='.$snippetId.'&pageno='.$pagenum);?>
|
277 |
-
<td style="text-align: center;" ><a
|
278 |
-
href='<?php echo wp_nonce_url($delurl,'ips-pdel_'.$snippetId); ?>'
|
279 |
-
onclick="javascript: return confirm('Please click \'OK\' to confirm ');"><img
|
280 |
-
id="xyz_ips_img" title="Delete Snippet"
|
281 |
-
src="<?php echo plugins_url('images/delete.png',XYZ_INSERT_PHP_PLUGIN_FILE)?>">
|
282 |
-
</a></td>
|
283 |
-
</tr>
|
284 |
-
<?php
|
285 |
-
$count++;
|
286 |
-
}
|
287 |
-
} else { ?>
|
288 |
-
<tr>
|
289 |
-
<td colspan="6" >PHP Code Snippets not found</td>
|
290 |
-
</tr>
|
291 |
-
<?php } ?>
|
292 |
-
</tbody>
|
293 |
-
</table>
|
294 |
|
295 |
<input id="xyz_ips_submit_ips"
|
296 |
style="cursor: pointer; margin-top:10px;margin-left:8px;" type="button"
|
@@ -320,7 +325,7 @@ if($xyz_ips_message == 8)
|
|
320 |
|
321 |
</fieldset>
|
322 |
|
323 |
-
|
324 |
|
325 |
</div>
|
326 |
<script type="text/javascript">
|
178 |
<option value="2">Delete</option>
|
179 |
</select>
|
180 |
<input type="submit" title="Apply" name="apply_ips_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;">
|
181 |
+
</form>
|
182 |
|
183 |
|
184 |
<form name="manage_snippets" action="" method="post">
|
186 |
<div class="xyz_ips_search_div" style="float:right;">
|
187 |
<table class="xyz_ips_search_div_table" style="width:100%;">
|
188 |
<tr>
|
|
|
|
|
189 |
<input type="text" name="snippet_name" value= "<?php if(isset($search_name)){echo esc_attr($search_name);}?>" placeholder="Search" >
|
190 |
<input type="submit" name="search" value="Go" />
|
|
|
191 |
</tr>
|
192 |
</table>
|
193 |
</div>
|
194 |
</form>
|
195 |
|
196 |
+
<table class="widefat" style="width: 99%; margin: 0 auto; border-bottom:none;">
|
197 |
+
<thead>
|
198 |
+
<tr>
|
199 |
+
<th scope="col" width="3%"><input type="checkbox" id="chkAllSnippets" /></th>
|
200 |
+
<th scope="col" >Tracking Name</th>
|
201 |
+
<th scope="col" >Snippet Short Code</th>
|
202 |
+
<th scope="col" >Status</th>
|
203 |
+
<th scope="col" colspan="4" style="text-align: center;">Action</th>
|
204 |
+
</tr>
|
205 |
+
</thead>
|
206 |
+
<tbody>
|
207 |
+
<?php
|
208 |
+
if( count($entries)>0 ) {
|
209 |
+
$count=1;
|
210 |
+
$class = '';
|
211 |
+
foreach( $entries as $entry ) {
|
212 |
+
$class = ( $count % 2 == 0 ) ? ' class="alternate"' : '';
|
213 |
+
$snippetId=intval($entry->id);
|
214 |
+
?>
|
215 |
+
<tr <?php echo $class; ?>>
|
216 |
+
<td style="vertical-align: middle !important;padding-left: 18px;">
|
217 |
+
<input type="checkbox" class="chk" value="<?php echo $snippetId; ?>" name="xyz_ips_snippet_ids[]" id="xyz_ips_snippet_ids" />
|
218 |
+
</td>
|
219 |
+
<td id="xyz_ips_vAlign"><?php
|
220 |
+
echo esc_html($entry->title);
|
221 |
+
?></td>
|
222 |
+
<td id="xyz_ips_vAlign"><?php
|
223 |
+
if($entry->status == 2){echo 'NA';}
|
224 |
+
else
|
225 |
+
echo '[xyz-ips snippet="'.esc_html($entry->title).'"]';
|
226 |
+
?></td>
|
227 |
+
<td id="xyz_ips_vAlign">
|
228 |
+
<?php
|
229 |
+
if($entry->status == 2){
|
230 |
+
echo "Inactive";
|
231 |
+
}elseif ($entry->status == 1){
|
232 |
+
echo "Active";
|
233 |
+
}
|
234 |
+
|
235 |
+
?>
|
236 |
+
</td>
|
237 |
+
<?php
|
238 |
+
if($entry->status == 2){
|
239 |
+
$stat1 = admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-status&snippetId='.$snippetId.'&status=1&pageno='.$pagenum);
|
240 |
+
?>
|
241 |
+
<td style="text-align: center;"><a
|
242 |
+
href='<?php echo wp_nonce_url($stat1,'ips-pstat_'.$snippetId); ?>'><img
|
243 |
+
id="xyz_ips_img" title="Activate"
|
244 |
+
src="<?php echo plugins_url('images/activate.png',XYZ_INSERT_PHP_PLUGIN_FILE)?>">
|
245 |
+
</a>
|
246 |
+
</td>
|
247 |
+
<?php
|
248 |
+
}elseif ($entry->status == 1){
|
249 |
+
$stat2 = admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-status&snippetId='.$snippetId.'&status=2&pageno='.$pagenum);
|
250 |
+
?>
|
251 |
+
<td style="text-align: center;"><a
|
252 |
+
href='<?php echo wp_nonce_url($stat2,'ips-pstat_'.$snippetId); ?>'><img
|
253 |
+
id="xyz_ips_img" title="Deactivate"
|
254 |
+
src="<?php echo plugins_url('images/pause.png',XYZ_INSERT_PHP_PLUGIN_FILE)?>">
|
255 |
+
</a>
|
256 |
+
</td>
|
257 |
+
<?php
|
258 |
+
}
|
259 |
|
260 |
+
?>
|
261 |
|
262 |
+
<td style="text-align: center;"><a
|
263 |
+
href='<?php echo admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-edit&snippetId='.$snippetId.'&pageno='.$pagenum); ?>'><img
|
264 |
+
id="xyz_ips_img" title="Edit Snippet"
|
265 |
+
src="<?php echo plugins_url('images/edit.png',XYZ_INSERT_PHP_PLUGIN_FILE)?>">
|
266 |
+
</a>
|
267 |
+
</td>
|
268 |
|
269 |
+
<?php $delurl = admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-delete&snippetId='.$snippetId.'&pageno='.$pagenum);?>
|
270 |
+
<td style="text-align: center;" ><a
|
271 |
+
href='<?php echo wp_nonce_url($delurl,'ips-pdel_'.$snippetId); ?>'
|
272 |
+
onclick="javascript: return confirm('Please click \'OK\' to confirm ');"><img
|
273 |
+
id="xyz_ips_img" title="Delete Snippet"
|
274 |
+
src="<?php echo plugins_url('images/delete.png',XYZ_INSERT_PHP_PLUGIN_FILE)?>">
|
275 |
+
</a></td>
|
276 |
|
277 |
+
<?php
|
278 |
+
$page_url =xyz_ips_get_link_by_slug('xyz-ics-preview-page');
|
279 |
+
$page_url =add_query_arg( 'preview', 'true', $page_url );
|
280 |
+
$page_url =add_query_arg( 'snippetId', $snippetId, $page_url );
|
281 |
+
$prewurl =esc_url($page_url);
|
282 |
+
?>
|
283 |
+
<td style="text-align: center;" >
|
284 |
+
<a href='<?php echo $prewurl;?>' target="_blank">
|
285 |
+
<img id="xyz_ips_img" title="Preview" src="<?php echo plugins_url('images/preview.png',XYZ_INSERT_PHP_PLUGIN_FILE)?>">
|
286 |
+
</a>
|
287 |
+
</td>
|
288 |
+
</tr>
|
289 |
+
<?php
|
290 |
+
$count++;
|
291 |
+
}
|
292 |
+
} else { ?>
|
293 |
+
<tr>
|
294 |
+
<td colspan="7" >PHP Code Snippets not found</td>
|
295 |
+
</tr>
|
296 |
+
<?php } ?>
|
297 |
+
</tbody>
|
298 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
<input id="xyz_ips_submit_ips"
|
301 |
style="cursor: pointer; margin-top:10px;margin-left:8px;" type="button"
|
325 |
|
326 |
</fieldset>
|
327 |
|
328 |
+
|
329 |
|
330 |
</div>
|
331 |
<script type="text/javascript">
|
admin/uninstall.php
CHANGED
File without changes
|
ajax-handler.php
CHANGED
File without changes
|
css/xyz_ips_styles.css
CHANGED
File without changes
|
direct_call.php
CHANGED
File without changes
|
editor_plugin.js.php
CHANGED
@@ -1,166 +1,166 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) )
|
3 |
-
exit;
|
4 |
-
|
5 |
-
header( 'Content-Type: text/javascript' );
|
6 |
-
if ( ! is_user_logged_in() )
|
7 |
-
die('You must be logged in to access this script.');
|
8 |
-
|
9 |
-
/*if(!isset($shortcodesXYZEP))
|
10 |
-
$shortcodesXYZEP = new XYZ_Insert_Php_TinyMCESelector();*/
|
11 |
-
|
12 |
-
global $wpdb;
|
13 |
-
$buttonName = 'xyz_ips_snippet_selecter';
|
14 |
-
|
15 |
-
$xyz_snippets_arr=$wpdb->get_results($wpdb->prepare( "SELECT id,title FROM ".$wpdb->prefix."xyz_ips_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 |
-
/* Register the buttons */
|
25 |
-
tinymce.create('tinymce.plugins.xyz_ips_snippet', {
|
26 |
-
init : function(ed, url) {
|
27 |
-
/**
|
28 |
-
* Inserts shortcode content
|
29 |
-
*/
|
30 |
-
ed.addButton( '<?php echo $buttonName;?>', {
|
31 |
-
title: 'Insert PHP Code Snippet',
|
32 |
-
type: 'menubutton',
|
33 |
-
icon: 'icon xyz-ips-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-ips 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_ips_buttons', tinymce.plugins.xyz_ips_snippet );
|
58 |
-
})();
|
59 |
-
<?php
|
60 |
-
}
|
61 |
-
/*else if(floatval(get_bloginfo('version'))>=3.9)
|
62 |
-
{
|
63 |
-
?>
|
64 |
-
(function() {
|
65 |
-
|
66 |
-
tinymce.PluginManager.add('<?php echo $buttonName; ?>', function( editor, url ) {
|
67 |
-
editor.addButton( '<?php echo $buttonName; ?>', {
|
68 |
-
title: 'Insert PHP Code Snippet',
|
69 |
-
type: 'menubutton',
|
70 |
-
icon: 'icon xyz-ips-own-icon',
|
71 |
-
menu: [
|
72 |
-
<?php foreach ($xyz_snippets_arr as $key=>$val) { ?>
|
73 |
-
{
|
74 |
-
text: '<?php echo addslashes($val['title']); ?>',
|
75 |
-
value: '[xyz-ips snippet="<?php echo addslashes($val['title']); ?>"]',
|
76 |
-
onclick: function() {
|
77 |
-
editor.insertContent(this.value());
|
78 |
-
}
|
79 |
-
},
|
80 |
-
<?php } ?>
|
81 |
-
]
|
82 |
-
});
|
83 |
-
});
|
84 |
-
|
85 |
-
})();
|
86 |
-
<?php }*/ else {
|
87 |
-
|
88 |
-
$xyz_snippets = array(
|
89 |
-
'title' =>'Insert PHP Code Snippet',
|
90 |
-
'url' => plugins_url('images/logo.png', XYZ_INSERT_PHP_PLUGIN_FILE),
|
91 |
-
'xyz_ips_snippets' => $xyz_snippets_arr
|
92 |
-
);
|
93 |
-
?>
|
94 |
-
|
95 |
-
var tinymce_<?php echo $buttonName; ?> =<?php echo json_encode($xyz_snippets) ?>;
|
96 |
-
|
97 |
-
|
98 |
-
(function() {
|
99 |
-
//******* Load plugin specific language pack
|
100 |
-
|
101 |
-
tinymce.create('tinymce.plugins.<?php echo $buttonName; ?>', {
|
102 |
-
/**
|
103 |
-
* Initializes the plugin, this will be executed after the plugin has been created.
|
104 |
-
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
105 |
-
* of the editor instance to intercept that event.
|
106 |
-
*
|
107 |
-
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
108 |
-
* @param {string} url Absolute URL to where the plugin is located.
|
109 |
-
*/
|
110 |
-
init : function(ed, url) {
|
111 |
-
|
112 |
-
tinymce_<?php echo $buttonName; ?>.insert = function(){
|
113 |
-
if(this.v && this.v != ''){
|
114 |
-
tinymce.execCommand('mceInsertContent', false, '[xyz-ips snippet="'+tinymce_<?php echo $buttonName; ?>.xyz_ips_snippets[this.v]['title']+'"]');
|
115 |
-
}
|
116 |
-
};
|
117 |
-
|
118 |
-
},
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Creates control instances based in the incomming name. This method is normally not
|
122 |
-
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
123 |
-
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
124 |
-
* method can be used to create those.
|
125 |
-
*
|
126 |
-
* @param {String} n Name of the control to create.
|
127 |
-
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
128 |
-
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
129 |
-
*/
|
130 |
-
createControl : function(n, cm) {
|
131 |
-
if(n=='<?php echo $buttonName; ?>'){
|
132 |
-
var c = cm.createSplitButton('<?php echo $buttonName; ?>', {
|
133 |
-
title : tinymce_<?php echo $buttonName; ?>.title,
|
134 |
-
image : tinymce_<?php echo $buttonName; ?>.url,
|
135 |
-
onclick : tinymce_<?php echo $buttonName; ?>.insert
|
136 |
-
});
|
137 |
-
|
138 |
-
// Add some values to the list box
|
139 |
-
|
140 |
-
|
141 |
-
c.onRenderMenu.add(function(c, m){
|
142 |
-
for (var id in tinymce_<?php echo $buttonName; ?>.xyz_ips_snippets){
|
143 |
-
m.add({
|
144 |
-
v : id,
|
145 |
-
title : tinymce_<?php echo $buttonName; ?>.xyz_ips_snippets[id]['title'],
|
146 |
-
onclick : tinymce_<?php echo $buttonName; ?>.insert
|
147 |
-
});
|
148 |
-
}
|
149 |
-
});
|
150 |
-
|
151 |
-
|
152 |
-
// Return the new listbox instance
|
153 |
-
return c;
|
154 |
-
}
|
155 |
-
|
156 |
-
return null;
|
157 |
-
},
|
158 |
-
|
159 |
-
|
160 |
-
});
|
161 |
-
|
162 |
-
// Register plugin
|
163 |
-
tinymce.PluginManager.add('<?php echo $buttonName; ?>', tinymce.plugins.<?php echo $buttonName; ?>);
|
164 |
-
})();
|
165 |
-
|
166 |
-
<?php } ?>
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) )
|
3 |
+
exit;
|
4 |
+
|
5 |
+
header( 'Content-Type: text/javascript' );
|
6 |
+
if ( ! is_user_logged_in() )
|
7 |
+
die('You must be logged in to access this script.');
|
8 |
+
|
9 |
+
/*if(!isset($shortcodesXYZEP))
|
10 |
+
$shortcodesXYZEP = new XYZ_Insert_Php_TinyMCESelector();*/
|
11 |
+
|
12 |
+
global $wpdb;
|
13 |
+
$buttonName = 'xyz_ips_snippet_selecter';
|
14 |
+
|
15 |
+
$xyz_snippets_arr=$wpdb->get_results($wpdb->prepare( "SELECT id,title FROM ".$wpdb->prefix."xyz_ips_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 |
+
/* Register the buttons */
|
25 |
+
tinymce.create('tinymce.plugins.xyz_ips_snippet', {
|
26 |
+
init : function(ed, url) {
|
27 |
+
/**
|
28 |
+
* Inserts shortcode content
|
29 |
+
*/
|
30 |
+
ed.addButton( '<?php echo $buttonName;?>', {
|
31 |
+
title: 'Insert PHP Code Snippet',
|
32 |
+
type: 'menubutton',
|
33 |
+
icon: 'icon xyz-ips-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-ips 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_ips_buttons', tinymce.plugins.xyz_ips_snippet );
|
58 |
+
})();
|
59 |
+
<?php
|
60 |
+
}
|
61 |
+
/*else if(floatval(get_bloginfo('version'))>=3.9)
|
62 |
+
{
|
63 |
+
?>
|
64 |
+
(function() {
|
65 |
+
|
66 |
+
tinymce.PluginManager.add('<?php echo $buttonName; ?>', function( editor, url ) {
|
67 |
+
editor.addButton( '<?php echo $buttonName; ?>', {
|
68 |
+
title: 'Insert PHP Code Snippet',
|
69 |
+
type: 'menubutton',
|
70 |
+
icon: 'icon xyz-ips-own-icon',
|
71 |
+
menu: [
|
72 |
+
<?php foreach ($xyz_snippets_arr as $key=>$val) { ?>
|
73 |
+
{
|
74 |
+
text: '<?php echo addslashes($val['title']); ?>',
|
75 |
+
value: '[xyz-ips snippet="<?php echo addslashes($val['title']); ?>"]',
|
76 |
+
onclick: function() {
|
77 |
+
editor.insertContent(this.value());
|
78 |
+
}
|
79 |
+
},
|
80 |
+
<?php } ?>
|
81 |
+
]
|
82 |
+
});
|
83 |
+
});
|
84 |
+
|
85 |
+
})();
|
86 |
+
<?php }*/ else {
|
87 |
+
|
88 |
+
$xyz_snippets = array(
|
89 |
+
'title' =>'Insert PHP Code Snippet',
|
90 |
+
'url' => plugins_url('images/logo.png', XYZ_INSERT_PHP_PLUGIN_FILE),
|
91 |
+
'xyz_ips_snippets' => $xyz_snippets_arr
|
92 |
+
);
|
93 |
+
?>
|
94 |
+
|
95 |
+
var tinymce_<?php echo $buttonName; ?> =<?php echo json_encode($xyz_snippets) ?>;
|
96 |
+
|
97 |
+
|
98 |
+
(function() {
|
99 |
+
//******* Load plugin specific language pack
|
100 |
+
|
101 |
+
tinymce.create('tinymce.plugins.<?php echo $buttonName; ?>', {
|
102 |
+
/**
|
103 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
104 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
105 |
+
* of the editor instance to intercept that event.
|
106 |
+
*
|
107 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
108 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
109 |
+
*/
|
110 |
+
init : function(ed, url) {
|
111 |
+
|
112 |
+
tinymce_<?php echo $buttonName; ?>.insert = function(){
|
113 |
+
if(this.v && this.v != ''){
|
114 |
+
tinymce.execCommand('mceInsertContent', false, '[xyz-ips snippet="'+tinymce_<?php echo $buttonName; ?>.xyz_ips_snippets[this.v]['title']+'"]');
|
115 |
+
}
|
116 |
+
};
|
117 |
+
|
118 |
+
},
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Creates control instances based in the incomming name. This method is normally not
|
122 |
+
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
123 |
+
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
124 |
+
* method can be used to create those.
|
125 |
+
*
|
126 |
+
* @param {String} n Name of the control to create.
|
127 |
+
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
128 |
+
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
129 |
+
*/
|
130 |
+
createControl : function(n, cm) {
|
131 |
+
if(n=='<?php echo $buttonName; ?>'){
|
132 |
+
var c = cm.createSplitButton('<?php echo $buttonName; ?>', {
|
133 |
+
title : tinymce_<?php echo $buttonName; ?>.title,
|
134 |
+
image : tinymce_<?php echo $buttonName; ?>.url,
|
135 |
+
onclick : tinymce_<?php echo $buttonName; ?>.insert
|
136 |
+
});
|
137 |
+
|
138 |
+
// Add some values to the list box
|
139 |
+
|
140 |
+
|
141 |
+
c.onRenderMenu.add(function(c, m){
|
142 |
+
for (var id in tinymce_<?php echo $buttonName; ?>.xyz_ips_snippets){
|
143 |
+
m.add({
|
144 |
+
v : id,
|
145 |
+
title : tinymce_<?php echo $buttonName; ?>.xyz_ips_snippets[id]['title'],
|
146 |
+
onclick : tinymce_<?php echo $buttonName; ?>.insert
|
147 |
+
});
|
148 |
+
}
|
149 |
+
});
|
150 |
+
|
151 |
+
|
152 |
+
// Return the new listbox instance
|
153 |
+
return c;
|
154 |
+
}
|
155 |
+
|
156 |
+
return null;
|
157 |
+
},
|
158 |
+
|
159 |
+
|
160 |
+
});
|
161 |
+
|
162 |
+
// Register plugin
|
163 |
+
tinymce.PluginManager.add('<?php echo $buttonName; ?>', tinymce.plugins.<?php echo $buttonName; ?>);
|
164 |
+
})();
|
165 |
+
|
166 |
+
<?php } ?>
|
images/activate.png
CHANGED
File without changes
|
images/delete.png
CHANGED
File without changes
|
images/edit.png
CHANGED
File without changes
|
images/facebook.png
CHANGED
File without changes
|
images/gplus.png
CHANGED
File without changes
|
images/linkedin.png
CHANGED
File without changes
|
images/logo.png
CHANGED
File without changes
|
images/pause.png
CHANGED
File without changes
|
images/preview.png
ADDED
Binary file
|
images/suggest.png
CHANGED
File without changes
|
images/support.png
CHANGED
File without changes
|
images/twitter.png
CHANGED
File without changes
|
images/xyz_logo.png
CHANGED
File without changes
|
insert-php-code-snippet.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Insert PHP Code Snippet
|
4 |
Plugin URI: http://xyzscripts.com/wordpress-plugins/insert-php-code-snippet/
|
5 |
Description: Insert and run PHP code in your pages and posts easily using shortcodes. This plugin lets you create a shortcode corresponding to any random PHP code 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-php-code-snippet
|
3 |
Plugin Name: Insert PHP Code Snippet
|
4 |
Plugin URI: http://xyzscripts.com/wordpress-plugins/insert-php-code-snippet/
|
5 |
Description: Insert and run PHP code in your pages and posts easily using shortcodes. This plugin lets you create a shortcode corresponding to any random PHP code and use the same in your posts, pages or widgets.
|
6 |
+
Version: 1.3.2
|
7 |
Author: xyzscripts.com
|
8 |
Author URI: http://xyzscripts.com/
|
9 |
Text Domain: insert-php-code-snippet
|
js/notice.js
CHANGED
File without changes
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
|
2 |
Contributors: f1logic
|
3 |
Donate link: http://xyzscripts.com/donate/
|
4 |
Tags: insert PHP, add PHP, insert PHP code, insert PHP tag, insert PHP snippet, insert PHP code snippet , insert PHP snippet, add PHP code, insert PHP tag, add PHP snippet, add PHP code snippet, integrate PHP codes, raw PHP, embed PHP, PHP inserter, PHP code inserter, PHP snippet inserter
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 1.3.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Add PHP code to your pages and posts easily using shortcodes.
|
@@ -66,6 +66,12 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
|
|
66 |
|
67 |
== Changelog ==
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
= 1.3.1 =
|
70 |
* Notice errors fixed
|
71 |
|
1 |
+
=== Insert PHP Code Snippet ===
|
2 |
Contributors: f1logic
|
3 |
Donate link: http://xyzscripts.com/donate/
|
4 |
Tags: insert PHP, add PHP, insert PHP code, insert PHP tag, insert PHP snippet, insert PHP code snippet , insert PHP snippet, add PHP code, insert PHP tag, add PHP snippet, add PHP code snippet, integrate PHP codes, raw PHP, embed PHP, PHP inserter, PHP code inserter, PHP snippet inserter
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 5.7
|
7 |
+
Stable tag: 1.3.2
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Add PHP code to your pages and posts easily using shortcodes.
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
+
= 1.3.2 =
|
70 |
+
* Option to enable exception handling
|
71 |
+
* Option to preview snippet
|
72 |
+
* Database collation issue fixed
|
73 |
+
* Minor bugs fixed
|
74 |
+
|
75 |
= 1.3.1 =
|
76 |
* Notice errors fixed
|
77 |
|
shortcode-handler.php
CHANGED
@@ -1,86 +1,118 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) )
|
3 |
-
exit;
|
4 |
-
global $wpdb;
|
5 |
-
add_shortcode('xyz-ips','xyz_ips_display_content');
|
6 |
-
function xyz_ips_display_content($xyz_snippet_name){
|
7 |
-
global $wpdb;
|
8 |
-
if(is_array($xyz_snippet_name)&& isset($xyz_snippet_name['snippet'])){
|
9 |
-
$snippet_name = $xyz_snippet_name['snippet'];
|
10 |
-
$query = $wpdb->get_results($wpdb->prepare( "SELECT * FROM ".$wpdb->prefix."xyz_ips_short_code WHERE title=%s" ,$snippet_name));
|
11 |
-
if(count($query)>0){
|
12 |
-
foreach ($query as $sippetdetails){
|
13 |
-
if($sippetdetails->status==1){
|
14 |
-
/* if(is_numeric(ini_get('output_buffering'))){
|
15 |
-
$tmp=ob_get_contents();
|
16 |
-
if(strlen($tmp)>0)
|
17 |
-
ob_clean();*/
|
18 |
-
ob_start();
|
19 |
-
$content_to_eval=$sippetdetails->content;
|
20 |
-
|
21 |
-
/***** to handle old codes : start *****/
|
22 |
-
|
23 |
-
if(get_option('xyz_ips_auto_insert')==1){
|
24 |
-
$xyz_ips_content_start='<?php';
|
25 |
-
$new_line="\r\n";
|
26 |
-
$xyz_ips_content_end='?>';
|
27 |
-
|
28 |
-
if (stripos($content_to_eval, '<?php') !== false)
|
29 |
-
$tag_start_position=stripos($content_to_eval,'<?php');
|
30 |
-
else
|
31 |
-
$tag_start_position="-1";
|
32 |
-
|
33 |
-
if (stripos($content_to_eval, '?>') !== false)
|
34 |
-
$tag_end_position=stripos($content_to_eval,'?>');
|
35 |
-
else
|
36 |
-
$tag_end_position="-1";
|
37 |
-
|
38 |
-
if(stripos($content_to_eval, '<?php') === false && stripos($content_to_eval, '?>') === false)
|
39 |
-
{
|
40 |
-
$content_to_eval=$xyz_ips_content_start.$new_line.$content_to_eval;
|
41 |
-
}
|
42 |
-
else if(stripos($content_to_eval, '<?php') !== false)
|
43 |
-
{
|
44 |
-
if($tag_start_position>=0 && $tag_end_position>=0 && $tag_start_position>$tag_end_position)
|
45 |
-
{
|
46 |
-
$content_to_eval=$xyz_ips_content_start.$new_line.$content_to_eval;
|
47 |
-
}
|
48 |
-
}
|
49 |
-
else if(stripos($content_to_eval, '<?php') === false)
|
50 |
-
{
|
51 |
-
if (stripos($content_to_eval, '?>') !== false)
|
52 |
-
{
|
53 |
-
$content_to_eval=$xyz_ips_content_start.$new_line.$content_to_eval;
|
54 |
-
}
|
55 |
-
}
|
56 |
-
$content_to_eval='?>'.$content_to_eval;
|
57 |
-
}
|
58 |
-
|
59 |
-
/***** to handle old codes : end *****/
|
60 |
-
else{
|
61 |
-
if(substr(trim($content_to_eval), 0,5)=='<?php')
|
62 |
-
$content_to_eval='?>'.$content_to_eval;
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) )
|
3 |
+
exit;
|
4 |
+
global $wpdb;
|
5 |
+
add_shortcode('xyz-ips','xyz_ips_display_content');
|
6 |
+
function xyz_ips_display_content($xyz_snippet_name){
|
7 |
+
global $wpdb;
|
8 |
+
if(is_array($xyz_snippet_name)&& isset($xyz_snippet_name['snippet'])){
|
9 |
+
$snippet_name = $xyz_snippet_name['snippet'];
|
10 |
+
$query = $wpdb->get_results($wpdb->prepare( "SELECT * FROM ".$wpdb->prefix."xyz_ips_short_code WHERE title=%s" ,$snippet_name));
|
11 |
+
if(count($query)>0){
|
12 |
+
foreach ($query as $sippetdetails){
|
13 |
+
if($sippetdetails->status==1){
|
14 |
+
/* if(is_numeric(ini_get('output_buffering'))){
|
15 |
+
$tmp=ob_get_contents();
|
16 |
+
if(strlen($tmp)>0)
|
17 |
+
ob_clean();*/
|
18 |
+
ob_start();
|
19 |
+
$content_to_eval=$sippetdetails->content;
|
20 |
+
|
21 |
+
/***** to handle old codes : start *****/
|
22 |
+
|
23 |
+
if(get_option('xyz_ips_auto_insert')==1){
|
24 |
+
$xyz_ips_content_start='<?php';
|
25 |
+
$new_line="\r\n";
|
26 |
+
$xyz_ips_content_end='?>';
|
27 |
+
|
28 |
+
if (stripos($content_to_eval, '<?php') !== false)
|
29 |
+
$tag_start_position=stripos($content_to_eval,'<?php');
|
30 |
+
else
|
31 |
+
$tag_start_position="-1";
|
32 |
+
|
33 |
+
if (stripos($content_to_eval, '?>') !== false)
|
34 |
+
$tag_end_position=stripos($content_to_eval,'?>');
|
35 |
+
else
|
36 |
+
$tag_end_position="-1";
|
37 |
+
|
38 |
+
if(stripos($content_to_eval, '<?php') === false && stripos($content_to_eval, '?>') === false)
|
39 |
+
{
|
40 |
+
$content_to_eval=$xyz_ips_content_start.$new_line.$content_to_eval;
|
41 |
+
}
|
42 |
+
else if(stripos($content_to_eval, '<?php') !== false)
|
43 |
+
{
|
44 |
+
if($tag_start_position>=0 && $tag_end_position>=0 && $tag_start_position>$tag_end_position)
|
45 |
+
{
|
46 |
+
$content_to_eval=$xyz_ips_content_start.$new_line.$content_to_eval;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
else if(stripos($content_to_eval, '<?php') === false)
|
50 |
+
{
|
51 |
+
if (stripos($content_to_eval, '?>') !== false)
|
52 |
+
{
|
53 |
+
$content_to_eval=$xyz_ips_content_start.$new_line.$content_to_eval;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
$content_to_eval='?>'.$content_to_eval;
|
57 |
+
}
|
58 |
+
|
59 |
+
/***** to handle old codes : end *****/
|
60 |
+
else{
|
61 |
+
if(substr(trim($content_to_eval), 0,5)=='<?php')
|
62 |
+
$content_to_eval='?>'.$content_to_eval;
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
if(get_option('xyz_ips_auto_exception')==1) {
|
68 |
+
|
69 |
+
$str1 = " try{";
|
70 |
+
$var="$";
|
71 |
+
$str2 = "}catch(Exception ".$var."e) {echo 'Caught exception: '.".$var."e->getMessage();}";
|
72 |
+
|
73 |
+
$first_start_tag=strpos($content_to_eval,"<?php");
|
74 |
+
$last_end_tag=strrpos($content_to_eval,"?>");
|
75 |
+
$last_start_tag=strrpos($content_to_eval,"<?php");
|
76 |
+
|
77 |
+
if($first_start_tag>=0) {
|
78 |
+
$new_pos=$first_start_tag+5; //add length of php start tag
|
79 |
+
$content_to_eval=substr_replace( $content_to_eval, $str1, $new_pos, 0 );
|
80 |
+
}
|
81 |
+
if($last_end_tag<$last_start_tag) {
|
82 |
+
$content_to_eval=$content_to_eval.$str2;
|
83 |
+
}
|
84 |
+
else {
|
85 |
+
if($last_end_tag>0) {
|
86 |
+
$new_pos=$last_end_tag+5; //add length of $str1
|
87 |
+
$content_to_eval=substr_replace( $content_to_eval, $str2, $new_pos, 0 );
|
88 |
+
}
|
89 |
+
else if($last_end_tag==0) {
|
90 |
+
$content_to_eval=$content_to_eval.$str2;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
//echo $content_to_eval;die;
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
eval($content_to_eval);
|
98 |
+
$xyz_em_content = ob_get_contents();
|
99 |
+
// ob_clean();
|
100 |
+
ob_end_clean();
|
101 |
+
return $xyz_em_content;
|
102 |
+
/* }
|
103 |
+
else{
|
104 |
+
eval($sippetdetails->content);
|
105 |
+
}*/
|
106 |
+
}
|
107 |
+
else{
|
108 |
+
return '';
|
109 |
+
}
|
110 |
+
break;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
else{
|
114 |
+
return '';
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
add_filter('widget_text', 'do_shortcode'); // to run shortcodes in text widgets
|
widget.php
CHANGED
File without changes
|
xyz-functions.php
CHANGED
@@ -1,53 +1,102 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) )
|
3 |
-
exit;
|
4 |
-
|
5 |
-
if(!function_exists('xyz_ips_plugin_get_version'))
|
6 |
-
{
|
7 |
-
function xyz_ips_plugin_get_version()
|
8 |
-
{
|
9 |
-
if ( ! function_exists( 'get_plugins' ) )
|
10 |
-
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
11 |
-
$plugin_folder = get_plugins( '/' . plugin_basename( dirname( XYZ_INSERT_PHP_PLUGIN_FILE ) ) );
|
12 |
-
return $plugin_folder['insert-php-code-snippet.php']['Version'];
|
13 |
-
}
|
14 |
-
}
|
15 |
-
|
16 |
-
if(!function_exists('xyz_trim_deep'))
|
17 |
-
{
|
18 |
-
|
19 |
-
function xyz_trim_deep($value) {
|
20 |
-
if ( is_array($value) ) {
|
21 |
-
$value = array_map('xyz_trim_deep', $value);
|
22 |
-
} elseif ( is_object($value) ) {
|
23 |
-
$vars = get_object_vars( $value );
|
24 |
-
foreach ($vars as $key=>$data) {
|
25 |
-
$value->{$key} = xyz_trim_deep( $data );
|
26 |
-
}
|
27 |
-
} else {
|
28 |
-
$value = trim($value);
|
29 |
-
}
|
30 |
-
|
31 |
-
return $value;
|
32 |
-
}
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
|
37 |
-
if(!function_exists('xyz_ips_links')){
|
38 |
-
function xyz_ips_links($links, $file) {
|
39 |
-
$base = plugin_basename(XYZ_INSERT_PHP_PLUGIN_FILE);
|
40 |
-
if ($file == $base) {
|
41 |
-
|
42 |
-
$links[] = '<a href="https://xyzscripts.com/support/" class="xyz_support" title="Support"></a>';
|
43 |
-
$links[] = '<a href="https://twitter.com/xyzscripts" class="xyz_twitt" title="Follow us on Twitter"></a>';
|
44 |
-
$links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_fbook" title="Like us on Facebook"></a>';
|
45 |
-
$links[] = '<a href="https://plus.google.com/+Xyzscripts/" class="xyz_gplus" title="+1 us on Google+"></a>';
|
46 |
-
$links[] = '<a href="https://www.linkedin.com/company/xyzscripts" class="xyz_linkedin" title="Follow us on LinkedIn"></a>';
|
47 |
-
}
|
48 |
-
return $links;
|
49 |
-
}
|
50 |
-
}
|
51 |
-
add_filter( 'plugin_row_meta','xyz_ips_links',10,2);
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) )
|
3 |
+
exit;
|
4 |
+
|
5 |
+
if(!function_exists('xyz_ips_plugin_get_version'))
|
6 |
+
{
|
7 |
+
function xyz_ips_plugin_get_version()
|
8 |
+
{
|
9 |
+
if ( ! function_exists( 'get_plugins' ) )
|
10 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
11 |
+
$plugin_folder = get_plugins( '/' . plugin_basename( dirname( XYZ_INSERT_PHP_PLUGIN_FILE ) ) );
|
12 |
+
return $plugin_folder['insert-php-code-snippet.php']['Version'];
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
if(!function_exists('xyz_trim_deep'))
|
17 |
+
{
|
18 |
+
|
19 |
+
function xyz_trim_deep($value) {
|
20 |
+
if ( is_array($value) ) {
|
21 |
+
$value = array_map('xyz_trim_deep', $value);
|
22 |
+
} elseif ( is_object($value) ) {
|
23 |
+
$vars = get_object_vars( $value );
|
24 |
+
foreach ($vars as $key=>$data) {
|
25 |
+
$value->{$key} = xyz_trim_deep( $data );
|
26 |
+
}
|
27 |
+
} else {
|
28 |
+
$value = trim($value);
|
29 |
+
}
|
30 |
+
|
31 |
+
return $value;
|
32 |
+
}
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
if(!function_exists('xyz_ips_links')){
|
38 |
+
function xyz_ips_links($links, $file) {
|
39 |
+
$base = plugin_basename(XYZ_INSERT_PHP_PLUGIN_FILE);
|
40 |
+
if ($file == $base) {
|
41 |
+
|
42 |
+
$links[] = '<a href="https://xyzscripts.com/support/" class="xyz_support" title="Support"></a>';
|
43 |
+
$links[] = '<a href="https://twitter.com/xyzscripts" class="xyz_twitt" title="Follow us on Twitter"></a>';
|
44 |
+
$links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_fbook" title="Like us on Facebook"></a>';
|
45 |
+
$links[] = '<a href="https://plus.google.com/+Xyzscripts/" class="xyz_gplus" title="+1 us on Google+"></a>';
|
46 |
+
$links[] = '<a href="https://www.linkedin.com/company/xyzscripts" class="xyz_linkedin" title="Follow us on LinkedIn"></a>';
|
47 |
+
}
|
48 |
+
return $links;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
add_filter( 'plugin_row_meta','xyz_ips_links',10,2);
|
52 |
+
|
53 |
+
if(!function_exists('xyz_ips_page_exists_by_slug'))
|
54 |
+
{
|
55 |
+
function xyz_ips_page_exists_by_slug( $post_slug ) {
|
56 |
+
$args_posts = array(
|
57 |
+
'post_type' => 'page',
|
58 |
+
'post_status' => 'any',
|
59 |
+
'name' => $post_slug,
|
60 |
+
'posts_per_page' => 1,
|
61 |
+
);
|
62 |
+
$loop_posts = new WP_Query( $args_posts );
|
63 |
+
if ( ! $loop_posts->have_posts() ) {
|
64 |
+
return false;
|
65 |
+
} else {
|
66 |
+
$loop_posts->the_post();
|
67 |
+
return $loop_posts->post->ID;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
71 |
+
if(!function_exists('xyz_ips_get_link_by_slug'))
|
72 |
+
{
|
73 |
+
|
74 |
+
function xyz_ips_get_link_by_slug($slug, $type = 'page'){
|
75 |
+
$post = get_page_by_path($slug, OBJECT, $type);
|
76 |
+
return get_permalink($post->ID);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
function xyz_ips_preview_page( $content ) {
|
81 |
+
if ( strcmp( 'xyz-ics-preview-page', get_post_field( 'post_name' ) ) === 0 ) {
|
82 |
+
$xyz_ips_snippetId=intval($_GET['snippetId']);
|
83 |
+
|
84 |
+
if($xyz_ips_snippetId!="" && is_numeric($xyz_ips_snippetId))
|
85 |
+
{
|
86 |
+
global $wpdb;
|
87 |
+
|
88 |
+
$snippetDetails = $wpdb->get_results($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id=%d LIMIT 0,1',$xyz_ips_snippetId )) ;
|
89 |
+
if(!empty($snippetDetails)) {
|
90 |
+
$snippetDetails = $snippetDetails[0];
|
91 |
+
|
92 |
+
$content = do_shortcode( '[xyz-ips snippet="'.esc_html($snippetDetails->title).'"]' );
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
return $content;
|
98 |
+
}
|
99 |
+
|
100 |
+
add_filter( 'the_content', 'xyz_ips_preview_page' );
|
101 |
+
|
102 |
+
?>
|