本文整理汇总了PHP中CRM_Core_Error::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Error::debug方法的具体用法?PHP CRM_Core_Error::debug怎么用?PHP CRM_Core_Error::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Error
的用法示例。
在下文中一共展示了CRM_Core_Error::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read
static function read($name, &$menu)
{
$config =& CRM_Core_Config::singleton();
$xml = simplexml_load_file($name);
foreach ($xml->item as $item) {
//do not expose 'Access Control' link for Joomla, CRM-3550
if ($item->path == 'civicrm/admin/access' && $config->userFramework == 'Joomla') {
continue;
}
if (!(string) $item->path) {
CRM_Core_Error::debug('i', $item);
CRM_Core_Error::fatal();
}
$path = (string) $item->path;
$menu[$path] = array();
unset($item->path);
foreach ($item as $key => $value) {
$key = (string) $key;
$value = (string) $value;
if (strpos($key, '_callback') && strpos($value, '::')) {
$value = explode('::', $value);
} else {
if ($key == 'access_arguments') {
if (strpos($value, ',') || strpos($value, ';')) {
if (strpos($value, ',')) {
$elements = explode(',', $value);
$op = 'and';
} else {
$elements = explode(';', $element);
$op = 'or';
}
$items = array();
foreach ($elements as $element) {
$items[] = $element;
}
$value = array($items, $op);
} else {
$value = array(array($value), 'and');
}
} else {
if ($key == 'is_public' || $key == 'is_ssl') {
$value = $value == 'true' || $value == 1 ? 1 : 0;
}
}
}
$menu[$path][$key] = $value;
}
}
}
示例2: isConditionValid
/**
* Method to determine if the condition is valid
*
* @param CRM_Civirules_TriggerData_TriggerData $triggerData
* @return bool
*/
public function isConditionValid(CRM_Civirules_TriggerData_TriggerData $triggerData)
{
$isConditionValid = FALSE;
$membership = $triggerData->getEntityData('Membership');
CRM_Core_Error::debug('membership', $membership);
switch ($this->conditionParams['operator']) {
case 0:
if ($membership['status_id'] == $this->conditionParams['membership_status_id']) {
$isConditionValid = TRUE;
}
break;
case 1:
if ($membership['status_id'] != $this->conditionParams['membership_status_id']) {
$isConditionValid = TRUE;
}
break;
}
return $isConditionValid;
}
示例3: read
static function read($name, &$menu)
{
$config = CRM_Core_Config::singleton();
$xml = simplexml_load_file($name);
foreach ($xml->item as $item) {
if (!(string) $item->path) {
CRM_Core_Error::debug('i', $item);
CRM_Core_Error::fatal();
}
$path = (string) $item->path;
$menu[$path] = array();
unset($item->path);
foreach ($item as $key => $value) {
$key = (string) $key;
$value = (string) $value;
if (strpos($key, '_callback') && strpos($value, '::')) {
$value = explode('::', $value);
} elseif ($key == 'access_arguments') {
if (strpos($value, ',') || strpos($value, ';')) {
if (strpos($value, ',')) {
$elements = explode(',', $value);
$op = 'and';
} else {
$elements = explode(';', $value);
$op = 'or';
}
$items = array();
foreach ($elements as $element) {
$items[] = $element;
}
$value = array($items, $op);
} else {
$value = array(array($value), 'and');
}
} elseif ($key == 'is_public' || $key == 'is_ssl') {
$value = $value == 'true' || $value == 1 ? 1 : 0;
}
$menu[$path][$key] = $value;
}
}
}
示例4: checkConfig
/**
* This function checks to see if we have the right config values
*
* @return string the error message if any
* @public
*/
function checkConfig()
{
$config = CRM_Core_Config::singleton();
$error = array();
//Create database tables if they haven't been.
if (!CRM_Core_DAO::checkTableExists('civicrm_stripe_customers')) {
CRM_Core_DAO::executeQuery("\r\n\t\tCREATE TABLE IF NOT EXISTS `civicrm_stripe_customers` (\r\n \t\t\t`email` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,\r\n \t\t\t`id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\r\n \t\t\tUNIQUE KEY `email` (`email`)\r\n\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\r\n\t\t\t");
CRM_Core_DAO::executeQuery("\r\n\t\tCREATE TABLE IF NOT EXISTS `civicrm_stripe_plans` (\r\n \t\t\t`plan_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\r\n \t\t\tUNIQUE KEY `plan_id` (`plan_id`)\r\n\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\r\n\t\t");
CRM_Core_DAO::executeQuery("\r\n\t\tCREATE TABLE IF NOT EXISTS `civicrm_stripe_subscriptions` (\r\n\t\t\t`customer_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\r\n\t\t\t`invoice_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,\r\n\t\t\t`end_time` int(11) NOT NULL DEFAULT '0',\r\n\t\t\t`is_live` tinyint(4) NOT NULL COMMENT 'Whether this is a live or test transaction',\r\n\t\t\tKEY `end_time` (`end_time`)\r\n\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;\r\n\t\t");
CRM_Core_Error::debug('Stripe Database tables created. <br />This is the only time this message will be displayed. You do not need to take any further actions.');
}
if (empty($this->_paymentProcessor['user_name'])) {
$error[] = ts('The "Secret Key" is not set in the Stripe Payment Processor settings.');
}
if (empty($this->_paymentProcessor['password'])) {
$error[] = ts('The "Publishable Key" is not set in the Stripe Payment Processor settings.');
}
if (!empty($error)) {
return implode('<p>', $error);
} else {
return NULL;
}
}
示例5: CRM_Case_XMLProcessor_Report
<?php
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
require_once 'CRM/Core/Error.php';
$config = CRM_Core_Config::singleton();
require_once 'CRM/Case/XMLProcessor/Report.php';
$xmlProcessor = new CRM_Case_XMLProcessor_Report();
$report = $xmlProcessor->getActivityInfo(102, 552);
CRM_Core_Error::debug($report);
exit;
$xmlProcessor->run(104, 1, 'Substance Abuse', '15 Day Review');
$params = array('clientID' => 104, 'creatorID' => 108, 'standardTimeline' => 1, 'activityTypeName' => 'Open Case', 'dueDateTime' => time(), 'caseID' => 1);
require_once 'CRM/Case/XMLProcessor/Process.php';
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$result = $xmlProcessor->get('Substance Abuse', 'CaseRoles');
CRM_Core_Error::debug('Case Roles', $result);
$result = $xmlProcessor->get('Substance Abuse', 'ActivityTypes');
CRM_Core_Error::debug('Activity Types', $result);
$result = $xmlProcessor->get('Substance Abuse', 'ActivitySets');
CRM_Core_Error::debug('Activity Sets', $result);
$xmlProcessor->run('Substance Abuse', $params);
exit;
示例6: _invoke
protected static function _invoke($args)
{
if ($args[0] !== 'civicrm') {
return;
}
require_once 'CRM/Core/I18n.php';
$config = CRM_Core_Config::singleton();
if (isset($args[1]) and $args[1] == 'menu' and isset($args[2]) and $args[2] == 'rebuild') {
// ensure that the user has a good privilege level
if (CRM_Core_Permission::check('administer CiviCRM')) {
self::rebuildMenuAndCaches();
CRM_Core_Session::setStatus(ts('Menu has been rebuilt'));
return CRM_Utils_System::redirect();
} else {
CRM_Core_Error::fatal('You do not have permission to execute this url');
}
}
// first fire up IDS and check for bad stuff
if ($config->useIDS) {
$ids = new CRM_Core_IDS();
$ids->check($args);
}
// also initialize the i18n framework
$i18n = CRM_Core_I18n::singleton();
if ($config->userFramework == 'Standalone') {
$session = CRM_Core_Session::singleton();
if ($session->get('new_install') !== TRUE) {
CRM_Core_Standalone::sidebarLeft();
} elseif ($args[1] == 'standalone' && $args[2] == 'register') {
CRM_Core_Menu::store();
}
}
// get the menu items
$path = implode('/', $args);
$item = CRM_Core_Menu::get($path);
// we should try to compute menus, if item is empty and stay on the same page,
// rather than compute and redirect to dashboard.
if (!$item) {
CRM_Core_Menu::store(FALSE);
$item = CRM_Core_Menu::get($path);
}
if ($config->userFramework == 'Joomla' && $item) {
$config->userFrameworkURLVar = 'task';
// joomla 1.5RC1 seems to push this in the POST variable, which messes
// QF and checkboxes
unset($_POST['option']);
CRM_Core_Joomla::sidebarLeft();
}
// set active Component
$template = CRM_Core_Smarty::singleton();
$template->assign('activeComponent', 'CiviCRM');
$template->assign('formTpl', 'default');
if ($item) {
// CRM-7656 - make sure we send a clean sanitized path to create printer friendly url
$printerFriendly = CRM_Utils_System::makeURL('snippet', FALSE, FALSE, CRM_Utils_Array::value('path', $item)) . '2';
$template->assign('printerFriendly', $printerFriendly);
if (!array_key_exists('page_callback', $item)) {
CRM_Core_Error::debug('Bad item', $item);
CRM_Core_Error::fatal(ts('Bad menu record in database'));
}
// check that we are permissioned to access this page
if (!CRM_Core_Permission::checkMenuItem($item)) {
CRM_Utils_System::permissionDenied();
return;
}
// check if ssl is set
if (CRM_Utils_Array::value('is_ssl', $item)) {
CRM_Utils_System::redirectToSSL();
}
if (isset($item['title'])) {
CRM_Utils_System::setTitle($item['title']);
}
if (isset($item['breadcrumb']) && !isset($item['is_public'])) {
CRM_Utils_System::appendBreadCrumb($item['breadcrumb']);
}
$pageArgs = NULL;
if (CRM_Utils_Array::value('page_arguments', $item)) {
$pageArgs = CRM_Core_Menu::getArrayForPathArgs($item['page_arguments']);
}
$template = CRM_Core_Smarty::singleton();
if (isset($item['is_public']) && $item['is_public']) {
$template->assign('urlIsPublic', TRUE);
} else {
$template->assign('urlIsPublic', FALSE);
}
if (isset($item['return_url'])) {
$session = CRM_Core_Session::singleton();
$args = CRM_Utils_Array::value('return_url_args', $item, 'reset=1');
$session->pushUserContext(CRM_Utils_System::url($item['return_url'], $args));
}
// CRM_Core_Error::debug( $item ); exit( );
$result = NULL;
if (is_array($item['page_callback'])) {
$newArgs = explode('/', $_GET[$config->userFrameworkURLVar]);
require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback'][0]) . '.php';
$result = call_user_func($item['page_callback'], $newArgs);
} elseif (strstr($item['page_callback'], '_Form')) {
$wrapper = new CRM_Utils_Wrapper();
$result = $wrapper->run(CRM_Utils_Array::value('page_callback', $item), CRM_Utils_Array::value('title', $item), isset($pageArgs) ? $pageArgs : NULL);
} else {
//.........这里部分代码省略.........
示例7: set
/**
* @param $key
* @param $value
*
* @return bool
* @throws Exception
*/
public function set($key, &$value)
{
if (!$this->_cache->set($this->_prefix . $key, serialize($value), $this->_timeout)) {
CRM_Core_Error::debug('Result Code: ', $this->_cache->getResultMessage());
CRM_Core_Error::fatal("Redis set failed, wondering why?, {$key}", $value);
return FALSE;
}
return TRUE;
}
示例8: define
<?php
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
require_once 'CRM/Utils/Cache.php';
define('CIVICRM_USE_MEMCACHE', 1);
$config =& CRM_Core_Config::singleton();
$cache =& CRM_Utils_Cache::singleton();
$cache->set('CRM_Core_Config' . CRM_Core_Config::domainID(), $config);
CRM_Core_Error::debug('get', $cache->get('CRM_Core_Config' . CRM_Core_Config::domainID()));
示例9: read
/**
* @param string $name
* @param $menu
*
* @throws Exception
*/
public static function read($name, &$menu)
{
$config = CRM_Core_Config::singleton();
$xml = simplexml_load_file($name);
foreach ($xml->item as $item) {
if (!(string) $item->path) {
CRM_Core_Error::debug('i', $item);
CRM_Core_Error::fatal();
}
$path = (string) $item->path;
$menu[$path] = array();
unset($item->path);
foreach ($item as $key => $value) {
$key = (string) $key;
$value = (string) $value;
if (strpos($key, '_callback') && strpos($value, '::')) {
// FIXME Remove the rewrite at this level. Instead, change downstream call_user_func*($value)
// to call_user_func*(Civi\Core\Resolver::singleton()->get($value)).
$value = explode('::', $value);
} elseif ($key == 'access_arguments') {
// FIXME Move the permission parser to its own class (or *maybe* CRM_Core_Permission).
if (strpos($value, ',') || strpos($value, ';')) {
if (strpos($value, ',')) {
$elements = explode(',', $value);
$op = 'and';
} else {
$elements = explode(';', $value);
$op = 'or';
}
$items = array();
foreach ($elements as $element) {
$items[] = $element;
}
$value = array($items, $op);
} else {
$value = array(array($value), 'and');
}
} elseif ($key == 'is_public' || $key == 'is_ssl') {
$value = $value == 'true' || $value == 1 ? 1 : 0;
}
$menu[$path][$key] = $value;
}
}
}
示例10: invoke
/**
* This is the main function that is called on every click action and based on the argument
* respective functions are called
*
* @param $args array this array contains the arguments of the url
*
* @static
* @access public
*/
static function invoke($args)
{
require_once 'CRM/Core/I18n.php';
require_once 'CRM/Utils/Wrapper.php';
require_once 'CRM/Core/Action.php';
require_once 'CRM/Utils/Request.php';
require_once 'CRM/Core/Menu.php';
require_once 'CRM/Core/Component.php';
require_once 'CRM/Core/Permission.php';
if ($args[0] !== 'civicrm') {
return;
}
if (isset($args[1]) and $args[1] == 'menu' and isset($args[2]) and $args[2] == 'rebuild') {
CRM_Core_Menu::store();
CRM_Core_Session::setStatus(ts('Menu has been rebuilt'));
// also reset navigation
require_once 'CRM/Core/BAO/Navigation.php';
CRM_Core_BAO_Navigation::resetNavigation();
return CRM_Utils_System::redirect();
}
// first fire up IDS and check for bad stuff
require_once 'CRM/Core/IDS.php';
$ids = new CRM_Core_IDS();
$ids->check($args);
$config =& CRM_Core_Config::singleton();
// also initialize the i18n framework
$i18n =& CRM_Core_I18n::singleton();
if ($config->userFramework == 'Standalone') {
require_once 'CRM/Core/Session.php';
$session =& CRM_Core_Session::singleton();
if ($session->get('new_install') !== true) {
require_once 'CRM/Core/Standalone.php';
CRM_Core_Standalone::sidebarLeft();
} else {
if ($args[1] == 'standalone' && $args[2] == 'register') {
CRM_Core_Menu::store();
}
}
}
// get the menu items
$path = implode('/', $args);
$item =& CRM_Core_Menu::get($path);
// we should try to compute menus, if item is empty and stay on the same page,
// rather than compute and redirect to dashboard.
if (!$item) {
CRM_Core_Menu::store(false);
$item =& CRM_Core_Menu::get($path);
}
if ($config->userFramework == 'Joomla' && $item) {
$config->userFrameworkURLVar = 'task';
require_once 'CRM/Core/Joomla.php';
// joomla 1.5RC1 seems to push this in the POST variable, which messes
// QF and checkboxes
unset($_POST['option']);
CRM_Core_Joomla::sidebarLeft();
}
// set active Component
$template =& CRM_Core_Smarty::singleton();
$template->assign('activeComponent', 'CiviCRM');
$template->assign('formTpl', 'default');
if ($item) {
if (!array_key_exists('page_callback', $item)) {
CRM_Core_Error::debug('Bad item', $item);
CRM_Core_Error::fatal(ts('Bad menu record in database'));
}
// check that we are permissioned to access this page
if (!CRM_Core_Permission::checkMenuItem($item)) {
CRM_Utils_System::permissionDenied();
return;
}
// check if ssl is set
if (CRM_Utils_Array::value('is_ssl', $item)) {
CRM_Utils_System::redirectToSSL();
}
if (isset($item['title'])) {
CRM_Utils_System::setTitle($item['title']);
}
if (isset($item['breadcrumb']) && !isset($item['is_public'])) {
CRM_Utils_System::appendBreadCrumb($item['breadcrumb']);
}
$pageArgs = null;
if (CRM_Utils_Array::value('page_arguments', $item)) {
$pageArgs = CRM_Core_Menu::getArrayForPathArgs($item['page_arguments']);
}
$template =& CRM_Core_Smarty::singleton();
if (isset($item['is_public']) && $item['is_public']) {
$template->assign('urlIsPublic', true);
} else {
$template->assign('urlIsPublic', false);
}
if (isset($item['return_url'])) {
//.........这里部分代码省略.........
示例11: backtrace
/**
* @param string $msg
* @param bool $log
*/
public static function backtrace($msg = 'backTrace', $log = FALSE)
{
$backTrace = debug_backtrace();
$message = self::formatBacktrace($backTrace);
if (!$log) {
CRM_Core_Error::debug($msg, $message);
} else {
CRM_Core_Error::debug_var($msg, $message);
}
}
示例12: postProcess
/**
* Mostly overriding this for ease of adding in debug.
*/
function postProcess() {
try {
if (!empty($this->_aclTable) && CRM_Utils_Array::value($this->_aclTable, $this->_aliases)) {
$this->buildACLClause($this->_aliases[$this->_aclTable]);
}
$this->beginPostProcess();
$sql = $this->buildQuery();
$this->reOrderColumnHeaders();
// build array of result based on column headers. This method also allows
// modifying column headers before using it to build result set i.e $rows.
$rows = array();
$this->buildRows($sql, $rows);
$this->addDeveloperTab($sql);
$this->addAggregatePercentRow($rows);
// format result set.
$this->formatDisplay($rows);
// assign variables to templates
$this->doTemplateAssignment($rows);
// do print / pdf / instance stuff if needed
$this->endPostProcess($rows);
} catch (Exception $e) {
$err['message'] = $e->getMessage();
$err['trace'] = $e->getTrace();
foreach ($err['trace'] as $fn) {
if ($fn['function'] == 'raiseError') {
foreach ($fn['args'] as $arg) {
$err['sql_error'] = $arg;
}
}
if ($fn['function'] == 'simpleQuery') {
foreach ($fn['args'] as $arg) {
$err['sql_query'] = $arg;
}
}
}
if (function_exists('dpm')) {
dpm($err);
dpm($this->_columns);;
}
else {
CRM_Core_Error::debug($err);
}
}
}
示例13: download
/**
* Download the remote zipfile.
*
* @return boolean Whether the download was successful.
*/
public function download()
{
require_once 'CA/Config/Curl.php';
$config = CRM_Core_Config::singleton();
$path = $config->extensionsDir . DIRECTORY_SEPARATOR . 'tmp';
$filename = $path . DIRECTORY_SEPARATOR . $this->key . '.zip';
if (!$this->downloadUrl) {
CRM_Core_Error::fatal('Cannot install this extension - downloadUrl is not set!');
}
// Download extension zip file ...
if (!function_exists('curl_init')) {
CRM_Core_Error::fatal('Cannot install this extension - curl is not installed!');
}
if (preg_match('/^https:/', $this->downloadUrl) && !CA_Config_Curl::singleton()->isEnableSSL()) {
CRM_Core_Error::fatal('Cannot install this extension - does not support SSL');
}
//setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->downloadUrl);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
if (preg_match('/^https:/', $this->downloadUrl)) {
curl_setopt_array($ch, CA_Config_Curl::singleton()->toCurlOptions());
}
//follow redirects
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$fp = fopen($filename, "w");
if (!$fp) {
CRM_Core_Session::setStatus(ts('Unable to write to %1.<br />Is the location writable?', array(1 => $filename)));
return;
}
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
if (curl_errno($ch)) {
CRM_Core_Error::debug(curl_error($ch));
CRM_Core_Error::debug(curl_errno($ch));
exit;
CRM_Core_Session::setStatus(ts('Unable to download extension from %1. Error Message: %2', array(1 => $this->downloadUrl, 2 => curl_error($ch))));
return;
} else {
curl_close($ch);
}
fclose($fp);
$this->tmpFile = $filename;
return TRUE;
}
示例14: debug
/**
* dumps the session to the log
*/
function debug($all = 1)
{
if ($all != 1) {
CRM_Core_Error::debug('CRM Session', $this->_session);
} else {
CRM_Core_Error::debug('CRM Session', $this->_session[$this->_key]);
}
}
示例15: postProcess
public function postProcess()
{
$this->_params = $this->controller->exportValues($this->_name);
CRM_Core_Error::debug($this->_params);
CRM_Utils_System::civiExit();
}