本文整理汇总了PHP中io::strtolower方法的典型用法代码示例。如果您正苦于以下问题:PHP io::strtolower方法的具体用法?PHP io::strtolower怎么用?PHP io::strtolower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io
的用法示例。
在下文中一共展示了io::strtolower方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
if (!$node) {
$lastmod = date($cms_language->getDateFormat() . ' H:i:s', filemtime(PATH_REALROOT_FS . '/robots.txt'));
$size = formatBytes(filesize(PATH_REALROOT_FS . '/robots.txt'), 2);
$qtip = $cms_language->getMessage(MESSAGE_PAGE_FILE_LAST_UPDATE_SIZE, array($cms_language->getMessage(MESSAGE_PAGE_TXT), $lastmod, $size));
$nodes = array(array('text' => $cms_language->getJsMessage(MESSAGE_PAGE_WEBSITES_CSS), 'id' => 'css', 'leaf' => false, 'cls' => 'folder', 'qtip' => '', 'deletable' => false), array('text' => $cms_language->getJsMessage(MESSAGE_PAGE_WEBSITES_JS), 'id' => 'js', 'leaf' => false, 'cls' => 'folder', 'qtip' => '', 'deletable' => false), array('text' => 'robots.txt', 'id' => 'robots.txt', 'leaf' => true, 'cls' => 'atm-txt', 'qtip' => $qtip, 'deletable' => false));
$view->setContent($nodes);
$view->show();
}
$allowedFiles = array('less' => array('name' => $cms_language->getMessage(MESSAGE_PAGE_STYLESHEET), 'class' => 'atm-css'), 'css' => array('name' => $cms_language->getMessage(MESSAGE_PAGE_STYLESHEET), 'class' => 'atm-css'), 'xml' => array('name' => $cms_language->getMessage(MESSAGE_PAGE_WYSIWYG), 'class' => 'atm-xml'), 'js' => array('name' => $cms_language->getMessage(MESSAGE_PAGE_JAVASCRIPT), 'class' => 'atm-js'), 'txt' => array('name' => $cms_language->getMessage(MESSAGE_PAGE_TXT), 'class' => 'atm-txt'));
$nodes = array();
$currentDepth = count(explode('/', $node));
try {
foreach (new DirectoryIterator(PATH_REALROOT_FS . '/' . $node) as $file) {
$lastmod = date($cms_language->getDateFormat() . ' H:i:s', $file->getMTime());
if ($file->isFile() && $file->getFilename() != ".htaccess") {
$extension = io::strtolower(pathinfo($file->getPathname(), PATHINFO_EXTENSION));
if (isset($allowedFiles[$extension])) {
$size = formatBytes($file->getSize(), 2);
$qtip = $cms_language->getMessage(MESSAGE_PAGE_FILE_LAST_UPDATE_SIZE, array($allowedFiles[$extension]['name'], $lastmod, $size));
$deletable = $extension != 'xml' && $file->isWritable();
$nodes[$file->getFilename()] = array('text' => $file->getFilename(), 'id' => $node . '/' . $file->getFilename(), 'leaf' => true, 'qtip' => $qtip, 'cls' => $allowedFiles[$extension]['class'], 'deletable' => $deletable);
}
} elseif ($file->isDir() && !$file->isDot()) {
$qtip = $cms_language->getMessage(MESSAGE_PAGE_FOLDER_LAST_UPDATE) . ' ' . $lastmod;
$nodes['-' . $file->getFilename()] = array('text' => $file->getFilename(), 'id' => $node . '/' . $file->getFilename(), 'qtip' => $qtip, 'leaf' => false, 'cls' => 'folder', 'expanded' => $currentDepth < $maxDepth, 'deletable' => false);
}
}
} catch (Exception $e) {
}
ksort($nodes);
$nodes = array_values($nodes);
示例2: load
/**
* Module autoload handler
*
* @param string $classname the classname required for loading
* @return string : the file to use for required classname
* @access public
*/
function load($classname)
{
static $classes;
if (!isset($classes)) {
$classes = array('cms_forms_action' => PATH_MODULES_FS . "/" . MOD_CMS_FORMS_CODENAME . "/action.php", 'cms_forms_record' => PATH_MODULES_FS . "/" . MOD_CMS_FORMS_CODENAME . "/record.php", 'cms_forms_field' => PATH_MODULES_FS . "/" . MOD_CMS_FORMS_CODENAME . "/field.php", 'cms_forms_formular' => PATH_MODULES_FS . "/" . MOD_CMS_FORMS_CODENAME . "/form.php", 'cms_forms_search' => PATH_MODULES_FS . "/" . MOD_CMS_FORMS_CODENAME . "/formssearch.php", 'cms_forms_formularcategories' => PATH_MODULES_FS . "/" . MOD_CMS_FORMS_CODENAME . "/formcategories.php", 'cms_forms_sender' => PATH_MODULES_FS . "/" . MOD_CMS_FORMS_CODENAME . "/sender.php", 'cms_forms_sendingssearch' => PATH_MODULES_FS . "/" . MOD_CMS_FORMS_CODENAME . "/sendingssearch.php", 'cms_block_cms_forms' => PATH_MODULES_FS . "/" . MOD_CMS_FORMS_CODENAME . "/block.php");
}
$file = '';
if (isset($classes[io::strtolower($classname)])) {
$file = $classes[io::strtolower($classname)];
}
return $file;
}
示例3: setAttribute
/**
* Set : an attribute
*
* @param string $k, The key of wanted attribute
* @param string $v, the value corresponding to key
* @return boolean true on success, false on failure
* @access public
*/
function setAttribute($k, $v)
{
$this->_attributes[io::strtolower($k)] = str_replace('"', "", io::strtolower($v));
return true;
}
示例4: setSoapValues
/**
* Set soap values
*
* @param integer $fieldID The field ID
* @param $domdocument XML values to set
* @param $itemId the ID of the polyobject item, if any (necessary for some fields (image, file, etc...)
* @return boolean true or false
* @access public
*/
function setSoapValues($fieldID, $domdocument, $itemId = '')
{
$view = CMS_view::getInstance();
$fieldValues = array();
// subfield
foreach ($domdocument->childNodes as $childNode) {
if ($childNode->nodeType == XML_ELEMENT_NODE) {
switch ($childNode->tagName) {
case 'subfield':
//<subfield id="{int}" [name="{string}"] type="int|string|date|text|object|binary|category|user|group">
$subFieldId = $childNode->getAttribute('id');
if (!sensitiveIO::isPositiveInteger($subFieldId) && $subFieldId != 0) {
$view->addError('Missing or invalid attribute id for subfield tag');
return false;
}
if (!isset($this->_subfields[$subFieldId])) {
$view->addError('Unknown field id ' . $fieldId . ' for object ' . $this->_objectID);
return false;
}
$fieldValues[$fieldID . '_' . $subFieldId] = trim(io::strtolower(APPLICATION_DEFAULT_ENCODING) != 'utf-8' ? utf8_decode($childNode->nodeValue) : $childNode->nodeValue);
break;
case 'object':
//TODO
break;
default:
$view->addError('Unknown xml tag ' . $childNode->tagName . ' to process.');
return false;
break;
}
} else {
if ($childNode->nodeType == XML_TEXT_NODE && trim($childNode->nodeValue)) {
$view->addError('Unknown xml content tag ' . $childNode->nodeValue . ' to process.');
return false;
}
}
}
if (!$this->checkMandatory($fieldValues, '')) {
$view->addError('Error of mandatory values for field ' . $fieldID);
return false;
} elseif (!$this->setValues($fieldValues, '', false, $itemId)) {
return false;
}
return true;
}
示例5: sort_files
/**
* Sorts files
*
* @param string $a
* @param string $b
* @return integer, 0 if nothing sorted
*/
function sort_files($a, $b)
{
if ($a['type'] != $b['type']) {
return $a['type'] > $b['type'] ? -1 : 1;
} elseif ($a['type'] == 5) {
return strcmp(io::strtolower($a['name']), io::strtolower($b['name']));
} else {
if ($a['ext'] != $b['ext']) {
return strcmp($a['ext'], $b['ext']);
} elseif ($a['stat'][7] != $b['stat'][7]) {
return $a['stat'][7] > $b['stat'][7] ? -1 : 1;
} else {
return strcmp(io::strtolower($a['name']), io::strtolower($b['name']));
}
}
return 0;
}
示例6: md5
CMS_grandFather::raiseError('Queried file does not exists.');
$view->show();
}
if (!is_file($file)) {
//file creation
$fileCreation = true;
$extension = '';
$fileId = md5(rand());
$fileDefinition = '';
$labelField = "{\n\t\txtype:\t\t\t'textfield',\n\t\tvalue:\t\t\t'',\n\t\tname:\t\t\t'filelabel',\n\t\tfieldLabel:\t\t'{$cms_language->getJsMessage(MESSAGE_PAGE_LABEL)}',\n\t\tborder:\t\t\tfalse,\n\t\tbodyStyle: \t\t'padding-bottom:10px'\n\t},";
$anchor = '-110';
$action = 'create';
} else {
//file edition
$fileCreation = false;
$extension = io::strtolower(pathinfo($file, PATHINFO_EXTENSION));
if (!isset($allowedFiles[$extension])) {
CMS_grandFather::raiseError('Action on this type of file is not allowed.');
$view->show();
}
$fileId = md5($file);
$file = new CMS_file($file);
$fileDefinition = $file->readContent();
$labelField = '';
$anchor = '-60';
$action = 'update';
}
if (strtolower(APPLICATION_DEFAULT_ENCODING) == 'utf-8') {
if (!io::isUTF8($fileDefinition)) {
$fileDefinition = utf8_encode($fileDefinition);
}
示例7: startScript
/**
* Start the scripts process queue.
* Remove the lock file then relaunch the script if force is true
*
* @param boolean $force Set to true if you wish to remove the lock file before launch
* @return void
* @access public
* @static
*/
static function startScript($force = false)
{
if (USE_BACKGROUND_REGENERATOR) {
$forceRestart = '';
if ($force) {
$forceRestart = ' -F';
} elseif (processManager::hasRunningScript()) {
return false;
}
//test if we're on windows or linux, for the output redirection
if (APPLICATION_IS_WINDOWS) {
if (realpath(PATH_PHP_CLI_WINDOWS) === false) {
CMS_grandFather::raiseError("Unknown CLI location : " . PATH_PHP_CLI_WINDOWS . ", please check your configuration.");
return false;
}
// Create the BAT file
$command = '@echo off' . "\r\n" . 'start /B /LOW ' . realpath(PATH_PHP_CLI_WINDOWS) . ' ' . realpath(PATH_PACKAGES_FS . '\\scripts\\script.php') . ' -m ' . REGENERATION_THREADS . $forceRestart;
$replace = array('program files (x86)' => 'progra~2', 'program files' => 'progra~1', 'documents and settings' => 'docume~1');
$command = str_ireplace(array_keys($replace), $replace, $command);
if (!@touch(PATH_WINDOWS_BIN_FS . "/script.bat")) {
CMS_grandFather::_raiseError("CMS_scriptsManager : startScript : Create file error : " . PATH_WINDOWS_BIN_FS . "/script.bat");
return false;
}
$fh = @fopen(PATH_WINDOWS_BIN_FS . "/script.bat", "wb");
if (is_resource($fh)) {
if (!@fwrite($fh, $command, io::strlen($command))) {
CMS_grandFather::raiseError("Save file error : script.bat");
}
@fclose($fh);
}
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run(str_ireplace(array_keys($replace), $replace, realpath(PATH_WINDOWS_BIN_FS . '\\script.bat')), 0, false);
} else {
$error = '';
if (!defined('PATH_PHP_CLI_UNIX') || !PATH_PHP_CLI_UNIX) {
$return = CMS_patch::executeCommand('which php 2>&1', $error);
if ($error) {
CMS_grandFather::raiseError('Error when finding php CLI with command "which php", please check your configuration : ' . $error);
return false;
}
if (io::substr($return, 0, 1) != '/') {
CMS_grandFather::raiseError('Can\'t find php CLI with command "which php", please check your configuration.');
return false;
}
$return = CMS_patch::executeCommand("cd " . PATH_REALROOT_FS . "; php " . PATH_PACKAGES_FS . "/scripts/script.php -m " . REGENERATION_THREADS . $forceRestart . " > /dev/null 2>&1 &", $error);
if ($error) {
CMS_grandFather::raiseError('Error during execution of script command (cd ' . PATH_REALROOT_FS . '; php ' . PATH_PACKAGES_FS . '/scripts/script.php -m ' . REGENERATION_THREADS . $forceRestart . '), please check your configuration : ' . $error);
return false;
}
} else {
$return = CMS_patch::executeCommand(PATH_PHP_CLI_UNIX . ' -v 2>&1', $error);
if ($error) {
CMS_grandFather::raiseError('Error when testing php CLI with command "' . PATH_PHP_CLI_UNIX . ' -v", please check your configuration : ' . $error);
return false;
}
if (io::strpos(io::strtolower($return), '(cli)') === false) {
CMS_grandFather::raiseError(PATH_PHP_CLI_UNIX . ' is not the CLI version');
return false;
}
$return = CMS_patch::executeCommand("cd " . PATH_REALROOT_FS . "; " . PATH_PHP_CLI_UNIX . " " . PATH_PACKAGES_FS . "/scripts/script.php -m " . REGENERATION_THREADS . $forceRestart . " > /dev/null 2>&1 &", $error);
if ($error) {
CMS_grandFather::raiseError('Error during execution of script command (cd ' . PATH_REALROOT_FS . '; ' . PATH_PHP_CLI_UNIX . ' ' . PATH_PACKAGES_FS . '/scripts/script.php -m ' . REGENERATION_THREADS . $forceRestart . '), please check your configuration : ' . $error);
return false;
}
}
//CMS_grandFather::log($return);
//CMS_grandFather::log("cd ".PATH_REALROOT_FS."; php ".PATH_PACKAGES_FS."/scripts/script.php -m ".REGENERATION_THREADS.$forceRestart." > /dev/null 2>&1 &");
//@system("cd ".PATH_REALROOT_FS."; php ".PATH_PACKAGES_FS."/scripts/script.php -m ".REGENERATION_THREADS.$forceRestart." > /dev/null 2>&1 &");
}
} else {
CMS_session::setSessionVar('start_script', true);
}
}
示例8: selectOptions
/**
* For a given category, return options tag list (for a select tag) of all sub categories
*
* @param array $values : parameters values array(parameterName => parameterValue) in :
* selected : the category id which is selected (optional)
* usedcategories : display only used categories (optional, default : true)
* usedbyitemsids : display only categories used by items list. Accept array of items ids or list of ids (comma separated). Used only if 'usedcategories' is active (optional, default : false)
* editableonly : display only editable categories (optional, default : false)
* root : the category id to use as root (optional)
* crosslanguage : returned categories do not filter by language and return all categories even if current language has no label (default : false)
* @param multidimentionnal array $tags : xml2Array content of atm-function tag (nothing for this one)
* @return string : options tag list
* @access public
*/
function selectOptions($values, $tags)
{
global $cms_language;
if (!isset($values['usedcategories']) || $values['usedcategories'] == 'true' || $values['usedcategories'] == '1') {
$usedCategories = true;
if (isset($values['usedbyitemsids']) && is_array($values['usedbyitemsids'])) {
$usedByItemsIds = $values['usedbyitemsids'];
} elseif (isset($values['usedbyitemsids']) && is_string($values['usedbyitemsids'])) {
$usedByItemsIds = explode(',', $values['usedbyitemsids']);
} else {
$usedByItemsIds = false;
}
} else {
$usedCategories = false;
$usedByItemsIds = false;
}
$disableCategories = array();
if (isset($values['disable'])) {
$disableCategories = explode(';', $values['disable']);
if (count($disableCategories) == 1) {
$disableCategories = explode(',', $values['disable']);
}
}
if (!isset($values['editableonly']) || $values['editableonly'] == 'false' || $values['editableonly'] == '0') {
$editableOnly = false;
} else {
$editableOnly = true;
}
if (!isset($values['crosslanguage']) || $values['crosslanguage'] == 'false' || $values['crosslanguage'] == '0') {
$crossLanguage = false;
} else {
$crossLanguage = true;
}
if (isset($values['root']) && sensitiveIO::isPositiveInteger($values['root'])) {
$rootCategory = $values['root'];
} else {
$rootCategory = false;
}
$maxlevel = isset($values['maxlevel']) ? (int) $values['maxlevel'] : 0;
$categories = $this->getAllCategoriesAsArray($cms_language, $usedCategories, false, $editableOnly, $rootCategory, false, $usedByItemsIds, $crossLanguage);
$return = "";
if (is_array($categories) && $categories) {
//natsort objects by name case insensitive
if (isset($values['sort']) && (io::strtolower($values['sort']) == 'asc' || io::strtolower($values['sort']) == 'desc')) {
uasort($categories, array('CMS_object_categories', '_natecasecomp'));
if (io::strtolower($values['sort']) == 'desc') {
$categories = array_reverse($categories, true);
}
}
foreach ($categories as $catID => $catLabel) {
// Disable categories
if (is_array($disableCategories) && $disableCategories) {
$lineage = CMS_moduleCategories_catalog::getLineageOfCategory($catID);
foreach ($disableCategories as $disableCategory) {
if (SensitiveIO::isPositiveInteger($disableCategory) && in_array($disableCategory, $lineage)) {
continue;
}
}
}
//max level
if ($maxlevel) {
if (substr_count($catLabel, '- ') >= $maxlevel) {
continue;
}
}
$selected = isset($values['selected']) && $catID == $values['selected'] ? ' selected="selected"' : '';
$return .= '<option title="' . io::htmlspecialchars($catLabel) . '" value="' . $catID . '"' . $selected . '>' . $catLabel . '</option>';
}
}
return $return;
}
示例9: getAllLanguagesCodes
/**
* Get all available languages codes from ISO 639-1 standard
* Static function.
*
* @return array(code => label)
* @access public
*/
function getAllLanguagesCodes()
{
if (!file_exists(PATH_PACKAGES_FS . '/files/iso639-1.txt')) {
return array();
}
$codeFile = new CMS_file(PATH_PACKAGES_FS . '/files/iso639-1.txt');
$languagesCodes = $codeFile->readContent('array');
$return = array();
foreach ($languagesCodes as $languagesCode) {
if (substr($languagesCode, 0, 1) != '#') {
list($code, $label) = explode("\t", $languagesCode);
if (io::strtolower(APPLICATION_DEFAULT_ENCODING) != 'utf-8') {
$label = utf8_decode($label);
}
$return[$code] = ucfirst($label);
}
}
return $return;
}
示例10: setValues
/**
* set object Values
*
* @param array $values : the POST result values
* @param string prefixname : the prefix used for post names
* @param boolean newFormat : new automne v4 format (default false for compatibility)
* @param integer $objectID : the current object id. Must be set, but default is blank for compatibility with other objects
* @return boolean true on success, false on failure
* @access public
*/
function setValues($values, $prefixName, $newFormat = false, $objectID = '')
{
if (!sensitiveIO::isPositiveInteger($objectID)) {
$this->raiseError('ObjectID must be a positive integer : ' . $objectID);
return false;
}
//get field parameters
$params = $this->getParamsValues();
//get module codename
$moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
if ($newFormat) {
//delete old images ?
//thumbnail
if ($this->_subfieldValues[0]->getValue() && (!$values[$prefixName . $this->_field->getID() . '_0'] || pathinfo($values[$prefixName . $this->_field->getID() . '_0'], PATHINFO_BASENAME) != $this->_subfieldValues[0]->getValue())) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[0]->getValue());
$this->_subfieldValues[0]->setValue('');
}
//image zoom
if ($this->_subfieldValues[2]->getValue() && (!isset($values[$prefixName . $this->_field->getID() . '_2']) || !$values[$prefixName . $this->_field->getID() . '_2'] || pathinfo($values[$prefixName . $this->_field->getID() . '_2'], PATHINFO_BASENAME) != $this->_subfieldValues[2]->getValue())) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[2]->getValue());
$this->_subfieldValues[2]->setValue('');
}
//set label from label field
if (!$this->_subfieldValues[1]->setValue(io::htmlspecialchars($values[$prefixName . $this->_field->getID() . '_1']))) {
return false;
}
//image zoom (if needed)
if ((!isset($values[$prefixName . $this->_field->getID() . '_makeZoom']) || $values[$prefixName . $this->_field->getID() . '_makeZoom'] != 1) && isset($values[$prefixName . $this->_field->getID() . '_2']) && $values[$prefixName . $this->_field->getID() . '_2'] && io::strpos($values[$prefixName . $this->_field->getID() . '_2'], PATH_UPLOAD_WR . '/') !== false) {
$filename = $values[$prefixName . $this->_field->getID() . '_2'];
//check for image type before doing anything
if (!in_array(io::strtolower(pathinfo($filename, PATHINFO_EXTENSION)), $this->_allowedExtensions)) {
return false;
}
//destroy old image if any
if ($this->_subfieldValues[2]->getValue()) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[2]->getValue());
$this->_subfieldValues[2]->setValue('');
}
//move and rename uploaded file
$filename = str_replace(PATH_UPLOAD_WR . '/', PATH_UPLOAD_FS . '/', $filename);
$basename = pathinfo($filename, PATHINFO_BASENAME);
//set thumbnail
$path = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED;
$zoomBasename = "r" . $objectID . "_" . $this->_field->getID() . "_" . io::strtolower(SensitiveIO::sanitizeAsciiString($basename));
if (io::strlen($zoomBasename) > 255) {
$zoomBasename = sensitiveIO::ellipsis($zoomBasename, 255, '-', true);
}
$zoomFilename = $path . '/' . $zoomBasename;
CMS_file::moveTo($filename, $zoomFilename);
CMS_file::chmodFile(FILES_CHMOD, $zoomFilename);
//set it
if (!$this->_subfieldValues[2]->setValue($zoomBasename)) {
return false;
}
}
//thumbnail
if ($values[$prefixName . $this->_field->getID() . '_0'] && io::strpos($values[$prefixName . $this->_field->getID() . '_0'], PATH_UPLOAD_WR . '/') !== false) {
$filename = $values[$prefixName . $this->_field->getID() . '_0'];
//check for image type before doing anything
if (!in_array(io::strtolower(pathinfo($filename, PATHINFO_EXTENSION)), $this->_allowedExtensions)) {
return false;
}
//destroy old image if any
if ($this->_subfieldValues[0]->getValue()) {
@unlink(PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[0]->getValue());
$this->_subfieldValues[0]->setValue('');
}
//move and rename uploaded file
$filename = str_replace(PATH_UPLOAD_WR . '/', PATH_UPLOAD_FS . '/', $filename);
$basename = pathinfo($filename, PATHINFO_BASENAME);
//set thumbnail
$path = PATH_MODULES_FILES_FS . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED;
$newBasename = "r" . $objectID . "_" . $this->_field->getID() . "_" . io::strtolower(SensitiveIO::sanitizeAsciiString($basename));
//rename image
$path_parts = pathinfo($newBasename);
$extension = io::strtolower($path_parts['extension']);
$newBasename = io::substr($path_parts['basename'], 0, -(io::strlen($extension) + 1)) . '_thumbnail.' . $extension;
if (io::strlen($newBasename) > 255) {
$newBasename = sensitiveIO::ellipsis($newBasename, 255, '-', true);
}
$newFilename = $path . '/' . $newBasename;
//move file from upload dir to new dir
CMS_file::moveTo($filename, $newFilename);
CMS_file::chmodFile(FILES_CHMOD, $newFilename);
//if we use original image as image zoom, set it
if (isset($values[$prefixName . $this->_field->getID() . '_makeZoom']) && $values[$prefixName . $this->_field->getID() . '_makeZoom'] == 1) {
$zoomFilename = str_replace('_thumbnail.' . $extension, '.' . $extension, $newFilename);
//copy image as zoom
CMS_file::copyTo($newFilename, $zoomFilename);
$zoomBasename = pathinfo($zoomFilename, PATHINFO_BASENAME);
//.........这里部分代码省略.........
示例11: array
$statusValues = sensitiveIO::jsonEncode($statusValues);
$searchPanel .= "{\n\t\txtype:\t\t\t\t'combo',\n\t\tname:\t\t\t\t'status_{$object->getID()}',\n\t\thiddenName:\t\t \t'status_{$object->getID()}',\n\t\tforceSelection:\t\ttrue,\n\t\tfieldLabel:\t\t\t'Publication',\n\t\tmode:\t\t\t\t'local',\n\t\ttriggerAction:\t\t'all',\n\t\tvalueField:\t\t\t'id',\n\t\tdisplayField:\t\t'label',\n\t\tvalue:\t\t\t\t'{$statusValue}',\n\t\tanchor:\t\t\t\t'-20px',\n\t\tstore:\t\t\t\tnew Ext.data.JsonStore({\n\t\t\tfields:\t\t\t\t['id', 'label'],\n\t\t\tdata:\t\t\t\t{$statusValues}\n\t\t}),\n\t\tallowBlank:\t\t \tfalse,\n\t\tselectOnFocus:\t\ttrue,\n\t\teditable:\t\t\tfalse,\n\t\tvalidateOnBlur:\t\tfalse,\n\t\tlisteners:\t\t\t{'valid':moduleObjectWindow.search}\n\t},";
}
// Build sort select
$items_possible['objectID'] = $cms_language->getMessage(MESSAGE_PAGE_FIELD_CREATION_DATE, false, MOD_POLYMOD_CODENAME);
//Ordre de création
// check if primary resource to add publication dates
if ($object->isPrimaryResource()) {
$items_possible['publication date before'] = $cms_language->getMessage(MESSAGE_PAGE_FIELD_PUBLICATION_DATE, false, MOD_POLYMOD_CODENAME);
//Date de début de publication
}
// build array of possible sort types
$possible_sorts = array('cms_object_boolean', 'cms_object_string', 'cms_object_date', 'cms_object_file', 'cms_object_image', 'cms_object_language', 'cms_object_integer', 'cms_object_usergroup');
// check witch fields are sortable
foreach ($objectFields as $fieldID => $field) {
if (in_array(io::strtolower(get_class($field->getTypeObject())), $possible_sorts)) {
$items_possible[$field->getID()] = $field->getLabel($cms_language);
}
}
// check if there are other sortable object than creation date
if (count($items_possible) > 1) {
$sortValue = CMS_session::getSessionVar('sort_' . $object->getID());
$sortValue = $sortValue ? $sortValue : 'objectID';
$sortValues = array();
foreach ($items_possible as $key => $label) {
$sortValues[] = array('id' => $key, 'label' => $label);
}
$sortValues = sensitiveIO::jsonEncode($sortValues);
$sortItem = "{\n\t\txtype:\t\t\t\t'combo',\n\t\tname:\t\t\t\t'sort_{$object->getID()}',\n\t\thiddenName:\t\t \t'sort_{$object->getID()}',\n\t\tforceSelection:\t\ttrue,\n\t\tfieldLabel:\t\t\t'{$cms_language->getJSMessage(MESSAGE_PAGE_FIELD_SORT, false, MOD_POLYMOD_CODENAME)}',\n\t\tmode:\t\t\t\t'local',\n\t\ttriggerAction:\t\t'all',\n\t\tvalueField:\t\t\t'id',\n\t\tdisplayField:\t\t'label',\n\t\tvalue:\t\t\t\t'{$sortValue}',\n\t\tanchor:\t\t\t\t'98%',\n\t\tstore:\t\t\t\tnew Ext.data.JsonStore({\n\t\t\tfields:\t\t\t\t['id', 'label'],\n\t\t\tdata:\t\t\t\t{$sortValues}\n\t\t}),\n\t\tallowBlank:\t\t \tfalse,\n\t\tselectOnFocus:\t\ttrue,\n\t\teditable:\t\t\tfalse,\n\t\tvalidateOnBlur:\t\tfalse,\n\t\tlisteners:\t\t\t{'valid':moduleObjectWindow.search}\n\t}";
} else {
$sortItem = "{\n\t\txtype:\t\t\t\t'textfield',\n\t\tfieldLabel:\t\t\t'{$cms_language->getJSMessage(MESSAGE_PAGE_FIELD_SORT, false, MOD_POLYMOD_CODENAME)}',\n\t\tanchor:\t\t\t\t'98%',\n\t\tdisabled:\t\t\ttrue,\n\t\tvalue:\t\t\t\t'{$items_possible['objectID']}',\n\t\tlisteners:\t\t\t{'valid':moduleObjectWindow.search}\n\t}";
示例12: getJSLocales
/**
* Get all JS locales for current user (in current language)
*
* @return string : JS locales
* @access public
*/
public static function getJSLocales()
{
$locales = '';
$user = CMS_session::getUser();
if (!$user) {
return $locales;
}
//add all JS locales
$language = $user->getLanguage();
$languageCode = $language->getCode();
//Get Ext locales
if ($languageCode != 'en') {
//english is defined as default language so we should not add it again
$extLocaleFile = PATH_MAIN_FS . '/ext/src/locale/ext-lang-' . $languageCode . '.js';
if (file_exists($extLocaleFile)) {
$fileContent = file_get_contents($extLocaleFile);
//remove BOM if any
if (substr($fileContent, 0, 3) == '') {
$fileContent = substr($fileContent, 3);
}
$locales .= io::strtolower(APPLICATION_DEFAULT_ENCODING) != 'utf-8' ? utf8_decode($fileContent) : $fileContent;
}
}
//add Automne locales
$locales .= $language->getMessage(self::MESSAGE_USER_JS_LOCALES);
return $locales;
}
示例13: load
/**
* Module autoload handler
*
* @param string $classname the classname required for loading
* @return string : the file to use for required classname
* @access public
*/
function load($classname)
{
static $classes;
if (!isset($classes)) {
$classes = array('cms_poly_object_field' => PATH_MODULES_FS . '/polymod/polyobjects/poly_object_field.php', 'cms_poly_object' => PATH_MODULES_FS . '/polymod/polyobjects/poly_object.php', 'cms_poly_object_definition' => PATH_MODULES_FS . '/polymod/polyobjects/poly_object_definition.php', 'cms_poly_object_catalog' => PATH_MODULES_FS . '/polymod/polyobjects/poly_object_catalog.php', 'cms_multi_poly_object' => PATH_MODULES_FS . '/polymod/polyobjects/multi_poly_object.php', 'cms_object_search' => PATH_MODULES_FS . '/polymod/object_search.php', 'cms_poly_plugin_definitions' => PATH_MODULES_FS . '/polymod/poly_plugin_definition.php', 'cms_object_i18nm' => PATH_MODULES_FS . '/polymod/object_i18nm.php', 'cms_polymod_definition_parsing' => PATH_MODULES_FS . '/polymod/poly_definition_parsing.php', 'cms_poly_module_structure' => PATH_MODULES_FS . '/polymod/poly_module_structure.php', 'cms_poly_rss_definitions' => PATH_MODULES_FS . '/polymod/poly_rss_definition.php', 'cms_block_polymod' => PATH_MODULES_FS . '/polymod/block.php', 'cms_poly_definition_functions' => PATH_MODULES_FS . '/polymod/poly_definition_functions.php', 'cms_xmltag_if' => PATH_MODULES_FS . '/polymod/tags/if.php', 'cms_xmltag_else' => PATH_MODULES_FS . '/polymod/tags/else.php', 'cms_xmltag_start' => PATH_MODULES_FS . '/polymod/tags/start.php', 'cms_xmltag_end' => PATH_MODULES_FS . '/polymod/tags/end.php', 'cms_xmltag_setvar' => PATH_MODULES_FS . '/polymod/tags/setvar.php', 'cms_polymod_oembed_definition' => PATH_MODULES_FS . '/polymod/poly_oembed_definition.php', 'cms_polymod_oembed_definition_catalog' => PATH_MODULES_FS . '/polymod/poly_oembed_definition_catalog.php');
}
$file = '';
if (isset($classes[io::strtolower($classname)])) {
$file = $classes[io::strtolower($classname)];
} elseif (io::strpos($classname, 'CMS_object_') === 0 && file_exists(PATH_MODULES_FS . '/polymod/objects/object_' . io::substr($classname, 11) . '.php')) {
$file = PATH_MODULES_FS . '/polymod/objects/object_' . io::substr($classname, 11) . '.php';
} elseif (io::strpos($classname, 'CMS_subobject_') === 0 && file_exists(PATH_MODULES_FS . '/polymod/subobjects/subobject_' . io::substr($classname, 14) . '.php')) {
$file = PATH_MODULES_FS . '/polymod/subobjects/subobject_' . io::substr($classname, 14) . '.php';
}
return $file;
}
示例14: die
*/
//force loading module cms_forms
if (!class_exists('CMS_module_cms_forms')) {
die('Cannot find cms_forms module ...');
}
//set current page ID
$mod_cms_forms["pageID"] = '{{pageID}}';
//Instanciate Form
$form = new CMS_forms_formular($mod_cms_forms["formID"]);
//Instanciate language
$cms_language = $form->getLanguage();
//Instanciate field error Ids
$cms_forms_error_ids = array();
//Form actions treatment
if ($form->getID() && $form->isPublic()) {
if (io::strtolower(APPLICATION_XHTML_DTD) != io::strtolower('<!DOCTYPE html>')) {
echo '<a name="formAnchor' . $form->getID() . '"></a>';
} else {
echo '<div id="formAnchor' . $form->getID() . '"></div>';
}
//Create or append (from header) form required message
if (isset($cms_forms_token[$form->getID()]) && $cms_forms_token[$form->getID()]) {
$cms_forms_error_msg[$form->getID()] .= $cms_language->getMessage(CMS_forms_formular::MESSAGE_CMS_FORMS_TOKEN_EXPIRED, false, MOD_CMS_FORMS_CODENAME);
}
//Create or append (from header) form required message
if (isset($cms_forms_required[$form->getID()]) && $cms_forms_required[$form->getID()] && is_array($cms_forms_required[$form->getID()])) {
$cms_forms_error_msg[$form->getID()] .= $cms_language->getMessage(CMS_forms_formular::MESSAGE_CMS_FORMS_REQUIRED_FIELDS, false, MOD_CMS_FORMS_CODENAME) . '<ul>';
foreach ($cms_forms_required[$form->getID()] as $fieldName) {
$field = $form->getFieldByName($fieldName, true);
$cms_forms_error_msg[$form->getID()] .= '<li>' . $field->getAttribute('label') . '</li>';
$cms_forms_error_ids[] .= $field->generateFieldIdDatas();
示例15: DOMElementToString
public static function DOMElementToString($domelement, $contentOnly = false)
{
if (!is_a($domelement, "DOMElement")) {
CMS_grandFather::raiseError('Domelement is not a DOMElement instance');
return false;
}
static $autoClosedTagsList;
if (!$autoClosedTagsList) {
$xml2Array = new CMS_xml2Array();
$tagsList = $xml2Array->getAutoClosedTagsList();
$autoClosedTagsList = implode($tagsList, '|');
}
$output = '';
if ($contentOnly) {
$output = '';
foreach ($domelement->childNodes as $node) {
$output .= $node->ownerDocument->saveXML($node, LIBXML_NOEMPTYTAG);
}
} else {
$output = $domNode->ownerDocument->saveXML($domNode, LIBXML_NOEMPTYTAG);
}
//convert output encoding if needed
if (io::isUTF8($output)) {
if (io::strtolower(APPLICATION_DEFAULT_ENCODING) != 'utf-8') {
$output = utf8_decode($output);
}
} else {
if (io::strtolower(APPLICATION_DEFAULT_ENCODING) == 'utf-8') {
$output = utf8_encode($output);
}
}
//to correct a bug in libXML < 2.6.27
if (LIBXML_VERSION < 20627 && strpos($output, '&#x') !== false) {
$output = preg_replace_callback('/(&#x[0-9A-Z]+;)/U', create_function('$matches', 'return io::decodeEntities($matches[0]);'), $output);
}
//replace tags like <br></br> by auto closed tags and strip cariage return arround entities
$output = preg_replace(array('#\\n(&[a-z]+;)\\n#U', '#<(' . $autoClosedTagsList . ')([^>]*)></\\1>#U'), array('\\1', '<\\1\\2/>'), $output);
return $output;
}