| 1 |
<?php |
| 2 |
add_action('admin_menu','wp_insert_update_notification'); |
| 3 |
add_action('widgets_init', 'wp_insert_unregister_widgets'); |
| 4 |
|
| 5 |
function wp_insert_update_notification() { |
| 6 |
if(get_option('wp_insert_hide_core_update_notification_enable')) { |
| 7 |
remove_action('admin_notices', 'update_nag', 3); |
| 8 |
remove_filter('update_footer', 'core_update_footer'); |
| 9 |
} |
| 10 |
|
| 11 |
if(get_option('wp_insert_show_id_enable')) { |
| 12 |
add_filter('manage_posts_columns', 'wp_insert_posts_columns_header'); |
| 13 |
add_filter('manage_posts_custom_column', 'wp_insert_posts_columns_row', 10, 2); |
| 14 |
|
| 15 |
add_filter('manage_pages_columns', 'wp_insert_posts_columns_header'); |
| 16 |
add_filter('manage_pages_custom_column', 'wp_insert_posts_columns_row', 10, 2); |
| 17 |
} |
| 18 |
|
| 19 |
if(get_option('wp_insert_load_theme_styles_enable')) { |
| 20 |
add_filter('mce_css', 'wp_insert_editor_style'); |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
function wp_insert_unregister_widgets() { |
| 25 |
if(get_option('wp_insert_hide_default_widgets_enable')) { |
| 26 |
unregister_widget('WP_Widget_Pages'); |
| 27 |
unregister_widget('WP_Widget_Calendar'); |
| 28 |
unregister_widget('WP_Widget_Archives'); |
| 29 |
unregister_widget('WP_Widget_Links'); |
| 30 |
unregister_widget('WP_Widget_Categories'); |
| 31 |
unregister_widget('WP_Widget_Recent_Posts'); |
| 32 |
unregister_widget('WP_Widget_Search'); |
| 33 |
unregister_widget('WP_Widget_Tag_Cloud'); |
| 34 |
unregister_widget('WP_Widget_Meta'); |
| 35 |
unregister_widget('WP_Widget_Recent_Comments'); |
| 36 |
unregister_widget('WP_Widget_RSS'); |
| 37 |
//unregister_widget('WP_Widget_Text'); |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
function wp_insert_posts_columns_header($columns) { |
| 42 |
$columns = array_merge(array_slice($columns, 0, 1), array('postID' => 'ID'),array_slice($columns, 1, count($columns))); |
| 43 |
return $columns; |
| 44 |
} |
| 45 |
function wp_insert_posts_columns_row($columnTitle, $postID){ |
| 46 |
if($columnTitle == 'postID'){ |
| 47 |
echo $postID; |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
function wp_insert_editor_style($url) { |
| 52 |
if (!empty($url)) $url .= ','; |
| 53 |
$url .= trailingslashit(get_stylesheet_directory_uri()).'style.css'; |
| 54 |
return $url; |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
function wp_insert_miscellaneous_pages() { |
| 59 |
global $screen_layout_columns; |
| 60 |
|
| 61 |
add_meta_box('wp_insert_miscellaneous_core_update_notification', 'Hide Core Update Notification', 'wp_insert_miscellaneous_core_update_notification_HTML', 'col_1'); |
| 62 |
add_meta_box('wp_insert_hide_default_widgets', 'Hide Default Widgets', 'wp_insert_hide_default_widgets_HTML', 'col_1'); |
| 63 |
add_meta_box('wp_insert_show_id', 'Show ID in Post & Page Listing', 'wp_insert_show_id_HTML', 'col_1'); |
| 64 |
add_meta_box('wp_insert_load_theme_styles', 'Load theme styles in Visual Editor', 'wp_insert_load_theme_styles_HTML', 'col_1'); |
| 65 |
|
| 66 |
$parameters = 'wp_insert_hide_core_update_notification_enable, wp_insert_hide_default_widgets_enable, wp_insert_show_id_enable, wp_insert_load_theme_styles_enable'; |
| 67 |
wp_insert_settings_page_layout($parameters, 'WP-INSERT : Miscellaneous Options', 'miscellaneous'); |
| 68 |
} |
| 69 |
|
| 70 |
function wp_insert_miscellaneous_core_update_notification_HTML() { ?> |
| 71 |
<div> |
| 72 |
<?php if(get_option('wp_insert_hide_core_update_notification_enable')) { ?> |
| 73 |
<input type="button" id="wp_insert_hide_core_update_notification_enable_button" value="Click to Deactivate" class="button" style="font-weight:bold;color:red;" onclick="wpInsertToggleAdWidget('#wp_insert_hide_core_update_notification_enable_button', '#wp_insert_hide_core_update_notification_enable')"/> |
| 74 |
<?php } else { ?> |
| 75 |
<input type="button" id="wp_insert_hide_core_update_notification_enable_button" value="Click to Activate" class="button" style="font-weight:bold;color:#2f9303;" onclick="wpInsertToggleAdWidget('#wp_insert_hide_core_update_notification_enable_button', '#wp_insert_hide_core_update_notification_enable')"/> |
| 76 |
<?php } ?> |
| 77 |
<input style="display:none;" id="wp_insert_hide_core_update_notification_enable" name="wp_insert_hide_core_update_notification_enable" type="checkbox" value="1"<?php if(get_option('wp_insert_hide_core_update_notification_enable')) echo ' checked="checked"'; ?> /> |
| 78 |
<p> |
| 79 |
<small> |
| 80 |
You can hide the message which says : "WordPress XX.XX.XX is available! Please update now." if you dont want users to accidently upgrade the core when you suspect an upgrade might break a feature. |
| 81 |
</small> |
| 82 |
</p> |
| 83 |
</div> |
| 84 |
<?php } |
| 85 |
|
| 86 |
function wp_insert_hide_default_widgets_HTML() { ?> |
| 87 |
<div> |
| 88 |
<?php if(get_option('wp_insert_hide_default_widgets_enable')) { ?> |
| 89 |
<input type="button" id="wp_insert_hide_default_widgets_enable_button" value="Click to Deactivate" class="button" style="font-weight:bold;color:red;" onclick="wpInsertToggleAdWidget('#wp_insert_hide_default_widgets_enable_button', '#wp_insert_hide_default_widgets_enable')"/> |
| 90 |
<?php } else { ?> |
| 91 |
<input type="button" id="wp_insert_hide_default_widgets_enable_button" value="Click to Activate" class="button" style="font-weight:bold;color:#2f9303;" onclick="wpInsertToggleAdWidget('#wp_insert_hide_default_widgets_enable_button', '#wp_insert_hide_default_widgets_enable')"/> |
| 92 |
<?php } ?> |
| 93 |
<input style="display:none;" id="wp_insert_hide_default_widgets_enable" name="wp_insert_hide_default_widgets_enable" type="checkbox" value="1"<?php if(get_option('wp_insert_hide_default_widgets_enable')) echo ' checked="checked"'; ?> /> |
| 94 |
<p> |
| 95 |
<small> |
| 96 |
Disables all default widgets except the Text Widget |
| 97 |
</small> |
| 98 |
</p> |
| 99 |
</div> |
| 100 |
<?php } |
| 101 |
|
| 102 |
function wp_insert_show_id_HTML() { ?> |
| 103 |
<div> |
| 104 |
<?php if(get_option('wp_insert_show_id_enable')) { ?> |
| 105 |
<input type="button" id="wp_insert_show_id_enable_button" value="Click to Deactivate" class="button" style="font-weight:bold;color:red;" onclick="wpInsertToggleAdWidget('#wp_insert_show_id_enable_button', '#wp_insert_show_id_enable')"/> |
| 106 |
<?php } else { ?> |
| 107 |
<input type="button" id="wp_insert_show_id_enable_button" value="Click to Activate" class="button" style="font-weight:bold;color:#2f9303;" onclick="wpInsertToggleAdWidget('#wp_insert_show_id_enable_button', '#wp_insert_show_id_enable')"/> |
| 108 |
<?php } ?> |
| 109 |
<input style="display:none;" id="wp_insert_show_id_enable" name="wp_insert_show_id_enable" type="checkbox" value="1"<?php if(get_option('wp_insert_show_id_enable')) echo ' checked="checked"'; ?> /> |
| 110 |
<p> |
| 111 |
<small> |
| 112 |
Disables all default widgets except the Text Widget |
| 113 |
</small> |
| 114 |
</p> |
| 115 |
</div> |
| 116 |
<?php } |
| 117 |
|
| 118 |
function wp_insert_load_theme_styles_HTML() { ?> |
| 119 |
<div> |
| 120 |
<?php if(get_option('wp_insert_load_theme_styles_enable')) { ?> |
| 121 |
<input type="button" id="wp_insert_load_theme_styles_enable_button" value="Click to Deactivate" class="button" style="font-weight:bold;color:red;" onclick="wpInsertToggleAdWidget('#wp_insert_load_theme_styles_enable_button', '#wp_insert_load_theme_styles_enable')"/> |
| 122 |
<?php } else { ?> |
| 123 |
<input type="button" id="wp_insert_load_theme_styles_enable_button" value="Click to Activate" class="button" style="font-weight:bold;color:#2f9303;" onclick="wpInsertToggleAdWidget('#wp_insert_load_theme_styles_enable_button', '#wp_insert_load_theme_styles_enable')"/> |
| 124 |
<?php } ?> |
| 125 |
<input style="display:none;" id="wp_insert_load_theme_styles_enable" name="wp_insert_load_theme_styles_enable" type="checkbox" value="1"<?php if(get_option('wp_insert_load_theme_styles_enable')) echo ' checked="checked"'; ?> /> |
| 126 |
<p> |
| 127 |
<small> |
| 128 |
Disables all default widgets except the Text Widget |
| 129 |
</small> |
| 130 |
</p> |
| 131 |
</div> |
| 132 |
<?php } |
| 133 |
?> |