PluginProbe
Insert Html Snippet / 1.2.2
Insert Html Snippet v1.2.2
1.4.6 trunk 1.0 1.0.1 1.1 1.1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3 1.3.1 1.3.2 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 All 27 releases
insert-html-snippet / admin / snippets.php

snippets.php in Insert Html Snippet 1.2.2, at admin/snippets.php

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