Example #1
0
/**
 * In BuddyPress 1.1 - 1.2.x, this function provided a better version of add_menu_page()
 * that allowed positioning of menus. Deprecated in 1.5 in favour of a nxt core function.
 *
 * @deprecated 1.5
 * @deprecated Use add_menu_page().
 * @since 1.1
 */
function bp_core_add_admin_menu_page($args = '')
{
    global $_registered_pages, $admin_page_hooks, $menu;
    _deprecated_function(__FUNCTION__, '1.5', 'Use add_menu_page()');
    $defaults = array('access_level' => 2, 'file' => false, 'function' => false, 'icon_url' => false, 'menu_title' => '', 'page_title' => '', 'position' => 100);
    $r = nxt_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $file = plugin_basename($file);
    $hookname = get_plugin_page_hookname($file, '');
    $admin_page_hooks[$file] = sanitize_title($menu_title);
    if (!empty($function) && !empty($hookname)) {
        add_action($hookname, $function);
    }
    if (empty($icon_url)) {
        $icon_url = 'images/generic.png';
    } elseif (is_ssl() && 0 === strpos($icon_url, 'http://')) {
        $icon_url = 'https://' . substr($icon_url, 7);
    }
    do {
        $position++;
    } while (!empty($menu[$position]));
    $menu[$position] = array($menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url);
    $_registered_pages[$hookname] = true;
    return $hookname;
}
Example #2
0
 function parse_args($args)
 {
     // callback: should be callable
     // callback_args: additional args to pass to callback
     // apply_to: all, files, dirs
     // keep_empty: (bool)
     // recurse: (int) depth, -1 = infinite
     // dots: true (everything), false (nothing), nosvn
     $defaults = array('callback' => false, 'callback_args' => false, 'keep_empty' => false, 'apply_to' => 'files', 'recurse' => -1, 'dots' => false);
     $this->callback = is_array($args) && isset($args['callback']) ? $args['callback'] : false;
     $args = nxt_parse_args($args, $defaults);
     foreach (array('callback', 'keep_empty', 'dots') as $a) {
         if ('false' == $args[$a]) {
             $args[$a] = false;
         } elseif ('true' == $args[$a]) {
             $args[$a] = true;
         }
     }
     if (!isset($this->callback)) {
         $this->callback = $args['callback'];
     }
     if (!is_callable($this->callback)) {
         $this->callback = false;
     }
     $this->callback_args = is_array($args['callback_args']) ? $args['callback_args'] : array();
     $this->keep_empty = (bool) $args['keep_empty'];
     $_apply_to = array('files' => 1, 'dirs' => 2, 'all' => 3);
     // This begs to be bitwise
     $this->apply_to = @$_apply_to[$args['apply_to']];
     $this->recurse = (int) $args['recurse'];
     $_dots = array(1 => 3, 0 => 0, 'nosvn' => 1);
     // bitwise here is a little silly
     $this->dots = @$_dots[$args['dots']];
 }
 function woo_enforce_defaults($instance)
 {
     $defaults = $this->woo_get_settings();
     $instance = nxt_parse_args($instance, $defaults);
     if ($instance['limit'] < 1) {
         $instance['limit'] = 1;
     } elseif ($instance['limit'] > 10) {
         $instance['limit'] = 10;
     }
     $instance['width'] = absint($instance['width']);
     if ($instance['width'] < 1) {
         $instance['width'] = $defaults['width'];
     }
     $instance['height'] = absint($instance['height']);
     if ($instance['height'] < 1) {
         $instance['height'] = $defaults['height'];
     }
     if ($instance['sorting'] != 'random') {
         $instance['sorting'] = $defaults['sorting'];
     }
     if (!in_array($instance['size'], array('s', 'm', 't'))) {
         $instance['size'] = $defaults['size'];
     }
     if ($instance['type'] != 'group') {
         $instance['type'] = $defaults['type'];
     }
     return $instance;
 }
Example #4
0
/**
 * Load a dashboard template relative to the template dir root
 *
 * @package Infinity
 * @subpackage dashboard
 * @param string $rel_path Relative path to template from dashboard template root
 * @param array|stdClass $args Variables to inject into template
 * @param array|stdClass $defaults Default values of variables being injected into template
 */
function infinity_dashboard_load_template($rel_path, $args = null, $defaults = null)
{
    // populate local scope
    extract(nxt_parse_args($args, (array) $defaults));
    // locate and include the template
    include infinity_dashboard_locate_template($rel_path);
}
/**
 * Return an array of users IDs based on the parameters passed.
 *
 * @package BuddyPress Core
 */
