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


PHP func_get_arg函数代码示例

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


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

示例1: __construct

 /**
  * Sets validator options
  *
  * @param  string|array|\Traversable $options
  */
 public function __construct($options = null)
 {
     if ($options instanceof Traversable) {
         $options = ArrayUtils::iteratorToArray($options);
     }
     $case = null;
     if (1 < func_num_args()) {
         $case = func_get_arg(1);
     }
     if (is_array($options)) {
         if (isset($options['case'])) {
             $case = $options['case'];
             unset($options['case']);
         }
         if (!array_key_exists('extension', $options)) {
             $options = array('extension' => $options);
         }
     } else {
         $options = array('extension' => $options);
     }
     if ($case !== null) {
         $options['case'] = $case;
     }
     parent::__construct($options);
 }
开发者ID:paulbriton,项目名称:streaming_diffusion,代码行数:30,代码来源:Extension.php

示例2: implodeIgnoringBlanks

 /**
  * Removes all blanks in an array and merges them into a string
  *
  * @param string $glue String to include between each element
  * @param array $array Array containing elements to be imploded
  * @param string $itemCallback A transformation closure to call on each element of the array
  * @param string $keysToInclude,... Keys of the array elements to include - if not supplied, all elements will be used
  * @return string String of concatenated elements
  */
 public static function implodeIgnoringBlanks($glue, $array, $itemCallback = null, $keysToInclude = null)
 {
     $array = array_filter($array);
     if (!empty($itemCallback)) {
         foreach ($array as $key => $value) {
             $array[$key] = $itemCallback($value);
         }
     }
     $keys = array($keysToInclude);
     for ($i = 4; $i < func_num_args(); $i++) {
         $keys[] = func_get_arg($i);
     }
     $keys = array_filter($keys);
     $string = "";
     if (count($keys)) {
         foreach ($keys as $key) {
             if (!empty($array[$key])) {
                 $string .= $array[$key] . $glue;
             }
         }
         if (strlen($string) >= strlen($glue)) {
             $string = substr($string, 0, strlen($string) - strlen($glue));
         }
     } else {
         $string = implode($glue, $array);
     }
     return $string;
 }
开发者ID:robertfalconer,项目名称:Rhubarb,代码行数:37,代码来源:StringTools.php

示例3: index

 /**
  * Carrega a página "/views/user-register/index.php"
  */
 public function index()
 {
     // Page title
     $this->title = 'User Register';
     // Verifica se o usuário está logado
     if (!$this->logged_in) {
         // Se não; garante o logout
         $this->logout();
         // Redireciona para a página de login
         $this->goto_login();
         // Garante que o script não vai passar daqui
         return;
     }
     // Verifica se o usuário tem a permissão para acessar essa página
     if (!$this->check_permissions($this->permission_required, $this->userdata['user_permissions'])) {
         // Exibe uma mensagem
         echo 'Você não tem permissões para acessar essa página.';
         // Finaliza aqui
         return;
     }
     // Parametros da função
     $parametros = func_num_args() >= 1 ? func_get_arg(0) : array();
     // Carrega o modelo para este view
     $modelo = $this->load_model('user-register/user-register-model');
     /** Carrega os arquivos do view **/
     // /views/_includes/header.php
     require ABSPATH . '/views/_includes/header.php';
     // /views/_includes/menu.php
     require ABSPATH . '/views/_includes/menu.php';
     // /views/user-register/index.php
     require ABSPATH . '/views/user-register/user-register-view.php';
     // /views/_includes/footer.php
     require ABSPATH . '/views/_includes/footer.php';
 }
开发者ID:Anpix,项目名称:TutsupMVC,代码行数:37,代码来源:user-register-controller.php

