本文整理汇总了PHP中throw_error函数的典型用法代码示例。如果您正苦于以下问题:PHP throw_error函数的具体用法?PHP throw_error怎么用?PHP throw_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了throw_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadPackages
function loadPackages()
{
include_once(LIMB_DIR . '/core/util/ini_support.inc.php');
$toolkit =& Limb :: toolkit();
$ini =& $toolkit->getINI('packages.ini');
$this->_packages = array();
$groups = $ini->getAll();
$packages = $ini->getOption('packages');
if (!count($packages))
return throw_error(new LimbException('no packages in package.ini!'));
foreach($packages as $package_path)
{
$package_data = array();
include($package_path . '/setup.php');
$this->_definePackageConstant($PACKAGE_NAME, $package_path);
$package_data['path'] = $package_path;
$package_data['name'] = $PACKAGE_NAME;
$this->_packages[] = $package_data;
}
}
示例2: getClassId
function getClassId($object)
{
$toolkit =& Limb :: toolkit();
$db_table =& $toolkit->createDBTable('SysClass');
$class_name = $object->__class_name;
$rs =& $db_table->select(array('name' => $class_name));
$count = $rs->getTotalRowCount();
if ($count == 1)
{
$rs->rewind();
$record = $rs->current();
return $record->get('id');
}
elseif($count > 1)
{
return throw_error(new LimbException('there are more than 1 type found',
array('name' => $class_name)));
}
$insert_data['name'] = $class_name;
return $db_table->insert($insert_data);
}
示例3: run
public function run($sql, $data = array())
{
try {
$statement = $this->PDO->prepare($sql);
if (count($data)) {
foreach ($data as $key => $value) {
if (is_int($value)) {
$statement->bindValue(":" . $key, $value, PDO::PARAM_INT);
} else {
if (is_bool($value)) {
$statement->bindValue(":" . $key, $value, PDO::PARAM_BOOL);
} else {
if (is_null($value)) {
$statement->bindValue(":" . $key, $value, PDO::PARAM_NULL);
} else {
if (is_string($value)) {
$statement->bindValue(":" . $key, $value);
}
}
}
}
}
}
$statement->execute();
return $statement;
} catch (PDOException $e) {
throw_error("Query Error: " . $e->getMessage());
}
}
示例4: resize
function resize($max_size)
{
$image_library =& $this->_getImageLibrary();
$media_manager =& $this->_getMediaManager();
$media_file_id = $this->getMediaFileId();
$input_file = $media_manager->getMediaFilePath($media_file_id);
$output_file = $this->_generateTempFile();
$input_file_type = $image_library->getImageType($this->getMimeType());
$output_file_type = $image_library->fallBackToAnySupportedType($input_file_type);
$image_library->setInputFile($input_file);
$image_library->setInputType($input_file_type);
$image_library->setOutputFile($output_file);
$image_library->setOutputType($output_file_type);
$image_library->resize(array('max_dimension' => $max_size));
//ugly!!!
$image_library->commit();
if (catch_error('LimbException', $e)) {
if (file_exists($output_file)) {
$this->_unlinkTempFile($output_file);
}
return throw_error($e);
}
$this->_updateDimensionsUsingFile($output_file);
$media_file_id = $media_manager->store($output_file);
$this->setMediaFileId($media_file_id);
$this->_unlinkTempFile($output_file);
}
示例5: create
function create($library = 'gd', $dir = '')
{
if(defined('IMAGE_LIBRARY'))
$library = IMAGE_LIBRARY;
$image_class_name = 'image_' . $library;
if(isset($GLOBALS['global_' . $image_class_name]))
$obj =& $GLOBALS['global_' . $image_class_name];
else
$obj = null;
if(get_class($obj) != $image_class_name)
{
$dir = ($dir == '') ? LIMB_DIR . '/core/image/' : $dir;
if(!file_exists($dir . $image_class_name . '.class.php'))
return throw_error(new FileNotFoundException('image library not found', $dir . $image_class_name . '.class.php'));
include_once($dir . $image_class_name . '.class.php');
$obj = new $image_class_name();
$GLOBALS['global_' . $image_class_name] =& $obj;
}
return $obj;
}
示例6: run
function run(&$filter_chain, &$request, &$response)
{
$toolkit =& Limb :: toolkit();
$action_resolver =& $toolkit->getRequestResolver('action');
$service_resolver =& $toolkit->getRequestResolver('service');
if(!is_object($service_resolver) || !is_object($action_resolver))
return throw_error(new LimbException('request resolvers not set'));
$service =& $service_resolver->resolve($request);
if(!$action =& $action_resolver->resolve($request))
{
$toolkit->setService($service);
}
elseif($service->actionExists($action))
{
$service->setCurrentAction($action);
$toolkit->setService($service);
}
else
{
$service404 = new Service('404');
$toolkit->setService($service404);
}
$filter_chain->next();
}
示例7: preParse
function preParse()
{
if (!isset($this->attributes['name'])) {
return throw_error(new WactException('missing required attribute', array('tag' => $this->tag, 'attribute' => 'name', 'file' => $this->source_file, 'line' => $this->starting_line_no)));
}
$this->const = $this->attributes['name'];
return PARSER_REQUIRE_PARSING;
}
示例8: getFileResolver
function & getFileResolver($resolver_name)
{
global $LIMB_FILE_RESOLVERS;
if(isset($LIMB_FILE_RESOLVERS[$resolver_name]))
return $LIMB_FILE_RESOLVERS[$resolver_name];
else
return throw_error(new LimbException('unknown file resolver',
array('resolver' => $resolver_name)));
}
示例9: resolve
function resolve($class_path, $params = array())
{
if(file_exists(LIMB_DIR . '/core/actions/' . $class_path . '.class.php'))
$full_path = LIMB_DIR . '/core/actions/' . $class_path . '.class.php';
else
return throw_error(new FileNotFoundException('action not found', $class_path));
return $full_path;
}
示例10: getCurrentDateTime
/**
* Created by PhpStorm.
* User: Asus
* Date: 5/30/2015
* Time: 9:57 AM
*/
function getCurrentDateTime()
{
global $timezone;
try {
$now = new DateTime("now", new DateTimeZone($timezone['timezone']));
} catch (Exception $e) {
throw_error($e->getMessage());
}
return $now->format("Y-m-d H:i:s");
}
示例11: get_slow_page_data
function get_slow_page_data()
{
global $xhprofModelObject;
global $game_cfg;
$result = $xhprofModelObject->generic_execute_get_query_detail('get_slow_page_data', array("slow_page_table" => $game_cfg["slow_page_table"]));
if (!$result) {
throw_error("Internal plumping error, slow db could not be owned (mined)");
}
return $result;
}
示例12: _applyAccessPolicy
function _applyAccessPolicy($object, $action)
{
$access_policy = new AccessPolicy();
$access_policy->applyAccessTemplates($object, $action);
if (catch_error('LimbException', $e)) {
MessageBox::writeNotice("Access template of " . get_class($object) . " for action '{$action}' not defined!!!");
} elseif (catch_error('LimbException', $e)) {
return throw_error($e);
}
}
示例13: load
function load()
{
if(!file_exists($this->file_path))
return throw_error(new FileNotFoundException('ini file not found', $this->file_path));
if ($this->use_cache)
$this->_loadCache();
else
$this->_parse($this->file_path);
}
示例14: preParse
function preParse()
{
if (!isset($this->attributes['tab_id'])) {
return throw_error(new WactException('missing required attribute', array('tag' => $this->tag, 'attribute' => 'id', 'file' => $this->source_file, 'line' => $this->starting_line_no)));
}
if (!in_array($this->attributes['tab_id'], $this->parent->parent->tabs)) {
return throw_error(new WactException('invalid attribute value', array('tag' => $this->tag, 'attribute' => 'tab_id', 'description' => 'tab_id not declared in <tab_item:label> tag', 'file' => $this->source_file, 'line' => $this->starting_line_no)));
}
return PARSER_REQUIRE_PARSING;
}
示例15: resolve
function resolve($file_name, $params = array())
{
if (file_exists(LIMB_DIR . '/tests/settings/' . $file_name))
$dir = LIMB_DIR . '/tests/settings/';
elseif (file_exists(LIMB_DIR . '/settings/' . $file_name))
$dir = LIMB_DIR . '/settings/';
else
return throw_error(new FileNotFoundException('ini file not found', $file_name));
return $dir . $file_name;
}