Пример #1
0
 /**
  * echo global CSS with wrapper
  */
 public static function output_global_css_styles_wrapped()
 {
     $base = new Essential_Grid_Base();
     echo '<style type="text/css">';
     echo $base->compress_css(self::get_global_css_styles());
     echo '</style>' . "\n";
 }
Пример #2
0
 public static function output_navigation_skins()
 {
     $base = new Essential_Grid_Base();
     $skins = self::get_essential_navigation_skins();
     $css = '';
     if (!empty($skins)) {
         foreach ($skins as $skin) {
             $css .= '<style class="navigation-skin-css-' . $skin['id'] . '" type="text/css">';
             $css .= $base->compress_css($skin['css']);
             $css .= '</style>' . "\n";
         }
     }
     return $css;
 }
 public function output_element_css_by_meta()
 {
     $base = new Essential_Grid_Base();
     $disallowed = array('transition', 'transition-delay');
     $allowed_wrap_styles = Essential_Grid_Item_Element::get_allowed_styles_for_wrap();
     $post_Class = !isset($post['ID']) ? '' : $post['ID'];
     $p_class = '.eg-post-' . $post_Class;
     if (!empty($this->layers_meta_css['idle'])) {
         echo '<style type="text/css">';
         $css = '';
         foreach ($this->layers_meta_css['idle'] as $class => $settings) {
             $forbidden = array();
             if (!empty($this->add_css_wrap) && isset($this->add_css_wrap[$class])) {
                 $forbidden = $allowed_wrap_styles;
             }
             //write hover only if no tag inside the text exists
             $d_i = $this->layers_css[$this->id]['settings'][$class]['important'];
             //add important or not
             if (!empty($settings)) {
                 $css .= '.' . $class . $p_class . ' {' . "\n";
                 foreach ($settings as $style => $value) {
                     if (!in_array($style, $forbidden) && !in_array($style, $disallowed)) {
                         $css .= '	' . $style . ': ' . stripslashes($value) . $d_i . ';' . "\n";
                     }
                 }
                 $css .= '}' . "\n";
             }
         }
         echo $base->compress_css($css);
         echo '</style>' . "\n";
     }
     if (!empty($this->layers_meta_css['hover'])) {
         echo '<style type="text/css">';
         $css = '';
         foreach ($this->layers_meta_css['hover'] as $class => $settings) {
             if (!empty($this->add_css_tags) && isset($this->add_css_tags[$class])) {
                 continue;
             }
             //write hover only if no tag inside the text exists
             $d_i = $this->layers_css[$this->id]['settings'][$class]['important'];
             //add important or not
             if (!empty($settings)) {
                 $css .= '.' . $class . $p_class . ':hover {' . "\n";
                 foreach ($settings as $style => $value) {
                     $css .= '	' . $style . ': ' . stripslashes($value) . $d_i . ';' . "\n";
                 }
                 $css .= '}' . "\n";
             }
         }
         echo $base->compress_css($css);
         echo '</style>' . "\n";
     }
     //check for custom css on tags
     if (!empty($this->add_css_tags)) {
         $allowed_styles = Essential_Grid_Item_Element::get_allowed_styles_for_tags();
         foreach ($this->add_css_tags as $class => $tags) {
             if (!empty($this->layers_meta_css['idle'][$class])) {
                 // we write the idle styles
                 $d_i = $this->layers_css[$this->id]['settings'][$class]['important'];
                 //add important or not
                 foreach ($tags as $tag => $do) {
                     echo '<style type="text/css">';
                     $css = '';
                     $css .= '.' . $class . $p_class . ' ' . $tag . ' {' . "\n";
                     foreach ($this->layers_meta_css['idle'][$class] as $style => $value) {
                         if (in_array($style, $allowed_styles)) {
                             $css .= '	' . $style . ': ' . stripslashes($value) . $d_i . ';' . "\n";
                         }
                     }
                     $css .= '}' . "\n";
                     echo $base->compress_css($css);
                     echo '</style>' . "\n";
                 }
             }
             if (!empty($this->layers_meta_css['hover'][$class])) {
                 // we write the hover styles
                 $d_i = $this->layers_css[$this->id]['settings'][$class]['important'];
                 //add important or not
                 foreach ($tags as $tag => $do) {
                     echo '<style type="text/css">';
                     $css = '';
                     $css .= '.' . $class . $p_class . ' ' . $tag . ':hover {' . "\n";
                     foreach ($this->layers_meta_css['hover'][$class] as $style => $value) {
                         if (in_array($style, $allowed_styles)) {
                             $css .= '	' . $style . ': ' . stripslashes($value) . $d_i . ';' . "\n";
                         }
                     }
                     $css .= '}' . "\n";
                     echo $base->compress_css($css);
                     echo '</style>' . "\n";
                 }
             }
         }
     }
     //check for custom css on wrappers for example
     if (!empty($this->add_css_wrap)) {
         $allowed_cat_tag_styles = Essential_Grid_Item_Element::get_allowed_styles_for_cat_tag();
         foreach ($this->add_css_wrap as $class => $tags) {
             if (!empty($this->layers_meta_css['idle'][$class])) {
                 // we write the idle styles
                 $d_i = $this->layers_css[$this->id]['settings'][$class]['important'];
                 //add important or not
                 foreach ($tags as $tag => $do) {
                     echo '<style type="text/css">' . "\n";
                     $css = '';
                     $css .= '.' . $class . '-' . $tag . $p_class . ' {' . "\n";
                     if (!empty($this->add_css_wrap) && isset($this->add_css_wrap[$class]) && isset($this->add_css_wrap[$class]['a']) && $this->add_css_wrap[$class]['a']['full'] == true) {
                         // set more styles (used for cat & tag list)
                         $allowed_styles = array_merge($allowed_cat_tag_styles, $allowed_wrap_styles);
                     } else {
                         $allowed_styles = $allowed_wrap_styles;
                     }
                     foreach ($this->layers_meta_css['idle'][$class] as $style => $value) {
                         if (in_array($style, $allowed_styles)) {
                             $css .= '	' . $style . ': ' . stripslashes($value) . $d_i . ';' . "\n";
                         }
                     }
                     $css .= '}' . "\n";
                     echo $base->compress_css($css);
                     echo '</style>' . "\n";
                 }
             }
         }
     }
 }