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 / snippet-add.php

snippet-add.php in Insert Html Snippet 1.0, at admin/snippet-add.php

101 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 global $wpdb;
4
5 $_POST = stripslashes_deep($_POST);
6 $_POST = xyz_trim_deep($_POST);
7
8 if(isset($_POST) && isset($_POST['addSubmit'])){
9
10 // echo '<pre>';
11 // print_r($_POST);
12 // die("JJJ");
13
14 $xyz_ihs_title = str_replace(' ', '-', $_POST['snippetTitle']);
15 $xyz_ihs_content = $_POST['snippetContent'];
16
17 if($xyz_ihs_title != "" && $xyz_ihs_content != ""){
18 if(ctype_alnum($xyz_ihs_title))
19 {
20
21 $snippet_count = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE title="'.$xyz_ihs_title.'"' ) ;
22 if($snippet_count == 0){
23 $xyz_shortCode = '[xyz-ihs snippet="'.$xyz_ihs_title.'"]';
24 $wpdb->insert($wpdb->prefix.'xyz_ihs_short_code', array('title' =>$xyz_ihs_title,'content'=>$xyz_ihs_content,'short_code'=>$xyz_shortCode,'status'=>'1'),array('%s','%s','%s','%d'));
25
26 header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=1'));
27 }else{
28 ?>
29 <div class="system_notice_area_style0" id="system_notice_area">
30 HTML Snippet already exists. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
31 </div>
32 <?php
33
34 }
35 }
36 else
37 {
38 ?>
39 <div class="system_notice_area_style0" id="system_notice_area">
40 HTML Snippet title must be alphanumeric. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
41 </div>
42 <?php
43
44 }
45
46
47 }else{
48 ?>
49 <div class="system_notice_area_style0" id="system_notice_area">
50 Fill all mandatory fields. &nbsp;&nbsp;&nbsp;<span id="system_notice_area_dismiss">Dismiss</span>
51 </div>
52 <?php
53 }
54
55 }
56
57 ?>
58
59 <div >
60 <fieldset
61 style="width: 99%; border: 1px solid #F7F7F7; padding: 10px 0px;">
62 <legend>
63 <b>Add HTML Snippet</b>
64 </legend>
65 <form name="frmmainForm" id="frmmainForm" method="post">
66
67 <div>
68 <table
69 style="width: 99%; background-color: #F9F9F9; border: 1px solid #E4E4E4; border-width: 1px;margin: 0 auto">
70 <tr><td><br/>
71 <div id="shortCode"></div>
72 <br/></td></tr>
73 <tr valign="top">
74 <td style="border-bottom: none;width:20%;">&nbsp;&nbsp;&nbsp;Tracking Name&nbsp;<font color="red">*</font></td>
75 <td style="border-bottom: none;width:1px;">&nbsp;:&nbsp;</td>
76 <td><input style="width:80%;"
77 type="text" name="snippetTitle" id="snippetTitle"
78 value="<?php if(isset($_POST['snippetTitle'])){ echo esc_attr($_POST['snippetTitle']);}?>"></td>
79 </tr>
80 <tr>
81 <td style="border-bottom: none;width:20%; ">&nbsp;&nbsp;&nbsp;HTML code &nbsp;<font color="red">*</font></td>
82 <td style="border-bottom: none;width:1px;">&nbsp;:&nbsp;</td>
83 <td >
84 <textarea name="snippetContent" style="width:80%;height:150px;"><?php if(isset($_POST['snippetContent'])){ echo esc_textarea($_POST['snippetContent']);}?></textarea>
85 </td>
86 </tr>
87
88 <tr>
89 <td></td><td></td>
90 <td><input class="button-primary" style="cursor: pointer;"
91 type="submit" name="addSubmit" value="Create"></td>
92 </tr>
93 <tr><td><br/></td></tr>
94 </table>
95 </div>
96
97 </form>
98 </fieldset>
99
100 </div>
101