本文整理汇总了PHP中AO::getModuleDir方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::getModuleDir方法的具体用法?PHP AO::getModuleDir怎么用?PHP AO::getModuleDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AO
的用法示例。
在下文中一共展示了AO::getModuleDir方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getControllerFileName
public function getControllerFileName($realModule, $controller)
{
$parts = explode('_', $realModule);
$realModule = implode('_', array_splice($parts, 0, 2));
$file = AO::getModuleDir('controllers', $realModule);
if (count($parts)) {
$file .= DS . implode(DS, $parts);
}
$file .= DS . uc_words($controller, DS) . 'Controller.php';
return $file;
}
示例2: getTimelineData
public function getTimelineData()
{
return file_get_contents(AO::getModuleDir('etc', 'Mage_Reports') . DS . 'flexTestDataTimeline.xml');
}
示例3: getCharsetOption
/**
* Deprecated
*
* @return string
*/
public function getCharsetOption()
{
$options = '';
$fileName = AO::getModuleDir('etc', 'Mage_Oscommerce') . DS . 'charsets.xml';
if (is_readable($fileName)) {
$xml = new Varien_Simplexml_Config();
$xml->loadFile($fileName);
$charsets = $xml->getNode('charset');
foreach ($charsets as $charset) {
$attributes = $charset->attributes();
$options .= '<option value=' . $attributes['name'] . '>' . $charset->family . ' (' . $attributes['name'] . ')</option>';
}
}
return $options;
}
示例4: run
/**
* Run webservice
*
* @param Mage_Api_Controller_Action $controller
* @return Mage_Api_Model_Server_Adapter_Soap
*/
public function run()
{
$urlModel = AO::getModel('core/url')->setUseSession(false);
if ($this->getController()->getRequest()->getParam('wsdl')) {
// Generating wsdl content from template
$io = new Varien_Io_File();
$io->open(array('path' => AO::getModuleDir('etc', 'Mage_Api')));
$wsdlContent = $io->read('wsdl.xml');
$template = AO::getModel('core/email_template_filter');
$wsdlConfig = new Varien_Object();
$queryParams = $this->getController()->getRequest()->getQuery();
if (isset($queryParams['wsdl'])) {
unset($queryParams['wsdl']);
}
$wsdlConfig->setUrl(htmlspecialchars($urlModel->getUrl('*/*/*', array('_query' => $queryParams))));
$wsdlConfig->setName('Magento');
$wsdlConfig->setHandler($this->getHandler());
$template->setVariables(array('wsdl' => $wsdlConfig));
$this->getController()->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($template->filter($wsdlContent));
} elseif ($this->_extensionLoaded()) {
$this->_soap = new SoapServer($urlModel->getUrl('*/*/*', array('wsdl' => 1)));
use_soap_error_handler(false);
$this->_soap->setClass($this->getHandler());
$this->getController()->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->_soap->handle());
} else {
$this->fault('0', 'Unable to load Soap extension on the server');
}
return $this;
}
示例5: _modifyResourceDb
/**
* Run module modification sql
*
* @param string $actionType install|upgrade|uninstall
* @param string $fromVersion
* @param string $toVersion
* @return bool
*/
protected function _modifyResourceDb($actionType, $fromVersion, $toVersion)
{
$resModel = (string) $this->_connectionConfig->model;
$modName = (string) $this->_moduleConfig[0]->getName();
$sqlFilesDir = AO::getModuleDir('sql', $modName) . DS . $this->_resourceName;
if (!is_dir($sqlFilesDir) || !is_readable($sqlFilesDir)) {
AO::getResourceModel('core/resource')->setDbVersion($this->_resourceName, $toVersion);
return $toVersion;
}
// Read resource files
$arrAvailableFiles = array();
$sqlDir = dir($sqlFilesDir);
while (false !== ($sqlFile = $sqlDir->read())) {
$matches = array();
if (preg_match('#^' . $resModel . '-' . $actionType . '-(.*)\\.(sql|php)$#i', $sqlFile, $matches)) {
$arrAvailableFiles[$matches[1]] = $sqlFile;
}
}
$sqlDir->close();
if (empty($arrAvailableFiles)) {
AO::getResourceModel('core/resource')->setDbVersion($this->_resourceName, $toVersion);
return $toVersion;
}
// Get SQL files name
$arrModifyFiles = $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrAvailableFiles);
if (empty($arrModifyFiles)) {
AO::getResourceModel('core/resource')->setDbVersion($this->_resourceName, $toVersion);
return $toVersion;
}
$modifyVersion = null;
foreach ($arrModifyFiles as $resourceFile) {
$sqlFile = $sqlFilesDir . DS . $resourceFile['fileName'];
$fileType = pathinfo($resourceFile['fileName'], PATHINFO_EXTENSION);
// Execute SQL
if ($this->_conn) {
try {
switch ($fileType) {
case 'sql':
$sql = file_get_contents($sqlFile);
if ($sql != '') {
$result = $this->run($sql);
} else {
$result = true;
}
break;
case 'php':
$conn = $this->_conn;
/**
* useful variables:
* - $conn: setup db connection
* - $sqlFilesDir: root dir for sql update files
*/
try {
#$conn->beginTransaction();
$result = (include $sqlFile);
#$conn->commit();
} catch (Exception $e) {
#$conn->rollback();
throw $e;
}
break;
default:
$result = false;
}
if ($result) {
/*$this->run("replace into ".$this->getTable('core/resource')." (code, version) values ('".$this->_resourceName."', '".$resourceFile['toVersion']."')");*/
AO::getResourceModel('core/resource')->setDbVersion($this->_resourceName, $resourceFile['toVersion']);
}
} catch (Exception $e) {
echo "<pre>" . print_r($e, 1) . "</pre>";
throw AO::exception('Mage_Core', AO::helper('core')->__('Error in file: "%s" - %s', $sqlFile, $e->getMessage()));
}
}
$modifyVersion = $resourceFile['toVersion'];
}
if ($actionType == 'upgrade' && $modifyVersion != $toVersion) {
AO::getResourceModel('core/resource')->setDbVersion($this->_resourceName, $toVersion);
} else {
$toVersion = $modifyVersion;
}
self::$_hadUpdates = true;
return $toVersion;
}
示例6: getDashboard
public function getDashboard()
{
return file_get_contents(AO::getModuleDir('etc', 'Mage_Reports') . DS . 'flexDashboard.xml');
}