WordPress.org

Plugin Directory

Changeset 625524


Ignore:
Timestamp:
11/15/12 05:29:01 (17 months ago)
Author:
jeremyfelt
Message:

Push v0.8 to production

See https://github.com/jeremyfelt/Automatic-Featured-Image-Posts for commit logs

Location:
automatic-featured-image-posts/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • automatic-featured-image-posts/trunk/automatic-featured-image-posts.php

    r543864 r625524  
    22/* 
    33Plugin Name: Automatic Featured Image Posts 
    4 Plugin URI: http://www.jeremyfelt.com/wordpress/plugins/automatic-featured-image-posts/ 
     4Plugin URI: http://jeremyfelt.com/wordpress/plugins/automatic-featured-image-posts/ 
    55Description: Automatically creates a new post with an assigned featured image from every image upload. 
    6 Version: 0.7 
     6Version: 0.8 
    77Author: Jeremy Felt 
    8 Author URI: http://www.jeremyfelt.com 
     8Author URI: http://jeremyfelt.com 
    99License: GPL2 
    1010*/ 
     
    4646        $afip_options = array(); 
    4747 
    48         if ( empty( $current_afip_options[ 'default_post_status' ] ) ) 
    49             $afip_options[ 'default_post_status' ] = 'publish'; 
     48        if ( empty( $current_afip_options['default_post_status'] ) ) 
     49            $afip_options['default_post_status'] = 'publish'; 
    5050        else 
    51             $afip_options[ 'default_post_status' ] = $current_afip_options[ 'default_post_status' ]; 
    52  
    53         if ( empty( $current_afip_options[ 'default_post_type' ] ) ) 
    54             $afip_options[ 'default_post_type' ] = 'post'; 
     51            $afip_options['default_post_status'] = $current_afip_options['default_post_status']; 
     52 
     53        if ( empty( $current_afip_options['default_post_type'] ) ) 
     54            $afip_options['default_post_type'] = 'post'; 
    5555        else 
    56             $afip_options[ 'default_post_type' ] = $current_afip_options[ 'default_post_type' ]; 
    57  
    58         if ( empty( $current_afip_options[ 'default_post_format' ] ) ) 
    59             $afip_options[ 'default_post_format' ] = 'standard'; 
     56            $afip_options['default_post_type'] = $current_afip_options['default_post_type']; 
     57 
     58        if ( empty( $current_afip_options['default_post_format'] ) ) 
     59            $afip_options['default_post_format'] = 'standard'; 
    6060        else 
    61             $afip_options[ 'default_post_format' ] = $current_afip_options[ 'default_post_format' ]; 
     61            $afip_options['default_post_format'] = $current_afip_options['default_post_format']; 
    6262 
    6363        update_option( 'afip_options', $afip_options ); 
     
    147147        $all_post_types = get_post_types( array( '_builtin' => false ) ); 
    148148 
    149         if ( ! isset( $afip_options[ 'default_post_type' ] ) ) 
    150             $afip_options[ 'default_post_type' ] = 'post'; 
     149        if ( ! isset( $afip_options['default_post_type'] ) ) 
     150            $afip_options['default_post_type'] = 'post'; 
    151151        ?> 
    152152        <select id="afip-default-post-type" name="afip_options[default_post_type]"> 
    153             <option value="post" <?php selected( $afip_options[ 'default_post_type' ], 'post' ); ?>>Post</option> 
    154         <?php foreach( $all_post_types as $p ) : ?><option value="<?php echo esc_attr( $p ); ?>" <?php selected( $afip_options[ 'default_post_type' ], esc_attr( $p ) ); ?>><?php echo esc_html( $p ); ?></option><?php endforeach; ?> 
     153            <option value="post" <?php selected( $afip_options['default_post_type'], 'post' ); ?>>Post</option> 
     154        <?php foreach( $all_post_types as $p ) : ?> 
     155            <option value="<?php echo esc_attr( $p ); ?>" <?php selected( $afip_options['default_post_type'], esc_attr( $p ) ); ?>><?php echo esc_html( $p ); ?></option> 
     156        <?php endforeach; ?> 
    155157        </select> 
    156158        <?php 
     
    164166        $afip_options = get_option( 'afip_options' ); 
    165167 
    166         if ( ! isset( $afip_options[ 'default_post_status' ] ) ) 
    167             $afip_options[ 'default_post_status' ] = 'draft'; 
     168        if ( ! isset( $afip_options['default_post_status'] ) ) 
     169            $afip_options['default_post_status'] = 'draft'; 
    168170        ?> 
    169171        <select id="afip_default_post_status" name="afip_options[default_post_status]"> 
    170             <option value="draft" <?php selected( $afip_options[ 'default_post_status' ], 'draft' ); ?>>Draft</option> 
    171             <option value="publish" <?php selected( $afip_options[ 'default_post_status' ], 'publish' ); ?>>Publish</option> 
    172             <option value="private" <?php selected( $afip_options[ 'default_post_status' ], 'private' ); ?>>Private</option> 
     172            <option value="draft" <?php selected( $afip_options['default_post_status'], 'draft' ); ?>>Draft</option> 
     173            <option value="publish" <?php selected( $afip_options['default_post_status'], 'publish' ); ?>>Publish</option> 
     174            <option value="private" <?php selected( $afip_options['default_post_status'], 'private' ); ?>>Private</option> 
    173175        </select> 
    174176        <?php 
     
    183185        $afip_options = get_option( 'afip_options' ); 
    184186 
    185         if ( ! isset( $afip_options[ 'default_post_format' ] ) ) 
    186             $afip_options[ 'default_post_format' ] = 'standard'; 
     187        if ( ! isset( $afip_options['default_post_format'] ) ) 
     188            $afip_options['default_post_format'] = 'standard'; 
    187189        ?> 
    188190        <select id="afip_default_post_format" name="afip_options[default_post_format]"> 
    189191            <?php 
    190                 if ( isset( $_wp_theme_features[ 'post-formats' ] ) && is_array( $_wp_theme_features[ 'post-formats' ] ) ) { 
    191                     foreach ( $_wp_theme_features[ 'post-formats' ] as $post_format_array ){ 
     192                if ( isset( $_wp_theme_features['post-formats'] ) && is_array( $_wp_theme_features['post-formats'] ) ) { 
     193                    foreach ( $_wp_theme_features['post-formats'] as $post_format_array ){ 
    192194                        foreach ( $post_format_array as $post_format ) { 
    193195                            ?> 
    194                             <option value="<?php echo esc_attr( $post_format ); ?>" <?php selected( $afip_options[ 'default_post_format' ], esc_attr( $post_format ) ); ?>><?php echo esc_html( ucwords( $post_format ) ); ?></option> 
     196                            <option value="<?php echo esc_attr( $post_format ); ?>" <?php selected( $afip_options['default_post_format'], esc_attr( $post_format ) ); ?>><?php echo esc_html( ucwords( $post_format ) ); ?></option> 
    195197                            <?php 
    196198                        } 
    197199                        if ( ! in_array( 'standard', $post_format_array ) ) { 
    198200                            ?> 
    199                             <option value="standard" <?php selected( $afip_options[ 'default_post_format' ], 'standard' ); ?>>Standard</option> 
     201                            <option value="standard" <?php selected( $afip_options['default_post_format'], 'standard' ); ?>>Standard</option> 
    200202                            <?php 
    201203                        } 
     
    203205                } else { 
    204206                    ?> 
    205                     <option value="standard" <?php selected( $afip_options[ 'default_post_format' ], 'standard' ); ?>>Standard</option> 
     207                    <option value="standard" <?php selected( $afip_options['default_post_format'], 'standard' ); ?>>Standard</option> 
    206208                    <?php 
    207209                } 
     
    224226        $valid_post_format_options = array( 'standard' ); 
    225227 
    226         if ( isset( $_wp_theme_features[ 'post-formats' ] ) && is_array( $_wp_theme_features[ 'post-formats' ] ) ) { 
    227             foreach ( $_wp_theme_features[ 'post-formats' ] as $post_format_array ) { 
     228        if ( isset( $_wp_theme_features['post-formats'] ) && is_array( $_wp_theme_features['post-formats'] ) ) { 
     229            foreach ( $_wp_theme_features['post-formats'] as $post_format_array ) { 
    228230                foreach ( $post_format_array as $post_format ) { 
    229231                    $valid_post_format_options[] = $post_format; 
     
    232234        } 
    233235 
    234         if ( ! in_array( $input[ 'default_post_status' ], $valid_post_status_options ) ) 
    235             $input[ 'default_post_status' ] = 'draft'; 
    236  
    237         if ( ! in_array( $input[ 'default_post_type' ], $valid_post_type_options ) ) 
    238             $input[ 'default_post_type' ] = 'post'; 
    239  
    240         if ( isset( $input[ 'default_post_format' ] ) && ! in_array( $input[ 'default_post_format' ], $valid_post_format_options ) ) 
    241             $input[ 'default_post_format' ] = 'standard'; 
     236        if ( ! in_array( $input['default_post_status'], $valid_post_status_options ) ) 
     237            $input['default_post_status'] = 'draft'; 
     238 
     239        if ( ! in_array( $input['default_post_type'], $valid_post_type_options ) ) 
     240            $input['default_post_type'] = 'post'; 
     241 
     242        if ( isset( $input['default_post_format'] ) && ! in_array( $input['default_post_format'], $valid_post_format_options ) ) 
     243            $input['default_post_format'] = 'standard'; 
    242244 
    243245        return $input; 
     
    295297 
    296298        $afip_options = get_option( 'afip_options' ); 
    297         $new_post_date = date( 'Y-m-d H:i:s' ); 
    298299        $current_user = wp_get_current_user(); 
     300 
     301        /* Allow other functions or themes to change the post date before creation. */ 
     302        $new_post_date = apply_filters( 'afip_new_post_date', current_time( 'mysql' ), $post_id ); 
    299303 
    300304        /* Allow other functions or themes to change the post title before creation. */ 
     
    310314            'post_title' => $new_post_title, 
    311315            'post_content' => $new_post_content, 
    312             'post_status' => $afip_options[ 'default_post_status' ], 
     316            'post_status' => $afip_options['default_post_status'], 
    313317            'post_author' => $current_user->ID, 
    314318            'post_date' => $new_post_date, 
    315319            'post_category' => $new_post_category, 
    316             'post_type' => $afip_options[ 'default_post_type' ], 
     320            'post_type' => $afip_options['default_post_type'], 
    317321        )); 
    318322 
    319         if ( isset( $afip_options[ 'default_post_format' ] ) && 'standard' != $afip_options[ 'default_post_format' ] ) 
    320             set_post_format( $new_post_id, $afip_options[ 'default_post_format' ] ); 
     323        if ( isset( $afip_options['default_post_format'] ) && 'standard' != $afip_options['default_post_format'] ) 
     324            set_post_format( $new_post_id, $afip_options['default_post_format'] ); 
    321325 
    322326        update_post_meta( $new_post_id, '_thumbnail_id', $post_id ); 
  • automatic-featured-image-posts/trunk/readme.txt

    r543864 r625524  
    22 
    33Contributors: jeremyfelt 
    4 Donate link: http://www.jeremyfelt.com/wordpress/plugins/automatic-featured-image-posts/ 
     4Donate link: http://jeremyfelt.com/wordpress/plugins/automatic-featured-image-posts/ 
    55Tags: featured image, media, photo, pictures, posts, photoblog, upload, automatic, custom post type, thumbnail, post thumbnails, post formats 
    66Requires at least: 3.2.1 
    7 Tested up to: 3.4 
    8 Stable tag: 0.7 
     7Tested up to: 3.5 
     8Stable tag: 0.8 
    99 
    1010Automatic Featured Image Posts creates a new post with a Featured Image every time an image is uploaded. 
     
    3333*  'afip_new_post_category' = Allow other functions or themes to change the post categories before creation. 
    3434*  'afip_new_post_content' = Allow other functions or themes to change the post content before creation. 
     35*  'afip_new_post_date' = Allow other functions or themes to change the post date before creation 
     36 
     37Feel free to [fork and/or contribute on GitHub](https://github.com/jeremyfelt/Automatic-Featured-Image-Posts) 
    3538 
    3639== Installation == 
     
    5962 
    6063== Changelog == 
     64 
     65= 0.8 = 
     66* Compatibility check with upcoming WordPress 3.5, all is a go! 
     67* Fix post time bug to account for WordPress timezone setting. props Matthew Harris 
     68* Add filter to new post date so that it can be modified. 
     69* General code style cleaning 
    6170 
    6271= 0.7 = 
     
    9099== Upgrade Notice == 
    91100 
     101= 0.8 = 
     102* Bug fix for new post's date. 
     103 
    92104= 0.7 = 
    93105* Bug fixes when saving options while post formats are not enabled 
Note: See TracChangeset for help on using the changeset viewer.