• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP log_warning函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: init

 /**
  * initialize exception handler list
  */
 public function init()
 {
     // if this object is already initialized, do nothing
     if ($this->init) {
         return TRUE;
     }
     // if our sandbox is not loaded, do nothing
     if (!$this->sandbox->isLoaded()) {
         return FALSE;
     }
     // read initialization options from sandbox profile
     $this->log_enabled = ub($this->sandbox->getProfile()->getBoolean('LOG_ENABLED', FALSE));
     $this->log_level = us($this->sandbox->getProfile()->getString('LOG_LEVEL', 'W'));
     $this->log_no_buffer = ub($this->sandbox->getProfile()->getBoolean('LOG_NO_BUFFER', FALSE));
     $this->log_tag_filters = uv($this->sandbox->getProfile()->getArray('LOG_TAG_FILTERS', array()));
     $this->log_loggers = uv($this->sandbox->getProfile()->getArray('LOG_LOGGERS', array()));
     $this->loggers = array();
     // create loggers on demand
     if ($this->log_loggers) {
         foreach ($this->log_loggers as $logger_name) {
             if (strlen($logger_name) === 0) {
                 continue;
             }
             if (!isset($this->loggers[$logger_name])) {
                 $logger = $this->sandbox->createObject($logger_name, 'logger', array(), 'Charcoal_ILogger');
                 self::register($logger_name, $logger);
             } else {
                 log_warning("system,debug,error", "Logger[{$logger_name}] is already registered!");
             }
         }
     }
     $this->init = TRUE;
     return TRUE;
 }
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:37,代码来源:LoggerList.class.php


示例2: process

function process($info)
{
    $commit_info = $info['commit_info'];
    $module = $info['module'];
    $git_path = $info['git_path'];
    $svn_path = $info['svn_path'];
    if (empty($module) || empty($git_path) || empty($svn_path)) {
        log_warning(sprintf("some parameter is invalid. " . "module[%s] git_path[%s] svn_path[%s]", $module, $git_path, $svn_path));
        return false;
    }
    $svn_path_name = basename($svn_path);
    if ($svn_path_name != $module) {
        log_warning("svn module does not match git module", $svn_path_name, $module);
        return false;
    }
    if ($commit_info['ref'] != 'refs/heads/master') {
        log_debug("omit non master commit");
        return true;
    }
    $pwd = dirname(__FILE__);
    $cmd = "(source ~/.bashrc && cd {$pwd} && nohup ./git2svn.sh {$module} {$git_path} {$svn_path}) >./log/job.\$\$.log 2>&1 & echo \$!";
    exec($cmd, $output, $ret);
    log_debug(sprintf("start background sync script. cmd[%s] ret[%s] job-pid[%s]", $cmd, $ret, $output[0]));
    if ($ret == 0) {
        return true;
    } else {
        return false;
    }
}
开发者ID:sdgdsffdsfff,项目名称:Git2Svn,代码行数:29,代码来源:gitlab-webhook-sync.php


