当前位置: 首页>>代码示例>>PHP>>正文


PHP td_util::remove_script_tag方法代码示例

本文整理汇总了PHP中td_util::remove_script_tag方法的典型用法代码示例。如果您正苦于以下问题:PHP td_util::remove_script_tag方法的具体用法?PHP td_util::remove_script_tag怎么用?PHP td_util::remove_script_tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在td_util的用法示例。


在下文中一共展示了td_util::remove_script_tag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render_generic

    /**
     * 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;
    }
开发者ID:luxifel,项目名称:Bionerd,代码行数:59,代码来源:td_weather.php

示例2: td_bottom_code


//.........这里部分代码省略.........
        //paste custom css
        if (!empty($td_custom_css)) {
            $css_buffy .= PHP_EOL . '/* custom css theme panel */' . PHP_EOL;
            $css_buffy .= $td_custom_css . PHP_EOL;
        }
        foreach ($responsive_css_values as $media_query => $responsive_css) {
            $css_buffy .= PHP_EOL . PHP_EOL . '/* custom responsive css from theme panel (Advanced CSS) */';
            $css_buffy .= PHP_EOL . $media_query . ' {' . PHP_EOL;
            $css_buffy .= $responsive_css;
            $css_buffy .= PHP_EOL . '}' . PHP_EOL;
        }
        $css_buffy .= '</style>' . PHP_EOL . PHP_EOL;
        // echo the css buffer
        echo $css_buffy;
    }
    //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 . ']') . ');
                });
            ');
            }
        }
    }
    if (TD_DEBUG_USE_LESS) {
        $style_sheet_path = td_global::$get_template_directory_uri . '/td_less_style.css.php?part=style.css_v2';
    } else {
        $style_sheet_path = get_stylesheet_uri();
    }
    /**
     * javascript splitter js split for IE8 and IE9.
     * It searches in the stylesheet for #td_css_split_separator and adds it in two pieces for ie8 ie9 selector bug
     */
    ob_start();
    ?>
	<script>

		(function(){
			var html_jquery_obj = jQuery('html');

			if (html_jquery_obj.length && (html_jquery_obj.is('.ie8') || html_jquery_obj.is('.ie9'))) {

				var path = '<?php 
    echo $style_sheet_path;
    ?>
';

				jQuery.get(path, function(data) {

					var str_split_separator = '#td_css_split_separator';
					var arr_splits = data.split(str_split_separator);
					var arr_length = arr_splits.length;

					if (arr_length > 1) {

						var dir_path = '<?php 
    echo get_template_directory_uri();
    ?>
';
						var splited_css = '';

						for (var i = 0; i < arr_length; i++) {
							if (i > 0) {
								arr_splits[i] = str_split_separator + ' ' + arr_splits[i];
							}
							//jQuery('head').append('<style>' + arr_splits[i] + '</style>');

							var formated_str = arr_splits[i].replace(/\surl\(\'(?!data\:)/gi, function regex_function(str) {
								return ' url(\'' + dir_path + '/' + str.replace(/url\(\'/gi, '').replace(/^\s+|\s+$/gm,'');
							});

							splited_css += "<style>" + formated_str + "</style>";
						}

						var td_theme_css = jQuery('link#td-theme-css');

						if (td_theme_css.length) {
							td_theme_css.after(splited_css);
						}
					}
				});
			}
		})();

	</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);
}
开发者ID:weerapat,项目名称:wp-daily,代码行数:101,代码来源:td_wp_booster_functions.php

示例3: td_js_generator

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()));
}
开发者ID:Che234,项目名称:andreatelo,代码行数:79,代码来源:td_js_generator.php

示例4: add_js_hook

    private function add_js_hook()
    {
        ob_start();
        // @todo chestia asta ar trebuii trecuta pe flag sau ceva in td_config ?
        ?>

            <script>

	            // if the theme has td_backstr support, it means this already uses it
                if (typeof window.td_backstr !== 'undefined') {

                    (function(){
                        // the site background td-backstretch jquery object is dynamically added in DOM, and after any translation effects are applied over td-backstretch
                        var wrapper_image_jquery_obj = jQuery('<div class=\'backstretch\'></div>');
                        var image_jquery_obj = jQuery('<img class=\'td-backstretch not-parallax\' src=\'<?php 
        echo $this->background_parameters['theme_bg_image'];
        ?>
\'>');

                        wrapper_image_jquery_obj.append(image_jquery_obj);

                        jQuery('body').prepend(wrapper_image_jquery_obj);

                        var td_backstr_item = new td_backstr.item();

                        td_backstr_item.wrapper_image_jquery_obj = wrapper_image_jquery_obj;
                        td_backstr_item.image_jquery_obj = image_jquery_obj;

                        td_backstr.add_item(td_backstr_item);

                    })();
                }

            </script>
            <?php 
        $buffer = ob_get_clean();
        $js = "\n" . td_util::remove_script_tag($buffer);
        return $js;
    }
开发者ID:Che234,项目名称:andreatelo,代码行数:39,代码来源:td_background_render.php

示例5: inner


//.........这里部分代码省略.........
            ?>
" 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();
    }
开发者ID:luxifel,项目名称:Bionerd,代码行数:101,代码来源:td_block_homepage_full_1.php


注:本文中的td_util::remove_script_tag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。