当前位置: 首页>>代码示例>>PHP>>正文


PHP nxt_parse_args函数代码示例

本文整理汇总了PHP中nxt_parse_args函数的典型用法代码示例。如果您正苦于以下问题:PHP nxt_parse_args函数的具体用法?PHP nxt_parse_args怎么用?PHP nxt_parse_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了nxt_parse_args函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的nxt_parse_args函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。