Plugin Directory

Changeset 1089689


Ignore:
Timestamp:
02/14/2015 06:10:46 AM (11 years ago)
Author:
somatic
Message:
  • NEW: option to prevent WP from automatically titling new image uploads with the filename
Location:
somatic-framework
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • somatic-framework/tags/1.8.11/inc/somaOptions.php

    r1089471 r1089689  
    4949        add_action('do_feed_rss2_comments', array( __CLASS__, 'disable_feeds' ) );
    5050        add_action('do_feed_atom_comments', array( __CLASS__, 'disable_feeds' ) );
    51         add_action('template_redirect', array( __CLASS__, 'attachment_page_redirect'), 1);              // nukes the "attachment page" by redirecting any views to the parent
     51        add_action( 'template_redirect', array( __CLASS__, 'attachment_page_redirect'), 1);         // nukes the "attachment page" by redirecting any views to the parent
     52        add_action( 'add_attachment', array( __CLASS__, 'blank_file_title' ) );                     // wp fills in title field with filename by default when uploading. this kills that.
    5253
    5354        // add_action( 'show_user_profile', array(__CLASS__, 'show_extra_profile_fields') );  // unused
     
    9091            "typekit" => "",                            // stores typekit ID and outputs necessary scripts
    9192            "google_analytics" => "",                   // stores google analytics ID and outputs necessary scripts
    92             "kill_attachment_pages" => 1                // redirects attachment pages to parent
     93            "kill_attachment_pages" => 1,               // redirects attachment pages to parent
     94            "blank_file_title" => 0                     // stops wp from making the title the filename
    9395        );
    9496
     
    469471                            <label><input name="somatic_framework_options[enable_page_excerpts]" type="checkbox" value="1" <?php if ( isset( $soma_options['enable_page_excerpts'] ) ) { checked( '1', $soma_options['enable_page_excerpts'] ); } ?> /> Enable excerpts for built-in Pages</label><br />
    470472                            <label><input name="somatic_framework_options[fulldisplayname]" type="checkbox" value="1" <?php if ( isset( $soma_options['fulldisplayname'] ) ) { checked( '1', $soma_options['fulldisplayname'] ); } ?> /> Force display name to be Firstname Lastname (wp default is the username)</label><br />
    471                             <label><input name="somatic_framework_options[kill_attachment_pages]" type="checkbox" value="1" <?php if ( isset( $soma_options['kill_attachment_pages'] ) ) { checked( '1', $soma_options['kill_attachment_pages'] ); } ?> /> Disable solo attachment pages by redirecting to parent post</label><br />
     473                            <label><input name="somatic_framework_options[kill_attachment_pages]" type="checkbox" value="1" <?php if ( isset( $soma_options['kill_attachment_pages'] ) ) { checked( '1', $soma_options['kill_attachment_pages'] ); } ?> /> Disable linking to attachment pages by redirecting to parent post</label><br />
     474                            <label><input name="somatic_framework_options[blank_file_title]" type="checkbox" value="1" <?php if ( isset( $soma_options['blank_file_title'] ) ) { checked( '1', $soma_options['blank_file_title'] ); } ?> /> Leave "title" field blank when uploading files (stop automatic insertion of filename)</label><br />
    472475                            <input type="submit" class="clicker" value="Save Changes" />
    473476                        </td>
     
    11671170}
    11681171
     1172function blank_file_title( $attachment_ID ) {
     1173    global $soma_options;
     1174    if ( somaFunctions::fetch_index( $soma_options, 'blank_file_title' ) ) {
     1175        $the_post = array();
     1176        $the_post['ID'] = $attachment_ID;
     1177        $the_post['post_title'] = '';
     1178        wp_update_post( $the_post );
     1179    }
     1180}
     1181
    11691182    /////////////// END CLASS
    11701183}
  • somatic-framework/tags/1.8.11/readme.txt

    r1089458 r1089689  
    3838* NEW: option to enable built-in page excerpts
    3939* NEW: option to disable attachment pages (redirecting to parent post)
     40* NEW: option to prevent WP from automatically titling new image uploads with the filename
    4041* more metabox disabling for themeblvd stuff
    4142
  • somatic-framework/trunk/inc/somaOptions.php

    r1089471 r1089689  
    4949        add_action('do_feed_rss2_comments', array( __CLASS__, 'disable_feeds' ) );
    5050        add_action('do_feed_atom_comments', array( __CLASS__, 'disable_feeds' ) );
    51         add_action('template_redirect', array( __CLASS__, 'attachment_page_redirect'), 1);              // nukes the "attachment page" by redirecting any views to the parent
     51        add_action( 'template_redirect', array( __CLASS__, 'attachment_page_redirect'), 1);         // nukes the "attachment page" by redirecting any views to the parent
     52        add_action( 'add_attachment', array( __CLASS__, 'blank_file_title' ) );                     // wp fills in title field with filename by default when uploading. this kills that.
    5253
    5354        // add_action( 'show_user_profile', array(__CLASS__, 'show_extra_profile_fields') );  // unused
     
    9091            "typekit" => "",                            // stores typekit ID and outputs necessary scripts
    9192            "google_analytics" => "",                   // stores google analytics ID and outputs necessary scripts
    92             "kill_attachment_pages" => 1                // redirects attachment pages to parent
     93            "kill_attachment_pages" => 1,               // redirects attachment pages to parent
     94            "blank_file_title" => 0                     // stops wp from making the title the filename
    9395        );
    9496
     
    469471                            <label><input name="somatic_framework_options[enable_page_excerpts]" type="checkbox" value="1" <?php if ( isset( $soma_options['enable_page_excerpts'] ) ) { checked( '1', $soma_options['enable_page_excerpts'] ); } ?> /> Enable excerpts for built-in Pages</label><br />
    470472                            <label><input name="somatic_framework_options[fulldisplayname]" type="checkbox" value="1" <?php if ( isset( $soma_options['fulldisplayname'] ) ) { checked( '1', $soma_options['fulldisplayname'] ); } ?> /> Force display name to be Firstname Lastname (wp default is the username)</label><br />
    471                             <label><input name="somatic_framework_options[kill_attachment_pages]" type="checkbox" value="1" <?php if ( isset( $soma_options['kill_attachment_pages'] ) ) { checked( '1', $soma_options['kill_attachment_pages'] ); } ?> /> Disable solo attachment pages by redirecting to parent post</label><br />
     473                            <label><input name="somatic_framework_options[kill_attachment_pages]" type="checkbox" value="1" <?php if ( isset( $soma_options['kill_attachment_pages'] ) ) { checked( '1', $soma_options['kill_attachment_pages'] ); } ?> /> Disable linking to attachment pages by redirecting to parent post</label><br />
     474                            <label><input name="somatic_framework_options[blank_file_title]" type="checkbox" value="1" <?php if ( isset( $soma_options['blank_file_title'] ) ) { checked( '1', $soma_options['blank_file_title'] ); } ?> /> Leave "title" field blank when uploading files (stop automatic insertion of filename)</label><br />
    472475                            <input type="submit" class="clicker" value="Save Changes" />
    473476                        </td>
     
    11671170}
    11681171
     1172function blank_file_title( $attachment_ID ) {
     1173    global $soma_options;
     1174    if ( somaFunctions::fetch_index( $soma_options, 'blank_file_title' ) ) {
     1175        $the_post = array();
     1176        $the_post['ID'] = $attachment_ID;
     1177        $the_post['post_title'] = '';
     1178        wp_update_post( $the_post );
     1179    }
     1180}
     1181
    11691182    /////////////// END CLASS
    11701183}
  • somatic-framework/trunk/readme.txt

    r1089458 r1089689  
    3838* NEW: option to enable built-in page excerpts
    3939* NEW: option to disable attachment pages (redirecting to parent post)
     40* NEW: option to prevent WP from automatically titling new image uploads with the filename
    4041* more metabox disabling for themeblvd stuff
    4142
Note: See TracChangeset for help on using the changeset viewer.