本文整理汇总了PHP中nxt_parse_args函数的典型用法代码示例。如果您正苦于以下问题:PHP nxt_parse_args函数的具体用法?PHP nxt_parse_args怎么用?PHP nxt_parse_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nxt_parse_args函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: bp_core_add_admin_menu_page
/**
* 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;
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:33,代码来源:1.5.php
示例2: parse_args
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']];
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:34,代码来源:class.bb-dir-map.php
示例3: woo_enforce_defaults
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;
}
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:28,代码来源:widget-woo-flickr.php
示例4: infinity_dashboard_load_template
/**
* 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);
}
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:16,代码来源:loader.php
示例5: bp_core_get_users
/**
* 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);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:13,代码来源:bp-members-functions.php
示例6: bp_blogs_get_blogs
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);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:8,代码来源:bp-blogs-functions.php
示例7: add
/**
* 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;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:79,代码来源:class-nxt-ajax-response.php
示例8: bp_blogs_delete_activity
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));
}
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:10,代码来源:bp-blogs-activity.php
示例9: nxt_kses
/**
* 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);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:31,代码来源:functions.kses.php
示例10: friends_record_activity
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));
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:11,代码来源:bp-friends-activity.php
示例11: form
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>';
}
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:11,代码来源:widget-adsense.php
示例12: dpa_admin_screen_validate
/**
* 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);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:18,代码来源:achievements-admin.php
示例13: woo_enforce_defaults
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;
}
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:13,代码来源:widget-woo-twitter.php
示例14: parse_settings
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;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:13,代码来源:class-nxt-editor.php
示例15: form
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>';
}
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:14,代码来源:widget-about.php
示例16: xprofile_insert_field_group
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();
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:14,代码来源:bp-xprofile-functions.php
示例17: woo_enforce_defaults
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;
}
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:15,代码来源:widget-woo-subscribe.php
示例18: __construct
/**
* @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);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:43,代码来源:class.nxt-auth.php
示例19: array
/**
* 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;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:30,代码来源:category.php
示例20: nxt_terms_checklist
/**
* 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));
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:54,代码来源:template.php
注:本文中的nxt_parse_args函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论