Version Description
- First official launch.
=
Download this release
Release Info
Developer | f1logic |
Plugin | Insert Html Snippet |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- add_shortcode_tynimce.php +41 -0
- admin/about.php +54 -0
- admin/ajax-backlink.php +14 -0
- admin/footer.php +225 -0
- admin/header.php +78 -0
- admin/images/facebook.png +0 -0
- admin/images/gplus.png +0 -0
- admin/images/support.png +0 -0
- admin/images/twitter.png +0 -0
- admin/images/xyz_logo.png +0 -0
- admin/install.php +27 -0
- admin/menu.php +85 -0
- admin/settings.php +84 -0
- admin/snippet-add.php +100 -0
- admin/snippet-delete.php +28 -0
- admin/snippet-edit.php +115 -0
- admin/snippet-status.php +29 -0
- admin/snippets.php +199 -0
- admin/style.php +138 -0
- admin/uninstall.php +15 -0
- css/xyz_ihs_styles.css +62 -0
- editor_plugin.js.php +78 -0
- images/activate.png +0 -0
- images/delete.png +0 -0
- images/edit.png +0 -0
- images/logo.png +0 -0
- images/pause.png +0 -0
- insert-html-snippet.php +67 -0
- js/notice.js +15 -0
- readme.txt +96 -0
- shortcode-handler.php +45 -0
- widget.php +80 -0
- xyz-functions.php +51 -0
add_shortcode_tynimce.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!class_exists('XYZ_Insert_Html_TinyMCESelector')):
|
4 |
+
|
5 |
+
class XYZ_Insert_Html_TinyMCESelector{
|
6 |
+
var $buttonName = 'xyz_ihs_snippet_selecter';
|
7 |
+
function addSelector(){
|
8 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
9 |
+
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
|
10 |
+
return;
|
11 |
+
|
12 |
+
// Add only in Rich Editor mode
|
13 |
+
if ( get_user_option('rich_editing') == 'true') {
|
14 |
+
add_filter('mce_external_plugins', array($this, 'registerTmcePlugin'));
|
15 |
+
//you can use the filters mce_buttons_2, mce_buttons_3 and mce_buttons_4
|
16 |
+
//to add your button to other toolbars of your tinymce
|
17 |
+
add_filter('mce_buttons', array($this, 'registerButton'));
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
function registerButton($buttons){
|
22 |
+
array_push($buttons, "separator", $this->buttonName);
|
23 |
+
return $buttons;
|
24 |
+
}
|
25 |
+
|
26 |
+
function registerTmcePlugin($plugin_array){
|
27 |
+
$plugin_array[$this->buttonName] = plugins_url() . '/insert-html-snippet/editor_plugin.js.php';
|
28 |
+
|
29 |
+
if ( get_user_option('rich_editing') == 'true')
|
30 |
+
//var_dump($plugin_array);
|
31 |
+
return $plugin_array;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
endif;
|
36 |
+
|
37 |
+
if(!isset($shortcodesXYZEH)){
|
38 |
+
$shortcodesXYZEH = new XYZ_Insert_Html_TinyMCESelector();
|
39 |
+
add_action('admin_head', array($shortcodesXYZEH, 'addSelector'));
|
40 |
+
}
|
41 |
+
|
admin/about.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style>
|
2 |
+
</style>
|
3 |
+
|
4 |
+
<h1 style="visibility: visible;">Insert HTML Snippet (V <?php echo xyz_ihs_plugin_get_version(); ?>)</h1>
|
5 |
+
Integrate HTML code seamlessly to your wordpress. This plugin lets you generate a shortcode corresponding
|
6 |
+
to any random HTML code be is javascript, ad codes, vide embedding codes or any raw HTML. The shortcodes
|
7 |
+
can be used in your pages, posts and widgets. Insert HTML Snippet is developed and maintained by
|
8 |
+
<a href="http://xyzscripts.com">xyzscripts</a>
|
9 |
+
.
|
10 |
+
|
11 |
+
|
12 |
+
<br />
|
13 |
+
<h2>Features</h2>
|
14 |
+
|
15 |
+
<div>
|
16 |
+
<p></p>
|
17 |
+
|
18 |
+
<div style="float: left;">
|
19 |
+
|
20 |
+
|
21 |
+
<ul>
|
22 |
+
<li>Convert HTML snippets to shortcodes</li>
|
23 |
+
<li>Support for shortcodes in widgets</li>
|
24 |
+
<li>Dropdown menu in TinyMCE editor to pick snippets easily</li>
|
25 |
+
</ul>
|
26 |
+
|
27 |
+
|
28 |
+
</div>
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
</div>
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
<div style="clear: both;"></div>
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
<h2>Other plugins</h2>
|
43 |
+
<div>
|
44 |
+
<p>Do checkout other plugins from our team.</p>
|
45 |
+
<ul>
|
46 |
+
<li><a target="_blank" href="http://wordpress.org/extend/plugins/lightbox-pop/">Lightbox Pop</a></li>
|
47 |
+
<li><a target="_blank" href="http://xyzscripts.com/wordpress-plugins/lightbox-pop/details">Lightbox Pop Premium</a></li>
|
48 |
+
<li><a target="_blank" href="http://wordpress.org/extend/plugins/newsletter-manager/">Newsletter Manager</a></li>
|
49 |
+
<li><a target="_blank" href="http://wordpress.org/extend/plugins/contact-form-manager/">Contact Form Manager</a></li>
|
50 |
+
|
51 |
+
</ul>
|
52 |
+
|
53 |
+
<p></p>
|
54 |
+
</div>
|
admin/ajax-backlink.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require( dirname( __FILE__ ) . '../../../../../wp-load.php' );
|
3 |
+
if(!current_user_can('manage_options')){
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
global $wpdb;
|
7 |
+
|
8 |
+
if($_POST){
|
9 |
+
|
10 |
+
update_option('xyz_credit_link','ihs');
|
11 |
+
}
|
12 |
+
|
13 |
+
|
14 |
+
?>
|
admin/footer.php
ADDED
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div style="clear: both;"></div>
|
2 |
+
|
3 |
+
<style>
|
4 |
+
|
5 |
+
.xyz_feedback{
|
6 |
+
background: #CEEAF7; /* Old browsers */
|
7 |
+
border: 1px solid #64cfe8;
|
8 |
+
width: 48%;
|
9 |
+
height:200px;
|
10 |
+
padding-left: 10px;
|
11 |
+
float: left;
|
12 |
+
|
13 |
+
}
|
14 |
+
|
15 |
+
.xyz_feedback ul{
|
16 |
+
font-weight: bold;
|
17 |
+
}
|
18 |
+
|
19 |
+
.xyz_feedback a{
|
20 |
+
text-decoration: none
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
.xyz_subscribe{
|
25 |
+
background: #bae598; /* Old browsers */
|
26 |
+
border: 1px solid #4d8a1d;
|
27 |
+
width: 48%;
|
28 |
+
padding-left: 10px;
|
29 |
+
float:right;
|
30 |
+
height:200px;
|
31 |
+
|
32 |
+
}
|
33 |
+
.xyz_subscribe td{
|
34 |
+
padding:0;
|
35 |
+
}
|
36 |
+
|
37 |
+
</style>
|
38 |
+
<p></p>
|
39 |
+
<div style="width: 100%">
|
40 |
+
<fieldset
|
41 |
+
style="width: 99%; border: 1px solid #F7F7F7; padding: 10px 0px;">
|
42 |
+
|
43 |
+
<table style="width:99%;margin: 0 auto">
|
44 |
+
<tr>
|
45 |
+
<td style="width:50%; padding: 0">
|
46 |
+
<div class="xyz_feedback" style="width:99%;float: left;">
|
47 |
+
<h2>Feedback</h2>
|
48 |
+
|
49 |
+
Your feedback and suggestions are our sources for betterment of this plugin. You can provide your feedback using any of the options below.
|
50 |
+
<p></p>
|
51 |
+
<ul style="float: left;">
|
52 |
+
|
53 |
+
<li><a target="_blank" href="http://xyzscripts.com/donate/1">Donate a dollar</a></li>
|
54 |
+
<li><a target="_blank" href="http://wordpress.org/extend/plugins/insert-html-snippet/">Rate this plugin</a></li>
|
55 |
+
<li><a target="_blank" href="http://xyzscripts.com/support/">Suggestions</a></li>
|
56 |
+
</ul>
|
57 |
+
<ul style="float: left;padding-left: 30px">
|
58 |
+
<li><a target="_blank" href="http://facebook.com/xyzscripts" class="xyz_fbook">Like us on facebook</a></li>
|
59 |
+
<li><a target="_blank" href="http://twitter.com/xyzscripts" class="xyz_twitt">Follow us on twitter</a></li>
|
60 |
+
<li><a target="_blank" href="https://plus.google.com/101215320403235276710/" class="xyz_gplus">+1 us on Google+</a></li>
|
61 |
+
|
62 |
+
</ul>
|
63 |
+
|
64 |
+
</div>
|
65 |
+
</td>
|
66 |
+
<td> </td>
|
67 |
+
|
68 |
+
<td style="width:50%;">
|
69 |
+
<div class="xyz_subscribe" style="width:99%;float: right;">
|
70 |
+
|
71 |
+
|
72 |
+
<h2>Subscribe</h2>
|
73 |
+
|
74 |
+
|
75 |
+
Stay tuned to our updates by subscribing below.
|
76 |
+
|
77 |
+
|
78 |
+
<div>
|
79 |
+
|
80 |
+
<script language="javascript">
|
81 |
+
function check_email(emailString)
|
82 |
+
{
|
83 |
+
var mailPattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
|
84 |
+
var matchArray = emailString.match(mailPattern);
|
85 |
+
if (emailString.length == 0)
|
86 |
+
return false;
|
87 |
+
|
88 |
+
if (matchArray == null) {
|
89 |
+
return false;
|
90 |
+
}else{
|
91 |
+
return true;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
function verify_lists(form)
|
97 |
+
{
|
98 |
+
|
99 |
+
var total=0;
|
100 |
+
var checkBox=form['chk[]'];
|
101 |
+
|
102 |
+
if(checkBox.length){
|
103 |
+
|
104 |
+
for(var i=0;i<checkBox.length;i++){
|
105 |
+
checkBox[i].checked?total++:null;
|
106 |
+
}
|
107 |
+
}else{
|
108 |
+
|
109 |
+
checkBox.checked?total++:null;
|
110 |
+
|
111 |
+
}
|
112 |
+
if(total>0){
|
113 |
+
return true;
|
114 |
+
}else{
|
115 |
+
return false;
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
function verify_fields()
|
121 |
+
{
|
122 |
+
|
123 |
+
if(check_email(document.email_subscription.email.value) == false){
|
124 |
+
alert("Please check whether the email is correct.");
|
125 |
+
document.email_subscription.email.select();
|
126 |
+
return false;
|
127 |
+
}else if(verify_lists(document.email_subscription)==false){
|
128 |
+
alert("Select atleast one list.");
|
129 |
+
}
|
130 |
+
else{
|
131 |
+
document.email_subscription.submit();
|
132 |
+
}
|
133 |
+
|
134 |
+
}
|
135 |
+
</script>
|
136 |
+
<?php global $current_user; get_currentuserinfo(); ?>
|
137 |
+
<form action=http://xyzscripts.com/newsletter/index.php?page=list/subscribe method="post" name="email_subscription" id="email_subscription" >
|
138 |
+
<input type="hidden" name="fieldNameIds" value="1,">
|
139 |
+
<input type="hidden" name="redirActive" value="http://xyzscripts.com/subscription/pending/XYZWPIH">
|
140 |
+
<input type="hidden" name="redirPending" value="http://xyzscripts.com/subscription/active/XYZWPIH">
|
141 |
+
<input type="hidden" name="mode" value="1">
|
142 |
+
<table border="0" style=" width: 100%; color: black;">
|
143 |
+
<tr>
|
144 |
+
<td colspan="3" style="padding: 0px;">
|
145 |
+
<span style="font-size:14px;"><b>Field marked <font style="color:#FF0000">*</font> are mandatory </b></span>
|
146 |
+
</td>
|
147 |
+
</tr>
|
148 |
+
|
149 |
+
<tr><td colspan="3" style="padding: 0px;"> </td></tr>
|
150 |
+
|
151 |
+
|
152 |
+
<tr>
|
153 |
+
<td id="align" >Name</td>
|
154 |
+
<td id="align" > : </td>
|
155 |
+
<td id="align" >
|
156 |
+
<input style="border: 1px solid #3fafe3; margin-right:10px;" type="text" name="field1" value="<?php
|
157 |
+
if ($current_user->user_firstname != "" || $current_user->user_lastname != "")
|
158 |
+
{
|
159 |
+
echo $current_user->user_firstname . " " . $current_user->user_lastname;
|
160 |
+
}
|
161 |
+
else if (strcasecmp($current_user->display_name, 'admin')!=0 && strcasecmp($current_user->display_name , "administrator")!=0 )
|
162 |
+
{
|
163 |
+
echo $current_user->display_name;
|
164 |
+
}
|
165 |
+
else if (strcasecmp($current_user->user_login ,"admin")!=0 && strcasecmp($current_user->user_login , "administrator")!=0 )
|
166 |
+
{
|
167 |
+
echo $current_user->user_login;
|
168 |
+
}
|
169 |
+
?>" ></td>
|
170 |
+
</tr>
|
171 |
+
<tr >
|
172 |
+
<td >Email Address</td><td > : </td>
|
173 |
+
<td >
|
174 |
+
<input style="border: 1px solid #3fafe3;" name="email"
|
175 |
+
type="text" value="<?php echo $current_user->user_email; ?>" /><span style="color:#FF0000">*</span>
|
176 |
+
</td>
|
177 |
+
</tr>
|
178 |
+
<tr><td colspan="3" style="padding: 0px;"> </td></tr>
|
179 |
+
|
180 |
+
|
181 |
+
<tr>
|
182 |
+
<td style="padding: 0px;"> </td><td style="padding: 0px;"> </td>
|
183 |
+
<td style="padding: 0px;">
|
184 |
+
<input class="button-primary" type="submit" value="subscribe" name="Submit" onclick="javascript: if(!verify_fields()) return false; " />
|
185 |
+
</td>
|
186 |
+
<td style="padding: 0px;"> </td>
|
187 |
+
</tr>
|
188 |
+
<tr>
|
189 |
+
<td colspan="3" style="padding: 0px;"> </td>
|
190 |
+
</tr>
|
191 |
+
</table>
|
192 |
+
<input type="hidden" name="listName" value="6,1,"/>
|
193 |
+
</form>
|
194 |
+
</div>
|
195 |
+
|
196 |
+
|
197 |
+
|
198 |
+
</div>
|
199 |
+
</td>
|
200 |
+
</tr>
|
201 |
+
</table>
|
202 |
+
</fieldset>
|
203 |
+
|
204 |
+
<div style="clear: both;"></div>
|
205 |
+
<div style="width: 99%">
|
206 |
+
<div style="padding-top: 10px;float:left;">
|
207 |
+
Powered by <a href="http://xyzscripts.com" target="_blank">XYZScripts</a>
|
208 |
+
</div>
|
209 |
+
<div style="padding-top: 10px;float:right ;">
|
210 |
+
See Also :
|
211 |
+
<a target="_blank" href="http://wordpress.org/extend/plugins/lightbox-pop/">Lightbox Pop</a>
|
212 |
+
|
|
213 |
+
<a target="_blank" href="http://xyzscripts.com/wordpress-plugins/lightbox-pop/details">Lightbox Pop Premium</a>
|
214 |
+
|
|
215 |
+
<a target="_blank" href="http://wordpress.org/extend/plugins/newsletter-manager/">Newsletter Manager</a>
|
216 |
+
|
|
217 |
+
<a target="_blank" href="http://wordpress.org/extend/plugins/contact-form-manager/">Contact Form Manager</a>
|
218 |
+
|
219 |
+
</div>
|
220 |
+
</div>
|
221 |
+
|
222 |
+
<div style="clear: both;"></div>
|
223 |
+
|
224 |
+
</div>
|
225 |
+
<p style="clear: both;"></p>
|
admin/header.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style>
|
2 |
+
a.xyz_header_link:hover{text-decoration:underline;}
|
3 |
+
.xyz_header_link{text-decoration:none;}
|
4 |
+
</style>
|
5 |
+
|
6 |
+
<?php
|
7 |
+
|
8 |
+
if(get_option('xyz_credit_link')=="0"){
|
9 |
+
?>
|
10 |
+
<div style="float:left;background-color: #FFECB3;border-radius:5px;padding: 0px 5px;margin-top: 10px;border: 1px solid #E0AB1B" id="xyz_backlink_div">
|
11 |
+
|
12 |
+
Please do a favour by enabling backlink to our site. <a id="xyz_ihs_backlink" style="cursor: pointer;" >Okay, Enable</a>.
|
13 |
+
<script type="text/javascript">
|
14 |
+
jQuery(document).ready(function() {
|
15 |
+
|
16 |
+
jQuery('#xyz_ihs_backlink').click(function() {
|
17 |
+
|
18 |
+
jQuery.ajax
|
19 |
+
({
|
20 |
+
type: "POST",
|
21 |
+
url: "<?php echo plugins_url('insert-html-snippet/admin/ajax-backlink.php') ?>",
|
22 |
+
data: 'enable=1',
|
23 |
+
cache: false,
|
24 |
+
success: function(html)
|
25 |
+
{
|
26 |
+
jQuery("#xyz_backlink_div").html('Thank you for enabling backlink !');
|
27 |
+
jQuery("#xyz_backlink_div").css('background-color', '#D8E8DA');
|
28 |
+
jQuery("#xyz_backlink_div").css('border', '1px solid #0F801C');
|
29 |
+
}
|
30 |
+
});
|
31 |
+
|
32 |
+
|
33 |
+
});
|
34 |
+
});
|
35 |
+
</script>
|
36 |
+
</div>
|
37 |
+
<?php
|
38 |
+
}
|
39 |
+
?>
|
40 |
+
|
41 |
+
<style>
|
42 |
+
#text {margin:50px auto; width:500px}
|
43 |
+
.hotspot {color:#900; padding-bottom:1px; border-bottom:1px dotted #900; cursor:pointer}
|
44 |
+
|
45 |
+
#tt {position:absolute; display:block; }
|
46 |
+
#tttop {display:block; height:5px; margin-left:5px;}
|
47 |
+
#ttcont {display:block; padding:2px 10px 3px 7px; margin-left:-400px; background:#666; color:#FFF}
|
48 |
+
#ttbot {display:block; height:5px; margin-left:5px; }
|
49 |
+
</style>
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
<div style="margin-top: 10px">
|
56 |
+
<table style="float:right; ">
|
57 |
+
<tr>
|
58 |
+
<td style="float:right;" >
|
59 |
+
<a onmouseover="tooltip.show('Please help us to keep this plugin free forever by donating a dollar');" onmouseout="tooltip.hide();" class="xyz_header_link" style="margin-left:8px;margin-right:12px;" target="_blank" href="http://xyzscripts.com/donate/1">Donate</a>
|
60 |
+
</td>
|
61 |
+
<td style="float:right;">
|
62 |
+
<a class="xyz_header_link" style="margin-left:8px;" target="_blank" href="http://kb.xyzscripts.com/category/insert-html-snippet/">FAQ</a>
|
63 |
+
</td>
|
64 |
+
<td style="float:right;">
|
65 |
+
<a class="xyz_header_link" style="margin-left:8px;" target="_blank" href="http://docs.xyzscripts.com/category/insert-html-snippet/">Docs</a>
|
66 |
+
</td>
|
67 |
+
<td style="float:right;">
|
68 |
+
<a class="xyz_header_link" style="margin-left:8px;" target="_blank" href="http://xyzscripts.com/wordpress-plugins/insert-html-snippet/details">About</a>
|
69 |
+
</td>
|
70 |
+
<td style="float:right;">
|
71 |
+
<a class="xyz_header_link" target="_blank" href="http://xyzscripts.com">XYZScripts</a>
|
72 |
+
</td>
|
73 |
+
|
74 |
+
</tr>
|
75 |
+
</table>
|
76 |
+
</div>
|
77 |
+
|
78 |
+
<div style="clear: both"></div>
|
admin/images/facebook.png
ADDED
Binary file
|
admin/images/gplus.png
ADDED
Binary file
|
admin/images/support.png
ADDED
Binary file
|
admin/images/twitter.png
ADDED
Binary file
|
admin/images/xyz_logo.png
ADDED
Binary file
|
admin/install.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function xyz_ihs_install(){
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
//global $current_user; get_currentuserinfo();
|
7 |
+
|
8 |
+
|
9 |
+
if(get_option('xyz_credit_link') == "")
|
10 |
+
{
|
11 |
+
add_option("xyz_credit_link",0);
|
12 |
+
}
|
13 |
+
|
14 |
+
add_option('xyz_ihs_limit',20);
|
15 |
+
|
16 |
+
$queryInsertHtml = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."xyz_ihs_short_code (
|
17 |
+
`id` int NOT NULL AUTO_INCREMENT,
|
18 |
+
`title` varchar(1000) COLLATE utf8_unicode_ci NOT NULL,
|
19 |
+
`content` longtext COLLATE utf8_unicode_ci NOT NULL,
|
20 |
+
`short_code` varchar(2000) COLLATE utf8_unicode_ci NOT NULL,
|
21 |
+
`status` int NOT NULL,
|
22 |
+
PRIMARY KEY (`id`)
|
23 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1";
|
24 |
+
$wpdb->query($queryInsertHtml);
|
25 |
+
}
|
26 |
+
|
27 |
+
register_activation_hook(XYZ_INSERT_HTML_PLUGIN_FILE,'xyz_ihs_install');
|
admin/menu.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( is_admin() ){
|
4 |
+
|
5 |
+
add_action('admin_menu', 'xyz_ihs_menu');
|
6 |
+
}
|
7 |
+
|
8 |
+
function xyz_ihs_menu(){
|
9 |
+
|
10 |
+
add_menu_page('insert-html-snippet', 'XYZ Html', 'manage_options', 'insert-html-snippet-manage','xyz_ihs_snippets',plugins_url('insert-html-snippet/images/logo.png'));
|
11 |
+
|
12 |
+
add_submenu_page('insert-html-snippet-manage', 'HTML Snippets', 'HTML Snippets', 'manage_options', 'insert-html-snippet-manage','xyz_ihs_snippets');
|
13 |
+
add_submenu_page('insert-html-snippet-manage', 'HTML Snippets - Manage settings', 'Settings', 'manage_options', 'insert-html-snippet-settings' ,'xyz_ihs_settings');
|
14 |
+
add_submenu_page('insert-html-snippet-manage', 'HTML Snippets - About', 'About', 'manage_options', 'insert-html-snippet-about' ,'xyz_ihs_about');
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
function xyz_ihs_snippets(){
|
19 |
+
$formflag = 0;
|
20 |
+
if(isset($_GET['action']) && $_GET['action']=='snippet-delete' )
|
21 |
+
{
|
22 |
+
include(dirname( __FILE__ ) . '/snippet-delete.php');
|
23 |
+
$formflag=1;
|
24 |
+
}
|
25 |
+
if(isset($_GET['action']) && $_GET['action']=='snippet-edit' )
|
26 |
+
{
|
27 |
+
require( dirname( __FILE__ ) . '/header.php' );
|
28 |
+
include(dirname( __FILE__ ) . '/snippet-edit.php');
|
29 |
+
require( dirname( __FILE__ ) . '/footer.php' );
|
30 |
+
$formflag=1;
|
31 |
+
}
|
32 |
+
if(isset($_GET['action']) && $_GET['action']=='snippet-add' )
|
33 |
+
{
|
34 |
+
require( dirname( __FILE__ ) . '/header.php' );
|
35 |
+
require( dirname( __FILE__ ) . '/snippet-add.php' );
|
36 |
+
require( dirname( __FILE__ ) . '/footer.php' );
|
37 |
+
$formflag=1;
|
38 |
+
}
|
39 |
+
if(isset($_GET['action']) && $_GET['action']=='snippet-status' )
|
40 |
+
{
|
41 |
+
require( dirname( __FILE__ ) . '/snippet-status.php' );
|
42 |
+
$formflag=1;
|
43 |
+
}
|
44 |
+
if($formflag == 0){
|
45 |
+
require( dirname( __FILE__ ) . '/header.php' );
|
46 |
+
require( dirname( __FILE__ ) . '/snippets.php' );
|
47 |
+
require( dirname( __FILE__ ) . '/footer.php' );
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
function xyz_ihs_settings()
|
52 |
+
{
|
53 |
+
require( dirname( __FILE__ ) . '/header.php' );
|
54 |
+
require( dirname( __FILE__ ) . '/settings.php' );
|
55 |
+
require( dirname( __FILE__ ) . '/footer.php' );
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
function xyz_ihs_about(){
|
60 |
+
require( dirname( __FILE__ ) . '/header.php' );
|
61 |
+
require( dirname( __FILE__ ) . '/about.php' );
|
62 |
+
require( dirname( __FILE__ ) . '/footer.php' );
|
63 |
+
}
|
64 |
+
|
65 |
+
if(is_admin()){
|
66 |
+
|
67 |
+
wp_enqueue_script('jquery');
|
68 |
+
|
69 |
+
wp_register_script( 'xyz_notice_script', plugins_url('insert-html-snippet/js/notice.js') );
|
70 |
+
wp_enqueue_script( 'xyz_notice_script' );
|
71 |
+
|
72 |
+
wp_register_style( 'xyz_ihs_style', plugins_url('insert-html-snippet/css/xyz_ihs_styles.css'));
|
73 |
+
wp_enqueue_style( 'xyz_ihs_style');
|
74 |
+
|
75 |
+
}
|
76 |
+
function xyz_ihs_admin_style()
|
77 |
+
{
|
78 |
+
require( dirname( __FILE__ ) . '/style.php' );
|
79 |
+
|
80 |
+
}
|
81 |
+
add_action('admin_print_styles', 'xyz_ihs_admin_style');
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
?>
|
admin/settings.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
global $wpdb;
|
4 |
+
// Load the options
|
5 |
+
|
6 |
+
|
7 |
+
if($_POST){
|
8 |
+
|
9 |
+
$_POST=xyz_trim_deep($_POST);
|
10 |
+
$_POST = stripslashes_deep($_POST);
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
$xyz_ihs_limit = abs(intval($_POST['xyz_ihs_limit']));
|
15 |
+
if($xyz_ihs_limit==0)$xyz_ihs_limit=20;
|
16 |
+
|
17 |
+
$xyz_ihs_credit = $_POST['xyz_ihs_credit'];
|
18 |
+
|
19 |
+
|
20 |
+
update_option('xyz_ihs_limit',$xyz_ihs_limit);
|
21 |
+
update_option('xyz_credit_link',$xyz_ihs_credit);
|
22 |
+
|
23 |
+
?>
|
24 |
+
|
25 |
+
|
26 |
+
<div class="system_notice_area_style1" id="system_notice_area">
|
27 |
+
Settings updated successfully. <span id="system_notice_area_dismiss">Dismiss</span>
|
28 |
+
</div>
|
29 |
+
|
30 |
+
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
?>
|
36 |
+
|
37 |
+
<div>
|
38 |
+
|
39 |
+
<h2>Settings</h2>
|
40 |
+
<form method="post">
|
41 |
+
<div style="float: left;width: 98%">
|
42 |
+
<fieldset style=" width:100%; border:1px solid #F7F7F7; padding:10px 0px 15px 10px;">
|
43 |
+
<legend >General</legend>
|
44 |
+
<table class="widefat" style="width:99%;">
|
45 |
+
<tr valign="top">
|
46 |
+
<td scope="row" ><label for="xyz_ihs_credit">Credit link to author</label>
|
47 |
+
</td>
|
48 |
+
<td><select name="xyz_ihs_credit" id="xyz_ihs_credit">
|
49 |
+
<option value="ihs"
|
50 |
+
<?php if(isset($_POST['xyz_ihs_credit']) && $_POST['xyz_ihs_credit']=='ihs') { echo 'selected';}elseif(get_option('xyz_credit_link')=="ihs"){echo 'selected';} ?>>Enable</option>
|
51 |
+
<option value="0"
|
52 |
+
<?php if(isset($_POST['xyz_ihs_credit']) && $_POST['xyz_ihs_credit']!='ihs') { echo 'selected';}elseif(get_option('xyz_credit_link')!="ihs"){echo 'selected';} ?>>Disable</option>
|
53 |
+
|
54 |
+
</select>
|
55 |
+
</td>
|
56 |
+
</tr>
|
57 |
+
<tr valign="top">
|
58 |
+
<td scope="row" class=" settingInput" id="bottomBorderNone"><label for="xyz_ihs_limit">Pagination limit</label>
|
59 |
+
</td>
|
60 |
+
<td id="bottomBorderNone"><input name="xyz_ihs_limit" type="text"
|
61 |
+
id="xyz_ihs_limit" value="<?php if(isset($_POST['xyz_ihs_limit']) ){echo abs(intval($_POST['xyz_ihs_limit']));}else{print(get_option('xyz_ihs_limit'));} ?>" />
|
62 |
+
</td>
|
63 |
+
</tr>
|
64 |
+
|
65 |
+
</table>
|
66 |
+
</fieldset>
|
67 |
+
|
68 |
+
<fieldset style=" width:100%;padding:10px 0px 15px 10px;">
|
69 |
+
<legend></legend>
|
70 |
+
<table class="widefat" style="width:99%; margin-top:10px;">
|
71 |
+
<tr>
|
72 |
+
<td colspan=2 id="bottomBorderNone" style="text-align: center;">
|
73 |
+
<div style="height:50px;"><input style="margin:10px 0 20px 0;" id="submit" class="button-primary bottonWidth" type="submit" value=" Update Settings " /></div>
|
74 |
+
|
75 |
+
</td>
|
76 |
+
</tr>
|
77 |
+
|
78 |
+
</table>
|
79 |
+
</fieldset>
|
80 |
+
|
81 |
+
|
82 |
+
</div>
|
83 |
+
|
84 |
+
</form>
|
admin/snippet-add.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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. <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. <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. <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%;"> Tracking Name <font color="red">*</font></td>
|
75 |
+
<td style="border-bottom: none;width:1px;"> : </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%; "> HTML code <font color="red">*</font></td>
|
82 |
+
<td style="border-bottom: none;width:1px;"> : </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>
|
admin/snippet-delete.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
global $wpdb;
|
3 |
+
|
4 |
+
$_POST = stripslashes_deep($_POST);
|
5 |
+
$_GET = stripslashes_deep($_GET);
|
6 |
+
|
7 |
+
$xyz_ihs_snippetId = intval($_GET['snippetId']);
|
8 |
+
$xyz_ihs_pageno = intval($_GET['pageno']);
|
9 |
+
|
10 |
+
if($xyz_ihs_snippetId=="" || !is_numeric($xyz_ihs_snippetId)){
|
11 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage'));
|
12 |
+
exit();
|
13 |
+
|
14 |
+
}
|
15 |
+
$snippetCount = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id="'.$xyz_ihs_snippetId.'" LIMIT 0,1' ) ;
|
16 |
+
|
17 |
+
if($snippetCount==0){
|
18 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=2'));
|
19 |
+
exit();
|
20 |
+
}else{
|
21 |
+
|
22 |
+
$wpdb->query( 'DELETE FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id="'.$xyz_ihs_snippetId.'" ' ) ;
|
23 |
+
|
24 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=3&pagenum='.$xyz_ihs_pageno));
|
25 |
+
exit();
|
26 |
+
|
27 |
+
}
|
28 |
+
?>
|
admin/snippet-edit.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
global $wpdb;
|
4 |
+
global $current_user;
|
5 |
+
get_currentuserinfo();
|
6 |
+
|
7 |
+
$xyz_ihs_snippetId = $_GET['snippetId'];
|
8 |
+
|
9 |
+
if(isset($_POST) && isset($_POST['updateSubmit'])){
|
10 |
+
|
11 |
+
// echo '<pre>';
|
12 |
+
// print_r($_POST);
|
13 |
+
// die("JJJ");
|
14 |
+
$_POST = stripslashes_deep($_POST);
|
15 |
+
$_POST = xyz_trim_deep($_POST);
|
16 |
+
|
17 |
+
$xyz_ihs_snippetId = $_GET['snippetId'];
|
18 |
+
$xyz_ihs_title = str_replace(' ', '-', $_POST['snippetTitle']);
|
19 |
+
$xyz_ihs_content = $_POST['snippetContent'];
|
20 |
+
|
21 |
+
if($xyz_ihs_title != "" && $xyz_ihs_content != ""){
|
22 |
+
|
23 |
+
if(ctype_alnum($xyz_ihs_title))
|
24 |
+
{
|
25 |
+
$snippet_count = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id!="'.$xyz_ihs_snippetId.'" AND title="'.$xyz_ihs_title.'" LIMIT 0,1' ) ;
|
26 |
+
|
27 |
+
if($snippet_count == 0){
|
28 |
+
$xyz_shortCode = '[xyz-ihs snippet="'.$xyz_ihs_title.'"]';
|
29 |
+
|
30 |
+
$wpdb->update($wpdb->prefix.'xyz_ihs_short_code', array('title'=>$xyz_ihs_title,'content'=>$xyz_ihs_content,'short_code'=>$xyz_shortCode,), array('id'=>$xyz_ihs_snippetId));
|
31 |
+
|
32 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&msg=5'));
|
33 |
+
|
34 |
+
}else{
|
35 |
+
?>
|
36 |
+
<div class="system_notice_area_style0" id="system_notice_area">
|
37 |
+
HTML Snippet already exists. <span id="system_notice_area_dismiss">Dismiss</span>
|
38 |
+
</div>
|
39 |
+
<?php
|
40 |
+
|
41 |
+
}
|
42 |
+
}
|
43 |
+
else
|
44 |
+
{
|
45 |
+
?>
|
46 |
+
<div class="system_notice_area_style0" id="system_notice_area">
|
47 |
+
HTML Snippet title must be alphanumeric. <span id="system_notice_area_dismiss">Dismiss</span>
|
48 |
+
</div>
|
49 |
+
<?php
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
}else{
|
55 |
+
?>
|
56 |
+
<div class="system_notice_area_style0" id="system_notice_area">
|
57 |
+
Fill all mandatory fields. <span id="system_notice_area_dismiss">Dismiss</span>
|
58 |
+
</div>
|
59 |
+
<?php
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
+
global $wpdb;
|
66 |
+
|
67 |
+
|
68 |
+
$snippetDetails = $wpdb->get_results( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id="'.$xyz_ihs_snippetId.'" LIMIT 0,1' ) ;
|
69 |
+
$snippetDetails = $snippetDetails[0];
|
70 |
+
|
71 |
+
?>
|
72 |
+
|
73 |
+
<div >
|
74 |
+
<fieldset
|
75 |
+
style="width: 99%; border: 1px solid #F7F7F7; padding: 10px 0px;">
|
76 |
+
<legend>
|
77 |
+
<b>Edit HTML Snippet</b>
|
78 |
+
</legend>
|
79 |
+
<form name="frmmainForm" id="frmmainForm" method="post">
|
80 |
+
<input type="hidden" id="snippetId" name="snippetId"
|
81 |
+
value="<?php if(isset($_POST['snippetId'])){ echo esc_attr($_POST['snippetId']);}else{ echo esc_attr($snippetDetails->id); }?>">
|
82 |
+
<div>
|
83 |
+
<table
|
84 |
+
style="width: 99%; background-color: #F9F9F9; border: 1px solid #E4E4E4; border-width: 1px;margin: 0 auto">
|
85 |
+
<tr><td><br/>
|
86 |
+
<div id="shortCode"></div>
|
87 |
+
<br/></td></tr>
|
88 |
+
<tr valign="top">
|
89 |
+
<td style="border-bottom: none;width:20%;"> Tracking Name <font color="red">*</font></td>
|
90 |
+
<td style="border-bottom: none;width:1px;"> : </td>
|
91 |
+
<td><input style="width:80%;"
|
92 |
+
type="text" name="snippetTitle" id="snippetTitle"
|
93 |
+
value="<?php if(isset($_POST['snippetTitle'])){ echo esc_attr($_POST['snippetTitle']);}else{ echo esc_attr($snippetDetails->title); }?>"></td>
|
94 |
+
</tr>
|
95 |
+
<tr>
|
96 |
+
<td style="border-bottom: none;width:20%; "> HTML code <font color="red">*</font></td>
|
97 |
+
<td style="border-bottom: none;width:1px;"> : </td>
|
98 |
+
<td >
|
99 |
+
<textarea name="snippetContent" style="width:80%;height:150px;"><?php if(isset($_POST['snippetContent'])){ echo esc_textarea($_POST['snippetContent']);}else{ echo esc_textarea($snippetDetails->content); }?></textarea>
|
100 |
+
</td>
|
101 |
+
</tr>
|
102 |
+
|
103 |
+
<tr>
|
104 |
+
<td></td><td></td>
|
105 |
+
<td><input class="button-primary" style="cursor: pointer;"
|
106 |
+
type="submit" name="updateSubmit" value="Update"></td>
|
107 |
+
</tr>
|
108 |
+
<tr><td><br/></td></tr>
|
109 |
+
</table>
|
110 |
+
</div>
|
111 |
+
|
112 |
+
</form>
|
113 |
+
</fieldset>
|
114 |
+
|
115 |
+
</div>
|
admin/snippet-status.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
global $wpdb;
|
4 |
+
|
5 |
+
$_POST = stripslashes_deep($_POST);
|
6 |
+
$_GET = stripslashes_deep($_GET);
|
7 |
+
|
8 |
+
$xyz_ihs_snippetId = intval($_GET['snippetId']);
|
9 |
+
$xyz_ihs_snippetStatus = intval($_GET['status']);
|
10 |
+
$xyz_ihs_pageno = intval($_GET['pageno']);
|
11 |
+
if($xyz_ihs_snippetId=="" || !is_numeric($xyz_ihs_snippetId)){
|
12 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage'));
|
13 |
+
exit();
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
$snippetCount = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id="'.$xyz_ihs_snippetId.'" LIMIT 0,1' ) ;
|
18 |
+
|
19 |
+
if($snippetCount==0){
|
20 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=2'));
|
21 |
+
exit();
|
22 |
+
}else{
|
23 |
+
|
24 |
+
$wpdb->update($wpdb->prefix.'xyz_ihs_short_code', array('status'=>$xyz_ihs_snippetStatus), array('id'=>$xyz_ihs_snippetId));
|
25 |
+
header("Location:".admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=4&pagenum='.$xyz_ihs_pageno));
|
26 |
+
exit();
|
27 |
+
|
28 |
+
}
|
29 |
+
?>
|
admin/snippets.php
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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. <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. <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. <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. <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. <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' => '«',
|
181 |
+
'next_text' => '»',
|
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 |
+
|
admin/style.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php require_once( dirname( __FILE__ ) .'/../../../../wp-load.php'); ?>
|
2 |
+
<style type="text/css">
|
3 |
+
|
4 |
+
#system_notice_area {
|
5 |
+
position: fixed;
|
6 |
+
margin-bottom:40px;
|
7 |
+
left:25%;
|
8 |
+
width:50%;
|
9 |
+
height:20px;
|
10 |
+
border-radius:5px;
|
11 |
+
-moz-border-radius:5px;
|
12 |
+
-webkit-border-radius:5px;
|
13 |
+
font-weight:bold;
|
14 |
+
display:none;
|
15 |
+
padding:5px;
|
16 |
+
color: #000000;
|
17 |
+
text-align: center;
|
18 |
+
<?php
|
19 |
+
if(function_exists('is_admin_bar_showing') && is_admin_bar_showing()){
|
20 |
+
?>
|
21 |
+
top :28px;
|
22 |
+
<?php
|
23 |
+
}else{
|
24 |
+
?>
|
25 |
+
top: 0px;
|
26 |
+
<?php
|
27 |
+
}
|
28 |
+
?>
|
29 |
+
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
.xyz_fbook{
|
36 |
+
|
37 |
+
background-image: url('<?php echo plugins_url("images/facebook.png",__FILE__) ?>');
|
38 |
+
height:16px;
|
39 |
+
background-repeat: no-repeat;
|
40 |
+
background-position: left center;
|
41 |
+
padding-left: 15px;
|
42 |
+
text-decoration: none;
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
}
|
47 |
+
.xyz_support{
|
48 |
+
|
49 |
+
background-image: url('<?php echo plugins_url("images/support.png",__FILE__) ?>');
|
50 |
+
height:16px;
|
51 |
+
background-repeat: no-repeat;
|
52 |
+
background-position: left center;
|
53 |
+
padding-left: 15px;
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
}
|
59 |
+
.xyz_twitt{
|
60 |
+
|
61 |
+
background-image: url('<?php echo plugins_url("images/twitter.png",__FILE__) ?>');
|
62 |
+
height:16px;
|
63 |
+
background-repeat: no-repeat;
|
64 |
+
background-position: left center;
|
65 |
+
padding-left: 15px;
|
66 |
+
text-decoration: none;
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
}
|
71 |
+
.xyz_gplus{
|
72 |
+
|
73 |
+
background-image: url('<?php echo plugins_url("images/gplus.png",__FILE__) ?>');
|
74 |
+
height:16px;
|
75 |
+
background-repeat: no-repeat;
|
76 |
+
background-position: left center;
|
77 |
+
padding-left: 15px;
|
78 |
+
text-decoration: none;
|
79 |
+
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
#insert-html-snippet .xyz_gplus{
|
85 |
+
margin-left: 3px;
|
86 |
+
}
|
87 |
+
|
88 |
+
#insert-html-snippet .plugin-version-author-uri {
|
89 |
+
|
90 |
+
background-color: #F4F4F4;
|
91 |
+
min-height:16px;
|
92 |
+
border-radius:5px;
|
93 |
+
margin-bottom: 10px;
|
94 |
+
font-weight:bold;
|
95 |
+
padding: 5px;
|
96 |
+
color: #111111;
|
97 |
+
|
98 |
+
-webkit-box-shadow: 0 8px 6px -6px black;
|
99 |
+
-moz-box-shadow: 0 8px 6px -6px black;
|
100 |
+
box-shadow: 0 8px 6px -6px black;
|
101 |
+
|
102 |
+
}
|
103 |
+
#insert-html-snippet{
|
104 |
+
background: #a9e8f5; /* Old browsers */
|
105 |
+
|
106 |
+
background: -moz-linear-gradient(top, #ffffff 0%, #a9e8f5 100%); /* FF3.6+ */
|
107 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#a9e8f5)); /* Chrome,Safari4+ */
|
108 |
+
background: -webkit-linear-gradient(top, #ffffff 0%,#a9e8f5 100%); /* Chrome10+,Safari5.1+ */
|
109 |
+
background: -o-linear-gradient(top, #ffffff 0%,#a9e8f5 100%); /* Opera 11.10+ */
|
110 |
+
background: -ms-linear-gradient(top, #ffffff 0%,#a9e8f5 100%); /* IE10+ */
|
111 |
+
background: linear-gradient(top, #ffffff 0%,#a9e8f5 100%); /* W3C */
|
112 |
+
|
113 |
+
|
114 |
+
}
|
115 |
+
#insert-html-snippet .plugin-version-author-uri a,
|
116 |
+
#insert-html-snippet .plugin-version-author-uri a:link,
|
117 |
+
#insert-html-snippet .plugin-version-author-uri a:hover,
|
118 |
+
#insert-html-snippet .plugin-version-author-uri a:active,
|
119 |
+
#insert-html-snippet .plugin-version-author-uri a:visited{
|
120 |
+
|
121 |
+
|
122 |
+
color: #111111;
|
123 |
+
text-decoration: none;
|
124 |
+
|
125 |
+
}
|
126 |
+
#insert-html-snippet .plugin-version-author-uri a:hover{
|
127 |
+
|
128 |
+
color:#cc811a;
|
129 |
+
}
|
130 |
+
#insert-html-snippet .plugin-title{
|
131 |
+
|
132 |
+
background-image: url('<?php echo plugins_url("images/xyz_logo.png",__FILE__) ?>');
|
133 |
+
background-repeat: no-repeat;
|
134 |
+
background-position: left bottom;
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
</style>
|
admin/uninstall.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function xyz_ihs_uninstall(){
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
delete_option("xyz_ihs_limit");
|
8 |
+
|
9 |
+
/* table delete*/
|
10 |
+
$wpdb->query("DROP TABLE ".$wpdb->prefix."xyz_ihs_short_code");
|
11 |
+
|
12 |
+
|
13 |
+
}
|
14 |
+
register_uninstall_hook(XYZ_INSERT_HTML_PLUGIN_FILE,'xyz_ihs_uninstall');
|
15 |
+
?>
|
css/xyz_ihs_styles.css
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
#system_notice_area_dismiss{
|
3 |
+
color: #FFFFFF;
|
4 |
+
cursor: pointer;
|
5 |
+
}
|
6 |
+
.system_notice_area_style1 {
|
7 |
+
background: #00C348;
|
8 |
+
border: 1px solid green;
|
9 |
+
}
|
10 |
+
|
11 |
+
.system_notice_area_style0 {
|
12 |
+
background: #FA5A6A;
|
13 |
+
border: 1px solid brown;
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
#button {
|
18 |
+
width: 140px;
|
19 |
+
background-color: #E4E4E4;
|
20 |
+
cursor: pointer;
|
21 |
+
-webkit-border-radius: 40px;
|
22 |
+
-moz-border-radius: 40px;
|
23 |
+
border-radius: 40px;
|
24 |
+
}
|
25 |
+
|
26 |
+
#button:hover {
|
27 |
+
border: 1px solid #797979;
|
28 |
+
}
|
29 |
+
|
30 |
+
a {
|
31 |
+
text-decoration: none;
|
32 |
+
}
|
33 |
+
|
34 |
+
label{
|
35 |
+
cursor:default;
|
36 |
+
}
|
37 |
+
|
38 |
+
#img{
|
39 |
+
width:20px;
|
40 |
+
height: 20px;
|
41 |
+
}
|
42 |
+
|
43 |
+
#tdCenter{
|
44 |
+
text-align: center;
|
45 |
+
}
|
46 |
+
.bottonWidth{
|
47 |
+
width:120px;
|
48 |
+
}
|
49 |
+
#buttonDesign{
|
50 |
+
width:120px;
|
51 |
+
}
|
52 |
+
|
53 |
+
#bottomBorderNone {
|
54 |
+
border-bottom:none;
|
55 |
+
}
|
56 |
+
|
57 |
+
legend{
|
58 |
+
font-size: 14px;
|
59 |
+
}
|
60 |
+
#content_xyz_ihs_snippet_selecterList_text{
|
61 |
+
width:90px;
|
62 |
+
}
|
editor_plugin.js.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once('../../../wp-load.php');
|
3 |
+
require_once('../../../wp-admin/includes/admin.php');
|
4 |
+
do_action('admin_init');
|
5 |
+
|
6 |
+
if ( ! is_user_logged_in() )
|
7 |
+
die('You must be logged in to access this script.');
|
8 |
+
|
9 |
+
if(!isset($shortcodesXYZEH))
|
10 |
+
$shortcodesXYZEH = new XYZ_Insert_Html_TinyMCESelector();
|
11 |
+
|
12 |
+
global $wpdb;
|
13 |
+
// $ordered_sct = array_keys($shortcode_tags);
|
14 |
+
// sort($ordered_sct);
|
15 |
+
|
16 |
+
$ordered_sct = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE status='1' ORDER BY id DESC" );
|
17 |
+
?>
|
18 |
+
|
19 |
+
(function() {
|
20 |
+
//******* Load plugin specific language pack
|
21 |
+
|
22 |
+
tinymce.create('tinymce.plugins.<?php echo $shortcodesXYZEH->buttonName; ?>', {
|
23 |
+
/**
|
24 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
25 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
26 |
+
* of the editor instance to intercept that event.
|
27 |
+
*
|
28 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
29 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
30 |
+
*/
|
31 |
+
init : function(ed, url) {
|
32 |
+
|
33 |
+
},
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Creates control instances based in the incomming name. This method is normally not
|
37 |
+
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
38 |
+
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
39 |
+
* method can be used to create those.
|
40 |
+
*
|
41 |
+
* @param {String} n Name of the control to create.
|
42 |
+
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
43 |
+
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
44 |
+
*/
|
45 |
+
createControl : function(n, cm) {
|
46 |
+
if(n=='<?php echo $shortcodesXYZEH->buttonName; ?>'){
|
47 |
+
var mlb = cm.createListBox('<?php echo $shortcodesXYZEH->buttonName; ?>List', {
|
48 |
+
title : 'HTML Snippets',
|
49 |
+
onselect : function(v) { //Option value as parameter
|
50 |
+
if(v != ''){
|
51 |
+
if(tinyMCE.activeEditor.selection.getContent() != ''){
|
52 |
+
tinyMCE.activeEditor.selection.setContent('[' + v + ']' + tinyMCE.activeEditor.selection.getContent() + '[/' + v + ']');
|
53 |
+
}
|
54 |
+
else{
|
55 |
+
tinyMCE.activeEditor.selection.setContent('[' + v + ']');
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
});
|
60 |
+
|
61 |
+
// Add some values to the list box
|
62 |
+
<?php foreach($ordered_sct as $sct):?>
|
63 |
+
mlb.add('<?php echo $sct->title;?>', '<?php echo 'xyz-ihs snippet="'.$sct->title.'"';?>');
|
64 |
+
<?php endforeach;?>
|
65 |
+
|
66 |
+
// Return the new listbox instance
|
67 |
+
return mlb;
|
68 |
+
}
|
69 |
+
|
70 |
+
return null;
|
71 |
+
},
|
72 |
+
|
73 |
+
|
74 |
+
});
|
75 |
+
|
76 |
+
// Register plugin
|
77 |
+
tinymce.PluginManager.add('<?php echo $shortcodesXYZEH->buttonName; ?>', tinymce.plugins.<?php echo $shortcodesXYZEH->buttonName; ?>);
|
78 |
+
})();
|
images/activate.png
ADDED
Binary file
|
images/delete.png
ADDED
Binary file
|
images/edit.png
ADDED
Binary file
|
images/logo.png
ADDED
Binary file
|
images/pause.png
ADDED
Binary file
|
insert-html-snippet.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Insert HTML Snippet
|
4 |
+
Plugin URI: http://xyzscripts.com/wordpress-plugins/insert-html-snippet/
|
5 |
+
Description: Add HTML code to your pages and posts easily using shortcodes. This plugin lets you create a shortcode corresponding to any random HTML code such as ad codes, javascript, video embedding, etc. and use the same in your posts, pages or widgets.
|
6 |
+
Version: 1.0
|
7 |
+
Author: xyzscripts.com
|
8 |
+
Author URI: http://xyzscripts.com/
|
9 |
+
Text Domain: insert-html-snippet
|
10 |
+
License: GPLv2 or later
|
11 |
+
*/
|
12 |
+
|
13 |
+
/*
|
14 |
+
This program is free software; you can redistribute it and/or
|
15 |
+
modify it under the terms of the GNU General Public License
|
16 |
+
as published by the Free Software Foundation; either version 2
|
17 |
+
of the License, or (at your option) any later version.
|
18 |
+
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
+
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
along with this program; if not, write to the Free Software
|
26 |
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
27 |
+
*/
|
28 |
+
|
29 |
+
// if ( !function_exists( 'add_action' ) ) {
|
30 |
+
// echo "Hi there! I'm just a plugin, not much I can do when called directly.";
|
31 |
+
// exit;
|
32 |
+
// }
|
33 |
+
|
34 |
+
ob_start();
|
35 |
+
|
36 |
+
// error_reporting(E_ALL);
|
37 |
+
|
38 |
+
define('XYZ_INSERT_HTML_PLUGIN_FILE',__FILE__);
|
39 |
+
|
40 |
+
require( dirname( __FILE__ ) . '/xyz-functions.php' );
|
41 |
+
|
42 |
+
require( dirname( __FILE__ ) . '/add_shortcode_tynimce.php' );
|
43 |
+
|
44 |
+
require( dirname( __FILE__ ) . '/admin/install.php' );
|
45 |
+
|
46 |
+
require( dirname( __FILE__ ) . '/admin/menu.php' );
|
47 |
+
|
48 |
+
require( dirname( __FILE__ ) . '/shortcode-handler.php' );
|
49 |
+
|
50 |
+
require( dirname( __FILE__ ) . '/admin/uninstall.php' );
|
51 |
+
|
52 |
+
require( dirname( __FILE__ ) . '/widget.php' );
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
if(get_option('xyz_credit_link')=="ihs"){
|
57 |
+
|
58 |
+
add_action('wp_footer', 'xyz_ihs_credit');
|
59 |
+
|
60 |
+
}
|
61 |
+
function xyz_ihs_credit() {
|
62 |
+
$content = '<div style="width:100%;text-align:center; font-size:11px; clear:both"><a target="_blank" title="Insert HTML Snippet Wordpress Plugin" href="http://xyzscripts.com/wordpress-plugins/insert-html-snippet/">HTML Snippets</a> Powered By : <a target="_blank" title="PHP Scripts & Programs" href="http://www.xyzscripts.com" >XYZScripts.com</a></div>';
|
63 |
+
echo $content;
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
?>
|
js/notice.js
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
jQuery('#system_notice_area').animate({
|
3 |
+
opacity : 'show',
|
4 |
+
height : 'show'
|
5 |
+
}, 500);
|
6 |
+
|
7 |
+
jQuery('#system_notice_area_dismiss').click(function() {
|
8 |
+
jQuery('#system_notice_area').animate({
|
9 |
+
opacity : 'hide',
|
10 |
+
height : 'hide'
|
11 |
+
}, 500);
|
12 |
+
|
13 |
+
});
|
14 |
+
|
15 |
+
});
|
readme.txt
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Insert Html Snippet ===
|
2 |
+
Contributors: f1logic
|
3 |
+
Donate link: http://xyzscripts.com/donate/
|
4 |
+
|
5 |
+
Tags: insert HTML, add HTML, insert adsense, insert ads, insert addthis code, insert flash , insert javascript, add javascript, insert css, add css, HTML to shortcode, integrate ad codes, raw html, embed html, html inserter, ad inserter, css inserter
|
6 |
+
Requires at least: 2.8
|
7 |
+
Tested up to: 3.5.1
|
8 |
+
Stable tag: 1.0
|
9 |
+
License: GPLv2 or later
|
10 |
+
|
11 |
+
Add HTML, CSS and javascript code to your pages and posts easily using shortcodes.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
A quicklook into Insert Html Snippet
|
16 |
+
|
17 |
+
★ Convert HTML snippets to shortcodes
|
18 |
+
★ Convert Javascript codes to shortcodes
|
19 |
+
★ Convert CSS codes to shortcodes
|
20 |
+
★ Support for snippet shortcodes in widgets
|
21 |
+
★ Dropdown menu in TinyMCE editor to pick snippet shortcodes easily
|
22 |
+
★ Insert adsense or any adcode
|
23 |
+
★ Insert addthis or any social bookmarking code
|
24 |
+
★ Insert flash, videos etc. to your posts,pages and widgets
|
25 |
+
|
26 |
+
= Features in Detail =
|
27 |
+
|
28 |
+
Insert Html Snippet allows you to create shortcodes corresponding to html snippets. You can create a shortcode corresponding to any random HTML code such as ad codes (adsense or any adserver), javascript codes (addthis), video embedding codes, css codes etc. and use the same in your posts, pages or widgets.
|
29 |
+
|
30 |
+
The shortcodes generated using the plugin are easily available as a dropdown in the standard wordpress content editor as well as in widget settings, thereby giving you ease of integrating your HTML snippets with your posts and pages.
|
31 |
+
|
32 |
+
= About =
|
33 |
+
|
34 |
+
Insert Html Snippet is developed and maintained by [XYZScripts](http://xyzscripts.com/ "xyzscripts.com"). For any support, you may [contact us](http://xyzscripts.com/support/ "XYZScripts Support").
|
35 |
+
|
36 |
+
★ [Insert HTML Snippet User Guide](http://docs.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet User Guide")
|
37 |
+
★ [Insert HTML Snippet FAQ](http://kb.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet FAQ")
|
38 |
+
|
39 |
+
== Installation ==
|
40 |
+
|
41 |
+
★ [Insert HTML Snippet User Guide](http://docs.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet User Guide")
|
42 |
+
★ [Insert HTML Snippet FAQ](http://kb.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet FAQ")
|
43 |
+
|
44 |
+
1. Extract `insert-html-snippet.zip` to your `/wp-content/plugins/` directory.
|
45 |
+
2. In the admin panel under plugins activate Insert Html Snippet.
|
46 |
+
|
47 |
+
If you need any further help, you may contact our [support desk](http://xyzscripts.com/support/ "XYZScripts Support").
|
48 |
+
|
49 |
+
== Frequently Asked Questions ==
|
50 |
+
|
51 |
+
★ [Insert HTML Snippet User Guide](http://docs.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet User Guide")
|
52 |
+
★ [Insert HTML Snippet FAQ](http://kb.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet FAQ")
|
53 |
+
|
54 |
+
= 1. The Insert Html Snippet is not working properly. =
|
55 |
+
|
56 |
+
Please check the wordpress version you are using. Make sure it meets the minimum version recommended by us. Make sure all files of the `insert html snippet` plugin uploaded to the folder `wp-content/plugins/`
|
57 |
+
|
58 |
+
= 2. I have 2 html shortcodes placed adjacently, but only one of them works. =
|
59 |
+
|
60 |
+
Please use a whitespace to separate 2 shortcodes.
|
61 |
+
|
62 |
+
More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScripts Support") and we shall get back to you with the answers.
|
63 |
+
|
64 |
+
|
65 |
+
== Screenshots ==
|
66 |
+
|
67 |
+
1. This is the shortcode generator page
|
68 |
+
2. This is page where you can manage all your snippets
|
69 |
+
3. The shortcodes are easily accessible in the content editor
|
70 |
+
|
71 |
+
|
72 |
+
== Changelog ==
|
73 |
+
|
74 |
+
= 1.0 =
|
75 |
+
* First official launch.
|
76 |
+
|
77 |
+
== Upgrade Notice ==
|
78 |
+
NA
|
79 |
+
|
80 |
+
== More Information ==
|
81 |
+
|
82 |
+
★ [Insert HTML Snippet User Guide](http://docs.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet User Guide")
|
83 |
+
★ [Insert HTML Snippet FAQ](http://kb.xyzscripts.com/wordpress-plugins/insert-html-snippet/ "Insert HTML Snippet FAQ")
|
84 |
+
|
85 |
+
= Troubleshooting =
|
86 |
+
|
87 |
+
Please read the FAQ first if you are having problems.
|
88 |
+
|
89 |
+
= Requirements =
|
90 |
+
|
91 |
+
WordPress 3.0+
|
92 |
+
PHP 5+
|
93 |
+
|
94 |
+
= Feedback =
|
95 |
+
|
96 |
+
We would like to receive your feedback and suggestions. You may submit them at our [support desk](http://xyzscripts.com/members/support/ "XYZScripts Support").
|
shortcode-handler.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
global $wpdb;
|
3 |
+
|
4 |
+
// $totalDetails = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE status='1'" );
|
5 |
+
// if(count($totalDetails)>0){
|
6 |
+
// foreach ($totalDetails as $total){
|
7 |
+
add_shortcode('xyz-ihs','xyz_ihs_display_content');
|
8 |
+
// }
|
9 |
+
// }
|
10 |
+
|
11 |
+
function xyz_ihs_display_content($xyz_snippet_name){
|
12 |
+
global $wpdb;
|
13 |
+
|
14 |
+
if(is_array($xyz_snippet_name)){
|
15 |
+
$snippet_name = $xyz_snippet_name['snippet'];
|
16 |
+
|
17 |
+
$query = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE title='$snippet_name'" );
|
18 |
+
|
19 |
+
if(count($query)>0){
|
20 |
+
|
21 |
+
foreach ($query as $sippetdetails){
|
22 |
+
// return stripslashes($sippetdetails->content);
|
23 |
+
if($sippetdetails->status==1)
|
24 |
+
return $sippetdetails->content;
|
25 |
+
else
|
26 |
+
return '';
|
27 |
+
break;
|
28 |
+
}
|
29 |
+
|
30 |
+
}else{
|
31 |
+
|
32 |
+
return "<div style='padding:20px; font-size:16px; color:#FA5A6A; width:93%;text-align:center;background:lightyellow;border:1px solid #3FAFE3; margin:20px 0 20px 0'>
|
33 |
+
|
34 |
+
Please use a valid short code to call snippet.
|
35 |
+
|
36 |
+
|
37 |
+
</div>";
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
add_filter('widget_text', 'do_shortcode');
|
widget.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* XYZScripts Insert HTML Snippet Widget Class
|
4 |
+
*/
|
5 |
+
require( dirname( __FILE__ ) . '../../../../wp-load.php' );
|
6 |
+
|
7 |
+
|
8 |
+
class Xyz_Insert_Html_Widget extends WP_Widget {
|
9 |
+
|
10 |
+
|
11 |
+
/** constructor -- name this the same as the class above */
|
12 |
+
function Xyz_Insert_Html_Widget() {
|
13 |
+
parent::WP_Widget(false, $name = 'Insert Html Snippet');
|
14 |
+
}
|
15 |
+
|
16 |
+
/** @see WP_Widget::widget -- do not rename this */
|
17 |
+
function widget($args, $instance) {
|
18 |
+
extract( $args );
|
19 |
+
global $wpdb;
|
20 |
+
$title = apply_filters('widget_title', $instance['title']);
|
21 |
+
$xyz_ihs_id = $instance['message'];
|
22 |
+
//echo "SELECT content FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE id='$xyz_ihs_title'";die;
|
23 |
+
$entries = $wpdb->get_results( "SELECT content FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE id='$xyz_ihs_id'" );
|
24 |
+
|
25 |
+
$entry = $entries[0];
|
26 |
+
|
27 |
+
echo $before_widget;
|
28 |
+
if ( $title )
|
29 |
+
echo $before_title . $title . $after_title;
|
30 |
+
echo $entry->content;
|
31 |
+
|
32 |
+
echo $after_widget;
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
/** @see WP_Widget::update -- do not rename this */
|
37 |
+
function update($new_instance, $old_instance) {
|
38 |
+
$instance = $old_instance;
|
39 |
+
$instance['title'] = strip_tags($new_instance['title']);
|
40 |
+
$instance['message'] = strip_tags($new_instance['message']);
|
41 |
+
return $instance;
|
42 |
+
}
|
43 |
+
|
44 |
+
/** @see WP_Widget::form -- do not rename this */
|
45 |
+
function form($instance) {
|
46 |
+
global $wpdb;
|
47 |
+
$entries = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ihs_short_code WHERE status='1' ORDER BY id DESC" );
|
48 |
+
|
49 |
+
$title = esc_attr($instance['title']);
|
50 |
+
$message = esc_attr($instance['message']);
|
51 |
+
?>
|
52 |
+
<p>
|
53 |
+
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
|
54 |
+
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
|
55 |
+
</p>
|
56 |
+
<p>
|
57 |
+
<label for="<?php echo $this->get_field_id('message'); ?>"><?php _e('Choose Snippet :'); ?></label>
|
58 |
+
|
59 |
+
<!-- <input class="widefat" id="<?php echo $this->get_field_id('message'); ?>" name="<?php echo $this->get_field_name('message'); ?>" type="text" value="<?php echo $message; ?>" />-->
|
60 |
+
<select name="<?php echo $this->get_field_name('message'); ?>">
|
61 |
+
<?php
|
62 |
+
if( count($entries)>0 ) {
|
63 |
+
$count=1;
|
64 |
+
$class = '';
|
65 |
+
foreach( $entries as $entry ) {
|
66 |
+
?>
|
67 |
+
<option value="<?php echo $entry->id;?>" <?php if($message==$entry->id)echo "selected"; ?>><?php echo $entry->title;?></option>
|
68 |
+
<?php
|
69 |
+
}
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
</select>
|
73 |
+
</p>
|
74 |
+
<?php
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
} // end class Xyz_Insert_Html_Widget
|
79 |
+
add_action('widgets_init', create_function('', 'return register_widget("Xyz_Insert_Html_Widget");'));
|
80 |
+
?>
|
xyz-functions.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!function_exists('xyz_ihs_plugin_get_version'))
|
4 |
+
{
|
5 |
+
function xyz_ihs_plugin_get_version()
|
6 |
+
{
|
7 |
+
if ( ! function_exists( 'get_plugins' ) )
|
8 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
9 |
+
$plugin_folder = get_plugins( '/' . plugin_basename( dirname( XYZ_INSERT_HTML_PLUGIN_FILE ) ) );
|
10 |
+
// print_r($plugin_folder);
|
11 |
+
return $plugin_folder['insert-html-snippet.php']['Version'];
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
if(!function_exists('xyz_trim_deep'))
|
16 |
+
{
|
17 |
+
|
18 |
+
function xyz_trim_deep($value) {
|
19 |
+
if ( is_array($value) ) {
|
20 |
+
$value = array_map('xyz_trim_deep', $value);
|
21 |
+
} elseif ( is_object($value) ) {
|
22 |
+
$vars = get_object_vars( $value );
|
23 |
+
foreach ($vars as $key=>$data) {
|
24 |
+
$value->{$key} = xyz_trim_deep( $data );
|
25 |
+
}
|
26 |
+
} else {
|
27 |
+
$value = trim($value);
|
28 |
+
}
|
29 |
+
|
30 |
+
return $value;
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
|
36 |
+
if(!function_exists('xyz_ihs_links')){
|
37 |
+
function xyz_ihs_links($links, $file) {
|
38 |
+
$base = plugin_basename(XYZ_INSERT_HTML_PLUGIN_FILE);
|
39 |
+
if ($file == $base) {
|
40 |
+
|
41 |
+
$links[] = '<a href="http://xyzscripts.com/support/" class="xyz_support" title="Support"></a>';
|
42 |
+
$links[] = '<a href="http://twitter.com/xyzscripts" class="xyz_twitt" title="Follow us on twitter"></a>';
|
43 |
+
$links[] = '<a href="https://www.facebook.com/xyzscripts" class="xyz_fbook" title="Facebook"></a>';
|
44 |
+
$links[] = '<a href="https://plus.google.com/101215320403235276710/" class="xyz_gplus" title="+1"></a>';
|
45 |
+
}
|
46 |
+
return $links;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
add_filter( 'plugin_row_meta','xyz_ihs_links',10,2);
|
50 |
+
|
51 |
+
?>
|