Changeset 1155546
- Timestamp:
- 05/07/2015 05:10:41 PM (11 years ago)
- Location:
- dobsondev-shortcodes
- Files:
-
- 12 added
- 2 deleted
- 3 edited
- 5 copied
-
tags/1.1.3 (copied) (copied from dobsondev-shortcodes/trunk)
-
tags/1.1.3/changelog.txt (copied) (copied from dobsondev-shortcodes/trunk/changelog.txt) (2 diffs)
-
tags/1.1.3/css (added)
-
tags/1.1.3/css/dobsondev-shortcodes.css (added)
-
tags/1.1.3/css/dobsondev-shortcodes.min.css (added)
-
tags/1.1.3/dobsondev-shortcodes.php (copied) (copied from dobsondev-shortcodes/trunk/dobsondev-shortcodes.php) (5 diffs)
-
tags/1.1.3/js (added)
-
tags/1.1.3/js/dobsondev-shortcodes.js (added)
-
tags/1.1.3/js/dobsondev-shortcodes.min.js (added)
-
tags/1.1.3/libs (copied) (copied from dobsondev-shortcodes/trunk/libs)
-
tags/1.1.3/readme.txt (copied) (copied from dobsondev-shortcodes/trunk/readme.txt) (5 diffs)
-
trunk/changelog.txt (modified) (2 diffs)
-
trunk/css (added)
-
trunk/css/dobsondev-shortcodes.css (added)
-
trunk/css/dobsondev-shortcodes.min.css (added)
-
trunk/dobsondev-shortcodes.css (deleted)
-
trunk/dobsondev-shortcodes.js (deleted)
-
trunk/dobsondev-shortcodes.php (modified) (5 diffs)
-
trunk/js (added)
-
trunk/js/dobsondev-shortcodes.js (added)
-
trunk/js/dobsondev-shortcodes.min.js (added)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dobsondev-shortcodes/tags/1.1.3/changelog.txt
r1131367 r1155546 5 5 * Added shortcode for displaying GitHub repository README.md files (1.1.0) 6 6 * Added shortcode for displaying GitHub repository file contents (1.1.1) 7 * Added Transient Cache support for the GitHub README and File shortcodes (1.1.3) 7 8 8 9 Bug Fixes … … 12 13 * Changed some documentation errors (1.1.1) 13 14 * Fixed a return error in the GitHub README and GitHub File Contents shortcodes (1.1.2) 15 * Minified the CSS and JS scripts (1.1.3) 16 14 17 15 18 = 1.0 = -
dobsondev-shortcodes/tags/1.1.3/dobsondev-shortcodes.php
r1131367 r1155546 4 4 * Plugin URI: http://dobsondev.com/portfolio/dobsondev-shortcodes/ 5 5 * Description: A collection of helpful shortcodes. 6 * Version: 1.1. 26 * Version: 1.1.3 7 7 * Author: Alex Dobson 8 8 * Author URI: http://dobsondev.com/ … … 28 28 /* Define our text domain for the plugin */ 29 29 define( 'DOBSONDEV_SHRTCODE_TEXTDOMAIN', 'dobsondev-shortcodes' ); 30 /* Define our version number for the plugin */ 31 define( 'DOBSONDEV_SHRTCODE_VER', '1.1.2' ); 32 30 33 31 34 /* Include Parsedown for Markdown Conversion */ … … 35 38 /* Enqueue the Style Sheet */ 36 39 function dobsondev_shrtcode_enqueue_scripts() { 37 wp_enqueue_style( 'dobsondev-shortcodes', plugins_url( ' dobsondev-shortcodes.css' , __FILE__ ) );40 wp_enqueue_style( 'dobsondev-shortcodes', plugins_url( 'css/dobsondev-shortcodes.min.css' , __FILE__ ) ); 38 41 wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css' ); 39 wp_enqueue_script( 'dobsondev-shortcodes-js', plugins_url( ' dobsondev-shortcodes.js', __FILE__ ), array( 'jquery' ) );42 wp_enqueue_script( 'dobsondev-shortcodes-js', plugins_url( 'js/dobsondev-shortcodes.min.js', __FILE__ ), array( 'jquery' ) ); 40 43 } 41 44 add_action( 'wp_enqueue_scripts', 'dobsondev_shrtcode_enqueue_scripts' ); … … 92 95 'owner' => "NULL", 93 96 'repo' => "NULL", 97 'cache_id' => "NULL", 94 98 ), $atts)); 95 99 if ($owner == "NULL" || $repo == "NULL") { 96 100 return '<p> Please Enter a Owner and Repo for the embedGitHubReadme ShortCode. </p>'; 97 101 } else { 98 $curl = curl_init(); 99 curl_setopt_array($curl, array( 100 CURLOPT_RETURNTRANSFER => 1, 101 CURLOPT_URL => 'https://api.github.com/repos/' . $owner . '/' . $repo . '/readme', 102 CURLOPT_USERAGENT => $repo, 103 CURLOPT_HEADER => false 104 )); 105 $response = curl_exec($curl); 106 // var_dump($response); 107 $response_array = json_decode($response); 108 // var_dump($response_array); 109 $parsedown = new Parsedown(); 110 return $parsedown->text(base64_decode($response_array->content)); 102 // check to see if we have a cached transient stored 103 if ( false === ( $readme_transient = get_transient( 'dobdev-t1-' . $cache_id ) ) ) { 104 // we do not have a transient stored so we have to make the API call 105 $curl = curl_init(); 106 curl_setopt_array($curl, array( 107 CURLOPT_RETURNTRANSFER => 1, 108 CURLOPT_URL => 'https://api.github.com/repos/' . $owner . '/' . $repo . '/readme', 109 CURLOPT_USERAGENT => $repo, 110 CURLOPT_HEADER => false 111 )); 112 $response = curl_exec($curl); 113 // var_dump($response); 114 $response_array = json_decode($response); 115 // var_dump($response_array); 116 $parsedown = new Parsedown(); 117 $output_readme = $parsedown->text(base64_decode($response_array->content)); 118 if ( $cache_id !== "NULL" ) { 119 // set the transient so we can use it later for faster loading times 120 // var_dump('DOBSONDEV T1 TRANSIENT SET | ID = ' . $cache_id); 121 set_transient( 'dobdev-t1-' . $cache_id, $output_readme, DAY_IN_SECONDS ); 122 } 123 return $output_readme; 124 } 125 // the transient was found so we will use it 126 // var_dump('DOBSONDEV T1 TRANSIENT USED | ID = ' . $cache_id); 127 return $readme_transient; 111 128 } 112 129 } … … 121 138 'path' => "NULL", 122 139 'markdown' => "no", 140 'cache_id' => "NULL", 123 141 ), $atts)); 124 142 if ($owner == "NULL" || $repo == "NULL" || $path == "NULL") { 125 143 return '<p> Please Enter a Owner, Repo and Path for the embedGitHubReadme ShortCode. </p>'; 126 144 } else { 127 $curl = curl_init(); 128 curl_setopt_array($curl, array( 129 CURLOPT_RETURNTRANSFER => 1, 130 CURLOPT_URL => 'https://api.github.com/repos/' . $owner . '/' . $repo . '/contents/' . $path, 131 CURLOPT_USERAGENT => $repo, 132 CURLOPT_HEADER => false 133 )); 134 $response = curl_exec($curl); 135 // var_dump($response); 136 $response_array = json_decode($response); 137 // var_dump($response_array); 138 if (strcasecmp($markdown, "yes") == 0) { 139 $parsedown = new Parsedown(); 140 return $parsedown->text(base64_decode($response_array->content)); 141 } else { 142 return base64_decode($response_array->content); 145 // check to see if we have a cached transient stored 146 if ( false === ( $githubfile_transient = get_transient( 'dobdev-t2-' . $cache_id ) ) ) { 147 // we do not have a transient stored so we have to make the API call 148 $curl = curl_init(); 149 curl_setopt_array($curl, array( 150 CURLOPT_RETURNTRANSFER => 1, 151 CURLOPT_URL => 'https://api.github.com/repos/' . $owner . '/' . $repo . '/contents/' . $path, 152 CURLOPT_USERAGENT => $repo, 153 CURLOPT_HEADER => false 154 )); 155 $response = curl_exec($curl); 156 // var_dump($response); 157 $response_array = json_decode($response); 158 // var_dump($response_array); 159 if (strcasecmp($markdown, "yes") == 0) { 160 $parsedown = new Parsedown(); 161 $output_md_file = $parsedown->text(base64_decode($response_array->content)); 162 if ( $cache_id !== "NULL" ) { 163 // set the transient if the cache_id is set so we can use it later for faster loading time 164 // var_dump('DOBSONDEV T2 TRANSIENT SET | ID = ' . $cache_id); 165 set_transient( 'dobdev-t2-' . $cache_id, $output_md_file, DAY_IN_SECONDS ); 166 } 167 return $output_md_file; 168 } else { 169 $output_file = base64_decode($response_array->content); 170 if ( $cache_id !== "NULL" ) { 171 // set the transient if the cache_id is set so we can use it later for faster loading time 172 // var_dump('DOBSONDEV T2 TRANSIENT SET | ID = ' . $cache_id); 173 set_transient( 'dobdev-t2-' . $cache_id, $output_file, DAY_IN_SECONDS ); 174 } 175 return $output_file; 176 } 143 177 } 178 // the transient was found so we will use it 179 // var_dump('DOBSONDEV T2 TRANSIENT USED | ID = ' . $cache_id); 180 return $githubfile_transient; 144 181 } 145 182 } -
dobsondev-shortcodes/tags/1.1.3/readme.txt
r1139363 r1155546 7 7 Requires at least: 2.5 8 8 Tested up to: 4.2 9 Stable tag: 1.1. 29 Stable tag: 1.1.3 10 10 11 11 Add a collection of helpful shortcodes to your site. … … 48 48 **Embed GitHub Repo Readme** 49 49 50 [embedGitHubReadme owner="Owner_of_Repo" repo="Repo_Name" ]50 [embedGitHubReadme owner="Owner_of_Repo" repo="Repo_Name" cache_id="id"] 51 51 52 52 This shortcode will display the contents of any GitHub repository's README file. The markdown will displayed as HTML output onto the page. This shortcode uses GitHub API calls to ensure that as you update you README file the output from this shortcode will also update. … … 54 54 The style will match that of your default page style, but if you want to change the style just wrap the shortcode inside of a div and then edit as much as the style as you want. 55 55 56 If you want to take advantage of WordPress' transient API for caching, simply enter an ID for the cache_id argument. Note that this ID can be anything other than "NULL", it doesn't necessarily have to be a number. Once entered this will cause the shortcode to cache the results of the API call for 24 hours. This means the shortcode will use those cached results and speed up the load times for 24 hours, at which point it will then call the API again to get any updates and use those cached results for another 24 hours. 57 56 58 **Embed GitHub Repo File Contents** 57 59 58 [embedGitHubContent owner="Owner_of_Repo" repo="Repo_Name" path="Path_to_File" markdown="Yes/No" ]60 [embedGitHubContent owner="Owner_of_Repo" repo="Repo_Name" path="Path_to_File" markdown="Yes/No" cache_id="id"] 59 61 60 62 This shortcode will display the contents of a file from any GitHub repository. You must include the Owner of the repository, the repository name and the path to the file. Optionally, if the file is a markdown file you can put markdown="yes" and the plugin will output the markdown as HTML onto the page. If you give the shortcode a path to a folder rather than to a file it will output an array of the folders contents. 63 64 If you want to take advantage of WordPress' transient API for caching, simply enter an ID for the cache_id argument. Note that this ID can be anything other than "NULL", it doesn't necessarily have to be a number. Once entered this will cause the shortcode to cache the results of the API call for 24 hours. This means the shortcode will use those cached results and speed up the load times for 24 hours, at which point it will then call the API again to get any updates and use those cached results for another 24 hours. 61 65 62 66 **Embed Twitch Stream** … … 153 157 * Added shortcode for displaying GitHub repository README.md files (1.1.0) 154 158 * Added shortcode for displaying GitHub repository file contents (1.1.1) 159 * Added Transient Cache support for the GitHub README and File shortcodes (1.1.3) 155 160 156 161 Bug Fixes … … 160 165 * Changed some documentation errors (1.1.1) 161 166 * Fixed a return error in the GitHub README and GitHub File Contents shortcodes (1.1.2) 167 * Minified the CSS and JS scripts (1.1.3) 162 168 163 169 = - 1.0 - = -
dobsondev-shortcodes/trunk/changelog.txt
r1131367 r1155546 5 5 * Added shortcode for displaying GitHub repository README.md files (1.1.0) 6 6 * Added shortcode for displaying GitHub repository file contents (1.1.1) 7 * Added Transient Cache support for the GitHub README and File shortcodes (1.1.3) 7 8 8 9 Bug Fixes … … 12 13 * Changed some documentation errors (1.1.1) 13 14 * Fixed a return error in the GitHub README and GitHub File Contents shortcodes (1.1.2) 15 * Minified the CSS and JS scripts (1.1.3) 16 14 17 15 18 = 1.0 = -
dobsondev-shortcodes/trunk/dobsondev-shortcodes.php
r1131367 r1155546 4 4 * Plugin URI: http://dobsondev.com/portfolio/dobsondev-shortcodes/ 5 5 * Description: A collection of helpful shortcodes. 6 * Version: 1.1. 26 * Version: 1.1.3 7 7 * Author: Alex Dobson 8 8 * Author URI: http://dobsondev.com/ … … 28 28 /* Define our text domain for the plugin */ 29 29 define( 'DOBSONDEV_SHRTCODE_TEXTDOMAIN', 'dobsondev-shortcodes' ); 30 /* Define our version number for the plugin */ 31 define( 'DOBSONDEV_SHRTCODE_VER', '1.1.2' ); 32 30 33 31 34 /* Include Parsedown for Markdown Conversion */ … … 35 38 /* Enqueue the Style Sheet */ 36 39 function dobsondev_shrtcode_enqueue_scripts() { 37 wp_enqueue_style( 'dobsondev-shortcodes', plugins_url( ' dobsondev-shortcodes.css' , __FILE__ ) );40 wp_enqueue_style( 'dobsondev-shortcodes', plugins_url( 'css/dobsondev-shortcodes.min.css' , __FILE__ ) ); 38 41 wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css' ); 39 wp_enqueue_script( 'dobsondev-shortcodes-js', plugins_url( ' dobsondev-shortcodes.js', __FILE__ ), array( 'jquery' ) );42 wp_enqueue_script( 'dobsondev-shortcodes-js', plugins_url( 'js/dobsondev-shortcodes.min.js', __FILE__ ), array( 'jquery' ) ); 40 43 } 41 44 add_action( 'wp_enqueue_scripts', 'dobsondev_shrtcode_enqueue_scripts' ); … … 92 95 'owner' => "NULL", 93 96 'repo' => "NULL", 97 'cache_id' => "NULL", 94 98 ), $atts)); 95 99 if ($owner == "NULL" || $repo == "NULL") { 96 100 return '<p> Please Enter a Owner and Repo for the embedGitHubReadme ShortCode. </p>'; 97 101 } else { 98 $curl = curl_init(); 99 curl_setopt_array($curl, array( 100 CURLOPT_RETURNTRANSFER => 1, 101 CURLOPT_URL => 'https://api.github.com/repos/' . $owner . '/' . $repo . '/readme', 102 CURLOPT_USERAGENT => $repo, 103 CURLOPT_HEADER => false 104 )); 105 $response = curl_exec($curl); 106 // var_dump($response); 107 $response_array = json_decode($response); 108 // var_dump($response_array); 109 $parsedown = new Parsedown(); 110 return $parsedown->text(base64_decode($response_array->content)); 102 // check to see if we have a cached transient stored 103 if ( false === ( $readme_transient = get_transient( 'dobdev-t1-' . $cache_id ) ) ) { 104 // we do not have a transient stored so we have to make the API call 105 $curl = curl_init(); 106 curl_setopt_array($curl, array( 107 CURLOPT_RETURNTRANSFER => 1, 108 CURLOPT_URL => 'https://api.github.com/repos/' . $owner . '/' . $repo . '/readme', 109 CURLOPT_USERAGENT => $repo, 110 CURLOPT_HEADER => false 111 )); 112 $response = curl_exec($curl); 113 // var_dump($response); 114 $response_array = json_decode($response); 115 // var_dump($response_array); 116 $parsedown = new Parsedown(); 117 $output_readme = $parsedown->text(base64_decode($response_array->content)); 118 if ( $cache_id !== "NULL" ) { 119 // set the transient so we can use it later for faster loading times 120 // var_dump('DOBSONDEV T1 TRANSIENT SET | ID = ' . $cache_id); 121 set_transient( 'dobdev-t1-' . $cache_id, $output_readme, DAY_IN_SECONDS ); 122 } 123 return $output_readme; 124 } 125 // the transient was found so we will use it 126 // var_dump('DOBSONDEV T1 TRANSIENT USED | ID = ' . $cache_id); 127 return $readme_transient; 111 128 } 112 129 } … … 121 138 'path' => "NULL", 122 139 'markdown' => "no", 140 'cache_id' => "NULL", 123 141 ), $atts)); 124 142 if ($owner == "NULL" || $repo == "NULL" || $path == "NULL") { 125 143 return '<p> Please Enter a Owner, Repo and Path for the embedGitHubReadme ShortCode. </p>'; 126 144 } else { 127 $curl = curl_init(); 128 curl_setopt_array($curl, array( 129 CURLOPT_RETURNTRANSFER => 1, 130 CURLOPT_URL => 'https://api.github.com/repos/' . $owner . '/' . $repo . '/contents/' . $path, 131 CURLOPT_USERAGENT => $repo, 132 CURLOPT_HEADER => false 133 )); 134 $response = curl_exec($curl); 135 // var_dump($response); 136 $response_array = json_decode($response); 137 // var_dump($response_array); 138 if (strcasecmp($markdown, "yes") == 0) { 139 $parsedown = new Parsedown(); 140 return $parsedown->text(base64_decode($response_array->content)); 141 } else { 142 return base64_decode($response_array->content); 145 // check to see if we have a cached transient stored 146 if ( false === ( $githubfile_transient = get_transient( 'dobdev-t2-' . $cache_id ) ) ) { 147 // we do not have a transient stored so we have to make the API call 148 $curl = curl_init(); 149 curl_setopt_array($curl, array( 150 CURLOPT_RETURNTRANSFER => 1, 151 CURLOPT_URL => 'https://api.github.com/repos/' . $owner . '/' . $repo . '/contents/' . $path, 152 CURLOPT_USERAGENT => $repo, 153 CURLOPT_HEADER => false 154 )); 155 $response = curl_exec($curl); 156 // var_dump($response); 157 $response_array = json_decode($response); 158 // var_dump($response_array); 159 if (strcasecmp($markdown, "yes") == 0) { 160 $parsedown = new Parsedown(); 161 $output_md_file = $parsedown->text(base64_decode($response_array->content)); 162 if ( $cache_id !== "NULL" ) { 163 // set the transient if the cache_id is set so we can use it later for faster loading time 164 // var_dump('DOBSONDEV T2 TRANSIENT SET | ID = ' . $cache_id); 165 set_transient( 'dobdev-t2-' . $cache_id, $output_md_file, DAY_IN_SECONDS ); 166 } 167 return $output_md_file; 168 } else { 169 $output_file = base64_decode($response_array->content); 170 if ( $cache_id !== "NULL" ) { 171 // set the transient if the cache_id is set so we can use it later for faster loading time 172 // var_dump('DOBSONDEV T2 TRANSIENT SET | ID = ' . $cache_id); 173 set_transient( 'dobdev-t2-' . $cache_id, $output_file, DAY_IN_SECONDS ); 174 } 175 return $output_file; 176 } 143 177 } 178 // the transient was found so we will use it 179 // var_dump('DOBSONDEV T2 TRANSIENT USED | ID = ' . $cache_id); 180 return $githubfile_transient; 144 181 } 145 182 } -
dobsondev-shortcodes/trunk/readme.txt
r1139363 r1155546 7 7 Requires at least: 2.5 8 8 Tested up to: 4.2 9 Stable tag: 1.1. 29 Stable tag: 1.1.3 10 10 11 11 Add a collection of helpful shortcodes to your site. … … 48 48 **Embed GitHub Repo Readme** 49 49 50 [embedGitHubReadme owner="Owner_of_Repo" repo="Repo_Name" ]50 [embedGitHubReadme owner="Owner_of_Repo" repo="Repo_Name" cache_id="id"] 51 51 52 52 This shortcode will display the contents of any GitHub repository's README file. The markdown will displayed as HTML output onto the page. This shortcode uses GitHub API calls to ensure that as you update you README file the output from this shortcode will also update. … … 54 54 The style will match that of your default page style, but if you want to change the style just wrap the shortcode inside of a div and then edit as much as the style as you want. 55 55 56 If you want to take advantage of WordPress' transient API for caching, simply enter an ID for the cache_id argument. Note that this ID can be anything other than "NULL", it doesn't necessarily have to be a number. Once entered this will cause the shortcode to cache the results of the API call for 24 hours. This means the shortcode will use those cached results and speed up the load times for 24 hours, at which point it will then call the API again to get any updates and use those cached results for another 24 hours. 57 56 58 **Embed GitHub Repo File Contents** 57 59 58 [embedGitHubContent owner="Owner_of_Repo" repo="Repo_Name" path="Path_to_File" markdown="Yes/No" ]60 [embedGitHubContent owner="Owner_of_Repo" repo="Repo_Name" path="Path_to_File" markdown="Yes/No" cache_id="id"] 59 61 60 62 This shortcode will display the contents of a file from any GitHub repository. You must include the Owner of the repository, the repository name and the path to the file. Optionally, if the file is a markdown file you can put markdown="yes" and the plugin will output the markdown as HTML onto the page. If you give the shortcode a path to a folder rather than to a file it will output an array of the folders contents. 63 64 If you want to take advantage of WordPress' transient API for caching, simply enter an ID for the cache_id argument. Note that this ID can be anything other than "NULL", it doesn't necessarily have to be a number. Once entered this will cause the shortcode to cache the results of the API call for 24 hours. This means the shortcode will use those cached results and speed up the load times for 24 hours, at which point it will then call the API again to get any updates and use those cached results for another 24 hours. 61 65 62 66 **Embed Twitch Stream** … … 153 157 * Added shortcode for displaying GitHub repository README.md files (1.1.0) 154 158 * Added shortcode for displaying GitHub repository file contents (1.1.1) 159 * Added Transient Cache support for the GitHub README and File shortcodes (1.1.3) 155 160 156 161 Bug Fixes … … 160 165 * Changed some documentation errors (1.1.1) 161 166 * Fixed a return error in the GitHub README and GitHub File Contents shortcodes (1.1.2) 167 * Minified the CSS and JS scripts (1.1.3) 162 168 163 169 = - 1.0 - =
Note: See TracChangeset
for help on using the changeset viewer.