Version Description
- Compatibility with wordpress 4.3
- Added options to sort snippets in admin area by id and title
- Removed redirection after snippet edit
Download this release
Release Info
Developer | f1logic |
Plugin | Insert PHP Code Snippet |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.2
- admin/footer.php +5 -4
- admin/install.php +13 -0
- admin/settings.php +29 -4
- admin/snippet-add.php +1 -1
- admin/snippet-edit.php +20 -3
- admin/snippets.php +7 -2
- admin/uninstall.php +3 -2
- editor_plugin.js.php +1 -1
- insert-php-code-snippet.php +1 -1
- readme.txt +7 -2
- widget.php +1 -1
- xyz-functions.php +1 -1
admin/footer.php
CHANGED
@@ -9,9 +9,10 @@
|
|
9 |
|
10 |
|
11 |
<a target="_blank" href="http://xyzscripts.com/support/" class="xyz_suggest">Suggestions</a> -
|
12 |
-
<a target="_blank" href="http://facebook.com/xyzscripts" class="xyz_fbook">Like us on
|
13 |
-
<a target="_blank" href="http://twitter.com/xyzscripts" class="xyz_twitt">Follow us on
|
14 |
-
<a target="_blank" href="https://plus.google.com/
|
|
|
15 |
|
16 |
|
17 |
</div>
|
@@ -23,7 +24,7 @@
|
|
23 |
<script language="javascript">
|
24 |
function check_email(emailString)
|
25 |
{
|
26 |
-
var mailPattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,
|
27 |
var matchArray = emailString.match(mailPattern);
|
28 |
if (emailString.length == 0)
|
29 |
return false;
|
9 |
|
10 |
|
11 |
<a target="_blank" href="http://xyzscripts.com/support/" class="xyz_suggest">Suggestions</a> -
|
12 |
+
<a target="_blank" href="http://facebook.com/xyzscripts" class="xyz_fbook">Like us on Facebook</a> -
|
13 |
+
<a target="_blank" href="http://twitter.com/xyzscripts" class="xyz_twitt">Follow us on Twitter</a> -
|
14 |
+
<a target="_blank" href="https://plus.google.com/+Xyzscripts/" class="xyz_gplus">+1 us on Google+</a> -
|
15 |
+
<a target="_blank" href="http://www.linkedin.com/company/xyzscripts" class="xyz_linkedin">Follow us on LinkedIn</a>
|
16 |
|
17 |
|
18 |
</div>
|
24 |
<script language="javascript">
|
25 |
function check_email(emailString)
|
26 |
{
|
27 |
+
var mailPattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,})$/;
|
28 |
var matchArray = emailString.match(mailPattern);
|
29 |
if (emailString.length == 0)
|
30 |
return false;
|
admin/install.php
CHANGED
@@ -26,6 +26,19 @@ function xyz_ips_install(){
|
|
26 |
global $wpdb;
|
27 |
//global $current_user; get_currentuserinfo();
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
if(get_option('xyz_credit_link') == "")
|
31 |
{
|
26 |
global $wpdb;
|
27 |
//global $current_user; get_currentuserinfo();
|
28 |
|
29 |
+
|
30 |
+
if(get_option('xyz_ips_sort_order')=='')
|
31 |
+
{
|
32 |
+
add_option('xyz_ips_sort_order','desc');
|
33 |
+
}
|
34 |
+
if(get_option('xyz_ips_sort_field_name')=='')
|
35 |
+
{
|
36 |
+
add_option('xyz_ips_sort_field_name','id');
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
|
43 |
if(get_option('xyz_credit_link') == "")
|
44 |
{
|
admin/settings.php
CHANGED
@@ -13,11 +13,18 @@ if($_POST){
|
|
13 |
if($xyz_ips_limit==0)$xyz_ips_limit=20;
|
14 |
|
15 |
$xyz_ips_credit = $_POST['xyz_ips_credit'];
|
16 |
-
|
|
|
|
|
17 |
|
18 |
update_option('xyz_ips_limit',$xyz_ips_limit);
|
19 |
update_option('xyz_credit_link',$xyz_ips_credit);
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
21 |
?>
|
22 |
|
23 |
<div class="system_notice_area_style1" id="system_notice_area">
|
@@ -37,7 +44,25 @@ if($_POST){
|
|
37 |
<fieldset style=" width:100%; border:1px solid #F7F7F7; padding:10px 0px 15px 10px;">
|
38 |
<legend ><h3>Settings</h3></legend>
|
39 |
<table class="widefat" style="width:99%;">
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
<td scope="row" ><label for="xyz_ips_credit">Credit link to author</label>
|
42 |
</td>
|
43 |
<td><select name="xyz_ips_credit" id="xyz_ips_credit">
|
@@ -70,4 +95,4 @@ if($_POST){
|
|
70 |
</div>
|
71 |
|
72 |
</form>
|
73 |
-
</div>
|
13 |
if($xyz_ips_limit==0)$xyz_ips_limit=20;
|
14 |
|
15 |
$xyz_ips_credit = $_POST['xyz_ips_credit'];
|
16 |
+
|
17 |
+
$xyz_ips_sortfield=$_POST['xyz_ips_sort_by_field'];
|
18 |
+
$xyz_ips_sortorder=$_POST['xyz_ips_sort_by_order'];
|
19 |
|
20 |
update_option('xyz_ips_limit',$xyz_ips_limit);
|
21 |
update_option('xyz_credit_link',$xyz_ips_credit);
|
22 |
+
|
23 |
+
|
24 |
+
update_option('xyz_ips_sort_field_name',$xyz_ips_sortfield);
|
25 |
+
update_option('xyz_ips_sort_order',$xyz_ips_sortorder);
|
26 |
+
|
27 |
+
|
28 |
?>
|
29 |
|
30 |
<div class="system_notice_area_style1" id="system_notice_area">
|
44 |
<fieldset style=" width:100%; border:1px solid #F7F7F7; padding:10px 0px 15px 10px;">
|
45 |
<legend ><h3>Settings</h3></legend>
|
46 |
<table class="widefat" style="width:99%;">
|
47 |
+
|
48 |
+
<tr valign="top">
|
49 |
+
<td scope="row" ><label for="xyz_ihs_sort">Sorting of snippets</label>
|
50 |
+
</td>
|
51 |
+
|
52 |
+
|
53 |
+
<td>
|
54 |
+
<select id="xyz_ips_sort_by_field" name="xyz_ips_sort_by_field" >
|
55 |
+
<option value="id" <?php if(isset($_POST['xyz_ips_sort_by_field']) && $_POST['xyz_ips_sort_by_field']=='id'){echo 'selected';} else if(get_option('xyz_ips_sort_field_name')=="id"){echo 'selected';} ?>>Based on create time</option>
|
56 |
+
<option value="title" <?php if(isset($_POST['xyz_ips_sort_by_field']) && $_POST['xyz_ips_sort_by_field']=='title'){ echo 'selected';}else if(get_option('xyz_ips_sort_field_name')=="title"){echo 'selected';} ?>>Based on name</option>
|
57 |
+
</select>
|
58 |
+
<select id="xyz_ips_sort_by_order" name="xyz_ips_sort_by_order" >
|
59 |
+
<option value="desc" <?php if(isset($_POST['xyz_ips_sort_by_order']) && $_POST['xyz_ips_sort_by_order']=='desc'){echo 'selected';} else if(get_option('xyz_ips_sort_order')=="desc"){echo 'selected';} ?>>Descending</option>
|
60 |
+
<option value="asc" <?php if(isset($_POST['xyz_ips_sort_by_order']) && $_POST['xyz_ips_sort_by_order']=='asc'){ echo 'selected';}else if(get_option('xyz_ips_sort_order')=="asc"){echo 'selected';} ?>>Ascending</option>
|
61 |
+
</select>
|
62 |
+
|
63 |
+
</td>
|
64 |
+
</tr>
|
65 |
+
<tr valign="top">
|
66 |
<td scope="row" ><label for="xyz_ips_credit">Credit link to author</label>
|
67 |
</td>
|
68 |
<td><select name="xyz_ips_credit" id="xyz_ips_credit">
|
95 |
</div>
|
96 |
|
97 |
</form>
|
98 |
+
</div>
|
admin/snippet-add.php
CHANGED
@@ -22,7 +22,7 @@ if(isset($_POST) && isset($_POST['addSubmit'])){
|
|
22 |
if($xyz_ips_title != "" && $xyz_ips_content != ""){
|
23 |
if(ctype_alnum($temp_xyz_ips_title)){
|
24 |
|
25 |
-
$snippet_count = $wpdb->query( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE title
|
26 |
if($snippet_count == 0){
|
27 |
$xyz_shortCode = '[xyz-ips snippet="'.$xyz_ips_title.'"]';
|
28 |
$wpdb->insert($wpdb->prefix.'xyz_ips_short_code', array('title' =>$xyz_ips_title,'content'=>$xyz_ips_content,'short_code'=>$xyz_shortCode,'status'=>'1'),array('%s','%s','%s','%d'));
|
22 |
if($xyz_ips_title != "" && $xyz_ips_content != ""){
|
23 |
if(ctype_alnum($temp_xyz_ips_title)){
|
24 |
|
25 |
+
$snippet_count = $wpdb->query($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ips_short_code WHERE title=%s',$xyz_ips_title) ) ;
|
26 |
if($snippet_count == 0){
|
27 |
$xyz_shortCode = '[xyz-ips snippet="'.$xyz_ips_title.'"]';
|
28 |
$wpdb->insert($wpdb->prefix.'xyz_ips_short_code', array('title' =>$xyz_ips_title,'content'=>$xyz_ips_content,'short_code'=>$xyz_shortCode,'status'=>'1'),array('%s','%s','%s','%d'));
|
admin/snippet-edit.php
CHANGED
@@ -6,6 +6,21 @@ get_currentuserinfo();
|
|
6 |
|
7 |
$xyz_ips_snippetId = $_GET['snippetId'];
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
if(isset($_POST) && isset($_POST['updateSubmit'])){
|
10 |
|
11 |
// echo '<pre>';
|
@@ -19,7 +34,7 @@ if(isset($_POST) && isset($_POST['updateSubmit'])){
|
|
19 |
$temp_xyz_ips_title = str_replace('-', '', $temp_xyz_ips_title);
|
20 |
$xyz_ips_title = str_replace(' ', '-', $_POST['snippetTitle']);
|
21 |
$xyz_ips_content = $_POST['snippetContent'];
|
22 |
-
|
23 |
if($xyz_ips_title != "" && $xyz_ips_content != ""){
|
24 |
|
25 |
if(ctype_alnum($temp_xyz_ips_title))
|
@@ -31,8 +46,10 @@ if(isset($_POST) && isset($_POST['updateSubmit'])){
|
|
31 |
|
32 |
$wpdb->update($wpdb->prefix.'xyz_ips_short_code', array('title'=>$xyz_ips_title,'content'=>$xyz_ips_content,'short_code'=>$xyz_shortCode,), array('id'=>$xyz_ips_snippetId));
|
33 |
|
34 |
-
header("Location:".admin_url('admin.php?page=insert-php-code-snippet-manage&
|
35 |
-
|
|
|
|
|
36 |
}else{
|
37 |
?>
|
38 |
<div class="system_notice_area_style0" id="system_notice_area">
|
6 |
|
7 |
$xyz_ips_snippetId = $_GET['snippetId'];
|
8 |
|
9 |
+
$xyz_ips_message='';
|
10 |
+
if(isset($_GET['xyz_ips_msg'])){
|
11 |
+
$xyz_ips_message = $_GET['xyz_ips_msg'];
|
12 |
+
}
|
13 |
+
if($xyz_ips_message == 1){
|
14 |
+
|
15 |
+
?>
|
16 |
+
<div class="system_notice_area_style1" id="system_notice_area">
|
17 |
+
PHP Snippet updated successfully. <span id="system_notice_area_dismiss">Dismiss</span>
|
18 |
+
</div>
|
19 |
+
|
20 |
+
<?php
|
21 |
+
|
22 |
+
|
23 |
+
}
|
24 |
if(isset($_POST) && isset($_POST['updateSubmit'])){
|
25 |
|
26 |
// echo '<pre>';
|
34 |
$temp_xyz_ips_title = str_replace('-', '', $temp_xyz_ips_title);
|
35 |
$xyz_ips_title = str_replace(' ', '-', $_POST['snippetTitle']);
|
36 |
$xyz_ips_content = $_POST['snippetContent'];
|
37 |
+
|
38 |
if($xyz_ips_title != "" && $xyz_ips_content != ""){
|
39 |
|
40 |
if(ctype_alnum($temp_xyz_ips_title))
|
46 |
|
47 |
$wpdb->update($wpdb->prefix.'xyz_ips_short_code', array('title'=>$xyz_ips_title,'content'=>$xyz_ips_content,'short_code'=>$xyz_shortCode,), array('id'=>$xyz_ips_snippetId));
|
48 |
|
49 |
+
header("Location:".admin_url('admin.php?page=insert-php-code-snippet-manage&action=snippet-edit&snippetId='.$xyz_ips_snippetId.'&xyz_ips_msg=1'));
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
}else{
|
54 |
?>
|
55 |
<div class="system_notice_area_style0" id="system_notice_area">
|
admin/snippets.php
CHANGED
@@ -70,9 +70,14 @@ id="system_notice_area_dismiss">Dismiss</span>
|
|
70 |
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
|
71 |
$limit = get_option('xyz_ips_limit');
|
72 |
$offset = ( $pagenum - 1 ) * $limit;
|
|
|
|
|
|
|
|
|
73 |
|
74 |
-
|
75 |
-
|
|
|
76 |
|
77 |
?>
|
78 |
<input id="submit_ips"
|
70 |
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
|
71 |
$limit = get_option('xyz_ips_limit');
|
72 |
$offset = ( $pagenum - 1 ) * $limit;
|
73 |
+
|
74 |
+
|
75 |
+
$field=get_option('xyz_ips_sort_field_name');
|
76 |
+
$order=get_option('xyz_ips_sort_order');
|
77 |
|
78 |
+
$entries = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."xyz_ips_short_code ORDER BY $field $order LIMIT $offset,$limit" );
|
79 |
+
|
80 |
+
|
81 |
|
82 |
?>
|
83 |
<input id="submit_ips"
|
admin/uninstall.php
CHANGED
@@ -23,7 +23,8 @@ function xyz_ips_network_uninstall($networkwide) {
|
|
23 |
function xyz_ips_uninstall(){
|
24 |
|
25 |
global $wpdb;
|
26 |
-
|
|
|
27 |
delete_option("xyz_ips_limit");
|
28 |
|
29 |
/* table delete*/
|
@@ -33,4 +34,4 @@ $wpdb->query("DROP TABLE ".$wpdb->prefix."xyz_ips_short_code");
|
|
33 |
}
|
34 |
|
35 |
register_uninstall_hook( XYZ_INSERT_PHP_PLUGIN_FILE, 'xyz_ips_network_uninstall' );
|
36 |
-
?>
|
23 |
function xyz_ips_uninstall(){
|
24 |
|
25 |
global $wpdb;
|
26 |
+
delete_option("xyz_ips_sort_order");
|
27 |
+
delete_option("xyz_ips_sort_field_name");
|
28 |
delete_option("xyz_ips_limit");
|
29 |
|
30 |
/* table delete*/
|
34 |
}
|
35 |
|
36 |
register_uninstall_hook( XYZ_INSERT_PHP_PLUGIN_FILE, 'xyz_ips_network_uninstall' );
|
37 |
+
?>
|
editor_plugin.js.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
if ( ! is_user_logged_in() )
|
4 |
die('You must be logged in to access this script.');
|
5 |
|
1 |
<?php
|
2 |
+
header( 'Content-Type: text/javascript' );
|
3 |
if ( ! is_user_logged_in() )
|
4 |
die('You must be logged in to access this script.');
|
5 |
|
insert-php-code-snippet.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Insert PHP Code Snippet
|
4 |
Plugin URI: http://xyzscripts.com/wordpress-plugins/insert-php-code-snippet/
|
5 |
Description: Insert and run PHP code in your pages and posts easily using shortcodes. This plugin lets you create a shortcode corresponding to any random PHP code and use the same in your posts, pages or widgets.
|
6 |
-
Version: 1.
|
7 |
Author: xyzscripts.com
|
8 |
Author URI: http://xyzscripts.com/
|
9 |
Text Domain: insert-php-code-snippet
|
3 |
Plugin Name: Insert PHP Code Snippet
|
4 |
Plugin URI: http://xyzscripts.com/wordpress-plugins/insert-php-code-snippet/
|
5 |
Description: Insert and run PHP code in your pages and posts easily using shortcodes. This plugin lets you create a shortcode corresponding to any random PHP code and use the same in your posts, pages or widgets.
|
6 |
+
Version: 1.2
|
7 |
Author: xyzscripts.com
|
8 |
Author URI: http://xyzscripts.com/
|
9 |
Text Domain: insert-php-code-snippet
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Donate link: http://xyzscripts.com/donate/
|
|
4 |
|
5 |
Tags: insert PHP, add PHP, insert PHP code, insert PHP tag, insert PHP snippet, insert PHP code snippet , insert PHP snippet, add PHP code, insert PHP tag, add PHP snippet, add PHP code snippet, integrate PHP codes, raw PHP, embed PHP, PHP inserter, PHP code inserter, PHP snippet inserter
|
6 |
Requires at least: 2.8
|
7 |
-
Tested up to: 4.
|
8 |
-
Stable tag: 1.
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
Add PHP code to your pages and posts easily using shortcodes.
|
@@ -67,6 +67,11 @@ More questions ? [Drop a mail](http://xyzscripts.com/members/support/ "XYZScript
|
|
67 |
|
68 |
== Changelog ==
|
69 |
|
|
|
|
|
|
|
|
|
|
|
70 |
= 1.1 =
|
71 |
* Snippet chooser TinyMCE plugin modified
|
72 |
* Compatibility with wordpress 3.9
|
4 |
|
5 |
Tags: insert PHP, add PHP, insert PHP code, insert PHP tag, insert PHP snippet, insert PHP code snippet , insert PHP snippet, add PHP code, insert PHP tag, add PHP snippet, add PHP code snippet, integrate PHP codes, raw PHP, embed PHP, PHP inserter, PHP code inserter, PHP snippet inserter
|
6 |
Requires at least: 2.8
|
7 |
+
Tested up to: 4.3
|
8 |
+
Stable tag: 1.2
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
Add PHP code to your pages and posts easily using shortcodes.
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 1.2 =
|
71 |
+
* Compatibility with wordpress 4.3
|
72 |
+
* Added options to sort snippets in admin area by id and title
|
73 |
+
* Removed redirection after snippet edit
|
74 |
+
|
75 |
= 1.1 =
|
76 |
* Snippet chooser TinyMCE plugin modified
|
77 |
* Compatibility with wordpress 3.9
|
widget.php
CHANGED
@@ -11,7 +11,7 @@ class Xyz_Insert_Php_Widget extends WP_Widget {
|
|
11 |
|
12 |
/** constructor -- name this the same as the class above */
|
13 |
function Xyz_Insert_Php_Widget() {
|
14 |
-
parent::
|
15 |
}
|
16 |
|
17 |
/** @see WP_Widget::widget -- do not rename this */
|
11 |
|
12 |
/** constructor -- name this the same as the class above */
|
13 |
function Xyz_Insert_Php_Widget() {
|
14 |
+
parent::__construct(false, $name = 'Insert PHP Snippet');
|
15 |
}
|
16 |
|
17 |
/** @see WP_Widget::widget -- do not rename this */
|
xyz-functions.php
CHANGED
@@ -41,7 +41,7 @@ function xyz_ips_links($links, $file) {
|
|
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="Like us on Facebook"></a>';
|
44 |
-
$links[] = '<a href="https://plus.google.com/
|
45 |
$links[] = '<a href="http://www.linkedin.com/company/xyzscripts" class="xyz_linkedin" title="Follow us on LinkedIn"></a>';
|
46 |
}
|
47 |
return $links;
|
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="Like us on Facebook"></a>';
|
44 |
+
$links[] = '<a href="https://plus.google.com/+Xyzscripts/" class="xyz_gplus" title="+1 us on Google+"></a>';
|
45 |
$links[] = '<a href="http://www.linkedin.com/company/xyzscripts" class="xyz_linkedin" title="Follow us on LinkedIn"></a>';
|
46 |
}
|
47 |
return $links;
|