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


PHP ReduxFramework_typography::makeGoogleWebfontString方法代码示例

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


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

示例1: _enqueue_output

        /**
         * Enqueue CSS/JS for options page
         *
         * @since       1.0.0
         * @access      public
         * @global      $wp_styles
         * @return      void
         */
        public function _enqueue_output()
        {
            if ($this->args['output'] == false && $this->args['compiler'] == false) {
                return;
            }
            /** @noinspection PhpUnusedLocalVariableInspection */
            foreach ($this->sections as $k => $section) {
                if (isset($section['type']) && $section['type'] == 'divide') {
                    continue;
                }
                if (isset($section['fields'])) {
                    /** @noinspection PhpUnusedLocalVariableInspection */
                    foreach ($section['fields'] as $fieldk => $field) {
                        if (isset($field['type']) && $field['type'] != "callback") {
                            $field_class = "ReduxFramework_{$field['type']}";
                            if (!class_exists($field_class)) {
                                if (!isset($field['compiler'])) {
                                    $field['compiler'] = "";
                                }
                                /**
                                 * Field class file
                                 *
                                 * filter 'redux/{opt_name}/field/class/{field.type}
                                 * @param string        field class file
                                 * @param array $field  field config data
                                 */
                                $class_file = apply_filters("redux/{$this->args['opt_name']}/field/class/{$field['type']}", self::$_dir . "inc/fields/{$field['type']}/field_{$field['type']}.php", $field);
                                if ($class_file && file_exists($class_file) && !class_exists($field_class)) {
                                    /** @noinspection PhpIncludeInspection */
                                    require_once $class_file;
                                }
                            }
                            if (!empty($this->options[$field['id']]) && class_exists($field_class) && method_exists($field_class, 'output') && $this->_can_output_css($field)) {
                                if (!empty($field['output']) && !is_array($field['output'])) {
                                    $field['output'] = array($field['output']);
                                }
                                $value = isset($this->options[$field['id']]) ? $this->options[$field['id']] : '';
                                $enqueue = new $field_class($field, $value, $this);
                                /** @noinspection PhpUndefinedMethodInspection */
                                if (isset($field['output']) && !empty($field['output']) || isset($field['compiler']) && !empty($field['compiler']) || $field['type'] == "typography") {
                                    $enqueue->output();
                                }
                            }
                        }
                    }
                }
            }
            if (!empty($this->outputCSS) && $this->args['output_tag'] == true) {
                echo '<style type="text/css" title="dynamic-css" class="options-output">' . $this->outputCSS . '</style>';
            }
            if (!empty($this->typography) && !empty($this->typography) && filter_var($this->args['output'], FILTER_VALIDATE_BOOLEAN)) {
                $version = !empty($this->options['REDUX_last_saved']) ? $this->options['REDUX_last_saved'] : '';
                $typography = new ReduxFramework_typography(null, null, $this);
                if ($this->args['async_typography'] && !empty($this->typography)) {
                    $families = array();
                    foreach ($this->typography as $key => $value) {
                        $families[] = $key;
                    }
                    ?>
                    <script>

                      /* You can add more configuration options to webfontloader by previously defining the WebFontConfig with your options */
                      if (typeof WebFontConfig === "undefined") { WebFontConfig = new Object(); }
                      WebFontConfig['google'] = { families: [<?php 
                    echo $typography->makeGoogleWebfontString($this->typography);
                    ?>
] };

                      (function() {
                        var wf = document.createElement('script');
                        wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.0/webfont.js';
                        wf.type = 'text/javascript';
                        wf.async = 'true';
                        var s = document.getElementsByTagName('script')[0];
                        s.parentNode.insertBefore(wf, s);
                      })();
                    </script><style>.wf-loading{visibility:hidden;}</style>
                    <?php 
                } else {
                    echo '<link rel="stylesheet" id="options-google-fonts"  href="' . $typography->makeGoogleWebfontLink($this->typography) . '&amp;v=' . $version . '" type="text/css" media="all" />';
                    //wp_register_style( 'redux-google-fonts', $typography->makeGoogleWebfontLink( $this->typography ), '', $version );
                    //wp_enqueue_style( 'redux-google-fonts' );
                }
            }
        }
开发者ID:patlegris,项目名称:angularpresstheme,代码行数:93,代码来源:framework.php

