本文整理汇总了PHP中ModuleHandler类的典型用法代码示例。如果您正苦于以下问题:PHP ModuleHandler类的具体用法?PHP ModuleHandler怎么用?PHP ModuleHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* Get single instance of ModuleHandler
*/
public static function getInstance()
{
if (!isset(self::$_instance)) {
self::$_instance = new self();
}
return self::$_instance;
}
示例2: init
function init()
{
// forbit access if the user is not an administrator
if (!$this->grant->manager && !$this->grant->is_admin) {
return $this->stop("msg_is_not_administrator");
}
// change into administration layout
//$this->setTemplatePath('./modules/cympusadmin/tpl');
$this->setLayoutPath('./modules/cympusadmin/tpl');
$this->setLayoutFile(_CYMPUSADMIN_LAYOUT_);
Context::loadLang(_XE_PATH_ . 'modules/cympusadmin/lang/');
if ($this->grant->is_admin) {
// parse admin menu
$oXmlParser = new XmlParser();
$xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_);
$admin_menu = cympusadmin::getMenu($xml_obj->menu->item);
Context::set('cympusadmin_menu', $admin_menu);
} else {
$output = ModuleHandler::triggerCall('cympusadmin.getManagerMenu', 'before', $manager_menu);
if (!$output->toBool()) {
return $output;
}
Context::set('cympusadmin_menu', $manager_menu);
}
$news = getNewsFromAgency();
Context::set('news', $news);
Context::set('admin_bar', 'false');
$oModuleModel =& getModel('module');
$module_info = $oModuleModel->getModuleInfoXml('cympusadmin');
Context::set('cympus_modinfo', $module_info);
return new Object();
}
示例3: __construct
/**
* Constructor
*/
protected function __construct()
{
global $section, $action;
parent::__construct(__FILE__);
// register backend
if (class_exists('backend')) {
$backend = backend::getInstance();
$import_menu = $backend->getMenu('shop_import');
if (!is_null($import_menu)) {
$import_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_import_items'), url_GetFromFilePath($this->path . 'images/import.svg'), window_Open('shop_import_items', 350, $this->getLanguageConstant('title_import_items'), true, true, backend_UrlMake($this->name, 'import')), 6));
$import_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_import_english'), url_GetFromFilePath($this->path . 'images/import.svg'), window_Open('shop_import_items', 350, $this->getLanguageConstant('title_import_items'), true, true, backend_UrlMake($this->name, 'import_english')), 6));
}
}
// register delivery method and create menu items
if (ModuleHandler::is_loaded('backend') && ModuleHandler::is_loaded('shop')) {
require_once 'units/method.php';
require_once 'units/pickup_method.php';
Paid_DeliveryMethod::getInstance($this);
Pickup_DeliveryMethod::getInstance($this);
}
if (ModuleHandler::is_loaded('head_tag') && $section == 'shop' && $action == 'checkout') {
$head_tag = head_tag::getInstance();
$head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/pikaday.js'), 'type' => 'text/javascript'));
$head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/pikaday.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
$head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/checkout.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
}
if (ModuleHandler::is_loaded('backend') && ModuleHandler::is_loaded('head_tag') && $section == 'backend') {
$head_tag = head_tag::getInstance();
$head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/backend.js'), 'type' => 'text/javascript'));
}
// connect transaction handling event
Events::connect('shop', 'transaction-completed', 'on_transaction_completed', $this);
}
示例4: dispMemberSignUpForm
function dispMemberSignUpForm()
{
$oMemberModel =& getModel('member');
if ($oMemberModel->isLogged()) {
return $this->stop('msg_already_logged');
}
$trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $this->member_config);
if (!$trigger_output->toBool()) {
return $trigger_output;
}
if ($this->member_config->enable_join != 'Y') {
return $this->stop('msg_signup_disabled');
}
$oMemberAdminView =& getAdminView('member');
$formTags = $oMemberAdminView->_getMemberInputTag($member_info);
Context::set('formTags', $formTags);
$member_config = $oMemberModel->getMemberConfig();
Context::set('member_config', $member_config);
global $lang;
$identifierForm->title = $lang->{$member_config->identifier};
$identifierForm->name = $member_config->identifier;
$identifierForm->value = $member_info->{$member_config->identifier};
Context::set('identifierForm', $identifierForm);
// Set a template file
$this->setTemplateFile('signup_form');
}
示例5: database_initialize
/**
* Perform database initialization.
*
* @param boolean $create_database
* @return boolean
*/
function database_initialize($create_database)
{
global $db, $db_config, $data_path;
$result = false;
$database_exists = false;
$sql_file = 'units/database/init.sql';
$xml_file = $data_path . 'system_init.xml';
if (!file_exists($sql_file) || !file_exists($xml_file)) {
trigger_error('Can not initialize database, missing configuration!', E_USER_ERROR);
return $result;
}
// make a log entry
trigger_error('Initializing database: ' . $db_config['name'], E_USER_NOTICE);
// get initialization SQL
$sql = file_get_contents($sql_file);
// create database if needed
if ($create_database) {
try {
$db->create($db_config['name']);
$db->select($db_config['name']);
$database_exists = true;
} catch (Exception $error) {
$database_exists = false;
}
} else {
$database_exists = true;
}
// create database
if ($database_exists && $db->multi_query($sql)) {
$module_manager = ModuleManager::getInstance();
$module_handler = ModuleHandler::getInstance();
$admin_manager = UserManager::getInstance();
// populate tables
$raw_data = file_get_contents($xml_file);
$data = new XMLParser($raw_data, $xml_file);
$data->parse();
// go over XML file and insert data
foreach ($data->document->tagChildren as $item) {
switch ($item->tagName) {
case 'module':
// insert data
$module_manager->insertData(array('name' => $item->tagAttrs['name'], 'order' => $item->tagAttrs['order'], 'preload' => $item->tagAttrs['preload'] == 'yes' ? 1 : 0, 'active' => 1));
// initialize module
$module = $module_handler->_loadModule($item->tagAttrs['name']);
if (!is_null($module)) {
$module->onInit();
}
break;
case 'user':
$salt = hash('sha256', UserManager::SALT . strval(time()));
$password = hash_hmac('sha256', $item->tagAttrs['password'], $salt);
$admin_manager->insertData(array('username' => $item->tagAttrs['username'], 'password' => $password, 'fullname' => $item->tagAttrs['fullname'], 'level' => $item->tagAttrs['level'], 'verified' => 1, 'salt' => $salt));
break;
}
}
// set result
$result = true;
}
return $result;
}
示例6: getCommentMenu
/**
* display the pop-up menu of the post
* Print, scrap, vote-up(recommen), vote-down(non-recommend), report features added
* @return void
*/
function getCommentMenu()
{
// get the post's id number and the current login information
$comment_srl = Context::get('target_srl');
$mid = Context::get('cur_mid');
$logged_info = Context::get('logged_info');
$act = Context::get('cur_act');
// array values for menu_list, "comment post, target, url"
$menu_list = array();
// call a trigger
ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list);
$oCommentController =& getController('comment');
// feature that only member can do
if ($logged_info->member_srl) {
$oCommentModel =& getModel('comment');
$columnList = array('comment_srl', 'module_srl', 'member_srl', 'ipaddress');
$oComment = $oCommentModel->getComment($comment_srl, false, $columnList);
$module_srl = $oComment->get('module_srl');
$member_srl = $oComment->get('member_srl');
$oModuleModel =& getModel('module');
$comment_config = $oModuleModel->getModulePartConfig('document', $module_srl);
if ($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) {
// Add a vote-up button for positive feedback
$url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url, 'cmd_vote', '', 'javascript');
}
if ($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) {
// Add a vote-down button for negative feedback
$url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url, 'cmd_vote_down', '', 'javascript');
}
// Add the report feature against abused posts
$url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url, 'cmd_declare', '', 'javascript');
}
// call a trigger (after)
ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
// find a comment by IP matching if an administrator.
if ($logged_info->is_admin == 'Y') {
$oCommentModel =& getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl);
if ($oComment->isExists()) {
// Find a post of the corresponding ip address
$url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->getIpAddress());
$oCommentController->addCommentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
$url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oComment->getIpAddress());
$oCommentController->addCommentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript');
}
}
// Changing a language of pop-up menu
$menus = Context::get('comment_popup_menu_list');
$menus_count = count($menus);
for ($i = 0; $i < $menus_count; $i++) {
$menus[$i]->str = Context::getLang($menus[$i]->str);
}
// get a list of final organized pop-up menus
$this->add('menus', $menus);
}
示例7: dispBoardMessage
function dispBoardMessage($msg_code)
{
$msg = Context::getLang($msg_code);
$oMessageObject =& ModuleHandler::getModuleInstance('message', 'mobile');
$oMessageObject->setError(-1);
$oMessageObject->setMessage($msg);
$oMessageObject->dispMessage();
$this->setTemplatePath($oMessageObject->getTemplatePath());
$this->setTemplateFile($oMessageObject->getTemplateFile());
}
示例8: getCommentMenu
/**
* @brief 선택된 게시물의 팝업메뉴 표시
*
* 인쇄, 스크랩, 추천, 비추천, 신고 기능 추가
**/
function getCommentMenu()
{
// 요청된 게시물 번호와 현재 로그인 정보 구함
$comment_srl = Context::get('target_srl');
$mid = Context::get('cur_mid');
$logged_info = Context::get('logged_info');
$act = Context::get('cur_act');
// menu_list 에 "표시할글,target,url" 을 배열로 넣는다
$menu_list = array();
// trigger 호출
ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list);
$oCommentController =& getController('comment');
// 회원이어야만 가능한 기능
if ($logged_info->member_srl) {
// 추천 버튼 추가
$url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url, 'cmd_vote', './modules/document/tpl/icons/vote_up.gif', 'javascript');
// 비추천 버튼 추가
$url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url, 'cmd_vote_down', './modules/document/tpl/icons/vote_down.gif', 'javascript');
// 신고 기능 추가
$url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url, 'cmd_declare', './modules/document/tpl/icons/declare.gif', 'javascript');
}
// trigger 호출 (after)
ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
// 관리자일 경우 ip로 글 찾기
if ($logged_info->is_admin == 'Y') {
$oCommentModel =& getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl);
if ($oComment->isExists()) {
// ip주소에 해당하는 글 찾기
$url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->get('ipaddress'));
$icon_path = './modules/member/tpl/images/icon_management.gif';
$oCommentController->addCommentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
$url = sprintf("var params = new Array(); params['ipaddress']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oComment->getIpAddress());
$oCommentController->addCommentPopupMenu($url, 'cmd_add_ip_to_spamfilter', './modules/document/tpl/icons/declare.gif', 'javascript');
}
}
// 팝업메뉴의 언어 변경
$menus = Context::get('comment_popup_menu_list');
$menus_count = count($menus);
for ($i = 0; $i < $menus_count; $i++) {
$menus[$i]->str = Context::getLang($menus[$i]->str);
}
// 최종적으로 정리된 팝업메뉴 목록을 구함
$this->add('menus', $menus);
}
示例9: init
function init($module = null)
{
// change into administration layout
$config = getModel('cympusadmin')->getConfig();
$args = new stdClass();
$args->module = 'cympusadmin';
$module_list = getModel('module')->getModuleSrlList($args);
if (!empty($module_list)) {
foreach ($module_list as $module_info) {
$cympus_module_info = $module_info;
}
}
$module_path = './modules/cympusadmin/';
$template_path = sprintf("%sskins/%s/", $module_path, $cympus_module_info->skin);
if (!is_dir($template_path) || !$cympus_module_info->skin) {
$config->admin_skins = 'default';
$template_path = sprintf("%sskins/%s/", $module_path, $cympus_module_info->skin);
}
if ($module) {
$module->setLayoutPath($template_path);
$module->setLayoutFile(_CYMPUSADMIN_LAYOUT_);
} else {
$this->setLayoutPath($template_path);
$this->setLayoutFile(_CYMPUSADMIN_LAYOUT_);
}
Context::loadLang(_XE_PATH_ . 'modules/cympusadmin/lang/');
$logged_info = Context::get('logged_info');
if ($logged_info->is_admin == 'Y') {
// parse admin menu
$oXmlParser = new XmlParser();
$xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_);
$admin_menu = cympusadmin::getMenu($xml_obj->menu->item);
Context::set('cympusadmin_menu', $admin_menu);
} else {
$output = ModuleHandler::triggerCall('cympusadmin.getManagerMenu', 'before', $manager_menu);
if (!$output->toBool()) {
return $output;
}
Context::set('cympusadmin_menu', $manager_menu);
}
$news = getNewsFromAgency();
Context::set('news', $news);
Context::set('admin_bar', 'false');
$oModuleModel = getModel('module');
$module_info = $oModuleModel->getModuleInfoXml('cympusadmin');
Context::set('cympus_modinfo', $module_info);
return new Object();
}
示例10: getTextyleCustomMenu
/**
* @brief get textyle custom menu
**/
function getTextyleCustomMenu()
{
static $custom_menu = null;
if (is_null($custom_menu)) {
$oModuleModel =& getModel('module');
$config = $oModuleModel->getModuleConfig('textyle');
$custom_menu->hidden_menu = $config->hidden_menu;
if (!$custom_menu->hidden_menu) {
$custom_menu->hidden_menu = array();
}
$custom_menu->attached_menu = $config->attached_menu;
if (!$custom_menu->attached_menu) {
$custom_menu->attached_menu = array();
}
}
$output = ModuleHandler::triggerCall('textyle.getTextyleCustomMenu', 'after', $custom_menu);
if (!$output->toBool()) {
return $output;
}
return $custom_menu;
}
示例11: dispPlanetAdminAdditionalSetup
/**
* @brief additional configuration support
**/
function dispPlanetAdminAdditionalSetup()
{
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
Context::set('setup_content', $content);
// 템플릿 파일 지정
$this->setTemplateFile('additional_setup');
}
示例12: dispMemberSignUpForm
/**
* @brief Display member join form
*/
function dispMemberSignUpForm()
{
//setcookie for redirect url in case of going to member sign up
setcookie("XE_REDIRECT_URL", $_SERVER['HTTP_REFERER']);
$member_config = $this->member_config;
$oMemberModel = getModel('member');
// Get the member information if logged-in
if ($oMemberModel->isLogged()) {
return $this->stop('msg_already_logged');
}
// call a trigger (before)
$trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config);
if (!$trigger_output->toBool()) {
return $trigger_output;
}
// Error appears if the member is not allowed to join
if ($member_config->enable_join != 'Y') {
return $this->stop('msg_signup_disabled');
}
$oMemberAdminView = getAdminView('member');
$formTags = $oMemberAdminView->_getMemberInputTag($member_info);
Context::set('formTags', $formTags);
global $lang;
$identifierForm = new stdClass();
$identifierForm->title = $lang->{$member_config->identifier};
$identifierForm->name = $member_config->identifier;
$identifierForm->value = $member_info->{$member_config->identifier};
Context::set('identifierForm', $identifierForm);
$this->addExtraFormValidatorMessage();
// Set a template file
$this->setTemplateFile('signup_form');
}
示例13: restoreTrash
/**
* Restore document from trash module, called by trash module
* This method is passived
* @param object|array $originObject
* @return object
*/
function restoreTrash($originObject)
{
if (is_array($originObject)) {
$originObject = (object) $originObject;
}
$oDocumentController = getController('document');
$oDocumentModel = getModel('document');
$oDB =& DB::getInstance();
$oDB->begin();
//DB restore
$output = $oDocumentController->insertDocument($originObject, false, true, false);
if (!$output->toBool()) {
return new Object(-1, $output->getMessage());
}
//FILE restore
$oDocument = $oDocumentModel->getDocument($originObject->document_srl);
// If the post was not temorarily saved, set the attachment's status to be valid
if ($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) {
$args = new stdClass();
$args->upload_target_srl = $oDocument->document_srl;
$args->isvalid = 'Y';
$output = executeQuery('file.updateFileValid', $args);
}
// call a trigger (after)
if ($output->toBool()) {
$trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $originObject);
if (!$trigger_output->toBool()) {
$oDB->rollback();
return $trigger_output;
}
}
// commit
$oDB->commit();
return new Object(0, 'success');
}
示例14: deleteMaterial
function deleteMaterial($material_srl)
{
if (strpos($material_srl, ',') === false) {
$args->material_srl = $material_srl;
} else {
$args->material_srls = $material_srl;
}
$output = executeQuery('material.deleteMaterial', $args);
// delete thumnail image
$oFileModel =& getModel('file');
$file_list = array();
if (strpos(',', $material_srl) === false) {
$file_list = $oFileModel->getFiles($material_srl);
} else {
$material_srls = explode(',', $material_srl);
foreach ($material_srls as $srl) {
$files = $oFileModel->getFiles($srl);
if ($files) {
$file_list = array_merge($file_list, $files);
}
}
}
if (count($file_list)) {
foreach ($file_list as $k => $file) {
$ext = substr(strrchr($file->source_filename, '.'), 1);
$_filename = sprintf("%s%s.%%s.%s", preg_replace("/\\/[^\\/]*\$/", "/", $file->uploaded_filename), $material_srl, $ext);
$s_filename = sprintf($_filename, 'S');
$l_filename = sprintf($_filename, 'L');
FileHandler::removeFile($s_filename);
FileHandler::removeFile($l_filename);
}
}
$obj->document_srl = $material_srl;
// trigger 호출 (after)
if ($output->toBool()) {
$trigger_output = ModuleHandler::triggerCall('material.deleteMaterial', 'after', $obj);
if (!$trigger_output->toBool()) {
return $trigger_output;
}
}
return $output;
}
示例15: declaredDocument
/**
* Report posts
* @param int $document_srl
* @param string $declare_message
* @return void|Object
*/
function declaredDocument($document_srl, $declare_message = '')
{
// Fail if session information already has a reported document
if ($_SESSION['declared_document'][$document_srl]) {
return new Object(-1, 'failed_declared');
}
// Check if previously reported
$args = new stdClass();
$args->document_srl = $document_srl;
$output = executeQuery('document.getDeclaredDocument', $args);
if (!$output->toBool()) {
return $output;
}
$declared_count = $output->data->declared_count ? $output->data->declared_count : 0;
$trigger_obj = new stdClass();
$trigger_obj->document_srl = $document_srl;
$trigger_obj->declared_count = $declared_count;
// Call a trigger (before)
$trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'before', $trigger_obj);
if (!$trigger_output->toBool()) {
return $trigger_output;
}
// Get the original document
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
// Pass if the author's IP address is as same as visitor's.
if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
$_SESSION['declared_document'][$document_srl] = true;
return new Object(-1, 'failed_declared');
}
// Check if document's author is a member.
if ($oDocument->get('member_srl')) {
// Create a member model object
$oMemberModel = getModel('member');
$member_srl = $oMemberModel->getLoggedMemberSrl();
// Pass after registering a session if author's information is same as the currently logged-in user's.
if ($member_srl && $member_srl == abs($oDocument->get('member_srl'))) {
$_SESSION['declared_document'][$document_srl] = true;
return new Object(-1, 'failed_declared');
}
}
// Use member_srl for logged-in members and IP address for non-members.
$args = new stdClass();
if ($member_srl) {
$args->member_srl = $member_srl;
} else {
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$args->document_srl = $document_srl;
$args->declare_message = trim(htmlspecialchars($declare_message));
$output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
// Pass after registering a sesson if reported/declared documents are in the logs.
if ($output->data->count) {
$_SESSION['declared_document'][$document_srl] = true;
return new Object(-1, 'failed_declared');
}
// begin transaction
$oDB =& DB::getInstance();
$oDB->begin();
// Add the declared document
if ($declared_count > 0) {
$output = executeQuery('document.updateDeclaredDocument', $args);
} else {
$output = executeQuery('document.insertDeclaredDocument', $args);
}
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
// Leave logs
$output = executeQuery('document.insertDocumentDeclaredLog', $args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
$this->add('declared_count', $declared_count + 1);
// Call a trigger (after)
$trigger_obj->declared_count = $declared_count + 1;
ModuleHandler::triggerCall('document.declaredDocument', 'after', $trigger_obj);
// commit
$oDB->commit();
// Leave in the session information
$_SESSION['declared_document'][$document_srl] = true;
$this->setMessage('success_declared');
}