本文整理汇总了PHP中PEAR_ErrorStack::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_ErrorStack::singleton方法的具体用法?PHP PEAR_ErrorStack::singleton怎么用?PHP PEAR_ErrorStack::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_ErrorStack
的用法示例。
在下文中一共展示了PEAR_ErrorStack::singleton方法的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: init
/**
* Initialize an object wrapper for a Subversion subcommand.
*
* @return mixed object on success, false on failure
* @access public
*/
function init($command, $options)
{
// Check for shortcuts for commands
$shortcuts = VersionControl_SVN::fetchShortcuts();
if (isset($options['shortcuts']) && is_array($options['shortcuts'])) {
foreach ($options['shortcuts'] as $key => $val) {
$shortcuts[strtolower($key)] = $val;
}
}
$cmd = isset($shortcuts[strtolower($command)]) ? $shortcuts[strtolower($command)] : $command;
$lowercmd = strtolower($cmd);
$cmd = ucfirst($lowercmd);
$class = 'VersionControl_SVN_' . $cmd;
if (include_once realpath(dirname(__FILE__)) . "/SVN/{$cmd}.php") {
if (class_exists($class)) {
$obj =& new $class();
$obj->options = $options;
$obj->_svn_cmd = $lowercmd;
$obj->_stack =& PEAR_ErrorStack::singleton('VersionControl_SVN');
$obj->_stack->setErrorMessageTemplate(VersionControl_SVN::declareErrorMessages());
$obj->setOptions($options);
return $obj;
}
}
PEAR_ErrorStack::staticPush('VersionControl_SVN', VERSIONCONTROL_SVN_ERROR_UNKNOWN_CMD, 'error', array('command' => $command, 'options' => $options));
return false;
}
示例12:
/**
* Returns the error-stack
*
* @static
* @access public
* @return object PEAR_ErrorStack error-stack
*/
function &getErrorStack()
{
return PEAR_ErrorStack::singleton('Date_Holidays', false, false, true);
}
示例13: LiveUser_Admin
/**
*
* @param bool|log boolean value to denote if the debug mode should be
enabled, or instance of a PEAR_ErrorStack compatible Log object
* @return LiveUser_Admin
*
* @access public
* @see init
*/
function LiveUser_Admin(&$debug)
{
$this->stack =& PEAR_ErrorStack::singleton('LiveUser_Admin');
if ($debug) {
$log =& LiveUser::PEARLogFactory($debug);
if ($log) {
$this->log =& $log;
$this->stack->setLogger($this->log);
}
}
$this->stack->setErrorMessageTemplate($this->_errorMessages);
}
示例14: LiveUser_Perm_Storage
/**
* Constructor
*
* @access protected
* @param mixed configuration array
* @return void
*/
function LiveUser_Perm_Storage()
{
$this->_stack =& PEAR_ErrorStack::singleton('LiveUser');
}
示例15: DocInfos
/**
* Constructeur DocInfos
*/
function DocInfos(&$db)
{
$this->db =& $db;
$this->errors =& PEAR_ErrorStack::singleton('OpenWeb::Backend::DocInfos');
}