Exemplo n.º 1
0
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 render($atts, $content = null)
 {
     $this->block_uid = td_global::td_generate_unique_id();
     //update unique id on each render
     $buffy = '';
     //output buffer
     extract(shortcode_atts(array('limit' => 4, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'tag_slug' => '', 'force_columns' => '', 'autoplay' => '', 'offset' => 0), $atts));
     if (empty($td_column_number)) {
         $td_column_number = td_util::vc_get_column_number();
         // get the column width of the block
     }
     if ($td_column_number == 3) {
         $current_limit = intval($limit);
         $post_limit = constant(get_class($this->internal_block_instance) . '::POST_LIMIT');
         $td_query = td_data_source::get_wp_query($atts);
         if (!empty($td_query->posts)) {
             if ($current_limit > $post_limit and count($td_query->posts) > $post_limit) {
                 $buffy .= '<div class="td-big-grid-slide td_block_wrap" id="iosSlider_' . $this->block_uid . '">';
                 $buffy .= '<div class="td-theme-slider td_block_inner" id="' . $this->block_uid . '">';
                 $current_offset = 0;
                 $atts['class'] = 'item';
                 while ($current_limit > 0) {
                     $atts['offset'] = $offset + $current_offset;
                     $buffy .= $this->internal_block_instance->render($atts);
                     $current_offset += $post_limit;
                     $current_limit -= $post_limit;
                 }
                 $buffy .= '</div>';
                 //end slider (if slider)
                 $buffy .= '<i class = "td-icon-left"></i>';
                 $buffy .= '<i class = "td-icon-right"></i>';
                 $buffy .= '</div>';
                 //end iosSlider (if slider)
                 $autoplay_settings = '';
                 $current_autoplay = filter_var($autoplay, FILTER_VALIDATE_INT);
                 if ($current_autoplay !== false) {
                     $autoplay_settings = 'autoSlide: true, autoSlideTimer: ' . $current_autoplay * 1000 . ',';
                 }
                 $slide_javascript = ';jQuery(document).ready(function() {
                     jQuery("#iosSlider_' . $this->block_uid . '").iosSlider({
                         snapToChildren: true,
                         desktopClickDrag: true,
                         keyboardControls: true,
                         responsiveSlides: true,
                         infiniteSlider: true,
                         ' . $autoplay_settings . '
                         navPrevSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-left"),
                         navNextSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-right")
                     });
                 });';
                 td_js_buffer::add_to_footer($slide_javascript);
             } else {
                 $buffy .= $this->internal_block_instance->render($atts);
             }
         }
     }
     return $buffy;
 }
Exemplo n.º 3
0
    /**
     * Used by all the shortcodes + widget to render the weather. The top bar has a separate function bellow
     * @param $atts
     * @param $block_uid
     * @param $template string -> block_template | top_bar_template
     * @return string
     */
    static function render_generic($atts, $block_uid, $template = 'block_template')
    {
        if (empty($atts['w_location'])) {
            return self::error('<strong>location</strong> is empty. Configure this block/widget and enter a location and we will show the weather from that location :) ');
        }
        $current_unit = 0;
        // 0 - metric
        $current_temp_label = 'C';
        $current_speed_label = 'kmh';
        if (!empty($atts['w_units'])) {
            $current_unit = 1;
            // imperial
            $current_temp_label = 'F';
            $current_speed_label = 'mph';
        }
        // prepare the data and do an api call
        $weather_data = array('block_uid' => '', 'api_location' => $atts['w_location'], 'api_language' => '', 'api_key' => self::get_a_owm_key(), 'today_icon' => '', 'today_icon_text' => '', 'today_temp' => array(0, 0), 'today_humidity' => '', 'today_wind_speed' => array(0, 0), 'today_min' => array(0, 0), 'today_max' => array(0, 0), 'today_clouds' => 0, 'current_unit' => $current_unit, 'forecast' => array());
        // disable the cache for debugging
        // td_remote_cache::_disable_cache();
        $weather_data_status = self::get_weather_data($atts, $weather_data);
        // check if we have an error and return that
        if ($weather_data_status != 'api_fail_cache' and $weather_data_status != 'api' and $weather_data_status != 'cache') {
            return $weather_data_status;
        }
        // we have to patch the cached data - to make sure we have the REAL block_uid that is now on the page
        $weather_data['block_uid'] = $block_uid;
        // render the HTML
        $buffy = '<!-- td weather source: ' . $weather_data_status . ' -->';
        if ($template == 'block_template') {
            // renders the block template
            $buffy .= self::render_block_template($atts, $weather_data, $current_temp_label, $current_speed_label);
        } else {
            // render the top menu template
            $buffy .= self::render_top_bar_template($atts, $weather_data, $current_temp_label);
        }
        // render the JS
        ob_start();
        ?>
		<script>
			jQuery().ready(function() {
				tdWeather.items.push(<?php 
        echo json_encode($weather_data);
        ?>
);
			});
		</script>
		<?php 
        $script_buffer = ob_get_clean();
        $js_script = "\n" . td_util::remove_script_tag($script_buffer);
        td_js_buffer::add_to_footer($js_script);
        return $buffy;
    }
Exemplo n.º 4
0
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    ");
}
Exemplo n.º 5
0
 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', '');
     }
 }
Exemplo n.º 6
0
 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'));
 }
