settings_page = add_options_page( __( 'Announcement Bar', Announcement_Bar::domain ), __( 'Announcement Bar', Announcement_Bar::domain ), 'manage_options', Announcement_Bar::domain, 'announcement_bar_settings_page' ); /* Register the default theme settings meta boxes. */ add_action( "load-{$announcement_bar->settings_page}", 'announcement_bar_create_settings_meta_boxes' ); /* Make sure the settings are saved. */ add_action( "load-{$announcement_bar->settings_page}", 'announcement_bar_load_settings_page' ); /* Load the JavaScript and stylehsheets needed for the theme settings. */ add_action( "load-{$announcement_bar->settings_page}", 'announcement_bar_settings_page_enqueue_script' ); add_action( "load-{$announcement_bar->settings_page}", 'announcement_bar_settings_page_enqueue_style' ); add_action( "admin_head-{$announcement_bar->settings_page}", 'announcement_bar_settings_page_load_scripts' ); } /** * Returns an array with the default plugin settings. * * @since 0.8 */ function announcement_bar_settings() { $plugin_data = get_plugin_data( ANNOUNCEMENT_BAR_DIR . 'announcement.php' ); $settings = array( 'version' => $plugin_data['Version'], 'notice' => true, /* Activate */ 'activate' => false, /* Rewrite Slug */ 'slug' => 'announcing', /* Options */ 'height' => '33px', 'background' => '#FFFFE0', 'color' => '#444444', 'a_color' => '#222222', 'size' => '14px', 'custom_css' => '', ); return apply_filters( 'announcement_bar_settings', $settings ); } /** * Function run at load time of the settings page, which is useful for hooking save functions into. * * @since 0.8 */ function announcement_bar_load_settings_page() { /* Get theme settings from the database. */ $settings = get_option( 'announcement_bar_settings' ); /* If no settings are available, add the default settings to the database. */ if ( empty( $settings ) ) { add_option( 'announcement_bar_settings', announcement_bar_settings(), '', 'yes' ); /* Redirect the page so that the settings are reflected on the settings page. */ wp_redirect( admin_url( 'options-general.php?page=announcement-bar' ) ); exit; } /* If the form has been submitted, check the referer and execute available actions. */ elseif ( isset( $_POST['announcement-bar-settings-submit'] ) ) { /* Make sure the form is valid. */ check_admin_referer( 'announcement-bar-settings-page' ); /* Available hook for saving settings. */ do_action( 'announcement_bar_update_settings_page' ); /* Get the current theme settings. */ $settings = get_option( 'announcement_bar_settings' ); if ( isset( $_POST['slug'] ) && $_POST['slug'] != $settings['slug'] ) do_action( 'announcement_bar_flush' ); /* Redirect the page so that the new settings are reflected on the settings page. */ wp_redirect( admin_url( 'options-general.php?page=announcement-bar&updated=true' ) ); exit; } /* If the form has been submitted, check the referer and execute available actions. */ elseif ( isset( $_GET['notice'] ) ) { /* Make sure the form is valid. */ check_admin_referer( 'announcement-bar-notice' ); /* Get the current theme settings. */ $settings = get_option( 'announcement_bar_settings' ); $settings['notice'] = ( ( isset( $_GET['notice'] ) ) ? false : true ); /* Available hook for saving settings. */ update_option( 'announcement_bar_settings', $settings ); /* Redirect the page so that the new settings are reflected on the settings page. */ //wp_redirect( admin_url( 'options-general.php?page=announcement-bar&updated=true' ) ); //exit; } } /** * Validates the plugin settings. * * @since 0.8 */ function announcement_bar_save_settings() { /* Get the current theme settings. */ $settings = get_option( 'announcement_bar_settings' ); $settings['version'] = ( isset( $_POST['version'] ) ) ? esc_html( $_POST['version'] ) : ''; $settings['activate'] = ( ( isset( $_POST['activate'] ) ) ? true : false ); $settings['slug'] = esc_html( $_POST['slug'] ); $settings['height'] = esc_html( $_POST['height'] ); $settings['background'] = esc_html( $_POST['background'] ); $settings['color'] = esc_html( $_POST['color'] ); $settings['a_color'] = esc_html( $_POST['a_color'] ); $settings['size'] = esc_html( $_POST['size'] ); $settings['custom_css'] = ( isset( $_POST['custom_css'] ) ) ? esc_html( $_POST['custom_css'] ) : ''; /* Update the theme settings. */ $updated = update_option( 'announcement_bar_settings', $settings ); } /** * Save and rewrite the rules if the $slug is changed */ function announcement_bar_flush_rewrite() { flush_rewrite_rules(); } /** * Registers the plugin meta boxes for use on the settings page. * * @since 0.8 */ function announcement_bar_create_settings_meta_boxes() { global $announcement_bar; add_meta_box( 'announcement-bar-activate-meta-box', __( 'Custom Activation — to infinity and beyond', Announcement_Bar::domain ), 'announcement_bar_activate_meta_box', $announcement_bar->settings_page, 'normal', 'high' ); add_meta_box( 'announcement-bar-announcement-meta-box', __( 'Announcement!', Announcement_Bar::domain ), 'announcement_bar_announcement_meta_box', $announcement_bar->settings_page, 'normal', 'high' ); add_meta_box( 'announcement-bar-general-meta-box', __( 'General Settings', Announcement_Bar::domain ), 'announcement_bar_general_meta_box', $announcement_bar->settings_page, 'normal', 'high' ); add_meta_box( 'announcement-bar-about-meta-box', __( 'About Announcement Bar', Announcement_Bar::domain ), 'announcement_bar_about_meta_box', $announcement_bar->settings_page, 'advanced', 'high' ); add_meta_box( 'announcement-bar-support-meta-box', __( 'Support Announcement Bar', Announcement_Bar::domain ), 'announcement_bar_support_meta_box', $announcement_bar->settings_page, 'advanced', 'high' ); add_meta_box( 'announcement-bar-tabs-meta-box', __( 'TheFrosty Network', Announcement_Bar::domain ), 'announcement_bar_tabs_meta_box', $announcement_bar->settings_page, 'side', 'low' ); } /** * Displays activation meta box. * * @since 0.8 */ function announcement_bar_activate_meta_box() { $num_posts = wp_count_posts( ANNOUNCEMENT_BAR_POST_TYPE ); $num = number_format_i18n( $num_posts->publish ); ?> = '1' ) { ?>
value="true" /> [?]
Check this box to show or hide the announcement bar.
= '1' || ( $num >= '1' && Announcement_Bar::get_setting( 'slug' ) != '' ) ) echo ' readonly="readonly"'; ?> /> [?]
Input your desired slug here.
– @TheFrosty
PayPal.', Announcement_Bar::domain ); ?>
This plugin on WordPress.org.', Announcement_Bar::domain ); ?>
On Twitter', Announcement_Bar::domain ); ?>
WordPress support forums.', Announcement_Bar::domain ); ?>
'', '28px' => '28px', '33px' => '33px', '40px' => '40px', '50px' => '50px', '55px' => '55px', '60px' => '60px', ); $sizes = array( '' => '', '12px' => '12px', '14px' => '14px', '16px' => '16px', '18px' => '18px', '20px' => '20px', '22px' => '22px', '24px' => '24px', '26px' => '26px', ); ?>
[?]
px', Announcement_Bar::domain ); ?>
[?]
[?]
with “#” or RGB/A format.
Example: ¹#121212 ²rgba(255,255,255,0.4)', Announcement_Bar::domain ); ?>
[?]
', Announcement_Bar::domain ); ?>
[?]
with “#” or RGB/A format.
Example: ¹#121212 ²rgba(255,255,255,0.4)', Announcement_Bar::domain ); ?>
[?]
with “#” or RGB/A format.
Example: ¹#121212 ²rgba(255,255,255,0.4)', Announcement_Bar::domain ); ?>
[?]
Some CSS attributes: #announcementbar-container, #announcementbar, .announcement, .toggle a, ', Announcement_Bar::domain ); ?>

