init(); $helper = new \bluesquirrel\Helper(); $data = array( 'bluesquirrel_theme_list_image' => $data_proc->option_default_filter('bluesquirrel_theme_list_image'), 'bluesquirrel_theme_hang_image' => $data_proc->option_default_filter('bluesquirrel_theme_hang_image'), 'bluesquirrel_theme_slider_button' => $data_proc->option_default_filter('bluesquirrel_theme_slider_button'), 'bluesquirrel_theme_slider_button_active' => $data_proc->option_default_filter('bluesquirrel_theme_slider_button_active'), 'bluesquirrel_theme_own_slider' => $data_proc->option_default_filter('bluesquirrel_theme_own_slider'), 'bluesquirrel_number_first_menu' => $data_proc->option_default_filter('bluesquirrel_number_first_menu'), 'bluesquirrel_number_second_menu' => $data_proc->option_default_filter('bluesquirrel_number_second_menu'), 'bluesquirrel_first_menu_section_width' => $data_proc->option_default_filter('bluesquirrel_first_menu_section_width'), 'bluesquirrel_second_menu_section_width' => $data_proc->option_default_filter('bluesquirrel_second_menu_section_width'), 'bluesquirrel_logo' => $data_proc->option_default_filter('bluesquirrel_logo'), 'bluesquirrel_logo_use' => $data_proc->option_default_filter('bluesquirrel_logo_use'), 'bluesquirrel_insert_top' => $data_proc->option_default_filter('bluesquirrel_insert_top'), 'bluesquirrel_single_page_use' => $data_proc->option_default_filter('bluesquirrel_single_page_use'), 'bluesquirrel_color_scheme' => $data_proc->option_default_filter('bluesquirrel_color_scheme'), 'bluesquirrel_lower_resolution_start_width' => $data_proc->option_default_filter('bluesquirrel_lower_resolution_start_width'), 'bluesquirrel_hide_sidebar' => $data_proc->option_default_filter('bluesquirrel_hide_sidebar'), ); return $data; } //Prepare data for header public function get_init_topsection_data(){ $data_proc = new \bluesquirrel\Data_Processing(); $data_proc->init(); $style = new \bluesquirrel\Stylesheets(); $data = array( 'bluesquirrel_logo' => $data_proc->option_default_filter('bluesquirrel_logo'), 'bluesquirrel_logo_use' => $data_proc->option_default_filter('bluesquirrel_logo_use'), 'bluesquirrel_theme_list_image' => $data_proc->option_default_filter('bluesquirrel_theme_list_image'), 'bluesquirrel_theme_hang_image' => $data_proc->option_default_filter('bluesquirrel_theme_hang_image'), 'bluesquirrel_body_classes' => $data_proc->option_default_filter('bluesquirrel_body_classes'), 'bluesquirrel_favicon' => $data_proc->option_default_filter('bluesquirrel_favicon'), 'bluesquirrel_color_scheme_style' => $style->scheme_to_prefix($data_proc->option_default_filter('bluesquirrel_color_scheme')), ); return $data; } //Prepare data for header public function get_init_invitation_data(){ $data_proc = new \bluesquirrel\Data_Processing(); $data_proc->init(); $style = new \bluesquirrel\Stylesheets(); $data = array( 'bluesquirrel_color_scheme_style' => $style->scheme_to_prefix($data_proc->option_default_filter('bluesquirrel_color_scheme')) ); $invites = $data_proc->option_default_filter('bluesquirrel_invitation_pages'); $check = $this->check_page_for_invitation($invites); if ($check !== false) { $data['bluesquirrel_invitation_page'] = $invites[$check]; } return $data; } //Prepare data for footer public function get_init_footer_data(){ $data_proc = new \bluesquirrel\Data_Processing(); $data_proc->init(); $style = new \bluesquirrel\Stylesheets(); $data = array( 'bluesquirrel_company_info' => $data_proc->option_default_filter('bluesquirrel_company_info'), ); return $data; } //Checking page for slider public function check_page_for_invitation($invites) { $data_proc = new \bluesquirrel\Data_Processing(); $data_proc->init(); $result = false; foreach ($invites as $key=>$invite) { if ($this->check_cur_doc_for_invite($invite['invitation_page'])) $result = $key; } return $result; } public function check_cur_doc_for_invite($page) { return is_page((int)$page); } //Prepare data for sidebar public function get_sidebar_show(){ $data_proc = new \bluesquirrel\Data_Processing(); $data_proc->init(); $data = array( 'bluesquirrel_hide_sidebar' => $data_proc->option_default_filter('bluesquirrel_hide_sidebar'), ); return $data; } //Prepare data for template selection public function get_check_template(){ $data_proc = new \bluesquirrel\Data_Processing(); $data_proc->init(); $data = array( 'bluesquirrel_single_page_use' => $data_proc->option_default_filter('bluesquirrel_single_page_use'), ); return $data; } //Prepare data for entries template public function get_entries_data(){ $data_proc = new \bluesquirrel\Data_Processing(); $data_proc->init(); $data = array( 'bluesquirrel_bs_is_excerpt' => $data_proc->option_default_filter('bluesquirrel_bs_is_excerpt'), ); return $data; } //Prepare data for social buttons template public function get_social_buttons(){ $data_proc = new \bluesquirrel\Data_Processing(); $data_proc->init(); $data = array( 'bluesquirrel_social' => $data_proc->option_default_filter('bluesquirrel_social'), ); return $data; } //Output js & css files in the head public function front_styles_and_scripts_in_head(){ wp_register_style('main-style', get_stylesheet_uri()); wp_enqueue_style('main-style'); } //Output js & css files in the body public function front_styles_and_scripts(){ //$front = new \bluesquirrel\Front_Settings(); $data = $this->get_init_js_data(); $check = $this->check_page_for_slider($data['bluesquirrel_theme_own_slider']['slider']); $helper = new \bluesquirrel\Helper(); $helper->addScrypt('modernizr-js', 'js/modernizr-custom.js', array('jquery',)); $helper->addScrypt('main-js', 'js/main.js', array('jquery',)); $helper->addScrypt('helper-js', 'js/helper.js', array('jquery',)); if ($data['bluesquirrel_single_page_use'] == "0"){ $helper->addScrypt('menu-js', 'js/menu.js', array('jquery',)); } if ($check !== false) : $helper->addScrypt('slider-js', 'js/slider.js', array('jquery',)); endif; if ( is_singular() ) wp_enqueue_script( "comment-reply" ); $load_path = array( esc_url(get_template_directory_uri()), ($check) ? "0" : "1", ($data['bluesquirrel_insert_top']=="1") ? __('[top]', 'blue-squirrel') : "", $data['bluesquirrel_hide_sidebar']); wp_localize_script( 'main-js', 'path', $load_path ); $style = new \bluesquirrel\Stylesheets(); if ($data['bluesquirrel_single_page_use'] == "0"){ $menu_settings = array('path'=> esc_url(get_template_directory_uri()), 'bluesquirrel_number_first_menu' => $data['bluesquirrel_number_first_menu'], 'bluesquirrel_number_second_menu' => $data['bluesquirrel_number_second_menu'], 'bluesquirrel_first_menu_section_width' => $data['bluesquirrel_first_menu_section_width'], 'bluesquirrel_second_menu_section_width' => $data['bluesquirrel_second_menu_section_width'], "is_rtl" => (is_rtl() ? "1":"0"), 'style'=> $style->scheme_to_prefix($data['bluesquirrel_color_scheme']), 'bluesquirrel_lower_resolution_start_width' => $data['bluesquirrel_lower_resolution_start_width']); wp_localize_script( 'menu-js', 'local_options', $menu_settings ); } if ($check !== false) : $img_src = array(); $img_info = array(); $img_fnames = array(); $img_dir = array(); $inner_html = array(); foreach ($data['bluesquirrel_theme_own_slider']['slider'][$check][0]['elems'] as $key=>$elem) { $img_src[] = $elem['simg']; $img_info[] = array($elem['class'], $elem['alt'], $elem['title']); $img_fnames[] = $elem['fnames']; $img_dir[] = $elem['dir']; $inner_html[] = stripslashes($elem['sdiv']); } $slider_settings = array('width'=> $data['bluesquirrel_theme_own_slider']['slider'][$check]['width'], 'height' => $data['bluesquirrel_theme_own_slider']['slider'][$check]['height'], 'content_div' => '.simple_slider_content', 'slide_delay' => $data['bluesquirrel_theme_own_slider']['slider'][$check]['duration'], 'effect_duration' => $data['bluesquirrel_theme_own_slider']['slider'][$check]['duration_effect'], 'preloader' => '.preloader', 'slider_button' => $data['bluesquirrel_theme_slider_button'], 'slider_button_active' => $data['bluesquirrel_theme_slider_button_active'], 'slider_button_div' => ".slider_buttons", 'main_wrapper_div' => '.simple_slider_wrapper', "path" => '"'.esc_url(get_template_directory_uri()).'"', 'img_src' => $img_src, 'img_info' => $img_info, 'img_fnames' => $img_fnames, 'img_dir' => $img_dir, 'inner_html' => $inner_html, "is_rtl" => (is_rtl() ? "1":"0"), 'bluesquirrel_hide_sidebar' => $data['bluesquirrel_hide_sidebar']); wp_localize_script( 'slider-js', 'slider_settings', $slider_settings ); endif; } //Checking page for slider public function check_page_for_slider($sliders) { $data_proc = new \bluesquirrel\Data_Processing(); $data_proc->init(); //$slider_pages = $data_proc->option_default_filter('bluesquirrel_theme_slider_page'); $result = false; foreach ($sliders as $key=>$slider) { list($slider_page, $spage) = explode(":", $slider['page']); if ($this->check_cur_doc($slider_page, $spage)) $result = $key; } return $result; } public function check_cur_doc($slider_page, $spage){ switch ((int)$slider_page) { case 0: return false; break; case 1 : return true; break; case 2 : return (is_front_page()); break; case 3 : return is_search(); break; case 4 : return is_single(); break; case 5 : return is_page(); break; case 6 : return is_page((int)$spage); break; case 7 : return is_tag(); break; case 8 : return is_author(); break; case 9 : return is_archive(); break; case 10 : return is_search(); break; case 11 : return is_singular(); break; case 12 : return is_user_logged_in(); break; case 14 : return is_sticky(); break; } } //Front attachment info public function wp_get_attachment( $attachment_id ) { $attachment = get_post( $attachment_id ); return array( 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), 'title' => $attachment->post_title ); } //Front full attachment info function wp_get_attachment_full( $attachment_id ) { $attachment = get_post( $attachment_id ); return array( 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content, 'href' => get_permalink( $attachment->ID ), 'src' => $attachment->guid, 'title' => $attachment->post_title, 'id' => $attachment->ID ); } //Front social key into caption function social_key_to_title( $key ) { switch ($key) { case 'amazon' : return __("Amazon", "blue-squirrel"); break; case 'google_plus' : return __("Google Plus", "blue-squirrel"); break; case 'facebook' : return __("FaceBook", "blue-squirrel"); break; case 'instagram' : return __("Instagram", "blue-squirrel"); break; case 'twitter' : return __("Twitter", "blue-squirrel"); break; case 'vk' : return __("Vk", "blue-squirrel"); break; case 'youtube' : return __("Youtube", "blue-squirrel"); break; case 'vimeo' : return __("Vimeo", "blue-squirrel"); break; case 'flickr' : return __("Flickr", "blue-squirrel"); break; case 'tumblr' : return __("Tumblr", "blue-squirrel"); break; case 'rss' : return __("RSS", "blue-squirrel"); break; } } } ?>