本文整理汇总了PHP中AO::isInstalled方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::isInstalled方法的具体用法?PHP AO::isInstalled怎么用?PHP AO::isInstalled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AO
的用法示例。
在下文中一共展示了AO::isInstalled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _afterModuleMatch
/**
* checking if we installed or not and doing redirect
*
* @return bool
*/
protected function _afterModuleMatch()
{
if (!AO::isInstalled()) {
AO::app()->getFrontController()->getResponse()->setRedirect(AO::getUrl('install'))->sendResponse();
exit;
}
return true;
}
示例2: getWelcome
public function getWelcome()
{
if (empty($this->_data['welcome'])) {
if (AO::isInstalled() && AO::getSingleton('customer/session')->isLoggedIn()) {
$this->_data['welcome'] = $this->__('Welcome, %s!', $this->htmlEscape(AO::getSingleton('customer/session')->getCustomer()->getName()));
} else {
$this->_data['welcome'] = AO::getStoreConfig('design/header/welcome');
}
}
return $this->_data['welcome'];
}
示例3: match
public function match(Zend_Controller_Request_Http $request)
{
if (!AO::isInstalled()) {
AO::app()->getFrontController()->getResponse()->setRedirect(AO::getUrl('install'))->sendResponse();
exit;
}
$identifier = trim($request->getPathInfo(), '/');
$page = AO::getModel('cms/page');
$pageId = $page->checkIdentifier($identifier, AO::app()->getStore()->getId());
if (!$pageId) {
return false;
}
$request->setModuleName(isset($d[0]) ? $d[0] : 'cms')->setControllerName(isset($d[1]) ? $d[1] : 'page')->setActionName(isset($d[2]) ? $d[2] : 'view')->setParam('page_id', $pageId);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
return true;
}
示例4: getTranslationArrayByStrings
public function getTranslationArrayByStrings(array $strings, $storeId = null)
{
if (!AO::isInstalled()) {
return array();
}
if (is_null($storeId)) {
$storeId = AO::app()->getStore()->getId();
}
$read = $this->_getReadAdapter();
if (!$read) {
return array();
}
if (empty($strings)) {
return array();
}
$select = $read->select()->from($this->getMainTable())->where('string in (:tr_strings)')->where('store_id = ?', $storeId);
$result = array();
foreach ($read->fetchAll($select, array('tr_strings' => $read->quote($strings))) as $row) {
$result[$row['string']] = $row['translate'];
}
return $result;
}
示例5: isApplicationInstalled
/**
* Checking install status of application
*
* @return bool
*/
public function isApplicationInstalled()
{
return AO::isInstalled();
}
示例6: _checkShouldBeSecure
protected function _checkShouldBeSecure($request, $path = '')
{
if (!AO::isInstalled() || $request->getPost()) {
return;
}
if ($this->_shouldBeSecure($path) && !AO::app()->getStore()->isCurrentlySecure()) {
$url = $this->_getCurrentSecureUrl($request);
AO::app()->getFrontController()->getResponse()->setRedirect($url)->sendResponse();
exit;
}
}
示例7: install
/**
* Install Magento
*
* @return boolean
*/
public function install()
{
try {
/**
* Check if already installed
*/
if (AO::isInstalled()) {
$this->addError('ERROR: Magento is already installed');
return false;
}
/**
* Skip URL validation, if set
*/
$this->_getDataModel()->setSkipUrlValidation($this->_args['skip_url_validation']);
$this->_getDataModel()->setSkipBaseUrlValidation($this->_args['skip_url_validation']);
/**
* Prepare data
*/
$this->_prepareData();
if ($this->hasErrors()) {
return false;
}
$installer = $this->_getInstaller();
/**
* Install configuration
*/
$installer->installConfig($this->_getDataModel()->getConfigData());
// TODO fix wizard and simplify this everythere
if ($this->hasErrors()) {
return false;
}
/**
* Reinitialize configuration (to use new config data)
*/
$this->_app->cleanCache();
AO::getConfig()->reinit();
/**
* Install database
*/
$installer->installDb();
if ($this->hasErrors()) {
return false;
}
/**
* Create primary administrator user
*/
$installer->createAdministrator($this->_getDataModel()->getAdminData());
if ($this->hasErrors()) {
return false;
}
/**
* Save encryption key or create if empty
*/
$encryptionKey = empty($this->_args['encryption_key']) ? md5(time()) : $this->_args['encryption_key'];
$this->_getDataModel()->setEncryptionKey($encryptionKey);
$installer->installEnryptionKey($encryptionKey);
if ($this->hasErrors()) {
return false;
}
/**
* Installation finish
*/
$installer->finish();
if ($this->hasErrors()) {
return false;
}
/**
* Change directories mode to be writable by apache user
*/
@chmod('var/cache', 0777);
@chmod('var/session', 0777);
} catch (Exception $e) {
$this->addError('ERROR: ' . $e->getMessage());
return false;
}
return true;
}
示例8: init
/**
* Initialization of core configuration
*
* @return Mage_Core_Model_Config
*/
public function init($options = array())
{
$this->setCacheChecksum(null);
$this->_cacheLoadedSections = array();
$this->_options = new Mage_Core_Model_Config_Options($options);
$etcDir = $this->getOptions()->getEtcDir();
$this->_customEtcDir = $etcDir;
$localConfigLoaded = $this->loadFile($etcDir . DS . 'local.xml');
$disableLocalModules = !$this->_canUseLocalModules();
if (AO::isInstalled()) {
if (AO::app()->useCache('config')) {
if (VPROF) {
Varien_Profiler::start('mage::app::init::config::load_cache');
}
$loaded = $this->loadCache();
if (VPROF) {
Varien_Profiler::stop('mage::app::init::config::load_cache');
}
if ($loaded) {
$this->_useCache = true;
return $this;
}
}
}
$mergeConfig = new Mage_Core_Model_Config_Base();
/**
* Load base configuration data
*/
$configFile = $etcDir . DS . 'config.xml';
$this->loadFile($configFile);
$this->_loadDeclaredModules($mergeConfig);
/**
* Load modules configuration data
*/
if (VPROF) {
Varien_Profiler::start('config/load-modules');
}
$modules = $this->getNode('modules')->children();
foreach ($modules as $modName => $module) {
if ($this->configElementIs($module, 'active')) {
if ($disableLocalModules && 'local' === (string) $module->codePool) {
continue;
}
$configFile = $this->getModuleDir('etc', $modName) . DS . 'config.xml';
if ($mergeConfig->loadFile($configFile)) {
$this->extend($mergeConfig, true);
}
}
}
if (VPROF) {
Varien_Profiler::stop('config/load-modules');
}
/**
* Load local configuration data
*/
if (VPROF) {
Varien_Profiler::start('config/load-local');
}
$configFile = $etcDir . DS . 'local.xml';
if (is_readable($configFile)) {
$mergeConfig->loadFile($configFile);
$this->extend($mergeConfig);
}
if (VPROF) {
Varien_Profiler::stop('config/load-local');
}
$this->applyExtends();
/**
* Load configuration from DB
*/
if ($localConfigLoaded) {
//AO-TODO: Create an admin interface to apply resource updates
//no need to install new apps every single page request.
/*
if (VPROF) Varien_Profiler::start('dbUpdates');
Mage_Core_Model_Resource_Setup::applyAllUpdates();
if (VPROF) Varien_Profiler::stop('dbUpdates');
*/
if (VPROF) {
Varien_Profiler::start('config/load-db');
}
$dbConf = $this->getResourceModel();
//class is Mage_Core_Model_Mysql4_Config
$dbConf->loadToXml($this);
if (VPROF) {
Varien_Profiler::stop('config/load-db');
}
}
if (AO::app()->useCache('config')) {
$this->saveCache(array(self::CACHE_TAG));
}
return $this;
}
示例9: rewrite
/**
* Implement logic of custom rewrites
*
* @param Zend_Controller_Request_Http $request
* @param Zend_Controller_Response_Http $response
* @return Mage_Core_Model_Url
*/
public function rewrite(Zend_Controller_Request_Http $request = null, Zend_Controller_Response_Http $response = null)
{
if (!AO::isInstalled()) {
return false;
}
if (is_null($request)) {
$request = AO::app()->getFrontController()->getRequest();
}
if (is_null($response)) {
$response = AO::app()->getFrontController()->getResponse();
}
if (is_null($this->getStoreId()) || false === $this->getStoreId()) {
$this->setStoreId(AO::app()->getStore()->getId());
}
$requestCases = array();
$requestPath = trim($request->getPathInfo(), '/');
/**
* We need try to find rewrites information for both cases
* More priority has url with query params
*/
if ($queryString = $this->_getQueryString()) {
$requestCases[] = $requestPath . '?' . $queryString;
$requestCases[] = $requestPath;
} else {
$requestCases[] = $requestPath;
}
$this->loadByRequestPath($requestCases);
/**
* Try to find rewrite by request path at first, if no luck - try to find by id_path
*/
if (!$this->getId() && isset($_GET['___from_store'])) {
try {
$fromStoreId = AO::app()->getStore($_GET['___from_store']);
} catch (Exception $e) {
return false;
}
$this->setStoreId($fromStoreId)->loadByRequestPath($requestCases);
if (!$this->getId()) {
return false;
}
$this->setStoreId(AO::app()->getStore()->getId())->loadByIdPath($this->getIdPath());
}
if (!$this->getId()) {
return false;
}
$request->setAlias(self::REWRITE_REQUEST_PATH_ALIAS, $this->getRequestPath());
$external = substr($this->getTargetPath(), 0, 6);
$isPermanentRedirectOption = $this->hasOption('RP');
if ($external === 'http:/' || $external === 'https:') {
if ($isPermanentRedirectOption) {
header('HTTP/1.1 301 Moved Permanently');
}
header("Location: " . $this->getTargetPath());
exit;
} else {
$targetUrl = $request->getBaseUrl() . '/' . $this->getTargetPath();
}
$isRedirectOption = $this->hasOption('R');
if ($isRedirectOption || $isPermanentRedirectOption) {
if (AO::getStoreConfig('web/url/use_store') && ($storeCode = AO::app()->getStore()->getCode())) {
$targetUrl = $request->getBaseUrl() . '/' . $storeCode . '/' . $this->getTargetPath();
}
if ($isPermanentRedirectOption) {
header('HTTP/1.1 301 Moved Permanently');
}
header('Location: ' . $targetUrl);
exit;
}
if (AO::getStoreConfig('web/url/use_store') && ($storeCode = AO::app()->getStore()->getCode())) {
$targetUrl = $request->getBaseUrl() . '/' . $storeCode . '/' . $this->getTargetPath();
}
if ($queryString = $this->_getQueryString()) {
$targetUrl .= '?' . $queryString;
}
$request->setRequestUri($targetUrl);
$request->setPathInfo($this->getTargetPath());
return true;
}
示例10: setPathInfo
/**
* Set the PATH_INFO string
* Set the ORIGINAL_PATH_INFO string
*
* @param string|null $pathInfo
* @return Zend_Controller_Request_Http
*/
public function setPathInfo($pathInfo = null)
{
if ($pathInfo === null) {
if (null === ($requestUri = $this->getRequestUri())) {
return $this;
}
// Remove the query string from REQUEST_URI
if ($pos = strpos($requestUri, '?')) {
$requestUri = substr($requestUri, 0, $pos);
}
$baseUrl = $this->getBaseUrl();
if (null !== $baseUrl && false === ($pathInfo = substr($requestUri, strlen($baseUrl)))) {
// If substr() returns false then PATH_INFO is set to an empty string
$pathInfo = '';
} elseif (null === $baseUrl) {
$pathInfo = $requestUri;
}
if (AO::isInstalled() && AO::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL)) {
$p = explode('/', ltrim($pathInfo, '/'), 2);
$storeCode = $p[0];
$stores = AO::app()->getStores(true, true);
if ($storeCode !== '' && isset($stores[$storeCode])) {
AO::app()->setCurrentStore($storeCode);
$pathInfo = '/' . (isset($p[1]) ? $p[1] : '');
} elseif ($storeCode !== '') {
$this->setActionName('noRoute');
}
}
$this->_originalPathInfo = (string) $pathInfo;
$this->_requestString = $pathInfo . ($pos !== false ? substr($requestUri, $pos) : '');
}
$this->_pathInfo = (string) $pathInfo;
return $this;
}
示例11: preDispatch
/**
* Dispatches event before action
*/
public function preDispatch()
{
if (!$this->getFlag('', self::FLAG_NO_CHECK_INSTALLATION)) {
if (!AO::isInstalled()) {
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
$this->_redirect('install');
return;
}
}
if ($this->_rewrite()) {
return;
}
if (!$this->getFlag('', self::FLAG_NO_START_SESSION)) {
AO::getSingleton('core/session', array('name' => $this->getLayout()->getArea()))->start();
}
AO::app()->loadArea($this->getLayout()->getArea());
if ($this->getFlag('', self::FLAG_NO_PRE_DISPATCH)) {
return;
}
AO::dispatchEvent('controller_action_predispatch', array('controller_action' => $this));
AO::dispatchEvent('controller_action_predispatch_' . $this->getRequest()->getRouteName(), array('controller_action' => $this));
AO::dispatchEvent('controller_action_predispatch_' . $this->getFullActionName(), array('controller_action' => $this));
}
示例12: getSessionSavePath
/**
* Get sesssion save path
*
* @return string
*/
public function getSessionSavePath()
{
if (AO::isInstalled() && ($sessionSavePath = AO::getConfig()->getNode(self::XML_NODE_SESSION_SAVE_PATH))) {
return $sessionSavePath;
}
return parent::getSessionSavePath();
}
示例13: init
public function init()
{
$this->setCacheChecksum(null);
$saveCache = true;
// check if local modules are disabled
$disableLocalModules = (string) $this->getNode('global/disable_local_modules');
$disableLocalModules = !empty($disableLocalModules) && ('true' === $disableLocalModules || '1' === $disableLocalModules);
if ($disableLocalModules) {
/**
* Reset include path
*/
$codeDir = AO::getConfig()->getOptions()->getCodeDir();
$libDir = AO::getConfig()->getOptions()->getLibDir();
set_include_path(BP . DS . 'app' . DS . 'code' . DS . 'community' . PS . BP . DS . 'app' . DS . 'code' . DS . 'core' . PS . BP . DS . 'lib' . PS . AO::registry('original_include_path'));
}
if (AO::isInstalled()) {
if (AO::app()->useCache('config')) {
$loaded = $this->loadCache();
if ($loaded) {
return $this;
}
}
}
$mergeWsdl = new Mage_Api_Model_Wsdl_Config_Base();
$mergeWsdl->setHandler($this->getHandler());
$modules = AO::getConfig()->getNode('modules')->children();
$baseWsdlFile = AO::getConfig()->getModuleDir('etc', "Mage_Api") . DS . 'wsdl2.xml';
$this->loadFile($baseWsdlFile);
foreach ($modules as $modName => $module) {
// if ($module->is('active') && $modName == 'Mage_Customer') {
if ($module->is('active') && $modName != 'Mage_Api') {
if ($disableLocalModules && 'local' === (string) $module->codePool) {
continue;
}
$wsdlFile = AO::getConfig()->getModuleDir('etc', $modName) . DS . 'wsdl.xml';
if ($mergeWsdl->loadFile($wsdlFile)) {
$this->extend($mergeWsdl, true);
}
}
}
$this->setWsdlContent($this->_xml->asXML());
if (AO::app()->useCache('config')) {
$this->saveCache(array('config'));
}
return $this;
}
示例14: isCurrentlySecure
public function isCurrentlySecure()
{
if (!empty($_SERVER['HTTPS'])) {
return true;
}
if (AO::isInstalled()) {
$secureBaseUrl = AO::getStoreConfig('web/secure/base_route_url');
if (!$secureBaseUrl) {
return false;
}
$uri = Zend_Uri::factory($secureBaseUrl);
$isSecure = $uri->getScheme() == 'https' && isset($_SERVER['SERVER_PORT']) && $uri->getPort() == $_SERVER['SERVER_PORT'];
return $isSecure;
} else {
$isSecure = isset($_SERVER['SERVER_PORT']) && 443 == $_SERVER['SERVER_PORT'];
return $isSecure;
}
}
示例15: getAllowCurrencies
/**
* Retrieve array of allowed currencies
*
* @return unknown
*/
public function getAllowCurrencies()
{
$data = array();
if (AO::isInstalled()) {
$data = AO::app()->getStore()->getConfig(self::XML_PATH_ALLOW_CURRENCIES_INSTALLED);
return explode(',', $data);
} else {
$data = AO::getConfig()->asArray(AO::getConfig()->getNode(self::XML_PATH_ALLOW_CURRENCIES));
if ($data) {
return array_keys($data);
}
}
return $data;
}