示例3: index

 /**
  * パスワードリマインダ.
  *
  * @param Application $app
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function index(Application $app, Request $request)
 {
     $builder = $app['form.factory']->createNamedBuilder('', 'forgot');
     $event = new EventArgs(array('builder' => $builder), $request);
     $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_FORGOT_INDEX_INITIALIZE, $event);
     $form = $builder->getForm();
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $Customer = $app['eccube.repository.customer']->getActiveCustomerByEmail($form->get('login_email')->getData());
         if (!is_null($Customer)) {
             // リセットキーの発行・有効期限の設定
             $Customer->setResetKey($app['eccube.repository.customer']->getUniqueResetKey($app))->setResetExpire(new \DateTime('+' . $app['config']['customer_reset_expire'] . ' min'));
             // リセットキーを更新
             $app['orm.em']->persist($Customer);
             $app['orm.em']->flush();
             $event = new EventArgs(array('form' => $form, 'Customer' => $Customer), $request);
             $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_FORGOT_INDEX_COMPLETE, $event);
             // 完了URLの生成
             $reset_url = $app->url('forgot_reset', array('reset_key' => $Customer->getResetKey()));
             // メール送信
             $app['eccube.service.mail']->sendPasswordResetNotificationMail($Customer, $reset_url);
             // ログ出力
             $app['monolog']->addInfo('send reset password mail to:' . "{$Customer->getId()} {$Customer->getEmail()} {$request->getClientIp()}");
         } else {
             log_warning('Un active customer try send reset password email: ', array('Enter email' => $form->get('login_email')->getData()));
         }
         return $app->redirect($app->url('forgot_complete'));
     }
     return $app->render('Forgot/index.twig', array('form' => $form->createView()));
 }
开发者ID:ryo-endo,项目名称:ec-cube,代码行数:37,代码来源:ForgotController.php


示例4: loadConfig

 /**
  *  load config
  *
  * @param  string|Charcoal_String $key                  config key
  *
  * @return mixed   configure data
  */
 public function loadConfig($key)
 {
     //        Charcoal_ParamTrait::validateString( 1, $key );
     $source = $key . '.ini';
     $is_debug = b($this->debug)->isTrue();
     $result = NULL;
     if (!is_file($source)) {
         if ($is_debug) {
             print "ini file[{$source}] does not exist." . eol();
             log_warning("system, debug, config", "config", "ini file[{$source}] does not exist.");
         }
     } else {
         // read ini file
         $result = @parse_ini_file($source, TRUE);
         if ($is_debug) {
             print "[{$source}] parse_ini_file({$source})=" . eol();
             ad($result);
             if ($result === FALSE) {
                 print "parse_ini_file failed: [{$source}]" . eol();
                 log_warning("system, debug, config", "config", "parse_ini_file failed: [{$source}]");
             } else {
                 log_debug("system, debug, config", "config", "read ini file[{$source}]:" . print_r($result, true));
             }
         }
     }
     return $result;
 }
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:34,代码来源:IniConfigProvider.class.php


示例5: handleException

 /**
  * execute exception handlers
  *
  * @param Exception $e     exception to handle
  *
  * @return boolean        TRUE means the exception is handled, otherwise FALSE
  */
 public function handleException($e)
 {
     Charcoal_ParamTrait::validateException(1, $e);
     if ($e instanceof Charcoal_HttpStatusException) {
         $status_code = $e->getStatusCode();
         // Show HTTP error document
         self::showHttpErrorDocument($status_code);
         log_warning('system,error', 'exception', "http_exception: status_code={$status_code}");
         return TRUE;
     }
     return FALSE;
 }
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:19,代码来源:HttpErrorDocumentExceptionHandler.class.php


示例6: blockComment

 protected function blockComment()
 {
     if (starts_with($this->line, '//')) {
         $this->interrupted = true;
     } elseif (starts_with($this->line, '#')) {
         log_warning('Using the # symbol for comments is deprecated');
         $this->interrupted = true;
     } elseif (starts_with($this->line, '/*')) {
         if (ends_with($this->line, '*/')) {
             return null;
         }
         $this->isComment = true;
     } elseif (ends_with($this->line, '*/')) {
         $this->isComment = false;
     }
 }
开发者ID:vulcan-project,项目名称:rivescript-php,代码行数:16,代码来源:Line.php


示例7: loadModule

 public static function loadModule($sandbox, $module_path, $task_manager)
 {
     //        Charcoal_ParamTrait::validateSandbox( 1, $sandbox );
     //        Charcoal_ParamTrait::validateStringOrObjectPath( 2, $module_path );
     //        Charcoal_ParamTrait::validateImplements( 3, 'Charcoal_ITaskManager', $task_manager );
     try {
         log_debug('debug, event', "loading module: {$module_path}");
         if ($module_path instanceof Charcoal_ObjectPath) {
             $module_path = $module_path->toString();
         } else {
             $module_path = us($module_path);
         }
         // check if module is already loaded
         if (isset(self::$loaded_paths[$module_path])) {
             log_warning('system, event, debug', "module[{$module_path}] is already loaded.");
             return;
         }
         /** @var Charcoal_IModule $module */
         /** @var Charcoal_Sandbox $sandbox */
         $module = $sandbox->createObject($module_path, 'module', array(), 'Charcoal_IModule', 'Charcoal_SimpleModule');
         // load module tasks
         $loaded_tasks = $module->loadTasks($task_manager);
         // load module events source code
         $loaded_events = $module->loadEvents($task_manager);
         // if no tasks or events are loaded, you maybe passed a wrong module path
         if (empty($loaded_tasks) && empty($loaded_events)) {
             _throw(new Charcoal_ModuleLoaderException($module_path, "no tasks and events are loaded."));
         }
         // load required modules
         $required_modules = $module->getRequiredModules();
         if ($required_modules) {
             $loaded_modules = NULL;
             foreach ($required_modules as $module_name) {
                 if (strlen($module_name) === 0) {
                     continue;
                 }
                 self::loadModule($sandbox, $module_name, $task_manager);
             }
         }
         self::$loaded_paths[$module_path] = $module_path;
         log_debug('debug, event, module', "loaded module: {$module_path}");
     } catch (Exception $ex) {
         _catch($ex);
         _throw(new Charcoal_ModuleLoaderException($module_path, "failed to load  module.", $ex));
     }
 }
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:46,代码来源:ModuleLoader.class.php


