function section_template() { // The boxes $ibox_array = $this->opt('ibox_array'); $format_upgrade_mapping = array('text' => 'ibox_text_%s', 'title' => 'ibox_title_%s', 'link' => 'ibox_link_%s', 'class' => 'ibox_class_%s', 'image' => 'ibox_image_%s', 'icon' => 'ibox_icon_%s'); $ibox_array = $this->upgrade_to_array_format('ibox_array', $ibox_array, $format_upgrade_mapping, $this->opt('ibox_count')); // must come after upgrade if (!$ibox_array || $ibox_array == 'false' || !is_array($ibox_array)) { $ibox_array = array(array(), array(), array()); } // Keep $cols = $this->opt('ibox_cols') ? $this->opt('ibox_cols') : 4; $media_type = $this->opt('ibox_media') ? $this->opt('ibox_media') : 'icon'; $media_format = $this->opt('ibox_format') ? $this->opt('ibox_format') : 'top'; $width = 0; $output = ''; $count = 1; if (is_array($ibox_array)) { $boxes = count($ibox_array); foreach ($ibox_array as $ibox) { $text = pl_array_get('text', $ibox, 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean id lectus sem. Cras consequat lorem.'); $title = pl_array_get('title', $ibox, 'iBox ' . $count); $link = pl_array_get('link', $ibox); $user_class = pl_array_get('class', $ibox); $image = pl_array_get('image', $ibox); $icon = pl_array_get('icon', $ibox); $counter = pl_array_get('count', $ibox, rand(100, 1000)); $color = pl_hash(pl_array_get('color', $ibox), false); $text = sprintf('<div data-sync="ibox_array_item%s_text">%s</div>', $count, $text); $title = sprintf('<h4 data-sync="ibox_array_item%s_title">%s</h4>', $count, $title); $text_link = $link ? sprintf('<div class="ibox-link"><a href="%s">%s <i class="icon icon-angle-right"></i></a></div>', $link, __('More', 'pagelines')) : ''; $text_color = $color && $color != '' ? sprintf('color: %s;', $color) : ''; $format_class = $media_format == 'left' ? 'media left-aligned' : 'top-aligned'; $media_class = 'media-type-' . $media_type; $style = ''; $media_html = ''; if ($media_type == 'icon') { if (!$icon || $icon == '') { $icons = pl_icon_array(); $icon = $icons[array_rand($icons)]; } $background = $color ? sprintf('<span class="invert-icon" style="background-color: %s;"></span>', $color) : ''; $media_html = sprintf('<i class="iii icon icon-3x icon-%s " style="%s"></i>%s', $icon, $text_color, $background); } elseif ($media_type == 'image') { $media_html = ''; $style .= $image ? sprintf('background-image: url(%s);', $image) : ''; } elseif ($media_type == 'count') { $media_html = sprintf('<span class="pl-counter" style="%s">%s</span>', $text_color, $counter); } $wrap_class = 'wrap-' . $media_type; $media_link = ''; $media_link_close = ''; if ($link) { $media_link = sprintf('<a href="%s">', $link); $media_link_close = '</a>'; } if ($width == 0) { $output .= '<div class="row fix">'; } $output .= sprintf('<div class="span%s ibox %s %s %s fix"> <div class="ibox-media img"> %s <span class="ibox-icon-border pl-animation pl-appear pl-link pl-link-invert %s" style="%s"> %s </span> %s </div> <div class="ibox-text bd"> %s <div class="ibox-desc"> %s %s </div> </div> </div>', $cols, $format_class, $user_class, $wrap_class, $media_link, $media_class, $style, $media_html, $media_link_close, $title, $text, $text_link); $width += $cols; if ($width >= 12 || $count == $boxes) { $width = 0; $output .= '</div>'; } $count++; } } printf('<div class="ibox-wrapper pl-animation-group">%s</div>', $output); $scopes = array('local', 'type', 'global'); // foreach($scopes as $scope) // $this->opt_update( 'ibox_array', false, $scope ); }
function pl_get_area_styles($section, $namespace = false) { $namespace = $namespace ? $namespace : $section->id; $bg = $section->opt($namespace . '_background'); $color = $section->opt($namespace . '_color'); $color_enable = $section->opt($namespace . '_color_enable'); $style = array('background' => $bg ? sprintf('background-image: url(%s);', $bg) : '', 'color' => $color_enable ? sprintf('background-color: %s;', pl_hash($color)) : ''); return $style; }