コード例 #1
0
 function attr()
 {
     global $smof_data;
     if (strpos($smof_data['site_width'], '%') === false && strpos($smof_data['site_width'], 'px') === false) {
         $smof_data['site_width'] = $smof_data['site_width'] . 'px';
     }
     $site_width = (int) $smof_data['site_width'];
     $site_width_percent = false;
     if (strpos($smof_data['site_width'], '%') !== false) {
         $site_width_percent = true;
     }
     $int_left_padding = (int) self::$args['padding_left'];
     $int_right_padding = (int) self::$args['padding_right'];
     $object_id = get_queried_object_id();
     $c_pageID = FusionCore_Plugin::c_pageID();
     $width_100 = false;
     $page_template = '';
     if (function_exists('is_woocommerce')) {
         if (is_woocommerce()) {
             $custom_fields = get_post_custom_values('_wp_page_template', $c_pageID);
             $page_template = is_array($custom_fields) && !empty($custom_fields) ? $custom_fields[0] : '';
         }
     }
     if (is_page_template('100-width.php') || is_page_template('blank.php') || ('1' == fusion_get_option('portfolio_width_100', 'portfolio_width_100', $c_pageID) || 'yes' == fusion_get_option('portfolio_width_100', 'portfolio_width_100', $c_pageID) && 'avada_portfolio' == get_post_type($c_pageID)) || avada_is_portfolio_template() && 'yes' == get_post_meta($c_pageID, 'pyre_portfolio_width_100', true) || '100-width.php' == $page_template) {
         $width_100 = true;
     }
     $attr['class'] = 'fusion-fullwidth fullwidth-box fusion-fullwidth-' . $this->fwc_counter . ' ';
     $attr['style'] = '';
     $attr['class'] .= sprintf(' fusion-parallax-%s', self::$args['background_parallax']);
     if (self::$args['hundred_percent'] == 'yes') {
         $attr['class'] .= ' hundred-percent-fullwidth';
         if ((int) self::$args['padding_left'] > 0 || (int) self::$args['padding_right'] > 0) {
             $attr['class'] .= ' fusion-nonzero-padding';
         }
     } else {
         $attr['class'] .= ' nonhundred-percent-fullwidth';
     }
     if (self::$bg_type == 'video') {
         $attr['class'] .= ' video-background';
     } else {
         if (self::$bg_type == 'faded') {
             $attr['class'] .= ' faded-background';
         }
     }
     if (self::$args['equal_height_columns'] == 'yes') {
         $attr['class'] .= ' fusion-equal-height-columns';
     }
     if (self::$args['border_color']) {
         $attr['style'] .= sprintf('border-color:%s;', self::$args['border_color']);
     }
     if (self::$args['border_size']) {
         $attr['style'] .= sprintf('border-bottom-width: %s;border-top-width: %s;', self::$args['border_size'], self::$args['border_size']);
     }
     if (self::$args['border_style']) {
         $attr['style'] .= sprintf('border-bottom-style: %s;border-top-style: %s;', self::$args['border_style'], self::$args['border_style']);
     }
     if (self::$args['padding_bottom']) {
         $attr['style'] .= sprintf('padding-bottom:%s;', self::$args['padding_bottom']);
     }
     if (self::$args['padding_top']) {
         $attr['style'] .= sprintf('padding-top:%s;', self::$args['padding_top']);
     }
     if (self::$args['padding_left']) {
         $attr['style'] .= sprintf('padding-left:%s;', self::$args['padding_left']);
     }
     if (self::$args['padding_right']) {
         $attr['style'] .= sprintf('padding-right:%s;', self::$args['padding_right']);
     }
     if (self::$args['hundred_percent'] == 'no' && (int) self::$args['padding_left'] > 0 && $width_100 == true) {
         $attr['style'] .= sprintf('padding-left:%s !important;', self::$args['padding_left']);
     }
     if (self::$args['hundred_percent'] == 'no' && (int) self::$args['padding_right'] > 0 && $width_100 == true) {
         $attr['style'] .= sprintf('padding-right:%s !important;', self::$args['padding_right']);
     }
     if (self::$args['id']) {
         $attr['id'] = self::$args['id'];
     }
     if (self::$args['class']) {
         $attr['class'] .= ' ' . self::$args['class'];
     }
     if (self::$args['background_image'] && self::$args['background_parallax'] == 'fixed') {
         $attr['style'] .= 'background-attachment:fixed;';
     }
     if (self::$args['background_parallax'] == "none" || self::$args['background_parallax'] == "fixed") {
         if (self::$args['background_color']) {
             $attr['style'] .= sprintf('background-color:%s;', self::$args['background_color']);
         }
         if (self::$args['background_image'] && self::$args['background_position']) {
             $attr['style'] .= sprintf('background-position:%s;', self::$args['background_position']);
         }
         if (self::$args['background_image'] && self::$args['background_repeat']) {
             $attr['style'] .= sprintf('background-repeat:%s;', self::$args['background_repeat']);
         }
         if (self::$args['background_image'] && self::$args['background_repeat'] == 'no-repeat') {
             $attr['style'] .= '-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;';
             // IE 8 background-size: cover filter
             if (self::$args['background_image']) {
                 $attr['style'] .= sprintf('-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'%s\', sizingMethod=\'scale\')";', self::$args['background_image']);
             }
         }
         if (self::$bg_type != 'faded') {
             if (self::$args['background_image']) {
                 $attr['style'] .= sprintf('background-image: url(%s);', self::$args['background_image']);
             }
         }
     }
     if (self::$args['hide_on_mobile'] == 'yes') {
         $attr['class'] .= ' fusion-hide-on-mobile';
     }
     return $attr;
 }