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


PHP Mage::init方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     \Mage::init();
     $this->mink = new Mink(array('goutte' => new Session(new GoutteDriver())));
     $this->mink->setDefaultSessionName('goutte');
     $this->manager = new FixtureManager(new AttributesProvider());
 }
开发者ID:jonathanselander,项目名称:Manager,代码行数:7,代码来源:WebTestCase.php

示例2: createOrder

 public static function createOrder($order, $product)
 {
     Mage::init();
     $customer = Mage::getModel('customer/customer')->load($order['customer_id']);
     $transaction = Mage::getModel('core/resource_transaction');
     $store_Id = $customer->getStoreId();
     //$order = Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId();
     $lastOrderId = Mage::getSingleton('eav/config')->getEntityType('order')->fetchNewIncrementId($store_Id);
     //$lastOrderId = $order->getIncrementId();
     $order = Mage::getModel('sales/order')->setIncrementId($lastOrderId)->setStoreId($store_Id)->setQuoteId(0)->setGlobal_currency_code('CNY')->setBase_currency_code('CNY')->setStore_currency_code('CNY')->setOrder_currency_code('CNY')->setOrigin_order_id($order['origin_order_id'])->setReferer($order['referer'])->setTo_buyer($order['to_buyer'])->setIs_1yuan($order['is_1yuan'])->setDevice_id($order['device_id'])->setShipping_type($order['shipping_type'])->setCreated_at($order['create_at']);
     $order->setCustomer_email($customer->getEmail())->setCustomerFirstname($customer->getFirstname())->setCustomerLastname($customer->getLastname())->setCustomerGroupId($customer->getGroupId())->setCustomer_is_guest(0)->setCustomer($customer);
     $billing = $customer->getDefaultBillingAddress();
     $billingAddress = Mage::getModel('sales/order_address')->setStoreId($store_Id)->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)->setCustomerId($customer->getId())->setCustomerAddressId($customer->getDefaultBilling())->setCustomer_address_id($billing->getEntityId())->setPrefix($billing->getPrefix())->setFirstname($billing->getFirstname())->setMiddlename($billing->getMiddlename())->setLastname($billing->getLastname())->setSuffix($billing->getSuffix())->setCompany($billing->getCompany())->setStreet($billing->getStreet())->setCity($billing->getCity())->setCountry_id($billing->getCountryId())->setRegion($billing->getRegion())->setRegion_id($billing->getRegionId())->setPostcode($billing->getPostcode())->setTelephone($billing->getTelephone())->setFax($billing->getFax());
     $order->setBillingAddress($billingAddress);
     $shipping = $customer->getDefaultShippingAddress();
     $shippingAddress = Mage::getModel('sales/order_address')->setStoreId($store_Id)->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)->setCustomerId($customer->getId())->setCustomerAddressId($customer->getDefaultShipping())->setCustomer_address_id($shipping->getEntityId())->setPrefix($shipping->getPrefix())->setFirstname($shipping->getFirstname())->setMiddlename($shipping->getMiddlename())->setLastname($shipping->getLastname())->setSuffix($shipping->getSuffix())->setCompany($shipping->getCompany())->setStreet($shipping->getStreet())->setCity($shipping->getCity())->setCountry_id($shipping->getCountryId())->setRegion($shipping->getRegion())->setRegion_id($shipping->getRegionId())->setPostcode($shipping->getPostcode())->setTelephone($shipping->getTelephone())->setFax($shipping->getFax());
     $order->setShippingAddress($shippingAddress)->setShipping_method('flatrate_flatrate');
     $orderPayment = Mage::getModel('sales/order_payment')->setStoreId($store_Id)->setCustomerPaymenyId(0)->setMethod('purchaseorder')->setPo_number(' - ');
     $order->setPayment($orderPayment);
     $subTotal = 0;
     $products = array('2' => array('qty' => 2));
     foreach ($products as $productId => $product) {
         $_product = Mage::getModel('catalog/product')->load($productId);
         $rowTotal = $_product->getPrice() * $product['qty'];
         $orderItem = Mage::getModel('sales/order_item')->setStoreId($store_Id)->setQuoteItemId(0)->setQuoteParentItemId(NULL)->setProductId($productId)->setProductType($_product->getTypeId())->setQtyBackordered(NULL)->setTotalQtyOrdered($product['qty'])->setQtyOrdered($product['qty'])->setName($_product->getName())->setSku($_product->getSku())->setPrice($_product->getPrice())->setBasePrice($_product->getPrice())->setOriginalPrice($_product->getPrice())->setRowTotal($rowTotal)->setBaseRowTotal($rowTotal);
         $subTotal += $rowTotal;
         $order->addItem($orderItem);
     }
     $order->setSubtotal($subTotal)->setBaseSubtotal($subTotal)->setGrandTotal($subTotal)->setBaseGrandTotal($subTotal);
     $transaction->addObject($order);
     $transaction->addCommitCallback(array($order, 'place'));
     $transaction->addCommitCallback(array($order, 'save'));
     $transaction->save();
 }
