function dt_print_widget_recent_photos($atts) { extract(shortcode_atts(array('ppp' => 6, 'title' => '', 'column' => 'half', 'orderby' => 'date', 'order' => 'DESC', 'only' => '', 'except' => ''), $atts)); $title = strip_tags($title); $ppp = absint($ppp); $order = DT_latest_photo_Widget::dt_sanitize_enum($order, DT_latest_photo_Widget::$order_reference); $orderby = DT_latest_photo_Widget::dt_sanitize_enum($orderby, array_keys(DT_latest_photo_Widget::$orderby_reference)); $args = array('before_widget' => '<div class="' . esc_attr($column) . '">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>'); $select = 'all'; $cats = array(); if ($except) { $select = 'except'; $cats = array_map('trim', explode(',', $except)); } if ($only) { $select = 'only'; $cats = array_map('trim', explode(',', $only)); } $params = array('title' => $title, 'show' => $ppp, 'order' => $order, 'orderby' => $orderby, 'select' => $select); if ($cats) { $params['cats'] = $cats; } ob_start(); the_widget('DT_latest_photo_Widget', $params, $args); $output = ob_get_clean(); return $output; }
function __construct() { if (empty(self::$orderby_reference)) { self::$orderby_reference = array('date' => _x('Order by date', 'backend orderby', LANGUAGE_ZONE), 'ID' => _x('Order by ID', 'backend orderby', LANGUAGE_ZONE), 'name' => _x('Order by name', 'backend orderby', LANGUAGE_ZONE), 'modified' => _x('Order by modified', 'backend orderby', LANGUAGE_ZONE), 'rand' => _x('Order by rand', 'backend orderby', LANGUAGE_ZONE), 'parent menu_order' => _x('Order by parent', 'backend orderby', LANGUAGE_ZONE)); } /* Widget settings. */ $widget_ops = array('description' => __('A widget with photos from your albums', 'dt')); /* Widget control settings. */ $control_ops = array('width' => 250, 'height' => 250, 'id_base' => 'dt-latest-photo-widget'); /* Create the widget. */ parent::__construct('dt-latest-photo-widget', DT_WIDGET_PREFIX . __('Small photos', LANGUAGE_ZONE), $widget_ops, $control_ops); }