本文整理汇总了PHP中RMEvents类的典型用法代码示例。如果您正苦于以下问题:PHP RMEvents类的具体用法?PHP RMEvents怎么用?PHP RMEvents使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RMEvents类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search_resources
function search_resources()
{
global $xoopsConfig, $xoopsUser, $page, $xoopsTpl;
$keyword = rmc_server_var($_GET, 'keyword', '');
$db = XoopsDatabaseFactory::getDatabaseConnection();
$sql = "SELECT COUNT(*) FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1";
list($num) = $db->fetchRow($db->query($sql));
$page = rmc_server_var($_GET, 'page', 1);
$limit = 15;
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$nav = new RMPageNav($num, $limit, $page, 5);
$nav->target_url(RDFunctions::make_link('search') . '?keyword=' . $keyword . '&page={PAGE_NUM}');
$sql = "SELECT * FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1 LIMIT {$start}, {$limit}";
$result = $db->query($sql);
$resources = array();
while ($row = $db->fetchArray($result)) {
$res = new RDResource();
$res->assignVars($row);
$resources[] = array('id' => $res->id(), 'title' => $res->getVar('title'), 'desc' => TextCleaner::truncate($res->getVar('description'), 100), 'link' => $res->permalink(), 'created' => $res->getVar('created'), 'owner' => $res->getVar('owner'), 'uname' => $res->getVar('owname'), 'reads' => $res->getVar('reads'));
}
RDFunctions::breadcrumb();
RMBreadCrumb::get()->add_crumb(__('Browsing recent Documents', 'docs'));
RMTemplate::get()->add_style('docs.css', 'docs');
include 'header.php';
$xoopsTpl->assign('xoops_pagetitle', sprintf(__('Search results for "%s"', 'docs'), $keyword));
include RMEvents::get()->run_event('docs.template.search', RMTemplate::get()->get_template('rd_search.php', 'module', 'docs'));
include 'footer.php';
}
示例2: __construct
/**
* Generate the uploader object
*
* @param string $dir
* @param mixed $maxsize
* @param mixed $allowedtypes
* @return RMFileUploader
*/
public function __construct($uploadDir, $maxFileSize, $allowed_exts = array())
{
//$this->XoopsMediaUploader($dir, $allowedtypes, $maxsize);
$this->extensionToMime = (include $GLOBALS['xoops']->path('include/mimetypes.inc.php'));
$ev = RMEvents::get();
$this->extensionToMime = $ev->run_event('rmcommon.get.mime.types', $this->extensionToMime);
if (!is_array($this->extensionToMime)) {
$this->extensionToMime = array();
return false;
}
if (is_array($allowed_exts)) {
foreach ($allowed_exts as $ext) {
$this->allowedMimeTypes[] = $this->extensionToMime[$ext];
}
}
$this->uploadDir = $uploadDir;
$this->maxFileSize = intval($maxFileSize);
if (isset($maxWidth)) {
$this->maxWidth = intval($maxWidth);
}
if (isset($maxHeight)) {
$this->maxHeight = intval($maxHeight);
}
if (!@(include_once $GLOBALS['xoops']->path('language/' . $GLOBALS['xoopsConfig']['language'] . '/uploader.php'))) {
include_once $GLOBALS['xoops']->path('language/english/uploader.php');
}
}
示例3: forums_data
function forums_data($data)
{
global $xoopsUser;
if (empty($data)) {
return;
}
$forums = array();
foreach ($data as $forum) {
$isModerator = $xoopsUser && ($xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid()));
if (!$forum->active && !$isModerator) {
continue;
}
$last = new bXPost($forum->lastPostId());
$lastpost = array();
if (!$last->isNew()) {
if (!isset($posters[$last->uid])) {
$posters[$last->uid] = new RMUser($last->uid);
}
$user = $posters[$last->uid];
$lastpost['date'] = bXFunctions::formatDate($last->date());
$lastpost['by'] = sprintf(__('by %s', 'bxpress'), $last->uname());
$lastpost['id'] = $last->id();
$lastpost['topic'] = $last->topic();
$lastpost['user'] = array('uname' => $user->uname, 'name' => $user->name != '' ? $user->name : $user->uname, 'avatar' => $user ? RMEvents::get()->run_event('rmcommon.get.avatar', $user->getVar('email'), 50) : '');
if ($xoopsUser) {
$lastpost['new'] = $last->date() > $xoopsUser->getVar('last_login') && time() - $last->date() < $xoopsModuleConfig['time_new'];
} else {
$lastpost['new'] = time() - $last->date() <= $xoopsModuleConfig['time_new'];
}
}
$category = new bXCategory($forum->cat);
$forums[] = array('id' => $forum->id(), 'name' => $forum->name(), 'desc' => $forum->description(), 'topics' => $forum->topics(), 'posts' => $forum->posts(), 'link' => $forum->makeLink(), 'last' => $lastpost, 'image' => $forum->image, 'active' => $forum->active, 'category' => array('title' => $category->title));
}
return $forums;
}
示例4: showFriends
/**
* @desc Visualiza la lista de amigos del usuario
**/
function showFriends()
{
global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $pag, $xoopsConfig;
$xoopsOption['template_main'] = 'gs_panel_friends.html';
include 'header.php';
$mc =& $xoopsModuleConfig;
GSFunctions::makeHeader();
//Barra de Navegación
$sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_friends') . " WHERE gsuser='" . $xoopsUser->uid() . "'";
$page = isset($pag) ? $pag : '';
$limit = 30;
list($num) = $db->fetchRow($db->query($sql));
if ($page > 0) {
$page -= 1;
}
$start = $page * $limit;
$tpages = (int) ($num / $limit);
if ($num % $limit > 0) {
$tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
$rest = $pactual - $tpages;
$pactual = $pactual - $rest + 1;
$start = ($pactual - 1) * $limit;
}
if ($tpages > 1) {
if ($mc['urlmode']) {
$urlnav = 'cpanel/friends';
} else {
$urlnav = 'cpanel.php?by=cpanel/friends';
}
$nav = new GsPageNav($num, $limit, $start, 'pag', $urlnav, 0);
$tpl->assign('friendsNavPage', $nav->renderNav(4, 1));
}
$showmax = $start + $limit;
$showmax = $showmax > $num ? $num : $showmax;
$tpl->assign('lang_showing', sprintf(__('Sowing friends %u to %u from %u.', 'galleries'), $start + 1, $showmax, $num));
$tpl->assign('limit', $limit);
$tpl->assign('pag', $pactual);
//Fin de barra de navegación
$sql = "SELECT * FROM " . $db->prefix('gs_friends') . " WHERE gsuser='" . $xoopsUser->uid() . "'";
$sql .= " LIMIT {$start},{$limit}";
$result = $db->query($sql);
while ($row = $db->fetchArray($result)) {
$xu = new XoopsUser($row['uid']);
$tpl->append('users', array('uid' => $xu->uid(), 'uname' => $xu->uname(), 'link' => XOOPS_URL . "/modules/galleries/" . ($mc['urlmode'] ? "usr/" . $xu->uname() . "/" : "user.php?id=usr/" . $xu->uname()), 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $xu->email(), 0, $xu->user_avatar() != '' ? XOOPS_URL . '/uploads/avatars/' . $xu->user_avatar() : GS_URL . '/images/avatar.png')));
}
$tpl->assign('lang_uname', __('User name', 'galleries'));
$tpl->assign('lang_newfriend', __('New Friend', 'galleries'));
$tpl->assign('lang_del', __('Delete', 'galleries'));
$tpl->assign('lang_confirm', __('Do you really wish to delete specified friend?', 'galleries'));
$tpl->assign('lang_confirms', __('Do you really wish to delete selected friends?', 'galleries'));
$tpl->assign('form_action_add', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/add/' : '?cp=add'));
$tpl->assign('form_action_del', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/delete/' : '?cp=delete'));
$tpl->assign('delete_link', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/deletefriend/pag/' . $pactual . '/id/' : '?cp=deletefriend&page=' . $pactual . '&id='));
RMTemplate::get()->add_style('panel.css', 'galleries');
createLinks();
include 'footer.php';
}
示例5: showCategos
/**
* Muestra una lista de las categorías existentes
*/
function showCategos()
{
global $xoopsModule, $xoopsSecurity;
$row = array();
qpArrayCategos($row);
$categories = array();
$db = XoopsDatabaseFactory::getDatabaseConnection();
foreach ($row as $k) {
$catego = new QPCategory($k['id_cat']);
$catego->update();
list($num) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix("qpages_pages") . " WHERE cat='{$k['id_cat']}'"));
$k['posts'] = $num;
$k['nombre'] = str_repeat("—", $k['saltos']) . ' ' . $k['nombre'];
$categories[] = $k;
}
// Event
$categories = RMEvents::get()->run_event('qpages.categories.list', $categories);
RMTemplate::get()->add_style('admin.css', 'qpages');
RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
RMTemplate::get()->add_script('../include/js/qpages.js');
RMTemplate::get()->assign('xoops_pagetitle', __('Categories management', 'qpages'));
xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> » ' . __('Categories', 'qpages'));
xoops_cp_header();
include RMTemplate::get()->get_template("admin/qp_categos.php", 'module', 'qpages');
xoops_cp_footer();
}
示例6: reviewEdit
/**
* @desc Muestra el contenido de las secciones editadas y original para su revisión
*/
function reviewEdit()
{
global $xoopsModule;
$id = rmc_server_var($_GET, 'id', 0);
if ($id <= 0) {
redirectMsg('edits.php', __('You have not specified any section!', 'docs'), 1);
die;
}
$edit = new RDEdit($id);
if ($edit->isNew()) {
redirectMsg('edits.php', __('Specified content does not exists!', 'docs'), 1);
die;
}
$sec = new RDSection($edit->getVar('id_sec'));
if ($sec->isNew()) {
redirectMsg('edits.php', __('The section indicated by current element does not exists!', 'docs'), 1);
die;
}
// Datos de la Sección
$section = array('id' => $sec->id(), 'title' => $sec->getVar('title'), 'text' => $sec->getVar('content'), 'link' => $sec->permalink(), 'res' => $sec->getVar('id_res'));
// Datos de la Edición
$new_content = array('id' => $edit->id(), 'title' => $edit->getVar('title'), 'text' => $edit->getVar('content'));
xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./edits.php'>" . __('Waiting Content', 'docs') . "</a> » " . sprintf(__('Editing %s', 'docs'), $sec->getVar('title')));
xoops_cp_header();
RMTemplate::get()->add_style('admin.css', 'docs');
include RMEvents::get()->run_event('docs.template.review.waiting', RMTemplate::get()->get_template('admin/rd_reviewedit.php', 'module', 'docs'));
xoops_cp_footer();
}
示例7: cu_render_output
/**
* Modify the page output to include some new features
*
* @param mixed $output
* @return string
*/
function cu_render_output($output)
{
global $xoTheme, $xoopsTpl;
if (function_exists('xoops_cp_header')) {
return $output;
}
$page = $output;
if ($xoopsTpl) {
if (defined('COMMENTS_INCLUDED') && COMMENTS_INCLUDED) {
RMTemplate::get()->add_xoops_style('comments.css', 'rmcommon');
}
}
$pos = strpos($page, "</head>");
if ($pos === FALSE) {
return $output;
}
include_once RMTemplate::get()->tpl_path('rmc_header.php', 'rmcommon');
$rtn = substr($page, 0, $pos) . "\n";
$rtn .= $scripts;
$rtn .= $styles;
$rtn .= $heads;
$rtn .= substr($page, $pos);
$rtn = RMEvents::get()->run_event('rmcommon.end.flush', $rtn);
return $rtn;
}
示例8: toolbar
public function toolbar()
{
RMTemplate::get()->add_tool(__('Dashboard', 'xthemes'), 'index.php', 'images/dashboard.png', 'dashboard');
RMTemplate::get()->add_tool(__('Available Themes', 'xthemes'), 'themes.php', 'images/themes.png', 'catalog');
RMTemplate::get()->add_tool(__('Theme Settings', 'xthemes'), 'settings.php', 'images/settings.png', 'settings');
RMTemplate::get()->add_tool(__('About', 'xthemes'), 'index.php?action=about', 'images/about.png', 'about');
$events = RMEvents::get();
$events->run_event('xthemes.toolbar');
}
示例9: show_rss_options
/**
* Show all RSS options
*/
function show_rss_options()
{
global $xoopsTpl, $xoopsConfig;
include XOOPS_ROOT_PATH . '/header.php';
$xoopsTpl->assign('xoops_pagetitle', __('RSS Center', 'rmcommon'));
$feeds = array();
$feeds = RMEvents::get()->run_event('rmcommon.get.feeds.list', $feeds);
RMTemplate::get()->add_style('rss.css', 'rmcommon');
include RMTemplate::get()->get_template('rmc_rss_center.php', 'module', 'rmcommon');
include XOOPS_ROOT_PATH . '/footer.php';
}
示例10: save
/**
* Save comment
*/
public function save()
{
// To check or modify data before save this
$ret = RMEvents::get()->run_event('rmcommon.saving.comment', $this);
if ($this->isNew()) {
$sr = $this->saveToTable();
} else {
$sr = $this->updateTable();
}
return $ret && $sr;
}
示例11: eventRmcommonXoopsCommonEnd
public function eventRmcommonXoopsCommonEnd()
{
global $xoopsConfig;
// Get preloaders from current theme
RMEvents::get()->load_extra_preloads(XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'], ucfirst($xoopsConfig['theme_set'] . 'Theme'));
$url = RMFunctions::current_url();
$p = parse_url($url);
if (substr($p['path'], -11) == 'backend.php') {
include_once RMCPATH . '/rss.php';
die;
}
}
示例12: show_rm_blocks
function show_rm_blocks()
{
global $xoopsModule, $xoopsConfig, $wid_globals, $xoopsSecurity;
$db = Database::getInstance();
$modules = RMFunctions::get_modules_list(1);
// ** API Event **
// Allows other methods to add o modify the list of available widgets
$modules = RMEvents::get()->run_event('rmcommon.blocks.modules', $modules);
// Cargamos los grupos
$sql = "SELECT groupid, name FROM " . $db->prefix("groups") . " ORDER BY name";
$result = $db->query($sql);
$groups = array();
while ($row = $db->fetchArray($result)) {
$groups[] = array('id' => $row['groupid'], 'name' => $row['name']);
}
// Cargamos las posiciones de bloques
$bpos = RMBlocksFunctions::block_positions();
$sql = createSQL();
$result = $db->query($sql);
$blocks = array();
$used_blocks = array();
while ($row = $db->fetchArray($result)) {
$mod = RMFunctions::load_module($row['element']);
if (!$mod) {
continue;
}
$used_blocks[] = array('id' => $row['bid'], 'title' => $row['name'], 'module' => array('id' => $mod->mid(), 'dir' => $mod->dirname(), 'name' => $mod->name()), 'canvas' => $bpos[$row['canvas']], 'weight' => $row['weight'], 'visible' => $row['visible'], 'type' => $row['type'], 'options' => $row['edit_func'] != '' ? 1 : 0, 'description' => $row['description']);
}
// ** API **
// Event for manege the used widgets list
$used_blocks = RMEvents::get()->run_event('rmcommon.used.blocks.list', $used_blocks);
$positions = array();
foreach ($bpos as $row) {
$positions[] = array('id' => $row['id_position'], 'name' => $row['name']);
}
$positions = RMEvents::get()->run_event('rmcommon.block.positions.list', $positions);
xoops_cp_location('<a href="./">' . $xoopsModule->getVar('name') . '</a> » ' . __('Blocks', 'rmcommon'));
RMTemplate::get()->add_style('blocks.css', 'rmcommon');
RMTemplate::get()->add_local_script('blocks.js', 'rmcommon', 'include');
RMTemplate::get()->add_local_script('jkmenu.js', 'rmcommon', 'include');
RMTemplate::get()->add_style('forms.css', 'rmcommon');
RMTemplate::get()->add_local_script('jquery-ui.min.js', 'rmcommon', 'include');
xoops_cp_header();
// Available Widgets
$blocks = RMBlocksFunctions::get_available_list($modules);
// Position
$the_position = isset($_GET['pos']) ? intval($_GET['pos']) : '';
include RMTemplate::get()->get_template("rmc_blocks.php", 'module', 'rmcommon');
xoops_cp_footer();
}
示例13: rd_show_page
function rd_show_page()
{
RMTemplate::get()->assign('xoops_pagetitle', __('Home Page', 'docs'));
xoops_cp_header();
include_once RMCPATH . '/class/form.class.php';
$content = @file_get_contents(XOOPS_CACHE_PATH . '/rd_homepage.html');
$content = TextCleaner::getInstance()->to_display($content);
$editor = new RMFormEditor('', 'homepage', '100%', '450px', $content);
$rmc_config = RMFunctions::configs();
if ($rmc_config['editor_type'] == 'tiny') {
$tiny = TinyEditor::getInstance();
$tiny->add_config('theme_advanced_buttons1', 'res_index');
}
include RMEvents::get()->run_event('docs.get.homepage.template', RMTemplate::get()->get_template('admin/rd_homepage.php', 'module', 'docs'));
xoops_cp_footer();
}
示例14: send_message
function send_message()
{
global $xoopsModule, $xoopsModuleConfig, $xoopsUser;
$name = rmc_server_var($_POST, 'name', '');
$email = rmc_server_var($_POST, 'email', '');
$company = rmc_server_var($_POST, 'company', '');
$phone = rmc_server_var($_POST, 'phone', '');
$subject = rmc_server_var($_POST, 'subject', '');
$message = rmc_server_var($_POST, 'message', '');
if ($name == '' || $email == '' || !checkEmail($email) || $subject == '' || $message == '') {
redirect_header($xoopsModuleConfig['url'], 1, __('Please fill all required fileds before to send this message!', 'contact'));
die;
}
// Recaptcha check
if (!RMEvents::get()->run_event('rmcommon.captcha.check', true)) {
redirect_header($xoopsModuleConfig['url'], 1, __('Please check the security words and write it correctly!', 'contact'));
die;
}
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$xoopsMailer->setBody($message . "\n--------------\n" . __('Message sent with ContactMe!', 'contact') . "\n" . $xoopsModuleConfig['url']);
$xoopsMailer->setToEmails($xoopsModuleConfig['mail']);
$xoopsMailer->setFromEmail($email);
$xoopsMailer->setFromName($name);
$xoopsMailer->setSubject($subject);
if (!$xoopsMailer->send(true)) {
redirect_header($xoopsModuleConfig['url'], 1, __('Message could not be delivered. Please try again.', 'contact'));
die;
}
// Save message on database for further use
$msg = new CTMessage();
$msg->setVar('subject', $subject);
$msg->setVar('ip', $_SERVER['REMOTE_ADDR']);
$msg->setVar('email', $email);
$msg->setVar('name', $name);
$msg->setVar('org', $company);
$msg->setVar('body', $message);
$msg->setVar('phone', $phone);
$msg->setVar('register', $xoopsUser ? 1 : 0);
if ($xoopsUser) {
$msg->setVar('xuid', $xoopsUser->uid());
}
$msg->setVar('date', time());
$msg->save();
redirect_header(XOOPS_URL, 1, __('Your message has been sent successfully!', 'contact'));
}
示例15: eventRmcommonXoopsCommonEnd
public function eventRmcommonXoopsCommonEnd()
{
global $xoopsConfig;
// Get preloaders from current theme
RMEvents::get()->load_extra_preloads(XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'], ucfirst($xoopsConfig['theme_set'] . 'Theme'));
$url = RMUris::current_url();
$p = parse_url($url);
$config = RMSettings::cu_settings();
/**
* This event has added in order to add custom codes in a "semantic" way, but
* the codes can be added from any pertinent place
*/
RMEvents::get()->run_event('rmcommon.load.codes');
if (substr($p['path'], -11) == 'backend.php' && $config->rss_enable) {
include_once RMCPATH . '/rss.php';
die;
}
}