开发者ID:HB4daemmon,项目名称:custom,代码行数:34,代码来源:orders.php

示例3: run

 public function run()
 {
     // Switch to some specific store view
     Mage::init();
     // Initialize area (<frontend> configuration nodes under modules config.xml)
     Mage::app()->loadArea(Mage_Core_Model_App_Area::AREA_FRONTEND);
     // Add some rewrite
     Mage::app()->getConfig()->setNode('global/models/catalog/rewrite/product', 'Catalog_Product_Debug');
     // Echo 'It works!'
     Mage::getModel('catalog/product')->testDebugMethod();
 }
开发者ID:thiagorb,项目名称:magento_scripts,代码行数:11,代码来源:debug_shell.php

示例4: testGenerateUniqueId

 public function testGenerateUniqueId()
 {
     Mage::init();
     $payment = new Varien_Object();
     $order = new Varien_Object();
     $billingAddress = new Varien_Object();
     $order->setBillingAddress($billingAddress);
     $payment->setOrder($order);
     $litle = new Litle_CreditCard_Model_PaymentLogic();
     $mock = $this->getMock('Mage_Payment_Model_Info');
     $hash = $litle->generateAuthorizationHash('123', '100', $mock, $payment);
     $this->assertEquals('123', $hash['id']);
 }
开发者ID:nengineer,项目名称:litle-integration-magento,代码行数:13,代码来源:PaymentLogicTest.php

示例5: bootstrap

function bootstrap()
{
    /**
     * Error reporting
     */
    error_reporting(E_ALL | E_STRICT);
    $mageFilename = 'app/Mage.php';
    $maintenanceFile = 'maintenance.flag';
    require_once $mageFilename;
    #Varien_Profiler::enable();
    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';
    if (method_exists('Mage', 'init')) {
        Mage::init($mageRunCode, $mageRunType);
    } else {
        Mage::app($mageRunCode, $mageRunType);
    }
    return $mageFilename;
}
开发者ID:saverdaj,项目名称:MagentoAttributeMigrationGenerate,代码行数:24,代码来源:magento-create-setup.php

示例6: substr

<?php

include_once 'app/Mage.php';
Mage::init();
//Initializing PHP variable with string
$captchanumber = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz';
//Getting first 6 word after shuffle
$captchanumber = substr(str_shuffle($captchanumber), 0, 6);
//Initializing session variable with above generated sub-string
//$_SESSION["code"] = $captchanumber;
$session = Mage::getSingleton("core/session", array("name" => "frontend"));
$session->setData("catptchacode", trim($captchanumber));
//Mage::getSingleton('core/session')->setCaptchacode($captchanumber);
//Generating CAPTCHA
$image = imagecreatefromjpeg("bj.jpg");
$foreground = imagecolorallocate($image, 0, 0, 0);
//font color
imagestring($image, 20, 35, 12, $captchanumber, $foreground);
header('Content-type: image/png');
imagepng($image);
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:20,代码来源:captcha.php

