Insert PHP Code Snippet - Version 1.3.3

Version Description

  • Minor bugs fixed
  • Option to send exception report to email
Download this release

Release Info

Developer f1logic
Plugin Icon 128x128 Insert PHP Code Snippet
Version 1.3.3
Comparing to
See all releases

Code changes from version 1.3.2 to 1.3.3

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
@@ -64,6 +64,7 @@ if (is_plugin_active($pluginName)) {
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 (
64
  update_option('xyz_ips_installed_date', $xyz_ips_installed_date);
65
  }
66
  add_option('xyz_ips_limit',20);
67
+ add_option('xyz_ips_exception_email',"0");
68
 
69
  $charset_collate = $wpdb->get_charset_collate();
70
  $queryInsertPhp = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."xyz_ips_short_code (
admin/menu.php CHANGED
File without changes
admin/settings.php CHANGED
@@ -48,6 +48,9 @@ if($_POST){
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"))
@@ -68,6 +71,29 @@ if($_POST){
68
  }
69
  }
70
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  <div>
72
  <form method="post">
73
  <?php wp_nonce_field('ips-psetting_');?>
@@ -137,6 +163,15 @@ if($_POST){
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>
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_exception_email=sanitize_text_field($_POST['xyz_ips_exception_email']);
52
+ update_option('xyz_ips_exception_email',$xyz_ips_exception_email);
53
+
54
  $xyz_ips_sortfield=sanitize_text_field($_POST['xyz_ips_sort_by_field']);
55
 
56
  if(($xyz_ips_sortfield=="id")||($xyz_ips_sortfield=="title"))
71
  }
72
  }
73
  ?>
74
+ <script type="text/javascript">
75
+
76
+ jQuery(document).ready(function() {
77
+ changeAutoException();
78
+
79
+ });
80
+
81
+ if(typeof changeAutoException == 'undefined')
82
+ {
83
+ function changeAutoException()
84
+ {
85
+ var auto_exception=jQuery("#xyz_ips_auto_exception").val();
86
+
87
+ if(auto_exception==1) {
88
+ jQuery("#xyz_ips_exception_email_tr").show();
89
+ }
90
+ else {
91
+ jQuery("#xyz_ips_exception_email_tr").hide();
92
+ }
93
+ }
94
+
95
+ }
96
+ </script>
97
  <div>
98
  <form method="post">
99
  <?php wp_nonce_field('ips-psetting_');?>
163
  </select>
164
  </td>
165
  </tr>
166
+ <tr valign="top" id="xyz_ips_exception_email_tr" style="display:none;">
167
+ <td scope="row">
168
+ <label for="xyz_ips_exception_email">Email address for sending exception report</label>
169
+ </td>
170
+ <td>
171
+ <input name="xyz_ips_exception_email" type="text" id="xyz_ips_exception_email" value="<?php if(isset($_POST['xyz_ips_exception_email']) ){echo esc_attr($_POST['xyz_ips_exception_email']);}else{if(get_option('xyz_ips_exception_email')!="0"){echo esc_attr(get_option('xyz_ips_exception_email'));}} ?>" />
172
+
173
+ </td>
174
+ </tr>
175
  <tr valign="top">
176
  <td scope="row">
177
  <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
@@ -17,7 +17,7 @@ if($xyz_ips_message == 1){
17
  </div>
18
  <?php
19
  }
20
- if($_GET['goback'])
21
  $goback= intval($_GET['goback']);
22
  if(isset($_POST) && isset($_POST['updateSubmit'])){
23
 
17
  </div>
18
  <?php
19
  }
20
+ if(isset($_GET['goback']))
21
  $goback= intval($_GET['goback']);
