Insert PHP Code Snippet - Version 1.1

Version Description

  • Snippet chooser TinyMCE plugin modified
  • Compatibility with wordpress 3.9
  • A few bug fixes
Download this release

Release Info

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

Code changes from version 1.0 to 1.1

add_shortcode_tynimce.php CHANGED
@@ -24,9 +24,7 @@ class XYZ_Insert_Php_TinyMCESelector{
24
  }
25
 
26
  function registerTmcePlugin($plugin_array){
27
-
28
  $plugin_array[$this->buttonName] =get_site_url() . '/index.php?wp_ips=editor_plugin_js';
29
-
30
  if ( get_user_option('rich_editing') == 'true')
31
  //var_dump($plugin_array);
32
  return $plugin_array;
@@ -40,3 +38,4 @@ if(!isset($shortcodesXYZEP)){
40
  add_action('admin_head', array($shortcodesXYZEP, 'addSelector'));
41
  }
42
 
 
24
  }
25
 
26
  function registerTmcePlugin($plugin_array){
 
27
  $plugin_array[$this->buttonName] =get_site_url() . '/index.php?wp_ips=editor_plugin_js';
 
28
  if ( get_user_option('rich_editing') == 'true')
29
  //var_dump($plugin_array);
30
  return $plugin_array;
38
  add_action('admin_head', array($shortcodesXYZEP, 'addSelector'));
39
  }
40
 
41
+ ?>
admin/footer.php CHANGED
@@ -121,8 +121,10 @@ type="text" value="<?php echo $current_user->user_email; ?>" /><span style="col
121
  <div style="width: 100%">
122
 
123
  <div class="xyz_our_plugins">
124
- See Also :
 
125
 
 
126
  <a target="_blank" href="http://wordpress.org/extend/plugins/lightbox-pop/">Lightbox Pop</a> ★
127
  <a target="_blank" href="http://wordpress.org/extend/plugins/full-screen-popup/">Full Screen Popup</a> ★
128
  <a target="_blank" href="http://wordpress.org/extend/plugins/popup-dialog-box/">Popup Dialog Box</a> ★
@@ -130,8 +132,11 @@ See Also :
130
  <a target="_blank" href="http://wordpress.org/extend/plugins/quick-box-popup/">Quick Box Popup</a> ★
131
  <a target="_blank" href="http://wordpress.org/extend/plugins/contact-form-manager/">Contact Form Manager</a> ★
132
  <a target="_blank" href="http://wordpress.org/extend/plugins/newsletter-manager/">Newsletter Manager</a> ★
133
- <a target="_blank" href="http://wordpress.org/extend/plugins/social-media-auto-publish/">Social Media Auto Publish</a>
134
-
 
 
 
135
  </div>
136
  </div>
137
  <div class="poweredBy">
121
  <div style="width: 100%">
122
 
123
  <div class="xyz_our_plugins">
124
+ Our Plugins :
125
+
126
 
127
+ <a target="_blank" href="http://wordpress.org/extend/plugins/insert-html-snippet/">Insert HTML Snippet</a> ★
128
  <a target="_blank" href="http://wordpress.org/extend/plugins/lightbox-pop/">Lightbox Pop</a> ★
129
  <a target="_blank" href="http://wordpress.org/extend/plugins/full-screen-popup/">Full Screen Popup</a> ★
130
  <a target="_blank" href="http://wordpress.org/extend/plugins/popup-dialog-box/">Popup Dialog Box</a> ★
132
  <a target="_blank" href="http://wordpress.org/extend/plugins/quick-box-popup/">Quick Box Popup</a> ★
133
  <a target="_blank" href="http://wordpress.org/extend/plugins/contact-form-manager/">Contact Form Manager</a> ★
134
  <a target="_blank" href="http://wordpress.org/extend/plugins/newsletter-manager/">Newsletter Manager</a> ★
135
+ <a target="_blank" href="http://wordpress.org/extend/plugins/social-media-auto-publish/">Social Media Auto Publish</a>★
136
+ <a target="_blank" href="http://wordpress.org/extend/plugins/facebook-auto-publish/">Facebook Auto Publish</a> ★
137
+ <a target="_blank" href="http://wordpress.org/extend/plugins/linkedin-auto-publish/">LinkedIn Auto Publish</a> ★
138
+ <a target="_blank" href="http://wordpress.org/extend/plugins/twitter-auto-publish/">Twitter Auto Publish</a> ★
139
+ <a target="_blank" href="http://wordpress.org/extend/plugins/insert-php-code-snippet/">Insert PHP Code Snippet</a>
140
  </div>