Exemplo n.º 7
0
    function render($atts)
    {
        $this->block_uid = td_global::td_generate_unique_id();
        //update unique id on each render
        //global $post;
        extract(shortcode_atts(array('limit' => 4, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'tag_slug' => '', 'force_columns' => '', 'autoplay' => ''), $atts));
        //echo $atts['limit'];
        //$atts['limit'] = 4;//set 4 to remove the slide
        $buffy = '';
        //output buffer
        $id_slider = '';
        $class_iosSlider = '';
        $this->td_create_slider = 0;
        //if there are more then 4 images then make big grid a slide
        if ($atts['limit'] > 4) {
            $this->td_create_slider = 1;
            $id_slider = 'id="iosSlider_' . $this->block_uid . '"';
            $class_iosSlider = 'iosSlider';
        }
        $buffy .= '<div class="' . $class_iosSlider . ' td_block_wrap td_block_big_grid" ' . $id_slider . '>';
        $buffy .= '<div class="slider td_block_inner" id="' . $this->block_uid . '">';
        //do the query
        $td_query = td_data_source::get_wp_query($atts);
        //by ref  do the query
        //get the js for this block - last parm is block id
        $buffy .= $this->get_block_js($atts, $td_query);
        //$buffy .= '<div class="td_block_wrap td_block_big_grid">';
        //get the sub category filter for this block
        $buffy .= $this->get_block_sub_cats($atts);
        //$buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
        //inner content of the block
        $buffy .= $this->inner($td_query->posts, $force_columns);
        //$buffy .= '</div>';
        //$buffy .= '</div> <!-- ./td_block_big_grid -->';
        $buffy .= '</div>';
        //end slider (if slider)
        if ($this->td_create_slider == 1) {
            $buffy .= '<i class = "td-icon-left"></i>';
            $buffy .= '<i class = "td-icon-right"></i>';
        }
        $buffy .= '</div>';
        //end iosSlider (if slider)
        //close the ios slider wrappers
        if ($this->td_create_slider == 1) {
            //autoplay option for
            $autoplay_string = '';
            if (!empty($autoplay)) {
                $autoplay_string = 'autoSlide: true,
                            autoSlideTimer: ' . $autoplay * 1000 . ',';
            }
            $slide_javascript = '
                    jQuery(document).ready(function() {
                        jQuery("#iosSlider_' . $this->block_uid . '").iosSlider({
                            snapToChildren: true,
                            desktopClickDrag: true,
                            keyboardControls: false,
                            responsiveSlides: true,
                            infiniteSlider: true,
                            ' . $autoplay_string . '
                            navPrevSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-left"),
                            navNextSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-right"),
                            onSliderLoaded : td_resize_page_sliders,
		                    onSliderResize : td_resize_big_grid_update_vars_' . $this->block_uid . ',//td_resize_slide,
		                    onSlideChange : td_resize_slide
                        });
                    });


                    /*
                    * Resize the iosSlider when the page is resided (fixes bug on Android devices)
                    * For big grid the code runs on all devices because the big slider changes its height
                    * and we change the td_resize_slide function with this one
                    */
                    function td_resize_big_grid_update_vars_' . $this->block_uid . '(args) {
                        //if(tdDetect.isAndroid) {
                            setTimeout(function(){
                                jQuery("#iosSlider_' . $this->block_uid . '").iosSlider("update");
                            }, 1000);
                        //}
                    }
            ';
            td_js_buffer::add_to_footer($slide_javascript);
        }
        return $buffy;
    }
Exemplo n.º 8
0
    /**
     * @param $posts
     * @param string $td_column_number - get the column number
     * @param string $autoplay - not use via ajax
     * @param bool $is_ajax - if true the script will return the js inline, if not, it will use the td_js_buffer class
     * @return string
     */
    function inner($posts, $td_column_number = '', $autoplay = '', $is_ajax = false)
    {
        $buffy = '';
        $td_block_layout = new td_block_layout();
        if (empty($td_column_number)) {
            $td_column_number = td_util::vc_get_column_number();
            // get the column width of the block from the page builder API
        }
        $td_post_count = 0;
        // the number of posts rendered
        $td_unique_id_slide = td_global::td_generate_unique_id();
        //@generic class for sliders : td-theme-slider
        $buffy .= '<div id="' . $td_unique_id_slide . '" class="td-theme-slider iosSlider-col-' . $td_column_number . ' td_mod_wrap">';
        $buffy .= '<div class="td-slider ">';
        if (!empty($posts)) {
            foreach ($posts as $post) {
                //$buffy .= td_modules::mod_slide_render($post, $td_column_number, $td_post_count);
                $td_module_slide = new td_module_slide($post);
                $buffy .= $td_module_slide->render($td_column_number, $td_post_count, $td_unique_id_slide);
                $td_post_count++;
            }
        }
        $buffy .= $td_block_layout->close_all_tags();
        $buffy .= '</div>';
        //close slider
        $buffy .= '<i class = "td-icon-left prevButton"></i>';
        $buffy .= '<i class = "td-icon-right nextButton"></i>';
        $buffy .= '</div>';
        //close ios
        if (!empty($autoplay)) {
            $autoplay_string = '
            autoSlide: true,
            autoSlideTimer: ' . $autoplay * 1000 . ',
            ';
        } else {
            $autoplay_string = '';
        }
        //add resize events
        //$add_js_resize = '';
        //if($td_column_number > 1) {
        $add_js_resize = ',
                //onSliderLoaded : td_resize_normal_slide,
                //onSliderResize : td_resize_normal_slide_and_update';
        //}
        $slide_js = '
jQuery(document).ready(function() {
    jQuery("#' . $td_unique_id_slide . '").iosSlider({
        snapToChildren: true,
        desktopClickDrag: true,
        keyboardControls: false,
        responsiveSlideContainer: true,
        responsiveSlides: true,
        ' . $autoplay_string . '

        infiniteSlider: true,
        navPrevSelector: jQuery("#' . $td_unique_id_slide . ' .prevButton"),
        navNextSelector: jQuery("#' . $td_unique_id_slide . ' .nextButton")
        ' . $add_js_resize . '
    });
});
    ';
        if ($is_ajax) {
            $buffy .= '<script>' . $slide_js . '</script>';
        } else {
            td_js_buffer::add_to_footer($slide_js);
        }
        return $buffy;
    }
Exemplo n.º 9
0
/**
 * @param string $output - is empty !!!
 * @param $atts
 * @param bool $content
 * @param bool $tag
 * @return mixed
 */
