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


PHP Mage::run方法代码示例

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


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

示例1: downloadPage

 /**
  * Method download choosen page by url in argument and retrieves
  * its contents.
  * @param string $url
  * @return string contents of downloaded page
  */
 function downloadPage($url)
 {
     if ($this->isReady()) {
         /* remember Magento state and reset Magento */
         $prevURI = $_SERVER['REQUEST_URI'];
         $state = Mage::getStaticState();
         Mage::reset();
         /* start catching output */
         ob_start();
         /* run new Magento */
         $_SERVER['REQUEST_URI'] = preg_replace('/http(s){0,1}:\\/\\/[^\\/]*/', '', $url);
         Mage::run();
         /* get output */
         $html = ob_get_contents();
         /* end catching output */
         ob_end_clean();
         /* restore Magento state */
         Mage::restoreState($state);
         return $html;
     }
     return '';
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:28,代码来源:Direct.php

示例2: getCachedPage

 public static function getCachedPage()
 {
     $key = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
         $key = 'SECURE_' . $key;
     }
     //get params from config to exclude from url key
     $config = simplexml_load_file('app/etc/local.xml');
     $excludes = array();
     $excludeParams = $config->lightspeed->global->params;
     $excludeArr = explode(",", $excludeParams);
     foreach ($excludeArr as $param) {
         $excludes[] = $param;
     }
     //see if we even need to remove some params
     if (count($excludes)) {
         //if we do, blow it up and remake it
         $keyPart = explode("?", $key);
         if (isset($keyPart[1])) {
             $keyParse = parse_url($key);
             $newParams = explode("&", $keyParse['query']);
             $newString = '?';
             foreach ($newParams as $iteration => $newParam) {
                 $paramArr = explode("=", $newParam);
                 if (!in_array($paramArr[0], $excludes)) {
                     $newString .= $paramArr[0] . "=" . $paramArr[1] . "&";
                 }
                 $key = $keyPart[0] . $newString;
                 $key = rtrim($key, "&");
                 $key = preg_replace('/(\\?|&|&&)debug_front=1/s', '', $key);
             }
         }
     } else {
         $key = preg_replace('/(\\?|&|&&)debug_front=1/s', '', $key);
     }
     if (self::$multiCurrency) {
         self::report("configuration set to use multi_currency");
         $key .= '_' . self::getCurrencyCode();
     }
     self::report("attempting to fetch url: {$key}");
     if ($data = self::get($key)) {
         if (self::messageExists()) {
             self::report("a global message exists, we must not allow a cached page", true);
             return false;
         }
         if (isset($data[1]) && $data[1]) {
             $disqualified = false;
             if ($data[1] == '*') {
                 // auto disqualify when messages exist in the session
                 self::report("disqualified because the disqualifier is *");
                 $disqualified = true;
             } else {
                 self::initConditions();
                 $disqualifiers = explode(",", $data[1]);
                 if ($count = count($disqualifiers)) {
                     for ($i = 0; $i < $count; $i++) {
                         if (in_array($disqualifiers[$i], self::$conditions)) {
                             self::report("disqualified with {$disqualifiers[$i]}");
                             $disqualified = true;
                             break 1;
                         }
                     }
                 }
             }
             if ($disqualified) {
                 // handle dynamic content retrieval here
                 if (isset($data[2]) && $data[2]) {
                     self::report("attempting to retrieve hole punched content from {$data[2]}");
                     $_SERVER['REQUEST_URI'] = self::$request_path . "/" . $data[2];
                     require_once 'app/Mage.php';
                     ob_start();
                     //Single Site
                     if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
                         $_SERVER['HTTPS'] = 'on';
                         $_SERVER['SERVER_PORT'] = 443;
                     }
                     Mage::run();
                     //Multi-site test settings
                     // Add a "case" statement for each new site
                     // switch($_SERVER['HTTP_HOST']) {
                     //   case 'www.site1.com':
                     //     Mage::run('site1', 'website');
                     //     break;
                     //
                     //   case 'www.site2.com':
                     //     Mage::run('site2', 'website');
                     //     break;
                     //
                     //   default:
                     //     Mage::run();
                     //     break;
                     //End Multi-site Config
                     $content = ob_get_clean();
                     self::$holeContent = Zend_Json::decode($content);
                     return self::fillNoCacheHoles($data[0]);
                 } else {
                     self::report("valid disqualifiers without hole punch content... bummer", true);
                     return false;
                 }
             } else {
//.........这里部分代码省略.........
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:101,代码来源:lightspeed.php

示例3: error_reporting

if (version_compare(phpversion(), '5.2.0', '<') === true) {
    echo '<div style="font:12px/1.35em arial, helvetica, sans-serif;"><div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;"><h3 style="margin:0; font-size:1.7em; font-weight:normal; text-transform:none; text-align:left; color:#2f2f2f;">Whoops, it looks like you have an invalid PHP version.</h3></div><p>Magento supports PHP 5.2.0 or newer. <a href="http://www.magentocommerce.com/install" target="">Find out</a> how to install</a> Magento using PHP-CGI as a work-around.</p></div>';
    exit;
}
/**
 * Error reporting
 */
error_reporting(E_ALL | E_STRICT);
/**
 * Compilation includes configuration file
 */
$compilerConfig = 'includes/config.php';
if (file_exists($compilerConfig)) {
    include $compilerConfig;
}
$mageFilename = 'app/Mage.php';
if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename . " was not found";
    }
    exit;
}
require_once $mageFilename;
#Varien_Profiler::enable();
#Mage::setIsDeveloperMode(true);
#ini_set('display_errors', 1);
umask(0);
Mage::run();
开发者ID:jauderho,项目名称:magento-mirror,代码行数:30,代码来源:index.php

示例4: header

    include $compilerConfig;
}
//$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
$mageFilename = '../app/Mage.php';
$maintenanceFile = 'maintenance.flag';
if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename . " was not found";
    }
    exit;
}
if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
require_once $mageFilename;
#Varien_Profiler::enable();
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}
#ini_set('display_errors', 1);
umask(0);
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
//Mage::run($mageRunCode, $mageRunType);
Mage::run('inox_1', 'website');
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:30,代码来源:index.php

