本文整理汇总了PHP中mosParameters::def方法的典型用法代码示例。如果您正苦于以下问题:PHP mosParameters::def方法的具体用法?PHP mosParameters::def怎么用?PHP mosParameters::def使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mosParameters
的用法示例。
在下文中一共展示了mosParameters::def方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: botMosImage
/**
*/
function botMosImage($published, &$row, &$params, $page = 0)
{
global $database, $_MAMBOTS;
// simple performance check to determine whether bot should process further
if (strpos($row->text, 'mosimage') === false) {
return true;
}
// expression to search for
$regex = '/{mosimage\\s*.*?}/i';
// check whether mosimage has been disabled for page
// check whether mambot has been unpublished
if (!$published || !$params->get('image')) {
$row->text = preg_replace($regex, '', $row->text);
return true;
}
//count how many {mosimage} are in introtext if it is set to hidden.
$introCount = 0;
if (!$params->get('introtext') & !$params->get('intro_only')) {
preg_match_all($regex, $row->introtext, $matches);
$introCount = count($matches[0]);
}
// find all instances of mambot and put in $matches
preg_match_all($regex, $row->text, $matches);
// Number of mambots
$count = count($matches[0]);
// mambot only processes if there are any instances of the mambot in the text
if ($count) {
// check if param query has previously been processed
if (!isset($_MAMBOTS->_content_mambot_params['mosimage'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'mosimage'" . "\n AND folder = 'content'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_content_mambot_params['mosimage'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_content_mambot_params['mosimage'];
$botParams = new mosParameters($mambot->params);
$botParams->def('padding');
$botParams->def('margin');
$botParams->def('link', 0);
$images = processImages($row, $botParams, $introCount);
// store some vars in globals to access from the replacer
$GLOBALS['botMosImageCount'] = 0;
$GLOBALS['botMosImageParams'] =& $botParams;
$GLOBALS['botMosImageArray'] =& $images;
//$GLOBALS['botMosImageArray'] =& $combine;
// perform the replacement
$row->text = preg_replace_callback($regex, 'botMosImage_replacer', $row->text);
// clean up globals
unset($GLOBALS['botMosImageCount']);
unset($GLOBALS['botMosImageMask']);
unset($GLOBALS['botMosImageArray']);
unset($GLOBALS['botJosIntroCount']);
return true;
}
}
示例2: botSearchNewsfeedslinks
/**
* Contacts Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function botSearchNewsfeedslinks($text, $phrase = '', $ordering = '')
{
global $database, $my, $_MAMBOTS;
// check if param query has previously been processed
if (!isset($_MAMBOTS->_search_mambot_params['newsfeeds'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'newsfeeds.searchbot'" . "\n AND folder = 'search'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_search_mambot_params['newsfeeds'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_search_mambot_params['newsfeeds'];
$botParams = new mosParameters($mambot->params);
$limit = $botParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
$wheres = array();
switch ($phrase) {
case 'exact':
$wheres2 = array();
$wheres2[] = "LOWER(a.name) LIKE '%{$text}%'";
$wheres2[] = "LOWER(a.link) LIKE '%{$text}%'";
$where = '(' . implode(') OR (', $wheres2) . ')';
break;
case 'all':
case 'any':
default:
$words = explode(' ', $text);
$wheres = array();
foreach ($words as $word) {
$wheres2 = array();
$wheres2[] = "LOWER(a.name) LIKE '%{$word}%'";
$wheres2[] = "LOWER(a.link) LIKE '%{$word}%'";
$wheres[] = implode(' OR ', $wheres2);
}
$where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
break;
}
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'b.title ASC, a.name ASC';
break;
case 'oldest':
case 'popular':
case 'newest':
default:
$order = 'a.name ASC';
}
$query = "SELECT a.name AS title," . "\n '' AS created," . "\n a.link AS text," . "\n CONCAT_WS( ' / '," . $database->Quote(_SEARCH_NEWSFEEDS) . ", b.title )AS section," . "\n CONCAT( 'index.php?option=com_newsfeeds&task=view&feedid=', a.id ) AS href," . "\n '1' AS browsernav" . "\n FROM #__newsfeeds AS a" . "\n INNER JOIN #__categories AS b ON b.id = a.catid" . "\n WHERE ( {$where} )" . "\n AND a.published = 1" . "\n AND b.published = 1" . "\n AND b.access <= " . (int) $my->gid . "\n ORDER BY {$order}";
$database->setQuery($query, 0, $limit);
$rows = $database->loadObjectList();
return $rows;
}
示例3: edit
/**
* @param database A database connector object
* @param integer The unique id of the category to edit (0 if new)
*/
function edit(&$uid, $menutype, $option)
{
global $database, $my, $mainframe;
$menu = new mosMenu($database);
$menu->load((int) $uid);
// fail if checked out not by 'me'
if ($menu->checked_out && $menu->checked_out != $my->id) {
mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator");
}
if ($uid) {
$menu->checkout($my->id);
// get previously selected Categories
$params = new mosParameters($menu->params);
$catids = $params->def('categoryid', '');
if ($catids) {
$catidsArray = explode(',', $catids);
mosArrayToInts($catidsArray);
$catids = 'c.id=' . implode(' OR c.id=', $catidsArray);
$query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope = 'content'" . "\n AND ( {$catids} )" . "\n ORDER BY s.name,c.name";
$database->setQuery($query);
$lookup = $database->loadObjectList();
} else {
$lookup = '';
}
} else {
$menu->type = 'content_blog_category';
$menu->menutype = $menutype;
$menu->ordering = 9999;
$menu->parent = intval(mosGetParam($_POST, 'parent', 0));
$menu->published = 1;
$lookup = '';
}
// build the html select list for category
$rows[] = mosHTML::makeOption('', 'All Categories');
$query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name,c.name";
$database->setQuery($query);
$rows = array_merge($rows, $database->loadObjectList());
$category = mosHTML::selectList($rows, 'catid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
$lists['categoryid'] = $category;
// build the html select list for ordering
$lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
// build the html select list for the group access
$lists['access'] = mosAdminMenus::Access($menu);
// build the html select list for paraent item
$lists['parent'] = mosAdminMenus::Parent($menu);
// build published button option
$lists['published'] = mosAdminMenus::Published($menu);
// build the url link output
$lists['link'] = mosAdminMenus::Link($menu, $uid);
// get params definitions
$params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
/* chipjack: passing $sectCatList (categories) instead of $slist (sections) */
content_blog_category_html::edit($menu, $lists, $params, $option);
}
示例4: edit
/**
* @param database A database connector object
* @param integer The unique id of the section to edit (0 if new)
*/
function edit($uid, $menutype, $option)
{
global $database, $my, $mainframe;
$menu = new mosMenu($database);
$menu->load((int) $uid);
// fail if checked out not by 'me'
if ($menu->checked_out && $menu->checked_out != $my->id) {
mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
}
if ($uid) {
$menu->checkout($my->id);
// get previously selected Categories
$params = new mosParameters($menu->params);
$secids = $params->def('sectionid', '');
if ($secids) {
$secidsArray = explode(',', $secids);
mosArrayToInts($secidsArray);
$secids = 's.id=' . implode(' OR s.id=', $secidsArray);
$query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND ( {$secids} )" . "\n ORDER BY s.name";
$database->setQuery($query);
$lookup = $database->loadObjectList();
} else {
$lookup = '';
}
} else {
$menu->type = 'content_blog_section';
$menu->menutype = $menutype;
$menu->ordering = 9999;
$menu->parent = intval(mosGetParam($_POST, 'parent', 0));
$menu->published = 1;
$lookup = '';
}
// build the html select list for section
$rows[] = mosHTML::makeOption('', 'Todas as Seções');
$query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name";
$database->setQuery($query);
$rows = array_merge($rows, $database->loadObjectList());
$section = mosHTML::selectList($rows, 'secid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
$lists['sectionid'] = $section;
// build the html select list for ordering
$lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
// build the html select list for the group access
$lists['access'] = mosAdminMenus::Access($menu);
// build the html select list for paraent item
$lists['parent'] = mosAdminMenus::Parent($menu);
// build published button option
$lists['published'] = mosAdminMenus::Published($menu);
// build the url link output
$lists['link'] = mosAdminMenus::Link($menu, $uid);
// get params definitions
$params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
content_blog_section_html::edit($menu, $lists, $params, $option);
}
示例5: botSearchSections
/**
* Sections Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function botSearchSections($text, $phrase = '', $ordering = '')
{
global $database, $my, $_MAMBOTS;
// check if param query has previously been processed
if (!isset($_MAMBOTS->_search_mambot_params['sections'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'sections.searchbot'" . "\n AND folder = 'search'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_search_mambot_params['sections'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_search_mambot_params['sections'];
$botParams = new mosParameters($mambot->params);
$limit = $botParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
}
$query = "SELECT a.name AS title," . "\n a.description AS text," . "\n '' AS created," . "\n '2' AS browsernav," . "\n a.id AS secid, m.id AS menuid, m.type AS menutype" . "\n FROM #__sections AS a" . "\n LEFT JOIN #__menu AS m ON m.componentid = a.id" . "\n WHERE ( a.name LIKE '%{$text}%'" . "\n OR a.title LIKE '%{$text}%'" . "\n OR a.description LIKE '%{$text}%' )" . "\n AND a.published = 1" . "\n AND a.access <= " . (int) $my->gid . "\n AND ( m.type = 'content_section' OR m.type = 'content_blog_section' )" . "\n GROUP BY a.id" . "\n ORDER BY {$order}";
$database->setQuery($query, 0, $limit);
$rows = $database->loadObjectList();
$count = count($rows);
for ($i = 0; $i < $count; $i++) {
if ($rows[$i]->menutype == 'content_section') {
$rows[$i]->href = 'index.php?option=com_content&task=section&id=' . $rows[$i]->secid . '&Itemid=' . $rows[$i]->menuid;
$rows[$i]->section = _SEARCH_SECLIST;
}
if ($rows[$i]->menutype == 'content_blog_section') {
$rows[$i]->href = 'index.php?option=com_content&task=blogsection&id=' . $rows[$i]->secid . '&Itemid=' . $rows[$i]->menuid;
$rows[$i]->section = _SEARCH_SECBLOG;
}
}
return $rows;
}
示例6: botSearchContacts
/**
* Contacts Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
*/
function botSearchContacts($text, $phrase = '', $ordering = '')
{
global $database, $my, $_MAMBOTS;
// check if param query has previously been processed
if (!isset($_MAMBOTS->_search_mambot_params['contacts'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'contacts.searchbot'" . "\n AND folder = 'search'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_search_mambot_params['contacts'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_search_mambot_params['contacts'];
$botParams = new mosParameters($mambot->params);
$limit = $botParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
$section = _CONTACT_TITLE;
switch ($ordering) {
case 'alpha':
$order = 'a.name ASC';
break;
case 'category':
$order = 'b.title ASC, a.name ASC';
break;
case 'popular':
case 'newest':
case 'oldest':
default:
$order = 'a.name DESC';
break;
}
$query = "SELECT a.name AS title," . "\n CONCAT_WS( ', ', a.name, a.con_position, a.misc ) AS text," . "\n '' AS created," . "\n CONCAT_WS( ' / ', " . $database->Quote($section) . ", b.title ) AS section," . "\n '2' AS browsernav," . "\n CONCAT( 'index.php?option=com_contact&task=view&contact_id=', a.id ) AS href" . "\n FROM #__contact_details AS a" . "\n INNER JOIN #__categories AS b ON b.id = a.catid" . "\n WHERE ( a.name LIKE '%{$text}%'" . "\n OR a.misc LIKE '%{$text}%'" . "\n OR a.con_position LIKE '%{$text}%'" . "\n OR a.address LIKE '%{$text}%'" . "\n OR a.suburb LIKE '%{$text}%'" . "\n OR a.state LIKE '%{$text}%'" . "\n OR a.country LIKE '%{$text}%'" . "\n OR a.postcode LIKE '%{$text}%'" . "\n OR a.telephone LIKE '%{$text}%'" . "\n OR a.fax LIKE '%{$text}%' )" . "\n AND a.published = 1" . "\n AND b.published = 1" . "\n AND a.access <= " . (int) $my->gid . "\n AND b.access <= " . (int) $my->gid . "\n GROUP BY a.id" . "\n ORDER BY {$order}";
$database->setQuery($query, 0, $limit);
$rows = $database->loadObjectList();
return $rows;
}
示例7: botMosLoadPosition
/**
* Mambot that loads module positions within content
*/
function botMosLoadPosition($published, &$row, &$params, $page = 0)
{
global $database, $_MAMBOTS;
// simple performance check to determine whether bot should process further
if (strpos($row->text, 'mosloadposition') === false) {
return true;
}
// expression to search for
$regex = '/{mosloadposition\\s*.*?}/i';
// check whether mambot has been unpublished
if (!$published) {
$row->text = preg_replace($regex, '', $row->text);
return true;
}
// find all instances of mambot and put in $matches
preg_match_all($regex, $row->text, $matches);
// Number of mambots
$count = count($matches[0]);
// mambot only processes if there are any instances of the mambot in the text
if ($count) {
// check if param query has previously been processed
if (!isset($_MAMBOTS->_content_mambot_params['mosloadposition'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'mosloadposition'" . "\n AND folder = 'content'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_content_mambot_params['mosloadposition'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_content_mambot_params['mosloadposition'];
$botParams = new mosParameters($mambot->params);
$style = $botParams->def('style', -2);
processPositions($row, $matches, $count, $regex, $style);
}
}
示例8: botExtendedMenuSourceWeblinks_onLoadMenu
function botExtendedMenuSourceWeblinks_onLoadMenu(&$menuLoader, $name = '')
{
global $database;
$botName = 'bot_exmenu_source_weblinks';
// load parameters
$database->setQuery('SELECT m.params FROM #__mambots AS m WHERE element = \'' . $botName . '\' AND folder = \'exmenu\'');
$params = new mosParameters($database->loadResult());
$params->def('source_name', 'weblinks');
if ($name != $params->get('source_name')) {
return FALSE;
}
$rootMenuNode =& $menuLoader->getRootMenuNode();
$database->setQuery('SELECT * FROM #__weblinks WHERE published = 1 ORDER BY hits DESC, title LIMIT 10');
$rows = $database->loadObjectList();
foreach (array_keys($rows) as $key) {
$row =& $rows[$key];
$menuNode =& $menuLoader->getEmptyMenuNode();
$menuNode->type = 'url';
$menuNode->link = $row->url;
$menuNode->name = $row->title;
$menuLoader->addMenuNode($rootMenuNode, $menuNode);
}
return TRUE;
}
示例9: edit
function edit(&$uid, $menutype, $option)
{
global $database, $my, $mainframe;
$menu = new mosMenu($database);
$menu->load((int) $uid);
// fail if checked out not by 'me'
if ($menu->checked_out && $menu->checked_out != $my->id) {
mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
}
if ($uid) {
$menu->checkout($my->id);
} else {
$menu->type = 'wrapper';
$menu->menutype = $menutype;
$menu->ordering = 9999;
$menu->parent = intval(mosGetParam($_POST, 'parent', 0));
$menu->published = 1;
$menu->link = 'index.php?option=com_wrapper';
}
// build the html select list for ordering
$lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
// build the html select list for the group access
$lists['access'] = mosAdminMenus::Access($menu);
// build the html select list for paraent item
$lists['parent'] = mosAdminMenus::Parent($menu);
// build published button option
$lists['published'] = mosAdminMenus::Published($menu);
// build the url link output
$lists['link'] = mosAdminMenus::Link($menu, $uid);
// get params definitions
$params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
if ($uid) {
$menu->url = $params->def('url', '');
}
wrapper_menu_html::edit($menu, $lists, $params, $option);
}
示例10: array
$_SESSION['session_username'] = $my->username;
$_SESSION['session_usertype'] = $my->usertype;
$_SESSION['session_gid'] = $my->gid;
$_SESSION['session_logintime'] = $logintime;
$_SESSION['session_user_params'] = $my->params;
$_SESSION['session_userstate'] = array();
session_write_close();
$expired = 'index2.php';
// check if site designated as a production site
// for a demo site disallow expired page functionality
if ($_VERSION->SITE == 1 && @$mosConfig_admin_expired === '1') {
$file = $mainframe->getPath('com_xml', 'com_users');
$params = new mosParameters($my->params, $file, 'component');
$now = time();
// expired page functionality handling
$expired = $params->def('expired', '');
$expired_time = $params->def('expired_time', '');
// if now expired link set or expired time is more than half the admin session life set, simply load normal admin homepage
$checktime = ($mosConfig_session_life_admin ? $mosConfig_session_life_admin : 1800) / 2;
if (!$expired || $now - $expired_time > $checktime) {
$expired = 'index2.php';
}
// link must also be a Joomla link to stop malicious redirection
if (strpos($expired, 'index2.php?option=com_') !== 0) {
$expired = 'index2.php';
}
// clear any existing expired page data
$params->set('expired', '');
$params->set('expired_time', '');
// param handling
if (is_array($params->toArray())) {
示例11: botMosPaging
/**
* Page break mambot
*
* <b>Usage:</b>
* <code>{mospagebreak}</code>
* <code>{mospagebreak title=The page title}</code>
* or
* <code>{mospagebreak heading=The first page}</code>
* or
* <code>{mospagebreak title=The page title&heading=The first page}</code>
* or
* <code>{mospagebreak heading=The first page&title=The page title}</code>
*
*/
function botMosPaging($published, &$row, &$params, $page = 0)
{
global $mainframe, $Itemid, $database, $_MAMBOTS;
// simple performance check to determine whether bot should process further
if (strpos($row->text, 'mospagebreak') === false) {
return true;
}
// expression to search for
$regex = '/{(mospagebreak)\\s*(.*?)}/i';
// check whether mambot has been unpublished
if (!$published || $params->get('intro_only') || $params->get('popup')) {
$row->text = preg_replace($regex, '', $row->text);
return;
}
// find all instances of mambot and put in $matches
$matches = array();
preg_match_all($regex, $row->text, $matches, PREG_SET_ORDER);
// split the text around the mambot
$text = preg_split($regex, $row->text);
// count the number of pages
$n = count($text);
// we have found at least one mambot, therefore at least 2 pages
if ($n > 1) {
// check if param query has previously been processed
if (!isset($_MAMBOTS->_content_mambot_params['mospaging'])) {
// load mambot params info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'mospaging'" . "\n AND folder = 'content'";
$database->setQuery($query);
$database->loadObject($mambot);
// save query to class variable
$_MAMBOTS->_content_mambot_params['mospaging'] = $mambot;
}
// pull query data from class variable
$mambot = $_MAMBOTS->_content_mambot_params['mospaging'];
$botParams = new mosParameters($mambot->params);
$title = $botParams->def('title', 1);
// adds heading or title to <site> Title
if ($title) {
$page_text = $page + 1;
$row->page_title = _PN_PAGE . ' ' . $page_text;
if (!$page) {
// processing for first page
parse_str(html_entity_decode($matches[0][2]), $args);
if (@$args['heading']) {
//$row->page_title = $args['heading'];
$row->page_title = '';
} else {
$row->page_title = '';
}
} else {
if ($matches[$page - 1][2]) {
parse_str(html_entity_decode($matches[$page - 1][2]), $args);
if (@$args['title']) {
$row->page_title = ': ' . stripslashes($args['title']);
}
}
}
}
// reset the text, we already hold it in the $text array
$row->text = '';
$hasToc = $mainframe->getCfg('multipage_toc');
if ($hasToc) {
// display TOC
createTOC($row, $matches, $page);
} else {
$row->toc = '';
}
// traditional mos page navigation
require_once $GLOBALS['mosConfig_absolute_path'] . '/includes/pageNavigation.php';
$pageNav = new mosPageNav($n, $page, 1);
// page counter
$row->text .= '<div class="pagenavcounter">';
$row->text .= $pageNav->writeLeafsCounter();
$row->text .= '</div>';
// page text
$row->text .= $text[$page];
$row->text .= '<br />';
$row->text .= '<div class="pagenavbar">';
// adds navigation between pages to bottom of text
if ($hasToc) {
createNavigation($row, $page, $n);
}
// page links shown at bottom of page if TOC disabled
if (!$hasToc) {
$row->text .= $pageNav->writePagesLinks('index.php?option=com_content&task=view&id=' . $row->id . '&Itemid=' . $Itemid);
}
//.........这里部分代码省略.........
示例12: dofreePDF
function dofreePDF()
{
global $mosConfig_live_site, $mosConfig_sitename, $mosConfig_offset;
global $mainframe, $database, $my;
$id = intval(mosGetParam($_REQUEST, 'id', 1));
$gid = $my->gid;
$now = _CURRENT_SERVER_TIME;
$nullDate = $database->getNullDate();
// query to check for state and access levels
$query = "SELECT a.*, cc.name AS category, s.name AS section, s.published AS sec_pub, cc.published AS cat_pub," . "\n s.access AS sec_access, cc.access AS cat_access, s.id AS sec_id, cc.id as cat_id" . "\n FROM #__content AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE a.id = " . (int) $id . "\n AND a.state = 1" . "\n AND a.access <= " . (int) $gid . "\n AND ( a.publish_up = " . $database->Quote($nullDate) . " OR a.publish_up <= " . $database->Quote($now) . " )" . "\n AND ( a.publish_down = " . $database->Quote($nullDate) . " OR a.publish_down >= " . $database->Quote($now) . " )";
$database->setQuery($query);
$row = NULL;
if ($database->loadObject($row)) {
/*
* check whether category is published
*/
if (!$row->cat_pub && $row->catid) {
mosNotAuth();
return;
}
/*
* check whether section is published
*/
if (!$row->sec_pub && $row->sectionid) {
mosNotAuth();
return;
}
/*
* check whether category access level allows access
*/
if ($row->cat_access > $gid && $row->catid) {
mosNotAuth();
return;
}
/*
* check whether section access level allows access
*/
if ($row->sec_access > $gid && $row->sectionid) {
mosNotAuth();
return;
}
include 'includes/class.ezpdf.php';
$params = new mosParameters($row->attribs);
$params->def('author', !$mainframe->getCfg('hideAuthor'));
$params->def('createdate', !$mainframe->getCfg('hideCreateDate'));
$params->def('modifydate', !$mainframe->getCfg('hideModifyDate'));
$row->fulltext = pdfCleaner($row->fulltext);
$row->introtext = pdfCleaner($row->introtext);
$pdf = new Cezpdf('a4', 'P');
//A4 Portrait
$pdf->ezSetCmMargins(2, 1.5, 1, 1);
$pdf->selectFont('./fonts/Helvetica.afm');
//choose font
$all = $pdf->openObject();
$pdf->saveState();
$pdf->setStrokeColor(0, 0, 0, 1);
// footer
$pdf->addText(250, 822, 6, $mosConfig_sitename);
$pdf->line(10, 40, 578, 40);
$pdf->line(10, 818, 578, 818);
$pdf->addText(30, 34, 6, $mosConfig_live_site);
$pdf->addText(250, 34, 6, _PDF_POWERED);
$pdf->addText(450, 34, 6, _PDF_GENERATED . ' ' . date('j F, Y, H:i', time() + $mosConfig_offset * 60 * 60));
$pdf->restoreState();
$pdf->closeObject();
$pdf->addObject($all, 'all');
$pdf->ezSetDy(30);
$txt1 = $row->title;
$pdf->ezText($txt1, 14);
$txt2 = AuthorDateLine($row, $params);
$pdf->ezText($txt2, 8);
$txt3 = $row->introtext . "\n" . $row->fulltext;
$pdf->ezText($txt3, 10);
$pdf->ezStream();
} else {
mosNotAuth();
return;
}
}
示例13: contactpage
function contactpage($contact_id)
{
global $mainframe, $database, $my, $Itemid;
$query = "SELECT a.id AS value, CONCAT_WS( ' - ', a.name, a.con_position ) AS text, a.catid, cc.access AS cat_access" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = 1" . "\n AND cc.published = 1" . "\n AND a.access <= " . (int) $my->gid . "\n ORDER BY a.default_con DESC, a.ordering ASC";
$database->setQuery($query);
$checks = $database->loadObjectList();
$count = count($checks);
if ($count) {
if ($contact_id < 1) {
$contact_id = $checks[0]->value;
}
$query = "SELECT a.*, cc.access AS cat_access" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = 1" . "\n AND a.id = " . (int) $contact_id . "\n AND a.access <= " . (int) $my->gid;
$database->SetQuery($query);
$contacts = $database->LoadObjectList();
if (!$contacts) {
echo _NOT_AUTH;
return;
}
$contact = $contacts[0];
/*
* check whether category access level allows access
*/
if ($contact->cat_access > $my->gid) {
mosNotAuth();
return;
}
$list = array();
foreach ($checks as $check) {
if ($check->catid == $contact->catid) {
$list[] = $check;
}
}
// creates dropdown select list
$contact->select = mosHTML::selectList($list, 'contact_id', 'class="inputbox" onchange="ViewCrossReference(this);"', 'value', 'text', $contact_id);
// Adds parameter handling
$params = new mosParameters($contact->params);
$params->set('page_title', 0);
$params->def('pageclass_sfx', '');
$params->def('back_button', $mainframe->getCfg('back_button'));
$params->def('print', !$mainframe->getCfg('hidePrint'));
$params->def('name', 1);
$params->def('email', 0);
$params->def('street_address', 1);
$params->def('suburb', 1);
$params->def('state', 1);
$params->def('country', 1);
$params->def('postcode', 1);
$params->def('telephone', 1);
$params->def('fax', 1);
$params->def('misc', 1);
$params->def('image', 1);
$params->def('email_description', 1);
$params->def('email_description_text', _EMAIL_DESCRIPTION);
$params->def('email_form', 1);
$params->def('email_copy', 0);
// global pront|pdf|email
$params->def('icons', $mainframe->getCfg('icons'));
// contact only icons
$params->def('contact_icons', 0);
$params->def('icon_address', '');
$params->def('icon_email', '');
$params->def('icon_telephone', '');
$params->def('icon_fax', '');
$params->def('icon_misc', '');
$params->def('drop_down', 0);
$params->def('vcard', 0);
if ($contact->email_to && $params->get('email')) {
// email cloacking
$contact->email = mosHTML::emailCloaking($contact->email_to);
}
// loads current template for the pop-up window
$pop = intval(mosGetParam($_REQUEST, 'pop', 0));
if ($pop) {
$params->set('popup', 1);
$params->set('back_button', 0);
}
if ($params->get('email_description')) {
$params->set('email_description', $params->get('email_description_text'));
} else {
$params->set('email_description', '');
}
// needed to control the display of the Address marker
$temp = $params->get('street_address') . $params->get('suburb') . $params->get('state') . $params->get('country') . $params->get('postcode');
$params->set('address_check', $temp);
// determines whether to use Text, Images or nothing to highlight the different info groups
switch ($params->get('contact_icons')) {
case 1:
// text
$params->set('marker_address', _CONTACT_ADDRESS);
$params->set('marker_email', _CONTACT_EMAIL);
$params->set('marker_telephone', _CONTACT_TELEPHONE);
$params->set('marker_fax', _CONTACT_FAX);
$params->set('marker_misc', _CONTACT_MISC);
$params->set('column_width', '100');
break;
case 2:
// none
$params->set('marker_address', '');
$params->set('marker_email', '');
$params->set('marker_telephone', '');
//.........这里部分代码省略.........
示例14: botTinymceEditorInit
/**
* TinyMCE WYSIWYG Editor - javascript initialisation
*/
function botTinymceEditorInit()
{
global $mosConfig_live_site, $database, $mosConfig_absolute_path, $mainframe;
// load tinymce info
$query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'tinymce'" . "\n AND folder = 'editors'";
$database->setQuery($query);
$database->loadObject($mambot);
$params = new mosParameters($mambot->params);
$theme = $params->get('theme', 'advanced');
// handling for former default option
if ($theme == 'default') {
$theme = 'advanced';
}
$toolbar = $params->def('toolbar', 'top');
$html_height = $params->def('html_height', '550');
$html_width = $params->def('html_width', '750');
$text_direction = $params->def('text_direction', 'ltr');
$content_css = $params->def('content_css', 1);
$content_css_custom = $params->def('content_css_custom', '');
$invalid_elements = $params->def('invalid_elements', 'script,applet,iframe');
$newlines = $params->def('newlines', 0);
$cleanup = $params->def('cleanup', 1);
$cleanup_startup = $params->set('cleanup_startup', 0);
// Currently disabled due to bugs in TinyMCE
$compressed = $params->def('compressed', 0);
$relative_urls = $params->def('relative_urls', 0);
// Plugins
// preview
$preview = $params->def('preview', 1);
$preview_height = $params->def('preview_height', '550');
$preview_width = $params->def('preview_width', '750');
// insert date
$insertdate = $params->def('insertdate', 1);
$format_date = $params->def('format_date', '%Y-%m-%d');
// insert time
$inserttime = $params->def('inserttime', 1);
$format_time = $params->def('format_time', '%H:%M:%S');
// search & replace
$searchreplace = $params->def('searchreplace', 1);
// emotions
$smilies = $params->def('smilies', 1);
// flash
$flash = $params->def('flash', 1);
// table
$table = $params->def('table', 1);
// horizontal line
$hr = $params->def('hr', 1);
// fullscreen
$fullscreen = $params->def('fullscreen', 1);
// autosave
$autosave = $params->def('autosave', 0);
// layer
$layer = $params->def('layer', 1);
// style
$style = $params->def('style', 1);
// visualchars
$visualchars = $params->def('visualchars', 1);
// media
$media = $params->def('media', 1);
// nonbreaking
$nonbreaking = $params->def('nonbreaking', 1);
if ($relative_urls) {
$relative_urls = 'true';
} else {
$relative_urls = 'false';
}
if ($content_css_custom) {
$content_css = 'content_css : "' . $content_css_custom . '", ';
} else {
$query = "SELECT template" . "\n FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND menuid = 0";
$database->setQuery($query);
$template = $database->loadResult();
$file_path = $mosConfig_absolute_path . '/templates/' . $template . '/css/';
if ($content_css) {
$file = 'template.css';
} else {
$file = 'editor_content.css';
}
$content_css = 'content_css : "' . $mosConfig_live_site . '/templates/' . $template . '/css/';
if (file_exists($file_path . '/' . $file)) {
$content_css = $content_css . $file . '", ';
} else {
$content_css = $content_css . 'template_css.css", ';
}
}
$plugins[] = '';
$buttons2[] = '';
$buttons3[] = '';
$elements[] = '';
if ($cleanup) {
$cleanup = 'true';
} else {
$cleanup = 'false';
}
if ($cleanup_startup) {
$cleanup_startup = 'true';
} else {
//.........这里部分代码省略.........
示例15: showWrap
function showWrap($option)
{
global $database, $Itemid, $mainframe;
$menu = $mainframe->get('menu');
$params = new mosParameters($menu->params);
$params->def('back_button', $mainframe->getCfg('back_button'));
$params->def('scrolling', 'auto');
$params->def('page_title', '1');
$params->def('pageclass_sfx', '');
$params->def('header', $menu->name);
$params->def('height', '500');
$params->def('height_auto', '0');
$params->def('width', '100%');
$params->def('add', '1');
$url = $params->def('url', '');
$row = new stdClass();
if ($params->get('add')) {
// adds 'http://' if none is set
if (substr($url, 0, 1) == '/') {
// relative url in component. use server http_host.
$row->url = 'http://' . $_SERVER['HTTP_HOST'] . $url;
} elseif (!strstr($url, 'http') && !strstr($url, 'https')) {
$row->url = 'http://' . $url;
} else {
$row->url = $url;
}
} else {
$row->url = $url;
}
// auto height control
if ($params->def('height_auto')) {
$row->load = 'onload="iFrameHeight()"';
} else {
$row->load = '';
}
$mainframe->SetPageTitle($menu->name);
HTML_wrapper::displayWrap($row, $params, $menu);
}