本文整理汇总了PHP中Mage::getModuleDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::getModuleDir方法的具体用法?PHP Mage::getModuleDir怎么用?PHP Mage::getModuleDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::getModuleDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTransport
public function getTransport($storeId)
{
$_helper = Mage::helper('smtppro');
$_helper->log("Getting Amazon SES Transport");
$path = Mage::getModuleDir('', 'Aschroder_SMTPPro');
include_once $path . '/lib/AmazonSES.php';
$emailTransport = new App_Mail_Transport_AmazonSES(array('accessKey' => $_helper->getAmazonSESAccessKey($storeId), 'privateKey' => $_helper->getAmazonSESPrivateKey($storeId)));
return $emailTransport;
}
示例2: loginRadiusSocialLinking
/**
*
* @param type $entityId
* @param type $profileData
* @return type
*/
public function loginRadiusSocialLinking($entityId, $profileData)
{
$session = Mage::getSingleton('customer/session');
$redirectionLink = 'customer/account';
$activationBlockObj = Mage::getBlockSingleton('activation/activation');
$socialLoginLinkData = array();
$socialLoginLinkData['sociallogin_id'] = $profileData->ID;
$socialLoginLinkData['entity_id'] = $entityId;
$socialLoginLinkData['provider'] = $profileData->Provider;
$socialLoginLinkData['avatar'] = $this->socialLoginFilterAvatar($socialLoginLinkData['sociallogin_id'], $profileData->ThumbnailImageUrl, $socialLoginLinkData['provider']);
$socialLoginLinkData['uid'] = isset($profileData->Uid) ? $profileData->Uid : '';
$socialLoginLinkData['status'] = 'unblocked';
if ($activationBlockObj->raasEnable() == 1) {
if ($this->loginRadiusRead("lr_sociallogin", "provider exists in sociallogin", array($entityId, $socialLoginLinkData['provider']))) {
$redirectionLink .= '?LoginRadiusLinked=0';
} else {
$customerEntity['uid'] = Mage::getSingleton("customer/session")->getLoginRadiusUid();
if (isset($customerEntity['uid']) && !empty($customerEntity['uid'])) {
require_once Mage::getModuleDir('', 'Loginradius_Sociallogin') . DS . 'Helper' . DS . 'SDKClient.php';
global $apiClient_class;
$apiClient_class = 'Loginradius_Sociallogin_Helper_SDKClient';
$activationBlockObj = Mage::getBlockSingleton('activation/activation');
$accountAPI = new LoginRadiusSDK\CustomerRegistration\AccountAPI($activationBlockObj->apiKey(), $activationBlockObj->apiSecret(), array('output_format' => 'json'));
$innerJoinQuery = $this->getCustomerData(array('customer_entity', 'lr_sociallogin'), array($socialLoginLinkData['sociallogin_id']), 'id');
if ($innerJoinQuery->fetch()) {
Mage::getSingleton('core/session')->addError('Account already exists or linked with another account.');
} else {
try {
$response = $accountAPI->accountLink($customerEntity['uid'], $socialLoginLinkData['sociallogin_id'], $socialLoginLinkData['provider']);
if (isset($response->isPosted) && $response->isPosted == true) {
$this->SocialLoginInsert("lr_sociallogin", $socialLoginLinkData);
$session->addSuccess(__('Account linked successfully.'));
} else {
$session->addError(__('An Error here'));
}
} catch (\LoginRadiusSDK\LoginRadiusException $e) {
$session->addError($e->getErrorResponse()->description);
}
}
}
}
} else {
// check if any account from this provider is already linked
$existAccount = $this->getCustomerData(array('customer_entity', 'lr_sociallogin'), array($socialLoginLinkData['sociallogin_id']), 'id');
if (is_array($existAccount->fetch())) {
$session->addError(__('This accounts is already linked with an account.'));
} elseif ($this->loginRadiusRead("lr_sociallogin", "provider exists in sociallogin", array($entityId, $socialLoginLinkData['provider']))) {
$session->addError(__('Multiple accounts cannot be linked from the same Social ID Provider.'));
} else {
$this->SocialLoginInsert("lr_sociallogin", $socialLoginLinkData);
$session->addSuccess(__('Account linked successfully.'));
}
}
Mage::app()->getResponse()->setRedirect(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . $redirectionLink);
return;
}
示例3: fetchView
public function fetchView($fileName)
{
//ignores file name, just uses a simple include with template name
$path = Mage::getModuleDir('', 'Alanstormdotcom_Developermanual');
$this->setScriptPath($path . '/templates');
return parent::fetchView($this->getTemplate());
}
示例4: getCssOutput
public function getCssOutput()
{
$args = explode('::', $this->getCss());
$file = Mage::getModuleDir('', $args[0]) . '/view/frontend/web/' . $args[1];
$url = str_replace(Mage::getBaseDir(), rtrim(Mage::getBaseUrl(), '/'), $file);
return sprintf('<link rel="stylesheet" href="%s"/>', $url);
}
示例5: fetchView
public function fetchView($fileName)
{
//ignores file name, just uses a simple include with template name
$path = Mage::getModuleDir('', 'Richardma_Exportorder');
$this->setScriptPath($path . '/templates');
return parent::fetchView($this->getTemplate());
}
示例6: _toHtml
protected function _toHtml()
{
if (is_link(dirname(Mage::getModuleDir('', 'PostcodeNl_Api'))) && !Mage::getStoreConfig('dev/template/allow_symlink')) {
throw new Mage_Core_Exception('Postcode.nl API Development: Symlinks not enabled! (set at Admin->System->Configuration->Advanced->Developer->Template Settings)');
}
return parent::_toHtml();
}
示例7: loadStub
/**
* stub import
* @return Xcom_Stub_Model_Updater
*/
public function loadStub()
{
$dirPath = Mage::getModuleDir('etc', 'Xcom_Stub');
$filePath = $dirPath . DS . 'stub.txt';
$file = fopen($filePath, 'rb');
$stub = Mage::getModel('xcom_stub/message');
try {
$stub->getResource()->clearStubTable();
if (filesize($filePath)) {
$data = unserialize(fread($file, filesize($filePath)));
foreach ($data as $row) {
unset($row[$stub->getIdFieldName()]);
foreach ($row as $key => $value) {
$stub->setData($key, $value);
}
$stub->save();
$stub->unsetData();
}
}
fclose($file);
} catch (Exception $e) {
fclose($file);
Mage::throwException($e->getMessage());
}
return $this;
}
示例8: _loadUpdateFileFromRequest
protected function _loadUpdateFileFromRequest()
{
$path_update = Mage::getModuleDir('', 'Nofrills_Booklayout') . DS . 'content-updates' . DS . $this->getFullActionName() . '.xml';
/*@davidselo: as� es como funciona el handle asociado al controlados que est� saltando
* en Magento pondriamos en el layour <nofrill_reference_fox>
* Module Name: nofrills booklayout
* Controller Name: reference
* Action Name: fox
* Es esencial para itentificar unicamente cualquier petici�n basandose en estos tres criterios.
* */
$layout = Mage::getSingleton('core/layout')->getUpdate()->addUpdate(file_get_contents($path_update));
//var_dump($layout);
/*PANTALLA:
* <block type="nofrills_booklayout/template" name="root" template="simple-page/2col.phtml" output="toHtml">
* <block type="nofrills_booklayout/template" name="additional_head" template="simple-page/head.phtml" />
* <block type="nofrills_booklayout/template" name="sidebar">
* <action method="setTemplate"><template>simple-page/sidebar.phtml</template></action>
* </block>
* <block type="core/text_list" name="content" />
* </block>
* <reference name="content">
* <block type="core/text" name="our_message">
* <action method="setText"><text>
* Magento is a foxy system.
* </text></action>
* </block>
* </reference>
* <remove name="sidebar" />"
*
* */
}
示例9: toOptionArray
public function toOptionArray($exclude = true)
{
$result = array();
$result['Magento'] = array('label' => 'Magento');
$path = Mage::getModuleDir('', 'Mirasvit_SearchIndex') . DS . 'Model' . DS . 'Index';
$io = new Varien_Io_File();
$io->open();
$io->cd($path);
foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $space) {
$io->cd($space['id']);
foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $module) {
$io->cd($module['id']);
foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $entity) {
if ($io->fileExists($entity['id'] . DS . 'Index.php', true)) {
$indexCode = $space['text'] . '_' . $module['text'] . '_' . $entity['text'];
$index = Mage::helper('searchindex/index')->getIndexModel($indexCode);
if (is_object($index)) {
if ($index->canUse()) {
if (!isset($result[$index->getBaseGroup()])) {
$result[$index->getBaseGroup()] = array('label' => $index->getBaseGroup(), 'value' => array());
}
$result[$index->getBaseGroup()]['value'][] = array('value' => $index->getCode(), 'label' => $index->getBaseTitle());
}
} else {
Mage::throwException('Wrong model for index ' . $indexCode);
}
}
}
}
}
return $result;
}
示例10: extendConfig
/**
* Extend extra configs from etc folder of module on system init configs
*
* @param Varien_Event_Observer $observer
*/
public function extendConfig($observer)
{
$storeCode = Mage::helper("jmbasetheme")->getCurrentStoreCode("backend");
$profiles = array_keys(Mage::helper("jmbasetheme")->getProfiles($storeCode));
$mergeObject = new Mage_Core_Model_Config_Base();
$profilePath = Mage::helper("jmbasetheme")->getProfilePath($storeCode);
foreach ($profiles as $profile) {
if (file_exists($profilePath . "core" . DS . $profile . ".xml")) {
$mergeObject->loadFile($profilePath . "core" . DS . $profile . ".xml");
} else {
$mergeObject->loadFile($profilePath . "local" . DS . $profile . ".xml");
}
$observer->config->extend($mergeObject, false);
}
if (file_exists($profilePath . "core" . DS . "core.xml")) {
$mergeObject->loadFile($profilePath . "core" . DS . "core.xml");
$observer->config->extend($mergeObject, false);
}
//extend tablet settings
$mergeObject->loadFile(Mage::getModuleDir('etc', 'Wavethemes_Jmbasetheme') . "/device.xml");
$observer->config->extend($mergeObject, false);
//extend mobile settings
$mergeObject->loadFile(Mage::getModuleDir('etc', 'Wavethemes_Jmbasetheme') . "/mobile.xml");
$observer->config->extend($mergeObject, false);
}
示例11: postAction
/**
* Submit new review action
*
*/
public function postAction()
{
if (Mage::getStoreConfigFlag(self::XML_PATH_PRC_ENABLED)) {
try {
$post = $this->getRequest()->getPost();
if ($post) {
//include reCaptcha library
require_once Mage::getModuleDir('', 'OlegKoval_ProductReviewCaptcha') . DS . 'Helper' . DS . 'recaptchalib.php';
//validate captcha
$privatekey = Mage::getStoreConfig(self::XML_PATH_PRC_PRIVATE_KEY);
$remote_addr = $this->getRequest()->getServer('REMOTE_ADDR');
$captcha = recaptcha_check_answer($privatekey, $remote_addr, $post["recaptcha_challenge_field"], $post["recaptcha_response_field"]);
if (!$captcha->is_valid) {
throw new Exception($this->__("The reCAPTCHA wasn't entered correctly."), 1);
}
} else {
throw new Exception('', 1);
}
} catch (Exception $e) {
if (strlen($e->getMessage()) > 0) {
Mage::getSingleton('core/session')->addError($this->__($e->getMessage()));
Mage::getSingleton('core/session')->setFormData($post);
}
if ($redirectUrl = Mage::getSingleton('review/session')->getRedirectUrl(true)) {
$this->_redirectUrl($redirectUrl);
return;
}
$this->_redirectReferer();
return;
}
}
//everything is OK - call parent action
parent::postAction();
}
示例12: __construct
function __construct($params)
{
$baseURL = isset($params['enderecoBase']) ? $params['enderecoBase'] : "https://qasecommerce.cielo.com.br";
$certificatePath = isset($params['caminhoCertificado']) && $params['caminhoCertificado'] != "" ? $params['caminhoCertificado'] : Mage::getModuleDir('', 'Maxima_Cielo') . "/ssl/VeriSignClass3PublicPrimaryCertificationAuthority-G5.crt";
$this->_webServiceURL = $baseURL . "/servicos/ecommwsec.do";
$this->_SSLCertificatePath = $certificatePath;
}
示例13: _getModuleConfig
/**
* @param $module
* @return Mage_Core_Model_Config_Base
*/
protected function _getModuleConfig($module)
{
/** @var $moduleConfig Mage_Core_Model_Config_Base */
$moduleConfig = Mage::getModel('core/config_base');
$moduleConfig->loadFile(Mage::getModuleDir('etc', $module) . DS . 'config.xml');
return $moduleConfig;
}
示例14: suite
/**
* This method loads all available test suites for PHPUnit
*
* @return PHPUnit_Framework_TestSuite
*/
public static function suite()
{
$groups = Mage::getConfig()->getNode(self::XML_PATH_UNIT_TEST_GROUPS);
$modules = Mage::getConfig()->getNode(self::XML_PATH_UNIT_TEST_MODULES);
$testSuiteClass = EcomDev_Utils_Reflection::getReflection((string) Mage::getConfig()->getNode(self::XML_PATH_UNIT_TEST_SUITE));
if (!$testSuiteClass->isSubclassOf('EcomDev_PHPUnit_Test_Suite_Group')) {
new RuntimeException('Test Suite class should be extended from EcomDev_PHPUnit_Test_Suite_Group');
}
$suite = new self('Magento Test Suite');
// Walk through different groups in modules for finding test cases
foreach ($groups->children() as $group) {
foreach ($modules->children() as $module) {
$realModule = Mage::getConfig()->getNode('modules/' . $module->getName());
if (!$realModule || !$realModule->is('active')) {
$suite->addTest(self::warning('There is no module with name: ' . $module->getName()));
continue;
}
$moduleCodeDir = Mage::getBaseDir('code') . DS . (string) $realModule->codePool;
$searchPath = Mage::getModuleDir('', $module->getName()) . DS . 'Test' . DS . (string) $group;
if (!is_dir($searchPath)) {
continue;
}
$currentGroups = array($group->getName(), $module->getName());
$testCases = self::_loadTestCases($searchPath, $moduleCodeDir);
foreach ($testCases as $className) {
$suite->addTest($testSuiteClass->newInstance($className, $currentGroups));
}
}
}
if (!$suite->count()) {
$suite->addTest(self::warning('There were no test cases for the current run'));
}
return $suite;
}
示例15: createHtaccesFile
protected function createHtaccesFile()
{
$srcFile = Mage::getModuleDir(null, 'Extendware_EWCore') . DS . 'resources' . DS . '.htaccess.template';
$destFile = $this->getCacheDirectory() . DS . '.htaccess';
if (@filemtime($srcFile) > @filemtime($destFile)) {
@copy($srcFile, $destFile);
}
}