示例5: dispatch

 /**
  * Run request
  *
  * @return void
  */
 public function dispatch($uri)
 {
     $this->getRequest()->setRequestUri($uri);
     Mage::run($this->_runCode, $this->_runScope, $this->_runOptions);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:10,代码来源:ControllerAbstract.php

示例6: header

if (file_exists($compilerConfig)) {
    include $compilerConfig;
}
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
$maintenanceFile = 'maintenance.flag';
if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename . " was not found";
    }
    exit;
}
if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
require MAGENTO_ROOT . '/app/bootstrap.php';
require_once $mageFilename;
#Varien_Profiler::enable();
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}
ini_set('display_errors', 1);
umask(0);
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'default';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run("default");
开发者ID:amal-nibaya,项目名称:PB-DEV,代码行数:30,代码来源:index.php

示例7: header

if (file_exists($compilerConfig)) {
    include $compilerConfig;
}
$mageFilename = $root . '/app/Mage.php';
$maintenanceFile = 'maintenance.flag';
if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename . " was not found";
    }
    exit;
}
if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
require $root . '/app/bootstrap.php';
require_once $mageFilename;
#Varien_Profiler::enable();
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}
#ini_set('display_errors', 1);
umask(0);
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run('jaipur', 'website');
开发者ID:aayushKhandpur,项目名称:aayush-renting,代码行数:30,代码来源:index.php

示例8: header

$compilerConfig = MAGENTO_ROOT . '/includes/config.php';
if (file_exists($compilerConfig)) {
    include $compilerConfig;
}
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
$maintenanceFile = 'maintenance.flag';
if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename . " was not found";
    }
    exit;
}
if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
require_once $mageFilename;
#Varien_Profiler::enable();
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}
#ini_set('display_errors', 1);
umask(0);
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run('en', 'website');
开发者ID:quyip8818,项目名称:Mag,代码行数:30,代码来源:index.php

示例9: run

 /**
  * Runs the WebApplication
  *
  * @param \AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest The request instance
  *
  * @return string The web applications content
  */
 public function run(HttpServletRequestInterface $servletRequest)
 {
     try {
         // register the Magento autoloader as FIRST autoloader
         spl_autoload_register(array(new \Varien_Autoload(), 'autoload'), true, true);
         // Varien_Profiler::enable();
         if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
             \Mage::setIsDeveloperMode(true);
         }
         ini_set('display_errors', 1);
         umask(0);
         // store or website code
         $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
         // run store or run website
         $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
         // set headers sent to false and start output caching
         appserver_set_headers_sent(false);
         ob_start();
         // reset and run Magento
         \Mage::reset();
         \Mage::register('ServletRequest', $servletRequest);
         \Mage::run();
         // write the session back after the request
         session_write_close();
         // We need to init the session anew, so PHP session handling will work like it would in a clean environment
         appserver_session_init();
         // grab the contents generated by Magento
         $content = ob_get_clean();
     } catch (\Exception $e) {
         error_log($content = $e->__toString());
     }
     // return the content
     return $content;
 }
