Changeset 1030041
- Timestamp:
- 11/21/2014 10:53:00 AM (11 years ago)
- Location:
- space-remover/trunk
- Files:
-
- 2 edited
-
classes/mgwe_space_remover_admin_class.php (modified) (7 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
space-remover/trunk/classes/mgwe_space_remover_admin_class.php
r1023660 r1030041 19 19 20 20 private $l10n_prefix; 21 public $allowedPostTypes; 22 21 23 22 24 /** … … 31 33 32 34 $this->I10n_prefix = $l10n_prefix; 33 35 36 34 37 35 38 add_action('admin_init', array( &$this, 'mgwe_admin_register_settings' ), 999 ); … … 52 55 */ 53 56 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 56 67 } 57 68 … … 67 78 68 79 global $post; 80 81 82 69 83 $values = $this->mgwe_get_custom_field('mgwe_single_disable'); 70 71 84 $check = ( $values == 'on' ) ? 'on' : ''; 72 85 … … 159 172 <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> 160 173 </tr> 174 <tr valign="top"><td colspan="2"> </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> 161 179 162 180 </table> 181 163 182 164 183 <?php submit_button(); ?> … … 182 201 register_setting( 'mgwe_space_remover_settings', 'remove_trailing' ); 183 202 register_setting( 'mgwe_space_remover_settings', 'remove_all' ); 203 register_setting( 'mgwe_space_remover_settings', 'hide_metabox' ); 204 184 205 } 185 206 … … 200 221 <?php 201 222 } 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 } 202 244 203 245 -
space-remover/trunk/readme.txt
r1023722 r1030041 4 4 Tags: clean,replace,remove,sanitize,trailing,leading,p,paragraph,space,the content,post,posts,page,pages 5 5 Requires at least: 3.2 6 Tested up to: 4.0 7 Stable tag: 1. 16 Tested up to: 4.0.1 7 Stable tag: 1.2 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 25 25 26 26 Extra: 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. 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. 28 29 UPDATE: 30 Version 1.2 adds Custom Post Type Support and an extra option to disable the admin (edit page) metabox! 31 28 32 29 33 = More information = … … 99 103 100 104 == Upgrade Notice == 105 = 1.2 = 106 Added Custom Post Type support and an option to disable the admin meta box 101 107 102 108 = 1.1 =
Note: See TracChangeset
for help on using the changeset viewer.