本文整理汇总了PHP中XoopsLists::getHtmlListAsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLists::getHtmlListAsArray方法的具体用法?PHP XoopsLists::getHtmlListAsArray怎么用?PHP XoopsLists::getHtmlListAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsLists
的用法示例。
在下文中一共展示了XoopsLists::getHtmlListAsArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* @param bool $index_by_page
* @return array
*/
function &about_template_lookup($index_by_page = false)
{
include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
$files = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['artdirname'] . '/templates/');
$list = array();
foreach ($files as $file => $name) {
// The valid file name must be: art_article_mytpl.html OR art_category-1_your-trial.html
if (preg_match('/^' . $GLOBALS['artdirname'] . "_([^_]*)(_(.*))?\\.(tpl|xotpl)\$/i", $name, $matches)) {
if (empty($matches[1])) {
continue;
}
if (empty($matches[3])) {
$matches[3] = 'default';
}
if (empty($index_by_page)) {
$list[] = array('file' => $name, 'description' => $matches[3]);
} else {
$list[$matches[1]][$matches[3]] = $name;
}
}
}
$cache_file = empty($index_by_page) ? 'template-list' : 'template-page';
xoops_load('xoopscache');
$key = $GLOBALS['artdirname'] . "_{$cache_file}";
XoopsCache::write($key, $list);
//load_functions("cache");
//mod_createCacheFile($list, $cache_file, $GLOBALS["artdirname"]);
return $list;
}
示例2: array
function &art_template_lookup($index_by_page = false)
{
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
$files = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/templates/");
$list = array();
foreach ($files as $file => $name) {
// The valid file name must be: art_article_mytpl.html OR art_category-1_your-trial.html
if (preg_match("/^" . $GLOBALS["ART_VAR_PREFIX"] . "_([^_]*)(_(.*))?\\.(html|xotpl)\$/i", $name, $matches)) {
if (empty($matches[1])) {
continue;
}
if (empty($matches[3])) {
$matches[3] = "default";
}
if (empty($index_by_page)) {
$list[] = array("file" => $name, "description" => $matches[3]);
} else {
$list[$matches[1]][$matches[3]] = $name;
}
}
}
$cache_file = empty($index_by_page) ? "template-list" : "template-page";
xoops_load("cache");
$key = $GLOBALS["artdirname"] . "_{$cache_file}";
XoopsCache::write($key, $list);
//load_functions("cache");
//mod_createCacheFile($list, $cache_file, $GLOBALS["artdirname"]);
return $list;
}
示例3: array
}
fclose ($fp);
}
include_once XOOPS_ROOT_PATH."/class/xoopslists.php";
$templates_array = array();
$templates_array = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH."/modules/{$mydirname}/templates/");
foreach($templates_array as $key)
{
// echo $templates_array[$key];
if ( preg_match('/^xwords/',$templates_array[$key]) )
{
$renamefilename = preg_replace('/^xwords(.+)/', "$mydirname$1", $templates_array[$key]);
rename( XOOPS_ROOT_PATH . "/modules/{$mydirname}/templates/".$templates_array[$key], XOOPS_ROOT_PATH . "/modules/{$mydirname}/templates/{$renamefilename}" );
}
}
$b_templates_array = array();
$b_templates_array = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH."/modules/{$mydirname}/templates/blocks/");
foreach($b_templates_array as $key)
{
// echo $b_templates_array[$key];
if ( preg_match('/^entries/',$b_templates_array[$key]) )
{
$renamefilename = preg_replace('/^entries(.+)/', "$mydirname$1", $b_templates_array[$key]);
rename( XOOPS_ROOT_PATH . "/modules/{$mydirname}/templates/blocks/".$b_templates_array[$key], XOOPS_ROOT_PATH . "/modules/{$mydirname}/templates/blocks/{$renamefilename}" );
}
}
?>
示例4: createElements
//.........这里部分代码省略.........
$this->addElement($summaryText);
}
// BODY
$editorConfigs['name'] = 'body';
$editorConfigs['value'] = $obj->getVar('body', 'e');
$bodyText = new XoopsFormEditor(_CO_PUBLISHER_BODY, $editor, $editorConfigs, $nohtml, $onfailure = null);
$bodyText->setDescription(_CO_PUBLISHER_BODY_DSC);
$this->addElement($bodyText);
// VARIOUS OPTIONS
if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML) || $this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY) || $this->isGranted(PublisherConstants::PUBLISHER_DOXCODE) || $this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE) || $this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) {
if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML)) {
$html_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO);
$this->addElement($html_radio);
}
if ($this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY)) {
$smiley_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->dosmiley(), _YES, _NO);
$this->addElement($smiley_radio);
}
if ($this->isGranted(PublisherConstants::PUBLISHER_DOXCODE)) {
$xcode_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOXCODE, 'doxcode', $obj->doxcode(), _YES, _NO);
$this->addElement($xcode_radio);
}
if ($this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE)) {
$image_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOIMAGE, 'doimage', $obj->doimage(), _YES, _NO);
$this->addElement($image_radio);
}
if ($this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) {
$linebreak_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOLINEBREAK, 'dolinebreak', $obj->dobr(), _YES, _NO);
$this->addElement($linebreak_radio);
}
}
// Available pages to wrap
if ($this->isGranted(PublisherConstants::PUBLISHER_AVAILABLE_PAGE_WRAP)) {
$wrapPages = XoopsLists::getHtmlListAsArray(publisherGetUploadDir(true, 'content'));
$availableWrapPagesText = array();
foreach ($wrapPages as $page) {
$availableWrapPagesText[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
}
$availableWrapPages = new XoopsFormLabel(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $availableWrapPagesText));
$availableWrapPages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC);
$this->addElement($availableWrapPages);
}
// Uid
/* We need to retreive the users manually because for some reason, on the frxoops.org server,
the method users::getobjects encounters a memory error
*/
// Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL
if ($this->isGranted(PublisherConstants::PUBLISHER_UID)) {
$uidSelect = new XoopsFormSelect(_CO_PUBLISHER_UID, 'uid', $obj->uid(), 1, false);
$uidSelect->setDescription(_CO_PUBLISHER_UID_DSC);
$sql = 'SELECT uid, uname FROM ' . $obj->db->prefix('users') . ' ORDER BY uname ASC';
$result = $obj->db->query($sql);
$usersArray = array();
$usersArray[0] = $GLOBALS['xoopsConfig']['anonymous'];
while (($myrow = $obj->db->fetchArray($result)) !== false) {
$usersArray[$myrow['uid']] = $myrow['uname'];
}
$uidSelect->addOptionArray($usersArray);
$this->addElement($uidSelect);
}
/* else {
$hidden = new XoopsFormHidden('uid', $obj->uid());
$this->addElement($hidden);
unset($hidden);
}*/
// Author ALias
示例5: array
function &catalog_template_lookup_blocks($index_by_page = false)
{
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
$files = XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . "/modules/" . "catalog" . "/templates/blocks/");
$list = array();
foreach ($files as $file => $name) {
if (preg_match("/^" . 'blocks_' . "catalog" . "_([^_]*)(_(.*))?\\.(html|xotpl)\$/i", $name, $matches)) {
if (empty($matches[1])) {
continue;
}
if (empty($matches[3])) {
$matches[3] = "default";
}
if (empty($index_by_page)) {
$list[] = array("file" => $name, "description" => $matches[3]);
} else {
$list[$matches[1]][$matches[3]] = $name;
}
}
}
$cache_file = empty($index_by_page) ? "template-list" : "template-page";
xoops_load("cache");
$key = "catalog" . "_{$cache_file}";
XoopsCache::write($key, $list);
return $list;
}
示例6: edititem
//.........这里部分代码省略.........
// SUMMARY
$summary_text = smartsection_getEditor(_AM_SSECTION_SUMMARY, 'summary', $itemObj->getVar('summary', 'e'));
$summary_text->setDescription(_AM_SSECTION_SUMMARY_DSC);
$sform->addElement($summary_text, false);
// DISPLAY_SUMMARY
$display_summary_radio = new XoopsFormRadioYN(_AM_SSECTION_DISPLAY_SUMMARY, 'display_summary', $itemObj->display_summary(), ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
$sform->addElement($display_summary_radio);
}
// BODY
/*if ($itemObj->address()) {
// Main body : pagewrap
$address_select = new XoopsFormSelect(_AM_SSECTION_BODY_SELECTFILE, "address", $itemObj->address());
$address_select->setDescription(_AM_SSECTION_BODY_SELECTFILE_DSC);
$dir = smartsection_getUploadDir(true, 'content');
$folder = dir($dir);
while($file = $folder->read()) {
if ($file != "." && $file != "..") {
$address_select->addOption($file, "".$file."");
}
}
$folder->close();
$sform->addElement($address_select);
$sform->addElement(new XoopsFormHidden('body', ''));
} else {*/
$body_text = smartsection_getEditor(_AM_SSECTION_BODY, 'body', $itemObj->getVar('body', 'e'));
if (SMARTSECTION_LEVEL >= 5) {
$body_text->setDescription(sprintf(_AM_SSECTION_BODY_DSC, SMARTSECTION_URL . "/admin/pagewrap_lookup.php"));
}
$sform->addElement($body_text);
//}
if (SMARTSECTION_LEVEL >= 5) {
// Available pages to wrap
$wrap_pages = XoopsLists::getHtmlListAsArray(smartsection_getUploadDir(true, 'content'));
$available_wrap_pages_text = array();
foreach ($wrap_pages as $page) {
$available_wrap_pages_text[] = "<span onclick='smartsectionPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
}
$available_wrap_pages = new XoopsFormLabel(_AM_SSECTION_AVAILABLE_PAGE_WRAP, implode(', ', $available_wrap_pages_text));
$available_wrap_pages->setDescription(_AM_SSECTION_AVAILABLE_PAGE_WRAP_DSC);
$sform->addElement($available_wrap_pages);
// Tags
if (smartsection_tag_module_included()) {
include_once XOOPS_ROOT_PATH . "/modules/tag/include/formtag.php";
$text_tags = new XoopsFormTag("item_tag", 60, 255, $itemObj->getVar('item_tag', 'e'), 0);
$sform->addElement($text_tags);
}
// IMAGE
$image_array = XoopsLists::getImgListAsArray(smartsection_getImageDir('item'));
$image_select = new XoopsFormSelect('', 'image', $itemObj->image());
//$image_select -> addOption ('-1', '---------------');
$image_select->addOptionArray($image_array);
$image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'");
$image_tray = new XoopsFormElementTray(_AM_SSECTION_IMAGE_ITEM, ' ');
$image_tray->addElement($image_select);
$image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartsection_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />"));
$image_tray->setDescription(_AM_SSECTION_IMAGE_ITEM_DSC);
$sform->addElement($image_tray);
// IMAGE UPLOAD
$max_size = 5000000;
$image_file_box = new XoopsFormFile(_AM_SSECTION_IMAGE_UPLOAD, "image_file", $max_size);
$image_file_box->setExtra("size ='50'");
$image_file_box->setDescription(_AM_SSECTION_IMAGE_UPLOAD_ITEM_DSC);
$sform->addElement($image_file_box);
}
// File upload UPLOAD
示例7: buildMainTab
/**
* Build the main tab
*
* @param PublisherItem $obj data source
* @param ContainerInterface $mainTab add elements to this tab/form
*
* @return void
*/
private function buildMainTab(PublisherItem $obj, ContainerInterface $mainTab)
{
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
// Category
$category_select = new Xoops\Form\Select(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e'));
$category_select->setDescription(_CO_PUBLISHER_CATEGORY_DSC);
$category_select->addOptionArray($publisher->getCategoryHandler()->getCategoriesForSubmit());
$mainTab->addElement($category_select);
// ITEM TITLE
$mainTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true);
// SUBTITLE
if ($this->isGranted(_PUBLISHER_SUBTITLE)) {
$mainTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e')));
}
// SHORT URL
if ($this->isGranted(_PUBLISHER_ITEM_SHORT_URL)) {
$text_short_url = new Xoops\Form\Text(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->getVar('short_url', 'e'));
$text_short_url->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC);
$mainTab->addElement($text_short_url);
}
// TAGS
if ($xoops->isActiveModule('tag') && $this->isGranted(_PUBLISHER_ITEM_TAG)) {
include_once $xoops->path('modules/tag/include/formtag.php');
$text_tags = new Tag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0);
$mainTab->addElement($text_tags);
}
$this->buildEditors($obj, $mainTab);
$this->buildTSOptions($obj, $mainTab);
// Available pages to wrap
if ($this->isGranted(_PUBLISHER_AVAILABLE_PAGE_WRAP)) {
$wrap_pages = XoopsLists::getHtmlListAsArray(PublisherUtils::getUploadDir(true, 'content'));
$available_wrap_pages_text = array();
foreach ($wrap_pages as $page) {
$available_wrap_pages_text[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");'" . " onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
}
$available_wrap_pages = new Xoops\Form\Label(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $available_wrap_pages_text));
$available_wrap_pages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC);
$mainTab->addElement($available_wrap_pages);
}
// Uid
/* We need to retrieve the users manually because for some reason, on the frxoops.org server,
the method users::getobjects encounters a memory error
*/
// Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL
if ($this->isGranted(_PUBLISHER_UID)) {
$uid_select = new Xoops\Form\SelectUser(_CO_PUBLISHER_UID, 'uid', true, array($obj->getVar('uid', 'e')), 1, false);
$uid_select->setDescription(_CO_PUBLISHER_UID_DSC);
$mainTab->addElement($uid_select);
}
// Author Alias
if ($this->isGranted(_PUBLISHER_AUTHOR_ALIAS)) {
$element = new Xoops\Form\Text(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e'));
$element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC);
$mainTab->addElement($element);
unset($element);
}
// STATUS
if ($this->isGranted(_PUBLISHER_STATUS)) {
$options = array(_PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, _PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, _PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, _PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED);
$status_select = new Xoops\Form\Select(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status'));
$status_select->addOptionArray($options);
$status_select->setDescription(_CO_PUBLISHER_STATUS_DSC);
$mainTab->addElement($status_select);
unset($status_select);
}
// Datesub
if ($this->isGranted(_PUBLISHER_DATESUB)) {
$datesub = $obj->getVar('datesub') == 0 ? time() : $obj->getVar('datesub');
$datesub_datetime = new Xoops\Form\DateTime(_CO_PUBLISHER_DATESUB, 'datesub', $datesub);
$datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC);
$mainTab->addElement($datesub_datetime);
}
// NOTIFY ON PUBLISH
if ($this->isGranted(_PUBLISHER_NOTIFY)) {
$notify_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_NOTIFY, 'notify', $obj->getVar('notifypub'));
$mainTab->addElement($notify_radio);
}
}