示例8: Engine_ErrorHandler

function Engine_ErrorHandler($errno, $errstr, $errfile, $errline)
{
    switch ($errno) {
        case E_ERROR:
            log_error($errstr, $errfile, $errline);
            break;
        case E_PARSE:
            log_error($errstr, $errfile, $errline);
            break;
        case E_WARNING:
            log_warning($errstr, $errfile, $errline);
            break;
        case E_NOTICE:
            log_notice($errstr, $errfile, $errline);
            break;
        default:
            log_notice($errstr, $errfile, $errline);
    }
}
开发者ID:romlg,项目名称:cms36,代码行数:19,代码来源:error.lib.php


示例9: read_csv_file_from_handle

function read_csv_file_from_handle($file_handle, $seperator)
{
    $result = array();
    $column_names = array();
    $line_index = 0;
    while (!feof($file_handle)) {
        $current_parts = fgetcsv($file_handle, 0, $seperator);
        if (empty($current_parts)) {
            continue;
        }
        $line_index += 1;
        if ($line_index < 2) {
            $seperators = array("\t", ";", "|");
            foreach ($seperators as $seperator_candidate) {
                if (count($current_parts) >= 2) {
                    continue;
                }
                $seperator = $seperator_candidate;
                rewind($file_handle);
                $current_parts = fgetcsv($file_handle, 0, $seperator);
            }
            $column_names = array_map('trim', $current_parts);
            continue;
        }
        $row = array();
        $column_index = 0;
        foreach ($column_names as $column_name) {
            if (!empty($column_name)) {
                if (isset($current_parts[$column_index])) {
                    $row[$column_name] = $current_parts[$column_index];
                } else {
                    $row[$column_name] = null;
                    log_warning($line_index, "No value found in the '{$column_name}' column", 'http://wiki.github.com/petewarden/openheatmap/no-value-found-in-column');
                }
            }
            $column_index += 1;
        }
        $result[] = $row;
    }
    return $result;
}
开发者ID:nateforsyth,项目名称:openheatmap,代码行数:41,代码来源:geoutils.php


示例10: route

 /**
  * Lookup routing rules
  *
  * @return array returns combined array, FALSE if any pattern is matched.
  */
 public function route(Charcoal_IRequest $request, Charcoal_IRoutingRule $rule)
 {
     // Get path info
     //$request_uri = $_SERVER["REQUEST_URI"];
     //$script_name = $_SERVER["SCRIPT_NAME"];
     //$dir_name    = dirname($script_name);
     //$pos = strpos( $request_uri, $dir_name );
     //$url = substr( $request_uri, $pos + strlen($dir_name) );
     $url = rtrim($_SERVER["REQUEST_URI"], '/');
     log_info('debug,router', "routing started. URL=[{$url}]");
     $proc_key = $this->getSandbox()->getProfile()->getString('PROC_KEY', 'proc');
     $rule_keys = $rule->getKeys();
     if ($rule_keys && is_array($rule_keys)) {
         log_info('debug,router', "rule keys=[" . implode(",", $rule_keys) . "]");
         foreach ($rule_keys as $pattern) {
             $proc = $rule->getProcPath(s($pattern));
             log_info('debug,router', "pattern=[{$pattern}] proc=[{$proc}]");
             if ($proc) {
                 log_info('debug,router', "testing pattern=[{$pattern}] url=[{$url}]");
                 $params = self::_match($pattern, $url);
                 log_info('debug,router', "params:" . print_r($params, true));
                 // match
                 if ($params !== NULL) {
                     $request->setArray($params);
                     $request->set($proc_key, $proc);
                     log_info('debug,router', "routing rule matched! pattern=[{$pattern}] proc_path=[{$proc}]");
                     $result = array('proc' => $proc, 'params' => $params, 'pattern' => $pattern);
                     return $result;
                 }
             }
         }
         log_warning('system,debug,router', "no routing rule is matched.");
     } else {
         log_warning('system,debug,router', "routing rule are not defined.");
     }
     return FALSE;
 }
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:42,代码来源:SimpleRouter.class.php