22
  if(isset($_POST) && isset($_POST['updateSubmit'])){
23
 
admin/snippet-status.php CHANGED
File without changes
admin/snippets.php CHANGED
File without changes
admin/uninstall.php CHANGED
@@ -30,6 +30,7 @@ delete_option("xyz_ips_sort_field_name");
30
  delete_option("xyz_ips_limit");
31
  delete_option("xyz_ips_installed_date");
32
  delete_option('xyz_ips_credit_dismiss');
 
33
  /* table delete*/
34
  $wpdb->query("DROP TABLE ".$wpdb->prefix."xyz_ips_short_code");
35
 
30
  delete_option("xyz_ips_limit");
31
  delete_option("xyz_ips_installed_date");
32
  delete_option('xyz_ips_credit_dismiss');
33
+ delete_option("xyz_ips_exception_email");
34
  /* table delete*/
35
  $wpdb->query("DROP TABLE ".$wpdb->prefix."xyz_ips_short_code");
36
 
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/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.2
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.3
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
@@ -3,8 +3,8 @@ 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,6 +66,10 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
66
 
67
  == Changelog ==
68
 
 
 
 
 
69
  = 1.3.2 =
70
  * Option to enable exception handling
71
  * Option to preview snippet
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.9.1
7
+ Stable tag: 1.3.3
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.3 =
70
+ * Minor bugs fixed
71
+ * Option to send exception report to email
72
+
73
  = 1.3.2 =
74
  * Option to enable exception handling
75
  * Option to preview snippet
shortcode-handler.php CHANGED
@@ -1,118 +1,141 @@
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $exception_occur=0;
67
+ $exception_msg="";
68
+
69
+ if(get_option('xyz_ips_auto_exception')==1) {
70
+
71
+ $str1 = " try{";
72
+ $var="$";
73
+ $str2 = "}catch(Exception ".$var."e) {echo 'Caught exception: '.".$var."e->getMessage();".$var."exception_occur=1;".$var."exception_msg=".$var."e->getMessage();}";
74
+
75
+ $first_start_tag=strpos($content_to_eval,"<?php");
76
+ $last_end_tag=strrpos($content_to_eval,"?>");
77
+ $last_start_tag=strrpos($content_to_eval,"<?php");
78
+
79
+ if($first_start_tag>=0) {
80
+ $new_pos=$first_start_tag+5; //add length of php start tag
81
+ $content_to_eval=substr_replace( $content_to_eval, $str1, $new_pos, 0 );
82
+ }
83
+ if($last_end_tag<$last_start_tag) {
84
+ $content_to_eval=$content_to_eval.$str2;
85
+ }
86
+ else {
87
+ if($last_end_tag>0) {
88
+ $new_pos=$last_end_tag+5; //add length of $str1
89
+ $content_to_eval=substr_replace( $content_to_eval, $str2, $new_pos, 0 );
90
+ }
91
+ else if($last_end_tag==0) {
92
+ $content_to_eval=$content_to_eval.$str2;
93
+ }
94
+ }
95
+ //echo $content_to_eval;die;
96
+ }
97
+
98
+
99
+ eval($content_to_eval);
100
+
101
+ if($exception_occur==1) {
102
+
103
+ global $post;
104
+ $post_slug = $post->post_name;
105
+
106
+ if($post_slug!="xyz-ics-preview-page") {
107
+
108
+ if(get_option('xyz_ips_exception_email')!="0" && get_option('xyz_ips_exception_email')!="") {
109
+
110
+ $email=get_option('xyz_ips_exception_email');
111
+ $headers= "Content-type: text/html";
112
+ $subject="Exception Report";
113
+ $message="Hi,<br>An exception occured while running one of the snippet.The snippet name is ".$snippet_name;
114
+ $message.=".<br>Exception details are given below<br>";
115
+ $message.=$exception_msg;
116
+ wp_mail($email, $subject, $message,$headers);
117
+ }
118
+ }
119
+ }
120
+
121
+ $xyz_em_content = ob_get_contents();
122
+ // ob_clean();
123
+ ob_end_clean();
124
+ return $xyz_em_content;
125
+ /* }
126
+ else{
127
+ eval($sippetdetails->content);
128
+ }*/
129
+ }
130
+ else{
131
+ return '';
132
+ }
133
+ break;
134
+ }
135
+ }
136
+ else{
137
+ return '';
138
+ }
139
+ }
140
+ }
141
+ add_filter('widget_text', 'do_shortcode'); // to run shortcodes in text widgets
widget.php CHANGED
File without changes
xyz-functions.php CHANGED
@@ -1,102 +1,105 @@
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
- ?>
 
 
 
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
+
83
+ $xyz_ips_snippetId="";
84
+ if(isset($_GET['snippetId']))
85
+ $xyz_ips_snippetId=intval($_GET['snippetId']);
86
+
87
+ if($xyz_ips_snippetId!="" && is_numeric($xyz_ips_snippetId))
88
+ {
89
+ global $wpdb;
90
+
91
+ $snippetDetails = $wpdb->get_results($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id=%d LIMIT 0,1',$xyz_ips_snippetId )) ;
92
+ if(!empty($snippetDetails)) {
93
+ $snippetDetails = $snippetDetails[0];
94
+
95
+ $content = do_shortcode( '[xyz-ips snippet="'.esc_html($snippetDetails->title).'"]' );
96
+ }
97
+ }
98
+ }
99
+
100
+ return $content;
101
+ }
102
+
103
+ add_filter( 'the_content', 'xyz_ips_preview_page' );
104
+
105
+ ?>