本文整理汇总了PHP中WebModule类的典型用法代码示例。如果您正苦于以下问题:PHP WebModule类的具体用法?PHP WebModule怎么用?PHP WebModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebModule类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: initializeForCommand
public function initializeForCommand()
{
switch ($this->command) {
case 'notice':
$response = null;
$responseVersion = 1;
if ($this->getOptionalModuleVar('BANNER_ALERT', false, 'notice')) {
$noticeData = $this->getOptionalModuleSection('notice');
if ($noticeData) {
$response = array('notice' => '', 'moduleID' => null, 'link' => $this->getOptionalModuleVar('BANNER_ALERT_MODULE_LINK', false, 'notice'));
// notice can either take a module or data model class or retriever class. The section is passed on. It must implement the HomeAlertInterface interface
if (isset($noticeData['BANNER_ALERT_MODULE'])) {
$moduleID = $noticeData['BANNER_ALERT_MODULE'];
$controller = WebModule::factory($moduleID);
$response['moduleID'] = $moduleID;
$string = "Module {$moduleID}";
} elseif (isset($noticeData['BANNER_ALERT_MODEL_CLASS'])) {
$controller = DataModel::factory($noticeData['BANNER_ALERT_MODEL_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_MODEL_CLASS'];
} elseif (isset($noticeData['BANNER_ALERT_RETRIEVER_CLASS'])) {
$controller = DataRetriever::factory($noticeData['BANNER_ALERT_RETRIEVER_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_RETRIEVER_CLASS'];
} else {
throw new KurogoConfigurationException("Banner alert not properly configured");
}
if (!$controller instanceof HomeAlertInterface) {
throw new KurogoConfigurationException("{$string} does not implement HomeAlertModule interface");
}
$response['notice'] = $controller->getHomeScreenAlert();
}
}
$this->setResponse($response);
$this->setResponseVersion($responseVersion);
break;
case 'modules':
if ($setcontext = $this->getArg('setcontext')) {
Kurogo::sharedInstance()->setUserContext($setcontext);
}
$responseVersion = 2;
$response = array('primary' => array(), 'secondary' => array(), 'customize' => $this->getOptionalModuleVar('ALLOW_CUSTOMIZE', true), 'displayType' => $this->getOptionalModuleVar('display_type', 'springboard'));
$allmodules = $this->getAllModules();
$navModules = Kurogo::getSiteSections('navigation', Config::APPLY_CONTEXTS_NAVIGATION);
foreach ($navModules as $moduleID => $moduleData) {
if ($module = Kurogo::arrayVal($allmodules, $moduleID)) {
$title = Kurogo::arrayVal($moduleData, 'title', $module->getModuleVar('title'));
$type = Kurogo::arrayVal($moduleData, 'type', 'primary');
$visible = Kurogo::arrayVal($moduleData, 'visible', 1);
$response[$type][] = array('tag' => $moduleID, 'title' => $title, 'visible' => (bool) $visible);
}
}
$this->setResponse($response);
$this->setResponseVersion($responseVersion);
break;
default:
$this->invalidCommand();
}
}
开发者ID:sponto,项目名称:msbm-mobile,代码行数:57,代码来源:HomeAPIModule.php
示例2: getCreditsHTML
protected function getCreditsHTML()
{
//get original device
$device = Kurogo::deviceClassifier()->getDevice();
//set browser to unknown so we don't get AppQ HTML
Kurogo::deviceClassifier()->setBrowser('unknown');
$module = WebModule::factory($this->configModule, 'credits_html');
$html = $module->fetchPage();
//restore device
Kurogo::deviceClassifier()->setDevice($device);
return $html;
}
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:12,代码来源:AboutAPIModule.php
示例3: initializeForCommand
public function initializeForCommand()
{
switch ($this->command) {
case 'notice':
$response = null;
$responseVersion = 1;
if ($this->getOptionalModuleVar('BANNER_ALERT', false, 'notice')) {
$noticeData = $this->getOptionalModuleSection('notice');
if ($noticeData) {
$response = array('notice' => '', 'moduleID' => null, 'link' => $this->getOptionalModuleVar('BANNER_ALERT_MODULE_LINK', false, 'notice'));
// notice can either take a module or data model class or retriever class. The section is passed on. It must implement the HomeAlertInterface interface
if (isset($noticeData['BANNER_ALERT_MODULE'])) {
$moduleID = $noticeData['BANNER_ALERT_MODULE'];
$controller = WebModule::factory($moduleID);
$response['moduleID'] = $moduleID;
$string = "Module {$moduleID}";
} elseif (isset($noticeData['BANNER_ALERT_MODEL_CLASS'])) {
$controller = DataModel::factory($noticeData['BANNER_ALERT_MODEL_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_MODEL_CLASS'];
} elseif (isset($noticeData['BANNER_ALERT_RETRIEVER_CLASS'])) {
$controller = DataRetriever::factory($noticeData['BANNER_ALERT_RETRIEVER_CLASS'], $noticeData);
$string = $noticeData['BANNER_ALERT_RETRIEVER_CLASS'];
} else {
throw new KurogoConfigurationException("Banner alert not properly configured");
}
if (!$controller instanceof HomeAlertInterface) {
throw new KurogoConfigurationException("{$string} does not implement HomeAlertModule interface");
}
$response['notice'] = $controller->getHomeScreenAlert();
}
}
$this->setResponse($response);
$this->setResponseVersion($responseVersion);
break;
default:
$this->invalidCommand();
}
}
开发者ID:nncsang,项目名称:Kurogo,代码行数:38,代码来源:HomeAPIModule.php
示例4: createDefaultFile
protected function createDefaultFile($file, $type)
{
switch ($type)
{
case 'site':
$_file = $this->getFileByType($file, $type);
$defaultFile = $this->getFileByType($file, $type.'-default');
if (file_exists($defaultFile)) {
$this->createDirIfNotExists(dirname($_file));
return @copy($defaultFile, $_file);
}
return false;
break;
case 'module':
//check to see if the module has a default config file first
$_file = $this->getFileByType($file, $type);
$defaultFile = $this->getFileByType($file, $type.'-default');
if (file_exists($defaultFile)) {
$this->createDirIfNotExists(dirname($_file));
return @copy($defaultFile, $_file);
} elseif ($module = WebModule::factory($file)) {
return $module->createDefaultConfigFile();
} else {
throw new Exception("Module $file not found");
}
break;
case 'file':
$defaultFile = $this->getFileByType($file, $type.'-default');
if (file_exists($defaultFile)) {
$this->createDirIfNotExists(dirname($file));
return @copy($defaultFile, $file);
}
return false;
break;
}
}
开发者ID:rezalutions,项目名称:Kurogo-Mobile-Web,代码行数:39,代码来源:ConfigFile.php
示例5: initializeForPage
protected function initializeForPage() {
$this->addJQuery();
switch ($this->page)
{
case 'module':
$moduleID = $this->getArg('moduleID');
if (empty($moduleID)) {
$this->redirectTo('modules');
}
$module = WebModule::factory($moduleID);
$moduleData = $module->getModuleData();
$moduleSections = array();
if ($section = $this->getArg('section')) {
if ($section=='feeds' && $module->hasFeeds()) {
if (strlen($this->getArg('removeFeed'))>0) {
$index = $this->getArg('removeFeed');
$module->removeFeed($index);
}
if ($this->getArg('addFeed')) {
$feedData = $this->getArg('addFeedData');
if (!$module->addFeed($feedData, $error)) {
$this->assign('errorMessage', $error);
}
}
$moduleData['feeds'] = $module->loadFeedData();
if (!$moduleData['feeds']) {
$moduleData['feeds'] = array();
}
$this->assign('feedURL', $this->buildBreadcrumbURL('module', array(
'moduleID'=>$moduleID,
'section'=>$section),false
));
$this->assign('feedFields', $module->getFeedFields());
} elseif (!isset($moduleData[$section])) {
$this->redirectTo('module', array('moduleID'=>$moduleID), false);
}
}
if ($this->getArg('submit')) {
$merge = $this->getArg('merge', true);
if ($merge) {
$moduleData = $this->prepareSubmitData('moduleData');
$moduleData = array_merge($module->getModuleDefaultData(), $moduleData);
} else {
$moduleData = $this->prepareSubmitData('moduleData');
}
if ($section) {
$moduleData = array($section=>$moduleData[$section]);
} else {
/* only include the scalar values since array values come from sections */
$_data = array();
foreach ($moduleData as $var=>$val) {
if (is_scalar($val)) {
$_data[$var] = $val;
}
$moduleData = $_data;
}
}
$module->saveConfig($moduleData, $section);
if ($section) {
$this->redirectTo('module', array('moduleID'=>$moduleID), false);
} else {
$this->redirectTo('modules', false, false);
}
}
$this->setPageTitle(sprintf("Administering %s module", $moduleData['title']));
$this->setBreadcrumbTitle($moduleData['title']);
$this->setBreadcrumbLongTitle($moduleData['title']);
$formListItems = array();
if ($section) {
$moduleData = $moduleData[$section];
} else {
$formListItems[] = $this->getModuleItemForKey('id', $moduleID);
}
foreach ($moduleData as $key=>$value) {
if (is_scalar($value)) {
$formListItems[] = $module->getModuleItemForKey($key, $value);
} else {
$moduleSections[$key] = $module->getSectionTitleForKey($key);
}
}
if (!$section) {
foreach ($moduleSections as $key=>$title) {
$formListItems[] = array(
'type'=>'url',
'name'=>$title,
'value'=>$this->buildBreadcrumbURL('module', array(
//.........这里部分代码省略.........
开发者ID:nicosiseng,项目名称:Kurogo-Mobile-Web,代码行数:101,代码来源:AdminWebModule.php
示例6: initializeForCommand
public function initializeForCommand()
{
$this->requiresAdmin();
switch ($this->command) {
case 'checkversion':
$current = Kurogo::sharedInstance()->checkCurrentVersion();
Kurogo::log(LOG_INFO, sprintf("Checking version. This site: %s Current Kurogo Version: %s", $current, KUROGO_VERSION), 'admin');
$uptodate = version_compare(KUROGO_VERSION, $current, ">=");
$messageKey = $uptodate ? 'KUROGO_VERSION_MESSAGE_UPTODATE' : 'KUROGO_VERSION_MESSAGE_NOTUPDATED';
$data = array('current' => $current, 'local' => KUROGO_VERSION, 'uptodate' => $uptodate, 'message' => $this->getLocalizedString($messageKey, $current, KUROGO_VERSION));
$this->setResponse($data);
$this->setResponseVersion(1);
break;
case 'getlocalizedstring':
$key = $this->getArg('key');
$data = array();
if (is_array($key)) {
foreach ($key as $k) {
$data[$k] = $this->getLocalizedString($k);
}
} else {
$data[$key] = $this->getLocalizedString($key);
}
$this->setResponse($data);
$this->setResponseVersion(1);
break;
case 'clearcaches':
Kurogo::log(LOG_NOTICE, "Clearing Site Caches", 'admin');
$result = Kurogo::sharedInstance()->clearCaches();
if ($result === 0) {
$this->setResponse(true);
$this->setResponseVersion(1);
} else {
$this->throwError(new KurogoError(1, "Error clearing caches", "There was an error ({$result}) clearing the caches"));
}
break;
case 'upload':
$type = $this->getArg('type');
$section = $this->getArg('section', '');
$subsection = null;
switch ($type) {
case 'module':
$moduleID = $this->getArg('module', '');
$module = WebModule::factory($moduleID);
$type = $module;
break;
case 'site':
break;
default:
throw new KurogoConfigurationException("Invalid type {$type}");
}
if (count($_FILES) == 0) {
throw new KurogoException("No files uploaded");
}
foreach ($_FILES as $key => $uploadData) {
$this->uploadFile($type, $section, $subsection, $key, $uploadData);
}
$this->setResponseVersion(1);
$this->setResponse(true);
break;
case 'getconfigsections':
$type = $this->getArg('type');
switch ($type) {
case 'module':
$moduleID = $this->getArg('module', '');
$module = WebModule::factory($moduleID);
$sections = $module->getModuleAdminSections();
break;
case 'site':
throw new KurogoConfigurationException("getconfigsections for site not handled yet");
}
$this->setResponse($sections);
$this->setResponseVersion(1);
break;
case 'getconfigdata':
$type = $this->getArg('type');
$section = $this->getArg('section', '');
switch ($type) {
case 'module':
$moduleID = $this->getArg('module', '');
$module = WebModule::factory($moduleID);
$adminData = $this->getAdminData($module, $section);
break;
case 'site':
$adminData = $this->getAdminData('site', $section);
break;
}
$this->setResponse($adminData);
$this->setResponseVersion(1);
break;
case 'setconfigdata':
$type = $this->getArg('type');
$data = $this->getArg('data', array());
$section = $this->getArg('section', '');
$subsection = null;
if (empty($data)) {
$data = array();
} elseif (!is_array($data)) {
throw new KurogoConfigurationException("Invalid data for {$type} {$section}");
}
//.........这里部分代码省略.........
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:101,代码来源:AdminAPIModule.php
示例7: array
<?php
$lines = array('User-agent: *', 'Allow: ' . URL_BASE, 'Disallow: ' . URL_BASE . 'rest/');
foreach (WebModule::getAllModules() as $module) {
if (!$module->allowRobots()) {
$lines[] = 'Disallow: ' . URL_BASE . $module->getConfigModule() . '/';
}
}
$output = implode("\n", $lines) . "\n";
header('Content-type: text/plain');
print $output;
开发者ID:nncsang,项目名称:Kurogo,代码行数:11,代码来源:robots.php
示例8: searchItems
public static function searchItems($moduleID, $searchTerms, $limit = null, $options = null)
{
$module = WebModule::factory($moduleID);
return $module->searchItems($searchTerms, $limit, $options);
}
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:5,代码来源:Kurogo.php
示例9: implode
$parts[0] = $url_redirects[$id];
$url = URL_PREFIX . implode("/", $parts);
}
header("Location: " . $url);
exit;
}
}
// find the page part
if (isset($parts[1])) {
if (strlen($parts[1])) {
$page = basename($parts[1], '.php');
}
} else {
// redirect with trailing slash for completeness
header("Location: ./$id/");
exit;
}
if ($module = WebModule::factory($id, $page, $args)) {
/* log this page view */
PageViews::increment($id, Kurogo::deviceClassifier()->getPlatform());
$module->displayPage();
} else {
throw new Exception("Module $id cannot be loaded");
}
}
exit;
开发者ID:neoroman,项目名称:Kurogo-Mobile-Web,代码行数:30,代码来源:index.php
示例10: afterUninstall
public function afterUninstall()
{
//Удаляем таблицу модуля
Yii::app()->db->createCommand()->dropTable(Page::model()->tableName());
Yii::app()->db->createCommand()->dropTable(PageTranslate::model()->tableName());
return parent::afterUninstall();
}
开发者ID:buildshop,项目名称:bs-common,代码行数:7,代码来源:PagesModule.php
示例11: getModuleDefaultData
protected function getModuleDefaultData()
{
return array_merge(parent::getModuleDefaultData(), array(
'url'=>''
)
);
}
开发者ID:nicosiseng,项目名称:Kurogo-Mobile-Web,代码行数:7,代码来源:FullwebWebModule.php
示例12: afterUninstall
public function afterUninstall()
{
Yii::app()->settings->clear('exchange1c');
$db = Yii::app()->db;
$db->createCommand()->dropTable('{{exchange1c}}');
return parent::afterUninstall();
}
开发者ID:buildshop,项目名称:bs-common,代码行数:7,代码来源:Exchange1cModule.php
示例13: init
/**
* Module constructor - Builds the initial module data
*
* @author vadim
*/
public function init()
{
// Set error handler
Yii::app()->errorHandler->errorAction = 'site/error/error';
/* Make sure we run the master module init function */
parent::init();
}
开发者ID:YiiCoded,项目名称:yii-ecommerce,代码行数:12,代码来源:SiteModule.php
示例14: prepareAdminForSection
protected function prepareAdminForSection($section, &$adminModule) {
switch ($section) {
case 'primary_modules':
case 'secondary_modules':
$adminModule->setTemplatePage('module_order', $this->id);
$adminModule->addInternalJavascript("/modules/{$this->id}/javascript/admin.js");
$adminModule->addInternalCSS("/modules/{$this->id}/css/admin.css");
$allModules = $this->getAllModules();
$navigationModules = $this->getNavigationModules();
foreach ($allModules as $moduleID=>$module) {
$allModules[$moduleID] = $module->getModuleName();
}
foreach ($navigationModules[rtrim($section,'_modules')] as $moduleID=>$module) {
$sectionModules[$moduleID] = $module['title'];
}
$adminModule->assign('allModules', $allModules);
$adminModule->assign('sectionModules', $sectionModules);
break;
default:
return parent::prepareAdminForSection($section, $adminModule);
}
}
开发者ID:nicosiseng,项目名称:Kurogo-Mobile-Web,代码行数:27,代码来源:HomeWebModule.php
示例15: beforeControllerAction
public function beforeControllerAction($controller, $action)
{
if (parent::beforeControllerAction($controller, $action)) {
return true;
} else {
return false;
}
}
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:8,代码来源:MailerModule.php
示例16: afterUninstall
public function afterUninstall()
{
//Удаляем таблицу модуля
Yii::app()->settings->clear('news');
Yii::app()->db->createCommand()->dropTable(News::model()->tableName());
Yii::app()->db->createCommand()->dropTable(NewsTranslate::model()->tableName());
return parent::afterUninstall();
}
开发者ID:buildshop,项目名称:bs-common,代码行数:8,代码来源:NewsModule.php
示例17: afterUninstall
public function afterUninstall()
{
$db = Yii::app()->db;
$tablesArray = array(Wishlist::model()->tableName(), WishlistProducts::model()->tableName());
foreach ($tablesArray as $table) {
$db->createCommand()->dropTable($table);
}
return parent::afterUninstall();
}
开发者ID:buildshop,项目名称:bs-common,代码行数:9,代码来源:WishlistModule.php
示例18: afterInstall
public function afterInstall()
{
if (Yii::app()->hasModule('shop')) {
return parent::afterInstall();
} else {
Yii::app()->controller->addFlashMessage('Ошибка, Модуль интернет-магазин не устрановлен.');
return false;
}
}
开发者ID:buildshop,项目名称:bs-common,代码行数:9,代码来源:CompareModule.php
示例19: afterUninstall
public function afterUninstall()
{
Yii::app()->settings->clear('contacts');
$db = Yii::app()->db;
$db->createCommand()->dropTable(ContactsMaps::model()->tableName());
$db->createCommand()->dropTable(ContactsMarkers::model()->tableName());
$db->createCommand()->dropTable(ContactsRouter::model()->tableName());
$db->createCommand()->dropTable(ContactsRouterTranslate::model()->tableName());
return parent::afterUninstall();
}
开发者ID:buildshop,项目名称:bs-common,代码行数:10,代码来源:ContactsModule.php
示例20: afterUninstall
public function afterUninstall()
{
$db = Yii::app()->db;
$tablesArray = array(ShopDiscount::model()->tableName(), $db->tablePrefix . 'shop_discount_category', $db->tablePrefix . 'shop_discount_manufacturer');
foreach ($tablesArray as $table) {
$db->createCommand()->dropTable($table);
}
GridColumns::model()->deleteAll("grid_id='shopdiscount-grid'");
return parent::afterUninstall();
}
开发者ID:buildshop,项目名称:bs-common,代码行数:10,代码来源:DiscountsModule.php
注:本文中的WebModule类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论