Plugin Directory

Changeset 1030041


Ignore:
Timestamp:
11/21/2014 10:53:00 AM (11 years ago)
Author:
mgwe
Message:

1.2 update
CPT support and metabox option

Location:
space-remover/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • space-remover/trunk/classes/mgwe_space_remover_admin_class.php

    r1023660 r1030041  
    1919   
    2020        private  $l10n_prefix;
     21        public   $allowedPostTypes;
     22     
    2123   
    2224   /**
     
    3133           
    3234                $this->I10n_prefix = $l10n_prefix;
    33              
     35
     36                             
    3437               
    3538                add_action('admin_init', array( &$this, 'mgwe_admin_register_settings' ), 999 );
     
    5255    */
    5356        public function mgwe_admin_add_meta_box(){
    54             add_meta_box( 'mgwe_meta_box', 'Space Remover', array( &$this, 'mgwe_meta_box' ), 'page', 'side', 'high' );
    55             add_meta_box( 'mgwe_meta_box', 'Space Remover', array( &$this, 'mgwe_meta_box' ), 'post', 'side', 'high' );
     57
     58             if(get_option('hide_metabox') == 'on') return;
     59
     60            $this->allowedPostTypes = $this->__mgwe_get_post_types();
     61
     62            foreach( $this->allowedPostTypes as $type ) {
     63                  //add_meta_box('featured-meta', 'Feature Me?', 'custom_meta_featured', $type, 'side');
     64                   add_meta_box( 'mgwe_meta_box', 'Space Remover', array( &$this, 'mgwe_meta_box' ), $type, 'side', 'high' );
     65            }
     66
    5667        }
    5768
     
    6778
    6879            global $post;
     80
     81           
     82
    6983            $values = $this->mgwe_get_custom_field('mgwe_single_disable');
    70 
    7184            $check = ( $values == 'on' ) ? 'on' : '';
    7285
     
    159172                            <td><input type="checkbox" name="remove_trailing" value="on" class="checkbox single-option" <?php echo ('on' == get_option('remove_trailing') && !$allChecked) ? 'checked="checked"' : '';  ?> <?php echo ($allChecked) ? 'disabled="disabled"' : '' ?> /></td>
    160173                        </tr>
     174                        <tr valign="top"><td colspan="2">&nbsp;</td></tr>
     175                        <tr valign="top">
     176                            <th scope="row"><?php _e('Hide "disable" metabox', $this->I10n_prefix); ?></th>
     177                            <td><input type="checkbox" name="hide_metabox" value="on" class="checkbox single-option" <?php echo ('on' == get_option('hide_metabox')) ? 'checked="checked"' : '';  ?>  /></td>
     178                        </tr>
    161179
    162180                    </table>
     181
    163182
    164183                    <?php submit_button(); ?>
     
    182201                register_setting( 'mgwe_space_remover_settings', 'remove_trailing' );
    183202                register_setting( 'mgwe_space_remover_settings', 'remove_all' );
     203                register_setting( 'mgwe_space_remover_settings', 'hide_metabox' );
     204
    184205        }
    185206
     
    200221            <?php
    201222        }
     223 
     224    /* Get a list of all the post types
     225     * @author  MG
     226     * @since   1.1
     227     */
     228        private function __mgwe_get_post_types(){
     229
     230            $args = array(
     231               'public'   => true,
     232               '_builtin' => false
     233            );
     234
     235            $output = 'names'; // names or objects, note names is the default
     236            $operator = 'and'; // 'and' or 'or'
     237
     238            $post_types = get_post_types( $args, $output, $operator );
     239            $post_types['post'] = 'post';
     240            $post_types['page'] = 'page';
     241
     242            return $post_types;
     243        }
    202244
    203245
  • space-remover/trunk/readme.txt

    r1023722 r1030041  
    44Tags: clean,replace,remove,sanitize,trailing,leading,p,paragraph,space,the content,post,posts,page,pages
    55Requires at least: 3.2
    6 Tested up to: 4.0
    7 Stable tag: 1.1
     6Tested up to: 4.0.1
     7Stable tag: 1.2
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2525
    2626Extra:
    27 Sometimes you want to use that extra space in your content. For this purpose you can also disable Space Remover on a page/ post individual basis.
     27Sometimes you want to use that extra space in your content. For this purpose you can also disable Space Remover on a page/ post individual basis.
     28
     29UPDATE:
     30Version 1.2 adds Custom Post Type Support and an extra option to disable the admin (edit page) metabox!
     31
    2832
    2933= More information =
     
    99103
    100104== Upgrade Notice ==
     105= 1.2 =
     106Added Custom Post Type support and an option to disable the admin meta box
    101107
    102108= 1.1 =
Note: See TracChangeset for help on using the changeset viewer.