示例7: displayAttributeManagementTool

    public static function displayAttributeManagementTool()
    {
        global $b2b, $db, $client, $sessionId;
        Mage::init();
        $Magento_AttributeSets = array();
        $attributestmp = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
        foreach ($attributestmp->getData() as $at) {
            // if (substr($at['attribute_code'], 0, strlen(ATTRIBUTES_PREFIX) ) == ATTRIBUTES_PREFIX) {
            $Magento_Attributes[$at['attribute_code']]['attribute_id'] = $at['attribute_id'];
            $Magento_Attributes[$at['attribute_code']]['name'] = $at['frontend_label'];
            // }
        }
        ksort($Magento_Attributes);
        $Magento_AttributeSets_temp = $client->call($sessionId, "catalog_product_attribute_set.list");
        foreach ($Magento_AttributeSets_temp as $as) {
            $Magento_AttributeSets[$as['name']] = $as['set_id'];
        }
        echo '<table border="0" cellpadding="0" cellspacing="0" width="600">';
        foreach ($Magento_Attributes as $Magento_Attribute) {
            if ($Magento_Attribute['name'] == "") {
                continue;
            }
            echo "<tr>";
            echo "<td>{$Magento_Attribute['name']}</td>";
            echo "<td>{$Magento_Attribute['code']}</td>";
            echo "<td><span class='copy_to_all_sets' id_attribute='{$Magento_Attribute['attribute_id']}'>COPY to all Sets</span></td>";
            echo "<td><span class='remove_from_all_sets' id_attribute='{$Magento_Attribute['attribute_id']}'>REMOVE from all Sets</span></td>";
            echo "</tr>";
        }
        echo '</table>';
        //  dump($Magento_AttributeSets);
        // dump($Magento_Attributes);
        ?>
       <style>
       .copy_to_all_sets{text-decoration: underline; color:blue;cursor:pointer}
       .remove_from_all_sets{text-decoration: underline; color:blue;cursor:pointer}
       </style><script language="JavaScript">
        <!--
          jQuery('.copy_to_all_sets').click(function() {
          	  	var e = $(this);
          	  	id_attribute = e.attr("id_attribute");
				var data = {  'supplier': supplier, 'id_attribute': id_attribute, 'to_do': "COPY_TO_ALL_SETS" };
				$.ajax({ type: 'post', cache: false, url: '<?php 
        echo CATEGORY_MAPPING_URL_AJAX;
        ?>
', data: data, success: function(data){
						if (data=="ok") {
                          alert("ok");
                 	  	}
					}
				})
		  })

		  jQuery('.remove_from_all_sets').click(function() {
          	  	var e = $(this);
          	  	id_attribute = e.attr("id_attribute");
				var data = {  'supplier': supplier, 'id_attribute': id_attribute, 'to_do': "REMOVE_FROM_ALL_SETS" };
				$.ajax({ type: 'post', cache: false, url: '<?php 
        echo CATEGORY_MAPPING_URL_AJAX;
        ?>
', data: data, success: function(data){
						if (data=="ok") {
                          alert("ok");
                 	  	}
					}
				})
		  })
      //-->
      </script>

       <?php 
    }
开发者ID:arribanz,项目名称:live,代码行数:72,代码来源:Settings.class.php

示例8: run


