本文整理匯總了PHP中JCommentsFactory::getCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP JCommentsFactory::getCache方法的具體用法?PHP JCommentsFactory::getCache怎麽用?PHP JCommentsFactory::getCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類JCommentsFactory
的用法示例。
在下文中一共展示了JCommentsFactory::getCache方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: com_uninstall
//.........這裏部分代碼省略.........
<td> </td>
</tr>
<tr valign="top" align="left">
<td> </td>
<td><span class="installheader"><?php
echo JText::_('A_UNINSTALL_LOG');
?>
</span></td>
</tr>
<tr valign="top" align="left">
<td> </td>
<td>
<ul style="padding: 0 0 0 20px; margin: 0;">
<?php
JCommentsInstallerHelper::uninstallPlugin('jcomments', 'content');
?>
<li><?php
echo JText::_('A_UNINSTALL_PLUGIN_CONTENT');
?>
: <span style="color: green">OK</span></li>
<?php
JCommentsInstallerHelper::uninstallPlugin('jcomments', 'search');
?>
<li><?php
echo JText::_('A_UNINSTALL_PLUGIN_SEARCH');
?>
: <span style="color: green">OK</span></li>
<?php
JCommentsInstallerHelper::uninstallPlugin('jcomments', 'system');
?>
<li><?php
echo JText::_('A_UNINSTALL_PLUGIN_SYSTEM');
?>
: <span style="color: green">OK</span></li>
<?php
JCommentsInstallerHelper::uninstallPlugin('jcommentson', 'editors-xtd', array('jcommentson.gif'));
JCommentsInstallerHelper::uninstallPlugin('jcommentsoff', 'editors-xtd', array('jcommentsoff.gif'));
?>
<li><?php
echo JText::_('A_UNINSTALL_PLUGIN_EDITORS_XTD');
?>
: <span style="color: green">OK</span></li>
<?php
if (JCOMMENTS_JVERSION == '1.0') {
global $mainframe;
$app = $mainframe;
} else {
JCommentsInstallerHelper::uninstallPlugin('jcomments', 'user');
$app = JFactory::getApplication('administrator');
}
// Clean all caches for components with comments
if ($app->getCfg('caching') == 1) {
$db = JCommentsFactory::getDBO();
$db->setQuery("SELECT DISTINCT(object_group) AS name FROM #__jcomments");
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$cache = JCommentsFactory::getCache($row->name);
$cache->clean();
}
unset($rows);
?>
<li><?php
echo JText::_('A_UNINSTALL_CLEAN_CACHE');
?>
: <span style="color: green">OK</span></li>
<?php
}
?>
<li><span style="color: green"><strong><?php
echo JText::_('A_UNINSTALL_COMPLETE');
?>
</strong></span></li>
</ul>
</td>
</tr>
</table>
</div>
<div class="b">
<div class="b">
<div class="b"></div>
</div>
</div>
</div>
</div>
<?php
if (JCOMMENTS_JVERSION == '1.0') {
global $mainframe;
$componentPath = $mainframe->getCfg('absolute_path') . DS . 'components' . DS . 'com_jcomments';
require_once $componentPath . DS . 'libraries' . DS . 'joomlatune' . DS . 'filesystem.php';
$files = JoomlaTuneFS::readDirectory($componentPath . DS . 'languages', '\\.ini', false, true);
foreach ($files as $file) {
if (!preg_match('/[a-z]{2}-[A-Z]{2}\\.com_jcomments/', (string) $file)) {
@unlink((string) $file);
}
}
}
}
示例2: isSubscribed
/**
* Checks if given user is subscribed to new comments notifications for an object
*
* @param int $object_id The object identifier
* @param string $object_group The object group (component name)
* @param int $userid The registered user identifier
* @param string $email The user email (for guests only)
* @param string $language The object language
* @return int
*/
function isSubscribed($object_id, $object_group, $userid, $email = '', $language = '')
{
static $data = null;
$key = $object_id . $object_group . $userid . $email . $language;
if (!isset($data[$key])) {
$cache = JCommentsFactory::getCache('com_jcomments_subscriptions_' . strtolower($object_group), 'callback');
$data[$key] = $cache->get(array($this, '_isSubscribed'), array($object_id, $object_group, $userid, $email, $language));
}
return $data[$key];
}
示例3: load
/**
* Load configuration from DB and stores it into field _params
*
* @param string $lang The language to use.
* @param string $component The component name.
* @return void
*/
public function load($lang = '', $component = '')
{
if (JCOMMENTS_JVERSION == '1.5') {
$jcfg = JFactory::getConfig();
// temporary fix (eAccelerator won't reset cache)
if ($jcfg->getValue('config.cache_handler', 'file') == 'eaccelerator') {
$params = JCommentsCfg::_load($lang, $component);
} else {
$cache = JCommentsFactory::getCache('com_jcomments');
$params = (array) $cache->get('JCommentsCfg::_load', array($lang, $component));
}
} else {
$cache = JCommentsFactory::getCache('com_jcomments');
$params = (array) $cache->get('JCommentsCfg::_load', array($lang, $component));
}
foreach ($params as $param) {
if ('smiles' == $param->name) {
if (!empty($param->value)) {
$smileValues = explode("\n", $param->value);
$this->_params['smiles'] = array();
foreach ($smileValues as $v) {
list($code, $image) = explode("\t", $v);
$this->_params['smiles'][$code] = $image;
}
} else {
$this->_params['smiles'] = array();
}
} else {
if ('badwords' == $param->name) {
if ('' != trim($param->value)) {
$this->_params['badwords'] = explode("\n", $param->value);
}
} else {
$this->_params[$param->name] = $param->value;
}
}
}
if ($this->get('smiles_path') == '') {
$this->set('smiles_path', '/components/com_jcomments/images/smiles/');
}
if ($this->get('enable_notification') == 0 || $this->check('notification_type', 2) == false) {
$this->set('can_report', '');
}
if (!extension_loaded('gd') || !function_exists('imagecreatefrompng')) {
if ($this->get('captcha_engine', 'kcaptcha') != 'recaptcha') {
$this->set('enable_captcha', '');
}
}
$this->_current = $lang;
unset($params);
}
示例4: saveSmiles
public static function saveSmiles()
{
JCommentsSecurity::checkToken();
$app = JCommentsFactory::getApplication('administrator');
$db = JCommentsFactory::getDBO();
$smileCodes = JCommentsInput::getVar('cfg_smile_codes', array());
$smileImages = JCommentsInput::getVar('cfg_smile_images', array());
$smilesValues = array();
foreach ($smileCodes as $k => $code) {
$image = trim($smileImages[$k]);
$code = trim($code);
if ($code != '' && $image != '') {
$smilesValues[] = $code . "\t" . $image;
}
}
$values = count($smilesValues) ? implode("\n", $smilesValues) : '';
$db->setQuery("SELECT name FROM #__jcomments_settings WHERE component=''");
$dbParams = $db->loadResultArray();
if (in_array('smiles', $dbParams)) {
$query = "UPDATE #__jcomments_settings SET `value` = " . $db->Quote($values) . " WHERE `name` = 'smiles'";
} else {
$query = "INSERT INTO #__jcomments_settings SET `value` = " . $db->Quote($values) . ", `name` = 'smiles'";
}
$db->setQuery($query);
$db->query();
$message = JText::_('A_SETTINGS_SAVED');
// Clean all caches for components with comments
if ($app->getCfg('caching') == 1) {
$db->setQuery("SELECT DISTINCT(object_group) AS name FROM #__jcomments");
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$cache = JCommentsFactory::getCache($row->name);
$cache->clean();
}
unset($rows);
}
$cache = JCommentsFactory::getCache('com_jcomments');
$cache->clean();
JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=smiles', $message);
}
示例5: RefreshObjects
public static function RefreshObjects($hash, $step = 0, $object_group = '', $lang = '')
{
if (JCommentsSecurity::badRequest() == 1) {
JCommentsSecurity::notAuth();
}
$response = JCommentsFactory::getAjaxResponse();
$app = JCommentsFactory::getApplication();
$count = 50;
if ($hash === md5($app->getCfg('secret'))) {
$db = JCommentsFactory::getDBO();
if ($step == 0) {
$db->setQuery('DELETE FROM #__jcomments_objects WHERE 1=1');
$db->query();
}
$where = array();
$where[] = 'IFNULL(c.lang, "") <> ""';
if (!empty($object_group)) {
$where[] = 'c.object_group = ' . $db->Quote($object_group);
}
// count objects without information
$query = "SELECT COUNT(DISTINCT c.object_id, c.object_group, c.lang)" . " FROM #__jcomments AS c" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "");
$db->setQuery($query);
$objectsCount = (int) $db->loadResult();
$where[] = 'NOT EXISTS (SELECT o.id FROM #__jcomments_objects AS o WHERE o.object_id = c.object_id AND o.object_group = c.object_group AND o.lang = c.lang)';
// get list of first objects without information
$query = "SELECT DISTINCT c.object_id, c.object_group, c.lang" . " FROM #__jcomments AS c" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . " ORDER BY c.object_group, c.lang";
$db->setQuery($query, 0, $count);
$rows = $db->loadObjectList();
$i = 0;
$multilanguage = JCommentsMultilingual::isEnabled();
$nextLanguage = $lang;
if (count($rows)) {
foreach ($rows as $row) {
if ($nextLanguage != $row->lang && $multilanguage) {
$nextLanguage = $row->lang;
break;
}
// retrieve and store object information
JCommentsObjectHelper::storeObjectInfo($row->object_id, $row->object_group, $row->lang, false, true);
$i++;
}
}
$objectsRefreshed = 0;
if ($i > 0) {
$db->setQuery("SELECT COUNT(*) FROM #__jcomments_objects");
$objectsRefreshed = (int) $db->loadResult();
$response->addScript("JCommentsRefreshObjectsProgress({$objectsRefreshed}, {$objectsCount});");
}
if ($objectsCount > $objectsRefreshed && ($i > 0 || $lang != $nextLanguage)) {
// we need continue refresh
$step++;
$response->addScript("JCommentsRefreshObjectsAJAX('{$hash}', '{$step}', '', '{$nextLanguage}');");
} else {
$response->addScript("JCommentsRefreshObjectsProgress({$objectsCount}, {$objectsCount});");
if ($app->getCfg('caching')) {
// clean cache for all object groups
$db->setQuery('SELECT DISTINCT object_group FROM #__jcomments_objects');
$rows = $db->loadResultArray();
foreach ($rows as $row) {
$cache = JCommentsFactory::getCache('com_jcomments_objects_' . strtolower($row));
$cache->clean();
}
}
}
}
return $response;
}
示例6: storeObjectInfo
/**
* Stores object information (inserts new or updates existing)
*
* @param int $object_id
* @param string $object_group
* @param string $language
* @param boolean $cleanCache
* @param boolean $allowEmpty
* @return JCommentsObjectInfo
*/
public static function storeObjectInfo($object_id, $object_group = 'com_content', $language = null, $cleanCache = false, $allowEmpty = false)
{
if (empty($language)) {
$language = JCommentsMultilingual::getLanguage();
}
$app = JCommentsFactory::getApplication();
// try to load object information from database
$object = JCommentsModelObject::getObjectInfo($object_id, $object_group, $language);
$objectId = $object === false ? 0 : $object->id;
if ($objectId == 0 && $app->isAdmin()) {
// return empty object because we can not create link in backend
return new JCommentsObjectInfo();
}
// get object information via plugins
$info = self::_loadObjectInfo($object_id, $object_group, $language);
if (!JCommentsModelObject::IsEmpty($info) || $allowEmpty) {
if ($app->isAdmin()) {
// we do not have to update object's link from backend
$info->link = null;
}
// insert/update object information
JCommentsModelObject::setObjectInfo($objectId, $info);
if ($cleanCache) {
// clean cache for given object group
$cache = JCommentsFactory::getCache('com_jcomments_objects_' . strtolower($object_group));
$cache->clean();
}
}
return $info;
}
示例7: postInstall
//.........這裏部分代碼省略.........
$adminIconsPath = '../administrator/components/com_jcomments/assets';
if (is_writable($menuiconpath)) {
$currentIconsPath = dirname(__FILE__) . DS . 'images';
ob_start();
$res1 = @copy($currentIconsPath . DS . 'icon-16-jcomments.png', $menuiconpath . DS . 'icon-16-jcomments.png');
$res2 = @copy($currentIconsPath . DS . 'icon-16-import.png', $menuiconpath . DS . 'icon-16-import.png');
$res3 = @copy($currentIconsPath . DS . 'icon-16-settings.png', $menuiconpath . DS . 'icon-16-settings.png');
$res4 = @copy($currentIconsPath . DS . 'icon-16-smiles.png', $menuiconpath . DS . 'icon-16-smiles.png');
$res5 = @copy($currentIconsPath . DS . 'icon-16-comments.png', $menuiconpath . DS . 'icon-16-comments.png');
$res6 = @copy($currentIconsPath . DS . 'icon-16-subscriptions.png', $menuiconpath . DS . 'icon-16-subscriptions.png');
$res7 = @copy($currentIconsPath . DS . 'icon-16-custombbcodes.png', $menuiconpath . DS . 'icon-16-custombbcodes.png');
$res8 = @copy($currentIconsPath . DS . 'icon-16-blacklist.png', $menuiconpath . DS . 'icon-16-blacklist.png');
ob_end_clean();
$result = $res1 && $res2 && $res3 && $res4 && $res5 && $res6 && $res7 && $res8;
if ($result && is_file($menuiconpath . DS . 'jcomments16x16.png')) {
$adminIconsPath = 'js/ThemeOffice';
}
}
$db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-jcomments.png' " . "\n WHERE admin_menu_link='option=com_jcomments'");
@$db->query();
$db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-comments.png', name='" . JText::_('A_SUBMENU_COMMENTS') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=comments'");
@$db->query();
$db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-settings.png', name='" . JText::_('A_SUBMENU_SETTINGS') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=settings'");
@$db->query();
$db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-smiles.png', name='" . JText::_('A_SUBMENU_SMILES') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=smiles'");
@$db->query();
$db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-subscriptions.png', name='" . JText::_('A_SUBMENU_SUBSCRIPTIONS') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=subscriptions'");
@$db->query();
$db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-custombbcodes.png', name='" . JText::_('A_SUBMENU_CUSTOM_BBCODE') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=custombbcodes'");
@$db->query();
$db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-blacklist.png', name='" . JText::_('A_SUBMENU_BLACKLIST') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=blacklist'");
@$db->query();
$db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-import.png', name='" . JText::_('A_SUBMENU_IMPORT') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=import'");
@$db->query();
$db->setQuery("UPDATE #__components SET admin_menu_img='{$adminIconsPath}/icon-16-jcomments.png', name='" . JText::_('A_SUBMENU_ABOUT') . "'" . "\n WHERE admin_menu_link='option=com_jcomments&task=about'");
@$db->query();
}
if (version_compare($version, '2.3.0', 'le')) {
// update db tables
if (JCommentsInstallerDatabaseHelper::upgradeStructure()) {
$installer->addMessage(JText::_('A_INSTALL_UPGRADE_TABLES'), true);
}
JCommentsInstallerDatabaseHelper::updateJoomGallery();
if (JCOMMENTS_JVERSION != '1.7') {
$db->setQuery("UPDATE `#__jcomments_settings` SET `value` = REPLACE(`value`, 'Unregistered', 'Public') ");
$db->query();
$db->setQuery("UPDATE `#__jcomments_settings` SET `value` = REPLACE(`value`, 'Super Administrator', 'Super Users') ");
$db->query();
$db->setQuery("UPDATE `#__jcomments_custom_bbcodes` SET `button_acl` = REPLACE(`button_acl`, 'Unregistered', 'Public') ");
$db->query();
$db->setQuery("UPDATE `#__jcomments_custom_bbcodes` SET `button_acl` = REPLACE(`button_acl`, 'Super Administrator', 'Super Users') ");
$db->query();
}
}
if (isset($_COOKIE['jcommentsadmin_group'])) {
if (!headers_sent()) {
setcookie('jcommentsadmin_group', '', time() - 3600, '/');
}
unset($_COOKIE['jcommentsadmin_group']);
}
$db->setQuery("SELECT `name`, `value` FROM `#__jcomments_settings`");
$paramsList = $db->loadObjectList('name');
if (count($paramsList) == 0) {
$defaultSettings = dirname(__FILE__) . DS . 'install' . DS . 'sql' . DS . 'settings.sql';
JCommentsInstaller::executeSQL($defaultSettings);
} else {
JCommentsInstaller::checkParam($paramsList, 'delete_mode', '0');
JCommentsInstaller::checkParam($paramsList, 'can_publish_for_my_object', '');
JCommentsInstaller::checkParam($paramsList, 'can_edit_for_my_object', '');
JCommentsInstaller::checkParam($paramsList, 'can_delete_for_my_object', '');
JCommentsInstaller::checkParam($paramsList, 'enable_blacklist', '0');
JCommentsInstaller::checkParam($paramsList, 'can_ban', 'Administrator,Super Administrator');
JCommentsInstaller::checkParam($paramsList, 'feed_limit', '100');
JCommentsInstaller::checkParam($paramsList, 'report_reason_required', '1');
if (version_compare($version, '2.2.0.0') <= 0) {
$smilesPath = DS . 'components' . DS . 'com_jcomments' . DS . 'images' . DS . 'smiles' . DS;
JCommentsInstaller::checkParam($paramsList, 'smiles_path', $smilesPath, true);
}
}
unset($paramsList);
if (JCOMMENTS_JVERSION == '1.7') {
// TODO remove this hack
JCommentsInstallerHelper::fixComponentName();
}
JCommentsInstallerHelper::fixUsergroups();
$joomfish = $app->getCfg('absolute_path') . DS . 'components' . DS . 'com_joomfish' . DS . 'joomfish.php';
if (is_file($joomfish) || JCommentsMultilingual::isEnabled()) {
JCommentsInstaller::upgradeLanguages();
}
$db->setQuery("SELECT COUNT(*) FROM `#__jcomments_custom_bbcodes`;");
$cnt = $db->loadResult();
if ($cnt == 0) {
$sql = dirname(__FILE__) . DS . 'install' . DS . 'sql' . DS . 'custom_bbcodes.sql';
JCommentsInstaller::executeSQL($sql);
}
JCommentsInstallerHelper::fixCustomBBCodeACL();
$installer->showInstallLog();
$cache = JCommentsFactory::getCache('com_jcomments');
$cache->clean();
}
示例8: order
public static function order($inc)
{
JCommentsSecurity::checkToken();
$id = JCommentsInput::getVar('cid', 0);
$id = count($id) ? $id[0] : 0;
$db = JCommentsFactory::getDBO();
$row = new JCommentsTableCustomBBCode($db);
if ($row->load($id)) {
$row->move($inc);
$cache = JCommentsFactory::getCache('com_jcomments');
$cache->clean();
}
JCommentsRedirect(JCOMMENTS_INDEX . '?option=com_jcomments&task=custombbcodes');
}