function td_theme_panel() { //the default image for wp-admin panel td_js_buffer::add_variable('td_admin_first_image', get_template_directory_uri() . '/wp-admin/images/panel/bg/1.jpg'); //run the wp-admin panel background td_js_buffer::add_to_wp_admin_footer("jQuery('#wpwrap').backstretch(td_admin_first_image, {fade: 800});"); //addi echo "<style>#wpwrap {background-color: #539AC5}</style>"; // load the view based on the td_page parameter if (!empty($_REQUEST['td_page'])) { if ($_REQUEST['td_page'] == 'td_view_import') { include 'td_view_import.php'; } elseif ($_REQUEST['td_page'] == 'td_view_import_category') { include 'td_view_import_category.php'; } elseif ($_REQUEST['td_page'] == 'td_view_import_export_settings') { include 'td_view_import_export_settings.php'; } elseif ($_REQUEST['td_page'] == 'td_view_import_theme_styles') { include 'td_view_import_theme_styles.php'; } elseif ($_REQUEST['td_page'] == 'td_view_custom_fonts') { include 'td_view_custom_fonts.php'; } elseif ($_REQUEST['td_page'] == 'td_import_font_settings') { include 'td_import_font_settings.php'; } } else { // default we load the panel include 'td_view.php'; } }
function __construct() { $this->background_click_td_option_array = td_util::get_td_ads('background_click'); //adds the javascript variables with background click options if (!empty($this->background_click_td_option_array) and !empty($this->background_click_td_option_array['background_click']['link'])) { td_js_buffer::add_variable('td_ad_background_click_link', $this->background_click_td_option_array['background_click']['link']); } else { //add empty variables to prevent errors in js (js dosn't check for undefined ! ) @todo fix this td_js_buffer::add_variable('td_ad_background_click_link', ''); } //adds the javascript variables with background click options if (!empty($this->background_click_td_option_array) and !empty($this->background_click_td_option_array['background_click']['target'])) { td_js_buffer::add_variable('td_ad_background_click_target', $this->background_click_td_option_array['background_click']['target']); } else { //add empty variables to prevent errors in js (js dosn't check for undefined ! ) @todo fix this td_js_buffer::add_variable('td_ad_background_click_target', ''); } }
function td_js_generator() { td_js_buffer::add_variable('td_ajax_url', admin_url('admin-ajax.php')); td_js_buffer::add_variable('td_get_template_directory_uri', get_template_directory_uri()); td_js_buffer::add_variable('tds_snap_menu', td_util::get_option('tds_snap_menu')); td_js_buffer::add_variable('tds_header_style', td_util::get_option('tds_header_style')); td_js_buffer::add_variable('tds_mobile_swipe', td_util::get_option('tds_mobile_swipe')); td_js_buffer::add_variable('td_search_url', get_search_link()); td_js_buffer::add_variable('td_please_wait', str_replace(array('"', "'"), array('`'), __td("Please wait..."))); td_js_buffer::add_variable('td_email_user_pass_incorrect', str_replace(array('"', "'"), array('`'), __td("User or password incorrect!"))); td_js_buffer::add_variable('td_email_user_incorrect', str_replace(array('"', "'"), array('`'), __td("Email or username incorrect!"))); td_js_buffer::add_variable('td_email_incorrect', str_replace(array('"', "'"), array('`'), __td("Email incorrect!"))); //use for more articles on post pages td_js_buffer::add_variable('tds_more_articles_on_post_enable', td_util::get_option('tds_more_articles_on_post_pages_enable')); td_js_buffer::add_variable('tds_more_articles_on_post_time_to_wait', td_util::get_option('tds_more_articles_on_post_pages_time_to_wait')); td_js_buffer::add_variable('tds_more_articles_on_post_pages_distance_from_top', intval(td_util::get_option('tds_more_articles_on_post_pages_distance_from_top'))); td_js_buffer::add("\nvar td_blocks = []; //here we store all the items for the current page\n\n//td_block class - each ajax block uses a object of this class for requests\nfunction td_block() {\n this.id = '';\n this.block_type = 1; //block type id (1-234 etc)\n this.atts = '';\n this.td_cur_cat = '';\n this.td_column_number = '';\n this.td_current_page = 1; //\n this.post_count = 0; //from wp\n this.found_posts = 0; //from wp\n this.max_num_pages = 0; //from wp\n this.is_ajax_running = false;\n this.header_color = '';\n}\n\n "); }
function __construct($background_parameters) { // save a local copy $this->background_parameters = $background_parameters; // bg click ad td_js_buffer::add_variable('td_ad_background_click_link', stripslashes($this->background_parameters['td_ad_background_click_link'])); // the slashes are added by wp in the panel submit td_js_buffer::add_variable('td_ad_background_click_target', $this->background_parameters['td_ad_background_click_target']); // add the css if needed - the css knows about the stretched background! if ($this->background_parameters['theme_bg_image'] != '' or $this->background_parameters['theme_bg_color'] != '') { td_css_buffer::add_to_header($this->add_css_custom_background()); } // add the js if needed - needed only for stretch background if (!empty($this->background_parameters['theme_bg_image']) and $this->background_parameters['is_stretched_bg'] == true) { td_js_buffer::add_to_footer($this->add_js_hook()); } // here we manipulate the body_class-es, we remove the WordPress ones and add our own + boxed version class add_filter('body_class', array($this, 'add_slug_to_body_class')); }
function wp_head_hook() { $responsive = td_util::get_option('tds_responsive'); td_js_buffer::add_variable('td_responsive', $responsive); }
function td_init_booster() { global $content_width; // content width - this is overwritten in post if (!isset($content_width)) { $content_width = 640; } /* ---------------------------------------------------------------------------- * add_image_size for WordPress - register all the thumbs from the thumblist */ foreach (td_api_thumb::get_all() as $thumb_array) { if (td_util::get_option('tds_thumb_' . $thumb_array['name']) != '') { add_image_size($thumb_array['name'], $thumb_array['width'], $thumb_array['height'], $thumb_array['crop']); } } /* ---------------------------------------------------------------------------- * Add lazy shortcodes of the registered blocks */ foreach (td_api_block::get_all() as $block_settings_key => $block_settings_value) { td_global_blocks::add_lazy_shortcode($block_settings_key); } /* ---------------------------------------------------------------------------- * register the default sidebars + dynamic ones */ register_sidebar(array('name' => TD_THEME_NAME . ' default', 'id' => 'td-default', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>')); register_sidebar(array('name' => 'Footer 1', 'id' => 'td-footer-1', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>')); register_sidebar(array('name' => 'Footer 2', 'id' => 'td-footer-2', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>')); register_sidebar(array('name' => 'Footer 3', 'id' => 'td-footer-3', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>')); //get our custom dynamic sidebars $currentSidebars = td_util::get_option('sidebars'); //if we have user made sidebars, register them in wp if (!empty($currentSidebars)) { foreach ($currentSidebars as $sidebar) { register_sidebar(array('name' => $sidebar, 'id' => 'td-' . td_util::sidebar_name_to_id($sidebar), 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>')); } //end foreach } $smooth_scroll = td_util::get_option('tds_smooth_scroll'); if (!empty($smooth_scroll)) { td_js_buffer::add_variable('tds_smooth_scroll', true); } }
function td_js_generator() { td_js_buffer::add_variable('td_ajax_url', admin_url('admin-ajax.php?td_theme_name=' . TD_THEME_NAME . '&v=' . TD_THEME_VERSION)); td_js_buffer::add_variable('td_get_template_directory_uri', get_template_directory_uri()); td_js_buffer::add_variable('tds_snap_menu', td_util::get_option('tds_snap_menu')); td_js_buffer::add_variable('tds_logo_on_sticky', td_util::get_option('tds_logo_on_sticky')); td_js_buffer::add_variable('tds_header_style', td_util::get_option('tds_header_style')); td_js_buffer::add_variable('td_please_wait', __td('Please wait...', TD_THEME_NAME)); td_js_buffer::add_variable('td_email_user_pass_incorrect', __td('User or password incorrect!', TD_THEME_NAME)); td_js_buffer::add_variable('td_email_user_incorrect', __td('Email or username incorrect!', TD_THEME_NAME)); td_js_buffer::add_variable('td_email_incorrect', __td('Email incorrect!', TD_THEME_NAME)); //use for more articles on post pages td_js_buffer::add_variable('tds_more_articles_on_post_enable', td_util::get_option('tds_more_articles_on_post_pages_enable')); td_js_buffer::add_variable('tds_more_articles_on_post_time_to_wait', td_util::get_option('tds_more_articles_on_post_pages_time_to_wait')); td_js_buffer::add_variable('tds_more_articles_on_post_pages_distance_from_top', intval(td_util::get_option('tds_more_articles_on_post_pages_distance_from_top'))); //theme color - used for loading box $td_get_db_theme_color = td_util::get_option('tds_theme_color'); if (!preg_match('/^#[a-f0-9]{6}$/i', $td_get_db_theme_color)) { $td_get_db_theme_color = '#4db2ec'; //default theme color } td_js_buffer::add_variable('tds_theme_color_site_wide', $td_get_db_theme_color); td_js_buffer::add_variable('tds_smart_sidebar', td_util::get_option('tds_smart_sidebar')); td_js_buffer::add_variable('td_theme_v', base64_encode(TD_THEME_VERSION)); td_js_buffer::add_variable('td_theme_n', base64_encode(TD_THEME_NAME)); // magnific popup translations td_js_buffer::add_variable('td_magnific_popup_translation_tPrev', __td('Previous (Left arrow key)', TD_THEME_NAME)); td_js_buffer::add_variable('td_magnific_popup_translation_tNext', __td('Next (Right arrow key)', TD_THEME_NAME)); td_js_buffer::add_variable('td_magnific_popup_translation_tCounter', __td('%curr% of %total%', TD_THEME_NAME)); td_js_buffer::add_variable('td_magnific_popup_translation_ajax_tError', __td('The content from %url% could not be loaded.', TD_THEME_NAME)); td_js_buffer::add_variable('td_magnific_popup_translation_image_tError', __td('The image #%curr% could not be loaded.', TD_THEME_NAME)); td_js_buffer::add_to_header("\r\nvar td_blocks = []; //here we store all the items for the current page\r\n\r\n//td_block class - each ajax block uses a object of this class for requests\r\nfunction td_block() {\r\n this.id = '';\r\n this.block_type = 1; //block type id (1-234 etc)\r\n this.atts = '';\r\n this.td_column_number = '';\r\n this.td_current_page = 1; //\r\n this.post_count = 0; //from wp\r\n this.found_posts = 0; //from wp\r\n this.max_num_pages = 0; //from wp\r\n this.td_filter_value = ''; //current live filter value\r\n this.td_filter_ui_uid = ''; //used to select a item from the drop down filter\r\n this.is_ajax_running = false;\r\n this.td_user_action = ''; // load more or infinite loader (used by the animation)\r\n this.header_color = '';\r\n this.ajax_pagination_infinite_stop = ''; //show load more at page x\r\n}\r\n\r\n "); // The mini detector - ads classes to the HTML tag, it enables us to fix issues in each device. // Has to run as fast as possible ob_start(); ?> <script> // td_js_generator - mini detector (function(){ var html_tag = document.getElementsByTagName("html")[0]; if(navigator.userAgent.indexOf("MSIE 10.0") > -1) { html_tag.className+=' ie10'; } if(!!navigator.userAgent.match(/Trident.*rv\:11\./)) { html_tag.className+=' ie11'; } if (/(iPad|iPhone|iPod)/g.test( navigator.userAgent )) { html_tag.className+=' td-md-is-ios'; } var user_agent = navigator.userAgent.toLowerCase(); if(user_agent.indexOf("android") > -1) { html_tag.className+=' td-md-is-android'; } if (navigator.userAgent.indexOf('Mac OS X') != -1) { html_tag.className+=' td-md-is-os-x'; } if(/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())) { html_tag.className+=' td-md-is-chrome'; } if (navigator.userAgent.indexOf('Firefox') != -1) { html_tag.className+=' td-md-is-firefox'; } if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { html_tag.className+=' td-md-is-safari'; } })(); </script> <?php td_js_buffer::add_to_header(td_util::remove_script_tag(ob_get_clean())); }
function hook_wp_head() { if (is_single()) { global $post; // facebook sharing fix for videos, we add the custom meta data if (has_post_thumbnail($post->ID)) { $td_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); if (!empty($td_image[0])) { echo '<meta property="og:image" content="' . $td_image[0] . '" />'; } } // show author meta tag on sigle pages $td_post_author = get_the_author_meta('display_name', $post->post_author); if ($td_post_author) { echo '<meta name="author" content="' . $td_post_author . '">' . "\n"; } } // fav icon support $tds_favicon_upload = td_util::get_option('tds_favicon_upload'); if (!empty($tds_favicon_upload)) { echo '<link rel="icon" type="image/png" href="' . $tds_favicon_upload . '">'; } // ios bookmark icon support $tds_ios_76 = td_util::get_option('tds_ios_icon_76'); $tds_ios_120 = td_util::get_option('tds_ios_icon_120'); $tds_ios_152 = td_util::get_option('tds_ios_icon_152'); $tds_ios_114 = td_util::get_option('tds_ios_icon_114'); $tds_ios_144 = td_util::get_option('tds_ios_icon_144'); if (!empty($tds_ios_76)) { echo '<link rel="apple-touch-icon-precomposed" sizes="76x76" href="' . $tds_ios_76 . '"/>'; } if (!empty($tds_ios_120)) { echo '<link rel="apple-touch-icon-precomposed" sizes="120x120" href="' . $tds_ios_120 . '"/>'; } if (!empty($tds_ios_152)) { echo '<link rel="apple-touch-icon-precomposed" sizes="152x152" href="' . $tds_ios_152 . '"/>'; } if (!empty($tds_ios_114)) { echo '<link rel="apple-touch-icon-precomposed" sizes="114x114" href="' . $tds_ios_114 . '"/>'; } if (!empty($tds_ios_144)) { echo '<link rel="apple-touch-icon-precomposed" sizes="144x144" href="' . $tds_ios_144 . '"/>'; } // js variable td_viewport_interval_list added to the window object td_js_buffer::add_variable('td_viewport_interval_list', td_global::$td_viewport_intervals); // @todo aici se va schimba setarea, iar userii isi pierd setarea existenta // lazy loading images - animation effect //$tds_lazy_loading_image = td_util::get_option('tds_lazy_loading_image'); $tds_animation_stack = td_util::get_option('tds_animation_stack'); // the body css supplementary classes and the global js animation effects variables are set only if the option 'tds_animation_stack' is set if (empty($tds_animation_stack)) { // js variable td_animation_stack_effect added to the window object $td_animation_stack_effect_type = 'type0'; if (!empty(td_global::$td_options['tds_animation_stack_effect'])) { $td_animation_stack_effect_type = td_global::$td_options['tds_animation_stack_effect']; } td_js_buffer::add_variable('td_animation_stack_effect', $td_animation_stack_effect_type); td_js_buffer::add_variable('tds_animation_stack', true); foreach (td_global::$td_animation_stack_effects as $td_animation_stack_effect) { if (($td_animation_stack_effect['val'] == '' and $td_animation_stack_effect_type == 'type0') || $td_animation_stack_effect['val'] == $td_animation_stack_effect_type) { td_js_buffer::add_variable('td_animation_stack_specific_selectors', $td_animation_stack_effect['specific_selectors']); td_js_buffer::add_variable('td_animation_stack_general_selectors', $td_animation_stack_effect['general_selectors']); break; } } add_filter('body_class', 'td_hook_add_custom_body_class'); } // if speed booster is active, the body animation classes are added into the head style, otherwise they are applied too late (the same is td-backstretch) // if (defined('TD_SPEED_BOOSTER')) { // echo '<style type="text/css"> // body.td-animation-stack-type0 .td-animation-stack .entry-thumb, // body.td-animation-stack-type0 .post img { // opacity: 0; // } // // body.td-animation-stack-type1 .td-animation-stack .entry-thumb, // body.td-animation-stack-type1 .post .entry-thumb, // body.td-animation-stack-type1 .post img[class*="wp-image-"], // body.td-animation-stack-type1 .post a.td-sml-link-to-image > img { // opacity: 0; // transform: scale(0.95); // } // // body.td-animation-stack-type2 .td-animation-stack .entry-thumb, // body.td-animation-stack-type2 .post .entry-thumb, // body.td-animation-stack-type2 .post img[class*="wp-image-"], // body.td-animation-stack-type2 .post a.td-sml-link-to-image > img { // opacity: 0; // .transform(translate(0px,10px)); // } // // .td-backstretch { // display: block; // max-width: none; // opacity: 0; // transition: opacity 2s ease 0s; // }</style>'; // } $tds_general_modal_image = td_util::get_option('tds_general_modal_image'); if (!empty($tds_general_modal_image)) { td_js_buffer::add_variable('tds_general_modal_image', $tds_general_modal_image); } }