本文整理汇总了PHP中trigger_error函数的典型用法代码示例。如果您正苦于以下问题:PHP trigger_error函数的具体用法?PHP trigger_error怎么用?PHP trigger_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trigger_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _str_pad
/**
* utf8::str_pad
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007 Kohana Team
* @copyright (c) 2005 Harry Fuecks
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
*/
function _str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_RIGHT)
{
if (utf8::is_ascii($str) and utf8::is_ascii($pad_str)) {
return str_pad($str, $final_str_length, $pad_str, $pad_type);
}
$str_length = utf8::strlen($str);
if ($final_str_length <= 0 or $final_str_length <= $str_length) {
return $str;
}
$pad_str_length = utf8::strlen($pad_str);
$pad_length = $final_str_length - $str_length;
if ($pad_type == STR_PAD_RIGHT) {
$repeat = ceil($pad_length / $pad_str_length);
return utf8::substr($str . str_repeat($pad_str, $repeat), 0, $final_str_length);
}
if ($pad_type == STR_PAD_LEFT) {
$repeat = ceil($pad_length / $pad_str_length);
return utf8::substr(str_repeat($pad_str, $repeat), 0, floor($pad_length)) . $str;
}
if ($pad_type == STR_PAD_BOTH) {
$pad_length /= 2;
$pad_length_left = floor($pad_length);
$pad_length_right = ceil($pad_length);
$repeat_left = ceil($pad_length_left / $pad_str_length);
$repeat_right = ceil($pad_length_right / $pad_str_length);
$pad_left = utf8::substr(str_repeat($pad_str, $repeat_left), 0, $pad_length_left);
$pad_right = utf8::substr(str_repeat($pad_str, $repeat_right), 0, $pad_length_left);
return $pad_left . $str . $pad_right;
}
trigger_error('utf8::str_pad: Unknown padding type (' . $type . ')', E_USER_ERROR);
}
示例2: create
/**
* Factory method that creates a cache object based on configuration
* @param $name Name of definitions handled by cache
* @param $config Instance of HTMLPurifier_Config
*/
public function create($type, $config)
{
$method = $config->get('Cache', 'DefinitionImpl');
if ($method === null) {
return new HTMLPurifier_DefinitionCache_Null($type);
}
if (!empty($this->caches[$method][$type])) {
return $this->caches[$method][$type];
}
if (isset($this->implementations[$method]) && class_exists($class = $this->implementations[$method], false)) {
$cache = new $class($type);
} else {
if ($method != 'Serializer') {
trigger_error("Unrecognized DefinitionCache {$method}, using Serializer instead", E_USER_WARNING);
}
$cache = new HTMLPurifier_DefinitionCache_Serializer($type);
}
foreach ($this->decorators as $decorator) {
$new_cache = $decorator->decorate($cache);
// prevent infinite recursion in PHP 4
unset($cache);
$cache = $new_cache;
}
$this->caches[$method][$type] = $cache;
return $this->caches[$method][$type];
}
示例3: calculateGFRResult
function calculateGFRResult()
{
$tmpArr = array();
$tmpArr[] = date('Y-m-d H:i:s');
//observation time
$tmpArr[] = 'GFR (CALC)';
//desc
$gender = NSDR::populate($this->_patientId . "::com.clearhealth.person.displayGender");
$crea = NSDR::populate($this->_patientId . "::com.clearhealth.labResults[populate(@description=CREA)]");
$genderFactor = null;
$creaValue = null;
$personAge = null;
$raceFactor = 1;
switch ($gender[key($gender)]) {
case 'M':
$genderFactor = 1;
break;
case 'F':
$genderFactor = 0.742;
break;
}
if ((int) strtotime($crea['observation_time']) >= strtotime('now - 60 days') && strtolower($crea[key($crea)]['units']) == 'mg/dl') {
$creaValue = $crea[key($crea)]['value'];
}
$person = new Person();
$person->personId = $this->_patientId;
$person->populate();
if ($person->age > 0) {
$personAge = $person->age;
}
$personStat = new PatientStatistics();
$personStat->personId = $this->_patientId;
$personStat->populate();
if ($personStat->race == "AFAM") {
$raceFactor = 1.21;
}
$gfrValue = "INC";
if ($personAge > 0 && $creaValue > 0) {
$gfrValue = "" . (int) round(pow($creaValue, -1.154) * pow($personAge, -0.203) * $genderFactor * $raceFactor * 186);
}
trigger_error("gfr:: " . $gfrValue, E_USER_NOTICE);
$tmpArr[] = $gfrValue;
// lab value
$tmpArr[] = 'mL/min/1.73 m2';
//units
$tmpArr[] = '';
//ref range
$tmpArr[] = '';
//abnormal
$tmpArr[] = 'F';
//status
$tmpArr[] = date('Y-m-d H:i:s') . '::' . '0';
// observationTime::(boolean)normal; 0 = abnormal, 1 = normal
$tmpArr[] = '0';
//sign
//$this->_calcLabResults[uniqid()] = $tmpArr;
$this->_calcLabResults[1] = $tmpArr;
// temporarily set index to one(1) to be able to include in selected lab results
return $tmpArr;
}
示例4: __construct
/**
* Setup the config based on either the Configure::read() values
* or the PaypalIpnConfig in config/paypal_ipn_config.php
*
* Will attempt to read configuration in the following order:
* Configure::read('PaypalIpn')
* App::import() of config/paypal_ipn_config.php
* App::import() of plugin's config/paypal_ipn_config.php
*/
function __construct()
{
$this->config = Configure::read('PaypalIpn');
if (empty($this->config)) {
$importConfig = array('type' => 'File', 'name' => 'PaypalIpn.PaypalIpnConfig', 'file' => CONFIGS . 'paypal_ipn_config.php');
if (!class_exists('PaypalIpnConfig')) {
App::import($importConfig);
}
if (!class_exists('PaypalIpnConfig')) {
// Import from paypal plugin configuration
$importConfig['file'] = 'config' . DS . 'paypal_ipn_config.php';
App::import($importConfig);
}
if (!class_exists('PaypalIpnConfig')) {
trigger_error(__d('paypal_ipn', 'PaypalIpnConfig: The configuration could not be loaded.', true), E_USER_ERROR);
}
if (!PHP5) {
$config =& new PaypalIpnConfig();
} else {
$config = new PaypalIpnConfig();
}
$vars = get_object_vars($config);
foreach ($vars as $property => $configuration) {
if (strpos($property, 'encryption_') === 0) {
$name = substr($property, 11);
$this->encryption[$name] = $configuration;
} else {
$this->config[$property] = $configuration;
}
}
}
parent::__construct();
}
示例5: __construct
function __construct($oTemplate = false)
{
if (isset($GLOBALS['bxDolClasses'][get_class($this)])) {
trigger_error('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR);
}
parent::__construct($oTemplate ? $oTemplate : BxDolStudioTemplate::getInstance());
}
示例6: PMA_RTN_main
/**
* Main function for the routines functionality
*
* @return nothing
*/
function PMA_RTN_main()
{
global $db;
PMA_RTN_setGlobals();
/**
* Process all requests
*/
PMA_RTN_handleEditor();
PMA_RTN_handleExecute();
PMA_RTN_handleExport();
/**
* Display a list of available routines
*/
$columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`, ";
$columns .= "`DTD_IDENTIFIER`, `ROUTINE_DEFINITION`";
$where = "ROUTINE_SCHEMA='" . PMA_Util::sqlAddSlashes($db) . "'";
$items = PMA_DBI_fetch_result("SELECT {$columns} FROM `INFORMATION_SCHEMA`.`ROUTINES` WHERE {$where};");
echo PMA_RTE_getList('routine', $items);
/**
* Display the form for adding a new routine, if the user has the privileges.
*/
echo PMA_RTN_getFooterLinks();
/**
* Display a warning for users with PHP's old "mysql" extension.
*/
if ($GLOBALS['cfg']['Server']['extension'] === 'mysql') {
trigger_error(__('You are using PHP\'s deprecated \'mysql\' extension, ' . 'which is not capable of handling multi queries. ' . '[strong]The execution of some stored routines may fail![/strong] ' . 'Please use the improved \'mysqli\' extension to ' . 'avoid any problems.'), E_USER_WARNING);
}
}
示例7: action
/**
* Page のアクション.
*
* @return void
*/
public function action()
{
$objDeliv = new SC_Helper_Delivery_Ex();
$mode = $this->getMode();
if (!empty($_POST)) {
$objFormParam = new SC_FormParam_Ex();
$objFormParam->setParam($_POST);
$this->arrErr = $this->lfCheckError($mode, $objFormParam);
if (!empty($this->arrErr['deliv_id'])) {
trigger_error('', E_USER_ERROR);
return;
}
}
switch ($mode) {
case 'delete':
// ランク付きレコードの削除
$objDeliv->delete($_POST['deliv_id']);
$this->objDisplay->reload();
// PRG pattern
break;
case 'up':
$objDeliv->rankUp($_POST['deliv_id']);
$this->objDisplay->reload();
// PRG pattern
break;
case 'down':
$objDeliv->rankDown($_POST['deliv_id']);
$this->objDisplay->reload();
// PRG pattern
break;
default:
break;
}
$this->arrDelivList = $objDeliv->getList();
}
示例8: formatMessage
public static function formatMessage(Rule $rule, $withValue = TRUE)
{
$message = $rule->message;
if ($message instanceof Nette\Utils\Html) {
return $message;
} elseif ($message === NULL && is_string($rule->validator) && isset(static::$messages[$rule->validator])) {
$message = static::$messages[$rule->validator];
} elseif ($message == NULL) {
// intentionally ==
trigger_error("Missing validation message for control '{$rule->control->getName()}'.", E_USER_WARNING);
}
if ($translator = $rule->control->getForm()->getTranslator()) {
$message = $translator->translate($message, is_int($rule->arg) ? $rule->arg : NULL);
}
$message = preg_replace_callback('#%(name|label|value|\\d+\\$[ds]|[ds])#', function ($m) use($rule, $withValue) {
static $i = -1;
switch ($m[1]) {
case 'name':
return $rule->control->getName();
case 'label':
return $rule->control->translate($rule->control->caption);
case 'value':
return $withValue ? $rule->control->getValue() : $m[0];
default:
$args = is_array($rule->arg) ? $rule->arg : array($rule->arg);
$i = (int) $m[1] ? $m[1] - 1 : $i + 1;
return isset($args[$i]) ? $args[$i] instanceof IControl ? $withValue ? $args[$i]->getValue() : "%{$i}" : $args[$i] : '';
}
}, $message);
return $message;
}
示例9: output
public function output(Pagemill_Data $data, Pagemill_Stream $stream)
{
//$inner = $data->parseVariables($this->rawOutput(), false);
$tmp = new Pagemill_Stream(true);
foreach ($this->children() as $child) {
$child->process($data, $tmp);
}
$inner = html_entity_decode($tmp->peek(), ENT_COMPAT, 'UTF-8');
$data->set('value', $inner);
$use = $data->parseVariables($this->getAttribute('use'));
if ($use) {
// Use the requested editor if available
if (class_exists($use)) {
if (is_subclass_of($use, __CLASS__)) {
$sub = new $use($this->name(), $this->attributes(), $this, $this->docType());
$sub->output($data, $stream);
return;
} else {
trigger_error("Requested editor class '{$cls}' does not appear to be an editor subclass.");
}
} else {
trigger_error("Requested editor class '{$cls}' does not exist.");
}
}
if (TYPEF_DEFAULT_EDITOR != '') {
// Use the requested editor if available
$use = TYPEF_DEFAULT_EDITOR;
if (class_exists($use)) {
if (is_subclass_of($use, __CLASS__)) {
$sub = new $use($this->name(), $this->attributes(), $this, $this->docType());
$sub->output($data, $stream);
return;
} else {
trigger_error("Configured editor class '{$use}' does not appear to be an editor subclass.");
}
} else {
trigger_error("Configured editor class '{$use}' does not exist.");
}
}
// Use CKEditor if available
if (class_exists('Typeframe_Tag_Editor_CkEditor')) {
$sub = new Typeframe_Tag_Editor_CkEditor($this->name(), $this->attributes(), $this, $this->docType());
$sub->process($data, $stream);
return;
}
// No editor available. Use a plain textarea.
$attribs = '';
foreach ($this->attributes() as $k => $v) {
if ($k != 'use') {
$attribs .= " {$k}=\"" . $data->parseVariables($v) . "\"";
}
}
if (!$this->getAttribute('cols')) {
$attribs .= ' cols="80"';
}
if (!$this->getAttribute('rows')) {
$attribs .= ' rows="25"';
}
$stream->puts("<textarea{$attribs}>" . $inner . "</textarea>");
}
示例10: doExecute
/**
* Main function executed automatically by the controller
*
* @param object $registry Registry object
* @return @e void
*/
public function doExecute(ipsRegistry $registry)
{
/* From App */
$app = trim($this->request['f_app']);
$area = trim($this->request['f_area']);
$relid = intval($this->request['f_relid']);
if (!$app or !$area or empty($relid)) {
trigger_error("Missing data in " . __FILE__ . ' ' . __LINE__);
}
/* Init some data */
require_once IPS_ROOT_PATH . 'sources/classes/like/composite.php';
/*noLibHook*/
$this->_like = classes_like::bootstrap($app, $area);
$this->registry->getClass('class_localization')->loadLanguageFile(array('public_like'), 'core');
/* What to do? */
switch ($this->request['do']) {
case 'setDialogue':
$this->_setDialogue($app, $area, $relid);
break;
case 'save':
$this->_save($relid);
break;
case 'unset':
$this->_unset($relid);
break;
case 'more':
$this->_more($relid);
break;
}
}
示例11: save
/**
* update file contents and meta
* or create new file, if not existing
* @param int $ttl
* @return bool
*/
public function save($ttl = 0)
{
$ttl = $ttl ?: $this->ttl;
if (empty($this->file)) {
trigger_error('Unable to save. No file specified.');
return false;
}
if (is_null($this->content)) {
trigger_error(sprintf('Unable to save. Contents of file `%s´ is NULL.', $this->file));
return false;
}
if ($this->changed) {
$this->fs->write($this->file, (string) $this->content);
if ($this->f3->get('CACHE')) {
$cache = \Cache::instance();
$cacheHash = $this->getCacheHash($this->file);
if ($this->ttl) {
$cache->set($cacheHash, $this->content, $this->ttl);
} elseif ($cache->exists($cacheHash)) {
$cache->clear($cacheHash);
}
}
}
$this->changed = false;
$this->metaHandle->save($this->file, $this->meta, $ttl);
return true;
}
示例12: __construct
/**
* Constructor method. Will populate other information beyond IP address from the outlet itself.
*
* @param $ip_address
*/
public function __construct($ip_address)
{
$this->ip_address = $ip_address;
if (!$this->refresh()) {
trigger_error("Unable to connect to outlet at " . $ip_address, E_USER_WARNING);
}
}
示例13: afterroute
/**
* kick start the View, which creates the response
* based on our previously set content data.
* finally echo the response or overwrite this method
* and do something else with it.
* @return string
*/
public function afterroute()
{
if (!$this->response) {
trigger_error('No View has been set.');
}
echo $this->response->render();
}
示例14: set_user_affiliation
public function set_user_affiliation($user_id, $type, $scope = 'domain', $target_id = null)
{
$allowed_types = array('admin', 'member', 'none', 'outcast', 'owner');
$allowed_scope = array('domain', 'site', 'conv');
if (!in_array($type, $allowed_types)) {
trigger_error('You cannot set a Livefyre user\'s affiliation to a type other than the allowed: ' . implode(', ', $allowed_types), E_USER_ERROR);
return false;
} else {
if (!in_array($scope, $allowed_scope)) {
trigger_error('You cannot set a Livefyre user\'s affiliation within a scope other than the allowed: ' . implode(', ', $allowed_scope), E_USER_ERROR);
return false;
}
$user_jid = $user_id . '@' . $this->get_host();
$systemuser = $this->user('system');
$request_url = 'http://' . $this->get_host() . '/api/v1.1/private/management/user/' . $user_jid . '/role/?lftoken=' . $this->user('system')->token();
$post_data = array('affiliation' => $type);
if ($scope == 'domain') {
$post_data['domain_wide'] = '1';
} elseif ($scope == 'conv') {
$post_data['conv_id'] = $target_id;
} elseif ($scope == 'site') {
$post_data['site_id'] = $target_id;
}
return $this->http->request($request_url, array('method' => 'POST', 'data' => $post_data));
}
return false;
}
示例15: run
/**
* wird ausgeführt, wenn Cache über "Cache leeren" Button geleert wird
* @param array $data
* @return mixed
*/
public function run($data = null)
{
$functionData = explode('_', $data['name'], 3);
if (!isset($functionData[0]) || !isset($functionData[1]) || !isset($functionData[2])) {
trigger_error('Malformed function name data given: "' . $data['name'] . '"');
return false;
}
$vendorKey = $functionData[0];
$moduleKey = $functionData[1];
$functionName = $functionData[2];
$classFile = \fpcm\classes\baseconfig::$moduleDir . $vendorKey . '/' . $moduleKey . '/events/apiCallFunction.php';
if (!file_exists($classFile)) {
trigger_error('Event class "apiCallFunction" not found in ' . \fpcm\model\files\ops::removeBaseDir($classFile, true));
return false;
}
$classkey = $vendorKey . '/' . $moduleKey;
$eventClass = \fpcm\model\abstracts\module::getModuleEventNamespace($classkey, 'apiCallFunction');
/**
* @var \fpcm\model\abstracts\event
*/
$module = new $eventClass();
if (!$this->is_a($module)) {
return false;
}
$data['name'] = $functionName;
return $module->run($data);
}