WordPress.org

Plugin Directory

Changeset 508767


Ignore:
Timestamp:
02/22/12 10:13:19 (2 years ago)
Author:
xnau
Message:

updates to version 1.3.2:

  • moved templates and image uploads defaults out of the plugin directory
  • updated instructions for using singe-record templates
  • image files are now stored as filenames only to allow portability; backward compatibility provided for
Location:
participants-database/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • participants-database/trunk/classes/PDb_List.class.php

    r508596 r508767  
    710710           case 'image-upload': 
    711711 
    712               $display_value = self::$backend ? basename( $value[ $column ] ) : '<img class="PDb-list-image" src="'.$value[ $column ].'" />'; 
     712              $display_value = self::$backend ? basename( $value[ $column ] ) : '<img class="PDb-list-image" src="'.Participants_Db::get_image_uri( $value[ $column ] ).'" />'; 
    713713                      
    714714                            if ( 
  • participants-database/trunk/classes/PDb_Settings.class.php

    r508735 r508767  
    121121        'options'    =>array( 
    122122          'type'        => 'text', 
    123           'help_text'   => __("this defines where the uploaded files will go, relative to the WordPress root. Don't put it in the plugin folder, the images will get deleted when the plugin is updated.", Participants_Db::PLUGIN_NAME ), 
     123          'help_text'   => __("this defines where the uploaded files will go, relative to the WordPress root.<br />Don't put it in the plugin folder, the images could get deleted when the plugin is updated.", Participants_Db::PLUGIN_NAME ), 
    124124          'value'       => Participants_Db::$uploads_path, 
    125125          ) 
  • participants-database/trunk/edit_participant.php

    r505719 r508767  
    119119            $value = date( get_option( 'date_format' )/*.' '.get_option( 'time_format' )*/, $time ); 
    120120             
     121        } elseif ( 'image-upload' == $column->form_element && ! empty( $value ) ) { 
     122             
     123            $value = Participants_Db::get_image_uri( $value ); 
     124             
    121125        } 
    122126 
  • participants-database/trunk/participants-database.php

    r508735 r508767  
    5959    public static $participants_db_options; 
    6060     
     61    public static $plugin_options; 
     62     
    6163    // holds the plugin settings object 
    6264    public static $plugin_settings; 
     
    122124        // this is relative to the WP install 
    123125        self::$uploads_path = 'wp-content/uploads/'.self::PLUGIN_NAME.'/'; 
     126         
     127        self::$plugin_options = get_option( self::$participants_db_options ); 
    124128         
    125129        // hard-code some image file extensions 
     
    813817            case 'image-upload' : 
    814818             
    815                 $return = '<img src="'.$value.'" />'; 
     819                $return = '<img src="'.self::get_image_uri( $value ).'" />'; 
    816820                break; 
    817821                 
     
    851855        return $return; 
    852856         
     857         
     858    } 
     859     
     860    /** 
     861     * returns a path to the defined image location 
     862     * 
     863     * can also deal with a path saved before 1.3.2 which included the whole path 
     864     */ 
     865    public function get_image_uri( $filename ) { 
     866         
     867        if ( ! file_exists( $filename ) ) { 
     868                     
     869            return get_bloginfo('wpurl').DIRECTORY_SEPARATOR.self::$plugin_options['image_upload_location'].basename( $filename ); 
     870             
     871        } else return $filename; 
    853872         
    854873    } 
     
    19381957        } 
    19391958         
    1940         else return get_bloginfo('wpurl').DIRECTORY_SEPARATOR.$options['image_upload_location'].$new_filename; 
     1959        /* 
     1960         * as of 1.3.2 we save the image as filename only; the image is retrieved from  
     1961         * the directory defined in the plugin setting using the self::get_image function 
     1962         */ 
     1963         
     1964        else return /*get_bloginfo('wpurl').DIRECTORY_SEPARATOR.$options['image_upload_location'].*/$new_filename; 
    19411965     
    19421966    } 
  • participants-database/trunk/readme.txt

    r508735 r508767  
    163163* moved templates and image uploads defaults out of the plugin directory 
    164164* updated instructions for using singe-record templates 
     165* image files are now stored as filenames only to allow portability; backward compatibility provided for 
    165166 
    166167 
     
    318319== Upgrade Notice == 
    319320 
     321= 1.3.2 = 
     322Fixes for several minor issues; image files are now portable 
     323 
    320324= 1.3.1 = 
    321325Bugfix for sites not using rewrites; Added Italian translation 
     
    461465 
    462466These fields will now be excluded from the display. The template offers many other opportunities to customize the output of the [pdb_single] shortcode to match your theme. 
     467 
     468**Image Uploads** 
     469 
     470Images can now be stored anywhere in the WP install directory, and can be moved without breaking image sources. The 'Image Upload Location' setting will always determine the location for the images. 
     471 
     472IMPORTANT: Don't store images in the plugin directory (as was the default before version 1.3.2) they could be deleted by automatic upgrades. The new default location is in "wp-content/uploads/participants-database/" If you have images in the plugin directory, move them to this directory (it's a good choice, but if you know a better one, use it) and then change the plugin setting to point to the new location. 
Note: See TracChangeset for help on using the changeset viewer.