示例11: getCache

 /**
  *    Get cache data
  *
  * @param Charcoal_String $key                   string name to identify cached data
  * @param Charcoal_String $type_name_checked     checks type(class/interface) if not NULL
  */
 public function getCache($key, Charcoal_String $type_name_checked = NULL)
 {
     //        Charcoal_ParamTrait::validateString( 1, $key );
     //        Charcoal_ParamTrait::validateString( 2, $type_name_checked, TRUE );
     try {
         $type_name_checked = us($type_name_checked);
         $cached_data = Charcoal_Cache::get($key);
         $type_check = $cached_data instanceof Charcoal_Object;
         if (!$type_check) {
             $actual_type = get_class($cached_data);
             log_warning("system, debug, cache", "cache", "cache type mismatch: expected=[Charcoal_Object] actual=[{$actual_type}]");
             return FALSE;
         }
         if ($cached_data !== FALSE && $type_name_checked !== NULL) {
             $type_check = $cached_data instanceof $type_name_checked;
             if (!$type_check) {
                 $actual_type = get_class($cached_data);
                 log_warning("system, debug, cache", "cache", "cache type mismatch: expected=[{$type_name_checked}] actual=[{$actual_type}]");
                 return FALSE;
             }
         }
         return $cached_data;
     } catch (Exception $ex) {
         _catch($ex);
         _throw(new Charcoal_EventContextException(__METHOD__ . '() failed.', $ex));
     }
 }
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:33,代码来源:EventContext.class.php


示例12: warning

 /**
  * Warning logging
  * 
  * @param string $message
  */
 public static function warning($message)
 {
     log_warning($message);
 }
开发者ID:jokopurnomoa,项目名称:elips-php,代码行数:9,代码来源:Log.php


示例13: handle_comment

