当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_Config::isUpgradeMode方法代码示例

本文整理汇总了PHP中CRM_Core_Config::isUpgradeMode方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Config::isUpgradeMode方法的具体用法?PHP CRM_Core_Config::isUpgradeMode怎么用?PHP CRM_Core_Config::isUpgradeMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_Config的用法示例。


在下文中一共展示了CRM_Core_Config::isUpgradeMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_function_crmNavigationMenu

/**
 * Output navigation script tag
 *
 * @param array $params
 *   - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
 * @param object $smarty the Smarty object
 *
 * @return string HTML
 */
function smarty_function_crmNavigationMenu($params, &$smarty)
{
    $config = CRM_Core_Config::singleton();
    //check if logged in user has access CiviCRM permission and build menu
    $buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
    if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
        $buildNavigation = FALSE;
    }
    if ($config->userFrameworkFrontend) {
        $buildNavigation = FALSE;
    }
    if ($buildNavigation) {
        $session = CRM_Core_Session::singleton();
        $contactID = $session->get('userID');
        if ($contactID) {
            // These params force the browser to refresh the js file when switching user, domain, or language
            // We don't put them as a query string because some browsers will refuse to cache a page with a ? in the url
            // We end the string with .js to trick apache mods into sending pro-caching headers
            // @see CRM_Admin_Page_AJAX::getNavigationMenu
            $lang = $config->lcMessages;
            $domain = CRM_Core_Config::domainID();
            $key = CRM_Core_BAO_Navigation::getCacheKey($contactID);
            $src = CRM_Utils_System::url("civicrm/ajax/menujs/{$contactID}/{$lang}/{$domain}/{$key}.js");
            return '<script type="text/javascript" src="' . $src . '"></script>';
        }
    }
    return '';
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:37,代码来源:function.crmNavigationMenu.php

示例2: smarty_function_crmNavigationMenu

/**
 * Output navigation script tag
 *
 * @param array $params
 *   - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
 * @param CRM_Core_Smarty $smarty
 *   The Smarty object.
 *
 * @return string
 *   HTML
 */
function smarty_function_crmNavigationMenu($params, &$smarty)
{
    $config = CRM_Core_Config::singleton();
    //check if logged in user has access CiviCRM permission and build menu
    $buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
    if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
        $buildNavigation = FALSE;
    }
    if ($config->userFrameworkFrontend) {
        $buildNavigation = FALSE;
    }
    if ($buildNavigation) {
        $session = CRM_Core_Session::singleton();
        $contactID = $session->get('userID');
        if ($contactID) {
            // These params force the browser to refresh the js file when switching user, domain, or language
            // We don't put them as a query string because some browsers will refuse to cache a page with a ? in the url
            // @see CRM_Admin_Page_AJAX::getNavigationMenu
            $lang = $config->lcMessages;
            $domain = CRM_Core_Config::domainID();
            $key = CRM_Core_BAO_Navigation::getCacheKey($contactID);
            $src = CRM_Utils_System::url("civicrm/ajax/menujs/{$contactID}/{$lang}/{$domain}/{$key}");
            // CRM-15493 QFkey needed for quicksearch bar - must be unique on each page refresh so adding it directly to markup
            $qfKey = CRM_Core_Key::get('CRM_Contact_Controller_Search', TRUE);
            return '<script id="civicrm-navigation-menu" type="text/javascript" src="' . $src . '" data-qfkey=' . json_encode($qfKey) . '></script>';
        }
    }
    return '';
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:40,代码来源:function.crmNavigationMenu.php

示例3: smarty_function_crmNavigationMenu

/**
 * Generate the nav menu
 *
 * @param array $params
 *   - is_default: bool, true if this is normal/default instance of the menu (which may be subject to CIVICRM_DISABLE_DEFAULT_MENU)
 * @param object $smarty the Smarty object
 *
 * @return string HTML
 */