function my_gallery_shortcode($output = '', $atts, $content = false, $tag = false)
{
    //print_r($atts);
    $buffy = '';
    //check for gallery  = slide
    if (!empty($atts) and !empty($atts['td_select_gallery_slide']) and $atts['td_select_gallery_slide'] == 'slide') {
        $td_double_slider2_no_js_limit = 7;
        $td_nr_columns_slide = 'td-slide-on-2-columns';
        $nr_title_chars = 155;
        //check to see if we have or not sidebar on the page, to set the small images when need to show them on center
        if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
            $td_double_slider2_no_js_limit = 10;
            $td_nr_columns_slide = 'td-slide-on-3-columns';
            $nr_title_chars = 170;
        }
        $title_slide = '';
        //check for the title
        if (!empty($atts['td_gallery_title_input'])) {
            $title_slide = $atts['td_gallery_title_input'];
            //check how many chars the tile have, if more then 84 then that cut it and add ... after
            if (mb_strlen($title_slide, 'UTF-8') > $nr_title_chars) {
                $title_slide = mb_substr($title_slide, 0, $nr_title_chars, 'UTF-8') . '...';
            }
        }
        $slide_images_thumbs_css = '';
        $slide_display_html = '';
        $slide_cursor_html = '';
        $image_ids = explode(',', $atts['ids']);
        //check to make sure we have images
        if (count($image_ids) == 1 and !is_numeric($image_ids[0])) {
            return;
        }
        $image_ids = array_map('trim', $image_ids);
        //trim elements of the $ids_gallery array
        //generate unique gallery slider id
        $gallery_slider_unique_id = td_global::td_generate_unique_id();
        $cur_item_nr = 1;
        foreach ($image_ids as $image_id) {
            //get the info about attachment
            $image_attachment = td_util::attachment_get_full_info($image_id);
            //get images url
            $td_temp_image_url_80x60 = wp_get_attachment_image_src($image_id, 'art-thumb');
            // 100 x 65 - for small images slide
            $td_temp_image_url_full = $image_attachment['src'];
            //default big image - for magnific popup
            if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
                $td_temp_image_url = wp_get_attachment_image_src($image_id, 'td_0x483');
                //1074 x 483 - for big slide 3 columns
            } else {
                $td_temp_image_url = wp_get_attachment_image_src($image_id, 'td_0x357');
                //0 x 357 - for big slide 2 columns
            }
            //check if we have all the images
            if (!empty($td_temp_image_url[0]) and !empty($td_temp_image_url_80x60[0]) and !empty($td_temp_image_url_full)) {
                //css for display the small cursor image
                $slide_images_thumbs_css .= '
                    #' . $gallery_slider_unique_id . '  .td-doubleSlider-2 .td-item' . $cur_item_nr . ' {
                        background: url(' . $td_temp_image_url_80x60[0] . ') 0 0 no-repeat;
                    }';
                //html for display the big image
                $class_post_content = '';
                if (!empty($image_attachment['description']) or !empty($image_attachment['caption'])) {
                    $class_post_content = 'td-gallery-slide-content';
                }
                //if picture has caption & description
                $figcaption = '';
                if (!empty($image_attachment['caption']) or !empty($image_attachment['description'])) {
                    $figcaption = '<figcaption class = "td-slide-caption ' . $class_post_content . '">';
                    if (!empty($image_attachment['caption'])) {
                        $figcaption .= '<div class = "td-gallery-slide-copywrite">' . $image_attachment['caption'] . '</div>';
                    }
                    if (!empty($image_attachment['description'])) {
                        $figcaption .= '<span>' . $image_attachment['description'] . '</span>';
                    }
                    $figcaption .= '</figcaption>';
                }
                $slide_display_html .= '
                    <div class = "td-slide-item td-item' . $cur_item_nr . '">
                        <figure class="td-slide-galery-figure td-slide-popup-gallery">
                            <a class="slide-gallery-image-link" href="' . $td_temp_image_url_full . '" title="' . $image_attachment['title'] . '"  data-caption="' . str_replace(array('"', "'"), array('`'), $image_attachment['caption']) . '"  data-description="' . str_replace(array('"', "'"), array('`'), $image_attachment['description']) . '">
                                <img src="' . $td_temp_image_url[0] . '" alt="' . htmlentities($image_attachment['alt'], ENT_QUOTES) . '">
                            </a>
                            ' . $figcaption . '
                        </figure>
                    </div>';
                //html for display the small cursor image
                $slide_cursor_html .= '
                    <div class = "td-button td-item' . $cur_item_nr . '">
                        <div class = "td-border"></div>
                    </div>';
                $cur_item_nr++;
            }
            //end check for images
        }
        //end foreach
        //check if we have html code for the slider
        if (!empty($slide_display_html) and !empty($slide_cursor_html)) {
            //get the number of slides
            $nr_of_slides = count($image_ids);
            if ($nr_of_slides < 0) {
                $nr_of_slides = 0;
            }
            $buffy = '
                <style type="text/css">
                    ' . $slide_images_thumbs_css . '
                </style>

                <div id="' . $gallery_slider_unique_id . '" class="' . $td_nr_columns_slide . '">
                    <div class="post_galery_slide_1">
                        <div class="td-gallery-slide-top">
                           <div class="td-gallery-title">' . $title_slide . '</div>

                            <div class="td-gallery-controls-wrapper">
                                <div class="td-gallery-slide-count"><span class="td-gallery-slide-item-focus">1</span> ' . __td('of') . ' ' . $nr_of_slides . '</div>
                                <div class="td-gallery-slide-prev-next-but">
                                    <i class = "td-icon-left doubleSliderPrevButton"></i>
                                    <i class = "td-icon-right doubleSliderNextButton"></i>
                                </div>
                            </div>
                        </div>

                        <div class = "td-doubleSlider-1 ">
                            <div class = "td-slider">
                                ' . $slide_display_html . '
                            </div>
                        </div>

                        <div class = "td-doubleSlider-2">
                            <div class = "td-slider">
                                ' . $slide_cursor_html . '
                            </div>
                        </div>

                    </div>

                </div>
                ';
            $slide_javascript = '
                    //total number of slides
                    var ' . $gallery_slider_unique_id . '_nr_of_slides = ' . $nr_of_slides . ';
                    var ' . $gallery_slider_unique_id . '_is_slider_moving = false;


                    var ' . $gallery_slider_unique_id . '_is_slider_timer = "";


                    jQuery(window).load(function() {//jQuery(document).ready(function() {//
                        //magnific popup
                        var mmm = jQuery("#' . $gallery_slider_unique_id . ' .td-slide-popup-gallery").magnificPopup({
                            delegate: "a",
                            type: "image",
                            tLoading: "Loading image #%curr%...",
                            mainClass: "mfp-img-mobile",
                            gallery: {
                                enabled: true,
                                navigateByImgClick: true,
                                preload: [0,1]
                            },
                            image: {
                                tError: "<a href=\'%url%\'>The image #%curr%</a> could not be loaded.",
                                    titleSrc: function(item) {//console.log(item.el);
                                    //alert(jQuery(item.el).data("caption"));
                                    return item.el.attr("data-caption") + "<div>" + item.el.attr("data-description") + "</div>";
                                }
                            },
                            zoom: {
                                    enabled: true,
                                    duration: 300,
                                    opener: function(element) {
                                        return element.find("img");
                                    }
                            },

                            callbacks: {
                                change: function() {
                                    // Will fire when popup is closed
                                    //console.log(mmm.tError);
                                    //console.log(mmm);
                                    jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-1").iosSlider("goToSlide", this.currItem.index + 1 );
                                }
                            }

                        });



                        jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-1").iosSlider({
                            scrollbar: true,
                            snapToChildren: true,
                            desktopClickDrag: true,
                            infiniteSlider: true,
                            responsiveSlides: true,
                            navPrevSelector: jQuery("#' . $gallery_slider_unique_id . ' .doubleSliderPrevButton"),
                            navNextSelector: jQuery("#' . $gallery_slider_unique_id . ' .doubleSliderNextButton"),
                            scrollbarHeight: "2",
                            scrollbarBorderRadius: "0",
                            scrollbarOpacity: "0.5",
                            onSliderResize: resize_update_vars_' . $gallery_slider_unique_id . ',
                            onSliderLoaded: doubleSlider2Load_' . $gallery_slider_unique_id . ',
                            onSlideChange: doubleSlider2Load_' . $gallery_slider_unique_id . ',

                            keyboardControls:true
                        });

                        //small image slide
                        jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-button").each(function(i) {

                                jQuery(this).bind("click", function() {
                                    if(' . $gallery_slider_unique_id . '_is_slider_moving == false) {
                                        jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-1").iosSlider("goToSlide", i+1);
                                    }
                                });
                        });

                        //check the number of slides
                        if(' . $gallery_slider_unique_id . '_nr_of_slides > ' . $td_double_slider2_no_js_limit . ') {
                            jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2").iosSlider({
                                desktopClickDrag: true,
                                snapToChildren: true,
                                snapSlideCenter: true,
                                infiniteSlider: true,
                                onSlideChange: function() {
                                    ' . $gallery_slider_unique_id . '_is_slider_moving = true;

                                    /*
                                    clearTimeout(' . $gallery_slider_unique_id . '_is_slider_timer);

                                    ' . $gallery_slider_unique_id . '_is_slider_timer = setTimeout(function(){
                                       ' . $gallery_slider_unique_id . '_is_slider_moving = false;
                                    },3000);

                                    */
                                }, //added this to disable clicking when dragging
                                onSlideComplete: function () {
                                    ' . $gallery_slider_unique_id . '_is_slider_moving = false;
                                }
                            });
                        } else {
                            jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2").addClass("td_center_slide2");
                        }

                        function doubleSlider2Load_' . $gallery_slider_unique_id . '(args) {
                            //var currentSlide = args.currentSlideNumber;
                            jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2").iosSlider("goToSlide", args.currentSlideNumber);


                            //put a transparent border around all small sliders
                            jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-button .td-border").css("border", "3px solid #ffffff").css("opacity", "0.5");
                            jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-button").css("border", "0");

                            //put a white border around the focused small slide
                            jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-button:eq(" + (args.currentSlideNumber-1) + ") .td-border").css("border", "3px solid #ffffff").css("opacity", "1");
                            //jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-button:eq(" + (args.currentSlideNumber-1) + ")").css("border", "3px solid #ffffff");

                            //write the current slide number
                            td_gallery_write_current_slide_' . $gallery_slider_unique_id . '(args.currentSlideNumber);

                        }

                        //writes the current slider beside to prev and next buttons
                        function td_gallery_write_current_slide_' . $gallery_slider_unique_id . '(slide_nr) {
                            jQuery("#' . $gallery_slider_unique_id . ' .td-gallery-slide-item-focus").html(slide_nr);
                        }


                        /*
                        * Resize the iosSlider when the page is resided (fixes bug on Android devices)
                        */
                        function resize_update_vars_' . $gallery_slider_unique_id . '(args) {
                            if(td_detect.is_android) {
                                setTimeout(function(){
                                    jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-1").iosSlider("update");
                                }, 1000);
                            }
                        }

                    });';
            td_js_buffer::add_to_footer($slide_javascript);
        }
        //end check if we have html code for the slider
    }
    //end if slide
    //!!!!!! WARNING
    //$return has to be != empty to overwride the default output
    return $buffy;
}
Exemplo n.º 10
0
            <?php 
        echo td_global_blocks::get_instance('td_slide_big')->render(array('sort' => 'featured', 'hide_title' => 'hide_title', 'force_columns' => 3, 'limit' => $td_slide_limit));
        ?>
        </div>
    </div>
    <?php 
    }
    echo td_page_generator::wrap_no_row_with_bg_end();
    /*
    if (!empty($td_slide_background)) {
        echo '<script>' . "\n";
        echo 'jQuery().ready(function() {' . "\n";
        echo 'jQuery(".td-big-slide-background").backstretch("' . $td_slide_background . '", {fade:1200});' . "\n";
        echo '});' . "\n";
        echo '</script>' . "\n";
    }
    */
    if (!empty($td_slide_background)) {
        $buffy = '';
        $buffy .= 'jQuery().ready(function() {' . "\n";
        $buffy .= 'jQuery(".td-big-slide-background ").backstretch("' . $td_slide_background . '", {fade:1200});' . "\n";
        $buffy .= '});' . "\n";
        td_js_buffer::add_to_footer($buffy);
    }
    if (!empty($td_slide_b_color)) {
        echo '<style>';
        echo '.td-full-layout .td-big-slide-background { background-color:' . $td_slide_b_color . '; }';
        echo '.td-boxed-layout .td-big-slide-background .container { background-color:' . $td_slide_b_color . ' !important; }';
        echo '</style>';
    }
}
Exemplo n.º 11
0
<?php

