Changeset 705496
- Timestamp:
- 04/29/2013 04:01:48 PM (13 years ago)
- Location:
- wp-livephp/trunk
- Files:
-
- 4 edited
-
readme.txt (modified) (7 diffs)
-
wp-live-monitor.php (modified) (9 diffs)
-
wp-live.js (modified) (1 diff)
-
wp-live.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-livephp/trunk/readme.txt
r639180 r705496 12 12 13 13 This plugin was written to make Wordpress theme and plugin developers' life easier. 14 Inspired by the brilliant live.js script (written by Martin Kool), 15 this plugin will auto refresh your browser if you change any files in your wp-content/themes 14 Inspired by the brilliant live.js script (written by Martin Kool), 15 this plugin will auto refresh your browser if you change any files in your wp-content/themes 16 16 or plugins directories. No need for Alt-Tab and manual refresh anymore. 17 17 18 If you activate the WP Live Php plugin, it adds a small javascript file to your blog. 19 It will monitor your directories by calling wp-live.php every second. If any file changed 18 If you activate the WP Live Php plugin, it adds a small javascript file to your blog. 19 It will monitor your directories by calling wp-live.php every second. If any file changed 20 20 (i.e. has a newer filemtime), the browser will be refreshed. 21 21 22 With this plugin, it is also very easy to check your work in many browsers simultaneously. 22 With this plugin, it is also very easy to check your work in many browsers simultaneously. 23 23 Just enable Frontend Monitoring, load the site in all your browsers and the rest goes automatically. 24 24 … … 27 27 28 28 Since v1.5 with the content update feature, you can auto-update your browser with every post or page save. 29 For this we create a file in the uploads base folder (wp-content/uploads/), and touch it with every save, 29 For this we create a file in the uploads base folder (wp-content/uploads/), and touch it with every save, 30 30 which will trigger a refresh in the client browser. That location must be writable for this to work. 31 31 … … 35 35 == Installation == 36 36 37 Upload the WP Live.php plugin to your blog and Activate it. 37 Upload the WP Live.php plugin to your blog and Activate it. 38 38 39 39 If you want to use the content updates, make sure that the uploads base folder (wp-content/uploads/) is … … 47 47 48 48 == Changelog == 49 = 1.6 = 50 * Refresh CSS files without reloading the page. 49 51 = 1.5 = 50 52 * Awesome new feature: content updates! … … 55 57 * File state cache clearing added 56 58 = 1.4 = 57 * Switched to long polling. Now the js will open only one long ajax request every 2 minutes (or as long as the php script is allowed to run). 58 = 1.3.1 = 59 * Switched to long polling. Now the js will open only one long ajax request every 2 minutes (or as long as the php script is allowed to run). 60 = 1.3.1 = 59 61 * No new features, only some refactoring and code cleaning 60 62 = 1.3 = 61 63 * Admin bar integration 62 = 1.2.1 = 64 = 1.2.1 = 63 65 * No cache fix for IE 64 = 1.2 = 66 = 1.2 = 65 67 * Added Backend (wp-admin) monitoring option 66 68 * Settings page improvements - Ajax controls … … 70 72 * Added settings page (Settings/WP Live.php) to enable / disable the monitoring function 71 73 * Some code cleanup 72 * Updated for WP 3.3 74 * Updated for WP 3.3 73 75 = 1.0 = 74 76 * Initial version … … 77 79 = 1.5 = 78 80 Awesome new feature: content updates! 79 = 1.2.1 = 81 = 1.2.1 = 80 82 Update to 1.2.1 if you plan to use this plugin on Internet Explorer 81 83 = 1.2 = -
wp-livephp/trunk/wp-live-monitor.php
r639173 r705496 5 5 * @link http://bencemeszaros.com 6 6 * @link http://wordpress.org/extend/plugins/wp-livephp/ 7 * @version 1. 57 * @version 1.6 8 8 */ 9 9 … … 20 20 /** ignore these files or directories */ 21 21 protected $ignore = array(); 22 22 23 23 /** default time limit in seconds */ 24 24 protected $timeLimit = 125; 25 25 26 /** Refresh css files without reloading the page */ 27 protected $cssOnTheFly = true; 28 26 29 /** the time to die */ 27 30 protected $deadLine; … … 39 42 40 43 $this->headers(); 41 $this->setDeadLine(); 44 $this->setDeadLine(); 42 45 $this->main($start); 43 46 } … … 48 51 } 49 52 } 50 53 51 54 /** 52 55 * Output the no-cache headers … … 65 68 // in safe mode there is no way to set the time limit 66 69 if (!ini_get('safe_mode')) 67 { 68 set_time_limit($this->timeLimit); 69 } 70 { 71 set_time_limit($this->timeLimit); 72 } 70 73 // lets check what the actual limit is 71 74 $limit = ini_get('max_execution_time'); 72 75 73 76 if (empty($limit) || $limit < 1) 74 77 { … … 86 89 protected function main($start) 87 90 { 88 // clear file state cache89 clearstatcache();91 // clear file state cache 92 clearstatcache(); 90 93 // long polling loop 91 94 do … … 94 97 foreach ($this->dirs as $root) 95 98 { 96 if ($this->checkDir(realpath($root), $start)) 99 $result = $this->checkDir(realpath($root), $start); 100 if ($result) 97 101 { 98 102 // if we find modified files in any of the directories, we can skip the rest 99 echo '1';103 echo json_encode($result); 100 104 101 105 die; 102 106 } 103 107 } 104 108 105 109 sleep(1); 106 110 } … … 141 145 if ($mtime && $start < $mtime) 142 146 { 147 $pinfo = pathinfo($file); 143 148 // return true at the first positive match 144 return true; 149 if ($this->cssOnTheFly && $pinfo['extension'] == 'css') { 150 // if the file is a css then then we send the whole path back 151 return $mtime * 1000; 152 } 153 else { 154 // otherwise return true 155 return true; 156 } 145 157 } 146 158 } … … 156 168 157 169 new LiveMonitor(); 158 170 159 171 160 172 } // end class check if -
wp-livephp/trunk/wp-live.js
r639173 r705496 1 1 /** 2 * Live.php 2 * Live.php 3 3 * @author Bence Meszaros 4 4 * @link http://bencemeszaros.com 5 5 * @link http://wordpress.org/extend/plugins/wp-livephp/ 6 * @version 1. 56 * @version 1.6 7 7 */ 8 8 -
wp-livephp/trunk/wp-live.php
r639173 r705496 7 7 Author URI: http://bencemeszaros.com 8 8 Plugin URI: http://wordpress.org/extend/plugins/wp-livephp/ 9 Version: 1. 59 Version: 1.6 10 10 License: GPL2 11 11 */ … … 31 31 { 32 32 protected $contentCheckFile = 'wp-live-contentcheck.txt'; 33 33 34 34 /** options array */ 35 35 protected $options = array(); … … 220 220 221 221 /** 222 * Content check file updater 222 * Content check file updater 223 223 * This is called at the save_post hook, to trigger a refresh at every post/page save 224 224 */ 225 public function touchContentCheckFile() 225 public function touchContentCheckFile() 226 226 { 227 227 touch($this->contentCheckFile); 228 228 } 229 229 230 230 /** 231 231 * Ajax handler … … 252 252 echo 'Error: Unable to create content check file at<br>' . $this->contentCheckFile; 253 253 } 254 } 254 } 255 255 else { 256 256 // remove the file … … 314 314 if(options) { 315 315 jQuery.extend(settings, options); 316 } 316 } 317 317 // create the switch 318 318 return this.each(function() {
Note: See TracChangeset
for help on using the changeset viewer.