Пример #1
0
 /** 
  * BOX SECTION                    
  * 
  * @description
  *    Shows a box, with Title and icons on left and a text of section (you can use HTMl tags)  
  * 
  * @example
  *   [section icon="" [size=""] title="" [class=""] [last=""] [border=""]]text[/section]
  * 
  * @attr  
  *   class - class of container of box (optional) @default: 'box-sections'
  *   icon  - one of set already been in $icons_name array
  *   size  - icons size (32 or 48) (optional) @default: 48 
  *   last  - specifics if this section is the last element (optional) @default: false 
  *   title - the title
  *   text  - text of the section
  *   border  - add border class
 **/
 function yiw_sc_section_func($atts, $content = null)
 {
     extract(shortcode_atts(array('class' => 'box-sections', 'before_title' => '<h3>', 'title_size' => '', 'title' => null, 'icon' => null, 'size' => 32, 'last' => false, 'border' => false, 'link' => '', 'link_title' => ''), $atts));
     $a_before = $a_after = '';
     if (!empty($before_title) && empty($title_size)) {
         $before_title = str_replace('<', '', $before_title);
         $before_title = str_replace('>', '', $before_title);
         $title_size = $before_title;
     }
     $img = '';
     if (!is_null($icon)) {
         $img = yiw_get_img('images/icons/set_icons/' . $icon . $size . '.png', $title, 'icon');
         if (empty($img)) {
             $img = yiw_get_img('images/icons/set_icons/' . $icon . '.png', $title, 'icon');
         }
     }
     $last_class = '';
     if ($last) {
         $last_class = ' last';
     }
     if ($border) {
         $class .= '-border';
     }
     if (!empty($link)) {
         $link = esc_url($link);
         if (!empty($link_title)) {
             $link_title = " title=\"{$link_title}\"";
         }
         $a_before = "<a href=\"{$link}\"{$link_title}>";
         $a_after = "</a>";
     }
     $html = "\n";
     $html .= "<div class=\"{$class}{$last_class}\">\n";
     $html .= "    {$a_before}\n";
     $html .= "    {$img}\n";
     $html .= "    <{$title_size}><span style=\"line-height:{$size}px\">{$title}</span></{$title_size}>";
     $html .= "    {$a_after}\n";
     $html .= "    " . wpautop(do_shortcode($content)) . "\n";
     $html .= "</div>\n";
     return apply_filters('yiw_sc_section_html', $html);
 }
Пример #2
0
/** 
 * Echo tag image, get from relative path on param (without slash first)
 * 
 * @since 1.0  
 */
function yiw_img($relative_path, $alt = '', $class = '')
{
    echo yiw_get_img($relative_path, $alt, $class);
}
Пример #3
0
 /** 
  * QUICK CONTACT BOX     
  * 
  * @description
  *    Create a box for quick contact with tab.    
  * 
  * @example
  *   [quick_contact [class=""] icon1="" icon2=""]
  *       [tab id=1]Text[/tab]
  *       [tab id=2]Text[/tab]
  *   [/quick_contact]
  * 
  * @attr  
  *   iconN - the icon of each tab
  *   id - the id of each tab    
  *   text - the text
 **/
 function yiw_sc_quick_contact_func($atts, $content = null)
 {
     extract(shortcode_atts(array("class" => 'quick-contact-box'), $atts));
     $html = '<div class="' . $class . ' group">' . "\n";
     $html .= '    <ul class="nav-box">' . "\n";
     $i = 1;
     foreach ($atts as $attr => $value) {
         if (!preg_match('/icon([0-9]{1,2})/', $attr)) {
             continue;
         }
         $html .= '<li><a href="#icon' . $i . '">' . yiw_get_img('images/icons/set_icons/' . $value . '.png', 'Image Tab ' . $i, 'nofade') . '</a></li>' . "\n";
         $i++;
     }
     $html .= '    </ul>' . "\n";
     $html .= '<div class="box-info group">' . $content . '</div>';
     $html .= '</div>' . "\n";
     $html = do_shortcode($html);
     return apply_filters('yiw_sc_quick_contact_html', $html);
 }