141
  </div>
142
  <div class="poweredBy">
admin/snippet-add.php CHANGED
@@ -20,7 +20,6 @@ if(isset($_POST) && isset($_POST['addSubmit'])){
20
  $xyz_ips_content = $_POST['snippetContent'];
21
 
22
  if($xyz_ips_title != "" && $xyz_ips_content != ""){
23
-
24
  if(ctype_alnum($temp_xyz_ips_title)){
25
 
26
  $snippet_count = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE title="'.$xyz_ips_title.'"' ) ;
@@ -39,7 +38,7 @@ if(isset($_POST) && isset($_POST['addSubmit'])){
39
  }else{
40
  ?>
41
  <div class="system_notice_area_style0" id="system_notice_area">
42
- PHP Snippet title must be alphanumeric. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
43
  </div>
44
  <?php
45
  }
20
  $xyz_ips_content = $_POST['snippetContent'];
21
 
22
  if($xyz_ips_title != "" && $xyz_ips_content != ""){
 
23
  if(ctype_alnum($temp_xyz_ips_title)){
24
 
25
  $snippet_count = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE title="'.$xyz_ips_title.'"' ) ;
38
  }else{
39
  ?>
40
  <div class="system_notice_area_style0" id="system_notice_area">
41
+ PHP Snippet title can have only alphabets,numbers or hyphen. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
42
  </div>
43
  <?php
44
  }
admin/snippet-delete.php CHANGED
@@ -12,14 +12,14 @@ if($xyz_ips_snippetId=="" || !is_numeric($xyz_ips_snippetId)){
12
  exit();
13
 
14
  }
15
- $snippetCount = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id="'.$xyz_ips_snippetId.'" LIMIT 0,1' ) ;
16
 
17
  if($snippetCount==0){
18
  header("Location:".admin_url('admin.php?page=insert-php-code-snippet-manage&xyz_ips_msg=2'));
19
  exit();
20
  }else{
21
 
22
- $wpdb->query( 'DELETE FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id="'.$xyz_ips_snippetId.'" ' ) ;
23
 
24
  header("Location:".admin_url('admin.php?page=insert-php-code-snippet-manage&xyz_ips_msg=3&pagenum='.$xyz_ips_pageno));
25
  exit();
12
  exit();
13
 
14
  }
15
+ $snippetCount = $wpdb->query($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id=%d LIMIT 0,1',$xyz_ips_snippetId )) ;
16
 
17
  if($snippetCount==0){
18
  header("Location:".admin_url('admin.php?page=insert-php-code-snippet-manage&xyz_ips_msg=2'));
19
  exit();
20
  }else{
21
 
22
+ $wpdb->query($wpdb->prepare( 'DELETE FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id=%d',$xyz_ips_snippetId)) ;
23
 
24
  header("Location:".admin_url('admin.php?page=insert-php-code-snippet-manage&xyz_ips_msg=3&pagenum='.$xyz_ips_pageno));
25
  exit();
admin/snippet-edit.php CHANGED
@@ -24,7 +24,7 @@ if(isset($_POST) && isset($_POST['updateSubmit'])){
24
 
25
  if(ctype_alnum($temp_xyz_ips_title))
26
  {
27
- $snippet_count = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id!="'.$xyz_ips_snippetId.'" AND title="'.$xyz_ips_title.'" LIMIT 0,1' ) ;
28
 
29
  if($snippet_count == 0){
30
  $xyz_shortCode = '[xyz-ips snippet="'.$xyz_ips_title.'"]';
@@ -46,7 +46,7 @@ if(isset($_POST) && isset($_POST['updateSubmit'])){
46
  {
47
  ?>
48
  <div class="system_notice_area_style0" id="system_notice_area">
49
- PHP Snippet title must be alphanumeric. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
50
  </div>
51
  <?php
52
 
@@ -67,7 +67,7 @@ if(isset($_POST) && isset($_POST['updateSubmit'])){
67
  global $wpdb;
68
 
69
 
70
- $snippetDetails = $wpdb->get_results( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id="'.$xyz_ips_snippetId.'" LIMIT 0,1' ) ;
71
  $snippetDetails = $snippetDetails[0];
72
 
73
  ?>
24
 
25
  if(ctype_alnum($temp_xyz_ips_title))
26
  {
27
+ $snippet_count = $wpdb->query($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id!=%d AND title=%s LIMIT 0,1',$xyz_ips_snippetId,$xyz_ips_title)) ;
28
 
29
  if($snippet_count == 0){
30
  $xyz_shortCode = '[xyz-ips snippet="'.$xyz_ips_title.'"]';
46
  {
47
  ?>
48
  <div class="system_notice_area_style0" id="system_notice_area">
49
+ PHP Snippet title can have only alphabets,numbers or hyphen. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
50
  </div>
51
  <?php
52
 
67
  global $wpdb;
68
 
69
 
70
+ $snippetDetails = $wpdb->get_results($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id=%d LIMIT 0,1',$xyz_ips_snippetId )) ;
71
  $snippetDetails = $snippetDetails[0];
72
 
73
  ?>
admin/snippet-status.php CHANGED
@@ -14,7 +14,7 @@ if($xyz_ips_snippetId=="" || !is_numeric($xyz_ips_snippetId)){
14
 
15
  }
16
 
17
- $snippetCount = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id="'.$xyz_ips_snippetId.'" LIMIT 0,1' ) ;
18
 
19
  if($snippetCount==0){
20
  header("Location:".admin_url('admin.php?page=insert-php-code-snippet-manage&xyz_ips_msg=2'));
14
 
15
  }
16
 
17
+ $snippetCount = $wpdb->query($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE id=%d LIMIT 0,1' ,$xyz_ips_snippetId)) ;
18
 
19
  if($snippetCount==0){
20
  header("Location:".admin_url('admin.php?page=insert-php-code-snippet-manage&xyz_ips_msg=2'));
css/xyz_ips_styles.css CHANGED
@@ -86,11 +86,11 @@ z-index:100000;
86
  }
87
 
88
 
89
- .xyz_suggest,.xyz_star,.xyz_donate,.xyz_fbook,.xyz_support,.xyz_twitt,.xyz_gplus{
90
  height:16px;
91
  background-repeat: no-repeat;
92
  background-position: left center;
93
- padding-left: 15px;
94
  text-decoration: none;
95
 
96
  vertical-align: middle;
@@ -129,10 +129,9 @@ z-index:100000;
129
 
130
  background-image: url('../images/gplus.png');
131
  }
132
-
133
-
134
- #insert-php-code-snippet .xyz_gplus{
135
- margin-left: 3px;
136
  }
137
 
138
  #insert-php-code-snippet .plugin-version-author-uri {
@@ -150,18 +149,26 @@ margin-left: 3px;
150
  box-shadow: 0 8px 6px -6px black;
151
 
152
  }
153
- #insert-php-code-snippet{
154
  background: #a9e8f5; /* Old browsers */
 
155
 
156
- background: -moz-linear-gradient(top, #ffffff 0%, #a9e8f5 100%); /* FF3.6+ */
157
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#a9e8f5)); /* Chrome,Safari4+ */
158
- background: -webkit-linear-gradient(top, #ffffff 0%,#a9e8f5 100%); /* Chrome10+,Safari5.1+ */
159
- background: -o-linear-gradient(top, #ffffff 0%,#a9e8f5 100%); /* Opera 11.10+ */
160
- background: -ms-linear-gradient(top, #ffffff 0%,#a9e8f5 100%); /* IE10+ */
161
- background: linear-gradient(top, #ffffff 0%,#a9e8f5 100%); /* W3C */
162
 
 
163
 
 
 
 
 
 
 
 
 
 
164
  }
 
 
 
165
  #insert-php-code-snippet .plugin-version-author-uri a,
166
  #insert-php-code-snippet .plugin-version-author-uri a:link,
167
  #insert-php-code-snippet .plugin-version-author-uri a:hover,
@@ -179,7 +186,7 @@ color:#cc811a;
179
  }
180
  #insert-php-code-snippet .plugin-title{
181
 
182
- background-image: url('../images/xyz_logo.png');
183
  background-repeat: no-repeat;
184
  background-position: left bottom;
185
 
@@ -207,13 +214,14 @@ background-position: left bottom;
207
  }
208
 
209
  .xyz_our_plugins{
210
- background: #F2F2F2; /* Old browsers */
211
  border: 1px solid #DFDFDF;
212
  border-radius:3px;
213
  width: 98%;
214
  padding-left: 10px;
215
  padding-top:10px;
216
- height:30px;
 
217
  margin-top:13px;
218
  }
219
 
@@ -260,3 +268,6 @@ background-position: left bottom;
260
  padding:0;
261
  }
262
 
 
 
 
86
  }
87
 
88
 
89
+ .xyz_suggest,.xyz_star,.xyz_donate,.xyz_fbook,.xyz_support,.xyz_twitt,.xyz_gplus,.xyz_linkedin{
90
  height:16px;
91
  background-repeat: no-repeat;
92
  background-position: left center;
93
+ padding-left: 20px;
94
  text-decoration: none;
95
 
96
  vertical-align: middle;
129
 
130
  background-image: url('../images/gplus.png');
131
  }
132
+ .xyz_linkedin{
133
+
134
+ background-image: url('../images/linkedin.png');
 
135
  }
136
 
137
  #insert-php-code-snippet .plugin-version-author-uri {
149
  box-shadow: 0 8px 6px -6px black;
150
 
151
  }
152
+ #insert-php-code-snippet th,#insert-php-code-snippet td{
153
  background: #a9e8f5; /* Old browsers */
154
+ background: linear-gradient( #ffffff,#a9e8f5 ); /* W3C */
155
 
 
 
 
 
 
 
156
 
157
+ }
158
 
159
+ #insert-php-code-snippet .plugin-version-author-uri a#xyz_update,
160
+ #insert-php-code-snippet.plugin-version-author-uri a#xyz_update:link,
161
+ #insert-php-code-snippet .plugin-version-author-uri a#xyz_update:hover,
162
+ #insert-php-code-snippet .plugin-version-author-uri a#xyz_update:active,
163
+ #insert-php-code-snippet .plugin-version-author-uri a#xyz_update:visited
164
+ {
165
+ color: red;
166
+ font-weight: bold;
167
+ text-decoration: blink;
168
  }
169
+
170
+
171
+
172
  #insert-php-code-snippet .plugin-version-author-uri a,
173
  #insert-php-code-snippet .plugin-version-author-uri a:link,
174
  #insert-php-code-snippet .plugin-version-author-uri a:hover,
186
  }
187
  #insert-php-code-snippet .plugin-title{
188
 
189
+ background: url('../images/xyz_logo.png'),linear-gradient( #ffffff,#a9e8f5 );
190
  background-repeat: no-repeat;
191
  background-position: left bottom;
192
 
214
  }
215
 
216
  .xyz_our_plugins{
217
+ background: #F2F2F2; /* Old browsers */
218
  border: 1px solid #DFDFDF;
219
  border-radius:3px;
220
  width: 98%;
221
  padding-left: 10px;
222
  padding-top:10px;
223
+ height:auto;
224
+ min-height: 40px;
225
  margin-top:13px;
226
  }
227
 
268
  padding:0;
269
  }
270
 
271
+ i.xyz-ips-own-icon {
272
+ background-image: url('../images/logo.png');
273
+ }
editor_plugin.js.php CHANGED
@@ -7,11 +7,49 @@
7
  $shortcodesXYZEP = new XYZ_Insert_Php_TinyMCESelector();
8
 
9
  global $wpdb;
10
- // $ordered_sct = array_keys($shortcode_tags);
11
- // sort($ordered_sct);
12
 
13
- $ordered_sct = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ips_short_code WHERE status='1' ORDER BY id DESC" );
 
 
 
 
 
 
 
14
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  (function() {
17
  //******* Load plugin specific language pack
@@ -26,6 +64,12 @@
26
  * @param {string} url Absolute URL to where the plugin is located.
27
  */
28
  init : function(ed, url) {
 
 
 
 
 
 
29
 
30
  },
31
 
@@ -41,27 +85,28 @@
41
  */
42
  createControl : function(n, cm) {
43
  if(n=='<?php echo $shortcodesXYZEP->buttonName; ?>'){
44
- var mlb = cm.createListBox('<?php echo $shortcodesXYZEP->buttonName; ?>List', {
45
- title : 'PHP Snippets',
46
- onselect : function(v) { //Option value as parameter
47
- if(v != ''){
48
- if(tinyMCE.activeEditor.selection.getContent() != ''){
49
- tinyMCE.activeEditor.selection.setContent('[' + v + ']' + tinyMCE.activeEditor.selection.getContent() + '[/' + v + ']');
50
- }
51
- else{
52
- tinyMCE.activeEditor.selection.setContent('[' + v + ']');
53
- }
54
- }
55
- }
56
  });
57
 
58
  // Add some values to the list box
59
- <?php foreach($ordered_sct as $sct):?>
60
- mlb.add('<?php echo $sct->title;?>', '<?php echo 'xyz-ips snippet="'.$sct->title.'"';?>');
61
- <?php endforeach;?>
 
 
 
 
 
 
 
 
 
62
 
63
  // Return the new listbox instance
64
- return mlb;
65
  }
66
 
67
  return null;
@@ -73,3 +118,5 @@
73
  // Register plugin
74
  tinymce.PluginManager.add('<?php echo $shortcodesXYZEP->buttonName; ?>', tinymce.plugins.<?php echo $shortcodesXYZEP->buttonName; ?>);
75
  })();
 
 
7
  $shortcodesXYZEP = new XYZ_Insert_Php_TinyMCESelector();
8
 
9
  global $wpdb;
 
 
10
 
11
+
12
+ $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 );
13
+ // print_r($xyz_snippets_arr);
14
+ if(count($xyz_snippets_arr)==0)
15
+ die;
16
+
17
+ if(floatval(get_bloginfo('version'))>=3.9)
18
+ {
19
  ?>
20
+ (function() {
21
+
22
+ tinymce.PluginManager.add('<?php echo $shortcodesXYZEP->buttonName; ?>', function( editor, url ) {
23
+ editor.addButton( '<?php echo $shortcodesXYZEP->buttonName; ?>', {
24
+ title: 'Insert PHP Code Snippet',
25
+ type: 'menubutton',
26
+ icon: 'icon xyz-ips-own-icon',
27
+ menu: [
28
+ <?php foreach ($xyz_snippets_arr as $key=>$val) { ?>
29
+ {
30
+ text: '<?php echo addslashes($val['title']); ?>',
31
+ value: '[xyz-ips snippet="<?php echo addslashes($val['title']); ?>"]',
32
+ onclick: function() {
33
+ editor.insertContent(this.value());
34
+ }
35
+ },
36
+ <?php } ?>
37
+ ]
38
+ });
39
+ });
40
+
41
+ })();
42
+ <?php } else {
43
+
44
+ $xyz_snippets = array(
45
+ 'title' =>'Insert PHP Code Snippet',
46
+ 'url' => plugins_url('insert-php-code-snippet/images/logo.png'),
47
+ 'xyz_ips_snippets' => $xyz_snippets_arr
48
+ );
49
+ ?>
50
+
51
+ var tinymce_<?php echo $shortcodesXYZEP->buttonName; ?> =<?php echo json_encode($xyz_snippets) ?>;
52
+
53
 
54
  (function() {
55
  //******* Load plugin specific language pack
64
  * @param {string} url Absolute URL to where the plugin is located.
65
  */
66
  init : function(ed, url) {
67
+
68
+ tinymce_<?php echo $shortcodesXYZEP->buttonName; ?>.insert = function(){
69
+ if(this.v && this.v != ''){
70
+ tinymce.execCommand('mceInsertContent', false, '[xyz-ips snippet="'+tinymce_<?php echo $shortcodesXYZEP->buttonName; ?>.xyz_ips_snippets[this.v]['title']+'"]');
71
+ }
72
+ };
73
 
74
  },
75
 
85
  */
86
  createControl : function(n, cm) {
87
  if(n=='<?php echo $shortcodesXYZEP->buttonName; ?>'){
88
+ var c = cm.createSplitButton('<?php echo $shortcodesXYZEP->buttonName; ?>', {
89
+ title : tinymce_<?php echo $shortcodesXYZEP->buttonName; ?>.title,
90
+ image : tinymce_<?php echo $shortcodesXYZEP->buttonName; ?>.url,
91
+ onclick : tinymce_<?php echo $shortcodesXYZEP->buttonName; ?>.insert
 
 
 
 
 
 
 
 
92
  });
93
 
94
  // Add some values to the list box
95
+
96
+
97
+ c.onRenderMenu.add(function(c, m){
98
+ for (var id in tinymce_<?php echo $shortcodesXYZEP->buttonName; ?>.xyz_ips_snippets){
99
+ m.add({
100
+ v : id,
101
+ title : tinymce_<?php echo $shortcodesXYZEP->buttonName; ?>.xyz_ips_snippets[id]['title'],
102
+ onclick : tinymce_<?php echo $shortcodesXYZEP->buttonName; ?>.insert
103
+ });
104
+ }
105
+ });
106
+
107
 
108
  // Return the new listbox instance
109
+ return c;
110
  }
111
 
112
  return null;
118
  // Register plugin
119
  tinymce.PluginManager.add('<?php echo $shortcodesXYZEP->buttonName; ?>', tinymce.plugins.<?php echo $shortcodesXYZEP->buttonName; ?>);
120
  })();
121
+
122
+ <?php } ?>
images/linkedin.png ADDED
Binary file
images/suggest.png ADDED
Binary file
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.0
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  Text Domain: insert-php-code-snippet
@@ -63,7 +63,7 @@ if(get_option('xyz_credit_link')=="ips"){
63
 
64
  }
65
  function xyz_ips_credit() {
66
- $content = '<div style="width:100%;text-align:center; font-size:11px; clear:both"><a target="_blank" title="Insert PHP Snippet Wordpress Plugin" href="http://xyzscripts.com/wordpress-plugins/insert-php-code-snippet/">PHP Code Snippets</a> Powered By : <a target="_blank" title="PHP Scripts & Programs" href="http://www.xyzscripts.com" >XYZScripts.com</a></div>';
67
  echo $content;
68
  }
69
 
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.1
7
  Author: xyzscripts.com
8
  Author URI: http://xyzscripts.com/
9
  Text Domain: insert-php-code-snippet
63
 
64
  }
65
  function xyz_ips_credit() {
66
+ $content = '<div style="width:100%;text-align:center; font-size:11px; clear:both"><a target="_blank" title="Insert PHP Snippet Wordpress Plugin" href="http://xyzscripts.com/wordpress-plugins/insert-php-code-snippet/">PHP Code Snippets</a> Powered By : <a target="_blank" title="PHP Scripts & Wordpress Plugins" href="http://www.xyzscripts.com" >XYZScripts.com</a></div>';
67
  echo $content;
68
  }
69
 
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://xyzscripts.com/donate/
4
 
5
  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
6
  Requires at least: 2.8
7
- Tested up to: 3.4.2
8
- Stable tag: 1.0
9
  License: GPLv2 or later
10
 
11
  Add PHP code to your pages and posts easily using shortcodes.
@@ -29,8 +29,14 @@ The shortcodes generated using the plugin are easily available as a dropdown in
29
 
30
  Insert PHP Code Snippet is developed and maintained by [XYZScripts](http://xyzscripts.com/ "xyzscripts.com"). For any support, you may [contact us](http://xyzscripts.com/support/ "XYZScripts Support").
31
 
 
 
 
32
  == Installation ==
33
 
 
 
 
34
  1. Extract `insert-php-code-snippet.zip` to your `/wp-content/plugins/` directory.
35
  2. In the admin panel under plugins activate Insert PHP Code Snippet.
36
 
@@ -38,6 +44,9 @@ If you need any further help, you may contact our [support desk](http://xyzscrip
38
 
39
  == Frequently Asked Questions ==
40
 
 
 
 
41
  = 1. The Insert PHP Code Snippet is not working properly. =
42
 
43
  Please check the wordpress version you are using. Make sure it meets the minimum version recommended by us. Make sure all files of the `insert php code snippet` plugin uploaded to the folder `wp-content/plugins/`
@@ -58,14 +67,20 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
58
 
59
  == Changelog ==
60
 
 
 
 
 
61
  = 1.0 =
62
  * First official launch.
63
 
64
  == Upgrade Notice ==
65
- NA
66
 
67
  == More Information ==
68
 
 
 
69
 
70
  = Troubleshooting =
71
 
4
 
5
  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
6
  Requires at least: 2.8
7
+ Tested up to: 4.0
8
+ Stable tag: 1.1
9
  License: GPLv2 or later
10
 
11
  Add PHP code to your pages and posts easily using shortcodes.
29
 
30
  Insert PHP Code Snippet is developed and maintained by [XYZScripts](http://xyzscripts.com/ "xyzscripts.com"). For any support, you may [contact us](http://xyzscripts.com/support/ "XYZScripts Support").
31
 
32
+ ★ [Insert PHP Code Snippet User Guide](http://docs.xyzscripts.com/wordpress-plugins/insert-php-code-snippet/ "Insert PHP Code Snippet User Guide")
33
+ ★ [Insert PHP Code Snippet FAQ](http://kb.xyzscripts.com/wordpress-plugins/insert-php-code-snippet/ "Insert PHP Code Snippet FAQ")
34
+
35
  == Installation ==
36
 
37
+ ★ [Insert PHP Code Snippet User Guide](http://docs.xyzscripts.com/wordpress-plugins/insert-php-code-snippet/ "Insert PHP Code Snippet User Guide")
38
+ ★ [Insert PHP Code Snippet FAQ](http://kb.xyzscripts.com/wordpress-plugins/insert-php-code-snippet/ "Insert PHP Code Snippet FAQ")
39
+
40
  1. Extract `insert-php-code-snippet.zip` to your `/wp-content/plugins/` directory.
41
  2. In the admin panel under plugins activate Insert PHP Code Snippet.
42
 
44
 
45
  == Frequently Asked Questions ==
46
 
47
+ ★ [Insert PHP Code Snippet User Guide](http://docs.xyzscripts.com/wordpress-plugins/insert-php-code-snippet/ "Insert PHP Code Snippet User Guide")
48
+ ★ [Insert PHP Code Snippet FAQ](http://kb.xyzscripts.com/wordpress-plugins/insert-php-code-snippet/ "Insert PHP Code Snippet FAQ")
49
+
50
  = 1. The Insert PHP Code Snippet is not working properly. =
51
 
52
  Please check the wordpress version you are using. Make sure it meets the minimum version recommended by us. Make sure all files of the `insert php code snippet` plugin uploaded to the folder `wp-content/plugins/`
67
 
68
  == Changelog ==
69
 
70
+ = 1.1 =
71
+ * Snippet chooser TinyMCE plugin modified
72
+ * Compatibility with wordpress 3.9
73
+ * A few bug fixes
74
  = 1.0 =
75
  * First official launch.
76
 
77
  == Upgrade Notice ==
78
+
79
 
80
  == More Information ==
81
 
82
+ ★ [Insert PHP Code Snippet User Guide](http://docs.xyzscripts.com/wordpress-plugins/insert-php-code-snippet/ "Insert PHP Code Snippet User Guide")
83
+ ★ [Insert PHP Code Snippet FAQ](http://kb.xyzscripts.com/wordpress-plugins/insert-php-code-snippet/ "Insert PHP Code Snippet FAQ")
84
 
85
  = Troubleshooting =
86
 
shortcode-handler.php CHANGED
@@ -1,58 +1,59 @@
1
- <?php
2
- global $wpdb;
3
-
4
- add_shortcode('xyz-ips','xyz_ips_display_content');
5
-
6
- function xyz_ips_display_content($xyz_snippet_name){
7
- global $wpdb;
8
-
9
- if(is_array($xyz_snippet_name)){
10
- $snippet_name = $xyz_snippet_name['snippet'];
11
-
12
- $query = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ips_short_code WHERE title='$snippet_name'" );
13
-
14
- if(count($query)>0){
15
-
16
- foreach ($query as $sippetdetails){
17
- if($sippetdetails->status==1){
18
-
19
- if(is_numeric(ini_get('output_buffering'))){
20
- $tmp=ob_get_contents();
21
- ob_clean();
22
- ob_start();
23
- eval($sippetdetails->content);
24
- $xyz_em_content = ob_get_contents();
25
- ob_clean();
26
- echo $tmp;
27
- return $xyz_em_content;
28
- }else{
29
- eval($sippetdetails->content);
30
- }
31
-
32
-
33
-
34
- }else{
35
- return '';
36
- }
37
- break;
38
- }
39
-
40
- }else{
41
-
42
- return "<div style='padding:20px; font-size:16px; color:#FA5A6A; width:93%;text-align:center;background:lightyellow;border:1px solid #3FAFE3; margin:20px 0 20px 0'>
43
-
44
- Please use a valid short code to call snippet.
45
-
46
-
47
- </div>";
48
-
49
- }
50
-
51
- }
52
- }
53
-
54
-
55
- add_filter('widget_text', 'do_shortcode');
56
-
57
-
58
-
 
1
+ <?php
2
+ global $wpdb;
3
+
4
+ add_shortcode('xyz-ips','xyz_ips_display_content');
5
+
6
+ function xyz_ips_display_content($xyz_snippet_name){
7
+ global $wpdb;
8
+
9
+ if(is_array($xyz_snippet_name)){
10
+ $snippet_name = $xyz_snippet_name['snippet'];
11
+
12
+ $query = $wpdb->get_results($wpdb->prepare( "SELECT * FROM ".$wpdb->prefix."xyz_ips_short_code WHERE title=%s" ,$snippet_name));
13
+
14
+ if(count($query)>0){
15
+
16
+ foreach ($query as $sippetdetails){
17
+ if($sippetdetails->status==1){
18
+
19
+ if(is_numeric(ini_get('output_buffering'))){
20
+ $tmp=ob_get_contents();
21
+ ob_clean();
22
+ ob_start();
23
+ $content_to_eval=$sippetdetails->content;
24
+ if(substr($content_to_eval, 0,5)=='<?php')
25
+ $content_to_eval='?>'.$content_to_eval;
26
+ eval($content_to_eval);
27
+ $xyz_em_content = ob_get_contents();
28
+ ob_clean();
29
+ echo $tmp;
30
+ return $xyz_em_content;
31
+ }else{
32
+ eval($sippetdetails->content);
33
+ }
34
+
35
+
36
+
37
+ }else{
38
+ return '';
39
+ }
40
+ break;
41
+ }
42
+
43
+ }else{
44
+
45
+ return '';
46
+ /* return "<div style='padding:20px; font-size:16px; color:#FA5A6A; width:93%;text-align:center;background:lightyellow;border:1px solid #3FAFE3; margin:20px 0 20px 0'>
47
+
48
+ Please use a valid short code to call snippet.
49
+
50
+
51
+ </div>";
52
+ */
53
+ }
54
+
55
+ }
56
+ }
57
+
58
+
59
+ add_filter('widget_text', 'do_shortcode'); // to run shortcodes in text widgets
widget.php CHANGED
@@ -21,14 +21,17 @@ class Xyz_Insert_Php_Widget extends WP_Widget {
21
  $title = apply_filters('widget_title', $instance['title']);
22
  $xyz_ips_id = $instance['message'];
23
 
24
- $entries = $wpdb->get_results( "SELECT content FROM ".$wpdb->prefix."xyz_ips_short_code WHERE id='$xyz_ips_id'" );
25
 
26
  $entry = $entries[0];
27
 
28
  echo $before_widget;
29
  if ( $title )
30
  echo $before_title . $title . $after_title;
31
- eval($entry->content);
 
 
 
32
 
33
  echo $after_widget;
34
 
@@ -45,7 +48,7 @@ class Xyz_Insert_Php_Widget extends WP_Widget {
45
  /** @see WP_Widget::form -- do not rename this */
46
  function form($instance) {
47
  global $wpdb;
48
- $entries = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ips_short_code WHERE status='1' ORDER BY id DESC" );
49
 
50
 
51
  if(isset($instance['title'])){
21
  $title = apply_filters('widget_title', $instance['title']);
22
  $xyz_ips_id = $instance['message'];
23
 
24
+ $entries = $wpdb->get_results($wpdb->prepare( "SELECT content FROM ".$wpdb->prefix."xyz_ips_short_code WHERE id=%d",$xyz_ips_id ));
25
 
26
  $entry = $entries[0];
27
 
28
  echo $before_widget;
29
  if ( $title )
30
  echo $before_title . $title . $after_title;
31
+ $content_to_eval=$entry->content;
32
+ if(substr($content_to_eval, 0,5)=='<?php')
33
+ $content_to_eval='?>'.$content_to_eval;
34
+ eval($content_to_eval);
35
 
36
  echo $after_widget;
37
 
48
  /** @see WP_Widget::form -- do not rename this */
49
  function form($instance) {
50
  global $wpdb;
51
+ $entries = $wpdb->get_results($wpdb->prepare( "SELECT * FROM ".$wpdb->prefix."xyz_ips_short_code WHERE status=%d ORDER BY id DESC",1 ));
52
 
53
 
54
  if(isset($instance['title'])){
xyz-functions.php CHANGED
@@ -39,9 +39,10 @@ function xyz_ips_links($links, $file) {
39
  if ($file == $base) {
40
 
41
  $links[] = '<a href="http://xyzscripts.com/support/" class="xyz_support" title="Support"></a>';
42
- $links[] = '<a href="http://twitter.com/xyzscripts" class="xyz_twitt" title="Follow us on twitter"></a>';
43
- $links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_fbook" title="Facebook"></a>';
44
  $links[] = '<a href="https://plus.google.com/101215320403235276710/" class="xyz_gplus" title="+1"></a>';
 
45
  }
46
  return $links;
47
  }
39
  if ($file == $base) {
40
 
41
  $links[] = '<a href="http://xyzscripts.com/support/" class="xyz_support" title="Support"></a>';
42
+ $links[] = '<a href="http://twitter.com/xyzscripts" class="xyz_twitt" title="Follow us on Twitter"></a>';
43
+ $links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_fbook" title="Like us on Facebook"></a>';
44
  $links[] = '<a href="https://plus.google.com/101215320403235276710/" class="xyz_gplus" title="+1"></a>';
45
+ $links[] = '<a href="http://www.linkedin.com/company/xyzscripts" class="xyz_linkedin" title="Follow us on LinkedIn"></a>';
46
  }
47
  return $links;
48
  }