//.........这里部分代码省略.........
             } else {
                 printf("There aren't any actions tracked.\r\n");
             }
         } else {
             if ($id = $this->getArgs('r', 'run')) {
                 $this->_printHeader();
                 $pendingList = $this->_io->getPendingList();
                 if (count($pendingList)) {
                     $executed = 0;
                     $session = Mage::getSingleton('adminhtml/session');
                     foreach ($pendingList as $i => $row) {
                         if ($id > 0 && $i + 1 != $id) {
                             continue;
                         }
                         $actionExecutorClass = $row[PugMoRe_Mageploy_Model_Action_Abstract::INDEX_EXECUTOR_CLASS];
                         $actionExecutorVersion = $row[PugMoRe_Mageploy_Model_Action_Abstract::INDEX_VERSION];
                         $controllerModule = $row[PugMoRe_Mageploy_Model_Action_Abstract::INDEX_CONTROLLER_MODULE];
                         $controllerName = $row[PugMoRe_Mageploy_Model_Action_Abstract::INDEX_CONTROLLER_NAME];
                         $controllerClassName = $this->_getControllerClassName($controllerModule, $controllerName);
                         if (class_exists($actionExecutorClass)) {
                             $controllerFileName = $this->_getControllerClassPath($controllerModule, $controllerName);
                             if (file_exists($controllerFileName)) {
                                 include_once $controllerFileName;
                             } else {
                                 printf("Error: file '%s' not found!\r\n", $controllerFileName);
                             }
                             if (class_exists($controllerClassName)) {
                                 $actionExecutor = new $actionExecutorClass();
                                 $parameters = $row[PugMoRe_Mageploy_Model_Action_Abstract::INDEX_ACTION_PARAMS];
                                 try {
                                     $request = $actionExecutor->decode($parameters, $actionExecutorVersion);
                                     $controller = new $controllerClassName($request, new PugMoRe_Mageploy_Controller_Response_Http());
                                     $action = $row[PugMoRe_Mageploy_Model_Action_Abstract::INDEX_ACTION_NAME] . 'Action';
                                     $controller->preDispatch();
                                     $controller->{$action}();
                                     $controller->postDispatch();
                                 } catch (Zend_Controller_Response_Exception $e) {
                                     # do nothing: avoid "Headers already sent" error message
                                 } catch (Exception $e) {
                                     $session->addError($e->getMessage());
                                 }
                                 // Add messages in body response in case of Ajax requests
                                 $messages = $session->getMessages(true);
                                 if ($request && $request->getParam('isAjax', false)) {
                                     $body = $controller->getResponse()->getBody();
                                     $msg = Mage::getSingleton('core/message')->notice($body);
                                     $messages->add($msg);
                                 }
                                 foreach ($messages->getItems() as $message) {
                                     $messageType = $message->getType();
                                     switch ($messageType) {
                                         case Mage_Core_Model_Message::ERROR:
                                             $color = self::TERM_COLOR_RED;
                                             break;
                                         case Mage_Core_Model_Message::SUCCESS:
                                             $color = self::TERM_COLOR_GREEN;
                                             break;
                                         default:
                                             #break intentionally omitted
                                         #break intentionally omitted
                                         case Mage_Core_Model_Message::WARNING:
                                             #break intentionally omitted
                                         #break intentionally omitted
                                         case Mage_Core_Model_Message::NOTICE:
                                             $color = self::TERM_COLOR_YELLOW;
                                             break;
                                     }
                                     printf("Action ID #%d - %s %s\r\n", $i + 1, $this->__getColoredString($message->getType(), $color), $message->getText());
                                 }
                                 $executed++;
                                 // register executed action
                                 $this->_io->done($row);
                             } else {
                                 printf("Error: class '%s' not found!\r\n", $controllerClassName);
                             }
                         } else {
                             printf("Error: class '%s' not found!\r\n", $actionExecutorClass);
                         }
                         // Yes, PHP is Object Oriented but don't forget the
                         // Superglobals! After all PHP is not Java :-)
                         $_GET = array();
                         $_POST = array();
                         $_REQUEST = array();
                         // And don't forget to reinitialize Magento to avoid
                         // problems with already populated objects (i.e. registry)
                         Mage::reset();
                         Mage::init($this->_appCode, $this->_appType);
                     }
                     // end foreach
                     printf("\r\nExecuted actions: %d/%d\r\n", $executed, count($pendingList));
                 } else {
                     printf("There aren't any pending actions to execute.\r\n");
                 }
             } else {
                 echo $this->usageHelp($doTracking);
             }
         }
     }
     printf("\r\n");
 }
开发者ID:ngreimel,项目名称:mageploy,代码行数:101,代码来源:mageploy.php

示例9: ini_set

 */
