1,
"logo_uploader" => "",
"logo_border_radio" => "noborder",
"intro_background" => "",
"intro_image_uploader" => "",
"intro_text_editor" => "",
"default_thumbnail_uploader" => "",
"intro_slabtext_checkbox" => 1,
"custom_css_editor" => "",
"link_color" => "",
"facebook_comment_checkbox" => 0,
"facebook_app_id" => "",
"fontface_radio" => ""
);
if($blogberry["fontface_radio"] == "") {
if(!is_array($fontface_files) || (count($fontface_files) == 0))
$fontface_files = get_fontface_files();
reset($fontface_files);
$blogberry["fontface_radio"] = key($fontface_files);
}
function has_logo() {
global $blogberry;
return intval($blogberry['logo_checkbox']);
}
function logo() {
global $blogberry;
echo $blogberry['logo_uploader'];
}
function get_logo() {
global $blogberry;
return $blogberry['logo_uploader'];
}
function has_logo_border() {
global $blogberry;
return !strcmp($blogberry['logo_border_radio'], 'bordered');
}
function intro_background() {
global $blogberry;
echo $blogberry['intro_background'];
}
function get_intro_background() {
global $blogberry;
return $blogberry['intro_background'];
}
function intro_image() {
global $blogberry;
echo $blogberry['intro_image_uploader'];
}
function get_intro_image() {
global $blogberry;
return $blogberry['intro_image_uploader'];
}
function get_intro_text() {
global $blogberry;
$return = $blogberry['intro_text_editor'];
if(trim($return) != '') {
$return = str_replace(" ", " ", $return);
$return = str_replace("\r", "", $return);
while(false !== strpos($return, " ")) {
$return = str_replace(" ", " ", $return);
}
$return = str_replace("\n ", "\n", $return);
$return = str_replace(" \n", "\n", $return);
while(strpos($return, "\n\n")) {
$return = str_replace("\n\n", "\n", $return);
}
} else {
$return = 'INTRO AREA, INTRODUCE YOURSELF HERE.
YOU CAN CHANGE TEXT, BACKGROUND COLOR AND BACKGROUND IMAGE
CLICK TO EDIT THIS TEXT.';
}
return $return;
}
function intro_text() {
echo nl2br(trim(get_intro_text()));
}
function intro_text_with_slabtext() {
global $blogberry;
$return = $blogberry['intro_text_editor'];
if(trim($return) != '') {
$return = str_replace(" ", " ", $return);
$return = str_replace("\r", "", $return);
while(false !== strpos($return, " ")) {
$return = str_replace(" ", " ", $return);
}
$return = str_replace("\n ", "\n", $return);
$return = str_replace(" \n", "\n", $return);
while(strpos($return, "\n\n")) {
$return = str_replace("\n\n", "\n", $return);
}
$return_with_slabtext = '';
foreach(explode("\n", trim($return)) as $_line) {
$return_with_slabtext .= ''.$_line.'';
}
} else {
$return_with_slabtext = 'INTRO AREA, INTRODUCE YOURSELF HERE. YOU CAN CHANGE TEXT, BACKGROUND COLOR AND BACKGROUND IMAGE
CLICK TO EDIT THIS TEXT.';
}
echo $return_with_slabtext;
}
function default_thumbnail() {
global $blogberry;
echo $blogberry['default_thumbnail_uploader'];
}
function get_default_thumbnail() {
global $blogberry;
return $blogberry['default_thumbnail_uploader'];
}
function use_intro_slabtext() {
global $blogberry;
return intval($blogberry['intro_slabtext_checkbox']);
}
function custom_css() {
global $blogberry;
echo $blogberry['custom_css_editor'];
}
function get_custom_css() {
global $blogberry;
return $blogberry['custom_css_editor'];
}
function link_color() {
global $blogberry;
echo $blogberry['link_color'];
}
function get_link_color() {
global $blogberry;
return $blogberry['link_color'];
}
function use_facebook_comment() {
global $blogberry;
return intval($blogberry['facebook_comment_checkbox']);
}
function facebook_app_id() {
global $blogberry;
echo $blogberry['facebook_app_id'];
}
function get_facebook_app_id() {
global $blogberry;
return $blogberry['facebook_app_id'];
}
function footer_text() {
global $blogberry;
echo $blogberry['footer_text_editor'];
}
function get_footer_text() {
global $blogberry;
return $blogberry['footer_text_editor'];
}
function fontface() {
global $blogberry;
echo $blogberry['fontface_radio'];
}
function get_fontface() {
global $blogberry;
return $blogberry['fontface_radio'];
}
function get_blogberry_logo_border_style() {
$return = '';
if(has_logo() && has_logo_border())
$return = 'bordered';
else
$return = 'noborder';
return $return;
}
function blogberry_logo_border_style() {
echo get_blogberry_logo_border_style();
}
function get_blogberry_logo() {
$logo = '';
if(has_logo()) {
$img = trim(get_logo());
$root_path = rtrim(realpath(dirname(__FILE__)."/../../../../"), "/\\");
if(strpos($img, home_url() ) !== false) {
$img = $root_path."/".ltrim(str_replace(home_url() , '', $img), '/');
}
if($img != '') {
if(has_logo_border()) {
$image = vt_resize('', $img, 150, 150, true);
$image['url'] = rtrim(home_url(), "/")."/".ltrim(str_replace($root_path, '', $image['url']), "/");
$logo = '
';
} else {
$image = vt_resize('', $img, 150, 1000, false);
$image['url'] = rtrim(home_url(), "/")."/".ltrim(str_replace($root_path, '', $image['url']), "/");
$logo = '
';
}
}
else {
$logo = '
Edit this logo';
}
}
return $logo;
}
function blogberry_logo() {
echo get_blogberry_logo();
}
function blogberry_head() {
global $blogberry;
global $post;
$head = '';
$type = is_singular() ? "article" : "website";
$title = wp_title('«', false, 'right');
$url = "http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
$image = "";
if(is_front_page()) {
$image = get_logo();
} else if(is_singular()) {
$post_thumbnail_id = get_post_thumbnail_id( $post->ID);
$image_properties = wp_get_attachment_image_src($post_thumbnail_id, "full");
$image = $image_properties[0];
}
if(trim($image) == "")
$image = get_stylesheet_directory_uri()."/img/seed-core/img/default-logo.png";
$path = substr($image, 0, strrpos($image, "/"));
$filename = substr($image, strrpos($image, "/") + 1);
$image = $path."/".urlencode($filename);
$site_name = get_bloginfo('name');
$descriptions = strip_tags(htmlspecialchars(get_bloginfo('description')));
if(is_singular()) {
$post_data = get_post( $post->ID );
the_post();
$excerpt = htmlspecialchars(get_the_excerpt());
rewind_posts();
$descriptions = strip_tags(htmlspecialchars($excerpt));
}
$app_id = get_facebook_app_id();
$head .= ''."\r\n";
$head .= ''."\r\n";
$head .= ''."\r\n";
$head .= ''."\r\n";
$head .= ''."\r\n";
if($app_id != '') {
$head .= ' '."\r\n";
}
$head .= ''."\r\n";
$head .= "\r\n";
$head .= '\r\n";
if($head != '')
?>
\r\n";
} else {
$foot .= "\r\n";
}
$foot .= "\r\n";
if($foot != '')
?>
$_files) {
if(count($_files) == 4) {
$fontface_css = "@font-face {\r\n";
$fontface_css .= " font-family: '".$_name."';\r\n";
$fontface_css .= " src: url('".get_bloginfo('stylesheet_directory')."/seed-custom/font/".$_name.".eot');\r\n";
$fontface_css .= " src: url('".get_bloginfo('stylesheet_directory')."/seed-custom/font/".$_name.".eot?#iefix') format('embedded-opentype'),\r\n";
$fontface_css .= " url('".get_bloginfo('stylesheet_directory')."/seed-custom/font/".$_name.".woff') format('woff'),\r\n";
$fontface_css .= " url('".get_bloginfo('stylesheet_directory')."/seed-custom/font/".$_name.".ttf') format('truetype'),\r\n";
$fontface_css .= " url('".get_bloginfo('stylesheet_directory')."/seed-custom/font/".$_name.".svg#".$_name."') format('svg');\r\n";
$fontface_css .= " font-weight: normal;font-style: normal;\r\n";
$fontface_css .= "}\r\n";
$fontface_files[$_name] = $fontface_css;
}
}
return $fontface_files;
}
// Add specific CSS class by filter
add_filter('body_class','add_font_class');
function add_font_class($classes) {
$font = get_fontface();
if(substr($font, -3) == '-th') {
$classes[] = 'font-th';
} elseif(substr($font, -9) == '-th-large') {
$classes[] = 'font-th-large';
}
return $classes;
}
function blogberry_admin_theme_style() {
wp_enqueue_style('seed-admin-theme', get_template_directory_uri().'/seed-custom/css/admin.css');
}
add_action('admin_enqueue_scripts', 'blogberry_admin_theme_style');
add_action('login_enqueue_scripts', 'blogberry_admin_theme_style');