Changeset 854464
- Timestamp:
- 02/09/2014 11:54:08 PM (12 years ago)
- Location:
- laravel-paste-embed/trunk
- Files:
-
- 2 edited
-
laravel-paste-embed.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
laravel-paste-embed/trunk/laravel-paste-embed.php
r825729 r854464 2 2 /** 3 3 * @package LaravePasteEmbed 4 * @version 1. 2.14 * @version 1.4 5 5 */ 6 6 /* 7 7 Plugin Name: Laravel Paste Embed 8 Plugin URI: http://www.ryandurham.com/ 2013/04/06/laravel-paste-embed/9 Description: A plugin to embed pages & snippets from paste.laravel.cominto a wordpress site.8 Plugin URI: http://www.ryandurham.com/projects/laravel-paste-embed/ 9 Description: A plugin to embed pages & snippets from laravel.io/bin into a wordpress site. 10 10 Author: Ryan Durham 11 Version: 1. 312 Author URI: http:// rydurham.com11 Version: 1.4 12 Author URI: http://www.ryandurham.com/projects 13 13 License: GPL2 14 14 15 Thanks to Dayle Rees & co. for the styles: http://paste.laravel.com/css/style.css 15 Thanks to Dayle Rees & co. for the styles: http://paste.laravel.com/css/style.css (link no longer works) 16 16 17 17 Thanks to Taylor Dewey (@tddewey) for the advice! … … 50 50 51 51 //Pull data from paste.laravel.com 52 $url = esc_url("http:// paste.laravel.com/$paste");53 $response = wp_remote_get($url );52 $url = esc_url("http://laravel.io/bin/$paste"); 53 $response = wp_remote_get($url, array('timeout' => 30)); 54 54 $response_code = wp_remote_retrieve_response_code( $response ); 55 55 56 56 if ( $response_code != '200' ) { 57 $error_message = "Paste Error: " . $response['response']['message']; 58 return $error_message; 57 $error = $response->get_error_code(); 58 $message = "<b>Paste Bin Error:</b> " . $response->get_error_message($error); 59 60 return $message; 59 61 } else { 60 62 //Parse the body of the response to pull out the relevant content. 61 63 $dom = new DOMDocument(); 62 $html = $dom->loadHTML( wp_remote_retrieve_body( $response ) ); 63 $code = $dom->getElementsByTagName( 'code' )->item( 0 )->nodeValue; 64 libxml_use_internal_errors(true); 65 $html = @$dom->loadHTML( wp_remote_retrieve_body( $response ) ); 66 67 $code = $dom->getElementsByTagName( 'pre' )->item( 0 )->nodeValue; 64 68 65 69 //Capture the paste output in an object buffer. … … 69 73 echo "<div class=\"lpe_title\">$caption</div>"; 70 74 } 71 echo "<div class=\"lpe_link\"><a href=\"$url\" target=\"_blank\"> link</a> </div>";75 echo "<div class=\"lpe_link\"><a href=\"$url\" target=\"_blank\">bin/$paste</a> </div>"; 72 76 echo "<pre class=\"prettyprint linenums \" style=\"height: $height;\">"; 73 77 echo htmlentities($code); -
laravel-paste-embed/trunk/readme.txt
r825729 r854464 1 1 === Laravel-Paste-Embed === 2 2 Contributors: rydurham 3 Donate link: http://www.ryandurham.com/ category/code/4 Tags: Laravel Paste3 Donate link: http://www.ryandurham.com/projects 4 Tags: Laravel, Laravel.io, Paste, Bin 5 5 Requires at least: 3.3 6 Tested up to: 3. 67 Stable tag: 1. 36 Tested up to: 3.8.1 7 Stable tag: 1.4 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 A WordPress plugin for embedding text from paste.laravel.com.11 A WordPress plugin for embedding text from laravel.io/bin. 12 12 13 13 == Description == 14 14 15 A Wordpress plugin to embed code from paste.laravel.com.15 A Wordpress plugin to embed code from laravel.io/bin 16 16 17 17 == Installation == … … 19 19 1. Upload the `laravel-paste-embed` folder to the `/wp-content/plugins/` directory 20 20 2. Activate the plugin through the 'Plugins' menu in WordPress 21 3. Go to paste.laravel.comand create the paste you are going to embed in your page or post.22 4. Grab the identifying bit from the end of the URL. ' cJ9' in this case: http://paste.laravel.com/cJ923 5. In your page or post add this shortcode, with the relevant part of the URL in question: [lpe paste=' cJ9']21 3. Go to laravel.io/bin and create the paste you are going to embed in your page or post. 22 4. Grab the identifying bit from the end of the URL. 'Q6a' in this case: http://laravel.io/bin/Q6a 23 5. In your page or post add this shortcode, with the relevant part of the URL in question: [lpe paste='Q6a'] 24 24 25 25
Note: See TracChangeset
for help on using the changeset viewer.