开发者ID:appserver-io-lab,项目名称:mage-servlet,代码行数:41,代码来源:MageServlet.php

示例10: isset

 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   Mage
 * @package    Mage
 * @copyright  Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
require_once 'app/bootstrap.php';
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
/* Additional local.xml file from environment variable */
$options = array();
if (!empty($_SERVER['MAGE_LOCAL_CONFIG'])) {
    $options['local_config'] = $_SERVER['MAGE_LOCAL_CONFIG'];
}
Mage::run($mageRunCode, $mageRunType, $options);
开发者ID:nemphys,项目名称:magento2,代码行数:30,代码来源:index.php

示例11: error_reporting

<?php

error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', __DIR__ . DIRECTORY_SEPARATOR . '..');
if (file_exists('maintenance.flag')) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
require_once MAGENTO_ROOT . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'Mage.php';
require_once MAGENTO_ROOT . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'MultiClient.php';
umask(0);
// aws load balancers are dumb
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
    $_SERVER['HTTPS'] = 'on';
    $_SERVER['SERVER_PORT'] = 443;
}
Mage::run(MultiClient::getRunCode(), MultiClient::getRunType(), MultiClient::getRunOptions());
开发者ID:Willboudle,项目名称:Magento-Multi_Client,代码行数:17,代码来源:index.php

示例12: run

 /**
  * Runs the WebApplication
  *
  * @param \AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest The request instance
  *
  * @return string The web applications content
  */
 public function run(HttpServletRequestInterface $servletRequest)
 {
     try {
         // register the Magento autoloader as FIRST autoloader
         spl_autoload_register(array(new \Varien_Autoload(), 'autoload'), true, true);
         // Varien_Profiler::enable();
         if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
             \Mage::setIsDeveloperMode(true);
         }
         ini_set('display_errors', 1);
         umask(0);
         // store or website code
         $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
         // run store or run website
         $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
         // set headers sent to false and start output caching
         appserver_set_headers_sent(false);
         ob_start();
         // reset and run Magento
         \Mage::reset();
         \Mage::register(MageStandardSessionServlet::SERVLET_REQUEST, $servletRequest);
         \Mage::run();
         /*
         // load the session and persist the data from $_SESSION
         $session = $servletRequest->getSession();
         
         foreach ($_SESSION as $namespace => $data) {
             if ($namespace !== 'identifier') {
                 error_log("Now add data for session {$session->getId()} and namespace: ". PHP_EOL . var_export($dat));
                 $session->putData($namespace, $data);
             }
         }
         */
         // grab the contents generated by Magento
         $content = ob_get_clean();
     } catch (\Exception $e) {
         error_log($content = $e->__toString());
     }
     // return the content
     return $content;
 }
开发者ID:appserver-io-lab,项目名称:mage-servlet,代码行数:48,代码来源:MageStandardSessionServlet.php

示例13: umask

    } else {
        echo $mageFilename." was not found";
    }
    exit;
}

if (file_exists($maintenanceFile)) {
    include_once MAGENTO_ROOT . '/errors/503.php';
    exit;
}

require_once $mageFilename;

#Varien_Profiler::enable();

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}

#ini_set('display_errors', 1);

umask(0);

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

Mage::run('wholesale', 'website');
// Mage::run($mageRunCode, $mageRunType);
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:31,代码来源:index.php

示例14: Mage_Core_Model_App_Options

/**
 * Application entry point
 *
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   Mage
 * @package    Mage
 * @copyright  Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
require_once __DIR__ . '/app/bootstrap.php';
$appOptions = new Mage_Core_Model_App_Options($_SERVER);
Mage::run($appOptions->getRunCode(), $appOptions->getRunType(), $appOptions->getRunOptions());
开发者ID:natxetee,项目名称:magento2,代码行数:29,代码来源:index.php

示例15: header

    include $compilerConfig;
}
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
$maintenanceFile = 'maintenance.flag';
if (!file_exists($mageFilename)) {
    if (is_dir('downloader')) {
        header("Location: downloader");
    } else {
        echo $mageFilename . " was not found";
    }
    exit;
}
if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
require MAGENTO_ROOT . '/app/bootstrap.php';
require_once $mageFilename;
#Varien_Profiler::enable();
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}
#Mage::setIsDeveloperMode(true);
#ini_set('display_errors', 1);
umask(0);
/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run($mageRunCode, $mageRunType);
开发者ID:pcuervo,项目名称:gadfy,代码行数:30,代码来源:index.php


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