function handle_comment($comment)
{
    global $OK_EXTRA_FUNCTIONS;
    if (substr($comment[1], 0, 17) == 'EXTRA FUNCTIONS: ') {
        $OK_EXTRA_FUNCTIONS = substr($comment[1], 17);
    }
    if (isset($GLOBALS['TODO'])) {
        if (strpos($comment[1], 'TODO') !== false) {
            log_warning('TODO comment found', $GLOBALS['i']);
        }
        if (strpos($comment[1], 'HACKHACK') !== false) {
            log_warning('HACKHACK comment found', $GLOBALS['i']);
        }
        if (strpos($comment[1], 'FIXME') !== false) {
            log_warning('FIXME comment found', $GLOBALS['i']);
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:parse.php


示例14: processEvents

 /**
  *   process events
  *
  * @param Charcoal_IEventContext $context
  *
  * @return int
  *
  * @throws Charcoal_BusinessException|Charcoal_RuntimeException
  */
 public function processEvents($context)
 {
     $debug = $this->getSandbox()->isDebug() || $context->getProcedure()->isDebugMode();
     if ($debug) {
         log_debug('system,event', "processEvents start.");
     }
     //        $procedure = $context->getProcedure();
     //        $request   = $context->getRequest();
     //        $sequence  = $context->getSequence();
     //        $response  = $context->getResponse();
     $max_event_loop = $this->max_event_loop;
     $exit_code = 0;
     try {
         $queue = $this->queue;
         $timer_all = Charcoal_Benchmark::start();
         $loop_id = 0;
         while (!$queue->isEmpty()) {
             if ($debug) {
                 log_debug('system,event', "event queue(" . count($queue) . "): {$queue}");
             }
             // increment loop counter
             $loop_id++;
             // イベント一覧を優先度でソートする
             $queue->sortByPriority();
             /** @var Charcoal_IEvent $event */
             $event = $queue->dequeue();
             /** @var string $event_name */
             $event_name = $event->getObjectName();
             /** @var Charcoal_ObjectPath $event_id */
             $event_id = $event->getObjectPath();
             $delete_event = FALSE;
             $context->setEvent($event);
             // if this event loop exceeds [max_event_loop], thro exception
             if ($loop_id > $max_event_loop) {
                 log_warning("system,event", "[loop:{$loop_id}/{$event_name}] aborting by overflow maximum loop count[{$max_event_loop}].", "task_manager");
                 log_warning("system,event", "[loop:{$loop_id}/{$event_name}] event queue=[{$queue}].", "task_manager");
                 _throw(new Charcoal_EventLoopCounterOverflowException($max_event_loop));
             }
             if ($debug) {
                 log_debug('system,event', "[loop:{$loop_id}/{$event_name}] event loop start.");
             }
             // タスク一覧を優先度でソートする
             $key_priority = array();
             foreach ($this->tasks as $key => $task) {
                 $key_priority[$key] = ui($task->getPriority());
             }
             $a_task_list = uv($this->tasks);
             array_multisort($key_priority, SORT_DESC, $a_task_list);
             $this->tasks = v($a_task_list);
             // task list to remove on end of this loop
             $remove_tasks = NULL;
             // すべてのタスクにイベントをディスパッチする
             if ($debug) {
                 log_debug('system,event', "[loop:{$loop_id}/{$event_name}] task list: [{$this->tasks}]");
             }
             foreach ($this->tasks as $task) {
                 $task_name = $task->getObjectName();
                 $task_id = $task->getObjectPath();
                 if ($debug) {
                     log_debug('system,event', "[loop:{$loop_id}/{$event_name}/{$task_name}] event[{$event_name}] is dispatching to task[{$task_name}].");
                 }
                 // イベントフィルタ
                 $process = FALSE;
                 $event_filters = $task->getEventFilters();
                 if ($debug) {
                     log_debug('system,event', "[loop:{$loop_id}/{$event_name}/{$task_name}] task event filter: " . $event_filters);
                 }
                 foreach ($event_filters as $filter) {
                     if ($event_id->getObjectPathString() == us($filter)) {
                         $process = TRUE;
                         break;
                     }
                 }
                 if (!$process) {
                     if ($debug) {
                         log_debug('system,event', "[loop:{$loop_id}/{$event_name}/{$task_name}] event[{$event_name}] is NOT found in task's event filters: [{$event_filters}]. Passing this task.");
                     }
                     continue;
                 }
                 if ($debug) {
                     log_debug('system,event', "[loop:{$loop_id}/{$event_name}/{$task_name}] event[{$event_name}] is found in task's event filters: [{$event_filters}].");
                 }
                 // task timer start
                 $timer_task = Charcoal_Benchmark::start();
                 $result = NULL;
                 try {
                     $result = $task->processEvent($context);
                     if ($debug) {
                         log_debug('system,event', "[loop:{$loop_id}/{$event_name}/{$task_name}] returned from processEvent with result:" . print_r($result, true));
                     }
                 } catch (Charcoal_BusinessException $e) {
//.........这里部分代码省略.........
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:101,代码来源:DefaultTaskManager.class.php


示例15: delete_user

 /**
  * @param Page $page
  * @param bool $with_images
  * @param bool $with_comments
  */
 private function delete_user(Page $page, $with_images = false, $with_comments = false)
 {
     global $user, $config, $database;
     $page->set_title("Error");
     $page->set_heading("Error");
     $page->add_block(new NavBlock());
     if (!$user->can("delete_user")) {
         $page->add_block(new Block("Not Admin", "Only admins can delete accounts"));
     } else {
         if (!isset($_POST['id']) || !is_numeric($_POST['id'])) {
             $page->add_block(new Block("No ID Specified", "You need to specify the account number to edit"));
         } else {
             log_warning("user", "Deleting user #{$_POST['id']}");
             if ($with_images) {
                 log_warning("user", "Deleting user #{$_POST['id']}'s uploads");
                 $rows = $database->get_all("SELECT * FROM images WHERE owner_id = :owner_id", array("owner_id" => $_POST['id']));
                 foreach ($rows as $key => $value) {
                     $image = Image::by_id($value['id']);
                     if ($image) {
                         send_event(new ImageDeletionEvent($image));
                     }
                 }
             } else {
                 $database->Execute("UPDATE images SET owner_id = :new_owner_id WHERE owner_id = :old_owner_id", array("new_owner_id" => $config->get_int('anon_id'), "old_owner_id" => $_POST['id']));
             }
             if ($with_comments) {
                 log_warning("user", "Deleting user #{$_POST['id']}'s comments");
                 $database->execute("DELETE FROM comments WHERE owner_id = :owner_id", array("owner_id" => $_POST['id']));
             } else {
                 $database->Execute("UPDATE comments SET owner_id = :new_owner_id WHERE owner_id = :old_owner_id", array("new_owner_id" => $config->get_int('anon_id'), "old_owner_id" => $_POST['id']));
             }
             send_event(new UserDeletionEvent($_POST['id']));
             $database->execute("DELETE FROM users WHERE id = :id", array("id" => $_POST['id']));
             $page->set_mode("redirect");
             $page->set_redirect(make_link("post/list"));
         }
     }
 }
开发者ID:JarJak,项目名称:shimmie2,代码行数:43,代码来源:main.php


示例16: lex

function lex($text = NULL)
{
    global $PCONTINUATIONS, $PCONTINUATIONS_SIMPLE, $PTOKENS, $TEXT;
    if (!is_null($text)) {
        $TEXT = $text;
    }
    // ocPortal doesn't make use of this, so no need to understand it
    $matches = array();
    if (strpos($TEXT, '<' . '?php') === false) {
        if (strpos($TEXT, '<' . '?') !== false) {
            if (strpos($TEXT, '?' . '>') !== false) {
                log_warning('It is best to only have one PHP code block and not to terminate it. This stops problems with white-space at the end of files.');
            } else {
                $TEXT .= '?' . '>';
            }
            log_warning('Use "<' . '?php" tagging for compatibility.');
            $num_matches = preg_match_all('#<\\?(.*)\\?' . '>#sU', $TEXT, $matches, PREG_OFFSET_CAPTURE);
        } elseif (strpos($TEXT, '<' . '%') !== false) {
            if (strpos($TEXT, '%' . '>') !== false) {
                log_warning('It is best to only have one PHP code block and not to terminate it. This stops problems with white-space at the end of files.');
            } else {
                $TEXT .= '%>';
            }
            log_warning('Use "<' . '?php" tagging for compatibility.');
            $num_matches = preg_match_all('#<%(.*)\\%>#sU', $TEXT, $matches, PREG_OFFSET_CAPTURE);
        } else {
            $num_matches = 0;
        }
    } else {
        if (strpos($TEXT, '?' . '>') !== false) {
            log_warning('It is best to only have one PHP code block and not to terminate it. This stops problems with white-space at the end of files.');
        } else {
            $TEXT .= '?' . '>';
        }
        $num_matches = preg_match_all('#<\\?php(.*)\\?' . '>#s', $TEXT, $matches, PREG_OFFSET_CAPTURE);
        // TODO: Put U back. I had to take it out because some kind of limit seemed to get hit with how much matching can be done with it on.
    }
    $new_text = '';
    $between_all = '';
    $extra_skipped = 0;
    $last_m = NULL;
    for ($i = 0; $i < $num_matches; $i++) {
        $m = $matches[1][$i];
        if (is_string($m)) {
            continue;
        } else {
            $between = substr($TEXT, strlen($new_text) + $extra_skipped, $m[1] - 5 - strlen($new_text) - $extra_skipped);
            $extra_skipped += 7;
            $between_all .= $between;
            $new_text .= preg_replace('#[^\\n]#s', ' ', $between);
            $new_text .= $m[0];
            $last_m = $m;
        }
    }
    if (!is_null($last_m)) {
        $between = substr($TEXT, $last_m[1] + strlen($last_m[0]) + 2);
        $between_all .= $between;
        $new_text .= preg_replace('#[^\\n]#', ' ', $between);
    }
    if ($num_matches == 0) {
        $between_all = $TEXT;
    }
    $TEXT = $new_text;
    if (trim($between_all) != '' && isset($GLOBALS['FILENAME'])) {
        global $WITHIN_PHP;
        $WITHIN_PHP = $num_matches != 0;
        require 'xhtml.php';
    }
    // So that we don't have to consider end-of-file states as much.
    $TEXT .= "\n";
    $tokens = array();
    // We will be lexing into this list of tokens
    $special_token_value = '';
    // This will be used during special lexing modes to build up the special token value being lexed
    $special_token_value_2 = '';
    $previous_state = NULL;
    $lex_state = PLEXER_FREE;
    $escape_flag = false;
    // Used for string_literal escaping
    $heredoc_simple = false;
    $heredoc_buildup = array();
    $heredoc_symbol = '';
    $tokens_since_comment = 0;
    $indentation = 0;
    $new_line = false;
    $brace_stack = array();
    // Lex the code. Hard coded state changes occur. Understanding of tokenisation implicit. Trying to match tokens to $PTOKENS, otherwise an identifier.
    $char = '';
    $i = 0;
    $len = strlen($TEXT);
    while (true) {
        switch ($lex_state) {
            case PLEXER_FREE:
                // Jump over any white space in our way
                do {
                    $previous_char = $char;
                    list($reached_end, $i, $char) = plex__get_next_char($i);
                    if ($reached_end) {
                        break 3;
                    }
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:lex.php


示例17: onConfigSave

 public function onConfigSave(ConfigSaveEvent $event)
 {
     global $config;
     foreach ($_POST as $_name => $junk) {
         if (substr($_name, 0, 6) == "_type_") {
             $name = substr($_name, 6);
             $type = $_POST["_type_{$name}"];
             $value = isset($_POST["_config_{$name}"]) ? $_POST["_config_{$name}"] : null;
             switch ($type) {
                 case "string":
                     $config->set_string($name, $value);
                     break;
                 case "int":
                     $config->set_int($name, $value);
                     break;
                 case "bool":
                     $config->set_bool($name, $value);
                     break;
                 case "array":
                     $config->set_array($name, $value);
                     break;
             }
         }
     }
     log_warning("setup", "Configuration updated");
     foreach (glob("data/cache/*.css") as $css_cache) {
         unlink($css_cache);
     }
     log_warning("setup", "Cache cleared");
 }
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:30,代码来源:main.php


示例18: processEvent

 /**
  * process event
  *
  * @param Charcoal_IEventContext $context   event context
  *
  * @return Charcoal_Boolean|bool
  */
 public function processEvent($context)
 {
     $request = $context->getRequest();
     //        $response  = $context->getResponse();
     //        $sequence  = $context->getSequence();
     //        $procedure = $context->getProcedure();
     echo PHP_EOL;
     echo "==========================================" . PHP_EOL;
     echo "CharcoalPHP Test Runner" . PHP_EOL;
     echo "   Framework Version:" . Charcoal_Framework::getVersion() . PHP_EOL;
     echo "==========================================" . PHP_EOL;
     // get paramter from command line
     $scenario = $request->getString('scenario');
     $scenario = trim($scenario);
     log_debug("debug,scenario", "scenario: {$scenario}");
     if ($scenario === NULL) {
         echo "actions or scenario parameter must be specified." . PHP_EOL;
         log_error("debug,error,scenario", "actions or scenario parameter must be specified.");
         return TRUE;
     }
     $scenario_file = $this->scenario_dir . '/' . $scenario . '.scenario.ini';
     if (!is_file($scenario_file)) {
         echo "scenario file not found: {$scenario_file}" . PHP_EOL;
         log_error("debug,error,scenario", "scenario file not found: {$scenario_file}");
         return TRUE;
     }
     $scenario_data = parse_ini_file($scenario_file, TRUE);
     log_debug("debug,scenario", "scenario_data: " . print_r($scenario_data, true));
     if (empty($scenario_data)) {
         echo "couldn't read scenario file: {$scenario_file}" . PHP_EOL;
         log_error("debug,error,scenario", "couldn't read scenario file: {$scenario_file}");
         return TRUE;
     }
     foreach ($scenario_data as $section => $data) {
         $target = isset($data['target']) ? $data['target'] : NULL;
         $actions = isset($data['actions']) ? $data['actions'] : NULL;
         $enabled = isset($data['enabled']) ? $data['enabled'] : TRUE;
         log_debug("debug,scenario", "target: {$target}");
         log_debug("debug,scenario", "actions: {$actions}");
         log_debug("debug,scenario", "enabled: {$enabled}");
         if (in_array(strtolower($enabled), array('0', 'false', 'no'))) {
             echo "section[{$section}] is DISABLED. will skip." . PHP_EOL;
             log_warning("debug, scenario", "section[{$section}] is DISABLED.");
             continue;
         }
         if (empty($target)) {
             echo "[WARNING] 'target' is not found at section[{$section}]" . PHP_EOL;
             log_warning("debug, scenario", "'target' is not found at section[{$section}]");
             continue;
         }
         if (empty($actions)) {
             echo "[WARNING] 'actions' is not found at section[{$section}]" . PHP_EOL;
             log_warning("debug, scenario", "'actions' is not found at section[{$section}]");
             continue;
         }
         $target_path = new Charcoal_ObjectPath($target);
         $module_path = '@' . $target_path->getVirtualPath();
         $context->loadModule($module_path);
         log_info("debug,scenario", "loaded module: {$module_path}");
         $event_args = array($section, $target, $actions);
         /** @var Charcoal_IEvent $event */
         $event = $context->createEvent('test', $event_args);
         $context->pushEvent($event);
         log_debug("debug,scenario", "event_args: " . print_r($event_args, true));
         log_debug("debug,scenario", "pushed event: " . print_r($event, true));
     }
     // request fo test summary
     /** @var Charcoal_IEvent $event */
     $event = $context->createEvent('test_summary');
     $context->pushEvent($event);
     return TRUE;
 }
开发者ID:stk2k,项目名称:charcoalphp2,代码行数:79,代码来源:TestDispatcherTask.class.php


示例19: http_multi

function http_multi(&$requests)
{
    $handles = array();
    $responses = array();
    foreach ($requests as $req) {
        $url = $req['url'];
        $method = isset($req['method']) ? strtoupper($req['method']) : 'GET';
        $body = is_array($req['body']) ? $req['body'] : null;
        $headers = is_array($req['headers']) ? $req['headers'] : array();
        $more = is_array($req['more']) ? $req['more'] : array();
        $more['return_curl_handle'] = 1;
        if ($method == 'HEAD') {
            $ch = http_head($url, $headers, $more);
        } else {
            if ($method == 'GET') {
                $ch = http_get($url, $headers, $more);
            } else {
                if ($method == 'POST') {
                    $ch = http_post($url, $body, $headers, $more);
                } else {
                    if ($method == 'DELETE') {
                        $ch = http_delete($url, $body, $headers, $more);
                    } else {
                        if ($method == 'PUT') {
                            $ch = http_put($url, $body, $headers, $more);
                        } else {
                            log_warning("http", "unsupported HTTP method : {$method}");
                            continue;
                        }
                    }
                }
            }
        }
        $handles[] = $ch;
    }
    # http://us.php.net/manual/en/function.curl-multi-init.php
    $mh = curl_multi_init();
    foreach ($handles as $ch) {
        curl_multi_add_handle($mh, $ch);
    }
    $active = null;
    $start = microtime_ms();
    # this syntax makes my eyes bleed but whatever...
    # (20110822/straup)
    do {
        $mrc = curl_multi_exec($mh, $active);
    } while ($mrc == CURLM_CALL_MULTI_PERFORM);
    while ($active && $mrc == CURLM_OK) {
        if (curl_multi_select($mh) != -1) {
            do {
                $mrc = curl_multi_exec($mh, $active);
            } while ($mrc == CURLM_CALL_MULTI_PERFORM);
        }
    }
    $end = microtime_ms();
    $GLOBALS['timings']['http_count'] += count($handlers);
    $GLOBALS['timings']['http_time'] += $end - $start;
    foreach ($handles as $ch) {
        $raw = curl_multi_getcontent($ch);
        $info = curl_getinfo($ch);
        curl_multi_remove_handle($mh, $ch);
        $rsp = _http_parse_response($raw, $info);
        $responses[] = $rsp;
    }
    curl_multi_close($mh);
    return $responses;
}
开发者ID:sanyaade-multimedia,项目名称:flamework,代码行数:67,代码来源:lib_http.php


示例20: load_names_data

function load_names_data($file_name)
{
    if (!file_exists($file_name)) {
        log_warning(0, "Couldn't find file '{$file_name}'");
        return;
    }
    $csv_data = read_csv_file($file_name);
    $output = array();
    foreach ($csv_data as $row) {
        $names_string = $row['names'];
        $names = explode('|', $names_string);
        foreach ($names as $name) {
            $name = normalize_name($name);
            $name_words = explode(' ', $name);
            $name_words = array_reverse($name_words);
            $first_word = $name_words[0];
            if (!isset($output[$first_word])) {
                $output[$first_word] = array();
            }
            $preceding_words = array_slice($name_words, 1);
            $output 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP log_write函数代码示例发布时间:2022-05-15
下一篇:
PHP log_warn函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap