Plugin Directory

Changeset 627884


Ignore:
Timestamp:
11/20/2012 08:53:37 PM (13 years ago)
Author:
PeterHudec
Message:

Added detection of plugin update

Location:
image-metadata-cruncher
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • image-metadata-cruncher/tags/1.1/image-metadata-cruncher.php

    r627803 r627884  
    2222    private $pattern;
    2323    public $plugin_name = 'Image Metadata Cruncher';
     24    private $version = 1.1;
     25    private $after_update = FALSE;
    2426   
    2527    /**
     
    2729     */
    2830    function __construct() {
     31        $options = get_option( $this->plugin_name );
     32        $this->after_update = intval( $options['version'] ) < intval( $this->version );
    2933       
    3034        // the EXIF and IPTC mapping arrays are quite long, so they deserve to be in separate files
     
    598602    public function defaults() {
    599603        add_option( $this->prefix, array(
     604            'version' => 1.1,
    600605            'title' => '{ IPTC:Headline }',
    601606            'alt' => '',
    602607            'caption' => '',
    603             'enable_highlighting' => 'on',
     608            'enable_highlighting' => 'enable',
    604609            'description' => '{ IPTC:Caption | EXIF:ImageDescription }',
    605610            'custom_meta' => array()
     
    777782    ///////////////////////////////////
    778783   
    779     public function section_0() { ?>
     784    public function section_0() {
     785        $options = get_option( $this->prefix );
     786        if ( intval( $options['version'] ) < 1.1 ) {
     787            $options['enable_highlighting'] = 'enable';
     788        }
     789        ?>
    780790        <p>
    781791            The fancy syntax highlighting of template tags may in some cases cause strange caret/cursor behaviour.
    782792            If you encounter any of such problems, you can disable this feature here.
    783793        </p>
    784         <?php $options = get_option( $this->prefix ); ?>
    785         <input type="checkbox" <?php checked( 'on', $options['enable_highlighting'] ); ?> name="<?php echo $this->prefix; ?>[enable_highlighting]" id="enable-highlighting" />
     794        <input type="checkbox" value="enable" <?php checked( 'enable', $options['enable_highlighting'] ); ?> name="<?php echo $this->prefix; ?>[enable_highlighting]" id="enable-highlighting" />
    786795        <label for="highlighting">Enable highlighting</label>
    787796    <?php }
  • image-metadata-cruncher/trunk/image-metadata-cruncher.php

    r627803 r627884  
    2222    private $pattern;
    2323    public $plugin_name = 'Image Metadata Cruncher';
     24    private $version = 1.1;
     25    private $after_update = FALSE;
    2426   
    2527    /**
     
    2729     */
    2830    function __construct() {
     31        $options = get_option( $this->plugin_name );
     32        $this->after_update = intval( $options['version'] ) < intval( $this->version );
    2933       
    3034        // the EXIF and IPTC mapping arrays are quite long, so they deserve to be in separate files
     
    598602    public function defaults() {
    599603        add_option( $this->prefix, array(
     604            'version' => 1.1,
    600605            'title' => '{ IPTC:Headline }',
    601606            'alt' => '',
    602607            'caption' => '',
    603             'enable_highlighting' => 'on',
     608            'enable_highlighting' => 'enable',
    604609            'description' => '{ IPTC:Caption | EXIF:ImageDescription }',
    605610            'custom_meta' => array()
     
    777782    ///////////////////////////////////
    778783   
    779     public function section_0() { ?>
     784    public function section_0() {
     785        $options = get_option( $this->prefix );
     786        if ( intval( $options['version'] ) < 1.1 ) {
     787            $options['enable_highlighting'] = 'enable';
     788        }
     789        ?>
    780790        <p>
    781791            The fancy syntax highlighting of template tags may in some cases cause strange caret/cursor behaviour.
    782792            If you encounter any of such problems, you can disable this feature here.
    783793        </p>
    784         <?php $options = get_option( $this->prefix ); ?>
    785         <input type="checkbox" <?php checked( 'on', $options['enable_highlighting'] ); ?> name="<?php echo $this->prefix; ?>[enable_highlighting]" id="enable-highlighting" />
     794        <input type="checkbox" value="enable" <?php checked( 'enable', $options['enable_highlighting'] ); ?> name="<?php echo $this->prefix; ?>[enable_highlighting]" id="enable-highlighting" />
    786795        <label for="highlighting">Enable highlighting</label>
    787796    <?php }
Note: See TracChangeset for help on using the changeset viewer.