Changeset 1215794
- Timestamp:
- 08/08/2015 01:19:46 PM (11 years ago)
- Location:
- insert-script/trunk
- Files:
-
- 2 edited
-
insert-script.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
insert-script/trunk/insert-script.php
r1197008 r1215794 3 3 /** 4 4 * @package Insert_Script 5 * @version 1. 15 * @version 1.3 6 6 */ 7 7 /* 8 8 Plugin Name: Insert Script 9 9 Plugin URI: http://belchamber.us/wordpress/plugins/insert-script.zip 10 Description: With the [insert_script] shortcode, this calls on the absolute path of any script from the path you provide with the "path=" attribute. 10 Description: With the [insert_script] shortcode, this calls on the absolute path of any script from the path you provide with the "path=" attribute. Now allows "vals" and "strings" as GET URL attribute, 11 "json_string" for properly encoded JSON string arrays will return $json_vals_arr to your script, and passes on "save_db" and "section" as $save_db and $section variables to whatever values you assign them to your external scripts. 11 12 Author: Aaron Belchamber 12 Version: 1. 113 Version: 1.3 13 14 Author URI: http://www.belchamber.us 14 15 */ … … 43 44 44 45 function shortcode($atts){ 45 extract(shortcode_atts(array("path" => '',"vars"=>''), $atts)); 46 /* 47 * Dynamically include file from path 48 * 49 * $path String 50 * example [insert_script path='/resources/main.php'] (paths start at public_html) 51 * 52 * $strings Uses PHP parse_str function -- look it up 53 * 54 */ 55 46 56 ob_start(); 47 include($_SERVER['DOCUMENT_ROOT'].$path); 48 return ob_get_clean(); 57 58 extract(shortcode_atts(array('path' => '','vals'=>'','strings' => '','save_db' => '','section'=>'','json_string'=>''), $atts)); 59 $path=html_entity_decode(trim($path)); 60 $strings=html_entity_decode(trim($strings)); 61 $vals=html_entity_decode(trim($vals)); 62 $save_db=html_entity_decode(trim($save_db)); 63 $section=html_entity_decode(trim($section)); 64 65 $json_string=html_entity_decode(trim($json_string)); 66 $json_vals_arr=json_decode($json_string,true); 67 68 if ($strings!=''){ 69 parse_str($strings);// Assign strings before including file to parse to inject values 70 } 71 72 if ($vals!=''){ 73 parse_str($vals); 74 } 75 76 if ($path!=''){ 77 @include($_SERVER['DOCUMENT_ROOT'].$path); 78 } 79 80 $html=ob_get_clean(); 81 return $html; 49 82 } 50 83 -
insert-script/trunk/readme.txt
r1197011 r1215794 4 4 Tags: insert,shortcode,insert script,php 5 5 Requires at least: 3.0.1 6 Tested up to: 4. 2.26 Tested up to: 4.3 7 7 Stable tag: /trunk/ 8 8 License: GPLv2 or later … … 14 14 With the [insert_script] shortcode, this calls on the absolute path of any script from the path you provide with the "path=" attribute. 15 15 It can also pass along declared variables from a "vars=" attribute where you can define GET values in URL safe declarations -- whatever 16 the script you are calling on requires. This allows a level of back-end integration with code, processes, and data outside of Wordpress. 16 the script you are calling on requires. 17 18 Now allows "vals" and "strings" you define with GET URL attribute (var1=value1&var2=value2). 19 Also pass JSON Array via "json_string" for properly encoded JSON string arrays which will pass array $json_vals_arr to your script, and passes on "save_db" and "section" as $save_db and $section variables to whatever values you assign them to your external scripts. 20 This allows a level of back-end integration with code, processes, and data outside of Wordpress. 17 21 18 22 … … 29 33 == Changelog == 30 34 31 No changes made in past two years and still works with every version of Wordpress to date. 35 1.3 Added new variables and ability to declare scalable "json_string" which will pass $json_vals_arr JSON array to your script too. 36 37 1.1 No changes made in past two years and still works with every version of Wordpress to date.
Note: See TracChangeset
for help on using the changeset viewer.