Esempio n. 1
0
 function widget($args, $instance)
 {
     $cache = wp_cache_get($this->className, 'widget');
     if (!is_array($cache)) {
         $cache = array();
     }
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = null;
     }
     if (isset($cache[$args['widget_id']])) {
         echo $cache[$args['widget_id']];
         return;
     }
     ob_start();
     extract($args, EXTR_SKIP);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     echo $before_widget;
     if ($title) {
         echo $before_title, $title, $after_title;
     }
     if (isset($instance['list'])) {
         echo ciGetPracticeAreasTitlesList($instance['maxPracticeAreas']);
     } else {
         echo ciGetPracticeAreasHTML($instance['maxPracticeAreas'], 0, $instance['maxCharLength']);
     }
     echo $after_widget;
     $cache[$args['widget_id']] = ob_get_flush();
     wp_cache_set($this->className, $cache, 'widget');
 }
Esempio n. 2
0
/**
 * Handles the [practiceareas /] shortcode. Usage:
 *
 * - [practiceareas /]
 * - [practiceareas list /]
 * - [practiceareas max=5 list /]
 * - [practiceareas length=250 columns=4 more /] (Max of 250 chars, in four columns, with a "more" link)
 *
 * @param array $atts
 * @param string $content
 */
function ciHandlePracticeAreaShortcode($atts, $content = "")
{
    $list = false;
    $max = 1000;
    $length = 250;
    $columns = 4;
    $more = false;
    $mb = 30;
    extract(shortcode_atts(array('list' => $list, 'max' => $max, 'length' => $length, 'columns' => $columns, 'more' => $more, 'mb' => $mb), ciNormalizeShortcodeAtts($atts), 'practiceareas'));
    if ($list) {
        return ciGetPracticeAreasTitlesList($max);
    } else {
        return ciGetPracticeAreasHTML($max, 3, $length, true, $columns, $more, $mb);
    }
}