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


PHP Event::has_run方法代码示例

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


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

示例1: exception_handler

 /**
  * Dual-purpose PHP error and exception handler. Uses the kohana_error_page
  * view to display the message.
  *
  * @param   integer|object  exception object or error code
  * @param   string          error message
  * @param   string          filename
  * @param   integer         line number
  * @return  void
  */
 public static function exception_handler($exception, $message = NULL, $file = NULL, $line = NULL)
 {
     // PHP errors have 5 args, always
     $PHP_ERROR = func_num_args() === 5;
     // Test to see if errors should be displayed
     if ($PHP_ERROR and (error_reporting() & $exception) === 0) {
         return;
     }
     // This is useful for hooks to determine if a page has an error
     self::$has_error = TRUE;
     // Error handling will use exactly 5 args, every time
     if ($PHP_ERROR) {
         $code = $exception;
         $type = 'PHP Error';
         $template = 'kohana_error_page';
     } else {
         $code = $exception->getCode();
         $type = get_class($exception);
         $message = $exception->getMessage();
         $file = $exception->getFile();
         $line = $exception->getLine();
         $template = $exception instanceof Kohana_Exception ? $exception->getTemplate() : 'kohana_error_page';
     }
     if (is_numeric($code)) {
         $codes = self::lang('errors');
         if (!empty($codes[$code])) {
             list($level, $error, $description) = $codes[$code];
         } else {
             $level = 1;
             $error = $PHP_ERROR ? 'Unknown Error' : get_class($exception);
             $description = '';
         }
     } else {
         // Custom error message, this will never be logged
         $level = 5;
         $error = $code;
         $description = '';
     }
     // Remove the DOCROOT from the path, as a security precaution
     $file = str_replace('\\', '/', realpath($file));
     $file = preg_replace('|^' . preg_quote(DOCROOT) . '|', '', $file);
     if ($level <= self::$configuration['core']['log_threshold']) {
         // Log the error
         self::log('error', self::lang('core.uncaught_exception', $type, $message, $file, $line));
     }
     if ($PHP_ERROR) {
         $description = self::lang('errors.' . E_RECOVERABLE_ERROR);
         $description = is_array($description) ? $description[2] : '';
         if (!headers_sent()) {
             // Send the 500 header
             header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
         }
     } else {
         if (method_exists($exception, 'sendHeaders') and !headers_sent()) {
             // Send the headers if they have not already been sent
             $exception->sendHeaders();
         }
     }
     while (ob_get_level() > self::$buffer_level) {
         // Close open buffers
         ob_end_clean();
     }
     // Test if display_errors is on
     if (self::$configuration['core']['display_errors'] === TRUE) {
         if (!IN_PRODUCTION and $line != FALSE) {
             // Remove the first entry of debug_backtrace(), it is the exception_handler call
             $trace = $PHP_ERROR ? array_slice(debug_backtrace(), 1) : $exception->getTrace();
             // Beautify backtrace
             $trace = self::backtrace($trace);
         }
         // Load the error
         require self::find_file('views', empty($template) ? 'kohana_error_page' : $template);
     } else {
         // Get the i18n messages
         $error = self::lang('core.generic_error');
         $message = self::lang('core.errors_disabled', url::site(), url::site(Router::$current_uri));
         // Load the errors_disabled view
         require self::find_file('views', 'kohana_error_disabled');
     }
     if (!Event::has_run('system.shutdown')) {
         // Run the shutdown even to ensure a clean exit
         Event::run('system.shutdown');
     }
     // Turn off error reporting
     error_reporting(0);
     exit;
 }
开发者ID:nanangsyaifudin,项目名称:HAC-2012,代码行数:97,代码来源:Kohana.php

示例2:

 */
?>
<div class="bg">
	<h2>
		<?php 
echo Kohana::lang('ui_admin.checkins');
?>
	</h2>

<?php 
Event::run('ushahidi_action.admin_checkins_custom_layout');
?>
	
<?php 
// Kill the rest of the page if this event has been utilized by a plugin
if (!Event::has_run('ushahidi_action.admin_checkins_custom_layout')) {
    ?>

	<!-- tabs -->
	<div class="tabs">
		<!-- tab -->
		<div class="tab">
			<ul>
				<li><a href="#" onClick="checkinsAction('d', 'DELETE', '')"><?php 
    echo utf8::strtoupper(Kohana::lang('ui_main.delete'));
    ?>
</a></li>
			</ul>
		</div>
	</div>
	<?php 
开发者ID:rjmackay,项目名称:Ushahidi_Web,代码行数:31,代码来源:main.php

示例3:

 * @module     API Controller
 * @copyright  Ushahidi - http://www.ushahidi.com
 * @license    http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL) 
 */
?>
			<div class="bg">
				<h2>
					<?php 
admin::messages_subtabs($service_id);
?>
				</h2>

