本文整理汇总了PHP中ZLanguage::getModuleDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP ZLanguage::getModuleDomain方法的具体用法?PHP ZLanguage::getModuleDomain怎么用?PHP ZLanguage::getModuleDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZLanguage
的用法示例。
在下文中一共展示了ZLanguage::getModuleDomain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateFileUpload
/**
* Check if an upload file meets all validation criteria.
*
* @param array $file Reference to data of uploaded file.
*
* @return boolean true if file is valid else false
*/
protected function validateFileUpload($file)
{
$dom = ZLanguage::getModuleDomain('MUBoard');
// check if a file has been uploaded properly without errors
if (!is_array($file) || is_array($file) && $file['error'] != '0') {
if (is_array($file)) {
return $this->handleError($file);
}
return LogUtil::registerError(__('Error! No file found.', $dom));
}
// extract file extension
$fileName = $file['name'];
$extensionarr = explode('.', $fileName);
$extension = strtolower($extensionarr[count($extensionarr) - 1]);
// validate extension
$isValidExtension = $this->isAllowedFileExtension($objectType, $fieldName, $extension);
if ($isValidExtension === false) {
return LogUtil::registerError(__('Error! This file type is not allowed. Please choose another file format.', $dom));
}
// validate image file
$imgInfo = array();
$isImage = in_array($extension, $this->imageFileTypes);
if ($isImage) {
$imgInfo = getimagesize($file['tmp_name']);
if (!is_array($imgInfo) || !$imgInfo[0] || !$imgInfo[1]) {
return LogUtil::registerError(__('Error! This file type seems not to be a valid image.', $dom));
}
}
return true;
}
示例2: Reviews_operation_update
/**
* Update operation.
* @param object $entity The treated object.
* @param array $params Additional arguments.
*
* @return bool False on failure or true if everything worked well.
*/
function Reviews_operation_update(&$entity, $params)
{
$dom = ZLanguage::getModuleDomain('Reviews');
// initialise the result flag
$result = false;
$objectType = $entity['_objectType'];
$currentState = $entity['workflowState'];
// get attributes read from the workflow
if (isset($params['nextstate']) && !empty($params['nextstate'])) {
// assign value to the data object
$entity['workflowState'] = $params['nextstate'];
if ($params['nextstate'] == 'archived') {
// bypass validator (for example an end date could have lost it's "value in future")
$entity['_bypassValidation'] = true;
}
}
// get entity manager
$serviceManager = ServiceUtil::getManager();
$entityManager = $serviceManager->getService('doctrine.entitymanager');
// save entity data
try {
//$this->entityManager->transactional(function($entityManager) {
$entityManager->persist($entity);
$entityManager->flush();
//});
$result = true;
} catch (\Exception $e) {
LogUtil::registerError($e->getMessage());
}
// return result of this operation
return $result;
}
示例3: smarty_function_contentcolumncount
/**
* Content
*
* @copyright (C) 2007-2010, Content Development Team
* @link http://github.com/zikula-modules/Content
* @license See license.txt
*/
function smarty_function_contentcolumncount($params, $view)
{
$dom = ZLanguage::getModuleDomain('Content');
// input is layout name
$layout = isset($params['layout']) ? $params['layout'] : '';
$columnCount = 1;
// assume 1 if no match can be found
// now start simple matching with a regular expression on the layout name. No science here.
// Looking for the first numbers in the string and stops with text again. Then take the highest single digit.
// Examples:
// layout columnCount
// ---------------------------------
// column21212 2
// column2d2575 2
// column3d502525 3
// column23andtext 3
//
if (preg_match('/[1-9]+/', $layout, $matches)) {
// found first set of numbers
$matchSplit = str_split($matches[0]);
rsort($matchSplit);
$columnCount = $matchSplit[0];
}
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $columnCount);
} else {
return $columnCount;
}
}
示例4: smarty_function_contentcodeeditor
/**
* Content
*
* @copyright (C) 2007-2010, Content Development Team
* @link http://github.com/zikula-modules/Content
* @license See license.txt
*/
function smarty_function_contentcodeeditor($params, $view)
{
$dom = ZLanguage::getModuleDomain('Content');
$inputId = $params['inputId'];
$inputType = isset($params['inputType']) ? $params['inputType'] : null;
// Get reference to optional radio button that enables the editor (a hack for the HTML plugin).
// It would have been easier just to read a $var in the template, but this won't work with a
// Forms plugin - you would just get the initial value from when the page was loaded
$htmlRadioButton = isset($params['htmlradioid']) ? $view->getPluginById($params['htmlradioid']) : null;
$textRadioButton = isset($params['textradioid']) ? $view->getPluginById($params['textradioid']) : null;
$html = '';
$useBBCode = $textRadioButton == null && $inputType == 'text' && !$view->isPostBack() || $textRadioButton != null && $textRadioButton->checked;
if ($useBBCode && ModUtil::available('BBCode')) {
$html = "<div class=\"z-formrow\"><em class=\"z-sub\">";
$html .= ModUtil::func('BBCode', 'User', 'bbcodes', array('textfieldid' => $inputId, 'images' => 0));
$html .= "</em></div>";
} else {
if ($useBBCode && !ModUtil::available('BBCode')) {
$html = "<div class=\"z-formrow\"><em class=\"z-sub\">";
$html .= '(' . __("Please install the BBCode module to enable BBCodes display.", $dom) . ')';
$html .= "</em></div>";
}
}
return $html;
}
示例5: moduleSearch
/**
*
*/
public function moduleSearch($args)
{
$dom = ZLanguage::getModuleDomain('MUBoard');
$searchsubmit = $this->request->getPost()->filter('searchsubmit', 'none', FILTER_SANITIZE_STRING);
$searchoptions = $this->request->getPost()->filter('searchoptions', 'all', FILTER_SANITIZE_STRING);
$searchplace = $this->request->getPost()->filter('searchplace', 'title', FILTER_SANITIZE_STRING);
$resultorder = $this->request->getPost()->filter('resultorder', 'none', FILTER_SANITIZE_STRING);
$kind = $this->request->query->filter('kind', 'none', FILTER_SANITIZE_STRING);
// user has not entered a string and there is 'none' as kind of search
if ($searchsubmit == 'none' && $kind == 'none') {
// return search form template
return $this->searchRedirect();
} else {
if ($searchsubmit != 'none' && $kind == 'none') {
$searchstring = $this->request->getPost()->filter('searchstring', '', FILTER_SANITIZE_STRING);
if ($searchstring == '') {
$url = ModUtil::url($this->name, 'search', 'modulesearch');
return LogUtil::registerError(__('You have to enter a string!', $dom), null, $url);
} else {
$args['searchstring'] = $searchstring;
$args['searchoptions'] = $searchoptions;
$args['searchplace'] = $searchplace;
$args['resultorder'] = $resultorder;
$args['kind'] = $kind;
}
}
if ($searchsubmit == 'none' && $kind != 'none') {
$args['kind'] = $kind;
}
}
return ModUtil::apiFunc($this->name, 'search', 'moduleSearch', $args);
}
示例6: smarty_function_AddressShowGmap
/**
* AddressBook
*
* @copyright (c) AddressBook Development Team
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package AddressBook
*/
function smarty_function_AddressShowGmap($params, &$smarty)
{
$dom = ZLanguage::getModuleDomain('AddressBook');
$assign = isset($params['assign']) ? $params['assign'] : null;
$directions = '';
if (isset($params['directions'])) {
$directions = '<a href="http://maps.google.com/maps?f=d&daddr=' . $params['lat_long'];
if (isset($params['zoomlevel'])) {
$directions .= '&z=' . $params['zoomlevel'];
}
$directions .= '" target="_blank">' . __('Get directions to this location', $dom) . '</a>';
}
if (!empty($directions)) {
$directions = '<div>' . $directions . '</div>';
}
include_once 'modules/AddressBook/lib/vendor/GMaps/GoogleMapV3.php';
$map_id = 'googlemap';
if (isset($params['mapid'])) {
$map_id .= $params['mapid'];
}
$app_id = 'ZikulaAddressBook';
$map = new GoogleMapAPI($map_id, $app_id);
if (isset($params['maptype'])) {
$map->setMapType($params['maptype']);
// hybrid, satellite, terrain, roadmap
}
if (isset($params['zoomlevel'])) {
$map->setZoomLevel($params['zoomlevel']);
}
$map->setTypeControlsStyle('dropdown');
$map->setWidth(isset($params['width']) && $params['width'] ? $params['width'] : '100%');
$map->setHeight(isset($params['height']) && $params['height'] ? $params['height'] : '400px');
// handle one (center) point
if (isset($params['lat_long'])) {
$arrLatLong = explode(',', $params['lat_long']);
$map->setCenterCoords($arrLatLong[1], $arrLatLong[0]);
$map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $params['title'], $params['html'], $params['tooltip'], $params['icon'], $params['iconshadow']);
}
// API key
if (isset($params['api_key'])) {
$map->setApiKey($params['api_key']);
}
// handle array of points
if (isset($params['points'])) {
foreach ($params['points'] as $point) {
$arrLatLong = explode(',', $point['lat_long']);
$map->addMarkerByCoords($arrLatLong[1], $arrLatLong[0], $point['title'], $point['html'], $point['tooltip'], $point['icon'], $point['iconshadow']);
}
}
// load the map
$map->enableOnLoad();
if ($assign) {
$result = $map->getHeaderJS() . $map->getMapJS() . $directions . $map->printMap() . $map->printOnLoad();
$smarty->assign($assign, $result);
} else {
PageUtil::addVar('rawtext', $map->getHeaderJS());
PageUtil::addVar('rawtext', $map->getMapJS());
return $directions . $map->printMap() . $map->printOnLoad();
}
}
示例7: __construct
public function __construct(EntityManagerInterface $entityManager, RequestStack $requestStack, EngineInterface $renderEngine)
{
$this->entityManager = $entityManager;
$this->requestStack = $requestStack;
$this->renderEngine = $renderEngine;
$this->domain = \ZLanguage::getModuleDomain('CmfcmfMediaModule');
}
示例8: _configureBase
/**
* Setup internal properties.
*
* @param $bundle
*
* @return void
*/
protected function _configureBase($bundle = null)
{
$this->systemBaseDir = realpath('.');
if (null !== $bundle) {
$this->name = $bundle->getName();
$this->domain = ZLanguage::getModuleDomain($this->name);
$this->baseDir = $bundle->getPath();
$versionClass = $bundle->getVersionClass();
$this->version = new $versionClass($bundle);
} else {
$className = $this->getReflection()->getName();
$separator = false === strpos($className, '_') ? '\\' : '_';
$parts = explode($separator, $className);
$this->name = $parts[0];
$this->baseDir = $this->libBaseDir = realpath(dirname($this->reflection->getFileName()) . '/../..');
if (realpath("{$this->baseDir}/lib/" . $this->name)) {
$this->libBaseDir = realpath("{$this->baseDir}/lib/" . $this->name);
}
$versionClass = "{$this->name}\\{$this->name}Version";
$versionClassOld = "{$this->name}_Version";
$versionClass = class_exists($versionClass) ? $versionClass : $versionClassOld;
$this->version = new $versionClass();
}
$this->modinfo = array('directory' => $this->name, 'type' => ModUtil::getModuleBaseDir($this->name) == 'system' ? ModUtil::TYPE_SYSTEM : ModUtil::TYPE_MODULE);
if ($this->modinfo['type'] == ModUtil::TYPE_MODULE) {
$this->domain = ZLanguage::getModuleDomain($this->name);
}
}
示例9: setup
/**
* Post constructor hook.
*
* @return void
*/
public function setup()
{
$this->view = \Zikula_View::getInstance(self::MODULENAME, false);
// set caching off
$this->_em = \ServiceUtil::get('doctrine.entitymanager');
$this->domain = \ZLanguage::getModuleDomain(self::MODULENAME);
}
示例10: __construct
public function __construct(RouterInterface $router, SecurityManager $securityManager, TranslatorInterface $translator)
{
$this->router = $router;
$this->securityManager = $securityManager;
$this->domain = \ZLanguage::getModuleDomain('CmfcmfMediaModule');
$this->translator = $translator;
}
示例11: initialize
/**
* Initialize form handler.
*
* This method takes care of all necessary initialisation of our data and form states.
*
* @return boolean False in case of initialization errors, otherwise true.
*/
public function initialize(Zikula_Form_View $view)
{
$dom = ZLanguage::getModuleDomain($this->name);
// permission check
if (!SecurityUtil::checkPermission('MUBoard::', '::', ACCESS_ADMIN)) {
return $view->registerError(LogUtil::registerPermissionError());
}
// retrieve module vars
$modVars = ModUtil::getVar('MUBoard');
// initialise list entries for the 'number images' setting
$modVars['numberImagesItems'] = array(array('value' => '1', 'text' => '1'), array('value' => '2', 'text' => '2'), array('value' => '3', 'text' => '3'));
// initialise list entries for the 'number files' setting
$modVars['numberFilesItems'] = array(array('value' => '1', 'text' => '1'), array('value' => '2', 'text' => '2'), array('value' => '3', 'text' => '3'));
// initialise list entries for the 'sorting postings' setting
$modVars['sortingCategoriesItems'] = array(array('value' => 'descending', 'text' => __('Descending', $dom)), array('value' => 'ascending', 'text' => __('Ascending', $dom)));
// initialise list entries for the 'sorting postings' setting
$modVars['sortingPostingsItems'] = array(array('value' => 'descending', 'text' => __('Descending', $dom)), array('value' => 'ascending', 'text' => __('Ascending', $dom)));
// initialise list entries for the 'icon set' setting
$modVars['iconSetItems'] = array(array('value' => '1', 'text' => '1'), array('value' => '2', 'text' => '2'), array('value' => '3', 'text' => '3'));
// initialise list entries for the 'template' setting
$modVars['templateItems'] = array(array('value' => 'normal', 'text' => 'Normal'), array('value' => 'jquery', 'text' => 'jQuery'));
// assign all module vars
$this->view->assign('config', $modVars);
// custom initialisation aspects
$this->initializeAdditions();
// everything okay, no initialization errors occured
return true;
}
示例12: validateAll
/**
* Performs all validation rules.
*
* @return mixed either array with error information or true on success
*/
public function validateAll()
{
$errorInfo = array('message' => '', 'code' => 0, 'debugArray' => array());
$dom = ZLanguage::getModuleDomain('MUBoard');
if (!$this->isStringNotLongerThan('title', 255)) {
$errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('title', 255), $dom);
return $errorInfo;
}
if (!$this->isStringNotEmpty('title')) {
$errorInfo['message'] = __f('Error! Field value must not be empty (%s).', array('title'), $dom);
return $errorInfo;
}
if (!$this->isStringNotLongerThan('description', 2000)) {
$errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('description', 2000), $dom);
return $errorInfo;
}
if (!$this->isStringNotEmpty('description')) {
$errorInfo['message'] = __f('Error! Field value must not be empty (%s).', array('description'), $dom);
return $errorInfo;
}
if (!$this->isValidInteger('pos')) {
$errorInfo['message'] = __f('Error! Field value may only contain digits (%s).', array('pos'), $dom);
return $errorInfo;
}
/* if (!$this->isNumberNotEmpty('pos')) {
$errorInfo['message'] = __f('Error! Field value must not be 0 (%s).', array('pos'), $dom);
return $errorInfo;
}*/
if (!$this->isNumberNotLongerThan('pos', 3)) {
$errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('pos', 3), $dom);
return $errorInfo;
}
return true;
}
示例13: validateAll
/**
* Performs all validation rules.
*
* @return mixed either array with error information or true on success
*/
public function validateAll()
{
$errorInfo = array('message' => '', 'code' => 0, 'debugArray' => array());
$dom = ZLanguage::getModuleDomain('MUBoard');
if (!$this->isValidInteger('userid')) {
$errorInfo['message'] = __f('Error! Field value may only contain digits (%s).', array('userid'), $dom);
return $errorInfo;
}
if (!$this->isNumberNotEmpty('userid')) {
$errorInfo['message'] = __f('Error! Field value must not be 0 (%s).', array('userid'), $dom);
return $errorInfo;
}
if (!$this->isNumberNotLongerThan('userid', 11)) {
$errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('userid', 11), $dom);
return $errorInfo;
}
if (!$this->isValidInteger('numberPostings')) {
$errorInfo['message'] = __f('Error! Field value may only contain digits (%s).', array('numberPostings'), $dom);
return $errorInfo;
}
/* if (!$this->isNumberNotEmpty('numberPostings')) {
$errorInfo['message'] = __f('Error! Field value must not be 0 (%s).', array('numberPostings'), $dom);
return $errorInfo;
}*/
if (!$this->isNumberNotLongerThan('numberPostings', 11)) {
$errorInfo['message'] = __f('Error! Length of field value must not be higher than %2$s (%1$s).', array('numberPostings', 11), $dom);
return $errorInfo;
}
if (!$this->isValidDateTime('lastVisit')) {
$errorInfo['message'] = __f('Error! Field value must be a valid datetime (%s).', array('lastVisit'), $dom);
return $errorInfo;
}
return true;
}
示例14: content_needleapi_content
/**
* Content needle
* @param $args['nid'] needle id
* @return array()
*/
function content_needleapi_content($args)
{
$dom = ZLanguage::getModuleDomain('Content');
// Get arguments from argument array
$nid = $args['nid'];
unset($args);
// cache the results
static $cache;
if (!isset($cache)) {
$cache = array();
}
if (!empty($nid)) {
if (!isset($cache[$nid])) {
// not in cache array
if (ModUtil::available('Content')) {
$contentpage = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $nid, 'includeContent' => false));
if ($contentpage != false) {
$cache[$nid] = '<a href="' . DataUtil::formatForDisplay(ModUtil::url('Content', 'user', 'view', array('pid' => $nid))) . '" title="' . DataUtil::formatForDisplay($contentpage['title']) . '">' . DataUtil::formatForDisplay($contentpage['title']) . '</a>';
} else {
$cache[$nid] = '<em>' . DataUtil::formatForDisplay(__('Unknown id', $dom)) . '</em>';
}
} else {
$cache[$nid] = '<em>' . DataUtil::formatForDisplay(__('Content not available', $dom)) . '</em>';
}
}
$result = $cache[$nid];
} else {
$result = '<em>' . DataUtil::formatForDisplay(__('No needle id', $dom)) . '</em>';
}
return $result;
}
示例15: smarty_modifier_news_getstatustext
/**
* Smarty modifier to get the respective status text
*
* Example
* <!--[$article.published_status|news_getstatustext]-->
*
* @author Mateo Tibaquira [mateo]
* @since 17/11/2009
* @param int $status The status to transform
* @return string the modified output
*/
function smarty_modifier_news_getstatustext($status)
{
$dom = ZLanguage::getModuleDomain('News');
$output = __('Unknown status', $dom);
switch ($status)
{
case 0:
$output = __('Published', $dom);
break;
case 1:
$output = __('Rejected', $dom);
break;
case 2:
$output = __('Pending Review', $dom);
break;
case 3:
$output = __('Archived', $dom);
break;
case 4:
$output = __('Draft', $dom);
break;
}
return $output;
}