本文整理汇总了PHP中Mage::isInstalled方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::isInstalled方法的具体用法?PHP Mage::isInstalled怎么用?PHP Mage::isInstalled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::isInstalled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: match
/**
* Validate and Match Cms Page and modify request
*
* @param Zend_Controller_Request_Http $request
* @return bool
*
* @SuppressWarnings(PHPMD.ExitExpression)
*/
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$identifier = trim($request->getPathInfo(), '/');
$condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
Mage::dispatchEvent('cms_controller_router_match_before', array('router' => $this, 'condition' => $condition));
$identifier = $condition->getIdentifier();
if ($condition->getRedirectUrl()) {
Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
$request->setDispatched(true);
return Mage::getControllerInstance('Mage_Core_Controller_Varien_Action_Forward', $request, Mage::app()->getFrontController()->getResponse());
}
if (!$condition->getContinue()) {
return null;
}
$page = Mage::getModel('Mage_Cms_Model_Page');
$pageId = $page->checkIdentifier($identifier, Mage::app()->getStore()->getId());
if (!$pageId) {
return null;
}
$request->setModuleName('cms')->setControllerName('page')->setActionName('view')->setParam('page_id', $pageId);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
return Mage::getControllerInstance('Mage_Core_Controller_Varien_Action_Forward', $request, Mage::app()->getFrontController()->getResponse());
}
示例2: match
/**
* match the route
* @param Zend_Controller_Request_Http $request
* @return bool
*/
public function match(Zend_Controller_Request_Http $request)
{
//if magento is not installed redirect to install
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
//get the url key
$urlKey = trim($request->getPathInfo(), '/');
//explode by slash
$parts = explode('/', $urlKey);
//if there are not 2 parts (tag/something) in the url we don't care about it.
//return false and let the rest of the application take care of the url.
if (count($parts) != 2) {
return false;
}
//if the first part of the url key is not 'tag' we don't care about it
//return false and let the rest of the application take care of the url
if ($parts[0] != 'tag') {
return false;
}
$tagName = urldecode($parts[1]);
//tag name
//load the tag model
$tag = Mage::getModel('tag/tag')->loadByName($tagName);
//if there is no tag with this name available in the current store just do nothing
if (!$tag->getId() || !$tag->isAvailableInStore()) {
return false;
}
//but if the tag is valid
//say to magento that the request should be mapped to `tag/product/list/tagId/ID_HERE` - the original url
$request->setModuleName('tag')->setControllerName('product')->setActionName('list')->setParam('tagId', $tag->getId());
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $urlKey);
return true;
}
示例3: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$baseHost = parse_url(Mage::getBaseUrl(), PHP_URL_HOST);
$curHost = $_SERVER['HTTP_HOST'];
if ($curHost != $baseHost) {
// Get the florist id
$floristId = explode('.', $curHost);
$floristId = $floristId[0];
$vendor = Mage::helper('udropship')->getVendorBySubdomain($floristId);
// Check if vendor exists with this subdomain
if ($cat = Mage::helper('udropship')->getCategoryByVendor($vendor)) {
// Register necessary values
if (!Mage::registry('current_subdomain')) {
Mage::register('current_subdomain', $floristId);
}
if (!Mage::registry('current_svendor')) {
Mage::register('current_svendor', $vendor);
}
if (!Mage::registry('subdomain')) {
Mage::register('subdomain', true);
}
if (!Mage::registry('current_subd_category')) {
Mage::register('current_subd_category', $cat);
}
} else {
header("Location: http://" . $baseHost);
exit;
}
}
return false;
}
示例4: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
/* @var $core Mana_Core_Helper_Data */
$core = Mage::helper('mana_core');
if ($core->getRoutePath() != '//') {
return false;
}
/* @var $routerHelper Mana_Core_Helper_Router */
$routerHelper = Mage::helper('mana_core/router');
$path = ltrim($request->getPathInfo(), '/');
$urlKey = Mage::getStoreConfig('mana/ajax/url_key_filter');
$routeSeparator = Mage::getStoreConfig('mana/ajax/route_separator_filter');
if ($core->startsWith($path, $urlKey . '/') && ($pos = strpos($path, '/' . $routeSeparator . '/')) > strlen($urlKey . '/')) {
$this->_route = substr($path, strlen($urlKey . '/'), $pos - strlen($urlKey . '/'));
$path = substr($path, $pos + strlen('/' . $routeSeparator));
$routerHelper->changePath($path)->processWithoutRendering($this, 'render');
$baseUrl = parse_url(Mage::getUrl(null, array('_nosid' => true)));
Mage::register('m_original_request_uri', $_SERVER['REQUEST_URI']);
$_SERVER['REQUEST_URI'] = $baseUrl['path'] . ($path ? ltrim($path, '/') : '/') . (($queryPos = strpos($_SERVER['REQUEST_URI'], '?')) !== false ? substr($_SERVER['REQUEST_URI'], $queryPos) : '');
Mage::register('manapro_filterajax_request', 1);
$this->getCatalogSession()->setData('manapro_filterajax_request', 1);
if ($core->isEnterpriseUrlRewriteInstalled()) {
$this->_getRequestRewriteController()->rewrite();
} else {
Mage::getModel('core/url_rewrite')->rewrite();
}
}
return false;
}
示例5: getGroupedHtml
/**
* Render Zkilleman_Notify messages if enabled, else render standard
*
* @return string Html output
*/
public function getGroupedHtml()
{
if (!Mage::isInstalled() || !Mage::getStoreConfig(self::CONFIG_REPLACE_STANDARD) || Mage::app()->getStore()->isAdmin()) {
return parent::getGroupedHtml();
}
return $this->renderView();
}
示例6: match
/**
* See if any product matches
*
* @param Zend_Controller_Request_Http $request
* @return bool
*/
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
// Clear session to make sure users can add products and the shopping cart clears properly
if (isset($_GET['zipcode'])) {
Mage::helper('urls')->clearSession($_GET['zipcode']);
}
// Get basic data
$identifier = urldecode(strtolower(trim($request->getPathInfo(), '/')));
$vendorsCollection = Mage::helper('urls')->getVendors();
$vendorId = false;
$productSlug = '';
// Get vendor id
$vendorId = $this->_detectVendorId($identifier, $vendorsCollection);
// Get product slug
preg_match('/.*\\/(.*).html$/', $identifier, $matches);
$productSlug = $matches[1];
if ($vendorId) {
Mage::register('vendorId', $vendorId);
$productId = Mage::helper('urls')->getProductIdBySlug($productSlug, $vendorId);
if ('' == $productId || empty($productId)) {
return false;
}
// Point to correct product
$request->setModuleName('catalog')->setControllerName('product')->setActionName('view')->setParam('id', $productId);
return true;
}
return false;
}
示例7: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$identifier = trim($request->getPathInfo(), '/');
/* @var $parser Hackathon_Layeredlanding_Model_Layeredlanding */
$landingPage = Mage::getModel('layeredlanding/layeredlanding')->loadByUrl($identifier);
if (!$landingPage->getId()) {
return false;
}
Mage::register('current_landingpage', $landingPage);
Mage::app()->getStore()->setConfig(Mage_Catalog_Helper_Category::XML_PATH_USE_CATEGORY_CANONICAL_TAG, 0);
// disable canonical tag
// if successfully gained url parameters, use them and dispatch ActionController action
$categoryIdsValue = $landingPage->getCategoryIds();
$categoryIds = explode(',', $categoryIdsValue);
$firstCategoryId = $categoryIds[0];
$request->setRouteName('catalog')->setModuleName('catalog')->setControllerName('category')->setActionName('view')->setParam('id', $firstCategoryId);
/** @var $attribute Hackathon_Layeredlanding_Model_Attributes */
foreach ($landingPage->getAttributes() as $attribute) {
$attr = Mage::getModel('eav/entity_attribute')->load($attribute->getAttributeId());
$request->setParam($attr->getAttributeCode(), $attribute->getValue());
}
$controllerClassName = $this->_validateControllerClassName('Mage_Catalog', 'category');
$controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $this->getFront()->getResponse());
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
// dispatch action
$request->setDispatched(true);
$controllerInstance->dispatch('view');
return true;
}
示例8: match
/**
* Validate and match entities and modify request
*
* @access public
* @param Zend_Controller_Request_Http $request
* @return bool
* @author Ultimate Module Creator
*/
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$urlKey = trim($request->getPathInfo(), '/');
$check = array();
$check['trainevent'] = new Varien_Object(array('prefix' => Mage::getStoreConfig('wage_trainevent/trainevent/url_prefix'), 'suffix' => Mage::getStoreConfig('wage_trainevent/trainevent/url_suffix'), 'list_key' => Mage::getStoreConfig('wage_trainevent/trainevent/url_rewrite_list'), 'list_action' => 'index', 'model' => 'wage_trainevent/trainevent', 'controller' => 'trainevent', 'action' => 'view', 'param' => 'id', 'check_path' => 0));
foreach ($check as $key => $settings) {
if ($settings->getListKey()) {
if ($urlKey == $settings->getListKey()) {
$request->setModuleName('wage_trainevent')->setControllerName($settings->getController())->setActionName($settings->getListAction());
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $urlKey);
return true;
}
}
if ($settings['prefix']) {
$parts = explode('/', $urlKey);
if ($parts[0] != $settings['prefix'] || count($parts) != 2) {
continue;
}
$urlKey = $parts[1];
}
if ($settings['suffix']) {
$urlKey = substr($urlKey, 0, -strlen($settings['suffix']) - 1);
}
$model = Mage::getModel($settings->getModel());
}
return false;
}
示例9: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$identifier = trim($request->getPathInfo(), '/');
$parts = explode('/', $identifier);
if (isset($parts[1]) && $parts[1] == 'reviews') {
$product = Mage::getModel('catalog/product')->loadByAttribute('url_key', $parts[0]);
if (isset($parts[2])) {
$p = explode('-', $parts[2]);
$id = (int) end($p);
$request->setRouteName('review')->setModuleName('review')->setControllerName('product')->setActionName('view')->setParam('id', $id)->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'reviews');
return true;
} else {
if ($product) {
$request->setRouteName('review')->setModuleName('review')->setControllerName('product')->setActionName('list')->setParam('id', $product->getId())->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'reviews');
return true;
}
}
} elseif ($parts[0] == 'tag' && isset($parts[1])) {
$p = explode('-', $parts[1]);
$id = (int) end($p);
$request->setRouteName('tag')->setModuleName('tag')->setControllerName('product')->setActionName('list')->setParam('tagId', $id)->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'tags');
return true;
}
return false;
}
示例10: isCurrentlySecure
public function isCurrentlySecure()
{
$standardRule = !empty($_SERVER['HTTPS']) && 'off' != $_SERVER['HTTPS'];
$offloaderHeader = trim((string) Mage::getConfig()->getNode(self::XML_PATH_OFFLOADER_HEADER, 'default'));
if (!empty($offloaderHeader) && !empty($_SERVER[$offloaderHeader]) || $standardRule) {
return true;
}
if (Mage::isInstalled()) {
$secureBaseUrl = '';
if (!$this->isAdmin()) {
$secureBaseUrl = Mage::getStoreConfig(Mage_Core_Model_Url::XML_PATH_SECURE_URL);
} else {
$secureBaseUrl = (string) Mage::getConfig()->getNode(Mage_Core_Model_Url::XML_PATH_SECURE_URL, 'default');
}
if (!$secureBaseUrl) {
return false;
}
if (false !== strpos($secureBaseUrl, '{{base_url}}')) {
$secureBaseUrl = Mage::getConfig()->substDistroServerVars('{{base_url}}');
}
$uri = Zend_Uri::factory($secureBaseUrl);
$port = $uri->getPort();
$isSecure = $uri->getScheme() == 'https' && isset($_SERVER['SERVER_PORT']) && $port == $_SERVER['SERVER_PORT'];
return $isSecure;
} else {
$isSecure = isset($_SERVER['SERVER_PORT']) && 443 == $_SERVER['SERVER_PORT'];
return $isSecure;
}
}
示例11: match
/**
* Rewritten function of the standard controller. Tries to match the pathinfo on url parameters.
*
* @see Mage_Core_Controller_Varien_Router_Standard::match()
* @param Zend_Controller_Request_Http $request The http request object that needs to be mapped on Action Controllers.
*/
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$identifier = urldecode(trim($request->getPathInfo(), '/'));
// try to gather url parameters from parser.
$parser = Mage::getModel('seofilter/parser');
$parsedRequestInfo = $parser->parseFilterInformationFromRequest($identifier, Mage::app()->getStore()->getId());
if (!$parsedRequestInfo) {
return false;
}
// if successfully gained url parameters, use them and dispatch ActionController action
$request->setRouteName('catalog')->setModuleName('catalog')->setControllerName('category')->setActionName('view')->setParam('id', $parsedRequestInfo['categoryId']);
$pathInfo = 'catalog/category/view/id/' . $parsedRequestInfo['categoryId'];
$requestUri = '/' . $pathInfo . '?';
foreach ($parsedRequestInfo['additionalParams'] as $paramKey => $paramValue) {
//@dva fix
if (is_array($paramValue)) {
$paramValue = implode($paramValue, '_');
}
$requestUri .= $paramKey . '=' . $paramValue . '&';
}
$controllerClassName = $this->_validateControllerClassName('Mage_Catalog', 'category');
$controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $this->getFront()->getResponse());
$request->setRequestUri(substr($requestUri, 0, -1));
$request->setPathInfo($pathInfo);
// dispatch action
$request->setDispatched(true);
$controllerInstance->dispatch('view');
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
return true;
}
示例12: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$identifier = trim($request->getPathInfo(), '/');
$condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
Mage::dispatchEvent('magicproduct_controller_router_match_before', array('router' => $this, 'condition' => $condition));
$identifier = $condition->getIdentifier();
if ($condition->getRedirectUrl()) {
Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
$request->setDispatched(true);
return true;
}
if (!$condition->getContinue()) {
return false;
}
if (!in_array($identifier, $this->router)) {
return false;
}
$request->setModuleName('magicproduct')->setControllerName('index')->setActionName('product')->setParam('type', $identifier);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
return true;
}
示例13: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$pathInfo = trim($request->getPathInfo(), '/');
$params = explode('/', $pathInfo);
if (isset($params[0]) && $params[0] == 'miembro' || isset($params[0]) && $params[0] == 'member') {
//redirect to mymodule/brands/index/brand_name/addidas
$request->setModuleName('member')->setControllerName('index')->setActionName('index');
if (isset($params[1])) {
$request->setParam('member_url', $params[1]);
}
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $pathInfo);
return true;
}
if (isset($params[0]) && $params[0] == 'mwcon') {
$request->setModuleName('member')->setControllerName('index')->setActionName('signin');
if (isset($params[1])) {
$request->setParam('member_id', $params[1]);
}
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $pathInfo);
return true;
}
return false;
}
示例14: _construct
public function _construct()
{
// Check to make sure Magento is installed
if (!Mage::isInstalled()) {
echo "Application is not installed yet, please complete install wizard first.";
exit;
}
// Initialize database connection
$this->_db = Mage::getSingleton('core/resource')->getConnection($this->config['connectiontype']);
// Process custom tables
if ($this->getArg('custom')) {
$cliCustomTables = array_map('trim', explode(',', $this->getArg('custom')));
$this->customTables = $cliCustomTables;
}
if ($this->getArg('customfile') && is_readable($this->getArg('customfile'))) {
$fileCustomTables = array_map('trim', file($this->getArg('customfile')));
$this->customTables = array_merge($this->customTables, $fileCustomTables);
}
// Configuration
$this->config['databaseconfig'] = Mage::getConfig()->getResourceConnectionConfig($this->config['connectiontype']);
$this->config['tableprefix'] = (string) Mage::getConfig()->getTablePrefix();
if ($this->getArg('clean')) {
$this->config['cleandata'] = true;
}
if ($this->getArg('exclude-config')) {
$this->config['exclude-config'] = true;
}
}
示例15: match
/**
* Validate and Match Manufacturer Page and modify request
*
* @param Zend_Controller_Request_Http $request
* @return bool
*/
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$router = 'manufacturers';
$identifier = trim(str_replace('/manufacturers/', '', $request->getPathInfo()), '/');
$condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
Mage::dispatchEvent('manufacturer_controller_router_match_before', array('router' => $this, 'condition' => $condition));
$identifier = $condition->getIdentifier();
if ($condition->getRedirectUrl()) {
Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
$request->setDispatched(true);
return true;
}
if (!$condition->getContinue()) {
return false;
}
$manufacturer = Mage::getModel('zeon_manufacturer/manufacturer');
$manufacturerId = $manufacturer->checkIdentifier($identifier, Mage::app()->getStore()->getId());
if (trim($identifier) && $manufacturerId) {
$request->setModuleName('manufacturers')->setControllerName('index')->setActionName('view')->setParam('manufacturer_id', $manufacturerId);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $router . '/' . $identifier);
return true;
}
return false;
}