示例4: __construct

 /**
  * Sets validator options
  *
  * @param  array|Zend_Config $haystack
  * @return void
  */
 public function __construct($options)
 {
     if ($options instanceof Zend_Config) {
         $options = $options->toArray();
     } else {
         if (!is_array($options)) {
             require_once 'Zend/Validate/Exception.php';
             throw new Zend_Validate_Exception('Array expected as parameter');
         } else {
             $count = func_num_args();
             $temp = array();
             if ($count > 1) {
                 $temp['haystack'] = func_get_arg(0);
                 $temp['strict'] = func_get_arg(1);
                 $options = $temp;
             } else {
                 $temp = func_get_arg(0);
                 if (!array_key_exists('haystack', $options)) {
                     $options = array();
                     $options['haystack'] = $temp;
                 } else {
                     $options = $temp;
                 }
             }
         }
     }
     $this->setHaystack($options['haystack']);
     if (array_key_exists('strict', $options)) {
         $this->setStrict($options['strict']);
     }
     if (array_key_exists('recursive', $options)) {
         $this->setRecursive($options['recursive']);
     }
 }
开发者ID:banumelody,项目名称:slims7_cendana,代码行数:40,代码来源:InArray.php

示例5: add_user

/**
 * Creates a new user from the "Users" form using $_POST information.
 *
 * It seems that the first half is for backwards compatibility, but only
 * has the ability to alter the user's role. WordPress core seems to
 * use this function only in the second way, running edit_user() with
 * no id so as to create a new user.
 *
 * @since 2.0
 *
 * @param int $user_id Optional. User ID.
 * @return null|WP_Error|int Null when adding user, WP_Error or User ID integer when no parameters.
 */
function add_user()
{
    if (func_num_args()) {
        // The hackiest hack that ever did hack
        global $current_user, $wp_roles;
        $user_id = (int) func_get_arg(0);
        if (isset($_POST['role'])) {
            $new_role = sanitize_text_field($_POST['role']);
            // Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
            if ($user_id != $current_user->id || $wp_roles->role_objects[$new_role]->has_cap('edit_users')) {
                // If the new role isn't editable by the logged-in user die with error
                $editable_roles = get_editable_roles();
                if (empty($editable_roles[$new_role])) {
                    wp_die(__('You can&#8217;t give users that role.'));
                }
                $user = new WP_User($user_id);
                $user->set_role($new_role);
            }
        }
    } else {
        add_action('user_register', 'add_user');
        // See above
        return edit_user();
    }
}
开发者ID:laiello,项目名称:cartonbank,代码行数:38,代码来源:user.php

