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

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