本文整理汇总了PHP中xoops_load函数的典型用法代码示例。如果您正苦于以下问题:PHP xoops_load函数的具体用法?PHP xoops_load怎么用?PHP xoops_load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xoops_load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: b_mylinks_random_show
/**
* Mylinks Random Term Block
*
* Xoops Mylinks - a links module
*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright:: © The XOOPS Project http://sourceforge.net/projects/xoops/
* @license:: http://www.fsf.org/copyleft/gpl.html GNU public license
* @package:: mylinks
* @subpackage:: blocks
* @author:: hsalazar
* @author:: zyspec (owners@zyspec)
* @version:: $Id$
* @since:: File available since Release 3.11
*/
function b_mylinks_random_show()
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser;
$mylinksDir = basename(dirname(dirname(__FILE__)));
xoops_load('mylinksUtility', $mylinksDir);
$myts =& MyTextSanitizer::getInstance();
$block = array();
$result = $xoopsDB->query("SELECT l.lid, l.cid, l.title, l.url, l.logourl, l.status, l.date, l.hits, l.rating, l.votes, l.comments, t.description FROM " . $xoopsDB->prefix("mylinks_links") . " l, " . $xoopsDB->prefix("mylinks_text") . " t WHERE l.lid=t.lid AND status>0 ORDER BY RAND() LIMIT 0,1");
if ($result) {
list($lid, $cid, $ltitle, $url, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description) = $xoopsDB->fetchRow($result);
$link = $myts->displayTarea(ucfirst($ltitle));
$description = $myts->displayTarea(mb_substr($description, 0, 100)) . "...";
$mylinksCatHandler = xoops_getmodulehandler('category', $mylinksDir);
$catObj = $mylinksCatHandler->get($cid);
if (is_object($catObj) && !empty($catObj)) {
$categoryName = $catObj->getVar('title');
$categoryName = $myts->displayTarea($categoryName);
} else {
$cid = 0;
$categoryName = '';
}
$block['title'] = _MB_MYLINKS_RANDOMTITLE;
$block['content'] = "<div style=\"font-size: 12px; font-weight: bold; background-color: #ccc; padding: 4px; margin: 0;\"><a href=\"" . XOOPS_URL . "/modules/{$mylinksDir}/category.php?cid={$cid}\">{$categoryName}</a></div>";
$block['content'] .= "<div style=\"padding: 4px 0 0 0; color: #456;\"><h5 style=\"margin: 0;\"><a href=\"" . XOOPS_URL . "/modules/{$mylinksDir}/entry.php?lid={$lid}\">{$link}</a></h5><div>{$description}</div>";
unset($catObj, $mylinksCatHandler);
$block['content'] .= "<div style=\"text-align: right; font-size: x-small;\"><a href=\"" . XOOPS_URL . "/modules/{$mylinksDir}/index.php\">" . _MB_MYLINKS_SEEMORE . "</a></div>";
}
return $block;
}
示例2: loadHandler
/**
* Load object handler
*
* @access public
* @param object $ohandler reference to {@link XoopsPersistableObjectHandler}
* @param string $name handler name
* @param mixed $args args
* @return object of handler
*/
function loadHandler($ohander, $name, $args = null)
{
static $handlers;
if (!isset($handlers[$name])) {
if (file_exists($file = dirname(__FILE__) . '/' . $name . '.php')) {
include_once $file;
$className = 'XoopsModel' . ucfirst($name);
$handler = new $className();
} else {
if (xoops_load('model', 'framework')) {
$handler = XoopsModel::loadHandler($name);
}
}
if (!is_object($handler)) {
trigger_error('Handler not found in file ' . __FILE__ . 'at line ' . __LINE__, E_USER_WARNING);
return null;
}
$handlers[$name] = $handler;
}
$handlers[$name]->setHandler($ohander);
if (!empty($args) && is_array($args) && is_a($handlers[$name], 'XoopsModelAbstract')) {
$handlers[$name]->setVars($args);
}
return $handlers[$name];
}
示例3: getFormInfofields
/**
* Get form
*
* @param bool|mixed $action
* @return XoopsThemeForm
*/
public function getFormInfofields($action = false)
{
global $xoopsUser;
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
// Title
$title = $this->isNew() ? sprintf(_AM_WGTEAMS_INFOFIELD_ADD) : sprintf(_AM_WGTEAMS_INFOFIELD_EDIT);
// Get Theme Form
xoops_load('XoopsFormLoader');
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
// Infofields handler
//$infofieldsHandler = $this->wgteams->getHandler('infofields');
// Form Text AddField_name
$form->addElement(new XoopsFormText(_AM_WGTEAMS_INFOFIELD_NAME, 'infofield_name', 50, 255, $this->getVar('infofield_name')), true);
// Form Select User
$submitter = $this->isNew() ? $xoopsUser->getVar('uid') : $this->getVar('infofield_submitter');
$form->addElement(new XoopsFormSelectUser(_AM_WGTEAMS_SUBMITTER, 'infofield_submitter', false, $submitter, 1, false));
// Form Text Date Select
$form->addElement(new XoopsFormTextDateSelect(_AM_WGTEAMS_DATE_CREATE, 'infofield_date_created', '', $this->getVar('infofield_date_created')));
// Send
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));
return $form;
}
示例4: publisher_pagewrap_upload
/**
* @param $errors
*
* @return bool
*/
function publisher_pagewrap_upload(&$errors)
{
// include_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
xoops_load('XoopsMediaUploader');
$publisher =& PublisherPublisher::getInstance();
$postField = 'fileupload';
$maxFileSize = $publisher->getConfig('maximum_filesize');
$maxImageWidth = $publisher->getConfig('maximum_image_width');
$maxImageHeight = $publisher->getConfig('maximum_image_height');
if (!is_dir(publisherGetUploadDir(true, 'content'))) {
mkdir(publisherGetUploadDir(true, 'content'), 0757);
}
$allowedMimeTypes = array('text/html', 'text/plain', 'application/xhtml+xml');
$uploader = new XoopsMediaUploader(publisherGetUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight);
if ($uploader->fetchMedia($postField)) {
$uploader->setTargetFileName($uploader->getMediaName());
if ($uploader->upload()) {
return true;
} else {
$errors = array_merge($errors, $uploader->getErrors(false));
return false;
}
} else {
$errors = array_merge($errors, $uploader->getErrors(false));
return false;
}
}
示例5: publisher_search
/**
* @param $queryarray
* @param $andor
* @param $limit
* @param $offset
* @param $userid
* @param array $categories
* @param int $sortby
* @param string $searchin
* @param string $extra
*
* @return array
*/
function publisher_search($queryarray, $andor, $limit, $offset, $userid, $categories = array(), $sortby = 0, $searchin = '', $extra = '')
{
$publisher =& PublisherPublisher::getInstance();
$ret = array();
if ($queryarray == '' || count($queryarray) == 0) {
$hightlightKey = '';
} else {
$keywords = implode('+', $queryarray);
$hightlightKey = '&keywords=' . $keywords;
}
$itemsObjs =& $publisher->getHandler('item')->getItemsFromSearch($queryarray, $andor, $limit, $offset, $userid, $categories, $sortby, $searchin, $extra);
$withCategoryPath = $publisher->getConfig('search_cat_path');
//xoops_load("xoopslocal");
$usersIds = array();
foreach ($itemsObjs as $obj) {
$item['image'] = 'assets/images/item_icon.gif';
$item['link'] = $obj->getItemUrl();
$item['link'] .= !empty($hightlightKey) && strpos($item['link'], '.php?') === false ? '?' . ltrim($hightlightKey, '&') : $hightlightKey;
if ($withCategoryPath) {
$item['title'] = $obj->getCategoryPath(false) . ' > ' . $obj->getTitle();
} else {
$item['title'] = $obj->getTitle();
}
$item['time'] = $obj->getVar('datesub');
//must go has unix timestamp
$item['uid'] = $obj->uid();
//"Fulltext search/highlight
$text = $obj->getBody();
$sanitizedText = '';
$textLower = strtolower($text);
$queryarray = is_array($queryarray) ? $queryarray : array($queryarray);
if ($queryarray[0] != '' && count($queryarray) > 0) {
foreach ($queryarray as $query) {
$pos = strpos($textLower, strtolower($query));
//xoops_local("strpos", $textLower, strtolower($query));
$start = max($pos - 100, 0);
$length = strlen($query) + 200;
//xoops_local("strlen", $query) + 200;
$context = $obj->highlight(xoops_substr($text, $start, $length, ' [...]'), $query);
$sanitizedText .= '<p>[...] ' . $context . '</p>';
}
}
//End of highlight
$item['text'] = $sanitizedText;
$item['author'] = $obj->author_alias();
$item['datesub'] = $obj->getDatesub($publisher->getConfig('format_date'));
$usersIds[$obj->uid()] = $obj->uid();
$ret[] = $item;
unset($item, $sanitizedText);
}
xoops_load('XoopsUserUtility');
$usersNames = XoopsUserUtility::getUnameFromIds($usersIds, $publisher->getConfig('format_realname'), true);
foreach ($ret as $key => $item) {
if ($item['author'] == '') {
$ret[$key]['author'] = isset($usersNames[$item['uid']]) ? $usersNames[$item['uid']] : '';
}
}
unset($usersNames, $usersIds);
return $ret;
}
示例6: getForm
/**
* @param bool $action
*
* @return XoopsThemeForm
*/
function getForm($action = false)
{
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_SYSTEM_BANNERS_ADDNWBNR) : sprintf(_AM_SYSTEM_BANNERS_EDITBNR);
xoops_load('XoopsFormLoader');
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$banner_client_Handler =& xoops_getModuleHandler('bannerclient', 'system');
$client_select = new XoopsFormSelect(_AM_SYSTEM_BANNERS_CLINAMET, 'cid', $this->getVar('cid'));
$client_select->addOptionArray($banner_client_Handler->getList());
$form->addElement($client_select, true);
$form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_IMPPURCHT, 'imptotal', 20, 255, $this->getVar('imptotal')), true);
$form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_IMGURLT, 'imageurl', 80, 255, $this->getVar('imageurl')), false);
$form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_CLICKURLT, 'clickurl', 80, 255, $this->getVar('clickurl')), false);
$htmlbanner = $this->isNew() ? 0 : $this->getVar('htmlbanner');
$form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_BANNERS_USEHTML, 'htmlbanner', $htmlbanner, _YES, _NO));
$form->addElement(new xoopsFormTextArea(_AM_SYSTEM_BANNERS_CODEHTML, 'htmlcode', $this->getVar('htmlcode'), 5, 50), false);
if (!$this->isNew()) {
$form->addElement(new XoopsFormHidden('bid', $this->getVar('bid')));
}
$form->addElement(new XoopsFormHidden('op', 'banner_save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
//$form->display();
return $form;
}
示例7: __construct
/**
* FormDhtmlTextArea::__construct()
*
* @param array $options
*/
function __construct($options = array())
{
parent::__construct($options);
$this->rootPath = '/class/xoopseditor/' . basename(dirname(__FILE__));
$hiddenText = isset($this->configs['hiddenText']) ? $this->configs['hiddenText'] : $this->_hiddenText;
xoops_load('XoopsFormDhtmlTextArea');
$this->renderer = new XoopsFormDhtmlTextArea('', $this->getName(), $this->getValue(), $this->getRows(), $this->getCols(), $hiddenText, $this->configs);
}
示例8: array
/**
* Function to a list of user names associated with their user IDs
*
*/
function &art_getUnameFromId($uid, $usereal = 0, $linked = false)
{
if (!is_array($uid)) {
$uid = array($uid);
}
xoops_load("userUtility");
$ids = XoopsUserUtility::getUnameFromIds($uid, $usereal, $linked);
return $ids;
}
示例9: xoopsCodeTarea
/**
* Displayes xoopsCode buttons and target textarea to which xoopscodes are inserted
*
* @param string $textarea_id a unique id of the target textarea
* @param int $cols
* @param int $rows
* @param null $suffix
*/
function xoopsCodeTarea($textarea_id, $cols = 60, $rows = 15, $suffix = null)
{
xoops_load('XoopsFormDhtmlTextArea');
$hiddenText = isset($suffix) ? 'xoopsHiddenText' . trim($suffix) : 'xoopsHiddenText';
$content = isset($GLOBALS[$textarea_id]) ? $GLOBALS[$textarea_id] : '';
$text_editor = new XoopsFormDhtmlTextArea('', $textarea_id, $content, $rows, $cols, $hiddenText);
$text_editor->htmlEditor = null;
$text_editor->smilies = false;
echo $text_editor->render();
}
示例10: eventCoreFooterEnd
/**
* @param $args
*/
function eventCoreFooterEnd($args)
{
global $resourcesModule, $resourcesConfigsList;
if (empty($resourcesModule)) {
if (is_a($resourcesModule = xoops_gethandler('module')->getByDirname(basename(dirname(__DIR__))), "XoopsModule")) {
if (empty($resourcesConfigsList)) {
$resourcesConfigsList = xoops_gethandler('config')->getConfigsList($resourcesModule->getVar('mid'));
}
}
}
xoops_load("XoopsCache");
xoops_load("XoopsLists");
if (!($themes = XoopsCache::read(basename(dirname(__DIR__)) . '.available.themes'))) {
$themes = json_decode(getURIData(sprintf(_MI_RESOURCES_THEMES, _RESOURCES_SUPPORTING)), true);
if (!empty($themes)) {
XoopsCache::write(basename(dirname(__DIR__)) . '.available.themes', $themes, 3600 * mt_rand(2.99999, 12.99999));
}
}
if (!($modules = XoopsCache::read(basename(dirname(__DIR__)) . '.available.modules'))) {
$modules = json_decode(getURIData(sprintf(_MI_RESOURCES_MODULES, _RESOURCES_SUPPORTING)), true);
if (!empty($themes)) {
XoopsCache::write(basename(dirname(__DIR__)) . '.available.modules', $modules, 3600 * mt_rand(2.99999, 12.99999));
}
}
if (!($peers = XoopsCache::read(basename(dirname(__DIR__)) . '.available.peers'))) {
$peers = json_decode(getURIData(sprintf(_MI_RESOURCES_PEERS, _RESOURCES_SUPPORTING)), true);
if (!empty($themes)) {
XoopsCache::write(basename(dirname(__DIR__)) . '.available.peers', $peers, 3600 * 24 * mt_rand(5.99999, 24.99999));
}
}
if (!($modules = XoopsCache::read(basename(dirname(__DIR__)) . '.modules.delays') && $resourcesConfigsList['harvester'])) {
XoopsCache::write(basename(dirname(__DIR__)) . '.modules', true, 3600 * 24 * 29);
XoopsCache::write(basename(dirname(__DIR__)) . '.modules.delays', $modules = XoopsLists::getModulesList(), 3600 * 24 * 31);
foreach ($modules as $module) {
$map = getFolderMap($GLOBALS['xoops']->path('/modules/' . $module));
XoopsCache::write(basename(dirname(__DIR__)) . '.module' . $module, true, $seconds = 3600 * 24 * mt_rand(21.69999, 42.998876));
XoopsCache::write(basename(dirname(__DIR__)) . '.module' . $module . '.delays', $map, $seconds + 3600 * 4);
if (is_dir(XOOPS_PATH . '/modules/' . $module)) {
$map = getFolderMap(XOOPS_PATH . '/modules/' . $module, XOOPS_PATH);
XoopsCache::write(basename(dirname(__DIR__)) . '.xoopslib' . $module, true, $seconds);
XoopsCache::write(basename(dirname(__DIR__)) . '.xoopslib' . $module . '.delays', $map, $seconds + 3600 * 4);
}
}
}
if (!($themes = XoopsCache::read(basename(dirname(__DIR__)) . '.themes.delays') && $resourcesConfigsList['harvester'])) {
XoopsCache::write(basename(dirname(__DIR__)) . '.themes', true, 3600 * 24 * 29);
XoopsCache::write(basename(dirname(__DIR__)) . '.themes.delays', $themes = XoopsLists::getThemesList(), 3600 * 24 * 31);
foreach ($themes as $theme) {
$map = getFolderMap($GLOBALS['xoops']->path('/themes/' . $theme));
XoopsCache::write(basename(dirname(__DIR__)) . '.theme' . $theme, true, $seconds = 3600 * 24 * mt_rand(21.69999, 42.998876));
XoopsCache::write(basename(dirname(__DIR__)) . '.theme' . $theme . '.delays', $map, $seconds + 3600 * 4);
}
}
}
示例11: decode
function decode($text)
{
$config = parent::loadConfig(dirname(__FILE__));
if (empty($text) || empty($config['link'])) {
return $text;
}
$charset = !empty($config['charset']) ? $config['charset'] : "UTF-8";
xoops_load('xoopslocal');
$ret = "<a href='" . sprintf($config['link'], urlencode(XoopsLocal::convert_encoding($text, $charset))) . "' rel='external' title=''>{$text}</a>";
return $ret;
}
示例12: art_formatTimestamp
/**
* Function to convert UNIX time to formatted time string
*/
function art_formatTimestamp($time, $format = "c", $timeoffset = null)
{
$artConfig = art_load_config();
if (strtolower($format) == "reg" || strtolower($format) == "") {
$format = "c";
}
if ((strtolower($format) == "custom" || strtolower($format) == "c") && !empty($artConfig["formatTimestamp_custom"])) {
$format = $artConfig["formatTimestamp_custom"];
}
xoops_load("xoopslocal");
return XoopsLocal::formatTimestamp($time, $format, $timeoffset);
}
示例13: mod_loadFile
function mod_loadFile($name, $dirname = null, $root_path = XOOPS_CACHE_PATH)
{
global $xoopsModule;
$data = null;
if (empty($name)) {
return $data;
}
$dirname = $dirname ? $dirname : (is_object($xoopsModule) ? $xoopsModule->getVar("dirname", "n") : "system");
xoops_load('XoopsCache');
$key = "{$dirname}_{$name}";
return XoopsCache::read($key);
}
示例14: XoopsFormCalendar
/**
* Constuctor
*
* @param string $caption caption
* @param string $name name
* @param string $size field size ( default : 15 )
* @param int $value field value ( default : time() )
*/
function XoopsFormCalendar($caption, $name, $size = 15, $value = 0)
{
xoops_load('XoopsCalendar');
$this->calendarHandler =& XoopsCalendar::getInstance();
$this->calendarHandler->loadHandler();
$value = !is_numeric($value) ? time() : intval($value);
$size = !is_numeric($size) ? 15 : intval($size);
$this->setCaption($caption);
$this->setName($name);
$this->setValue($value);
$this->setSize($size);
}
示例15: load
function load(&$ts, $text, $force = false)
{
global $xoopsUser, $xoopsConfig, $xoopsUserIsAdmin;
if (empty($force) && $xoopsUserIsAdmin) {
return $text;
}
// Built-in fitlers for XSS scripts
// To be improved
$text = $ts->filterXss($text);
if (xoops_load("purifier", "framework")) {
$text = XoopsPurifier::purify($text);
return $text;
}
$tags = array();
$search = array();
$replace = array();
$config = parent::loadConfig(dirname(__FILE__));
if (!empty($config["patterns"])) {
foreach ($config["patterns"] as $pattern) {
if (empty($pattern['search'])) {
continue;
}
$search[] = $pattern['search'];
$replace[] = $pattern['replace'];
}
}
if (!empty($config["tags"])) {
$tags = array_map("trim", $config["tags"]);
}
// Set embedded tags
$tags[] = "SCRIPT";
$tags[] = "VBSCRIPT";
$tags[] = "JAVASCRIPT";
foreach ($tags as $tag) {
$search[] = "/<" . $tag . "[^>]*?>.*?<\\/" . $tag . ">/si";
$replace[] = " [!" . strtoupper($tag) . " FILTERED!] ";
}
// Set meta refresh tag
$search[] = "/<META[^>\\/]*HTTP-EQUIV=(['\"])?REFRESH(\\1)[^>\\/]*?\\/>/si";
$replace[] = "";
// Sanitizing scripts in IMG tag
//$search[]= "/(<IMG[\s]+[^>\/]*SOURCE=)(['\"])?(.*)(\\2)([^>\/]*?\/>)/si";
//$replace[]="";
// Set iframe tag
$search[] = "/<IFRAME[^>\\/]*SRC=(['\"])?([^>\\/]*)(\\1)[^>\\/]*?\\/>/si";
$replace[] = " [!IFRAME FILTERED! \\2] ";
$search[] = "/<IFRAME[^>]*?>([^<]*)<\\/IFRAME>/si";
$replace[] = " [!IFRAME FILTERED! \\1] ";
// action
$text = preg_replace($search, $replace, $text);
return $text;
}