示例#1
0
 /**
  * insert a new item in the database
  *
  * @param object $item reference to the {@link PublisherItem} object
  * @param bool   $force
  *
  * @return bool FALSE if failed, TRUE if already present and unchanged or successful
  */
 public function insert(&$item, $force = false)
 {
     if (!$item->meta_keywords() || !$item->meta_description() || !$item->short_url()) {
         $publisher_metagen = new PublisherMetagen($item->title(), $item->getVar('meta_keywords'), $item->getVar('summary'));
         // Auto create meta tags if empty
         if (!$item->meta_keywords()) {
             $item->setVar('meta_keywords', $publisher_metagen->_keywords);
         }
         if (!$item->meta_description()) {
             $item->setVar('meta_description', $publisher_metagen->_description);
         }
         // Auto create short_url if empty
         if (!$item->short_url()) {
             $item->setVar('short_url', $publisher_metagen->generateSeoTitle($item->getVar('title', 'n'), false));
         }
     }
     if (!parent::insert($item, $force)) {
         return false;
     }
     if (xoops_isActiveModule('tag')) {
         // Storing tags information
         $tag_handler = xoops_getmodulehandler('tag', 'tag');
         $tag_handler->updateByItem($item->getVar('item_tag'), $item->getVar('itemid'), PUBLISHER_DIRNAME, 0);
     }
     return true;
 }
示例#2
0
$xoopsTpl->assign('module_home', publisherModuleHome($publisher->getConfig('format_linked_path')));
$xoopsTpl->assign('categoryPath', $item['categoryPath'] . ' > ' . $item['title']);
$xoopsTpl->assign('commentatarticlelevel', $publisher->getConfig('perm_com_art_level'));
$xoopsTpl->assign('com_rule', $publisher->getConfig('com_rule'));
$xoopsTpl->assign('other_items', $publisher->getConfig('item_other_items_type'));
$xoopsTpl->assign('itemfooter', $myts->displayTarea($publisher->getConfig('item_footer'), 1));
$xoopsTpl->assign('perm_author_items', $publisher->getConfig('perm_author_items'));
// tags support
if (xoops_isActiveModule('tag')) {
    include_once $GLOBALS['xoops']->path('modules/tag/include/tagbar.php');
    $xoopsTpl->assign('tagbar', tagbar($itemId, $catid = 0));
}
/**
 * Generating meta information for this page
 */
$publisherMetagen = new PublisherMetagen($itemObj->getVar('title'), $itemObj->getVar('meta_keywords', 'n'), $itemObj->getVar('meta_description', 'n'), $itemObj->getCategoryPath());
$publisherMetagen->createMetaTags();
// Include the comments if the selected ITEM supports comments
if ($publisher->getConfig('com_rule') != 0 && ($itemObj->cancomment() == 1 || !$publisher->getConfig('perm_com_art_level'))) {
    include_once $GLOBALS['xoops']->path('include/comment_view.php');
    // Problem with url_rewrite and posting comments :
    $xoopsTpl->assign(array('editcomment_link' => PUBLISHER_URL . '/comment_edit.php?com_itemid=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode . $link_extra, 'deletecomment_link' => PUBLISHER_URL . '/comment_delete.php?com_itemid=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode . $link_extra, 'replycomment_link' => PUBLISHER_URL . '/comment_reply.php?com_itemid=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode . $link_extra));
    $xoopsTpl->_tpl_vars['commentsnav'] = str_replace("self.location.href='", "self.location.href='" . PUBLISHER_URL . '/', $xoopsTpl->_tpl_vars['commentsnav']);
}
// Include support for AJAX rating
if ($publisher->getConfig('perm_rating')) {
    $xoopsTpl->assign('rating_enabled', true);
    $item['ratingbar'] = publisherRatingBar($itemId);
    $xoTheme->addScript(PUBLISHER_URL . '/assets/js/behavior.js');
    $xoTheme->addScript(PUBLISHER_URL . '/assets/js/rating.js');
}
示例#3
0
 /**
  * insert a new category in the database
  *
  * @param object $category reference to the {@link PublisherCategory} object
  * @param bool   $force
  *
  * @return bool FALSE if failed, TRUE if already present and unchanged or successful
  */
 public function insert(&$category, $force = false)
 {
     // Auto create meta tags if empty
     if (!$category->meta_keywords() || !$category->meta_description()) {
         $publisherMetagen = new PublisherMetagen($category->name(), $category->getVar('meta_keywords'), $category->getVar('description'));
         if (!$category->meta_keywords()) {
             $category->setVar('meta_keywords', $publisherMetagen->keywords);
         }
         if (!$category->meta_description()) {
             $category->setVar('meta_description', $publisherMetagen->description);
         }
     }
     // Auto create short_url if empty
     if (!$category->short_url()) {
         $category->setVar('short_url', PublisherMetagen::generateSeoTitle($category->name('n'), false));
     }
     $ret = parent::insert($category, $force);
     return $ret;
 }
示例#4
0
 /**
  * insert a new category in the database
  *
  * @param XoopsObject $category reference to the {@link PublisherCategory} object
  * @param bool        $force
  *
  * @return bool FALSE if failed, TRUE if already present and unchanged or successful
  */
 public function insert(XoopsObject $category, $force = true)
 {
     // Auto create meta tags if empty
     if (!$category->getVar('meta_keywords') || !$category->getVar('meta_description')) {
         $publisher_metagen = new PublisherMetagen($category->getVar('name'), $category->getVar('meta_keywords'), $category->getVar('description'));
         if (!$category->getVar('meta_keywords')) {
             $category->setVar('meta_keywords', $publisher_metagen->_keywords);
         }
         if (!$category->getVar('meta_description')) {
             $category->setVar('meta_description', $publisher_metagen->_description);
         }
     }
     // Auto create short_url if empty
     if (!$category->getVar('short_url')) {
         $category->setVar('short_url', PublisherMetagen::generateSeoTitle($category->getVar('name', 'n'), false));
     }
     $ret = parent::insert($category, $force);
     return $ret;
 }