$mageShellFilename = 'Mageshell.php';
if (!file_exists($mageShellFilename)) {
    echo $mageShellFilename . 'was not found';
    exit;
}
require_once $mageShellFilename;
#Varien_Profiler::enable();
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(022);
/* 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::init($mageRunCode, $mageRunType);
/* Start session */
if (isset($options['u']) && isset($options['p'])) {
    $username = $options['u'];
    $password = $options['p'];
    $user = Mage::getSingleton('admin/session')->login($username, $password);
    if (!is_object($user) || !$user->getId()) {
        echo "Admin login failed.\n";
    } else {
        echo "Logged in as {$user->getUsername()}\n";
    }
} else {
    if (isset($options['a'])) {
        Mage::app()->setCurrentStore('admin');
        echo "Using admin context.\n";
    } else {
开发者ID:stolksdorf,项目名称:mageshell,代码行数:31,代码来源:mageshell-run.php

示例10: updateSeller

function updateSeller($data)
{
    include '../app/Mage.php';
    Mage::init();
    if (isset($data['sku']) && $data['sku'] != '' && isset($data['status']) && $data['status'] != '' && isset($data['price']) && $data['price'] != '' && isset($data['special_price']) && isset($data['sellerCode']) && $data['sellerCode'] != '' && isset($data['inventory']) && $data['inventory'] != '') {
        if ($data['status'] == 1 || $data['status'] == 2) {
            if (is_numeric($data['price'])) {
                if (is_numeric($data['inventory'])) {
                    $sku = $data['sku'] . '-' . $data['sellerCode'];
                    $product = Mage::getModel('catalog/product');
                    $productId = $product->getIdBySku($sku);
                    if (isset($productId) && $productId != '') {
                        $product = $product->load($productId);
                        $product->setStatus($data['status']);
                        $product->setPrice($data['price']);
                        $product->setSpecialPrice($data['special_price']);
                        $product->save();
                        $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
                        if ($stockItem->getId() > 0 and $stockItem->getManageStock()) {
                            $qty = $data['inventory'];
                            $stockItem->setQty($qty);
                            $stockItem->setIsInStock((int) ($qty > 0));
                            $stockItem->save();
                        }
                        $proArr['data'] = null;
                        $proArr['message'] = "Update Success";
                    } else {
                        $proArr['data'] = null;
                        $proArr['message'] = "Sku doesnot exist";
                    }
                } else {
                    $proArr['data'] = null;
                    $proArr['message'] = "Inventory need be number";
                }
            } else {
                $proArr['data'] = null;
                $proArr['message'] = "price need be in correct format EX: 109.23";
            }
        } else {
            $proArr['data'] = null;
            $proArr['message'] = "status can be either 1 or 2";
        }
    } else {
        $proArr['data'] = null;
        $proArr['message'] = "Seller code, sku, Price, special_price, Inventory and status are required";
    }
    return $proArr;
}
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:48,代码来源:vendorskus.php

示例11: sendChangePasswordMail

function sendChangePasswordMail($data)
{
    include '../app/Mage.php';
    Mage::init();
    if (isset($data['user_id']) && trim($data['user_id']) != '' && isset($data['new_password']) && trim($data['new_password']) != '') {
        $customer = Mage::getModel('customer/customer')->load(trim($data['user_id']));
        if ($customer->getEmail()) {
            $templateId = 2;
            //template id for sending customer data
            $mailTemplate = Mage::getModel('core/email_template');
            $template_collection = $mailTemplate->load($templateId);
            $template_data = $template_collection->getData();
            $templateId = $template_data['template_id'];
            $mailSubject = $template_data['template_subject'];
            $from_email = Mage::getStoreConfig('trans_email/ident_sales/email');
            //fetch sender email
            $from_name = Mage::getStoreConfig('trans_email/ident_sales/name');
            //fetch sender name
            $sender = array('name' => 'msupply', 'email' => 'no-reply@msupply.com');
            $mailfirstname = $customer->getFirstname();
            $vars = array('newpassword' => trim($data['new_password']), 'firstname' => $mailfirstname);
            $email = $customer->getEmail();
            $storeId = Mage::app()->getStore()->getId();
            $model = $mailTemplate->setReplyTo($sender['email'])->setTemplateSubject($mailSubject);
            $model->sendTransactional($templateId, $sender, $email, 'msupply', $vars, $storeId);
            //sms
            $sms = new Celusion_SMSConneXion_Model_Observer();
            $observer = new Varien_Event_Observer();
            $observer->setData(array('customer' => $customer));
            $sms->sendUpdatePasswordAlertsApi($observer);
            $proArr['message'] = "sent";
            $proArr['status'] = 'ok';
        } else {
            $proArr['message'] = "user_id doesnot match";
            $proArr['status'] = 'failed';
        }
    } else {
        $proArr['message'] = "user_id and new_password is required";
        $proArr['status'] = 'failed';
    }
    return $proArr;
}
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:42,代码来源:customerMail.php

示例12: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     Mage::init();
     $this->_getInstaller()->setDataModel($this->_getDataModel());
 }
开发者ID:rorteg,项目名称:magento2,代码行数:8,代码来源:Console.php

示例13: define

define('MAGENTO_ROOT', getcwd());
//Initialize Magento
require_once MAGENTO_ROOT . '/app/Mage.php';
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
$website = 'base';
if (isset($_SERVER['SERVER_NAME'])) {
    switch ($_SERVER['SERVER_NAME']) {
        case 'website.address.com':
            $website = 'website_code';
            break;
    }
}
$mageRunType = 'website';
Mage::init($website, $mageRunType);
try {
    $code = 'media_gallery';
    $attribute = Mage::getSingleton('eav/config')->getAttribute('catalog_product', $code);
    $table = Mage_Catalog_Model_Resource_Product_Attribute_Backend_Media::GALLERY_TABLE;
    $connection = Mage::getSingleton('core/resource')->getConnection('default_read');
    $select = $connection->select()->from($attribute->getResource()->getTable($table), 'value')->where('attribute_id=?', $attribute->getId())->distinct();
    $images = $connection->fetchCol($select);
    unset($attribute);
    unset($connection);
    unset($select);
    Mage::log($website, null, 's3.log');
    $totalImages = count($images);
    Mage::log($totalImages . ' images to process', null, 's3.log');
    //Get settings for S3
    $accessKey = Mage::getStoreConfig(MVentory_CDN_Model_Config::ACCESS_KEY);
开发者ID:sebastianwahn,项目名称:MVentory_S3CDN,代码行数:31,代码来源:upload-to-s3.php

示例14: str_replace

$pathInfo = str_replace('..', '', ltrim($request->getPathInfo(), '/'));
$filePath = str_replace('/', DS, $publicDirectory . DS . $pathInfo);
if ($mediaDirectory) {
    if (0 !== stripos($pathInfo, $mediaDirectory . '/') || is_dir($filePath)) {
        sendNotFoundPage();
    }
    $relativeFilename = str_replace($mediaDirectory . '/', '', $pathInfo);
    checkResource($relativeFilename, $allowedResources);
    sendFile($filePath);
}
$appOptions = new Mage_Core_Model_App_Options($_SERVER);
if (empty($mediaDirectory)) {
    Mage::init($appOptions->getRunCode(), $appOptions->getRunType(), $appOptions->getRunOptions());
} else {
    $appRunOptions = array_merge($appOptions->getRunOptions(), array('cache' => array('disallow_save' => true)));
    Mage::init($appOptions->getRunCode(), $appOptions->getRunType(), $appRunOptions, array('Mage_Core'));
}
Mage::app()->requireInstalledInstance();
if (!$mediaDirectory) {
    $config = Mage_Core_Model_File_Storage::getScriptConfig();
    $mediaDirectory = str_replace($publicDirectory, '', $config['media_directory']);
    $allowedResources = array_merge($allowedResources, $config['allowed_resources']);
    $relativeFilename = str_replace($mediaDirectory . '/', '', $pathInfo);
    $fp = fopen($configCacheFile, 'w');
    if (flock($fp, LOCK_EX | LOCK_NB)) {
        ftruncate($fp, 0);
        fwrite($fp, json_encode($config));
    }
    flock($fp, LOCK_UN);
    fclose($fp);
    checkResource($relativeFilename, $allowedResources);
开发者ID:natxetee,项目名称:magento2,代码行数:31,代码来源:get.php

示例15: sendFile

    sendFile($filePath);
}
$mageFilename = 'app/Mage.php';
if (!file_exists($mageFilename)) {
    echo $mageFilename . ' was not found';
}
require_once $mageFilename;
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';
if (empty($mediaDirectory)) {
    Mage::init($mageRunCode, $mageRunType);
} else {
    Mage::init($mageRunCode, $mageRunType, array(), array('Mage_Core'));
}
if (!$mediaDirectory) {
    $config = Mage_Core_Model_File_Storage::getScriptConfig();
    $mediaDirectory = str_replace($bp . $ds, '', $config['media_directory']);
    $allowedResources = array_merge($allowedResources, $config['allowed_resources']);
    $relativeFilename = str_replace($mediaDirectory . '/', '', $pathInfo);
    $fp = fopen($configCacheFile, 'w');
    if (flock($fp, LOCK_EX | LOCK_NB)) {
        ftruncate($fp, 0);
        fwrite($fp, json_encode($config));
    }
    flock($fp, LOCK_UN);
    fclose($fp);
    checkResource($relativeFilename, $allowedResources);
}
开发者ID:lightyoruichi,项目名称:Magento-Pre-Patched-Files,代码行数:31,代码来源:get.php


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