PluginProbe
Insert PHP Code Snippet / 1.2
Insert PHP Code Snippet v1.2
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 / admin / snippets.php

snippets.php in Insert PHP Code Snippet 1.2, at admin/snippets.php

202 lines 5.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 global $wpdb;
3 $_GET = stripslashes_deep($_GET);
4 $xyz_ips_message = '';
5 if(isset($_GET['xyz_ips_msg'])){
6 $xyz_ips_message = $_GET['xyz_ips_msg'];
7 }
8 if($xyz_ips_message == 1){
9
10 ?>
11 <div class="system_notice_area_style1" id="system_notice_area">
12 PHP Snippet successfully added.&nbsp;&nbsp;&nbsp;<span
13 id="system_notice_area_dismiss">Dismiss</span>
14 </div>
15 <?php
16
17 }
18 if($xyz_ips_message == 2){
19
20 ?>
21 <div class="system_notice_area_style0" id="system_notice_area">
22 PHP Snippet not found.&nbsp;&nbsp;&nbsp;<span
23 id="system_notice_area_dismiss">Dismiss</span>
24 </div>
25 <?php
26
27 }
28 if($xyz_ips_message == 3){
29
30 ?>
31 <div class="system_notice_area_style1" id="system_notice_area">
32 PHP Snippet successfully deleted.&nbsp;&nbsp;&nbsp;<span
33 id="system_notice_area_dismiss">Dismiss</span>
34 </div>
35 <?php
36
37 }
38 if($xyz_ips_message == 4){
39
40 ?>
41 <div class="system_notice_area_style1" id="system_notice_area">
42 PHP Snippet status successfully changed.&nbsp;&nbsp;&nbsp;<span
43 id="system_notice_area_dismiss">Dismiss</span>
44 </div>
45 <?php
46
47 }
48 if($xyz_ips_message == 5){
49
50 ?>
51 <div class="system_notice_area_style1" id="system_notice_area">
52 PHP Snippet successfully updated.&nbsp;&nbsp;&nbsp;<span
53 id="system_notice_area_dismiss">Dismiss</span>
54 </div>
55 <?php
56
57 }
58 ?>
59
60
61 <div >
62
63
64 <form method="post">
65 <fieldset
66 style="width: 99%; border: 1px solid #F7F7F7; padding: 10px 0px;">
67 <legend><h3>PHP Code Snippets</h3></legend>
68 <?php
69 global $wpdb;
70 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
71 $limit = get_option('xyz_ips_limit');
72 $offset = ( $pagenum - 1 ) * $limit;
73
74
75 $field=get_option('xyz_ips_sort_field_name');
76 $order=get_option('xyz_ips_sort_order');
77
78 $entries = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ips_short_code ORDER BY $field $order LIMIT $offset,$limit" );
79
80
81
82 ?>
83 <input id="submit_ips"
84 style="cursor: pointer; margin-bottom:10px; margin-left:8px;" type="button"
85 name="textFieldButton2" value="Add New PHP Code Snippet"
86 onClick='document.location.href="<?php echo admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-add');?>"'>
87 <table class="widefat" style="width: 99%; margin: 0 auto; border-bottom:none;">
88 <thead>
89 <tr>
90 <th scope="col" >Tracking Name</th>
91 <th scope="col" >Snippet Short Code</th>
92 <th scope="col" >Status</th>
93 <th scope="col" colspan="3" style="text-align: center;">Action</th>
94 </tr>
95 </thead>
96 <tbody>
97 <?php
98 if( count($entries)>0 ) {
99 $count=1;
100 $class = '';
101 foreach( $entries as $entry ) {
102 $class = ( $count % 2 == 0 ) ? ' class="alternate"' : '';
103 ?>
104 <tr <?php echo $class; ?>>
105 <td id="vAlign"><?php
106 echo esc_html($entry->title);
107 ?></td>
108 <td id="vAlign"><?php
109 if($entry->status == 2){echo 'NA';}
110 else
111 echo '[xyz-ips snippet="'.esc_html($entry->title).'"]';
112 ?></td>
113 <td id="vAlign">
114 <?php
115 if($entry->status == 2){
116 echo "Inactive";
117 }elseif ($entry->status == 1){
118 echo "Active";
119 }
120
121 ?>
122 </td>
123 <?php
124 if($entry->status == 2){
125 ?>
126 <td style="text-align: center;"><a
127 href='<?php echo admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-status&snippetId='.$entry->id.'&status=1&pageno='.$pagenum); ?>'><img
128 id="img" title="Activate"
129 src="<?php echo plugins_url('insert-php-code-snippet/images/activate.png')?>">
130 </a>
131 </td>
132 <?php
133 }elseif ($entry->status == 1){
134 ?>
135 <td style="text-align: center;"><a
136 href='<?php echo admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-status&snippetId='.$entry->id.'&status=2&pageno='.$pagenum); ?>'><img
137 id="img" title="Deactivate"
138 src="<?php echo plugins_url('insert-php-code-snippet/images/pause.png')?>">
139 </a>
140 </td>
141 <?php
142 }
143
144 ?>
145
146 <td style="text-align: center;"><a
147 href='<?php echo admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-edit&snippetId='.$entry->id.'&pageno='.$pagenum); ?>'><img
148 id="img" title="Edit Snippet"
149 src="<?php echo plugins_url('insert-php-code-snippet/images/edit.png')?>">
150 </a>
151 </td>
152 <td style="text-align: center;" ><a
153 href='<?php echo admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-delete&snippetId='.$entry->id.'&pageno='.$pagenum); ?>'
154 onclick="javascript: return confirm('Please click \'OK\' to confirm ');"><img
155 id="img" title="Delete Snippet"
156 src="<?php echo plugins_url('insert-php-code-snippet/images/delete.png')?>">
157 </a></td>
158 </tr>
159 <?php
160 $count++;
161 }
162 } else { ?>
163 <tr>
164 <td colspan="6" >PHP Code Snippets not found</td>
165 </tr>
166 <?php } ?>
167 </tbody>
168 </table>
169
170 <input id="submit_ips"
171 style="cursor: pointer; margin-top:10px;margin-left:8px;" type="button"
172 name="textFieldButton2" value="Add New PHP Code Snippet"
173 onClick='document.location.href="<?php echo admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-add');?>"'>
174
175 <?php
176 $total = $wpdb->get_var( "SELECT COUNT(`id`) FROM ".$wpdb->prefix."xyz_ips_short_code" );
177 $num_of_pages = ceil( $total / $limit );
178
179 $page_links = paginate_links( array(
180 'base' => add_query_arg( 'pagenum','%#%'),
181 'format' => '',
182 'prev_text' => '&laquo;',
183 'next_text' => '&raquo;',
184 'total' => $num_of_pages,
185 'current' => $pagenum
186 ) );
187
188
189
190 if ( $page_links ) {
191 echo '<div class="tablenav" style="width:99%"><div class="tablenav-pages" style="margin: 1em 0">' . $page_links . '</div></div>';
192 }
193
194 ?>
195
196 </fieldset>
197
198 </form>
199
200 </div>
201
202