本文整理汇总了PHP中PEAR_ErrorStack类的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_ErrorStack类的具体用法?PHP PEAR_ErrorStack怎么用?PHP PEAR_ErrorStack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PEAR_ErrorStack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _checkParams
/** Check params.
* @var array $params */
function _checkParams(&$params)
{
foreach ($this->__args as $name => $val) {
// Deal with unfilled parameters
if (!isset($params[$name]) || empty($params[$name])) {
// Set default val if available
if (!empty($this->__args[$name]['DEFAULT'])) {
$params[$name] = $this->__args[$name]['DEFAULT'];
} else {
$errstack =& PEAR_ErrorStack::singleton($this->__module);
$errstack->push(MB_MISSING_ACTION_ARG, 'error', array('name' => $name));
return null;
}
} else {
if (isset($this->__args[$name]['REGEX'])) {
if (!preg_match($this->__args[$name]['REGEX'], $params[$name])) {
$errstack =& PEAR_ErrorStack::singleton($this->__module);
$errstack->push(MB_INVALID_ACTION_ARG, 'error', array('module' => $this->__module, 'action' => $this->__name, 'name' => $name, 'val' => $params[$name], 'regex' => $this->__args[$name]['REGEX'], 'default' => $this->__args[$name]['DEFAULT']));
return null;
}
}
}
}
return true;
}
示例2: _getModuleClassPath
/** Renvoie le chemin vers le module.
* @param string $module_name
*/
function _getModuleClassPath($module_name)
{
$path = MB_CONF_PREFIX . "/phplib/modules/{$module_name}/{$module_name}.php";
if (!file_exists($path)) {
$errstack =& PEAR_ErrorStack::singleton('MicroBuilder');
$errstack->push(MB_NONEXISTENT_MODULE, 'error', array('module' => $module_name));
return null;
}
return $path;
}
示例3: _getActionClassPath
/** Renvoie le chemin vers l'action.
*/
function _getActionClassPath($module_name, $action_name)
{
$path = MB_CONF_PREFIX . "/phplib/modules/{$module_name}/actions/{$action_name}.php";
if (!file_exists($path)) {
$errstack =& PEAR_ErrorStack::singleton($module_name);
$errstack->push(MB_NONEXISTENT_ACTION, 'error', array('module' => $module_name, 'action' => $action_name, 'file' => $path));
return null;
}
return $path;
}
示例4: _getThemeClassPath
/** Returns theme class path
* @param string $theme_name
*/
function _getThemeClassPath($theme_name)
{
$path = MB_CONF_PREFIX . "/phplib/themes/{$theme_name}/{$theme_name}.php";
if (!file_exists($path)) {
$errstack =& PEAR_ErrorStack::singleton('MicroBuilder');
$errstack->push(MB_NONEXISTENT_THEME, 'fatal', array('theme' => $theme_name, 'path' => $path));
return null;
}
return $path;
}
示例5: errorCallback
/** ErrorCallback */
function errorCallback($err)
{
switch ($err['level']) {
case 'error':
break;
case 'fatal':
$mbstack =& PEAR_ErrorStack::singleton('MicroBuilder');
$mbstack->push(5, 'error', array(), "Fatal error during module execution");
break;
}
}
示例6: __construct
/**
* PHP5 type constructor
*/
function __construct()
{
global $wpdb;
//get the PhotoQ error stack for easy access
$this->_errStack =& PEAR_ErrorStack::singleton('PhotoQ');
PhotoQHelper::debug('-----------start plugin-------------');
// load text domain for localization
load_plugin_textdomain('PhotoQ', '', 'photoq-photoblog-plugin/lang');
// set names of database tables used and created by photoq
$this->QUEUEMETA_TABLE = $wpdb->prefix . "photoqmeta";
$this->QUEUE_TABLE = $wpdb->prefix . "photoq";
$this->QFIELDS_TABLE = $wpdb->prefix . "photoqfields";
$this->QCAT_TABLE = $wpdb->prefix . "photoq2cat";
$this->POSTS_TABLE = $wpdb->prefix . "posts";
// setting up database
$this->_db =& PhotoQSingleton::getInstance('PhotoQDB');
// setting up options
$this->_oc =& PhotoQSingleton::getInstance('PhotoQOptionController');
$this->_autoUpgrade();
//creating queue
$this->_queue =& PhotoQSingleton::getInstance('PhotoQQueue');
// actions and filters are next
// Insert the _actionAddAdminPages() sink into the plugin hook list for 'admin_menu'
add_action('admin_menu', array(&$this, '_actionAddAdminPages'));
// function executed when a post is deleted
add_action('delete_post', array(&$this, '_actionCleanUp'));
// Hook into the 'wp_dashboard_setup' action to setup the photoq dashboard widget
add_action('wp_dashboard_setup', array(&$this, '_actionAddDashboardWidget'));
add_action('admin_print_styles-index.php', array(&$this, '_actionEnqueueDashboardStyles'), 1);
// the next two hooks are used to show a thumb in the manage post section
add_filter('manage_posts_columns', array(&$this, '_filterAddThumbToListOfPosts'));
add_action('manage_posts_custom_column', array(&$this, '_actionInsertThumbIntoListOfPosts'), 10, 2);
// filter to show change photo form in post editing
add_filter('edit_form_advanced', array(&$this, '_filterShowChangePostedPhotoBox'));
// Only show description in content field when editing
add_filter('edit_post_content', array(&$this, '_filterPrepareEditorContent'), 100, 2);
// Get description back
add_filter('wp_insert_post_data', array(&$this, '_filterPostProcessEditedPost'), 100, 2);
register_activation_hook(PHOTOQ_PATH . 'whoismanu-photoq.php', array(&$this, 'activatePlugin'));
register_deactivation_hook(PHOTOQ_PATH . 'whoismanu-photoq.php', array(&$this, 'deactivatePlugin'));
add_filter('favorite_actions', array(&$this, '_filterAddFavoriteActions'));
add_filter('contextual_help', array(&$this, '_filterAddContextualHelp'), 100, 2);
/*foreach( $_POST as $key => $value){
PhotoQHelper::debug("POST $key: ".print_r($value,true)." <br />");
}
foreach( $_GET as $key => $value){
PhotoQHelper::debug("GET $key: ".print_r($value,true)." <br />");
}
*/
PhotoQHelper::debug('leave __construct()');
}
示例7: __construct
/**
* PHP5 type constructor
*
* @access public
*/
function __construct()
{
parent::__construct("wimpq_options", new PhotoQRenderOptionVisitor());
//get the PhotoQ error stack for easy access and set it up properly
$this->_errStack =& PEAR_ErrorStack::singleton('PhotoQ');
//get alternative original identifier if available
$originalID = get_option("wimpq_originalFolder");
if ($originalID) {
$this->ORIGINAL_IDENTIFIER = $originalID;
}
//establish default options
$this->_defineAndRegisterOptions();
//localize strings in js scripts etc. of option controller
$this->localizeStrings(array("switchLinkLabel" => __('Switch Sides', 'PhotoQ')));
}
示例8: __construct
/**
* PHP5 type constructor
*
* @access public
*/
function __construct()
{
global $wpdb;
//get the PhotoQ error stack for easy access
$this->_errStack =& PEAR_ErrorStack::singleton('PhotoQ');
// set wordpress database
$this->_wpdb =& $wpdb;
// some methods need access to options so instantiate an OptionController
$this->_oc =& PhotoQSingleton::getInstance('PhotoQOptionController');
// set names of database tables used and created by photoq
$this->QUEUEMETA_TABLE = $wpdb->prefix . "photoqmeta";
$this->QUEUE_TABLE = $wpdb->prefix . "photoq";
$this->QFIELDS_TABLE = $wpdb->prefix . "photoqfields";
$this->QCAT_TABLE = $wpdb->prefix . "photoq2cat";
$this->QBATCH_TABLE = $wpdb->prefix . "photoqbatch";
// set names of wordpress database tables used by photoq
$this->POSTS_TABLE = $wpdb->prefix . "posts";
$this->POSTMETA_TABLE = $wpdb->prefix . "postmeta";
}
示例9: __construct
/**
* PHP5 type constructor
*/
function __construct($id, $title, $descr, $exif, $path, $imgname, $tags = '', $slug = '', $edited = false)
{
//get the PhotoQ error stack for easy access
$this->_errStack =& PEAR_ErrorStack::singleton('PhotoQ');
//get the other singletons
$this->_oc =& PhotoQSingleton::getInstance('PhotoQOptionController');
$this->_db =& PhotoQSingleton::getInstance('PhotoQDB');
$this->id = $id;
$this->imgname = $imgname;
$this->_tags = $tags;
$this->title = $title;
$this->descr = $descr;
$this->exif = maybe_unserialize($exif);
if (empty($path)) {
$this->_path = $this->_oc->getQDir() . $this->imgname;
} else {
$this->_path = $path;
}
//mute this one because it can issue warnings if the original does not exist.
@$this->initImageSizes();
}
示例10: __construct
function __construct(&$context, $id = NULL)
{
//get the PhotoQ error stack for easy access
$this->_errStack =& PEAR_ErrorStack::singleton('PhotoQ');
$this->_db =& PhotoQSingleton::getInstance('PhotoQDB');
if (is_null($id)) {
//create a new empty BatchProcessor
//PhotoQHelper::debug('creating empty BatchProcessor');
$this->_batchSets = array();
$this->_totalSets = 0;
$this->_id = $id;
//no id yet
} else {
//load it from the database
//PhotoQHelper::debug('creating BatchProcessor no:' . $id);
$this->_context =& $context;
$this->load($id);
//PhotoQHelper::debug('sets from db: ' . print_r($this->_batchSets,true));
}
//at the end of script execution we need to make the batch persistent
//such that execution can go on in the next request
register_shutdown_function(array(&$this, '_makeBatchPersistent'));
}
示例11:
/**
* Returns the error-stack
*
* @static
* @access public
* @return object PEAR_ErrorStack error-stack
*/
function &getErrorStack()
{
return PEAR_ErrorStack::singleton('Date_Holidays', false, false, true);
}
示例12: error_reporting
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @package Piece_Unity
* @subpackage Piece_Unity_Component_KernelConfigurator
* @copyright 2006-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License (revised)
* @version SVN: $Id$
* @since File available since Release 1.0.0
*/
error_reporting(E_ALL);
if (file_exists(dirname(__FILE__) . '/../../../Piece/Unity.php')) {
set_include_path(realpath(dirname(__FILE__) . '/../../..') . PATH_SEPARATOR . get_include_path());
}
if (file_exists(dirname(__FILE__) . '/../Piece/Unity/Plugin/KernelConfigurator.php')) {
set_include_path(realpath(dirname(__FILE__) . '/..') . PATH_SEPARATOR . get_include_path());
}
require_once 'PEAR/ErrorStack.php';
PEAR_ErrorStack::setDefaultCallback(create_function('$error', 'var_dump($error); return ' . PEAR_ERRORSTACK_DIE . ';'));
/*
* Local Variables:
* mode: php
* coding: iso-8859-1
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* indent-tabs-mode: nil
* End:
*/
示例13: error
/**
*
* Pushes an error onto the PEAR_ErrorStack.
*
* @return void
*
*/
function error()
{
// push an error onto the stack
PEAR_ErrorStack::staticPush('Savant2', $this->code, null, $this->info, $this->text);
}
示例14: LiveUser_Perm_Storage
/**
* Constructor
*
* @access protected
* @param mixed configuration array
* @return void
*/
function LiveUser_Perm_Storage()
{
$this->_stack =& PEAR_ErrorStack::singleton('LiveUser');
}
示例15: fetchCommands
/**
* Scan through the SVN directory looking for subclasses.
*
* @return mixed array on success, false on failure
* @access public
*/
function fetchCommands()
{
$commands = array();
$dir = realpath(dirname(__FILE__)) . '/SVN';
$dp = @opendir($dir);
if (empty($dp)) {
PEAR_ErrorStack::staticPush('VersionControl_SVN', VERSIONCONTROL_SVN_ERROR, 'error', array('errstr' => "fetchCommands: opendir({$dir}) failed"));
return false;
}
while ($entry = readdir($dp)) {
if ($entry[0] == '.' || substr($entry, -4) != '.php') {
continue;
}
$commands[] = substr($entry, 0, -4);
}
closedir($dp);
return $commands;
}