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


PHP Misc::array_map_deep方法代码示例

本文整理汇总了PHP中Misc::array_map_deep方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::array_map_deep方法的具体用法?PHP Misc::array_map_deep怎么用?PHP Misc::array_map_deep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Misc的用法示例。


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

示例1: array_map_deep

 /**
  * Method used to simulate array_map()'s functionality in a deeply nested
  * array. The PHP built-in function does not allow that.
  *
  * @access  public
  * @param   array $in_array The array to run the function against
  * @param   string $in_func The function to run
  * @param   array $in_args The array of arguments to pass to the function
  * @param   integer $in_index Internal parameter to specify which index of the array we are currently mapping
  * @return  array The mapped array
  */
 function array_map_deep(&$in_array, $in_func, $in_args = array(), $in_index = 1)
 {
     // fix people from messing up the index of the value
     if ($in_index < 1) {
         $in_index = 1;
     }
     foreach (array_keys($in_array) as $key) {
         // we need a reference, not a copy, normal foreach won't do
         $value =& $in_array[$key];
         // we need to copy args because we are doing
         // manipulation on it farther down
         $args = $in_args;
         if (is_array($value)) {
             Misc::array_map_deep($value, $in_func, $in_args, $in_index);
         } else {
             array_splice($args, $in_index - 1, $in_index - 1, $value);
             $value = call_user_func_array($in_func, $args);
         }
     }
     return $in_array;
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:32,代码来源:class.misc.php

示例2: checkDatabase

 /**
  * Checks on the status of the MySQL database.
  *
  * @access  public
  */
 function checkDatabase()
 {
     // try to connect to the database
     $dsn = array('phptype' => APP_SQL_DBTYPE, 'hostspec' => APP_SQL_DBHOST, 'database' => APP_SQL_DBNAME, 'username' => APP_SQL_DBUSER, 'password' => APP_SQL_DBPASS);
     $dbh = DB::connect($dsn);
     if (PEAR::isError($dbh)) {
         echo "ERROR: Could not connect to the mysql database. Detailed error message:\n\n";
         echo $dbh->getMessage() . '/' . $dbh->getDebugInfo();
     } else {
         $required_tables = array("custom_field", "custom_field_option", "custom_filter", "customer_account_manager", "customer_note", "email_account", "email_draft", "email_draft_recipient", "email_response", "faq", "faq_support_level", "group", "history_type", "irc_notice", "issue", "issue_association", "issue_attachment", "issue_attachment_file", "issue_checkin", "issue_custom_field", "issue_history", "issue_quarantine", "issue_requirement", "issue_user", "issue_user_replier", "mail_queue", "mail_queue_log", "news", "note", "phone_support", "project", "project_category", "project_custom_field", "project_email_response", "project_group", "project_news", "project_phone_category", "project_priority", "project_release", "project_round_robin", "project_status", "project_status_date", "project_user", "reminder_action", "reminder_action_list", "reminder_action_type", "reminder_field", "reminder_history", "reminder_level", "reminder_level_condition", "reminder_operator", "reminder_priority", "reminder_requirement", "reminder_triggered_action", "resolution", "round_robin_user", "search_profile", "status", "subscription", "subscription_type", "support_email", "support_email_body", "time_tracking", "time_tracking_category", "user");
         // add the table prefix to all of the required tables
         $required_tables = Misc::array_map_deep($required_tables, array('Monitor', '_add_table_prefix'));
         // check if all of the required tables are really there
         $stmt = "SHOW TABLES";
         $table_list = $dbh->getCol($stmt);
         for ($i = 0; $i < count($required_tables); $i++) {
             if (!in_array($required_tables[$i], $table_list)) {
                 echo "ERROR: Could not find required table '" . $required_tables[$i] . "'\n";
             }
         }
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:27,代码来源:class.monitor.php

示例3: checkDatabase

 /**
  * Checks on the status of the MySQL database.
  *
  * @return  integer Number of errors encountered.
  */
 public static function checkDatabase()
 {
     $required_tables = array('custom_field', 'custom_field_option', 'custom_filter', 'customer_account_manager', 'customer_note', 'email_account', 'email_draft', 'email_draft_recipient', 'email_response', 'faq', 'faq_support_level', 'group', 'history_type', 'irc_notice', 'issue', 'issue_association', 'issue_attachment', 'issue_attachment_file', 'issue_checkin', 'issue_custom_field', 'issue_history', 'issue_quarantine', 'issue_requirement', 'issue_user', 'issue_user_replier', 'mail_queue', 'mail_queue_log', 'news', 'note', 'phone_support', 'project', 'project_category', 'project_custom_field', 'project_email_response', 'project_group', 'project_news', 'project_phone_category', 'project_priority', 'project_release', 'project_round_robin', 'project_status', 'project_status_date', 'project_user', 'reminder_action', 'reminder_action_list', 'reminder_action_type', 'reminder_field', 'reminder_history', 'reminder_level', 'reminder_level_condition', 'reminder_operator', 'reminder_priority', 'reminder_requirement', 'reminder_triggered_action', 'resolution', 'round_robin_user', 'search_profile', 'status', 'subscription', 'subscription_type', 'support_email', 'support_email_body', 'time_tracking', 'time_tracking_category', 'user');
     // add the table prefix to all of the required tables
     $required_tables = Misc::array_map_deep($required_tables, array(__CLASS__, 'add_table_prefix'));
     // check if all of the required tables are really there
     $stmt = 'SHOW TABLES';
     $table_list = DB_Helper::getInstance()->getColumn($stmt);
     $errors = 0;
     foreach ($required_tables as $table) {
         if (!in_array($table, $table_list)) {
             echo ev_gettext('ERROR: Could not find required table "%s"', $table), "\n";
             $errors++;
         }
     }
     return $errors;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:22,代码来源:class.monitor.php

示例4: array

// |                                                                      |
// | You should have received a copy of the GNU General Public License    |
// | along with this program; if not, write to:                           |
// |                                                                      |
// | Free Software Foundation, Inc.                                       |
// | 59 Temple Place - Suite 330                                          |
// | Boston, MA 02111-1307, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com>                             |
// +----------------------------------------------------------------------+
//
// @(#) $Id: s.cvs_ping.php 1.4 03/01/16 01:47:31-00:00 jpm $
//
include_once "config.inc.php";
include_once APP_INC_PATH . "class.misc.php";
include_once APP_INC_PATH . "class.scm.php";
include_once APP_INC_PATH . "class.workflow.php";
include_once APP_INC_PATH . "db_access.php";
$HTTP_GET_VARS = Misc::array_map_deep($HTTP_GET_VARS, 'base64_decode');
foreach ($HTTP_GET_VARS['issue'] as $issue_id) {
    $files = array();
    for ($y = 0; $y < count($HTTP_GET_VARS['files']); $y++) {
        SCM::logCheckin($issue_id, $y);
        $files[] = array('file' => $HTTP_GET_VARS['files'][$y], 'old_version' => $HTTP_GET_VARS['old_versions'][$y], 'new_version' => $HTTP_GET_VARS['new_versions'][$y]);
    }
    $prj_id = Issue::getProjectID($issue_id);
    $module = $HTTP_GET_VARS['module'];
    $username = $HTTP_GET_VARS['username'];
    $commit_msg = $HTTP_GET_VARS['commit_msg'];
    Workflow::handleSCMCheckins($prj_id, $issue_id, $module, $files, $username, $commit_msg);
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:scm_ping.php


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