// Template 7 -post-final-7.psd - full image background
$td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
if (!empty($td_post_featured_image)) {
    td_js_buffer::add_to_footer('jQuery(window).ready(function() {' . "\r\n" . '(function(){' . "\r\n" . 'var td_backstr_item = new td_backstr.item();' . "\r\n" . 'td_backstr_item.wrapper_image_jquery_obj = jQuery("#td-full-screen-header-image");' . "\r\n" . 'td_backstr_item.image_jquery_obj = td_backstr_item.wrapper_image_jquery_obj.find(\'img:first\');' . "\r\n" . 'td_backstr.add_item(td_backstr_item);' . "\r\n" . "jQuery('.td-read-down a').click(function(event){" . "\r\n" . "event.preventDefault();" . "\r\n" . "var header_wrap = jQuery('.td-full-screen-header-image-wrap:first')" . "\r\n" . "if (header_wrap.length == 1) {" . "\r\n" . "td_util.scroll_to_position(header_wrap.height() + header_wrap.offset().top, 1200);" . "\r\n" . "}" . "\r\n" . "});" . "\r\n" . '})();' . "\r\n" . '});');
}
//get the global sidebar position from single.php
global $loop_sidebar_position;
// sidebar position used to align the breadcrumb on sidebar left + sidebar first on mobile issue
$td_sidebar_position = '';
if ($loop_sidebar_position == 'sidebar_left') {
    $td_sidebar_position = 'td-sidebar-left';
}
$td_mod_single = new td_module_single($post);
?>

