Plugin Directory

Changeset 509532


Ignore:
Timestamp:
02/23/2012 09:49:51 PM (14 years ago)
Author:
brainstormmedia
Message:
  • Fix saved CSS being one update behind
  • Fix initial values of fields & background color picker
  • Fix preview update stall
  • Fix background value when no image selected
  • Fix background replacement matching
Location:
styles/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • styles/trunk/classes/StormStylesAdmin.php

    r508741 r509532  
    470470
    471471        // Update vars in active file object
    472         $this->file->set( $input['variables'] );
    473         // Convert input array to object for storage
    474         $input['variables'] = $this->file;
    475        
    476         return $input['variables'];
     472        if ( is_array( $input ) ) {
     473            $this->file->set( $input['variables'] );
     474            // Convert input array to object for storage
     475            $input['variables'] = $this->file;
     476
     477            return $input['variables'];
     478        }else {
     479            return false;
     480        }
     481       
    477482    }
    478483   
     
    567572            // Uses $this->update() sanitation callback
    568573            update_option('StormStyles', $_POST );
     574        }else {
     575            $this->build();
    569576        }
    570577
  • styles/trunk/classes/WordPressBridge.php

    r508741 r509532  
    210210       
    211211        // Remove -wp- prefix
    212         $meta['property'] = str_replace('-wp-background', 'background', $prop).';';
     212        $meta['property'] = trim(str_replace('-wp-background', 'background', $prop), ';').';';
     213       
    213214        return $this->background($value, $scaffold, $meta);
    214215    }
     
    216217    public function background($value, $scaffold, $meta) {
    217218        extract( $this->extract($value) );
     219       
    218220        if ( ($match = $this->find_linear_gradient( $value ))  ) {
    219221            return $this->linear_gradient($match);
     
    231233        }
    232234       
     235        if ( false !== strpos($meta['property'], 'url(#)') ) {
     236            return '';
     237        }
     238
    233239        return $meta['property'];
    234240    }
     
    393399    private function extract($value, $id = '') {
    394400
    395         if ( false !== strpos( $value, $this->meta_gliph ) ) {
     401        $glyphpos = strpos( $value, $this->meta_gliph );
     402
     403        if ( false !== $glyphpos && $value[$glyphpos-1] !== ':' ) { // Catch http:// when glyph == //
    396404            $meta = substr($value, strrpos($value, $this->meta_gliph) + strlen($this->meta_gliph) );
    397405            $value = substr($value, 0, strrpos($value, $this->meta_gliph));
  • styles/trunk/classes/stormFirePHP/stormFirePHP.php

    r508741 r509532  
    11<?php
    22
    3 if ( !class_exists('FirePHP') ) {
     3if ( !class_exists('FirePHP') && !function_exists('stormFirePHPShutdown') ) {
     4    function stormFirePHPShutdown() {
     5        $error=error_get_last();
     6       if($error=null) FB::log($error['message'], 'Fatal Error '.basename($error['file']).':'.$error['line']);
     7    }
     8   
    49    ob_start();
    510    include dirname(__FILE__).'/FirePHPCore/fb.php';
     11
     12    if ( false !== strpos($_SERVER['DOCUMENT_ROOT'], '/Users/') || BSM_DEVELOPMENT === true ) {
     13        // Development
     14        error_reporting(E_ALL & ~E_NOTICE );
     15
     16        $firePHP = FirePHP::getInstance(true);
     17        $firePHP->registerErrorHandler();
     18        $firePHP->registerExceptionHandler();
     19
     20        register_shutdown_function('stormFirePHPShutdown');
     21    }else {
     22        FB::setEnabled(false);
     23    }
     24
    625}
    7 
    8 if ( false !== strpos($_SERVER['DOCUMENT_ROOT'], '/Users/') || WP_DEBUG === true || BSM_DEVELOPMENT === true ) {
    9     // Development
    10     error_reporting(E_ALL & ~E_NOTICE );
    11    
    12     $firePHP = FirePHP::getInstance(true);
    13     $firePHP->registerErrorHandler();
    14     $firePHP->registerExceptionHandler();
    15    
    16     register_shutdown_function('stormFirePHPShutdown');
    17 }else {
    18     FB::setEnabled(false);
    19 }
    20 
    21 function stormFirePHPShutdown() {
    22     $error=error_get_last();
    23    if($error=null) FB::log($error['message'], 'Fatal Error '.basename($error['file']).':'.$error['line']);
    24 }
  • styles/trunk/gui/Color.php

    r508741 r509532  
    4141   
    4242    function output() {
    43         // Change color picker to http://www.digitalmagicpro.com/jPicker/
    4443        ?>
    4544        <input class="pds_color_input" type="text" name="<?php echo $this->form_name ?>[color]" id="<?php echo $this->form_id ?>" value="<?php echo $this->value('form', 'color'); ?>" size="8" maxlength="8" />
  • styles/trunk/js/admin.js

    r508741 r509532  
    207207                setColor($color, hex);
    208208            },
    209             flat: true
     209            flat: true,
     210            color: 'ff0000'
    210211        };
    211212           
     
    338339        var load_color = function() {
    339340           
     341            var colorVal = $color.val().replace('#', '');
     342           
    340343            // Update color field value
    341             if ( $color.val().length > 1 ) {
    342                 $color.data('color',  $color.val().replace('#', '') );
    343                 $color.data('ahex',  $color.val().replace('#', '') );
     344            if ( colorVal.length > 1 ) {
     345                $color.data('color',  colorVal );
     346                $color.data('ahex',  colorVal );
    344347            }else {
    345348                $color.data('ahex',  'ffffffff' );
    346349            }
    347             $css.val( $color.val() ).change();
    348            
    349             var colorPicker = $('<div/>').ColorPicker( colorPickerOpts );
     350            $css.val( $color.val() ).change(); // Keeps #
     351           
     352            var tmpColorPickerOpts = $.extend( colorPickerOpts, { color: colorVal });
     353           
     354            var colorPicker = $('<div/>').ColorPicker( tmpColorPickerOpts );
    350355           
    351356            $ui.append( colorPicker );
  • styles/trunk/readme.txt

    r508741 r509532  
    77Requires at least: 3.1
    88Tested up to: 3.3.1
    9 Stable tag: 0.4.0
     9Stable tag: 0.4.1
    1010
    1111Change the appearance of supported themes using zero code. Creates appearance options for images, colors, gradients, and fonts.
     
    2121* Google Fonts
    2222* Font size, color, styling, and capitalization
     23* Live preview
    2324
    2425The plugin includes full support for TwentyTen and TwentyEleven out of the box. Just enable the plugin, and you can start playing with your site's look under Appearance > Styles.
    2526
    26 For experienced developers, other themes can be integrated using only CSS. A full theme GUI can be created in less than an hour by those familiar with CSS syntax. An example of how fast this process is can be seen in the video below.
     27Here's a quick demo of how it works in TwentyEleven:
    2728
    28 [youtube http://www.youtube.com/watch?v=-Iw8d0g_ltQ]
     29[youtube http://www.youtube.com/watch?v=2gbRFFxx1GY]
    2930
    3031**Warning**: While we have spent a lot of time testing and using Styles, it is still experimental! We may add or remove features or change syntax in future updates. This plugin requires [PHP 5.2](https://codex.wordpress.org/Switching_to_PHP5), which is the minimum supported version as of WordPress 3.2.
     
    7071== Changelog ==
    7172
     73= 0.4.1 =
     74* Fix saved CSS being one update behind
     75* Fix initial values of fields & background color picker
     76* Fix preview update stall
     77* Fix background value when no image selected
     78* Fix background replacement matching
     79
    7280= 0.4.0 =
    7381* Initial public release.
  • styles/trunk/styles.php

    r508741 r509532  
    33Plugin Name: Styles
    44Plugin URI: http://stylesplugin.com
    5 Description: Change the appearance of any theme using the WordPress admin. Creates WordPress theme options from CSS: images, colors, gradients, and fonts.
    6 Version: 0.4
     5Description: Change the appearance of your theme using the WordPress admin. Creates WordPress theme options for images, colors, gradients, and fonts.
     6Version: 0.4.1
    77Author: Brainstorm Media
    88Author URI: http://brainstormmedia.com
     
    5757     * @var int
    5858     **/
    59     var $version = '0.4';
     59    var $version = '0.4.1';
    6060   
    6161    /**
     
    414414     **/
    415415    function load_file() {
    416         if ( false !== $this->file ) { return; }
    417        
    418416        global $blog_id;
    419417
     
    434432
    435433            $this->css = new StormCSSParser( $file['path'], $this );
    436            
    437             $this->file   = new StormStyles_Extension_Variable( $file, $this );
    438            
    439         }else if ( BSM_DEVELOPMENT === true ){
     434
     435            if ( !isset($_GET['scaffold']) ) {
     436                // No need to init vars if we're just outputting
     437                $this->file   = new StormStyles_Extension_Variable( $file, $this );
     438
     439                // Merge values from database into variable objects
     440                if ( @is_object( $this->options['variables'] ) && is_object($this->file) ) {
     441                    $this->file->set( $this->options['variables']->get() );
     442                }
     443            }
     444        }
     445       
     446        if ( false !== $this->file ) { return; }
     447
     448        if ( BSM_DEVELOPMENT === true ){
    440449           
    441450            // Development: Force re-render on every CSS load
Note: See TracChangeset for help on using the changeset viewer.