PluginProbe
Insert PHP Code Snippet / 1.0
Insert PHP Code Snippet v1.0
1.4.7 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 All 27 releases
insert-php-code-snippet / shortcode-handler.php

shortcode-handler.php in Insert PHP Code Snippet 1.0, at shortcode-handler.php

59 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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
59