PluginProbe
Insert Html Snippet / 1.2
Insert Html Snippet v1.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, at admin/snippets.php

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