<article id="post-<?php 
echo $td_mod_single->post->ID;
?>
" class="<?php 
echo join(' ', get_post_class('td-post-template-7'));
?>
" <?php 
echo $td_mod_single->get_item_scope();
?>
>

    <div class="td-full-screen-header-image-wrap">

        <div class="td-container td-post-header">
Exemplo n.º 12
0
 static function _render_wp_admin_footer()
 {
     //renders only the variables - used in wp-admin
     self::$js_wp_admin_buffer_rendered = true;
     return "\n<!-- JS generated by theme -->" . "\n\n<script>\n    " . self::$js_variables_buffer . "\n" . self::$js_wp_admin_buffer . "\n</script>\n\n";
 }
Exemplo n.º 13
0
function td_js_buffer_footer_render()
{
    echo td_js_buffer::render_footer();
}
Exemplo n.º 14
0
$loop_sidebar_position = td_util::get_option('tds_' . $template_id . '_sidebar_pos');
//sidebar right is default (empty)
//override the category global template with the category specific settings
if (!empty($tdc_layout)) {
    $loop_module_id = $tdc_layout;
}
if (!empty($tdc_sidebar_pos)) {
    $loop_sidebar_position = $tdc_sidebar_pos;
}
// sidebar position used to align the breadcrumb on sidebar left + sidebar first on mobile issue
$td_sidebar_position = '';
if ($loop_sidebar_position == 'sidebar_left') {
    $td_sidebar_position = 'td-sidebar-left';
}
// make the category pulldown filter list to be equal
td_js_buffer::add_to_footer('jQuery().ready(function() {' . "\r\n" . 'var pulldown_size = jQuery(".td-category-pulldown-filter:first").width();' . "\r\n" . 'if (pulldown_size > 113) { jQuery(".td-category-pulldown-filter .td-pulldown-filter-list").css({"min-width": pulldown_size, "border-top": "1px solid #444"}); }' . "\r\n" . '});');
?>



<?php 
td_api_category_template::_helper_show_category_template();
td_api_category_top_posts_style::_helper_show_category_top_posts_style();
?>

<div class="td-main-content-wrap">
    <div class="td-container">

        <!-- content -->
        <div class="td-pb-row">
            <?php 
Exemplo n.º 15
0
<?php

td_js_buffer::add_to_header("\n" . "\r\n\r\n//themeforest iframe removal code - used only on demo\r\nvar td_is_safari = false;\r\nvar td_is_ios = false;\r\nvar td_is_windows_phone = false;\r\n\r\n\r\n\r\nvar ua = navigator.userAgent.toLowerCase();\r\n\r\nvar td_is_android = ua.indexOf('android') > -1;\r\n\r\nif (ua.indexOf('safari')!=-1){\r\n    if(ua.indexOf('chrome')  > -1){\r\n\r\n    }else{\r\n        td_is_safari = true;\r\n    }\r\n}\r\n\r\nif(navigator.userAgent.match(/(iPhone|iPod|iPad)/i)) {\r\n    td_is_ios = true;\r\n}\r\n\r\nif (navigator.userAgent.match(/Windows Phone/i)) {\r\n    td_is_windows_phone = true;\r\n}\r\n\r\nif(td_is_ios || td_is_safari || td_is_windows_phone || td_is_android) {\r\n    if (top.location != location) {\r\n        top.location.replace('" . TD_THEME_DEMO_URL . "/');\r\n    }\r\n}\r\n    ");
Exemplo n.º 16
0
?>