settings_page, 'normal', $plugin_data ); ?>
settings_page, 'advanced', $plugin_data ); ?>
settings_page, 'side', $plugin_data ); ?>

' . __('Settings') . ''; array_unshift( $links, $settings_link ); // before other links } return $links; } /** * Warnings * @since 0.5 * @package admin */ function announcement_bar_admin_warnings() { global $announcement_bar; function announcement_bar_warning_slug() { global $announcement_bar; $num_posts = wp_count_posts( 'AnnouncementBar' ); $num = isset( $num_posts->publish ) ? number_format_i18n( $num_posts->publish ) : '0'; $slug = Announcement_Bar::get_setting( 'slug' ); if ( Announcement_Bar::get_setting( 'notice' ) == true ) { ?>

Announcement Bar, just visit the %1$s page before adding a post to the %2$s.
Current slug set as %3$s %4$s', 'options', 'announcement bar', home_url( '/' ).''.$slug.'/', 'hide' ), Announcement_Bar::domain ); ?>

Announcement Bar, will inly work with WordPress 3.0.x and greater. You\'ve got version %1$s', $wp_version ), Announcement_Bar::domain ); ?>

set_feed_url( $attr ); if ( false !== strpos( $domain, '/' ) || 'localhost' == $domain || preg_match( '|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|', $domain ) ) { $feed->enable_cache( false ); } else { $feed->enable_cache( true ); $feed->set_cache_location( plugin_dir_path( __FILE__ ) . 'cache' ); } $feed->init(); $feed->handle_content_type(); $items = $feed->get_item(); echo '
'; echo '
'; } } ?>