function bp_core_get_users($args = '')
{
    global $bp;
    $defaults = array('type' => 'active', 'user_id' => false, 'exclude' => false, 'search_terms' => false, 'meta_key' => false, 'meta_value' => false, 'include' => false, 'per_page' => 20, 'page' => 1, 'populate_extras' => true);
    $params = nxt_parse_args($args, $defaults);
    extract($params, EXTR_SKIP);
    return apply_filters('bp_core_get_users', BP_Core_User::get_users($type, $per_page, $page, $user_id, $include, $search_terms, $populate_extras, $exclude, $meta_key, $meta_value), $params);
}
function bp_blogs_get_blogs($args = '')
{
    global $bp;
    $defaults = array('type' => 'active', 'user_id' => false, 'search_terms' => false, 'per_page' => 20, 'page' => 1);
    $params = nxt_parse_args($args, $defaults);
    extract($params, EXTR_SKIP);
    return apply_filters('bp_blogs_get_blogs', BP_Blogs_Blog::get($type, $per_page, $page, $user_id, $search_terms), $params);
}
 /**
  * Append to XML response based on given arguments.
  *
  * The arguments that can be passed in the $args parameter are below. It is
  * also possible to pass a nxt_Error object in either the 'id' or 'data'
  * argument. The parameter isn't actually optional, content should be given
  * in order to send the correct response.
  *
  * 'what' argument is a string that is the XMLRPC response type.
  * 'action' argument is a boolean or string that acts like a nonce.
  * 'id' argument can be nxt_Error or an integer.
  * 'old_id' argument is false by default or an integer of the previous ID.
  * 'position' argument is an integer or a string with -1 = top, 1 = bottom,
  * html ID = after, -html ID = before.
  * 'data' argument is a string with the content or message.
  * 'supplemental' argument is an array of strings that will be children of
  * the supplemental element.
  *
  * @since 2.1.0
  *
  * @param string|array $args Override defaults.
  * @return string XML response.
  */
 function add($args = '')
 {
     $defaults = array('what' => 'object', 'action' => false, 'id' => '0', 'old_id' => false, 'position' => 1, 'data' => '', 'supplemental' => array());
     $r = nxt_parse_args($args, $defaults);
     extract($r, EXTR_SKIP);
     $position = preg_replace('/[^a-z0-9:_-]/i', '', $position);
     if (is_nxt_error($id)) {
         $data = $id;
         $id = 0;
     }
     $response = '';
     if (is_nxt_error($data)) {
         foreach ((array) $data->get_error_codes() as $code) {
             $response .= "<nxt_error code='{$code}'><![CDATA[" . $data->get_error_message($code) . "]]></nxt_error>";
             if (!($error_data = $data->get_error_data($code))) {
                 continue;
             }
             $class = '';
             if (is_object($error_data)) {
                 $class = ' class="' . get_class($error_data) . '"';
                 $error_data = get_object_vars($error_data);
             }
             $response .= "<nxt_error_data code='{$code}'{$class}>";
             if (is_scalar($error_data)) {
                 $response .= "<![CDATA[{$error_data}]]>";
             } elseif (is_array($error_data)) {
                 foreach ($error_data as $k => $v) {
                     $response .= "<{$k}><![CDATA[{$v}]]></{$k}>";
                 }
             }
             $response .= "</nxt_error_data>";
         }
     } else {
         $response = "<response_data><![CDATA[{$data}]]></response_data>";
     }
     $s = '';
     if (is_array($supplemental)) {
         foreach ($supplemental as $k => $v) {
             $s .= "<{$k}><![CDATA[{$v}]]></{$k}>";
         }
         $s = "<supplemental>{$s}</supplemental>";
     }
     if (false === $action) {
         $action = $_POST['action'];
     }
     $x = '';
     $x .= "<response action='{$action}_{$id}'>";
     // The action attribute in the xml output is formatted like a nonce action
     $x .= "<{$what} id='{$id}' " . (false === $old_id ? '' : "old_id='{$old_id}' ") . "position='{$position}'>";
     $x .= $response;
     $x .= $s;
     $x .= "</{$what}>";
     $x .= "</response>";
     $this->responses[] = $x;
     return $x;
 }
Example #8
0
function bp_blogs_delete_activity($args = true)
{
    global $bp;
    if (bp_is_active('activity')) {
        $defaults = array('item_id' => false, 'component' => $bp->blogs->id, 'type' => false, 'user_id' => false, 'secondary_item_id' => false);
        $params = nxt_parse_args($args, $defaults);
        extract($params, EXTR_SKIP);
        bp_activity_delete_by_item_id(array('item_id' => $item_id, 'component' => $component, 'type' => $type, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id));
    }
}
/**
 * Filters content and keeps only allowable HTML elements.
 *
 * This function makes sure that only the allowed HTML element names, attribute
 * names and attribute values plus only sane HTML entities will occur in
 * $string. You have to remove any slashes from PHP's magic quotes before you
 * call this function.
 *
 * The default allowed protocols are 'http', 'https', 'ftp', 'mailto', 'news',
 * 'irc', 'gopher', 'nntp', 'feed', 'telnet, 'mms', 'rtsp' and 'svn'. This
 * covers all common link protocols, except for 'javascript' which should not
 * be allowed for untrusted users.
 *
 * @since 1.0.0
 *
 * @param string $string Content to filter through kses
 * @param array $allowed_html List of allowed HTML elements
 * @param array $allowed_protocols Optional. Allowed protocol in links.
 * @return string Filtered content with only allowed HTML elements
 */