<?php 
//if we have a featured image, show it
if (!empty($td_post_featured_image)) {
    ?>

    <div  class="td-big-slide-background"><div id="td-full-screen-header-image" class="td-image-gradient"></div></div>

    <!-- preload the image -->
    <img src="<?php 
    echo $td_post_featured_image;
    ?>
" alt="" style="display:none;"/>
    <?php 
    td_js_buffer::add_to_footer('jQuery().ready(function() {' . "\r\n" . 'jQuery("#td-full-screen-header-image").backstretch("' . $td_post_featured_image . '", {fade:1200, centeredY:false});' . "\r\n" . '});');
}
?>

<article id="post-<?php 
echo $td_mod_single->post->ID;
?>
" class="<?php 
echo join(' ', get_post_class());
?>
" <?php 
echo $td_mod_single->get_item_scope();
?>
>

Exemplo n.º 17
0
<?php

// Template 6 - post-final-6.psd - full image background
//get the global sidebar position from td_single_template_vars.php
locate_template('includes/wp_booster/td_single_template_vars.php', true);
get_header();
global $loop_sidebar_position, $td_sidebar_position, $post;
$td_mod_single = new td_module_single($post);
$td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
if (!empty($td_post_featured_image)) {
    td_js_buffer::add_to_footer('jQuery(window).ready(function() {' . "\r\n" . '(function(){' . "\r\n" . 'var td_backstr_item = new tdBackstr.item();' . "\r\n" . 'td_backstr_item.wrapper_image_jquery_obj = jQuery( "#td-full-screen-header-image" );' . "\r\n" . 'td_backstr_item.image_jquery_obj = td_backstr_item.wrapper_image_jquery_obj.find( \'img:first\' );' . "\r\n" . 'tdBackstr.add_item( td_backstr_item );' . "\r\n" . '})();' . "\r\n" . '});');
}
?>
<article id="post-<?php 
echo $td_mod_single->post->ID;
?>
" class="<?php 
echo join(' ', get_post_class('td-post-template-6'));
?>
" <?php 
echo $td_mod_single->get_item_scope();
?>
>

    <div class="td-full-screen-header-image-wrap">

        <div id="td-full-screen-header-image" class="td-image-gradient-style6">
            <img class="td-backstretch" src="<?php 