示例6: runDump

 /**
  * Processes the dump variables, if none is supplied, all the twig
  * template variables are used
  * @param  Twig_Environment $env
  * @param  array            $context
  * @return string
  */
 public function runDump(Twig_Environment $env, $context)
 {
     if (!$env->isDebug()) {
         return;
     }
     $result = '';
     $count = func_num_args();
     if ($count == 2) {
         $this->variablePrefix = true;
         $vars = [];
         foreach ($context as $key => $value) {
             if (!$value instanceof Twig_Template) {
                 $vars[$key] = $value;
             }
         }
         $result .= $this->dump($vars, static::PAGE_CAPTION);
     } else {
         $this->variablePrefix = false;
         for ($i = 2; $i < $count; $i++) {
             $var = func_get_arg($i);
             if ($var instanceof ComponentBase) {
                 $caption = [static::COMPONENT_CAPTION, get_class($var)];
             } elseif (is_array($var)) {
                 $caption = static::ARRAY_CAPTION;
             } elseif (is_object($var)) {
                 $caption = [static::OBJECT_CAPTION, get_class($var)];
             } else {
                 $caption = [static::OBJECT_CAPTION, gettype($var)];
             }
             $result .= $this->dump($var, $caption);
         }
     }
     return $result;
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:41,代码来源:DebugExtension.php

示例7: __construct

 public function __construct()
 {
     if (func_num_args() == 1) {
         $this->setDefaultValue(func_get_arg(0));
         $this->setHumanValue(func_get_arg(0));
     }
 }
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:7,代码来源:Daemon_ConfigEntry.php

示例8: __new__

 protected final function __new__()
 {
     parent::__new__(func_num_args() > 0 ? func_get_arg(0) : null);
     $this->o('Template')->cp($this->vars);
     $this->request_url = parent::current_url();
     $this->request_query = parent::query_string() == null ? null : '?' . parent::query_string();
 }
开发者ID:satully,项目名称:dev_socialapp,代码行数:7,代码来源:Flow.php

示例9: test

function test()
{
    var_dump(func_get_arg(0));
    var_dump(func_get_arg(1));
    var_dump(func_get_arg(2));
    var_dump(func_get_arg(3));
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:16.php

示例10: execute

 public function execute($id)
 {
     if (!isset($this->prepares[$id])) {
         throw new Moonlake_Exception_ModelConnector("The given id doesn't represent a valid prepared statement. This mostly means, that the statement is freed befor this call");
     }
     for ($i = 0; $i < count($this->prepares[$id]['types']); $i++) {
         $args[] = func_get_arg($i + 1);
     }
     $stmt = $this->prepares[$id]['stmt'];
     call_user_method_array('bind_param', $stmt, $args);
     $stmt->execute() or $this->error($this->prepares[$id]['sql']);
     // bind result byref to array
     call_user_func_array(array($stmt, "bind_result"), $byref_array_for_fields);
     // returns a copy of a value
     $copy = create_function('$a', 'return $a;');
     $results = array();
     while ($mysqli_stmt_object->fetch()) {
         // array_map will preserve keys when done here and this way
         $result = array_map($copy, $byref_array_for_fields);
         $mresult = new Moonlake_Model_Result();
         foreach ($result as $key => $val) {
             $mresult->{$key} = $val;
         }
         $results[] = $mresult;
     }
     // create with this new query
     $qid = count($this->queries);
     $this->queries[$qid]['sql'] = $sql;
     $this->queries[$qid]['rows'] = count($results);
     $this->queries[$qid]['seek'] = 0;
     $this->queries[$qid]['result'] = $results;
     return $results;
 }
开发者ID:bmario,项目名称:moonlake,代码行数:33,代码来源:mysqliconnector.php

示例11: sort2DArray

function sort2DArray($ArrayData, $KeyName1, $SortOrder1 = "SORT_ASC", $SortType1 = "SORT_REGULAR")
{
    if (!is_array($ArrayData)) {
        return $ArrayData;
    }
    // Get args number.
    $ArgCount = func_num_args();
    // Get keys to sort by and put them to SortRule array.
    for ($I = 1; $I < $ArgCount; $I++) {
        $Arg = func_get_arg($I);
        if (!@eregi("SORT", $Arg)) {
            $KeyNameList[] = $Arg;
            $SortRule[] = '$' . $Arg;
        } else {
            $SortRule[] = $Arg;
        }
    }
    // Get the values according to the keys and put them to array.
    foreach ($ArrayData as $Key => $Info) {
        foreach ($KeyNameList as $KeyName) {
            ${$KeyName}[$Key] = $Info[$KeyName];
        }
    }
    // Create the eval string and eval it.
    $EvalString = 'array_multisort(' . join(",", $SortRule) . ',$ArrayData);';
    eval($EvalString);
    return $ArrayData;
}
开发者ID:fkssei,项目名称:pigcms10,代码行数:28,代码来源:CrAction.class.php

示例12: __construct

 /**
  * @param array $elements
  */
 public function __construct($elements = array())
 {
     if (!is_array($elements)) {
         $elements = func_get_arg(1);
     }
     parent::__construct($this->getAllowedType(), $elements);
 }
开发者ID:bcolucci,项目名称:type,代码行数:10,代码来源:TypedCollection.php

示例13: __construct

 /**
  * Constructor to set initial or default values of member properties
  * @param   string            $status   Initialization value for the property $this->status
  * @param   string            $uuid     Initialization value for the property $this->uuid  
  */
 public function __construct()
 {
     if (2 == func_num_args()) {
         $this->status = func_get_arg(0);
         $this->uuid = func_get_arg(1);
     }
 }
开发者ID:bemyguest,项目名称:sdk-php,代码行数:12,代码来源:UpdateBookingRequest.php

示例14: __construct

 public function __construct()
 {
     if (func_num_args() == 1) {
         $arg = func_get_arg(0);
         $this->_fromArray($arg);
     }
 }
开发者ID:socialweb,项目名称:tincan_xapi,代码行数:7,代码来源:StatementRef.php

示例15: query

 /**
  * @return Statement
  */
 public function query()
 {
     $query = func_get_arg(0);
     $stmt = new Statement($this, $query);
     $stmt->execute();
     return $stmt;
 }
开发者ID:mihai-stancu,项目名称:orientdb-orm,代码行数:10,代码来源:AbstractConnection.php


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