function nxt_kses($string, $allowed_html, $allowed_protocols = array())
{
    $allowed_protocols = nxt_parse_args($allowed_protocols, apply_filters('kses_allowed_protocols', array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn')));
    $string = nxt_kses_no_null($string);
    $string = nxt_kses_js_entities($string);
    $string = nxt_kses_normalize_entities($string);
    $allowed_html_fixed = nxt_kses_array_lc($allowed_html);
    $string = nxt_kses_hook($string, $allowed_html_fixed, $allowed_protocols);
    // nxt changed the order of these funcs and added args to nxt_kses_hook
    return nxt_kses_split($string, $allowed_html_fixed, $allowed_protocols);
}
Example #10
0
function friends_record_activity($args = '')
{
    global $bp;
    if (!bp_is_active('activity')) {
        return false;
    }
    $defaults = array('user_id' => $bp->loggedin_user->id, 'action' => '', 'content' => '', 'primary_link' => '', 'component' => $bp->friends->id, 'type' => false, 'item_id' => false, 'secondary_item_id' => false, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => false);
    $r = nxt_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    return bp_activity_add(array('user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide));
}
 function form($instance)
 {
     //Defaults
     $instance = nxt_parse_args((array) $instance, array('title' => 'Adsense', 'adsenseCode' => ''));
     $title = esc_attr($instance['title']);
     $adsenseCode = esc_textarea($instance['adsenseCode']);
     # Title
     echo '<p><label for="' . $this->get_field_id('title') . '">' . 'Title:' . '</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $title . '" /></p>';
     # Adsense Code
     echo '<p><label for="' . $this->get_field_id('adsenseCode') . '">' . 'Adsense Code:' . '</label><textarea cols="20" rows="12" class="widefat" id="' . $this->get_field_id('adsenseCode') . '" name="' . $this->get_field_name('adsenseCode') . '" >' . $adsenseCode . '</textarea></p>';
 }
/**
 * Admin settings API validation function
 *
 * @param array $input New form values
 * @since 2.0
 */
function dpa_admin_screen_validate($input)
{
    $current_settings = get_blog_option(BP_ROOT_BLOG, 'achievements');
    if (is_string($input)) {
        // nxtmu-edit.php
        return get_blog_option(BP_ROOT_BLOG, 'achievements');
    }
    if (isset($input['mediakeywords'])) {
        $input['mediakeywords'] = apply_filters('dpa_admin_settings_mediakeywords_before_save', stripslashes($input['mediakeywords']));
    }
    return nxt_parse_args($input, $current_settings);
}
 function woo_enforce_defaults($instance)
 {
     $defaults = $this->woo_get_settings();
     $instance = nxt_parse_args($instance, $defaults);
     $instance['title'] = strip_tags($instance['title']);
     // Not for security so much as to give them feedback that HTML isn't allowed
     $instance['username'] = preg_replace('|[^a-zA-Z0-9_]|', '', $instance['username']);
     $instance['limit'] = intval($instance['limit']);
     if ($instance['limit'] < 1) {
         $instance['limit'] = 5;
     }
     return $instance;
 }
Example #14
0
 public static function parse_settings($editor_id, $settings)
 {
     $set = nxt_parse_args($settings, array('nxtautop' => true, 'media_buttons' => true, 'textarea_name' => $editor_id, 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true));
     self::$this_tinymce = $set['tinymce'] && user_can_richedit();
     self::$this_quicktags = (bool) $set['quicktags'];
     if (self::$this_tinymce) {
         self::$has_tinymce = true;
     }
     if (self::$this_quicktags) {
         self::$has_quicktags = true;
     }
     return $set;
 }
Example #15
0
 function form($instance)
 {
     //Defaults
     $instance = nxt_parse_args((array) $instance, array('title' => 'About Me', 'imagePath' => '', 'aboutText' => ''));
     $title = esc_attr($instance['title']);
     $imagePath = esc_url($instance['imagePath']);
     $aboutText = esc_textarea($instance['aboutText']);
     # Title
     echo '<p><label for="' . $this->get_field_id('title') . '">' . 'Title:' . '</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $title . '" /></p>';
     # Image
     echo '<p><label for="' . $this->get_field_id('imagePath') . '">' . 'Image:' . '</label><textarea cols="20" rows="2" class="widefat" id="' . $this->get_field_id('imagePath') . '" name="' . $this->get_field_name('imagePath') . '" >' . $imagePath . '</textarea></p>';
     # About Text
     echo '<p><label for="' . $this->get_field_id('aboutText') . '">' . 'Text:' . '</label><textarea cols="20" rows="5" class="widefat" id="' . $this->get_field_id('aboutText') . '" name="' . $this->get_field_name('aboutText') . '" >' . $aboutText . '</textarea></p>';
 }
function xprofile_insert_field_group($args = '')
{
    $defaults = array('field_group_id' => false, 'name' => false, 'description' => '', 'can_delete' => true);
    $r = nxt_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    if (!$name) {
        return false;
    }
    $field_group = new BP_XProfile_Group($field_group_id);
    $field_group->name = $name;
    $field_group->description = $description;
    $field_group->can_delete = $can_delete;
    return $field_group->save();
}
 function woo_enforce_defaults($instance)
 {
     $defaults = $this->woo_get_settings();
     $instance = nxt_parse_args($instance, $defaults);
     $instance['title'] = strip_tags($instance['title']);
     if ('' == $instance['title']) {
         $instance['title'] = __('Subscribe', 'woothemes');
     }
     foreach (array('form', 'social', 'single', 'page') as $checkbox) {
         if ('on' != $instance[$checkbox]) {
             $instance[$checkbox] = '';
         }
     }
     return $instance;
 }
 /**
  * @param array $cookies Array indexed by internal name of cookie.  Values are arrays of array defining cookie parameters.
  * $cookies = array(
  *	'auth' => array(
  *		0 => array(
  *			'domain' => (string) cookie domain
  *			'path' => (string) cookie path
  *			'name' => (string) cookie name
  *			'secure' => (bool) restrict cookie to HTTPS only
  *		)
  *	)
  * );
  *
  * At least one cookie is required.  Give it an internal name of 'auth'.
  *
  * Suggested cookie structure:
  * 	logged_in: whether or not a user is logged in.  Send everywhere.
  *	auth: used to authorize user's actions.  Send only to domains/paths that need it (e.g. nxt-admin/)
  *	secure_auth: used to authorize user's actions.  Send only to domains/paths that need it and only over HTTPS
  *
  * You should be very careful when setting cookie domain to ensure that it always follows the rules set out in
  * the {@link http://curl.haxx.se/rfc/cookie_spec.html Set Cookie spec}.  In most cases it is best to leave cookie
  * set to false and allow for user configuration to define a cookie domain in a configuration file when
  * cross subdomain cookies are required.
  * 
  * @link 
  */
 function __construct(&$db, &$users, $cookies)
 {
     $this->db =& $db;
     $this->users =& $users;
     $cookies = nxt_parse_args($cookies, array('auth' => null));
     $_cookies = array();
     foreach ($cookies as $_scheme => $_scheme_cookies) {
         foreach ($_scheme_cookies as $_scheme_cookie) {
             $_cookies[$_scheme][] = nxt_parse_args($_scheme_cookie, array('domain' => null, 'path' => null, 'name' => ''));
         }
         unset($_scheme_cookie);
     }
     unset($_scheme, $_scheme_cookies);
     $this->cookies = $_cookies;
     unset($_cookies);
 }
Example #19
0
/**
 * Retrieve list of category objects.
 *
 * If you change the type to 'link' in the arguments, then the link categories
 * will be returned instead. Also all categories will be updated to be backwards
 * compatible with pre-2.3 plugins and themes.
 *
 * @since 2.1.0
 * @see get_terms() Type of arguments that can be changed.
 * @link http://codex.nxtclass.org/Function_Reference/get_categories
 *
 * @param string|array $args Optional. Change the defaults retrieving categories.
 * @return array List of categories.
 */
function &get_categories($args = '')
{
    $defaults = array('taxonomy' => 'category');
    $args = nxt_parse_args($args, $defaults);
    $taxonomy = apply_filters('get_categories_taxonomy', $args['taxonomy'], $args);
    // Back compat
    if (isset($args['type']) && 'link' == $args['type']) {
        _deprecated_argument(__FUNCTION__, '3.0', '');
        $taxonomy = $args['taxonomy'] = 'link_category';
    }
    $categories = (array) get_terms($taxonomy, $args);
    foreach (array_keys($categories) as $k) {
        _make_cat_compat($categories[$k]);
    }
    return $categories;
}
Example #20
0
/**
 * Taxonomy independent version of nxt_category_checklist
 *
 * @since 3.0.0
 *
 * @param int $post_id
 * @param array $args
 */
function nxt_terms_checklist($post_id = 0, $args = array())
{
    $defaults = array('descendants_and_self' => 0, 'selected_cats' => false, 'popular_cats' => false, 'walker' => null, 'taxonomy' => 'category', 'checked_ontop' => true);
    extract(nxt_parse_args($args, $defaults), EXTR_SKIP);
    if (empty($walker) || !is_a($walker, 'Walker')) {
        $walker = new Walker_Category_Checklist();
    }
    $descendants_and_self = (int) $descendants_and_self;
    $args = array('taxonomy' => $taxonomy);
    $tax = get_taxonomy($taxonomy);
    $args['disabled'] = !current_user_can($tax->cap->assign_terms);
    if (is_array($selected_cats)) {
        $args['selected_cats'] = $selected_cats;
    } elseif ($post_id) {
        $args['selected_cats'] = nxt_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
    } else {
        $args['selected_cats'] = array();
    }
    if (is_array($popular_cats)) {
        $args['popular_cats'] = $popular_cats;
    } else {
        $args['popular_cats'] = get_terms($taxonomy, array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false));
    }
    if ($descendants_and_self) {
        $categories = (array) get_terms($taxonomy, array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0));
        $self = get_term($descendants_and_self, $taxonomy);
        array_unshift($categories, $self);
    } else {
        $categories = (array) get_terms($taxonomy, array('get' => 'all'));
    }
    if ($checked_ontop) {
        // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
        $checked_categories = array();
        $keys = array_keys($categories);
        foreach ($keys as $k) {
            if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
                $checked_categories[] = $categories[$k];
                unset($categories[$k]);
            }
        }
        // Put checked cats on top
        echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args));
    }
    // Then the rest of them
    echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));
}
 function woo_enforce_defaults($instance)
 {
     $defaults = $this->woo_get_settings();
     $instance = nxt_parse_args($instance, $defaults);
     $instance['cat_id'] = absint($instance['cat_id']);
     if ($instance['cat_id'] < 1) {
         $instance['cat_id'] = '';
     }
     // Enforce defaults if any of these three are empty
     foreach (array('limit', 'width', 'height') as $setting) {
         $instance[$setting] = absint($instance[$setting]);
         if ($instance[$setting] < 1) {
             $instance[$setting] = $defaults[$setting];
         }
     }
     return $instance;
 }