echo $td_post_featured_image;
?>
">
Exemplo n.º 18
0
    function inner($posts, $td_column_number = '')
    {
        ob_start();
        if (!empty($posts[0])) {
            $post = $posts[0];
            //we get only one post
            // $td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
            $td_mod_single = new td_module_single($post);
            //make the js template
            ?>

            <!-- add class to body, no jQuery and inline -->
            <?php 
            ob_start();
            ?>
            <script>
                document.body.className+=' td-boxed-layout single_template_8 homepage-post ';
            </script>
            <?php 
            echo ob_get_clean();
            ?>



            <script type="text/template" id="<?php 
            echo $this->block_uid . '_tmpl';
            ?>
">

                <article id="post-<?php 
            echo $td_mod_single->post->ID;
            ?>
" class="<?php 
            echo join(' ', get_post_class('post td-post-template-8'));
            ?>
" <?php 
            echo $td_mod_single->get_item_scope();
            ?>
>
                    <div class="td-post-header td-image-gradient-style8">
                        <div class="td-crumb-container"><?php 
            echo td_page_generator::get_single_breadcrumbs($td_mod_single->title);
            ?>
</div>

                        <div class="td-post-header-holder">

                            <header class="td-post-title">

                                <?php 
            echo $td_mod_single->get_category();
            ?>
                                <?php 
            echo $td_mod_single->get_title();
            ?>


                                <?php 
            if (!empty($td_mod_single->td_post_theme_settings['td_subtitle'])) {
                ?>
                                    <p class="td-post-sub-title"><?php 
                echo $td_mod_single->td_post_theme_settings['td_subtitle'];
                ?>
</p>
                                <?php 
            }
            ?>

                                <div class="td-module-meta-info">
                                    <?php 
            echo $td_mod_single->get_author();
            ?>
                                    <?php 
            echo $td_mod_single->get_date(false);
            ?>
                                    <?php 
            echo $td_mod_single->get_views();
            ?>
                                    <?php 
            echo $td_mod_single->get_comments();
            ?>
                                </div>

                            </header>
                        </div>
                    </div>
                </article>

            </script>






            <?php 
            $td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
            ob_start();
            ?>
            <script>
                // add the template
                jQuery( '.td-header-wrap' ).after( jQuery( '#<?php 
            echo $this->block_uid;
            ?>
_tmpl' ).html() );

                // make the wrapper and the image -> and add the image inside
                var td_homepage_full_bg_image_wrapper = jQuery( '<div class="backstretch"></div>' );
                var td_homepage_full_bg_image = jQuery( '<img class="td-backstretch not-parallax" src="<?php 
            echo $td_post_featured_image;
            ?>
"/>' );
                td_homepage_full_bg_image_wrapper.append(td_homepage_full_bg_image);

                // add to body
                jQuery('body').prepend( td_homepage_full_bg_image_wrapper );

                // run the backstracher
                var td_backstr_item = new tdBackstr.item();
                td_backstr_item.wrapper_image_jquery_obj = td_homepage_full_bg_image_wrapper;
                td_backstr_item.image_jquery_obj = td_homepage_full_bg_image;
                tdBackstr.add_item( td_backstr_item );

            </script>
            <?php 
            $buffer = ob_get_clean();
            $js = "\n" . td_util::remove_script_tag($buffer);
            td_js_buffer::add_to_footer($js);
        }
        return ob_get_clean();
    }
Exemplo n.º 19
0
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 inner($posts, $td_column_number = '')
    {
        ob_start();
        if (!empty($posts[0])) {
            $post = $posts[0];
            //we get only one post
            $td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
            $td_mod_single = new td_module_single($post);
            //make the js template
            ?>
            <script type="text/template" id="<?php 
            echo $this->block_uid . '_tmpl';
            ?>
">

                <article id="post-<?php 
            echo $td_mod_single->post->ID;
            ?>
"
                         class="<?php 
            echo join(' ', get_post_class('td-post-template-6'));
            ?>
" <?php 
            echo $td_mod_single->get_item_scope();
            ?>
>
                    <div class="template6-header">
                        <div class="td-post-header td-container" id="td_parallax_header_6">
                            <header class="td-pb-padding-side">
                                <?php 
            echo $td_mod_single->get_category();
            ?>
                                <?php 
            echo $td_mod_single->get_title();
            ?>
                                <?php 
            if (!empty($td_mod_single->td_post_theme_settings['td_subtitle'])) {
                ?>
                                    <p class="td-post-sub-title"><?php 
                echo $td_mod_single->td_post_theme_settings['td_subtitle'];
                ?>
</p>
                                <?php 
            }
            ?>
                                <div class="meta-info">
                                    <?php 
            echo $td_mod_single->get_author();
            ?>
                                    <?php 
            echo $td_mod_single->get_date(false);
            ?>
                                    <?php 
            echo $td_mod_single->get_views();
            ?>
                                    <?php 
            echo $td_mod_single->get_comments();
            ?>
                                </div>
                                <div class="td-read-down"><a href="#"><i class="td-icon-read-down"></i></a></div>
                            </header>
                        </div>
                    </div>
                </article>

            </script>


            <?php 
            td_js_buffer::add_to_footer("jQuery('body').addClass('single_template_6');" . "\r\n" . "jQuery('body').prepend(jQuery('#" . $this->block_uid . "_tmpl').html());" . "\r\n" . 'jQuery(\'body\').prepend(\'<div class="td-full-screen-header-image-wrap"><div id="td-full-screen-header-image" class="td-image-gradient"></div></div>\');' . "\r\n" . 'jQuery().ready(function() {' . "\r\n" . "jQuery('#td-full-screen-header-image').backstretch('" . $td_post_featured_image . "', {fade:1200, centeredY:false});" . "\r\n" . 'td_post_template_6_title();' . "\r\n" . "jQuery('.td-read-down a').click(function(event){" . "\r\n" . "event.preventDefault();" . "\r\n" . "td_util.scroll_to_position(jQuery('.td-full-screen-header-image-wrap').height(), 1200);" . "\r\n" . "});" . "\r\n" . '});');
        }
        return ob_get_clean();
    }
Exemplo n.º 21
0
    protected function render_after_list_wrap()
    {
        $buffy = '';
        $buffy .= '</div>';
        $buffy .= '</div>';
        // end ios slider
        $buffy .= '<div class="td-sml3-bottom-controls">' . $this->slide_controls . '</div>';
        //bottom controls
        $buffy .= '</div>';
        //.td_smart_list_3  wrapper with id
        // @todo fix the moving from left to right from the controls, now the slide only works from right to left,
        td_js_buffer::add_to_footer('
jQuery(document).ready(function() {
    jQuery("#' . $this->smart_list_tip_3_unique_id . '").iosSlider({
        snapToChildren: true,
        desktopClickDrag: true,
        keyboardControls: false,
        infiniteSlider: true,
        navPrevSelector: jQuery(".td_smart_list_3 .doubleSliderPrevButton"),
        navNextSelector: jQuery(".td_smart_list_3 .doubleSliderNextButton"),
        startAtSlide:td_history.get_current_page("slide"),
        onSliderLoaded : td_resize_smartlist_slides,
		onSliderResize : td_resize_smartlist_sliders_and_update,
		onSlideChange : td_resize_smartlist_slides,
		onSlideComplete : td_history.slide_changed_callback
    });


    // add current page history
    td_history.replace_history_entry({current_slide:td_history.get_current_page("slide"), slide_id:"' . $this->smart_list_tip_3_unique_id . '"});

});
    ');
        return $buffy;
    }
function td_bottom_code()
{
    global $post;
    //buffy before pasting custom css code
    $buffy_custom_css = '';
    $speed_booster = '';
    if (defined('TD_SPEED_BOOSTER')) {
        $speed_booster = 'Speed booster: ' . TD_SPEED_BOOSTER . "\n";
    }
    echo '

    <!--

        Theme: ' . TD_THEME_NAME . ' by tagDiv 2014
        Version: ' . TD_THEME_VERSION . ' (rara)
        Deploy mode: ' . TD_DEPLOY_MODE . '
        ' . $speed_booster . '
        uid: ' . uniqid() . '
    -->

    ';
    //get and paste user custom css
    $td_custom_css = stripslashes(td_util::get_option('tds_custom_css'));
    //desktop
    $td_responsive_css_desktop = stripslashes(td_util::get_option('tds_responsive_css_desktop'));
    //ipad landscape
    $td_responsive_css_ipad_landscape = stripslashes(td_util::get_option('tds_responsive_css_ipad_landscape'));
    //ipad portrait
    $td_responsive_css_ipad_portrait = stripslashes(td_util::get_option('tds_responsive_css_ipad_portrait'));
    //phone
    $td_responsive_css_phone = stripslashes(td_util::get_option('tds_responsive_css_phone'));
    //check if we have to add the custom css code
    if (!empty($td_custom_css) || !empty($td_responsive_css_desktop) || !empty($td_responsive_css_ipad_landscape) || !empty($td_responsive_css_ipad_portrait) || !empty($td_responsive_css_phone)) {
        $buffy_custom_css = '
            <style type="text/css" media="screen">';
        //paste custom css
        if (!empty($td_custom_css)) {
            $buffy_custom_css .= '
                ' . $td_custom_css . '
                ';
        }
        //paste desktop custom css
        if (!empty($td_responsive_css_desktop)) {
            $buffy_custom_css .= '

                  /* responsive monitor */
                  @media (min-width: 1200px) {
                  ' . $td_responsive_css_desktop . '}
                  ';
        }
        //paste ipad landscape custom css
        if (!empty($td_responsive_css_ipad_landscape)) {
            $buffy_custom_css .= '

                  /* responsive landscape tablet */
                  @media (min-width: 1019px) and (max-width: 1199px) {
                  ' . $td_responsive_css_ipad_landscape . '}';
        }
        //paste ipad portrait custom css
        if (!empty($td_responsive_css_ipad_portrait)) {
            $buffy_custom_css .= '

                 /* responsive portrait tablet */
                  @media (min-width: 768px) and (max-width: 1018px) {
                  ' . $td_responsive_css_ipad_portrait . '}';
        }
        //paste ipad portrait custom css
        if (!empty($td_responsive_css_phone)) {
            $buffy_custom_css .= '

                 /* responsive phone */
                 @media (max-width: 767px) {
                 ' . $td_responsive_css_phone . '}';
        }
        $buffy_custom_css .= '</style>';
        echo $buffy_custom_css;
    }
    //get and paste user custom javascript
    $td_custom_javascript = stripslashes(td_util::get_option('tds_custom_javascript'));
    if (!empty($td_custom_javascript)) {
        echo '<script type="text/javascript">' . $td_custom_javascript . '</script>';
    }
    //AJAX POST VIEW COUNT
    if (td_util::get_option('tds_ajax_post_view_count') == 'enabled') {
        //Ajax get & update counter views
        if (is_single()) {
            //echo 'post page: '.  $post->ID;
            if ($post->ID > 0) {
                td_js_buffer::add_to_footer('
                jQuery().ready(function jQuery_ready() {
                    td_ajax_count.td_get_views_counts_ajax("post",' . json_encode('[' . $post->ID . ']') . ');
                });
            ');
            }
        }
    }
}
Exemplo n.º 23
0
    /**
     * @param $posts
     * @param string $td_column_number - get the column number
     * @param string $autoplay - not use via ajax
     * @param bool $is_ajax - if true the script will return the js inline, if not, it will use the td_js_buffer class
     * @return string
     */
    function inner($posts, $td_column_number = '', $autoplay = '', $is_ajax = false)
    {
        //global $post;
        $buffy = '';
        $td_block_layout = new td_block_layout();
        if (empty($td_column_number)) {
            $td_column_number = $td_block_layout->get_column_number();
            // get the column width of the block
        }
        $td_post_count = 0;
        // the number of posts rendered
        $td_current_column = 1;
        //the current column
        $td_unique_id_slide = td_global::td_generate_unique_id();
        $buffy .= '<div id="' . $td_unique_id_slide . '" class="iosSlider iosSlider-col-' . $td_column_number . ' td_mod_wrap">';
        $buffy .= '<div class="slider ">';
        if (!empty($posts)) {
            foreach ($posts as $post) {
                //$buffy .= td_modules::mod_slide_render($post, $td_column_number, $td_post_count);
                $td_module_slide = new td_module_slide($post);
                $buffy .= $td_module_slide->render($td_column_number, $td_post_count);
                //current column
                if ($td_current_column == $td_column_number) {
                    $td_current_column = 1;
                } else {
                    $td_current_column++;
                }
                $td_post_count++;
            }
        }
        $buffy .= $td_block_layout->close_all_tags();
        $buffy .= '</div>';
        //close slider
        $buffy .= '<div class = "prevButton"></div>';
        $buffy .= '<div class = "nextButton"></div>';
        $buffy .= '</div>';
        //clos ios
        if (!empty($autoplay)) {
            $autoplay_string = '
            autoSlide: true,
            autoSlideTimer: ' . $autoplay * 1000 . ',
            ';
        } else {
            $autoplay_string = '';
        }
        $slide_js = '
jQuery(document).ready(function() {
    jQuery("#' . $td_unique_id_slide . '").iosSlider({
        snapToChildren: true,
        desktopClickDrag: true,
        keyboardControls: false,
        ' . $autoplay_string . '

        infiniteSlider: true,
        navPrevSelector: jQuery("#' . $td_unique_id_slide . ' .prevButton"),
        navNextSelector: jQuery("#' . $td_unique_id_slide . ' .nextButton"),
        onSlideComplete: slideContentComplete,
        onSlideStart: slideStartedMoving
    });
});
    ';
        if ($is_ajax) {
            $buffy .= '<script>' . $slide_js . '</script>';
        } else {
            td_js_buffer::add_to_footer($slide_js);
        }
        return $buffy;
    }
Exemplo n.º 24
0
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()));
}
Exemplo n.º 25
0
 function wp_head_hook()
 {
     $responsive = td_util::get_option('tds_responsive');
     td_js_buffer::add_variable('td_responsive', $responsive);
 }
<?php

// Template 6 - post-final-6.psd - full image background
$td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full');
//if we have a featured image, show it
if (!empty($td_post_featured_image)) {
    //css fix add gradient overlay + shadow
    td_js_buffer::add_to_footer('jQuery().ready(function() {' . "\r\n" . 'jQuery(\'body\').prepend(\'<div class="td-full-screen-header-image-wrap"><div id="td-full-screen-header-image" class="td-image-gradient"></div></div>\');' . "\r\n" . "jQuery('#td-full-screen-header-image').backstretch('" . $td_post_featured_image . "', {fade:1200, centeredY:false});" . "\r\n" . 'td_post_template_6_title();' . "\r\n" . '});');
}
//get the global sidebar position from single.php
global $loop_sidebar_position;
$td_mod_single = new td_module_single($post);
?>
<article id="post-<?php 
echo $td_mod_single->post->ID;
?>
" class="<?php 
echo join(' ', get_post_class('td-post-template-6'));
?>
" <?php 
echo $td_mod_single->get_item_scope();
?>
>


    <div class="template6-header">
        <div class="td-post-header td-container" id="td_parallax_header_6">

            <header class="td-pb-padding-side">
                <?php 
echo $td_mod_single->get_category();