示例2: _enqueue_output

        /**
         * Enqueue CSS and Google fonts for front end
         *
         * @since       1.0.0
         * @access      public
         * @return      void
         */
        public function _enqueue_output()
        {
            if ($this->args['output'] == false && $this->args['compiler'] == false) {
                return;
            }
            /** @noinspection PhpUnusedLocalVariableInspection */
            foreach ($this->sections as $k => $section) {
                if (isset($section['type']) && $section['type'] == 'divide') {
                    continue;
                }
                if (isset($section['fields'])) {
                    /** @noinspection PhpUnusedLocalVariableInspection */
                    foreach ($section['fields'] as $fieldk => $field) {
                        if (isset($field['type']) && $field['type'] != "callback") {
                            $field_class = "ReduxFramework_{$field['type']}";
                            if (!class_exists($field_class)) {
                                if (!isset($field['compiler'])) {
                                    $field['compiler'] = "";
                                }
                                /**
                                 * Field class file
                                 * filter 'redux/{opt_name}/field/class/{field.type}
                                 *
                                 * @param       string        field class file
                                 * @param array $field        field config data
                                 */
                                $class_file = apply_filters("redux/{$this->args['opt_name']}/field/class/{$field['type']}", self::$_dir . "inc/fields/{$field['type']}/field_{$field['type']}.php", $field);
                                if ($class_file && file_exists($class_file) && !class_exists($field_class)) {
                                    /** @noinspection PhpIncludeInspection */
                                    require_once $class_file;
                                }
                            }
                            if (!empty($this->options[$field['id']]) && class_exists($field_class) && method_exists($field_class, 'output') && $this->_can_output_css($field)) {
                                $field = apply_filters("redux/field/{$this->args['opt_name']}/output_css", $field);
                                if (!empty($field['output']) && !is_array($field['output'])) {
                                    $field['output'] = array($field['output']);
                                }
                                $value = isset($this->options[$field['id']]) ? $this->options[$field['id']] : '';
                                $enqueue = new $field_class($field, $value, $this);
                                if (isset($field['output']) && !empty($field['output']) || isset($field['compiler']) && !empty($field['compiler']) || $field['type'] == "typography" || $field['type'] == "icon_select") {
                                    $enqueue->output();
                                }
                            }
                        }
                    }
                }
            }
            // For use like in the customizer. Stops the output, but passes the CSS in the variable for the compiler
            if (isset($this->no_output)) {
                return;
            }
            if (!empty($this->typography) && !empty($this->typography) && filter_var($this->args['output'], FILTER_VALIDATE_BOOLEAN)) {
                $version = !empty($this->transients['last_save']) ? $this->transients['last_save'] : '';
                $typography = new ReduxFramework_typography(null, null, $this);
                if ($this->args['async_typography'] && !empty($this->typography)) {
                    $families = array();
                    foreach ($this->typography as $key => $value) {
                        $families[] = $key;
                    }
                    ?>
                        <script>
                            /* You can add more configuration options to webfontloader by previously defining the WebFontConfig with your options */
                            if ( typeof WebFontConfig === "undefined" ) {
                                WebFontConfig = new Object();
                            }
                            WebFontConfig['google'] = {families: [<?php 
                    echo $typography->makeGoogleWebfontString($this->typography);
                    ?>
]};

                            (function() {
                                var wf = document.createElement( 'script' );
                                wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.3/webfont.js';
                                wf.type = 'text/javascript';
                                wf.async = 'true';
                                var s = document.getElementsByTagName( 'script' )[0];
                                s.parentNode.insertBefore( wf, s );
                            })();
                        </script>
                    <?php 
                } elseif (!$this->args['disable_google_fonts_link']) {
                    $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https:" : "http:";
                    //echo '<link rel="stylesheet" id="options-google-fonts" title="" href="'.$protocol.$typography->makeGoogleWebfontLink( $this->typography ).'&amp;v='.$version.'" type="text/css" media="all" />';
                    wp_register_style('redux-google-fonts-' . $this->args['opt_name'], $protocol . $typography->makeGoogleWebfontLink($this->typography), '', $version);
                    wp_enqueue_style('redux-google-fonts-' . $this->args['opt_name']);
                }
            }
        }
开发者ID:aguerojahannes,项目名称:aguerojahannes.com,代码行数:95,代码来源:framework.php


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