本文整理汇总了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) . '&v=' . $version . '" type="text/css" media="all" />';
//wp_register_style( 'redux-google-fonts', $typography->makeGoogleWebfontLink( $this->typography ), '', $version );
//wp_enqueue_style( 'redux-google-fonts' );
}
}
}
示例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 ).'&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']);
}
}
}