function smarty_function_crmNavigationMenu($params, &$smarty)
{
    //check if logged in user has access CiviCRM permission and build menu
    $buildNavigation = !CRM_Core_Config::isUpgradeMode() && CRM_Core_Permission::check('access CiviCRM');
    if (defined('CIVICRM_DISABLE_DEFAULT_MENU') && CRM_Utils_Array::value('is_default', $params, FALSE)) {
        $buildNavigation = FALSE;
    }
    if ($buildNavigation) {
        $session = CRM_Core_Session::singleton();
        $contactID = $session->get('userID');
        if ($contactID) {
            $navigation = CRM_Core_BAO_Navigation::createNavigation($contactID);
            $smarty->assign('navigation', $navigation);
            return $smarty->fetch('CRM/common/Navigation.tpl');
        }
    }
    return '';
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:27,代码来源:function.crmNavigationMenu.php

示例4: retrieve

 /**
  * Retrieve the settings values from db.
  *
  * @param $defaults
  *
  * @return array
  */
 public static function retrieve(&$defaults)
 {
     $domain = new CRM_Core_DAO_Domain();
     //we are initializing config, really can't use, CRM-7863
     $urlVar = 'q';
     if (defined('CIVICRM_UF') && CIVICRM_UF == 'Joomla') {
         $urlVar = 'task';
     }
     if (CRM_Core_Config::isUpgradeMode()) {
         $domain->selectAdd('config_backend');
     } elseif (CRM_Utils_Array::value($urlVar, $_GET) == 'admin/modules/list/confirm') {
         $domain->selectAdd('config_backend', 'locales');
     } else {
         $domain->selectAdd('config_backend, locales, locale_custom_strings');
     }
     $domain->id = CRM_Core_Config::domainID();
     $domain->find(TRUE);
     if ($domain->config_backend) {
         $defaults = unserialize($domain->config_backend);
         if ($defaults === FALSE || !is_array($defaults)) {
             $defaults = array();
             return FALSE;
         }
         $skipVars = self::skipVars();
         foreach ($skipVars as $skip) {
             if (array_key_exists($skip, $defaults)) {
                 unset($defaults[$skip]);
             }
         }
         // check if there are any locale strings
         if ($domain->locale_custom_strings) {
             $defaults['localeCustomStrings'] = unserialize($domain->locale_custom_strings);
         } else {
             $defaults['localeCustomStrings'] = NULL;
         }
         // are we in a multi-language setup?
         $multiLang = $domain->locales ? TRUE : FALSE;
         // set the current language
         $lcMessages = NULL;
         $session = CRM_Core_Session::singleton();
         // on multi-lang sites based on request and civicrm_uf_match
         if ($multiLang) {
             $lcMessagesRequest = CRM_Utils_Request::retrieve('lcMessages', 'String', $this);
             $languageLimit = array();
             if (array_key_exists('languageLimit', $defaults) && is_array($defaults['languageLimit'])) {
                 $languageLimit = $defaults['languageLimit'];
             }
             if (in_array($lcMessagesRequest, array_keys($languageLimit))) {
                 $lcMessages = $lcMessagesRequest;
                 //CRM-8559, cache navigation do not respect locale if it is changed, so reseting cache.
                 CRM_Core_BAO_Cache::deleteGroup('navigation');
             } else {
                 $lcMessagesRequest = NULL;
             }
             if (!$lcMessagesRequest) {
                 $lcMessagesSession = $session->get('lcMessages');
                 if (in_array($lcMessagesSession, array_keys($languageLimit))) {
                     $lcMessages = $lcMessagesSession;
                 } else {
                     $lcMessagesSession = NULL;
                 }
             }
             if ($lcMessagesRequest) {
                 $ufm = new CRM_Core_DAO_UFMatch();
                 $ufm->contact_id = $session->get('userID');
                 if ($ufm->find(TRUE)) {
                     $ufm->language = $lcMessages;
                     $ufm->save();
                 }
                 $session->set('lcMessages', $lcMessages);
             }
             if (!$lcMessages and $session->get('userID')) {
                 $ufm = new CRM_Core_DAO_UFMatch();
                 $ufm->contact_id = $session->get('userID');
                 if ($ufm->find(TRUE) && in_array($ufm->language, array_keys($languageLimit))) {
                     $lcMessages = $ufm->language;
                 }
                 $session->set('lcMessages', $lcMessages);
             }
         }
         global $dbLocale;
         // try to inherit the language from the hosting CMS
         if (!empty($defaults['inheritLocale'])) {
             // FIXME: On multilanguage installs, CRM_Utils_System::getUFLocale() in many cases returns nothing if $dbLocale is not set
             $dbLocale = $multiLang ? "_{$defaults['lcMessages']}" : '';
             $lcMessages = CRM_Utils_System::getUFLocale();
             if ($domain->locales and !in_array($lcMessages, explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales))) {
                 $lcMessages = NULL;
             }
         }
         if (empty($lcMessages)) {
             //CRM-11993 - if a single-lang site, use default
             $lcMessages = CRM_Utils_Array::value('lcMessages', $defaults);
//.........这里部分代码省略.........
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:101,代码来源:ConfigSetting.php

示例5: retrieveDirectoryAndURLPreferences

 static function retrieveDirectoryAndURLPreferences(&$params, $setInConfig = FALSE)
 {
     if ($setInConfig) {
         $config = CRM_Core_Config::singleton();
     }
     $isJoomla = defined('CIVICRM_UF') && CIVICRM_UF == 'Joomla' ? TRUE : FALSE;
     if (CRM_Core_Config::isUpgradeMode() && !$isJoomla) {
         $currentVer = CRM_Core_BAO_Domain::version();
         if (version_compare($currentVer, '4.1.alpha1') < 0) {
             return;
         }
     }
     $sql = "\nSELECT name, group_name, value\nFROM   civicrm_setting\nWHERE  ( group_name = %1\nOR       group_name = %2 )\nAND domain_id = %3\n";
     $sqlParams = array(1 => array(self::DIRECTORY_PREFERENCES_NAME, 'String'), 2 => array(self::URL_PREFERENCES_NAME, 'String'), 3 => array(CRM_Core_Config::domainID(), 'Integer'));
     $dao = CRM_Core_DAO::executeQuery($sql, $sqlParams, TRUE, NULL, FALSE, TRUE, TRUE);
     if (is_a($dao, 'DB_Error')) {
         if (CRM_Core_Config::isUpgradeMode()) {
             // seems like this is a 4.0 -> 4.1 upgrade, so we suppress this error and continue
             // hack to set the resource base url so that js/ css etc is loaded correctly
             if ($isJoomla) {
                 $params['userFrameworkResourceURL'] = CRM_Utils_File::addTrailingSlash(CIVICRM_UF_BASEURL, '/') . str_replace('administrator', '', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', 'userFrameworkResourceURL', 'value', 'name'));
             }
             return;
         } else {
             echo "Fatal DB error, exiting, seems like your schema does not have civicrm_setting table\n";
             exit;
         }
     }
     while ($dao->fetch()) {
         $value = self::getOverride($dao->group_name, $dao->name, NULL);
         if ($value === NULL && $dao->value) {
             $value = unserialize($dao->value);
             if ($dao->group_name == self::DIRECTORY_PREFERENCES_NAME) {
                 $value = CRM_Utils_File::absoluteDirectory($value);
             } else {
                 // CRM-7622: we need to remove the language part
                 $value = CRM_Utils_System::absoluteURL($value, TRUE);
             }
         }
         // CRM-10931, If DB doesn't have any value, carry on with any default value thats already available
         if (!isset($value) && CRM_Utils_Array::value($dao->name, $params)) {
             $value = $params[$dao->name];
         }
         $params[$dao->name] = $value;
         if ($setInConfig) {
             $config->{$dao->name} = $value;
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:49,代码来源:Setting.php

示例6: versionCheck

 /**
  * Show the message about CiviCRM versions
  *
  * @param obj: $template (reference)
  */
 static function versionCheck($template)
 {
     if (CRM_Core_Config::isUpgradeMode()) {
         return;
     }
     $versionCheck = CRM_Utils_VersionCheck::singleton();
     $newerVersion = $versionCheck->newerVersion();
     $template->assign('newer_civicrm_version', $newerVersion);
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:14,代码来源:Invoke.php

示例7: reportException

 /**
  * Print an unhandled exception
  *
  * @param $e
  */
 function reportException(Exception $e)
 {
     CRM_Core_Error::debug_var('CRM_Queue_ErrorPolicy_reportException', CRM_Core_Error::formatTextException($e));
     $response = array('is_error' => 1, 'is_continue' => 0);
     $config = CRM_Core_Config::singleton();
     if ($config->backtrace || CRM_Core_Config::isUpgradeMode()) {
         $response['exception'] = CRM_Core_Error::formatHtmlException($e);
     } else {
         $response['exception'] = htmlentities($e->getMessage());
     }
     global $activeQueueRunner;
     if (is_object($activeQueueRunner)) {
         $response['last_task_title'] = $activeQueueRunner->lastTaskTitle;
     }
     CRM_Utils_JSON::output($response);
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:21,代码来源:ErrorPolicy.php

示例8: singleton

 /**
  * Get or set the single instance of CRM_Core_Resources.
  *
  * @param CRM_Core_Resources $instance
  *   New copy of the manager.
  * @return CRM_Core_Resources
  */
 public static function singleton(CRM_Core_Resources $instance = NULL)
 {
     if ($instance !== NULL) {
         self::$_singleton = $instance;
     }
     if (self::$_singleton === NULL) {
         $sys = CRM_Extension_System::singleton();
         $cache = new CRM_Utils_Cache_SqlGroup(array('group' => 'js-strings', 'prefetch' => FALSE));
         self::$_singleton = new CRM_Core_Resources($sys->getMapper(), $cache, CRM_Core_Config::isUpgradeMode() ? NULL : 'resCacheCode');
     }
     return self::$_singleton;
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:19,代码来源:Resources.php

示例9: isUpgradeFromPreFourOneAlpha1

 /**
  * Civicrm_setting didn't exist before 4.1.alpha1 and this function helps taking decisions during upgrade
  *
  * @return bool
  */
 public static function isUpgradeFromPreFourOneAlpha1()
 {
     if (CRM_Core_Config::isUpgradeMode()) {
         $currentVer = CRM_Core_BAO_Domain::version();
         if (version_compare($currentVer, '4.1.alpha1') < 0) {
             return TRUE;
         }
     }
     return FALSE;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:15,代码来源:Setting.php

示例10: getModuleUFGroup

 /**
  * Get the uf group for a module.
  *
  * @param string $moduleName
  *   Module name.
  * @param int $count
  *   No to increment the weight.
  * @param bool $skipPermission
  * @param int $op
  *   Which operation (view, edit, create, etc) to check permission for.
  * @param array|NULL $returnFields list of UFGroup fields to return; NULL for default
  *
  * @return array
  *   array of ufgroups for a module
  */
 public static function getModuleUFGroup($moduleName = NULL, $count = 0, $skipPermission = TRUE, $op = CRM_Core_Permission::VIEW, $returnFields = NULL)
 {
     $selectFields = array('id', 'title', 'created_id', 'is_active', 'is_reserved', 'group_type');
     if (!CRM_Core_Config::isUpgradeMode()) {
         // CRM-13555, since description field was added later (4.4), and to avoid any problems with upgrade
         $selectFields[] = 'description';
     }
     if (!empty($returnFields)) {
         $selectFields = array_merge($returnFields, array_diff($selectFields, $returnFields));
     }
     $queryString = 'SELECT civicrm_uf_group.' . implode(', civicrm_uf_group.', $selectFields) . '
                     FROM civicrm_uf_group
                     LEFT JOIN civicrm_uf_join ON (civicrm_uf_group.id = uf_group_id)';
     $p = array();
     if ($moduleName) {
         $queryString .= ' AND civicrm_uf_group.is_active = 1
                           WHERE civicrm_uf_join.module = %2';
         $p[2] = array($moduleName, 'String');
     }
     // add permissioning for profiles only if not registration
     if (!$skipPermission) {
         $permissionClause = CRM_Core_Permission::ufGroupClause($op, 'civicrm_uf_group.');
         if (strpos($queryString, 'WHERE') !== FALSE) {
             $queryString .= " AND {$permissionClause} ";
         } else {
             $queryString .= " {$permissionClause} ";
         }
     }
     $queryString .= ' ORDER BY civicrm_uf_join.weight, civicrm_uf_group.title';
     $dao = CRM_Core_DAO::executeQuery($queryString, $p);
     $ufGroups = array();
     while ($dao->fetch()) {
         //skip mix profiles in user Registration / User Account
         if (($moduleName == 'User Registration' || $moduleName == 'User Account') && CRM_Core_BAO_UFField::checkProfileType($dao->id)) {
             continue;
         }
         foreach ($selectFields as $key => $field) {
             if ($field == 'id') {
                 continue;
             }
             $ufGroups[$dao->id][$field] = $dao->{$field};
         }
     }
     // Allow other modules to alter/override the UFGroups.
     CRM_Utils_Hook::buildUFGroupsForModule($moduleName, $ufGroups);
     return $ufGroups;
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:62,代码来源:UFGroup.php

示例11: initialize

 private function initialize()
 {
     $config = CRM_Core_Config::singleton();
     if (isset($config->customTemplateDir) && $config->customTemplateDir) {
         $this->template_dir = array_merge(array($config->customTemplateDir), $config->templateDir);
     } else {
         $this->template_dir = $config->templateDir;
     }
     $this->compile_dir = $config->templateCompileDir;
     // check and ensure it is writable
     // else we sometime suppress errors quietly and this results
     // in blank emails etc
     if (!is_writable($this->compile_dir)) {
         echo "CiviCRM does not have permission to write temp files in {$this->compile_dir}, Exiting";
         exit;
     }
     //Check for safe mode CRM-2207
     if (ini_get('safe_mode')) {
         $this->use_sub_dirs = FALSE;
     } else {
         $this->use_sub_dirs = TRUE;
     }
     $customPluginsDir = NULL;
     if (isset($config->customPHPPathDir)) {
         $customPluginsDir = $config->customPHPPathDir . DIRECTORY_SEPARATOR . 'CRM' . DIRECTORY_SEPARATOR . 'Core' . DIRECTORY_SEPARATOR . 'Smarty' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR;
         if (!file_exists($customPluginsDir)) {
             $customPluginsDir = NULL;
         }
     }
     if ($customPluginsDir) {
         $this->plugins_dir = array($customPluginsDir, $config->smartyDir . 'plugins', $config->pluginsDir);
     } else {
         $this->plugins_dir = array($config->smartyDir . 'plugins', $config->pluginsDir);
     }
     // add the session and the config here
     $session = CRM_Core_Session::singleton();
     $this->assign_by_ref('config', $config);
     $this->assign_by_ref('session', $session);
     // check default editor and assign to template
     $defaultWysiwygEditor = $session->get('defaultWysiwygEditor');
     if (!$defaultWysiwygEditor && !CRM_Core_Config::isUpgradeMode()) {
         $defaultWysiwygEditor = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id');
         // For logged-in users, store it in session to reduce db calls
         if ($session->get('userID')) {
             $session->set('defaultWysiwygEditor', $defaultWysiwygEditor);
         }
     }
     $this->assign('defaultWysiwygEditor', $defaultWysiwygEditor);
     global $tsLocale;
     $this->assign('tsLocale', $tsLocale);
     // CRM-7163 hack: we don’t display langSwitch on upgrades anyway
     if (!CRM_Core_Config::isUpgradeMode()) {
         $this->assign('langSwitch', CRM_Core_I18n::languages(TRUE));
     }
     $this->register_function('crmURL', array('CRM_Utils_System', 'crmURL'));
     $this->load_filter('pre', 'resetExtScope');
     $this->assign('crmPermissions', new CRM_Core_Smarty_Permissions());
 }
开发者ID:kidaa30,项目名称:yes,代码行数:58,代码来源:Smarty.php

示例12: triggerInfo

 static function triggerInfo(&$info, $tableName = NULL)
 {
     // get the current supported locales
     $domain = new CRM_Core_DAO_Domain();
     $domain->find(TRUE);
     if (empty($domain->locales)) {
         return;
     }
     $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
     $locale = array_pop($locales);
     // CRM-10027
     if (count($locales) == 0) {
         return;
     }
     $currentVer = CRM_Core_BAO_Domain::version(TRUE);
     if ($currentVer && CRM_Core_Config::isUpgradeMode()) {
         // take exact version so that proper schema structure file in invoked
         $latest = self::getLatestSchema($currentVer);
         require_once "CRM/Core/I18n/SchemaStructure_{$latest}.php";
         $class = "CRM_Core_I18n_SchemaStructure_{$latest}";
     } else {
         $class = 'CRM_Core_I18n_SchemaStructure';
     }
     $columns =& $class::columns();
     foreach ($columns as $table => $hash) {
         if ($tableName && $tableName != $table) {
             continue;
         }
         $trigger = array();
         foreach ($hash as $column => $_) {
             $trigger[] = "IF NEW.{$column}_{$locale} IS NOT NULL THEN";
             foreach ($locales as $old) {
                 $trigger[] = "IF NEW.{$column}_{$old} IS NULL THEN SET NEW.{$column}_{$old} = NEW.{$column}_{$locale}; END IF;";
             }
             foreach ($locales as $old) {
                 $trigger[] = "ELSEIF NEW.{$column}_{$old} IS NOT NULL THEN";
                 foreach (array_merge($locales, array($locale)) as $loc) {
                     if ($loc == $old) {
                         continue;
                     }
                     $trigger[] = "IF NEW.{$column}_{$loc} IS NULL THEN SET NEW.{$column}_{$loc} = NEW.{$column}_{$old}; END IF;";
                 }
             }
             $trigger[] = 'END IF;';
         }
         $sql = implode(' ', $trigger);
         $info[] = array('table' => array($table), 'when' => 'BEFORE', 'event' => array('UPDATE'), 'sql' => $sql);
     }
     // take care of the ON INSERT triggers
     foreach ($columns as $table => $hash) {
         $trigger = array();
         foreach ($hash as $column => $_) {
             $trigger[] = "IF NEW.{$column}_{$locale} IS NOT NULL THEN";
             foreach ($locales as $old) {
                 $trigger[] = "SET NEW.{$column}_{$old} = NEW.{$column}_{$locale};";
             }
             foreach ($locales as $old) {
                 $trigger[] = "ELSEIF NEW.{$column}_{$old} IS NOT NULL THEN";
                 foreach (array_merge($locales, array($locale)) as $loc) {
                     if ($loc == $old) {
                         continue;
                     }
                     $trigger[] = "SET NEW.{$column}_{$loc} = NEW.{$column}_{$old};";
                 }
             }
             $trigger[] = 'END IF;';
         }
         $sql = implode(' ', $trigger);
         $info[] = array('table' => array($table), 'when' => 'BEFORE', 'event' => array('INSERT'), 'sql' => $sql);
     }
 }
开发者ID:hguru,项目名称:224Civi,代码行数:71,代码来源:Schema.php

示例13: retrieve

 /**
  * Retrieve the settings values from db.
  *
  * @param $defaults
  *
  * @return array
  */
 public static function retrieve(&$defaults)
 {
     $domain = new CRM_Core_DAO_Domain();
     //we are initializing config, really can't use, CRM-7863
     $urlVar = 'q';
     if (defined('CIVICRM_UF') && CIVICRM_UF == 'Joomla') {
         $urlVar = 'task';
     }
     if (CRM_Core_Config::isUpgradeMode()) {
         $domain->selectAdd('config_backend');
     } else {
         $domain->selectAdd('config_backend, locales');
     }
     $domain->id = CRM_Core_Config::domainID();
     $domain->find(TRUE);
     if ($domain->config_backend) {
         $defaults = unserialize($domain->config_backend);
         if ($defaults === FALSE || !is_array($defaults)) {
             $defaults = array();
             return FALSE;
         }
         $skipVars = self::skipVars();
         foreach ($skipVars as $skip) {
             if (array_key_exists($skip, $defaults)) {
                 unset($defaults[$skip]);
             }
         }
         CRM_Core_BAO_ConfigSetting::applyLocale(Civi::settings($domain->id), $domain->locales);
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:37,代码来源:ConfigSetting.php

示例14: versionCheck

 /**
  * Show the message about CiviCRM versions.
  *
  * @param CRM_Core_Smarty $template
  */
 public static function versionCheck($template)
 {
     if (CRM_Core_Config::isUpgradeMode()) {
         return;
     }
     $newerVersion = $securityUpdate = NULL;
     if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'versionAlert', NULL, 1) & 1) {
         $newerVersion = CRM_Utils_VersionCheck::singleton()->isNewerVersionAvailable();
     }
     if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'securityUpdateAlert', NULL, 3) & 1) {
         $securityUpdate = CRM_Utils_VersionCheck::singleton()->isSecurityUpdateAvailable();
     }
     $template->assign('newer_civicrm_version', $newerVersion);
     $template->assign('security_update', $securityUpdate);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:20,代码来源:Invoke.php

示例15: crm_translate_raw

 /**
  * Lookup the raw translation of a string (without any extra escaping or interpolation).
  *
  * @param string $text
  * @param string|NULL $domain
  * @param int|NULL $count
  * @param string $plural
  * @param string $context
  *
  * @return string
  */
 protected function crm_translate_raw($text, $domain, $count, $plural, $context)
 {
     // gettext domain for extensions
     $domain_changed = FALSE;
     if (!empty($domain) && $this->_phpgettext) {
         if ($this->setGettextDomain($domain)) {
             $domain_changed = TRUE;
         }
     }
     // do all wildcard translations first
     if (!isset(Civi::$statics[__CLASS__]) || !array_key_exists($this->locale, Civi::$statics[__CLASS__])) {
         if (defined('CIVICRM_DSN') && !CRM_Core_Config::isUpgradeMode()) {
             Civi::$statics[__CLASS__][$this->locale] = CRM_Core_BAO_WordReplacement::getLocaleCustomStrings($this->locale);
         } else {
             Civi::$statics[__CLASS__][$this->locale] = array();
         }
     }
     $stringTable = Civi::$statics[__CLASS__][$this->locale];
     $exactMatch = FALSE;
     if (isset($stringTable['enabled']['exactMatch'])) {
         foreach ($stringTable['enabled']['exactMatch'] as $search => $replace) {
             if ($search === $text) {
                 $exactMatch = TRUE;
                 $text = $replace;
                 break;
             }
         }
     }
     if (!$exactMatch && isset($stringTable['enabled']['wildcardMatch'])) {
         $search = array_keys($stringTable['enabled']['wildcardMatch']);
         $replace = array_values($stringTable['enabled']['wildcardMatch']);
         $text = str_replace($search, $replace, $text);
     }
     // dont translate if we've done exactMatch already
     if (!$exactMatch) {
         // use plural if required parameters are set
         if (isset($count) && isset($plural)) {
             if ($this->_phpgettext) {
                 $text = $this->_phpgettext->ngettext($text, $plural, $count);
             } else {
                 // if the locale's not set, we do ngettext work by hand
                 // if $count == 1 then $text = $text, else $text = $plural
                 if ($count != 1) {
                     $text = $plural;
                 }
             }
             // expand %count in translated string to $count
             $text = strtr($text, array('%count' => $count));
             // if not plural, but the locale's set, translate
         } elseif ($this->_phpgettext) {
             if ($context) {
                 $text = $this->_phpgettext->pgettext($context, $text);
             } else {
                 $text = $this->_phpgettext->translate($text);
             }
         }
     }
     if ($domain_changed) {
         $this->setGettextDomain('civicrm');
     }
     return $text;
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:73,代码来源:I18n.php


注:本文中的CRM_Core_Config::isUpgradeMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。