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

193 lines 6.0 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 = intval($_GET['xyz_ihs_msg']);
10 }
11 if($xyz_ihs_message == 1){
12
13 ?>
14 <div class="xyz_system_notice_area_style1" id="xyz_system_notice_area">
15 HTML Snippet successfully added.&nbsp;&nbsp;&nbsp;<span
16 id="xyz_system_notice_area_dismiss">Dismiss</span>
17 </div>
18 <?php
19
20 }
21 if($xyz_ihs_message == 2){
22
23 ?>
24 <div class="xyz_system_notice_area_style0" id="xyz_system_notice_area">
25 HTML Snippet not found.&nbsp;&nbsp;&nbsp;<span
26 id="xyz_system_notice_area_dismiss">Dismiss</span>
27 </div>
28 <?php
29
30 }
31 if($xyz_ihs_message == 3){
32
33 ?>
34 <div class="xyz_system_notice_area_style1" id="xyz_system_notice_area">
35 HTML Snippet successfully deleted.&nbsp;&nbsp;&nbsp;<span
36 id="xyz_system_notice_area_dismiss">Dismiss</span>
37 </div>
38 <?php
39
40 }
41 if($xyz_ihs_message == 4){
42
43 ?>
44 <div class="xyz_system_notice_area_style1" id="xyz_system_notice_area">
45 HTML Snippet status successfully changed.&nbsp;&nbsp;&nbsp;<span
46 id="xyz_system_notice_area_dismiss">Dismiss</span>
47 </div>
48 <?php
49
50 }
51 if($xyz_ihs_message == 5){
52
53 ?>
54 <div class="xyz_system_notice_area_style1" id="xyz_system_notice_area">
55 HTML Snippet successfully updated.&nbsp;&nbsp;&nbsp;<span
56 id="xyz_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="xyz_ihs_submit" style="cursor: pointer; margin-bottom:10px; margin-left:8px;" type="button" name="textFieldButton2" value="Add New HTML Snippet" 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 id="xyz_ihs_vAlign"><?php
102 echo esc_html($entry->title);
103 ?></td>
104 <td id="xyz_ihs_vAlign"><?php
105 if($entry->status == 2){echo 'NA';}
106 else
107 echo '[xyz-ihs snippet="'.esc_html($entry->title).'"]';
108 ?></td>
109 <td id="xyz_ihs_vAlign">
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 $stat1 = admin_url('admin.php?page=insert-html-snippet-manage&action=snippet-status&snippetId='.$entry->id.'&status=1&pageno='.$pagenum);
122 ?>
123 <td style="text-align: center;"><a
124 href='<?php echo wp_nonce_url($stat1,'ihs-stat_'.$entry->id); ?>'><img
125 id="xyz_ihs_img" title="Activate"
126 src="<?php echo plugins_url('images/activate.png', XYZ_INSERT_HTML_PLUGIN_FILE )?>">
127 </a>
128 </td>
129 <?php
130 }elseif ($entry->status == 1){
131 $stat2 = admin_url('admin.php?page=insert-html-snippet-manage&action=snippet-status&snippetId='.$entry->id.'&status=2&pageno='.$pagenum);
132 ?>
133 <td style="text-align: center;"><a
134 href='<?php echo wp_nonce_url($stat2,'ihs-stat_'.$entry->id); ?>'><img
135 id="xyz_ihs_img" title="Deactivate"
136 src="<?php echo plugins_url('images/pause.png',XYZ_INSERT_HTML_PLUGIN_FILE)?>">
137 </a>
138 </td>
139 <?php
140 }
141
142 ?>
143
144 <td style="text-align: center;"><a
145 href='<?php echo admin_url('admin.php?page=insert-html-snippet-manage&action=snippet-edit&snippetId='.$entry->id.'&pageno='.$pagenum); ?>'><img
146 id="xyz_ihs_img" title="Edit Snippet"
147 src="<?php echo plugins_url('images/edit.png',XYZ_INSERT_HTML_PLUGIN_FILE)?>">
148 </a>
149 </td>
150
151 <?php $delurl = admin_url('admin.php?page=insert-html-snippet-manage&action=snippet-delete&snippetId='.$entry->id.'&pageno='.$pagenum);?>
152 <td style="text-align: center;" ><a
153 href='<?php echo wp_nonce_url($delurl,'ihs-del_'.$entry->id); ?>'
154 onclick="javascript: return confirm('Please click \'OK\' to confirm ');"><img
155 id="xyz_ihs_img" title="Delete Snippet"
156 src="<?php echo plugins_url('images/delete.png',XYZ_INSERT_HTML_PLUGIN_FILE)?>">
157 </a></td>
158 </tr>
159 <?php
160 $count++;
161 }
162 } else { ?>
163 <tr>
164 <td colspan="6" >HTML Snippets not found</td>
165 </tr>
166 <?php } ?>
167 </tbody>
168 </table>
169
170 <input id="xyz_ihs_submit" style="cursor: pointer; margin-top:10px;margin-left:8px;" type="button" name="textFieldButton2" value="Add New HTML Snippet" onClick='document.location.href="<?php echo admin_url('admin.php?page=insert-html-snippet-manage&action=snippet-add');?>"'>
171
172 <?php
173 $total = $wpdb->get_var( "SELECT COUNT(`id`) FROM ".$wpdb->prefix."xyz_ihs_short_code" );
174 $num_of_pages = ceil( $total / $limit );
175
176 $page_links = paginate_links( array(
177 'base' => add_query_arg( 'pagenum','%#%'),
178 'format' => '',
179 'prev_text' => '&laquo;',
180 'next_text' => '&raquo;',
181 'total' => $num_of_pages,
182 'current' => $pagenum
183 ) );
184
185 if ( $page_links ) {
186 echo '<div class="tablenav" style="width:99%"><div class="tablenav-pages" style="margin: 1em 0">' . $page_links . '</div></div>';
187 }
188
189 ?>
190 </fieldset>
191 </form>
192 </div>
193