• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_default_styles函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_default_styles函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_default_styles函数的具体用法?PHP wp_default_styles怎么用?PHP wp_default_styles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: preg_replace

    return @file_get_contents($path);
}
require ABSPATH . '/wp-includes/script-loader.php';
require ABSPATH . '/wp-includes/version.php';
$load = preg_replace('/[^a-z0-9,_-]+/i', '', $_GET['load']);
$load = explode(',', $load);
if (empty($load)) {
    exit;
}
$compress = isset($_GET['c']) && $_GET['c'];
$force_gzip = $compress && 'gzip' == $_GET['c'];
$rtl = isset($_GET['dir']) && 'rtl' == $_GET['dir'];
$expires_offset = 31536000;
$out = '';
$wp_styles = new WP_Styles();
wp_default_styles($wp_styles);
foreach ($load as $handle) {
    if (!array_key_exists($handle, $wp_styles->registered)) {
        continue;
    }
    $style = $wp_styles->registered[$handle];
    $path = ABSPATH . $style->src;
    $content = get_file($path) . "\n";
    if ($rtl && isset($style->extra['rtl']) && $style->extra['rtl']) {
        $rtl_path = is_bool($style->extra['rtl']) ? str_replace('.css', '-rtl.css', $path) : ABSPATH . $style->extra['rtl'];
        $content .= get_file($rtl_path) . "\n";
    }
    $out .= str_replace('../images/', 'images/', $content);
}
header('Content-Type: text/css');
header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $expires_offset) . ' GMT');
开发者ID:papayalabs,项目名称:htdocs,代码行数:31,代码来源:load-styles.php


示例2: OutputHead

 function OutputHead($bUseEnqueue, $xmlCssData, $xmlScriptData)
 {
     // ** Standard css
     $wp_styles = false;
     $standardCss = $xmlCssData->getElementsByTagName("standard");
     foreach ($standardCss as $iStdCss) {
         if ($bUseEnqueue) {
             wp_enqueue_style($iStdCss->attributes->getNamedItem("name")->nodeValue);
         } else {
             // Get all the default Wordpress styles
             // Note: This is done here for efficiency (if no standard wordpress css files are required, this will never be executed)
             if (!$wp_styles) {
                 $wp_styles = new WP_Styles();
                 wp_default_styles($wp_styles);
             }
             $stdCssName = $iStdCss->attributes->getNamedItem("name")->nodeValue;
             if (!array_key_exists($stdCssName, $wp_styles->registered)) {
                 continue;
             }
             echo "<link rel='stylesheet' id='{$stdCssName}-css' href='" . site_url($wp_styles->registered[$stdCssName]->src) . "' type='text/css' media='all'  />\n";
             // Note: Wordpress also appends a ?ver=xx to the end of href (and encodes href with esc_attr)
         }
     }
     // * Custom css
     $customCss = $xmlCssData->getElementsByTagName("custom");
     foreach ($customCss as $iCustomCss) {
         if ($bUseEnqueue) {
             $dependencies = false;
             if (isset($iCustomCss->attributes->getNamedItem("dependencies")->nodeValue)) {
                 $dependencies = explode(";", $iCustomCss->attributes->getNamedItem("dependencies")->nodeValue);
             }
             wp_deregister_style($iCustomCss->attributes->getNamedItem("name")->nodeValue);
             wp_register_style($iCustomCss->attributes->getNamedItem("name")->nodeValue, $iCustomCss->attributes->getNamedItem("src")->nodeValue, $dependencies, false);
             wp_enqueue_style($iCustomCss->attributes->getNamedItem("name")->nodeValue);
         } else {
             $CssName = $iCustomCss->attributes->getNamedItem("name")->nodeValue;
             $CssSrc = $iCustomCss->attributes->getNamedItem("src")->nodeValue;
             echo "<link rel='stylesheet' id='{$CssName}-css' href='{$CssSrc}' type='text/css' media='all' />\n";
             // Note: Wordpress also appends a ?ver=xx to the end of href (and encodes href with esc_attr)
         }
     }
     // * Standard script
     global $wp_scripts;
     $standardScripts = $this->ExtractStandardScripts($xmlScriptData, !$bUseEnqueue);
     // We don't need to explicitly handle dependencies if we use enqueue (since Wordpress does this for us)
     foreach ($standardScripts as $iStdScript) {
         if ($bUseEnqueue) {
             wp_enqueue_script($iStdScript);
         } else {
             // Get all the default Wordpress scripts
             // Note: This is done here for efficiency (if no standard wordpress script files are required, this will never be executed)
             if (!$wp_scripts) {
                 $wp_scripts = new WP_Scripts();
                 wp_default_scripts($wp_scripts);
             }
             if (!array_key_exists($iStdScript, $wp_scripts->registered)) {
                 continue;
             }
             echo "<script type='text/javascript' src='" . site_url($wp_scripts->registered[$iStdScript]->src) . "'></script>";
         }
     }
     // * Custom script
     $customScripts = $xmlScriptData->getElementsByTagName("custom");
     foreach ($customScripts as $iCustomScript) {
         if ($bUseEnqueue) {
             $dependencies = false;
             if (isset($iCustomScript->attributes->getNamedItem("dependencies")->nodeValue)) {
                 $dependencies = explode(";", $iCustomScript->attributes->getNamedItem("dependencies")->nodeValue);
             }
             wp_deregister_script($iCustomScript->attributes->getNamedItem("name")->nodeValue);
             wp_register_script($iCustomScript->attributes->getNamedItem("name")->nodeValue, $iCustomScript->attributes->getNamedItem("src")->nodeValue, $dependencies, false);
             wp_enqueue_script($iCustomScript->attributes->getNamedItem("name")->nodeValue);
         } else {
             $ScriptName = $iCustomScript->attributes->getNamedItem("name")->nodeValue;
             $ScriptSrc = $iCustomScript->attributes->getNamedItem("src")->nodeValue;
             echo "<script type='text/javascript' src='{$ScriptSrc}'></script>";
             // Note: Wordpress also appends a ?ver=xx to the end of src (and encodes href with esc_attr)
         }
     }
 }
开发者ID:elviosc,项目名称:crankyads,代码行数:80,代码来源:ContentController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_defer_comment_counting函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_default_scripts函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap