本文整理汇总了PHP中warning函数的典型用法代码示例。如果您正苦于以下问题:PHP warning函数的具体用法?PHP warning怎么用?PHP warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warning函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(StringObject $string, $offset, $brackets = '{}')
{
$this->string = $string;
$this->offset = $offset;
$this->match = null;
$this->length = 0;
list($opener, $closer) = str_split($brackets, 1);
if (strpos($string->raw, $opener, $this->offset) === false) {
return;
}
if (substr_count($string->raw, $opener) !== substr_count($string->raw, $closer)) {
$sample = substr($string->raw, $this->offset, 25);
warning("Unmatched token near '{$sample}'.");
return;
}
$patt = $opener === '{' ? Regex::$patt->block : Regex::$patt->parens;
if (preg_match($patt, $string->raw, $m, PREG_OFFSET_CAPTURE, $this->offset)) {
$this->match = $m;
$this->matchLength = strlen($m[0][0]);
$this->matchStart = $m[0][1];
$this->matchEnd = $this->matchStart + $this->matchLength;
$this->length = $this->matchEnd - $this->offset;
} else {
warning("Could not match '{$opener}'. Exiting.");
}
}
示例2: requireUser
function requireUser($b = true)
{
if ($b && !isLoggedIn()) {
warning('You need to login to view this page.');
redirect($GLOBALS['sLoginPage'] . '?ref=' . str_replace('?logout=true', '', $_SERVER['REQUEST_URI']));
}
}
示例3: __construct
/**
* Use Facebook::configure() to initialize the facebook instance.
*
* @param string $appId
* @param string $appSecret
* @param array $options
*/
function __construct($appId, $appSecret, $permissions = array(), $options = array())
{
$this->appId = $appId;
$this->appSecret = $appSecret;
if (is_array($permissions)) {
$permissions = implode(',', $permissions);
}
$this->requiredPermissions = $permissions;
$state = $this->getPersistentData('state');
if (!empty($state)) {
$this->state = $state;
}
$accessToken = $this->getPersistentData('access_token');
if (!empty($accessToken)) {
$this->accessToken = $accessToken;
}
if (isset($options['ignore_session_state'])) {
// Option to prevent the "No session started" warning.
$ignoreSessionState = $options['ignore_session_state'];
unset($options['ignore_session_state']);
} else {
$ignoreSessionState = false;
}
if ($ignoreSessionState == false && session_id() == false) {
warning('No session started');
}
foreach ($options as $property => $value) {
$this->{$property} = $value;
}
$this->logger = new Logger(array('identifier' => 'Facebook', 'singular' => 'request', 'plural' => 'requests', 'renderer' => 'Sledgehammer\\Facebook::renderLog', 'columns' => array('Method', 'Request', 'Duration')));
}
示例4: percentile_actions
/** Possible actions for a caller: delete */
function percentile_actions($percentile_id)
{
$CI =& get_instance();
$edit_link = anchor('percentile/edit/' . $percentile_id, img_edit());
$delete_link = anchor('percentile/delete/' . $percentile_id, img_delete(), warning(lang('sure_delete_percentile')));
return implode(' ', array($edit_link, $delete_link));
}
示例5: participation_actions
/** Possible actions for a participation: prioritize and delete */
function participation_actions($participation_id)
{
$CI =& get_instance();
$pp = $CI->participationModel->get_participation_by_id($participation_id);
$not_cancelled = $pp->cancelled == 0;
$is_confirmed = $pp->confirmed == 1 && $not_cancelled;
$not_completed = $is_confirmed && $pp->noshow == 0 && $pp->completed == 0;
$is_noshow = $pp->noshow == 1;
$is_completed = $pp->completed == 1;
$after_now = input_datetime($pp->appointment) > input_datetime('now');
$get_link = participation_get_link($pp);
$cancel_link = $not_completed && $not_cancelled ? anchor('participation/cancel/' . $pp->id, img_cancel(lang('cancelled'))) : img_cancel(lang('cancelled'), TRUE);
$reschedule_link = $not_completed ? anchor('participation/reschedule/' . $pp->id, img_calendar()) : img_calendar(TRUE);
$noshow_link = $is_confirmed && !$is_noshow && !$after_now ? anchor('participation/no_show/' . $pp->id, img_noshow()) : img_noshow(TRUE);
$completed_link = $is_confirmed && !$after_now ? anchor('participation/completed/' . $pp->id, img_accept(lang('completed'))) : img_accept(lang('completed'), TRUE);
$delete_link = anchor('participation/delete/' . $pp->id, img_p_delete(), warning(lang('sure_delete_part')));
$comment_link = anchor('participation/edit_comment/' . $pp->id, img_comment());
switch (current_role()) {
case UserRole::Admin:
$actions = array($get_link, $cancel_link, $reschedule_link, $noshow_link, $completed_link, $comment_link, $delete_link);
break;
case UserRole::Leader:
$actions = array($get_link, $cancel_link, $reschedule_link, $noshow_link, $completed_link, $comment_link);
break;
default:
$actions = array($get_link, $cancel_link, $reschedule_link, $comment_link);
break;
}
return implode(' ', $actions);
}
示例6: resolveDocRoot
protected static function resolveDocRoot($doc_root = null)
{
// Get document_root reference
// $_SERVER['DOCUMENT_ROOT'] is unreliable in certain CGI/Apache/IIS setups
if (!$doc_root) {
$script_filename = $_SERVER['SCRIPT_FILENAME'];
$script_name = $_SERVER['SCRIPT_NAME'];
if ($script_filename && $script_name) {
$len_diff = strlen($script_filename) - strlen($script_name);
// We're comparing the two strings so normalize OS directory separators
$script_filename = str_replace('\\', '/', $script_filename);
$script_name = str_replace('\\', '/', $script_name);
// Check $script_filename ends with $script_name
if (substr($script_filename, $len_diff) === $script_name) {
$path = substr($script_filename, 0, $len_diff);
$doc_root = realpath($path);
}
}
if (!$doc_root) {
$doc_root = realpath($_SERVER['DOCUMENT_ROOT']);
}
if (!$doc_root) {
warning("Could not get a valid DOCUMENT_ROOT reference.");
}
}
return Util::normalizePath($doc_root);
}
示例7: __constructor
public function __constructor()
{
if (func_get_args()) {
$this->parent = func_get_arg(0);
} else {
$this->parent = new client();
}
//record a "menu interface" in object client
//$this->_namespace = \get_constant('\platform\config\interfac3::_namespace');
//$this->{$this->_namespace} = empty_object();
//load template
$this->_template_namespace = \get_constant('\\platform\\config\\template::_namespace');
$this->{$this->_template_namespace} = new template($this);
//load components
$this->load_components();
//get array of allowed interfaces, depends on role (mode)
$access_list = '\\platform\\config\\interfac3::_a_' . $_SESSION['mode'];
if (is_defined($access_list)) {
$allowed_interfaces = \get_constant($access_list);
} else {
\error('interfac3', 'e001');
}
foreach ($allowed_interfaces as $interface) {
//record a sub object for "menu interface" in object client
//$this->{$this->_namespace}->{$interface} = empty_object();
//if interface exists, generate interface
if (is_defined('\\platform\\config\\interfac3::_i_' . $interface)) {
new interfac3($this, $interface);
} else {
\warning('interfac3', 'e002', $interface);
}
}
}
示例8: language_actions
/** Possible actions for a language: prioritize and delete */
function language_actions($language_id)
{
$CI =& get_instance();
$c = $CI->languageModel->get_language_by_id($language_id);
$d_link = anchor('language/delete/' . $c->id, img_delete(), warning(lang('sure_delete_language')));
return $d_link;
}
示例9: testsurvey_actions
/** Possible actions for a testsurvey: edit, view scores, delete */
function testsurvey_actions($testsurvey_id)
{
$inspect_link = anchor('testsurvey/get/' . $testsurvey_id, img_zoom('testsurvey'));
$find_link = anchor('testsurvey/find/' . $testsurvey_id, img_email(lang('testinvite')));
$edit_link = anchor('testsurvey/edit/' . $testsurvey_id, img_edit());
$delete_link = anchor('testsurvey/delete/' . $testsurvey_id, img_delete(), warning(lang('sure_delete_testsurvey')));
return implode(' ', array($inspect_link, $find_link, $edit_link, $delete_link));
}
示例10: create
/**
* @param string $model (required)
* @param array $values
* @param array $options array(
* 'repository' => (string) "default"
* )
*
* @return SimpleRecord
*/
public static function create($model = null, $values = [], $options = [])
{
if (count(func_get_args()) < 2) {
warning('SimpleRecord::create() requires minimal 1 parameter', 'SimpleRecord::create($model, $values = [], $options = []');
}
$options['model'] = $model;
return parent::create($values, $options);
}
示例11: testcat_actions
/** Possible actions for a testcat: edit, show scores and delete */
function testcat_actions($testcat_id)
{
$CI =& get_instance();
$scores = $CI->scoreModel->get_scores_by_testcat($testcat_id);
$edit_link = anchor('testcat/edit/' . $testcat_id, img_edit());
$score_link = count($scores) > 0 ? anchor('score/testcat/' . $testcat_id, img_scores()) : img_scores(TRUE);
$delete_link = anchor('testcat/delete/' . $testcat_id, img_delete(), warning(lang('sure_delete_testcat')));
return implode(' ', array($edit_link, $score_link, $delete_link));
}
示例12: user_actions
/** Possible actions for a user: edit, view participants, call, archive, delete */
function user_actions($user_id)
{
$CI =& get_instance();
$u = $CI->userModel->get_user_by_id($user_id);
$edit_link = anchor('user/edit/' . $u->id, img_edit());
$act_link = is_activated($u) ? anchor('user/deactivate/' . $u->id, img_active(TRUE)) : anchor('user/activate/' . $u->id, img_active(FALSE));
$delete_link = is_admin($u) ? img_delete(TRUE) : anchor('user/delete/' . $u->id, img_delete(), warning(lang('sure_delete_user')));
return implode(' ', array($edit_link, $act_link, $delete_link));
}
示例13: beforesave_not_empty
/**
*
* @param mixed $value
* @param array $column
* @param string $msg_prefix
* @return boolean
*/
function beforesave_not_empty($value, array $column, $msg_prefix) {
if (!$value) {
warning($msg_prefix."The field ".$column[0]." must be not empty!");
return false;
}
return true;
}
示例14: save
function save($filename, $contents)
{
if (!is_writeable($filename)) {
warning("{$filename} not writeable!");
return;
}
$fp = fopen($filename, "w");
fwrite($fp, $contents);
fclose($fp);
}
示例15: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param ProductRepository $products
* @param SupplierRepository $suppliers
* @param VatRateRepository $vat_rates
* @return Response
*/
public function edit($id, ProductRepository $products, SupplierRepository $suppliers, VatRateRepository $vat_rates)
{
try {
$product = $products->findById($id);
return view('products.edit')->with('model', $product)->with('suppliers', $suppliers->all())->with('vat_rates', $vat_rates->all());
} catch (ModelNotFoundException $e) {
flash() - warning(trans('products.not_found'));
return redirect()->route('product.index');
}
}