Example #22
0
function groups_record_activity($args = '')
{
    global $bp;
    if (!bp_is_active('activity')) {
        return false;
    }
    // If the group is not public, hide the activity sitewide.
    if (isset($bp->groups->current_group->status) && 'public' == $bp->groups->current_group->status) {
        $hide_sitewide = false;
    } else {
        $hide_sitewide = true;
    }
    $defaults = array('id' => false, 'user_id' => $bp->loggedin_user->id, 'action' => '', 'content' => '', 'primary_link' => '', 'component' => $bp->groups->id, 'type' => false, 'item_id' => false, 'secondary_item_id' => false, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => $hide_sitewide);
    $r = nxt_parse_args($args, $defaults);
    extract($r);
    return bp_activity_add(array('id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide));
}
 function form($instance)
 {
     //Defaults
     $instance = nxt_parse_args((array) $instance, array('logoImagePath' => '', 'copyrightInfo' => '', 'imagePath' => '', 'textInfo' => '', 'readMoreUrl' => '', 'readMoreText' => ''));
     $logoImagePath = $instance['logoImagePath'];
     $copyrightInfo = $instance['copyrightInfo'];
     $imagePath = $instance['imagePath'];
     $textInfo = $instance['textInfo'];
     $readMoreUrl = $instance['readMoreUrl'];
     $readMoreText = $instance['readMoreText'];
     # Logo Image
     echo '<p><label for="' . $this->get_field_id('logoImagePath') . '">' . 'Logo Image URL (109x33px):' . '</label><textarea cols="20" rows="2" class="widefat" id="' . $this->get_field_id('logoImagePath') . '" name="' . $this->get_field_name('logoImagePath') . '" >' . esc_textarea($logoImagePath) . '</textarea></p>';
     # Copyright
     echo '<p><label for="' . $this->get_field_id('copyrightInfo') . '">' . 'Copyright Text:' . '</label><input class="widefat" id="' . $this->get_field_id('copyrightInfo') . '" name="' . $this->get_field_name('copyrightInfo') . '" type="text" value="' . esc_attr($copyrightInfo) . '" /></p>';
     # Thumbnail Image URL
     echo '<p><label for="' . $this->get_field_id('imagePath') . '">' . 'Thumbnail Image URL:' . '</label><textarea cols="20" rows="2" class="widefat" id="' . $this->get_field_id('imagePath') . '" name="' . $this->get_field_name('imagePath') . '" >' . esc_url($imagePath) . '</textarea></p>';
     # Text
     echo '<p><label for="' . $this->get_field_id('textInfo') . '">' . 'Text:' . '</label><textarea cols="20" rows="5" class="widefat" id="' . $this->get_field_id('textInfo') . '" name="' . $this->get_field_name('textInfo') . '" >' . esc_textarea($textInfo) . '</textarea></p>';
     # Read More Link Text
     echo '<p><label for="' . $this->get_field_id('readMoreText') . '">' . 'Read More Link Text:' . '</label><input class="widefat" id="' . $this->get_field_id('readMoreText') . '" name="' . $this->get_field_name('readMoreText') . '" type="text" value="' . esc_url($readMoreText) . '" /></p>';
     # Read More URL
     echo '<p><label for="' . $this->get_field_id('readMoreUrl') . '">' . 'Read More URL:' . '</label><input class="widefat" id="' . $this->get_field_id('readMoreUrl') . '" name="' . $this->get_field_name('readMoreUrl') . '" type="text" value="' . esc_url($readMoreUrl) . '" /></p>';
 }
 function delete($args)
 {
     global $nxtdb, $bp;
     $defaults = array('id' => false, 'action' => false, 'content' => false, 'component' => false, 'type' => false, 'primary_link' => false, 'user_id' => false, 'item_id' => false, 'secondary_item_id' => false, 'date_recorded' => false, 'hide_sitewide' => false);
     $params = nxt_parse_args($args, $defaults);
     extract($params);
     $where_args = false;
     if (!empty($id)) {
         $where_args[] = $nxtdb->prepare("id = %d", $id);
     }
     if (!empty($user_id)) {
         $where_args[] = $nxtdb->prepare("user_id = %d", $user_id);
     }
     if (!empty($action)) {
         $where_args[] = $nxtdb->prepare("action = %s", $action);
     }
     if (!empty($content)) {
         $where_args[] = $nxtdb->prepare("content = %s", $content);
     }
     if (!empty($component)) {
         $where_args[] = $nxtdb->prepare("component = %s", $component);
     }
     if (!empty($type)) {
         $where_args[] = $nxtdb->prepare("type = %s", $type);
     }
     if (!empty($primary_link)) {
         $where_args[] = $nxtdb->prepare("primary_link = %s", $primary_link);
     }
     if (!empty($item_id)) {
         $where_args[] = $nxtdb->prepare("item_id = %s", $item_id);
     }
     if (!empty($secondary_item_id)) {
         $where_args[] = $nxtdb->prepare("secondary_item_id = %s", $secondary_item_id);
     }
     if (!empty($date_recorded)) {
         $where_args[] = $nxtdb->prepare("date_recorded = %s", $date_recorded);
     }
     if (!empty($hide_sitewide)) {
         $where_args[] = $nxtdb->prepare("hide_sitewide = %d", $hide_sitewide);
     }
     if (!empty($where_args)) {
         $where_sql = 'WHERE ' . join(' AND ', $where_args);
     } else {
         return false;
     }
     // Fetch the activity IDs so we can delete any comments for this activity item
     $activity_ids = $nxtdb->get_col($nxtdb->prepare("SELECT id FROM {$bp->activity->table_name} {$where_sql}"));
     if (!$nxtdb->query($nxtdb->prepare("DELETE FROM {$bp->activity->table_name} {$where_sql}"))) {
         return false;
     }
     if ($activity_ids) {
         BP_Activity_Activity::delete_activity_item_comments($activity_ids);
         BP_Activity_Activity::delete_activity_meta_entries($activity_ids);
         return $activity_ids;
     }
     return $activity_ids;
 }
function of_sanitize_typography($input)
{
    $output = nxt_parse_args($input, array('size' => '', 'face' => '', 'style' => '', 'color' => ''));
    $output['size'] = apply_filters('of_font_size', $output['size']);
    $output['face'] = apply_filters('of_font_face', $output['face']);
    $output['style'] = apply_filters('of_font_style', $output['style']);
    $output['color'] = apply_filters('of_color', $output['color']);
    return $output;
}
Example #26
0
 /**
  * Update term based on arguments provided.
  *
  * The $args will indiscriminately override all values with the same field name.
  * Care must be taken to not override important information need to update or
  * update will fail (or perhaps create a new term, neither would be acceptable).
  *
  * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not
  * defined in $args already.
  *
  * 'alias_of' will create a term group, if it doesn't already exist, and update
  * it for the $term.
  *
  * If the 'slug' argument in $args is missing, then the 'name' in $args will be
  * used. It should also be noted that if you set 'slug' and it isn't unique then
  * a nxt_Error will be passed back. If you don't pass any slug, then a unique one
  * will be created for you.
  *
  * For what can be overrode in $args, check the term scheme can contain and stay
  * away from the term keys.
  *
  * @package NXTClass
  * @subpackage Taxonomy
  * @since 2.3.0
  *
  * @uses do_action() Will call both 'edit_term' and 'edit_$taxonomy' twice.
  * @uses apply_filters() Will call the 'term_id_filter' filter and pass the term
  *  id and taxonomy id.
  *
  * @param int $term_id The ID of the term
  * @param string $taxonomy The context in which to relate the term to the object.
  * @param array|string $args Overwrite term field values
  * @return array|nxt_Error Returns Term ID and Taxonomy Term ID
  */
 function update_term($term_id, $taxonomy, $args = array())
 {
     if (!$this->is_taxonomy($taxonomy)) {
         return new nxt_Error('invalid_taxonomy', __('Invalid taxonomy'));
     }
     $term_id = (int) $term_id;
     // First, get all of the original args
     $term = $this->get_term($term_id, $taxonomy, ARRAY_A);
     if (is_nxt_error($term)) {
         return $term;
     }
     // Merge old and new args with new args overwriting old ones.
     $args = array_merge($term, $args);
     $defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
     $args = nxt_parse_args($args, $defaults);
     $args = $this->sanitize_term($args, $taxonomy, 'db');
     extract($args, EXTR_SKIP);
     // expected_slashed ($name)
     $name = stripslashes($name);
     $description = stripslashes($description);
     if ('' == trim($name)) {
         return new nxt_Error('empty_term_name', __('A name is required for this term'));
     }
     $empty_slug = false;
     if (empty($slug)) {
         $empty_slug = true;
         $slug = $this->sanitize_term_slug($name, $taxonomy, $term_id);
     }
     if ($alias_of) {
         $alias = $this->db->get_row($this->db->prepare("SELECT term_id, term_group FROM {$this->db->terms} WHERE slug = %s", $alias_of));
         if ($alias->term_group) {
             // The alias we want is already in a group, so let's use that one.
             $term_group = $alias->term_group;
         } else {
             // The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
             $term_group = $this->db->get_var("SELECT MAX(term_group) FROM {$this->db->terms}") + 1;
             $this->db->update($this->db->terms, compact('term_group'), array('term_id' => $alias->term_id));
         }
     }
     // Check for duplicate slug
     $id = $this->db->get_var($this->db->prepare("SELECT term_id FROM {$this->db->terms} WHERE slug = %s", $slug));
     if ($id && $id != $term_id) {
         // If an empty slug was passed or the parent changed, reset the slug to something unique.
         // Otherwise, bail.
         if ($empty_slug || $parent != $term->parent) {
             $slug = $this->unique_term_slug($slug, (object) $args);
         } else {
             return new nxt_Error('duplicate_term_slug', sprintf(__('The slug &#8220;%s&#8221; is already in use by another term'), $slug));
         }
     }
     $this->db->update($this->db->terms, compact('name', 'slug', 'term_group'), compact('term_id'));
     if (empty($slug)) {
         $slug = $this->sanitize_term_slug($name, $taxonomy, $term_id);
         $this->db->update($this->db->terms, compact('slug'), compact('term_id'));
     }
     $tt_id = $this->db->get_var($this->db->prepare("SELECT tt.term_taxonomy_id FROM {$this->db->term_taxonomy} AS tt INNER JOIN {$this->db->terms} AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id));
     $this->db->update($this->db->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent'), array('term_taxonomy_id' => $tt_id));
     do_action("edit_term", $term_id, $tt_id);
     do_action("edit_{$taxonomy}", $term_id, $tt_id);
     $term_id = apply_filters('term_id_filter', $term_id, $tt_id);
     $this->clean_term_cache($term_id, $taxonomy);
     do_action("edited_term", $term_id, $tt_id);
     do_action("edited_{$taxonomy}", $term_id, $tt_id);
     return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
 }
Example #27
0
/**
 * Displays a navigation menu.
 *
 * Optional $args contents:
 *
 * menu - The menu that is desired.  Accepts (matching in order) id, slug, name. Defaults to blank.
 * menu_class - CSS class to use for the ul element which forms the menu. Defaults to 'menu'.
 * menu_id - The ID that is applied to the ul element which forms the menu. Defaults to the menu slug, incremented.
 * container - Whether to wrap the ul, and what to wrap it with. Defaults to 'div'.
 * container_class - the class that is applied to the container. Defaults to 'menu-{menu slug}-container'.
 * container_id - The ID that is applied to the container. Defaults to blank.
 * fallback_cb - If the menu doesn't exists, a callback function will fire. Defaults to 'nxt_page_menu'. Set to false for no fallback.
 * before - Text before the link text.
 * after - Text after the link text.
 * link_before - Text before the link.
 * link_after - Text after the link.
 * echo - Whether to echo the menu or return it. Defaults to echo.
 * depth - how many levels of the hierarchy are to be included.  0 means all.  Defaults to 0.
 * walker - allows a custom walker to be specified.
 * theme_location - the location in the theme to be used.  Must be registered with register_nav_menu() in order to be selectable by the user.
 * items_wrap - How the list items should be wrapped. Defaults to a ul with an id and class. Uses printf() format with numbered placeholders.
 *
 * @since 3.0.0
 *
 * @param array $args Arguments
 */
function nxt_nav_menu($args = array())
{
    static $menu_id_slugs = array();
    $defaults = array('menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'nxt_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'depth' => 0, 'walker' => '', 'theme_location' => '');
    $args = nxt_parse_args($args, $defaults);
    $args = apply_filters('nxt_nav_menu_args', $args);
    $args = (object) $args;
    // Get the nav menu based on the requested menu
    $menu = nxt_get_nav_menu_object($args->menu);
    // Get the nav menu based on the theme_location
    if (!$menu && $args->theme_location && ($locations = get_nav_menu_locations()) && isset($locations[$args->theme_location])) {
        $menu = nxt_get_nav_menu_object($locations[$args->theme_location]);
    }
    // get the first menu that has items if we still can't find a menu
    if (!$menu && !$args->theme_location) {
        $menus = nxt_get_nav_menus();
        foreach ($menus as $menu_maybe) {
            if ($menu_items = nxt_get_nav_menu_items($menu_maybe->term_id)) {
                $menu = $menu_maybe;
                break;
            }
        }
    }
    // If the menu exists, get its items.
    if ($menu && !is_nxt_error($menu) && !isset($menu_items)) {
        $menu_items = nxt_get_nav_menu_items($menu->term_id);
    }
    // If no menu was found or if the menu has no items and no location was requested, call the fallback_cb if it exists
    if ((!$menu || is_nxt_error($menu) || isset($menu_items) && empty($menu_items) && !$args->theme_location) && $args->fallback_cb && is_callable($args->fallback_cb)) {
        return call_user_func($args->fallback_cb, (array) $args);
    }
    // If no fallback function was specified and the menu doesn't exists, bail.
    if (!$menu || is_nxt_error($menu)) {
        return false;
    }
    $nav_menu = $items = '';
    $show_container = false;
    if ($args->container) {
        $allowed_tags = apply_filters('nxt_nav_menu_container_allowedtags', array('div', 'nav'));
        if (in_array($args->container, $allowed_tags)) {
            $show_container = true;
            $class = $args->container_class ? ' class="' . esc_attr($args->container_class) . '"' : ' class="menu-' . $menu->slug . '-container"';
            $id = $args->container_id ? ' id="' . esc_attr($args->container_id) . '"' : '';
            $nav_menu .= '<' . $args->container . $id . $class . '>';
        }
    }
    // Set up the $menu_item variables
    _nxt_menu_item_classes_by_context($menu_items);
    $sorted_menu_items = array();
    foreach ((array) $menu_items as $key => $menu_item) {
        $sorted_menu_items[$menu_item->menu_order] = $menu_item;
    }
    unset($menu_items);
    $sorted_menu_items = apply_filters('nxt_nav_menu_objects', $sorted_menu_items, $args);
    $items .= walk_nav_menu_tree($sorted_menu_items, $args->depth, $args);
    unset($sorted_menu_items);
    // Attributes
    if (!empty($args->menu_id)) {
        $wrap_id = $args->menu_id;
    } else {
        $wrap_id = 'menu-' . $menu->slug;
        while (in_array($wrap_id, $menu_id_slugs)) {
            if (preg_match('#-(\\d+)$#', $wrap_id, $matches)) {
                $wrap_id = preg_replace('#-(\\d+)$#', '-' . ++$matches[1], $wrap_id);
            } else {
                $wrap_id = $wrap_id . '-1';
            }
        }
    }
    $menu_id_slugs[] = $wrap_id;
    $wrap_class = $args->menu_class ? $args->menu_class : '';
    // Allow plugins to hook into the menu to add their own <li>'s
    $items = apply_filters('nxt_nav_menu_items', $items, $args);
    $items = apply_filters("nxt_nav_menu_{$menu->slug}_items", $items, $args);
    $nav_menu .= sprintf($args->items_wrap, esc_attr($wrap_id), esc_attr($wrap_class), $items);
    unset($items);
    if ($show_container) {
        $nav_menu .= '</' . $args->container . '>';
    }
    $nav_menu = apply_filters('nxt_nav_menu', $nav_menu, $args);
    if ($args->echo) {
        echo $nav_menu;
    } else {
        return $nav_menu;
    }
}
Example #28
0
function bp_dtheme_ajax_querystring($query_string, $object)
{
    global $bp;
    if (empty($object)) {
        return false;
    }
    /* Set up the cookies passed on this AJAX request. Store a local var to avoid conflicts */
    if (!empty($_POST['cookie'])) {
        $_BP_COOKIE = nxt_parse_args(str_replace('; ', '&', urldecode($_POST['cookie'])));
    } else {
        $_BP_COOKIE =& $_COOKIE;
    }
    $qs = false;
    /***
     * Check if any cookie values are set. If there are then override the default params passed to the
     * template loop
     */
    if (!empty($_BP_COOKIE['bp-' . $object . '-filter']) && '-1' != $_BP_COOKIE['bp-' . $object . '-filter']) {
        $qs[] = 'type=' . $_BP_COOKIE['bp-' . $object . '-filter'];
        $qs[] = 'action=' . $_BP_COOKIE['bp-' . $object . '-filter'];
        // Activity stream filtering on action
    }
    if (!empty($_BP_COOKIE['bp-' . $object . '-scope'])) {
        if ('personal' == $_BP_COOKIE['bp-' . $object . '-scope']) {
            $user_id = $bp->displayed_user->id ? $bp->displayed_user->id : $bp->loggedin_user->id;
            $qs[] = 'user_id=' . $user_id;
        }
        if ('all' != $_BP_COOKIE['bp-' . $object . '-scope'] && empty($bp->displayed_user->id) && !$bp->is_single_item) {
            $qs[] = 'scope=' . $_BP_COOKIE['bp-' . $object . '-scope'];
        }
        // Activity stream scope only on activity directory.
    }
    /* If page and search_terms have been passed via the AJAX post request, use those */
    if (!empty($_POST['page']) && '-1' != $_POST['page']) {
        $qs[] = 'page=' . $_POST['page'];
    }
    $object_search_text = bp_get_search_default_text($object);
    if (!empty($_POST['search_terms']) && $object_search_text != $_POST['search_terms'] && 'false' != $_POST['search_terms'] && 'undefined' != $_POST['search_terms']) {
        $qs[] = 'search_terms=' . $_POST['search_terms'];
    }
    /* Now pass the querystring to override default values. */
    $query_string = empty($qs) ? '' : join('&', (array) $qs);
    $object_filter = '';
    if (isset($_BP_COOKIE['bp-' . $object . '-filter'])) {
        $object_filter = $_BP_COOKIE['bp-' . $object . '-filter'];
    }
    $object_scope = '';
    if (isset($_BP_COOKIE['bp-' . $object . '-scope'])) {
        $object_scope = $_BP_COOKIE['bp-' . $object . '-scope'];
    }
    $object_page = '';
    if (isset($_BP_COOKIE['bp-' . $object . '-page'])) {
        $object_page = $_BP_COOKIE['bp-' . $object . '-page'];
    }
    $object_search_terms = '';
    if (isset($_BP_COOKIE['bp-' . $object . '-search-terms'])) {
        $object_search_terms = $_BP_COOKIE['bp-' . $object . '-search-terms'];
    }
    $object_extras = '';
    if (isset($_BP_COOKIE['bp-' . $object . '-extras'])) {
        $object_extras = $_BP_COOKIE['bp-' . $object . '-extras'];
    }
    return apply_filters('bp_dtheme_ajax_querystring', $query_string, $object, $object_filter, $object_scope, $object_page, $object_search_terms, $object_extras);
}
Example #29
0
    function form($instance)
    {
        $defaults = array();
        $instance = nxt_parse_args((array) $instance, $defaults);
        ?>
		<p><label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'huddle');
        ?>
</label><input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo $instance['title'];
        ?>
" /></p>
	
		<p style="border-bottom:1px solid #DFDFDF; padding: 20px 0; margin-bottom:20px;"><strong><?php 
        _e('Video', 'huddle');
        ?>
:</strong></p>
		<p><label for="<?php 
        echo $this->get_field_id('huddle_vid_embed1');
        ?>
"><?php 
        _e('Video Embed Code (Best at 265px wide)', 'huddle');
        ?>
</label><textarea style="height:200px;" class="widefat" id="<?php 
        echo $this->get_field_id('huddle_vid_embed1');
        ?>
" name="<?php 
        echo $this->get_field_name('huddle_vid_embed1');
        ?>
"><?php 
        echo stripslashes(htmlspecialchars($instance['huddle_vid_embed1'], ENT_QUOTES));
        ?>
</textarea></p>
		<p><label for="<?php 
        echo $this->get_field_id('huddle_vid_desc1');
        ?>
"><?php 
        _e('Description:', 'huddle');
        ?>
</label><input class="widefat" id="<?php 
        echo $this->get_field_id('huddle_vid_desc1');
        ?>
" name="<?php 
        echo $this->get_field_name('huddle_vid_desc1');
        ?>
" value="<?php 
        echo stripslashes(htmlspecialchars($instance['huddle_vid_desc1'], ENT_QUOTES));
        ?>
" /></p>
	
	<?php 
    }
function bb_option_form_element($name = 'name', $args = null)
{
    global $bb_hardcoded;
    $defaults = array('title' => 'title', 'type' => 'text', 'value' => false, 'options' => false, 'message' => false, 'class' => false, 'default' => false, 'before' => '', 'after' => '', 'note' => false, 'attributes' => false, 'disabled' => false);
    $args = nxt_parse_args($args, $defaults);
    $id = str_replace(array('_', '[', ']'), array('-', '-', ''), $name);
    if (false !== strpos($name, '[')) {
        list($option_name, $option_key) = preg_split('/[\\[\\]]/', $name, -1, PREG_SPLIT_NO_EMPTY);
        $option = bb_get_option($option_name);
        $value = false === $args['value'] ? esc_attr($option[$option_key]) : esc_attr($args['value']);
        $hardcoded = isset($bb_hardcoded[$option_name][$option_key]);
    } else {
        $value = false === $args['value'] ? bb_get_form_option($name) : esc_attr($args['value']);
        $hardcoded = isset($bb_hardcoded[$name]);
    }
    $class = $args['class'] ? (array) $args['class'] : array();
    array_unshift($class, $args['type']);
    if ($hardcoded || $args['disabled']) {
        $disabled = ' disabled="disabled"';
    } else {
        $disabled = false;
    }
    if ($args['attributes']) {
        $attributes = array();
        foreach ($args['attributes'] as $k => $v) {
            $attributes[] = "{$k}='{$v}'";
        }
        $attributes = ' ' . join(' ', $attributes);
    } else {
        $attributes = '';
    }
    ?>

		<div id="option-<?php 
    echo $id;
    ?>
"<?php 
    if (!empty($disabled)) {
        echo ' class="disabled"';
    }
    ?>
>
<?php 
    switch ($args['type']) {
        case 'radio':
        case 'checkbox':
        case 'message':
            ?>
			<div class="label">
				<?php 
            echo $args['title'];
            ?>
			</div>

<?php 
            break;
        case 'select':
        default:
            ?>
			<label for="<?php 
            echo $id;
            ?>
">
				<?php 
            echo $args['title'];
            ?>
			</label>

<?php 
            break;
    }
    ?>
			<div class="inputs">

<?php 
    if ($args['before']) {
        echo '<span class="before">' . $args['before'] . '</span>';
    }
    switch ($args['type']) {
        case 'select':
            echo "<select{$disabled} class='" . join(' ', $class) . "' name='{$name}' id='{$id}'{$attributes}>\n";
            if (is_array($args['options'])) {
                foreach ($args['options'] as $option => $label) {
                    echo "\t<option value='{$option}'" . ($value == $option ? " selected='selected'" : '') . ">{$label}</option>\n";
                }
            } elseif (is_string($args['options'])) {
                echo $args['options'] . "\n";
            }
            echo "</select>\n";
            break;
        case 'radio':
        case 'checkbox':
            if (is_array($args['options'])) {
                $_id = 0;
                if ('radio' === $args['type'] && !in_array($value, array_keys($args['options'])) && empty($value)) {
                    $use_first_value = true;
                }
                $type = $args['type'];
                foreach ($args['options'] as $option => $label) {
                    if ($use_first_value) {
                        $use_first_value = false;
                        $value = $option;
                    }
                    if (is_array($label)) {
                        if (isset($label['attributes'])) {
                            $attributes = array();
                            foreach ($label['attributes'] as $k => $v) {
                                $attributes[] = "{$k}='{$v}'";
                            }
                            $attributes = ' ' . join(' ', $attributes);
                        } else {
                            $attributes = '';
                        }
                        if (isset($label['name'])) {
                            $name = $label['name'];
                            $id = str_replace(array('_', '[', ']'), array('-', '-', ''), $name);
                            $hardcoded = isset($bb_hardcoded[$name]);
                        }
                        if (isset($label['value'])) {
                            $_value = $label['value'];
                        } else {
                            $_value = $args['value'];
                        }
                        $value = false === $_value ? bb_get_form_option($name) : esc_attr($_value);
                        $label = $label['label'];
                    }
                    echo "<label class=\"{$type}s\"><input{$disabled} type='{$type}' class='" . join(' ', $class) . "' name='{$name}' id='{$id}-{$_id}' value='{$option}'" . ($value == $option ? " checked='checked'" : '') . "{$attributes} /> {$label}</label>\n";
                    $_id++;
                }
            } elseif (is_string($args['options'])) {
                echo $args['options'] . "\n";
            }
            break;
        case 'message':
            if ($args['message']) {
                echo $args['message'];
            }
            break;
        default:
            echo "<input{$disabled} type='{$args['type']}' class='" . join(' ', $class) . "' name='{$name}' id='{$id}' value='{$value}'{$attributes} />\n";
            break;
    }
    if ($args['after']) {
        echo '<span class="after">' . $args['after'] . '</span>';
    }
    if ($args['note']) {
        foreach ((array) $args['note'] as $note) {
            ?>

				<p><?php 
            echo $note;
            ?>
</p>

<?php 
        }
    }
    ?>

			</div>
		</div>

<?php 
}