Exemplo n.º 1
0
 function _render_sidebar($fields, $name, $attributes)
 {
     $guid = $fields['guid'];
     if (!isset($this->_render_guid_count)) {
         $this->_render_guid_count = array();
     }
     if (!isset($this->_render_guid_count[$guid])) {
         $this->_render_guid_count[$guid] = 1;
     } else {
         $this->_render_guid_count[$guid]++;
     }
     $fields['sidebar_id'] = "{$guid}-{$this->_render_guid_count[$guid]}";
     $fields['sidebar_name'] = $name;
     $fields['attributes'] = $attributes;
     $results = apply_filters('builder_module_filter_sidebar_wrapper_attributes', $fields);
     ITUtility::print_open_tag('div', $results['attributes']);
     unset($fields['attributes']);
     do_action('builder_sidebar_render', $fields);
     echo "</div>\n";
 }
Exemplo n.º 2
0
 function _render($fields)
 {
     $data = $fields['data'];
     if (!empty($data['attachment'])) {
         if (!wp_attachment_is_image($data['attachment'])) {
             return;
         }
         $post = get_post($data['attachment']);
         $file = get_attached_file($data['attachment']);
     } else {
         if (!empty($data['manual_file'])) {
             $file = builder_main_get_builder_core_path() . '/lib/layout-engine/default-images/' . $data['manual_file'];
             if (!file_exists($file)) {
                 return;
             }
         }
     }
     $image_width = $fields['widths']['element_width'];
     it_classes_load('it-file-utility.php');
     if ('custom' == $data['height_type']) {
         $resized_image = ITFileUtility::resize_image($file, $image_width, $data['height'], true);
     } else {
         $resized_image = ITFileUtility::resize_image($file, $image_width);
     }
     if (!is_array($resized_image) && is_wp_error($resized_image)) {
         echo "<!-- Resize Error: " . $resized_image->get_error_message() . " -->";
     } else {
         $image_url = $resized_image['url'];
     }
     if (!empty($data['url'])) {
         $attributes['href'] = $data['url'];
         if (!empty($data['new_window'])) {
             $attributes['target'] = '_blank';
         }
         ITUtility::print_open_tag('a', $attributes);
     }
     if (!empty($data['image_alt'])) {
         $alt = $data['image_alt'];
     }
     if (empty($alt)) {
         $alt = get_post_meta($data['attachment'], '_wp_attachment_image_alt', true);
     }
     if (empty($alt)) {
         $alt = $data['name'];
     }
     $attributes = array('src' => $image_url, 'alt' => $alt);
     $new_attributes = apply_filters('builder_image_module_filter_img_attributes', $attributes, $fields);
     if (empty($new_attributes)) {
         $new_attributes = $attributes;
     } else {
         if (empty($new_attributes['src'])) {
             $new_attributes['src'] = $attributes['src'];
         }
     }
     $attributes = $new_attributes;
     ITUtility::print_self_closing_tag('img', $attributes);
     if (!empty($data['url'])) {
         echo "</a>";
     }
 }
Exemplo n.º 3
0
 function _render_container_start()
 {
     $background_wrapper_attributes = array('class' => array('builder-container-background-wrapper'));
     $background_wrapper_attributes = apply_filters('builder_filter_container_background_wrapper_attributes', $background_wrapper_attributes);
     $width = apply_filters('builder_get_container_width', 0);
     $outer_wrapper_attributes = array('class' => array('builder-container-outer-wrapper'), 'style' => array());
     $outer_wrapper_attributes = apply_filters('builder_filter_container_outer_wrapper_attributes', $outer_wrapper_attributes);
     if (empty($outer_wrapper_attributes['style'])) {
         unset($outer_wrapper_attributes['style']);
     }
     $inner_wrapper_attributes = array('class' => array('builder-container'), 'id' => "builder-container-{$this->_layout['guid']}");
     $inner_wrapper_attributes = apply_filters('builder_filter_container_inner_wrapper_attributes', $inner_wrapper_attributes);
     ITUtility::print_open_tag('div', $background_wrapper_attributes);
     ITUtility::print_open_tag('div', $outer_wrapper_attributes);
     ITUtility::print_open_tag('div', $inner_wrapper_attributes);
 }