本文整理汇总了PHP中Comments::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::getInstance方法的具体用法?PHP Comments::getInstance怎么用?PHP Comments::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::getInstance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eventOnSystemPreferencesForm
public static function eventOnSystemPreferencesForm($args)
{
/* @var $module XoopsModule */
$module = $args[0];
if ($plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'comments')) {
Comments::getInstance()->loadLanguage('main');
}
}
示例2: xoops_module_pre_uninstall_comments
function xoops_module_pre_uninstall_comments(&$module)
{
$xoops = Xoops::getInstance();
XoopsLoad::loadFile($xoops->path('modules/comments/class/helper.php'));
$helper = Comments::getInstance();
$plugins = \Xoops\Module\Plugin::getPlugins('comments');
foreach (array_keys($plugins) as $dirname) {
$helper->deleteModuleRelations($xoops->getModuleByDirname($dirname));
}
return true;
}
示例3: waiting
/**
* @return array
*/
public function waiting()
{
$comments = Comments::getInstance();
//need this here to init constants
$criteria = new CriteriaCompo(new Criteria('status', COMMENTS_PENDING));
$ret = array();
if ($count = $comments->getHandlerComment()->getCount($criteria)) {
$ret['count'] = $count;
$ret['name'] = Xoops::getInstance()->getHandlerModule()->getByDirname('comments')->getVar('name');
$ret['link'] = Xoops::getInstance()->url('modules/comments/admin/main.php');
}
return $ret;
}
示例4: implode
$obj = $content_Handler->get($content_id);
if ($ok == 1) {
if (!$xoops->security()->check()) {
$xoops->redirect('content.php', 3, implode(',', $xoops->security()->getErrors()));
}
// Deleting the content
if ($content_Handler->delete($obj)) {
// update permissions
$gperm_Handler->updatePerms($content_id);
// deleting page_related_link
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('link_content_id', $content_id));
$link_Handler->deleteAll($criteria);
// deleting comments
if ($xoops->isActiveModule('comments')) {
$comment_handler = Comments::getInstance()->getHandlerComment()->deleteByItemId($helper->getModule()->getVar('mid'), $content_id);
}
$xoops->redirect('content.php', 2, XoopsLocale::S_DATABASE_UPDATED);
} else {
echo $xoops->alert('error', $obj->getHtmlErrors());
}
} else {
// deleting main and secondary
echo $xoops->confirm(array('ok' => 1, 'content_id' => $content_id, 'op' => 'delete'), 'content.php', XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM . '<br /><span class="red">' . $obj->getvar('content_title') . '<span>');
}
break;
case 'update_status':
$content_id = Request::getInt('content_id', 0);
if ($content_id > 0) {
$obj = $content_Handler->get($content_id);
$old = $obj->getVar('content_status');
示例5: array
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* Comments Manager
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author Kazumi Ono (AKA onokazu)
* @package comments
* @version $Id$
*/
include __DIR__ . '/header.php';
// Get main instance
$xoops = Xoops::getInstance();
$system = System::getInstance();
$helper = Comments::getInstance();
// Get Action type
$op = $system->cleanVars($_REQUEST, 'op', 'default', 'string');
// Call Header
$xoops->header('admin:comments/comments.tpl');
$admin_page = new \Xoops\Module\Admin();
$admin_page->renderNavigation('main.php');
$limit_array = array(20, 50, 100);
$status_array = array(COMMENTS_PENDING => _MD_COMMENTS_PENDING, COMMENTS_ACTIVE => _MD_COMMENTS_ACTIVE, COMMENTS_HIDDEN => _MD_COMMENTS_HIDDEN);
$status_array2 = array(COMMENTS_PENDING => '<span style="text-decoration: none; font-weight: bold; color: #008000;">' . _MD_COMMENTS_PENDING . '</span>', COMMENTS_ACTIVE => '<span style="text-decoration: none; font-weight: bold; color: #ff0000;">' . _MD_COMMENTS_ACTIVE . '</span>', COMMENTS_HIDDEN => '<span style="text-decoration: none; font-weight: bold; color: #0000ff;">' . _MD_COMMENTS_HIDDEN . '</span>');
$start = 0;
$status_array[0] = _AM_COMMENTS_FORM_ALL_STATUS;
$comments = array();
$status = !isset($_REQUEST['status']) || !in_array((int) $_REQUEST['status'], array_keys($status_array)) ? 0 : (int) $_REQUEST['status'];
$module = !isset($_REQUEST['module']) ? 0 : (int) $_REQUEST['module'];
$modules_array = array();
示例6: copyrighted
<?php
/*
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.
*/
/**
* Comments
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include_once dirname(dirname(__DIR__)) . '/mainfile.php';
Comments::getInstance()->displayReply();
示例7: copyrighted
<?php
/*
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.
*/
/**
* Comments
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include_once dirname(dirname(__DIR__)) . '/mainfile.php';
Comments::getInstance()->displayNew();
示例8: b_comments_show
/**
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package Comments
* @author trabis <lusopoemas@gmail.com>
* @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://jp.xoops.org/
* @version $Id$
*/
function b_comments_show($options)
{
$xoops = Xoops::getInstance();
$helper = Comments::getInstance();
$block = array();
$available_modules = \Xoops\Module\Plugin::getPlugins('comments');
if (empty($available_modules)) {
return $block;
}
$comment_handler = $helper->getHandlerComment();
$criteria = new CriteriaCompo(new Criteria('status', COMMENTS_ACTIVE));
$criteria->setLimit((int) $options[0]);
$criteria->setSort('created');
$criteria->setOrder('DESC');
// Check modules permissions
$moduleperm_handler = $xoops->getHandlerGroupperm();
$gperm_groupid = $xoops->getUserGroups();
$criteria1 = new CriteriaCompo(new Criteria('gperm_name', 'module_read', '='));
$criteria1->add(new Criteria('gperm_groupid', '(' . implode(',', $gperm_groupid) . ')', 'IN'));
$perms = $moduleperm_handler->getObjects($criteria1, true);
$modIds = array();
foreach ($perms as $item) {
$modIds[] = $item->getVar('gperm_itemid');
}
if (count($modIds) > 0) {
$modIds = array_unique($modIds);
$criteria->add(new Criteria('modid', '(' . implode(',', $modIds) . ')', 'IN'));
} else {
return $block;
}
$comments = $comment_handler->getObjects($criteria, true);
$member_handler = $xoops->getHandlerMember();
$module_handler = $xoops->getHandlerModule();
$modules = $module_handler->getObjectsArray(new Criteria('dirname', "('" . implode("','", array_keys($available_modules)) . "')", 'IN'), true);
$comment_config = array();
foreach (array_keys($comments) as $i) {
$mid = $comments[$i]->getVar('modid');
$com['module'] = '<a href="' . \XoopsBaseConfig::get('url') . '/modules/' . $modules[$mid]->getVar('dirname') . '/">' . $modules[$mid]->getVar('name') . '</a>';
if (!isset($comment_config[$mid])) {
$comment_config[$mid] = \Xoops\Module\Plugin::getPlugin($modules[$mid]->getVar('dirname'), 'comments');
}
$com['id'] = $i;
$com['title'] = '<a href="' . \XoopsBaseConfig::get('url') . '/modules/' . $modules[$mid]->getVar('dirname') . '/' . $comment_config[$mid]->pageName() . '?' . $comment_config[$mid]->itemName() . '=' . $comments[$i]->getVar('itemid') . '&com_id=' . $i . '&com_rootid=' . $comments[$i]->getVar('rootid') . '&' . htmlspecialchars($comments[$i]->getVar('exparams')) . '#comment' . $i . '">' . $comments[$i]->getVar('title') . '</a>';
$com['icon'] = htmlspecialchars($comments[$i]->getVar('icon'), ENT_QUOTES);
$com['icon'] = $com['icon'] != '' ? $com['icon'] : 'icon1.gif';
$com['time'] = XoopsLocale::formatTimestamp($comments[$i]->getVar('created'), 'm');
if ($comments[$i]->getVar('uid') > 0) {
$poster = $member_handler->getUser($comments[$i]->getVar('uid'));
if (is_object($poster)) {
$com['poster'] = '<a href="' . \XoopsBaseConfig::get('url') . '/userinfo.php?uid=' . $comments[$i]->getVar('uid') . '">' . $poster->getVar('uname') . '</a>';
} else {
$com['poster'] = $xoops->getConfig('anonymous');
}
} else {
$com['poster'] = $xoops->getConfig('anonymous');
}
$block['comments'][] = $com;
unset($com);
}
return $block;
}
示例9: copyrighted
<?php
/*
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.
*/
/**
* Comments
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include_once dirname(dirname(__DIR__)) . '/mainfile.php';
Comments::getInstance()->displayPost();
示例10: copyrighted
<?php
/*
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.
*/
/**
* Comments
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include_once dirname(dirname(__DIR__)) . '/mainfile.php';
Comments::getInstance()->displayDelete();
示例11: copyrighted
<?php
/*
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.
*/
/**
* Comments
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include_once dirname(dirname(__DIR__)) . '/mainfile.php';
Comments::getInstance()->displayEdit();
示例12: __construct
/**
* @param CommentsComment $obj
*/
public function __construct(CommentsComment $obj)
{
$xoops = Xoops::getInstance();
$helper = Comments::getInstance();
$module = $xoops->getModuleById($obj->getVar('modid'));
if (!is_object($module)) {
$xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$dirname = $module->getVar('dirname');
// create form
if ($xoops->isAdminSide) {
$url = $helper->url("admin/comment_post.php");
} else {
$url = $helper->url("comment_post.php");
}
parent::__construct(_MD_COMMENTS_POSTCOMMENT, "commentform", $url, "post", true);
switch ($xoops->getModuleConfig('com_rule', $dirname)) {
case COMMENTS_APPROVEALL:
$rule_text = _MD_COMMENTS_COMAPPROVEALL;
break;
case COMMENTS_APPROVEUSER:
$rule_text = _MD_COMMENTS_COMAPPROVEUSER;
break;
case COMMENTS_APPROVEADMIN:
default:
$rule_text = _MD_COMMENTS_COMAPPROVEADMIN;
break;
}
$this->addElement(new Xoops\Form\Label(_MD_COMMENTS_COMRULES, $rule_text));
$this->addElement(new Xoops\Form\Text(_MD_COMMENTS_TITLE, 'com_title', 50, 255, $obj->getVar('title', 'e')), true);
$icons_radio = new Xoops\Form\Radio(XoopsLocale::MESSAGE_ICON, 'com_icon', $obj->getVar('icon', 'e'));
$subject_icons = XoopsLists::getSubjectsList();
foreach ($subject_icons as $iconfile) {
$icons_radio->addOption($iconfile, '<img src="' . \XoopsBaseConfig::get('url') . '/images/subject/' . $iconfile . '" alt="" />');
}
$this->addElement($icons_radio);
// editor
$editor = $helper->getConfig('com_editor');
if (class_exists('Xoops\\Form\\Editor')) {
$configs = array('name' => 'com_text', 'value' => $obj->getVar('text', 'e'), 'rows' => 25, 'cols' => 90, 'width' => '100%', 'height' => '400px', 'editor' => $editor);
$this->addElement(new Xoops\Form\Editor(_MD_COMMENTS_MESSAGE, 'com_text', $configs, false, $onfailure = 'textarea'));
} else {
$this->addElement(new Xoops\Form\DhtmlTextArea(_MD_COMMENTS_MESSAGE, 'com_text', $obj->getVar('text', 'e'), 10, 50), true);
}
$option_tray = new Xoops\Form\ElementTray(XoopsLocale::OPTIONS, '<br />');
$button_tray = new Xoops\Form\ElementTray('', ' ');
if ($xoops->isUser()) {
if ($xoops->getModuleConfig('com_anonpost', $dirname)) {
$noname = $obj->getVar('noname', 'e') ? 1 : 0;
$noname_checkbox = new Xoops\Form\Checkbox('', 'com_noname', $noname);
$noname_checkbox->addOption(1, XoopsLocale::POST_ANONYMOUSLY);
$option_tray->addElement($noname_checkbox);
}
if (false != $xoops->user->isAdmin($obj->getVar('modid'))) {
// show status change box when editing (comment id is not empty)
if ($obj->getVar('id', 'e')) {
$status_select = new Xoops\Form\Select(_MD_COMMENTS_STATUS, 'com_status', $obj->getVar('status', 'e'));
$status_select->addOptionArray(array(COMMENTS_PENDING => _MD_COMMENTS_PENDING, COMMENTS_ACTIVE => _MD_COMMENTS_ACTIVE, COMMENTS_HIDDEN => _MD_COMMENTS_HIDDEN));
$this->addElement($status_select);
$button_tray->addElement(new Xoops\Form\Button('', 'com_dodelete', XoopsLocale::A_DELETE, 'submit'));
}
if (isset($editor) && in_array($editor, array('textarea', 'dhtmltextarea'))) {
$html_checkbox = new Xoops\Form\Checkbox('', 'com_dohtml', $obj->getVar('dohtml', 'e'));
$html_checkbox->addOption(1, _MD_COMMENTS_DOHTML);
$option_tray->addElement($html_checkbox);
}
}
}
if (isset($editor) && in_array($editor, array('textarea', 'dhtmltextarea'))) {
//Yeah, what?
}
$smiley_checkbox = new Xoops\Form\Checkbox('', 'com_dosmiley', $obj->getVar('domsiley', 'e'));
$smiley_checkbox->addOption(1, _MD_COMMENTS_DOSMILEY);
$option_tray->addElement($smiley_checkbox);
$xcode_checkbox = new Xoops\Form\Checkbox('', 'com_doxcode', $obj->getVar('doxcode', 'e'));
$xcode_checkbox->addOption(1, _MD_COMMENTS_DOXCODE);
$option_tray->addElement($xcode_checkbox);
if (isset($editor) && in_array($editor, array('textarea', 'dhtmltextarea'))) {
$br_checkbox = new Xoops\Form\Checkbox('', 'com_dobr', $obj->getVar('dobr', 'e'));
$br_checkbox->addOption(1, _MD_COMMENTS_DOAUTOWRAP);
$option_tray->addElement($br_checkbox);
} else {
$this->addElement(new Xoops\Form\Hidden('com_dohtml', 1));
$this->addElement(new Xoops\Form\Hidden('com_dobr', 0));
}
$this->addElement($option_tray);
if (!$xoops->isUser()) {
$this->addElement(new Xoops\Form\Captcha());
}
$this->addElement(new Xoops\Form\Hidden('com_modid', $obj->getVar('modid', 'e')));
$this->addElement(new Xoops\Form\Hidden('com_pid', $obj->getVar('pid', 'e')));
$this->addElement(new Xoops\Form\Hidden('com_rootid', $obj->getVar('rootid', 'e')));
$this->addElement(new Xoops\Form\Hidden('com_id', $obj->getVar('id', 'e')));
$this->addElement(new Xoops\Form\Hidden('com_itemid', $obj->getVar('itemid', 'e')));
$this->addElement(new Xoops\Form\Hidden('com_order', Request::getInt('com_order', $helper->getUserConfig('com_order'))));
$this->addElement(new Xoops\Form\Hidden('com_mode', Request::getString('com_mode', $helper->getUserConfig('com_mode'))));
// add module specific extra params
//.........这里部分代码省略.........