'0',
"block_display" => null,
"box_display" => null,
"color_scheme" => '1',
"body_bck_img" => null,
"body_bck_img_width" => null,
"body_bck_img_height" => null,
"body_bck_img_alt" => null,
"body_bck_img_attachment" => 'scroll',
"body_bck_img_position" => null,
"body_bck_img_repeat" => 'repeat',
"body_back_color" => null,
"body_txt_color" => null,
"body_lnk_color" => null,
"body_lnk_hover_color" => null,
"body_lnk_visited_color" => null,
"main_content_back_color" => null,
"h1" => array(
"size" => null,
'color' => null,
),
"h2" => array(
"size" => null,
'color' => null,
),
"h3" => array(
"size" => null,
'color' => null,
),
"h4" => array(
"size" => null,
'color' => null,
),
"h5" => array(
"size" => null,
'color' => null,
),
"h6" => array(
"size" => null,
'color' => null,
),
"widget_border" => null,
"page_header" => null,
"page_header_bck_img" => null,
"page_header_bck_img_width" => null,
"page_header_bck_img_height" => null,
"page_header_bck_img_alt" => null,
"page_header_bck_img_attachment" => 'scroll',
"page_header_bck_img_position" => null,
"page_header_bck_img_repeat" => "repeat",
"page_header_height" => null,
"page_header_color" => null,
"page_header_layout" => '1',
"show_todays_date" => null,
"breadcrumbs" => null,
"blog_info" => null,
"show_sidebar" => null,
"default_user_img" => null,
"default_user_img_width" => null,
"default_user_img_height" => null,
"default_user_img_alt" => null,
"dynamic_meta_tag" => null,
"contact_info" => array(
"contact_address" => null,
"address_icon" => null,
"contact_phone" => null,
"phone_icon" => null,
"contact_url" => null,
"url_icon" => null,
"contact_email" => null,
"email_icon" => null,
"contact_facebook" => null,
"facebook_icon" => null,
"contact_twitter" => null,
"twitter_icon" => null,
"contact_google" => null,
"google_icon" => null,
"contact_linkedin" => null,
"linkedin_icon" => null,
"contact_instagram" => null,
"instagram_icon" => null,
"contact_tumblr" => null,
"tumblr_icon" => null,
"contact_pinterest" => null,
"pinterest_icon" => null,
"contact_info_layout" => '1',
"user_id" => null,
"show_address" => null,
"show_phone" => null,
"show_email" => null,
"show_url" => null,
"show_social" => null,
"share_title" => null,
),
"contact_form" => null,
"fonts" => array(
"body_txt_font_family" => "no_font",
"body_txt_font_type" => "system",
"body_txt_font_weight" => "regular",
"body_txt_font_subsets" => null,
"headers_font_family" => "no_font",
"headers_font_type" => "system",
"headers_font_weight" => "regular",
"headers_font_subsets" => null,
"main_menu_font_family" => "no_font",
"main_menu_font_type" => "system",
"main_menu_font_weight" => "regular",
"main_menu_font_subsets" => null,
),
"facebook_app_id" => null,
"google_app_id" => null,
"header_sticky" => null,
"header_back_color" => null,
"header_txt_color" => null,
"header_lnk_color" => null,
"logo" => null,
"logo_width" => null,
"logo_height" => null,
"logo_alt" => null,
"show_contact" => null,
"menu_back_color" => null,
"menu_lnk_color" => null,
"menu_active_color" => null,
"submenu_back_color" => null,
"submenu_lnk_color" => null,
"posts_general" => array(
"img_size" => "scale",
"sticky_display" => null,
"standard_icon" => null,
"image_icon" => null,
"audio_icon" => null,
"video_icon" => null,
"gallery_icon" => null,
"link_icon" => null,
"quote_icon" => null,
"author_icon" => null,
"date_icon" => null,
"categories_icon" => null,
"tags_icon" => null,
"comments_icon" => null,
),
"posts_landing" => array(
"layout" => "layout1",
'title_text' => null,
"title_border" => "default",
'tagline_text' => null,
"tagline_border" => "0",
"wrap_class" => null,
"title_class" => null,
"cols" => "1",
"border" => "0",
"masonry" => null,
"alternate_color" => null,
'sticky_only' => false,
'ignore_sticky' => false,
'limit' => null,
"show_title" => null,
"show_content" => null,
"show_author" => null,
"show_date" => null,
"show_categories" => null,
"show_tags" => null,
"show_stats" => null,
"show_social" => null,
"share_title" => null,
"show_icons" => null,
"post_meta_layout" => '1',
"gallery_slideshow" => null,
"quote_layout" => '1',
"display_format_icon" => null,
),
"posts_single" => array(
"override_landing" => null,
"layout" => "layout1",
'title_text' => null,
"title_border" => "default",
'tagline_text' => null,
"tagline_border" => "0",
"wrap_class" => null,
"title_class" => null,
"border" => "0",
"show_title" => "on",
"show_content" => "on",
"show_author" => "on",
"show_date" => "on",
"show_categories" => "on",
"show_tags" => "on",
"show_stats" => "on",
"show_social" => "on",
"share_title" => null,
"show_icons" => "on",
"post_meta_layout" => '1',
"gallery_slideshow" => null,
"quote_layout" => '1',
"display_format_icon" => null,
),
"footer_extended" => null,
"footer_bck_color" => null,
"footer_txt_color" => null,
"footer_lnk_color" => null,
"footer_lnk_hover_color" => null,
"footer_lnk_visited_color" => null,
"copyright" => null,
"custom_css" => null,
"google_fonts_url" => null,
);
return apply_filters( 'blogcentral_option_defaults', $blogcentral_defaults );
}
/**
* Initial values for options
*
* Used if the $blogcentral_opts variable is empty, meaning it has never been saved to the database.
*
* @since 1.0.0
*/
function blogcentral_get_option_initial() {
global $blogcentral_defaults;
$blogcentral_initial = array_merge( $blogcentral_defaults, array(
"logo" => BLOGCENTRAL_THEME_URL . "/images/preview/full-dark-logo.png",
//"show_sidebar" => "on",
"page_header" => 'on',
"page_header_bck_img" => BLOGCENTRAL_THEME_URL . "/images/preview/down-alley.jpg",
"page_header_bck_img_alt" => 'placeholder',
"page_header_bck_img_attachment" => 'fixed',
"page_header_bck_img_repeat" => "repeat",
"page_header_color" => "white",
"page_header_layout" => '1',
'posts_landing' => array_merge( $blogcentral_defaults['posts_landing'],
array(
'show_title' => 'on',
'show_author' => 'on',
'show_date' => 'on',
'show_stats' => 'on',
'show_categories' => 'on',
'show_tags' => 'on',
'show_content' => 'on',
'show_social' => 'on',
'show_icons' => 'on',
)
),
"copyright" => "
Copyright © 2015 " . get_bloginfo( 'name' ) . " All Rights Reserved.",
)
);
return apply_filters( 'blogcentral_option_initial', $blogcentral_initial );
}
/**
* Default values for options
*
* If using the BlogCentral Shortcodes & Widgets Pack plugin, the contact_info and posts_landing arrays have to be a
* complete list of supported attributes, because they will be used in the shortcodes class to merge shortcode atts with defaults.
*
* @since 1.0.1
*/
function blogcentral_initialize_global_opts() {
global $blogcentral_initial;
// Get cached theme options, if not cached, then use get_option.
if ( ! is_admin() && ! is_home() ) {
$cached_opts = get_transient( 'blogcentral_options' );
if ( ! $cached_opts ) {
$blogcentral_opts = get_option( BLOGCENTRAL_DB_OPTIONS_NAME );
set_transient( 'blogcentral_options', $blogcentral_opts, 21 * DAY_IN_SECONDS );
} else {
$blogcentral_opts = $cached_opts;
}
} else {
$blogcentral_opts = get_option( BLOGCENTRAL_DB_OPTIONS_NAME );
}
if ( empty( $blogcentral_opts ) ) {
$blogcentral_opts = $blogcentral_initial;
}
return $blogcentral_opts;
}
/**
* Predefined options for the demos.
*
* @since 1.0.1
*/
function blogcentral_get_demos_opts() {
$blogcentral_demos_opts = array(
array(
"blog_demo" => '1',
"color_scheme" => "4",
"body_back_color" => "#F8F8F8",
"widget_border" => "div3",
"page_header" => 'on',
"page_header_bck_img" => BLOGCENTRAL_THEME_URL . "/images/preview/down-alley.jpg",
"page_header_bck_img_alt" => 'placeholder',
"page_header_bck_img_attachment" => 'fixed',
"page_header_bck_img_repeat" => "repeat",
"page_header_color" => "white",
"page_header_layout" => '1',
"breadcrumbs" => "on",
"show_sidebar"=>"on",
"default_user_img" => BLOGCENTRAL_THEME_URL . "/images/placeholder.png",
"default_user_img_alt" => 'default user image',
"contact_info" => array(
"contact_address" => "Cincinnati OH",
"address_icon" => "fa-home",
"contact_info_layout" =>' 1',
),
"header_sticky" => "on",
"logo" => BLOGCENTRAL_THEME_URL . "/images/preview/full-dark-logo.png",
"logo_alt" => "logo",
"submenu_back_color" => "#333",
"submenu_lnk_color" => "white",
"posts_general" => array(
"img_size" => "scale",
"standard_icon" => "fa-pencil",
"image_icon" => "fa-camera",
"audio_icon" => "fa-music",
"video_icon" => "fa-video-camera",
"gallery_icon" => "fa-picture-o",
"link_icon" => "fa-chain-broken",
"quote_icon" => "fa-quote-left",
"author_icon" => "fa-user",
"date_icon" => "fa-clock-o",
"categories_icon" => "fa-folder",
"tags_icon" => "fa-tags",
"comments_icon" => "fa-comments-o",
),
"posts_landing" => array(
"layout" => "layout1",
"cols" => "1",
"border" => "0",
"masonry" => "on",
"show_title" => "on",
"show_content" => "on",
"show_author" => "on",
"show_date" => "on",
"show_categories" => "on",
"show_tags" => "on",
"show_stats" => "on",
"show_social" => "on",
"share_title" => null,
"show_icons" => "on",
"post_meta_layout" => '1',
"gallery_slideshow" => "on",
"quote_layout" => '2',
),
"posts_single" => array(),
"footer_extended" => "on",
"copyright" => "
Copyright © 2015 " . get_bloginfo( 'name' ) . " All Rights Reserved.",
"custom_css" => "
#main-content {
background-color: transparent;
}
.single-post #main-posts-cont {
border-bottom: 3px double #eee;
}
.contact-form {
background-color: white;
padding: 20px;
}
#comments,.contact-form, .author-bio, #main-content .widget-container {
padding:36px 20px !important;
background-color: white;
margin-bottom: 32px;
}
",
),
array(
"blog_demo" => '2',
"color_scheme" => "4",
"body_back_color" => "#F8F8F8",
"widget_border" => "div3",
"page_header" => 'on',
"page_header_bck_img" => BLOGCENTRAL_THEME_URL . "/images/preview/down-alley.jpg",
"page_header_bck_img_alt" => 'placeholder',
"page_header_bck_img_attachment" => 'fixed',
"page_header_bck_img_repeat" => "repeat",
"page_header_color" => "white",
"page_header_layout" => '2',
"breadcrumbs" => "on",
"default_user_img" => BLOGCENTRAL_THEME_URL . "/images/placeholder.png",
"default_user_img_alt" => 'default user image',
"contact_info" => array(
"contact_address" => "Cincinnati OH",
"address_icon" => "fa-home",
"contact_info_layout" =>' 1',
),
"header_sticky" => "on",
"logo" => BLOGCENTRAL_THEME_URL . "/images/preview/full-dark-logo.png",
"logo_alt" => "logo",
"submenu_back_color" => "#333",
"submenu_lnk_color" => "white",
"posts_general" => array(
"img_size" => "scale",
"standard_icon" => "fa-pencil",
"image_icon" => "fa-camera",
"audio_icon" => "fa-music",
"video_icon" => "fa-video-camera",
"gallery_icon" => "fa-picture-o",
"link_icon" => "fa-chain-broken",
"quote_icon" => "fa-quote-left",
"author_icon" => "fa-user",
"date_icon" => "fa-clock-o",
"categories_icon" => "fa-folder",
"tags_icon" => "fa-tags",
"comments_icon" => "fa-comments-o",
),
"posts_landing" => array(
"layout" => "layout1",
"cols" => "3",
"border" => "0",
"masonry" => "on",
"show_title" => "on",
"show_content" => "on",
"show_author" => "on",
"show_date" => "on",
"show_categories" => "on",
"show_tags" => "on",
"show_stats" => "on",
"show_social" => "on",
"share_title" => null,
"show_icons" => "on",
"post_meta_layout" => '1',
"gallery_slideshow" => "on",
"quote_layout" => '2',
),
"posts_single" => array(),
"footer_extended" => "on",
"copyright" => "
Copyright © 2015 " . get_bloginfo( 'name' ) . " All Rights Reserved.",
"custom_css" => "
#main-content {
background-color: transparent;
}
.single-post #main-posts-cont {
border-bottom: 3px double #eee;
}
.contact-form {
background-color: white;
padding: 20px;
}
#comments,.contact-form, .author-bio, #main-content .widget-container {
padding:36px 20px !important;
background-color: white;
margin-bottom: 32px;
}
",
),
array(
"blog_demo" => '3',
"color_scheme" => "4",
"body_back_color" => "#F8F8F8",
"widget_border" => "div3",
"page_header" => 'on',
"page_header_bck_img" => BLOGCENTRAL_THEME_URL . "/images/preview/down-alley.jpg",
"page_header_bck_img_alt" => 'placeholder',
"page_header_bck_img_attachment" => 'fixed',
"page_header_bck_img_repeat" => "repeat",
"page_header_color" => "white",
"page_header_layout" => '3',
"breadcrumbs" => "on",
"default_user_img" => BLOGCENTRAL_THEME_URL . "/images/placeholder.png",
"default_user_img_alt" => 'default user image',
"contact_info" => array(
"contact_address" => "Cincinnati OH",
"address_icon" => "fa-home",
"contact_info_layout" => '1',
),
"header_sticky" => "on",
"logo" => BLOGCENTRAL_THEME_URL . "/images/preview/full-dark-logo.png",
"logo_alt" => "logo",
"submenu_back_color" => "#333",
"submenu_lnk_color" => "white",
"posts_general" => array(
"img_size" => "scale",
"standard_icon" => "fa-pencil",
"image_icon" => "fa-camera",
"audio_icon" => "fa-music",
"video_icon" => "fa-video-camera",
"gallery_icon" => "fa-picture-o",
"link_icon" => "fa-chain-broken",
"quote_icon" => "fa-quote-left",
"author_icon" => "fa-user",
"date_icon" => "fa-clock-o",
"categories_icon" => "fa-folder",
"tags_icon" => "fa-tags",
"comments_icon" => "fa-comments-o",
),
"posts_landing" => array(
"layout" => "layout2",
"cols" => "1",
"border" => "0",
"masonry" => "on",
"show_title" => "on",
"show_content" => "on",
"show_author" => "on",
"show_date" => "on",
"show_categories" => "on",
"show_tags" => "on",
"show_stats" => "on",
"show_social" => "on",
"share_title" => null,
"show_icons" => "on",
"post_meta_layout" => '1',
"gallery_slideshow" => "on",
"quote_layout" => '2',
),
"posts_single" => array(
"override_landing" => "on",
"layout" => "layout1",
"cols" => "1",
"border" => "0",
"masonry" => "on",
"show_title" => "on",
"show_content" => "on",
"show_author" => "on",
"show_date" => "on",
"show_categories" => "on",
"show_tags" => "on",
"show_stats" => "on",
"show_social" => "on",
"share_title" => null,
"show_icons" => "on",
"post_meta_layout" => '1',
"gallery_slideshow" => "on",
"quote_layout" => '2',
),
"footer_extended" => "on",
"copyright" => "
Copyright © 2015 " . get_bloginfo( 'name' ) . " All Rights Reserved.",
"custom_css" => "
#main-content {
background-color: transparent;
}
.layout2.component .component-media-wrap {
margin-right: 0;
}
.single-post #main-posts-cont {
border-bottom: 3px double #eee;
}
.contact-form {
background-color: white;
padding: 20px;
}
#comments,.contact-form, .author-bio, #main-content .widget-container {
padding:36px 20px !important;
background-color: white;
margin-bottom: 32px;
}
",
),
);
return apply_filters( 'blogcentral_demos_opts', $blogcentral_demos_opts );
}
if ( ! function_exists( 'blogcentral_theme_setup' ) ) {
/**
* Theme setup
*
* @since 1.0.0
*/
function blogcentral_theme_setup() {
// Register the main navigation menu
register_nav_menu( 'primary', __( 'Primary Menu', BLOGCENTRAL_TXT_DOMAIN ) );
/*
* Make theme available for translation.
* Translations can be saved in the /languages/ directory.
*/
load_theme_textdomain( BLOGCENTRAL_TXT_DOMAIN, get_template_directory() . '/languages' );
// This theme styles the visual editor to resemble the theme style.
add_editor_style( array( 'css/editor-style.css' ) );
// Add RSS feed links to
' . __( 'Blog Demos', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'BlogCentral provides 3 predefined blog demos to choose. The demos define values for some of the theme options. Choosing a blog demo should be the first step, since it will delete all of your saved options. When you select the demo you would like to use, immediately click on the "Change Blog Demo" button, this will save the demo options as the theme options. You can further customize the options, if desired, by using the theme options page.', BLOGCENTRAL_TXT_DOMAIN ) . '
'; '' . __( 'Making your site look like the demos', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Your site will almost look exactly like the demos except for maybe, your logo, posts, and widgets. You can download an xml file for the demo content, which will include the posts. For the widgets, you will have to download the widgets.json file, and have the Widget Import/Export plugin installed and activated. For more detailed information read this tutorial.', BLOGCENTRAL_TXT_DOMAIN ) . '
'; return $html; } } if ( ! function_exists( 'blogcentral_construct_contact_help_tab' ) ) { /** * Construct help panel for the contact tab * * @since 1.0.0 * * @return string help instructions. */ function blogcentral_construct_contact_help_tab() { $html = '' . __( 'Icons', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'To choose an icon, click inside the input textbox.', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Contact Form', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'This theme is compatible with any plugin that displays contact forms via a shortcode. If you would like to display a contact form, enter the shortcode generated by the plugin in the textarea.', BLOGCENTRAL_TXT_DOMAIN ) . '
'; return $html; } } if ( ! function_exists( 'blogcentral_construct_typography_help_tab' ) ) { /** * Construct help panel for the typography tab * * @since 1.0.0 * * @return string help instructions. */ function blogcentral_construct_typography_help_tab() { $html = '' . __( 'You can customize the font family, weight and style, and subsets for the body text, headers, and menu items. Choose from traditional system fonts and google fonts.', BLOGCENTRAL_TXT_DOMAIN ) . '
'; return $html; } } if ( ! function_exists( 'blogcentral_construct_social_api_help_tab' ) ) { /** * Construct help panel for the social api tab * * @since 1.0.0 * * @return string help instructions. */ function blogcentral_construct_social_api_help_tab() { $html = '' . __( 'Third Party APIs', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'If you would like to use the facebook comments, and google maps and fonts, you must provide your API keys for each platform. Visit their website to obtain this information.', BLOGCENTRAL_TXT_DOMAIN ) . '
'; return $html; } } if ( ! function_exists( 'blogcentral_construct_colors_help_tab' ) ) { /** * Construct help panel for the general tab * * @since 1.0.0 * * @return string help instructions. */ function blogcentral_construct_colors_help_tab() { $html = '' . __( 'The "General Background, Colors, & Sizes" tab is where you can choose a color scheme, customize the color for the body text, links, and headers, and the background for the body, and main content, and the size of the header tags.', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Choosing Colors', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'BlogCentral uses the native Wordpress color picker to choose a color. You can also enter the color manually. Examples: #ffffff, rgb(255,255,255) or white.', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Background Images', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'There are two places you can set the background for the body. The first way to access this option is to navigate to "Appearance->Background" on the admin sidebar, click on the Color tab to choose a background color, or the "Background" tab to choose a background image. The second way is on the theme options page under the "General Background, Colors, & Sizes" tab. From there you can choose a background color or image for the body, but you also have options for attachment, position, and repeat. Note that setting these options via the first way will not set the options via the second way, and vice-versa. It is recommended not to use both ways to set the background for the body.', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Font sizes, padding, margins, widths and heights.', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Enter font sizes, padding, margins, widths, and heights with unit of measurement, eg. 12px, 1.2rem etc. For dimensions of an image, do not include a unit of measurement.', BLOGCENTRAL_TXT_DOMAIN ) . '
'; return $html; } } if ( ! function_exists( 'blogcentral_construct_header_help_tab' ) ) { /** * Construct help panel for the header tab * * @since 1.0.0 * * @return string help instructions. */ function blogcentral_construct_header_help_tab() { $html = '' . __( 'The "Header" tab is where you customize the appearance of the header. The header is the top area of the page that holds the logo, header widget, and the main navigation menu.', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Contact Information Display', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'BlogCentral provides options to display the contact information for a company or an individual. If you would like to display the contact information, the BlogCentral Shortcodes & Widgets Pack plugin must be installed and activated. If the option for a user id is blank, then the contact information entered in the contact tab on the theme\'s options page will be used, otherwise the contact information for the user of the provided user id will be displayed. For social media contacts, enter the full url, ie. http://www.facebook.com/username.', BLOGCENTRAL_TXT_DOMAIN ) . '
'; return $html; } } if ( ! function_exists( 'blogcentral_construct_nav_menu_help_tab' ) ) { /** * Construct help panel for the header tab * * @since 1.0.0 * * @return string help instructions. */ function blogcentral_construct_nav_menu_help_tab() { $html = '' . __( 'The "Main Navigation Menu" tab is where you customize the appearance of the main navigation menu and its submenus. You can customize the color for the background, links, and active links.', BLOGCENTRAL_TXT_DOMAIN ) . '
'; return $html; } } if ( ! function_exists( 'blogcentral_construct_page_header_help_tab' ) ) { /** * Construct help panel for the page header tab * * @since 1.0.0 * * @return string help instructions. */ function blogcentral_construct_page_header_help_tab() { $html = '' . __( 'The "Page Header" tab is where you customize the appearance of the page header. The page header sits immediately below the header. This area is widgetized and is also called the precontent widget. If no widgets are active, then it serves as the page header and a box with an image and an overlay that shows what page is being viewed, today\'s date, and the breadcrumbs will be shown, if enabled.', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Height', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'You can define a height for the page header, enter it with the unit of measurement, ex. 150px.', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Page Header Layouts', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'BlogCentral provides 3 page header layouts.', BLOGCENTRAL_TXT_DOMAIN ) . '
'; return $html; } } if ( ! function_exists( 'blogcentral_construct_posts_help_tab' ) ) { /** * Construct help panel for the posts tab * * @since 1.0.0 * * @return string help instructions. */ function blogcentral_construct_posts_help_tab() { $html = '' . __( 'Post Listing Pages', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Options on this page determine how posts listing is displayed on the front, archive, author, search, category and tags pages.', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'Single Post Page', BLOGCENTRAL_TXT_DOMAIN ) . '
' . __( 'BlogCentral offers the option to use the same settings of the landing page for the single post page. If you choose to override the settings, then none of them will be used for the single post page.', BLOGCENTRAL_TXT_DOMAIN ) . '
'; return $html; } } /** * 5.3 Controller + Save Theme Settings *-----------------------------------------------------------------------*/ if ( ! function_exists( 'blogcentral_front_controller' ) ) { /** * Route url requests to the appropriate function. * * @since 1.0.0 */ function blogcentral_front_controller() { $action = isset( $_GET['action'] ) ? $_GET['action'] : ( isset( $_POST['action'] ) ? $_POST['action'] : '' ); if ( isset( $_GET['page'] ) && 'blogcentral_options' === $_GET['page'] ) { switch ( $action ) { case 'blogcentral_options': default: blogcentral_theme_options(); } }// End if } } if ( ! function_exists( 'blogcentral_validate_options' ) ) { /** * Perform security checks on theme options * * Construct the google fonts url for any google font option selected. * * @since 1.0.0 */ function blogcentral_validate_options() { global $blogcentral_opts; global $blogcentral_defaults; $check_text = array( "body_bck_img_alt", "default_user_img_alt", 'contact_address', "contact_phone", "address_icon", "phone_icon", "url_icon", "email_icon", "facebook_icon", "twitter_icon", "google_icon", "linkedin_icon", "instagram_icon", "tumblr_icon", "pinterest_icon", "facebook_app_id", "google_app_id", "logo_alt", "img_size", "standard_icon", "image_icon", "audio_icon", "video_icon", "gallery_icon", "link_icon", "quote_icon", "author_icon", "date_icon", "categories_icon", "tags_icon", "comments_icon", ); $check_int = array( "color_scheme", "body_bck_img_width", "body_bck_img_height", "page_header_bck_img_width", "page_header_bck_img_height", "default_user_img_width", "default_user_img_height", "user_id", ); $check_url = array( 'contact_url', 'contact_facebook', 'contact_twitter', 'contact_google', 'contact_linkedin', 'contact_instagram', 'contact_tumblr', 'contact_pinterest', ); $check_email = array( 'contact_email', ); $check_html = array( 'copyright', ); $check_html_limited = array( 'title_text', 'tagline_text', "share_title", ); $check_html_class = array( "wrap_class", "title_class", ); // Only allow these tags with these attributes. $kses_allow = array( 'a' => array( 'href' => array(), 'title' => array(), ), 'br' => array(), 'span' => array( 'id' => array(), 'class' => array(), ), ); // Do server-side validations $excpts = false; $options = array(); if ( ! is_array( $_POST ) ) { // Error do not save. add_settings_error( 'Post-not-array', esc_attr( 'not-array' ), __( 'Error: The post variable is corrupted. Please contact the administrator.', BLOGCENTRAL_TXT_DOMAIN ), 'error' ); $excpts = true; } else { foreach ( $_POST['blogcentral'] as $post => $vpost ) { // First check if it is a valid theme option. if ( ! array_key_exists( $post, $blogcentral_defaults ) ) { continue; } if ( is_array( $vpost ) ) { $flag = false; $temp = array(); foreach ( $vpost as $key => $val ) { if ( '' !== $val ) { // Do security checks if ( in_array( $val, $check_text ) ) { $val = sanitize_text_field( $val ); } elseif ( in_array( $val, $check_url ) ) { $val = esc_url_raw( $val ); } elseif ( in_array( $val, $check_email ) ) { $val = sanitize_email( $val ); } elseif ( in_array( $val, $check_int ) ) { $val = absint( $val ); } elseif ( in_array( $val, $check_html ) ) { $val = wp_kses_post( $val ); } elseif ( in_array( $val, $check_html_limited ) ) { $val = wp_kses( $val, $kses_allow ); } elseif ( in_array( $val, $check_html_class ) ) { $val = sanitize_html_class( $val ); } $flag = true; $temp[$key] = $val; } } if ( $flag ) { $options[$post] = array(); $options[$post] = $temp; } } else { if ( '' !== $vpost ) { // Do security checks if ( in_array( $vpost, $check_text ) ) { $vpost = sanitize_text_field( $vpost ); } elseif ( in_array( $vpost, $check_url ) ) { $vpost = esc_url_raw( $vpost ); } elseif ( in_array( $vpost, $check_email ) ) { $vpost = sanitize_email( $vpost ); } elseif ( in_array( $vpost, $check_int ) ) { $vpost = absint( $vpost ); } elseif ( in_array( $vpost, $check_html ) ) { $vpost = wp_kses_post( $vpost ); } elseif ( in_array( $vpost, $check_html_limited ) ) { $vpost = wp_kses( $vpost, $kses_allow ); } elseif ( in_array( $vpost, $check_html_class ) ) { $vpost = sanitize_html_class( $vpost ); } $options[$post] = $vpost; } } } // Construct google fonts url to save to the database. $fonts = blogcentral_construct_google_fonts_url(); $options['google_fonts_url'] = $fonts; // Update global variable with new options $blogcentral_opts = $options; } // Output any errors or confirmation messages. if ( ! $excpts ) { add_settings_error( 'options-saved', esc_attr( 'options-saved' ), __( 'All options saved successfully!', BLOGCENTRAL_TXT_DOMAIN ), 'updated' ); } return $options; } } if ( ! function_exists( 'blogcentral_admin_notices' ) ) { /** * Output any admin notices * * @since 1.0.0 */ function blogcentral_admin_notices() { settings_errors(); } } if ( ! function_exists( 'blogcentral_change_blog_demo' ) ) { /** * Change the blog demo and save options to database. * * @since 1.0.0 * * @param string $selected Optional. Saved border. */ function blogcentral_change_blog_demo() { // Check nonce. $nonce = $_REQUEST['blogcentral_demo_nonce']; if ( ! wp_verify_nonce( $nonce, 'blogcentral-change-demo' ) ) { // This nonce is not valid. die( 'No Swiping' ); } else { global $blogcentral_opts; global $blogcentral_blog_demos_opts; $template = isset( $_POST['blogcentral']['blog_demo'] ) ? $_POST['blogcentral']['blog_demo'] : ''; if ( empty( $template ) && '0' !== $template ) { // Error $_POST['messages'] = array( __( 'Please select a blog demo', BLOGCENTRAL_TXT_DOMAIN ) ); return; } if ( '0' === $template ) { $_POST['messages'] = array( __( "If you do not want to use a blog demo, and you need to save your options, click the 'Save Options' button.", BLOGCENTRAL_TXT_DOMAIN ) ); return; } // Save options. update_option( BLOGCENTRAL_DB_OPTIONS_NAME, $blogcentral_blog_demos_opts[ $template - 1 ] ); // Update global variable with new options $blogcentral_opts = $blogcentral_blog_demos_opts[ $template - 1 ]; $_POST['messages'] = array( __( 'Blog Demo Changed Successfully!', BLOGCENTRAL_TXT_DOMAIN ) ); } } } /** * 5.4 Theme Options *-----------------------------------------------------------------------*/ /** * 5.4.1 Main *-----------------------------------------------------------------------*/ if ( ! function_exists( 'blogcentral_get_field_name_wrap' ) ) { /** * Construct name of input field for use on the theme options page, and if the BlogCental Shortcodes & Widgets Pack plugin is installed, on the shortcode, and widget options pages. * * A wrapper used to name a field regularly or, if displaying options for a widget, use the widgets' * get_field_name method. * * @since 1.0.0 * * @param string $name Required. Name of input field. * @param string $name_attr_pre Required. Name prefix of input field. * @param object $widget Optional. Widget object to display options for. * @return string. Modified name of input field. */ function blogcentral_get_field_name_wrap( $name, $name_attr_pre, & $widget = false ) { if ( empty( $name ) || empty( $name_attr_pre ) ) { return; } else { $frag = "[$name]"; } return ( $widget ? $widget->get_field_name( $name ) : $name_attr_pre . $frag ); } } if ( ! function_exists( 'blogcentral_get_field_id_wrap' ) ) { /** * Construct id for use on the theme options page, and if the BlogCental Shortcodes & Widgets Pack plugin is installed, on the shortcode, and widget options pages. * * A wrapper used to create an id. if displaying options for a widget, uses the widgets' * get_field_id method. * * @since 1.0.0 * * @param string $id Required. Id of input field. * @param string $name_attr_pre Optional. Prefix for name attribute. * @param object $widget Optional. Widget object if displaying options for a widget. * @return string. Modified name of input field. */ function blogcentral_get_field_id_wrap( $id, $name_attr_pre, & $widget = false ) { if ( empty( $name_attr_pre ) ) { return; } return ( $widget ? $widget->get_field_id( $id ) : $name_attr_pre . '-' . $id ); } } if ( ! function_exists( 'blogcentral_register_theme_options' ) ) { /** * Register theme options with the settings api * * @since 1.0.0 */ function blogcentral_register_theme_options() { register_setting( 'blogcentral', BLOGCENTRAL_DB_OPTIONS_NAME, 'blogcentral_validate_options' ); } } if ( ! function_exists( 'blogcentral_theme_options' ) ) { /** * Display the theme options page. * * @since 1.0.0 */ function blogcentral_theme_options() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.', BLOGCENTRAL_TXT_DOMAIN ) ); } // Get the saved settings. global $blogcentral_opts; global $blogcentral_defaults; global $blogcentral_initial; // Global plugin object. global $bcswp_plugin; $saved = $blogcentral_opts; if ( ! empty( $saved ) ) { $saved = array_map( 'stripslashes_deep', $saved ); foreach ( $saved as $key => $val ) { if ( is_array( $val ) ) { $saved[$key] = wp_parse_args( $saved[$key], $blogcentral_defaults[$key] ); } } $saved = wp_parse_args( $saved, $blogcentral_defaults ); } else { $saved = $blogcentral_initial; } $show_contact = $saved['show_contact'] ? true : false; $widget_border = $saved['widget_border'] ? $saved['widget_border'] : ''; ?>"; _e( 'Layout - choose from 3 different layouts.', BLOGCENTRAL_TXT_DOMAIN ); echo "
| " . __( 'Layout', BLOGCENTRAL_TXT_DOMAIN ) . " |
";
for ( $i = 1; $i < 4; ++$i ) {
echo "
';
// Ending "; } echo ' | tag is in the display_component_layout_wraps function.
}
}
if ( ! function_exists( 'blogcentral_display_component_layout_wraps' ) ) {
/**
* Construct and display options for layout containers.
*
* These containers holds options that are specific to the layout chosen.
*
* @since 1.0.0
*
* @param array $opts Optional. Saved options.
* @param object $widget Optional. Widget object if displaying options for a widget.
*/
function blogcentral_display_component_layout_wraps( $opts, & $widget = false ) {
$layout = $opts ? ( isset( $opts['layout'] ) ? $opts['layout'] : 'layout1' ) : 'layout1';
$name = isset( $opts['name'] ) ? esc_html( $opts['name'] ) : '';
echo "
" . __( 'Content under media', BLOGCENTRAL_TXT_DOMAIN ) . "
" . __( 'Content floated to right of media, in a two column design.', BLOGCENTRAL_TXT_DOMAIN ) . " " . __( 'Text Layout, no media will be displayed.', BLOGCENTRAL_TXT_DOMAIN ) . "
|
|---|
"; _e( 'General Options', BLOGCENTRAL_TXT_DOMAIN ); echo "
| " . __( 'How many columns?', BLOGCENTRAL_TXT_DOMAIN ) . " | |
|---|---|
| " . __( 'Border for each post', BLOGCENTRAL_TXT_DOMAIN ) . " |
|
| " . __( 'Masonry display', BLOGCENTRAL_TXT_DOMAIN ) . " |
|
| " . __( 'Alternate background color', BLOGCENTRAL_TXT_DOMAIN ) . " |
|
"; _e( 'Custom Text', BLOGCENTRAL_TXT_DOMAIN ); echo "
| " . __( 'Title', BLOGCENTRAL_TXT_DOMAIN ) . " | |
|---|---|
| " . __( 'Title Border Style', BLOGCENTRAL_TXT_DOMAIN ) . " |
";
if ( 'default' !== $opts['title_border'] && ( '0' !== $opts['title_border'] ) ) :
echo "$opts[title_border]";
else :
echo "";
endif;
echo " "; _e( 'Border style for the title.', BLOGCENTRAL_TXT_DOMAIN ); echo " |
| " . __( 'Tagline Text', BLOGCENTRAL_TXT_DOMAIN ) . " |
"; _e( 'The text below the title', BLOGCENTRAL_TXT_DOMAIN ); echo " |
| " . __( 'Tagline Border Style', BLOGCENTRAL_TXT_DOMAIN ) . " |
";
if ( 'default' !== $opts['tagline_border'] && ( '0' !== $opts['tagline_border'] ) ) :
echo "$opts[tagline_border]";
else :
echo "";
endif;
echo " "; _e( 'Border style for the tagline.', BLOGCENTRAL_TXT_DOMAIN ); echo " |
"; _e( 'Custom Classes', BLOGCENTRAL_TXT_DOMAIN ); // The wrap class will be added to the most outer div of the component. echo "
| " . __( 'Wrap Classes', BLOGCENTRAL_TXT_DOMAIN ) . " |
"; _e( 'Default class is components-wrap, you can add more classes, separate them with a space.', BLOGCENTRAL_TXT_DOMAIN ); echo " |
|---|---|
| " . __( 'Header Classes', BLOGCENTRAL_TXT_DOMAIN ) . " |
"; _e( 'Separate classes with a space.', BLOGCENTRAL_TXT_DOMAIN ); echo " |
| ' . __( 'Featured Post Image(s) Size', BLOGCENTRAL_TXT_DOMAIN ) . ' |
|
|---|---|
| ' . __( 'Sticky Posts Display', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Default Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Image Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Audio Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Video Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Gallery Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Link Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Quote Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Author Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Date Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Categories List Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Tags List Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Comments Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' |
' . __( 'Post Data', BLOGCENTRAL_TXT_DOMAIN ) . '
| ' . __( 'Title', BLOGCENTRAL_TXT_DOMAIN ) . ' |
|
|---|---|
| ' . __( 'Post Content', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Author', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Post Date', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Categories', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Tags', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Stats', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Social Share', BLOGCENTRAL_TXT_DOMAIN ) . ' | '; blogcentral_display_social_share_opts( $opts, $widget ); echo ' |
| ' . __( 'Show Icons', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Post Meta Layout', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Gallery Posts', BLOGCENTRAL_TXT_DOMAIN ) . ' |
|
| ' . __( 'Quote Posts Layout', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Post Format Icon', BLOGCENTRAL_TXT_DOMAIN ) . ' |
' . __( 'Query Options', BLOGCENTRAL_TXT_DOMAIN ) . '
| ' . __( 'Ignore Sticky Posts', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
|---|---|
| ' . __( 'Show only sticky posts', BLOGCENTRAL_TXT_DOMAIN ) . ' | |
| ' . __( 'Number of posts to display', BLOGCENTRAL_TXT_DOMAIN ) . ' |
'; _e( 'Default is to display all posts.', BLOGCENTRAL_TXT_DOMAIN ); echo ' |
tags are allowed. remove_filter( 'term_description', 'wpautop' ); /** * 6.3 Construct meta tags *-----------------------------------------------------------------------*/ /** * Construct the meta tags to be added to the header * * Construct static and dynamic meta tags. * * @since 1.0.0 */ function blogcentral_construct_meta_tag() { echo ''; } /** * 6.4 Body Class *-----------------------------------------------------------------------*/ if ( ! function_exists( 'blogcentral_body_class' ) ) { /** * Construct the classes to be added to the body tag * * Uses the body_class filter. * * @since 1.0.0 * * @param array $classes Required. Array of classes. * @return array $classes. Classes to be added to the body tag, augmented with the theme's classes. */ function blogcentral_body_class( $classes ) { // Global variable that holds the theme options. global $blogcentral_opts; if ( ! is_multi_author() ) { $classes[] = 'single-author'; } if ( is_active_sidebar( 'sidebar-rght' ) && ! is_attachment() && ! is_404() ) { $classes[] = 'sidebar'; } if ( ! get_option( 'show_avatars' ) ) { $classes[] = 'no-avatars'; } if ( isset( $blogcentral_opts['color_scheme'] ) ) { $scheme = $blogcentral_opts['color_scheme']; } if ( isset( $scheme ) && 'none' !== $scheme ) { $classes[] = 'color-scheme' . esc_html( $scheme ); } $classes[] = ' color-scheme'; if ( isset( $blogcentral_opts['block_display'] ) ) { $classes[] = 'block-display'; } if ( isset( $blogcentral_opts['box_display'] ) ) { $classes[] = 'box-display'; } return $classes; } } /** * 6.5 Page Header/Precontent Area *-----------------------------------------------------------------------*/ if ( ! function_exists( 'blogcentral_get_todays_date' ) ) { /** * Display today's date * * @since 1.0.0 */ function blogcentral_get_todays_date() { print strftime('%A %B %d, %Y'); } } if ( ! function_exists( 'blogcentral_display_breadcrumbs' ) ) { /** * Construct and display the breadcrumbs * * @since 1.0.0 */ function blogcentral_display_breadcrumbs() { global $post; // If on home page, no need to display the breadcrumbs. if ( is_home() ) { return ''; } echo '
'; } } if ( ! function_exists( 'blogcentral_output_precontent_frag' ) ) { /** * Construct and display html for the precontent widget area, which will hold the breadcrumbs, today's date, and * title of the page, only if no active widgets in this area * * @since 1.0.0 * * @param array $opts Required. Various options set on the theme's options page * @param string $title Optional. Text to display to indicate what page is being viewed. * @param boolean $about_me Optional. Is this the precontent area for about me page?. */ function blogcentral_output_precontent_frag( $opts, $title = '', $about_me = false ) { $breadcrumbs = isset( $opts['breadcrumbs'] ) ? $opts['breadcrumbs'] : ''; $page_header = isset( $opts['page_header'] ) ? $opts['page_header'] : ''; $page_header_style = $crumbs = $todays_date = $crumbs_style = $page_class = $page_title_class = $page_header_title = ''; // Add classes for an overlay if ( isset( $opts['page_header_bck_img'] ) ) { $page_header_img = $opts['page_header_bck_img']; $page_class .= ' fixed-height'; } else { $page_header_img = ''; $page_title_class = ''; } if ( isset( $opts['page_header_bck_img'] ) && $opts['page_header_bck_img'] ) { $page_title_class = ' class="overlay"'; } else { $page_title_class = ' class="no-overlay"'; } // Add class for the page header layout. if ( isset( $opts['page_header_layout'] ) ) { if ( '2' === $opts['page_header_layout'] ) { $page_class .= ' layout2'; } elseif ( '3' === $opts['page_header_layout'] ) { $page_class .= ' layout3'; } } // Construct breadcrumbs. if ( $breadcrumbs && ! is_home() ) { ob_start(); blogcentral_display_breadcrumbs(); $crumbs .= ob_get_clean(); } // Construct today's date. if ( isset( $opts['show_todays_date'] ) ) { $todays_date = '' . __( 'Today is ', BLOGCENTRAL_TXT_DOMAIN ) . ''; ob_start(); blogcentral_get_todays_date(); $todays_date .= ob_get_clean() . ''; } /* * If no active widgets, then show a background image with an overlay that shows what the user is * viewing, e.g. blog, category, etc. */ $active_sidebar = false; $container_id = ''; if ( $about_me ) { $active_sidebar = is_active_sidebar( 'precontent-widget-about-me' ); $dynamic_sidebar = $container_id = "precontent-widget-about-me"; } else { $dynamic_sidebar = "precontent-widget"; $active_sidebar = is_active_sidebar( 'precontent-widget' ); $container_id = "precontent-widget-cont"; } if ( $active_sidebar ) { echo '', '' ); ?>