<?php 
Event::run('ushahidi_action.admin_messages_custom_layout');
// Kill the rest of the page if this event has been utilized by a plugin
if (!Event::has_run('ushahidi_action.admin_messages_custom_layout')) {
    ?>

				<!-- tabs -->
				<div class="tabs">
					<!-- tabset -->
					<ul class="tabset">
						<li><a href="<?php 
    echo url::site() . "admin/messages/index/" . $service_id;
    ?>
?type=1" <?php 
    if ($type == '1') {
        echo "class=\"active\"";
    }
    ?>
><?php 
开发者ID:mewsop,项目名称:Ushahidi_Web,代码行数:31,代码来源:messages.php

示例4: redirect

 /**
  * Sends a page redirect header and runs the system.redirect Event.
  *
  * @param  mixed   string site URI or URL to redirect to, or array of strings if method is 300
  * @param  string  HTTP method of redirect
  * @return void
  */
 public static function redirect($uri = '', $method = '302')
 {
     if (Event::has_run('system.send_headers')) {
         return FALSE;
     }
     $codes = array('refresh' => 'Refresh', '300' => 'Multiple Choices', '301' => 'Moved Permanently', '302' => 'Found', '303' => 'See Other', '304' => 'Not Modified', '305' => 'Use Proxy', '307' => 'Temporary Redirect');
     // Validate the method and default to 302
     $method = isset($codes[$method]) ? (string) $method : '302';
     if ($method === '300') {
         $uri = (array) $uri;
         $output = '<ul>';
         foreach ($uri as $link) {
             $output .= '<li>' . html::anchor($link) . '</li>';
         }
         $output .= '</ul>';
         // The first URI will be used for the Location header
         $uri = $uri[0];
     } else {
         $output = '<p>' . html::anchor($uri) . '</p>';
     }
     // Run the redirect event
     Event::run('system.redirect', $uri);
     if (strpos($uri, '://') === FALSE) {
         // HTTP headers expect absolute URLs
         $uri = url::site($uri, request::protocol());
     }
     if ($method === 'refresh') {
         header('Refresh: 0; url=' . $uri);
     } else {
         header('HTTP/1.1 ' . $method . ' ' . $codes[$method]);
         header('Location: ' . $uri);
     }
     // We are about to exit, so run the send_headers event
     Event::run('system.send_headers');
     exit('<h1>' . $method . ' - ' . $codes[$method] . '</h1>' . $output);
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:43,代码来源:url.php

示例5: output_buffer

 /**
  * Kohana output handler. Called during ob_clean, ob_flush, and their variants.
  *
  * @param   string  current output buffer
  * @return  string
  */
 public static function output_buffer($output)
 {
     // Could be flushing, so send headers first
     if (!Event::has_run('system.send_headers')) {
         // Run the send_headers event
         Event::run('system.send_headers');
     }
     // Set final output
     Kohana::$output = $output;
     // Set and return the final output
     return Kohana::$output;
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:18,代码来源:Kohana.php

示例6: redirect

 /**
  * Sends a page redirect header.
  *
  * @param  mixed   string site URI or URL to redirect to, or array of strings if method is 300
  * @param  string  HTTP method of redirect
  * @return void
  */
 public static function redirect($uri = '', $method = '302')
 {
     if (Event::has_run('system.send_headers')) {
         return;
     }
     $uri = (array) $uri;
     for ($i = 0, $count_uri = count($uri); $i < $count_uri; $i++) {
         if (strpos($uri[$i], '://') === FALSE) {
             $uri[$i] = url::site($uri[$i]);
         }
     }
     if ($method == '300') {
         if ($count_uri > 0) {
             header('HTTP/1.1 300 Multiple Choices');
             header('Location: ' . $uri[0]);
             $choices = '';
             foreach ($uri as $href) {
                 $choices .= '<li><a href="' . $href . '">' . $href . '</a></li>';
             }
             exit('<h1>301 - Multiple Choices:</h1><ul>' . $choices . '</ul>');
         }
     } else {
         $uri = $uri[0];
         if ($method == 'refresh') {
             header('Refresh: 0; url=' . $uri);
         } else {
             $codes = array('301' => 'Moved Permanently', '302' => 'Found', '303' => 'See Other', '304' => 'Not Modified', '305' => 'Use Proxy', '307' => 'Temporary Redirect');
             $method = isset($codes[$method]) ? $method : '302';
             header('HTTP/1.1 ' . $method . ' ' . $codes[$method]);
             header('Location: ' . $uri);
         }
         exit('<h1>' . $method . ' - ' . $codes[$method] . '</h1><p><a href="' . $uri . '">' . $uri . '</a></p>');
     }
 }
开发者ID:Toushi,项目名称:flow,代码行数:41,代码来源:url.php

示例7: output_buffer

 /**
  * Eight output handler.
  *
  * @param   string  current output buffer
  * @return  string
  */
 public static function output_buffer($output)
 {
     if (!Event::has_run('system.send_headers')) {
         // Run the send_headers event, specifically for cookies being set
         Event::run('system.send_headers');
     }
     // Set final output
     self::$output = $output;
     // Look for errors in the output buffer
     if (!self::$configuration['core']['display_errors'] && self::$configuration['core']['catch_all_errors']) {
         if (preg_match('#<phperror>.*</phperror>#is', self::$output, $matches)) {
             // We only care about the first error
             $match = $matches[0];
             // Pull some info out of the error
             preg_match('#error:(.*)\\ in\\ (.*)\\ on\\ line ([0-9]+)#i', strip_tags($match), $matches);
             $error = new Eight_Exception_PHP(E_ERROR, trim($matches[1]), trim($matches[2]), trim($matches[3]));
             // Log the error
             self::log('error', Eight_Exception_PHP::text($error));
             self::log_save();
             // Show the pretty error page
             self::$output = file_get_contents(self::find_file('views', 'eight/error_disabled', TRUE));
         }
     }
     // Set and return the final output
     return self::$output;
 }
开发者ID:shnhrrsn-abandoned,项目名称:EightPHP,代码行数:32,代码来源:eight.php

示例8: output_buffer

 /**
  * Eight output handler.
  *
  * @param   string  current output buffer
  * @return  string
  */
 public static function output_buffer($output)
 {
     if (!Event::has_run('system.send_headers')) {
         // Run the send_headers event, specifically for cookies being set
         Event::run('system.send_headers');
     }
     // Set final output
     self::$output = $output;
     // Set and return the final output
     return self::$output;
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:17,代码来源:eight.php


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