當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Stylesheet::add_rules方法代碼示例

本文整理匯總了PHP中Stylesheet::add_rules方法的典型用法代碼示例。如果您正苦於以下問題:PHP Stylesheet::add_rules方法的具體用法?PHP Stylesheet::add_rules怎麽用?PHP Stylesheet::add_rules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Stylesheet的用法示例。


在下文中一共展示了Stylesheet::add_rules方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _parse_schemes_css_code

 protected function _parse_schemes_css_code()
 {
     foreach (Plugin::instance()->widgets_manager->get_widget_types() as $widget) {
         foreach ($widget->get_scheme_controls() as $control) {
             $scheme_value = Plugin::instance()->schemes_manager->get_scheme_value($control['scheme']['type'], $control['scheme']['value']);
             if (empty($scheme_value)) {
                 continue;
             }
             if (!empty($control['scheme']['key'])) {
                 $scheme_value = $scheme_value[$control['scheme']['key']];
             }
             if (empty($scheme_value)) {
                 continue;
             }
             $element_unique_class = 'elementor-widget-' . $widget->get_name();
             $control_obj = Plugin::instance()->controls_manager->get_control($control['type']);
             if (Controls_Manager::FONT === $control_obj->get_type()) {
                 $this->add_enqueue_font($scheme_value);
             }
             foreach ($control['selectors'] as $selector => $css_property) {
                 $output_selector = str_replace('{{WRAPPER}}', '.' . $element_unique_class, $selector);
                 $output_css_property = $control_obj->get_replaced_style_values($css_property, $scheme_value);
                 $this->stylesheet->add_rules($output_selector, $output_css_property);
             }
         }
     }
 }
開發者ID:pojome,項目名稱:elementor,代碼行數:27,代碼來源:frontend.php

示例2: add_control_style_rules

 private function add_control_style_rules($control, $value, $placeholders, $replacements)
 {
     if (!is_numeric($value) && !is_float($value) && empty($value)) {
         return;
     }
     if (Controls_Manager::FONT === $control['type']) {
         $this->fonts[] = $value;
     }
     $control_obj = Plugin::instance()->controls_manager->get_control($control['type']);
     foreach ($control['selectors'] as $selector => $css_property) {
         $parsed_css_property = $control_obj->get_replaced_style_values($css_property, $value);
         if (!$parsed_css_property) {
             continue;
         }
         $parsed_selector = str_replace($placeholders, $replacements, $selector);
         $device = !empty($control['responsive']) ? $control['responsive'] : Element_Base::RESPONSIVE_DESKTOP;
         $this->stylesheet_obj->add_rules($parsed_selector, $parsed_css_property, $device);
     }
 }
開發者ID:pojome,項目名稱:elementor,代碼行數:19,代碼來源:post-css-file.php


注:本文中的Stylesheet::add_rules方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。