Plugin Directory

Changeset 705496


Ignore:
Timestamp:
04/29/2013 04:01:48 PM (13 years ago)
Author:
mbence
Message:

v1.6 Refresh CSS without reloading the page

Location:
wp-livephp/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-livephp/trunk/readme.txt

    r639180 r705496  
    1212
    1313This 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 
     14Inspired by the brilliant live.js script (written by Martin Kool),
     15this plugin will auto refresh your browser if you change any files in your wp-content/themes
    1616or plugins directories. No need for Alt-Tab and manual refresh anymore.
    1717
    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 
     18If you activate the WP Live Php plugin, it adds a small javascript file to your blog.
     19It will monitor your directories by calling wp-live.php every second. If any file changed
    2020(i.e. has a newer filemtime), the browser will be refreshed.
    2121
    22 With this plugin, it is also very easy to check your work in many browsers simultaneously. 
     22With this plugin, it is also very easy to check your work in many browsers simultaneously.
    2323Just enable Frontend Monitoring, load the site in all your browsers and the rest goes automatically.
    2424
     
    2727
    2828Since 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, 
     29For this we create a file in the uploads base folder (wp-content/uploads/), and touch it with every save,
    3030which will trigger a refresh in the client browser. That location must be writable for this to work.
    3131
     
    3535== Installation ==
    3636
    37 Upload the WP Live.php plugin to your blog and Activate it. 
     37Upload the WP Live.php plugin to your blog and Activate it.
    3838
    3939If you want to use the content updates, make sure that the uploads base folder (wp-content/uploads/) is
     
    4747
    4848== Changelog ==
     49= 1.6 =
     50* Refresh CSS files without reloading the page.
    4951= 1.5 =
    5052* Awesome new feature: content updates!
     
    5557* File state cache clearing added
    5658= 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 =
    5961* No new features, only some refactoring and code cleaning
    6062= 1.3 =
    6163* Admin bar integration
    62 = 1.2.1 = 
     64= 1.2.1 =
    6365* No cache fix for IE
    64 = 1.2 = 
     66= 1.2 =
    6567* Added Backend (wp-admin) monitoring option
    6668* Settings page improvements - Ajax controls
     
    7072* Added settings page (Settings/WP Live.php) to enable / disable the  monitoring function
    7173* Some code cleanup
    72 * Updated for WP 3.3 
     74* Updated for WP 3.3
    7375= 1.0 =
    7476* Initial version
     
    7779= 1.5 =
    7880Awesome new feature: content updates!
    79 = 1.2.1 = 
     81= 1.2.1 =
    8082Update to 1.2.1 if you plan to use this plugin on Internet Explorer
    8183= 1.2 =
  • wp-livephp/trunk/wp-live-monitor.php

    r639173 r705496  
    55 * @link http://bencemeszaros.com
    66 * @link http://wordpress.org/extend/plugins/wp-livephp/
    7  * @version 1.5
     7 * @version 1.6
    88 */
    99
     
    2020        /** ignore these files or directories */
    2121        protected $ignore = array();
    22        
     22
    2323        /** default time limit in seconds */
    2424        protected $timeLimit = 125;
    25        
     25
     26        /** Refresh css files without reloading the page */
     27        protected $cssOnTheFly = true;
     28
    2629        /** the time to die */
    2730        protected $deadLine;
     
    3942
    4043                $this->headers();
    41                 $this->setDeadLine();               
     44                $this->setDeadLine();
    4245                $this->main($start);
    4346            }
     
    4851            }
    4952        }
    50        
     53
    5154        /**
    5255         * Output the no-cache headers
     
    6568            // in safe mode there is no way to set the time limit
    6669            if (!ini_get('safe_mode'))
    67             { 
    68                 set_time_limit($this->timeLimit); 
    69             }       
     70            {
     71                set_time_limit($this->timeLimit);
     72            }
    7073            // lets check what the actual limit is
    7174            $limit = ini_get('max_execution_time');
    72            
     75
    7376            if (empty($limit) || $limit < 1)
    7477            {
     
    8689        protected function main($start)
    8790        {
    88             // clear file state cache
    89             clearstatcache();
     91            // clear file state cache
     92            clearstatcache();
    9093            // long polling loop
    9194            do
     
    9497                foreach ($this->dirs as $root)
    9598                {
    96                     if ($this->checkDir(realpath($root), $start))
     99                    $result = $this->checkDir(realpath($root), $start);
     100                    if ($result)
    97101                    {
    98102                        // if we find modified files in any of the directories, we can skip the rest
    99                         echo '1';
     103                        echo json_encode($result);
    100104
    101105                        die;
    102106                    }
    103107                }
    104                
     108
    105109                sleep(1);
    106110            }
     
    141145                                if ($mtime && $start < $mtime)
    142146                                {
     147                                    $pinfo = pathinfo($file);
    143148                                    // 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                                    }
    145157                                }
    146158                            }
     
    156168
    157169    new LiveMonitor();
    158    
     170
    159171
    160172} // end class check if
  • wp-livephp/trunk/wp-live.js

    r639173 r705496  
    11/**
    2  * Live.php 
     2 * Live.php
    33 * @author Bence Meszaros
    44 * @link http://bencemeszaros.com
    55 * @link http://wordpress.org/extend/plugins/wp-livephp/
    6  * @version 1.5
     6 * @version 1.6
    77 */
    88
  • wp-livephp/trunk/wp-live.php

    r639173 r705496  
    77  Author URI: http://bencemeszaros.com
    88  Plugin URI: http://wordpress.org/extend/plugins/wp-livephp/
    9   Version: 1.5
     9  Version: 1.6
    1010  License: GPL2
    1111 */
     
    3131    {
    3232        protected $contentCheckFile = 'wp-live-contentcheck.txt';
    33        
     33
    3434        /** options array */
    3535        protected $options = array();
     
    220220
    221221        /**
    222          * Content check file updater 
     222         * Content check file updater
    223223         * This is called at the save_post hook, to trigger a refresh at every post/page save
    224224         */
    225         public function touchContentCheckFile() 
     225        public function touchContentCheckFile()
    226226        {
    227227            touch($this->contentCheckFile);
    228228        }
    229        
     229
    230230        /**
    231231         * Ajax handler
     
    252252                                echo 'Error: Unable to create content check file at<br>' . $this->contentCheckFile;
    253253                            }
    254                         }   
     254                        }
    255255                        else {
    256256                            // remove the file
     
    314314            if(options) {
    315315                jQuery.extend(settings, options);
    316             }     
     316            }
    317317            // create the switch
    318318            return this.each(function() {
Note: See TracChangeset for help on using the changeset viewer.