Exemplo n.º 1
0
 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     $title = empty($instance['title']) ? 'Photos on Flickr' : apply_filters('widget_title', $instance['title']);
     $id = empty($instance['id']) ? '' : apply_filters('widget_id', $instance['id']);
     $number = empty($instance['number']) ? 9 : apply_filters('widget_number', $instance['number']);
     echo $before_widget;
     echo $before_title . $title . $after_title;
     echo wip_display_flickr($id, $number);
     echo $after_widget;
 }
 function _content_for_column($type, $fields = "")
 {
     $colContent = "";
     switch ($type) {
         case 'paragraph-text':
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : '';
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? isset($fields[2]) && $fields[2] !== '' ? apply_filters('the_content', stripslashes(wptexturize($fields[1]))) : stripslashes(wptexturize($fields[1])) : '';
             break;
         case 'latest-post':
             $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 5;
             $usethumbnail = $fields != "" && is_array($fields) && (isset($fields[2]) && $fields[2] !== "") ? true : false;
             $showexcerpt = $fields != "" && is_array($fields) && (isset($fields[3]) && $fields[3] !== "") ? true : false;
             $catID = isset($fields[4]) && $fields[4] == 'all' ? 0 : intval($fields[4]);
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : '';
             $colContent .= wipfr_latest_blog($count, $usethumbnail, $showexcerpt, 66, $catID);
             break;
         case 'latest-portfolio-thumbnail':
             $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 6;
             $catID = isset($fields[2]) && $fields[2] == 'all' ? 0 : intval($fields[2]);
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : '';
             $colContent .= wipfr_latest_portfolio_thumbnail($count, $catID);
             break;
         case 'latest-product':
             $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 6;
             $catID = isset($fields[2]) && $fields[2] == 'all' ? 0 : intval($fields[2]);
             $featured = $fields != "" && is_array($fields) && (isset($fields[3]) && $fields[3] != "") ? true : false;
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : '';
             if (woocommerce_found()) {
                 $colContent .= _wip_latest_woo_product($count, $catID, $featured);
             } else {
                 $colContent .= __('Please activate WooCommerce Plugin!', 'wip');
             }
             break;
         case 'latest-post-column':
             $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 3;
             $catID = isset($fields[2]) && $fields[2] == 'all' ? 0 : intval($fields[2]);
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : '';
             $colContent .= wip_layout_helper::_print_column_blog_lists($count, $catID);
             break;
         case 'latest-tweet':
             $count = $fields != "" && is_array($fields) && (isset($fields[2]) && $fields[2] != "") ? $fields[2] : 4;
             $twitterUser = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] !== "") ? esc_attr($fields[1]) : '';
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : '';
             if ($twitterUser != "") {
                 $colContent .= _wip_display_tweets($twitterUser, $count);
             } else {
                 $colContent .= __('Cannot process request! Twitter username is blank!', 'wip');
             }
             break;
         case 'flickr-photo':
             $count = $fields != "" && is_array($fields) && (isset($fields[2]) && $fields[2] != "") ? $fields[2] : 9;
             $flickrID = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] !== "") ? esc_attr($fields[1]) : '';
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : '';
             if ($flickrID != "") {
                 $colContent .= wip_display_flickr($flickrID, $count);
             } else {
                 $colContent .= __('Cannot process request! Please enter your Flickr ID!', 'wip');
             }
             break;
         case 'box-testimonial':
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : '';
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? wpautop(stripslashes(wptexturize('<span class="before_quote">&#8220;</span>' . $fields[1] . '<span class="after_quote">&#8222;</span>'))) : '';
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[2]) && $fields[2] != "") ? stripslashes(wptexturize('<span class="testi_writer">&#8212; ' . $fields[2] . '</span>')) : '<span class="testi_writer">&#8212; No Body</span>';
             break;
         case 'latest-product-column':
             $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 3;
             $prodCat = isset($fields[2]) && $fields[2] == 'all' ? 0 : intval($fields[2]);
             $featured = $fields != "" && is_array($fields) && (isset($fields[3]) && $fields[3] != "") ? true : false;
             $colContent .= $fields != "" && is_array($fields) && (isset($fields[0]) && $fields[0] != "") ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : '';
             if (woocommerce_found()) {
                 $colContent .= _wip_show_product_lists_for_manager(34, $count, $prodCat, $featured, false);
             } else {
                 $colContent .= __('Please activate WooCommerce Plugin!', 'wip');
             }
             break;
         case 'latest-portfolio-column':
             $count = $fields != "" && is_array($fields) && (isset($fields[1]) && $fields[1] != "") ? $fields[1] : 3;
             $portCat = isset($fields[2]) && $fields[2] == 'all' ? 0 : intval($fields[2]);
             $colContent .= isset($fields[0]) && $fields[0] != "" ? '<h3 class="section_title">' . stripslashes(esc_attr($fields[0])) . '</h3>' . "\n" : '';
             $colContent .= wip_layout_helper::_print_column_portfolio_lists($count, $portCat);
             break;
     }
     return $colContent;
 }