* This class contains the functions that get called by using
* the special tags in the skins
*
- * The allowed tags for a type of skinpart are defined by the
- * Skin::getAllowedActionsForType($type) method
- *
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: ACTIONS.php 1784 2012-04-22 04:28:30Z sakamocchi $
+<<<<<<< HEAD
+ * @version $Id: ACTIONS.php 1863 2012-05-19 10:50:27Z sakamocchi $
+=======
+ * @version $Id: ACTIONS.php 1886 2012-06-17 08:27:27Z sakamocchi $
+>>>>>>> skinnable-master
*/
class Actions extends BaseActions
// generating links to items/archives/... (e.g. catid)
private $linkparams;
- // reference to the skin object for which a part is being parsed
- private $skin;
-
// used when including templated forms from the include/ dir. The $formdata var
// contains the values to fill out in there (assoc array name -> value)
private $formdata;
'archivelink',
'bloglist',
'category',
- 'charset',
'loginform',
'member',
'nucleusbutton',
);
/**
+<<<<<<< HEAD
* Actions::$skin_type_friendly_names
* friendly name for wrapped page types
*/
static public $default_skin_types = array(
+=======
+ * Actions::$normal_skin_types
+ * friendly name for wrapped page types
+ */
+ static public $normal_skin_types = array(
+>>>>>>> skinnable-master
'index' => _SKIN_PART_MAIN,
'item' => _SKIN_PART_ITEM,
'archivelist' => _SKIN_PART_ALIST,
);
/**
- * Actions::getDefinedActions()
+<<<<<<< HEAD
+ * Actions::getAvailableSkinTypes()
+=======
+ * Actions::getNormalSkinTypes()
+>>>>>>> skinnable-master
*
* @static
- * @param string $type page type
+ * @param void
+ * @return array list of friendly names for page actions
+ */
+<<<<<<< HEAD
+ static public function getAvailableSkinTypes()
+ {
+ return self::$default_skin_types;
+=======
+ static public function getNormalSkinTypes()
+ {
+ return self::$normal_skin_types;
+>>>>>>> skinnable-master
+ }
+
+ /**
+ * Actions::__construct()
+ * Constructor for a new Actions object
+ *
+ * @param string $type
+ * @return void
+ */
+ public function __construct($type)
+ {
+ global $catid;
+
+ // call constructor of superclass first
+ parent::__construct();
+ $this->skintype = $type;
+
+ if ( $catid )
+ {
+ $this->linkparams = array('catid' => $catid);
+ }
+ return;
+ }
+
+ /**
+ * Actions::getAvailableActions()
+ *
+ * @param void
* @return array allowed actions for the page type
*/
- static public function getDefinedActions($type='')
+ public function getAvailableActions()
{
$extra_actions = array();
- switch ( $type )
+ switch ( $this->skintype )
{
case 'index':
$extra_actions = array(
$defined_actions = array_merge(self::$default_actions, $extra_actions);
- return array_merge($defined_actions, parent::getDefinedActions());
- }
-
- /**
- * Actions::getDefaultSkinTypes()
- *
- * @static
- * @param void
- * @return array list of friendly names for page actions
- */
- static public function getDefaultSkinTypes()
- {
- return self::$default_skin_types;
- }
-
- /**
- * Actions::__construct()
- * Constructor for a new Actions object
- *
- * @param string $type
- * @return void
- */
- public function __construct($type)
- {
- global $catid;
-
- // call constructor of superclass first
- parent::__construct();
- $this->skintype = $type;
-
- if ( $catid )
- {
- $this->linkparams = array('catid' => $catid);
- }
- return;
- }
-
- /**
- * Actions::setSkin()
- * Set the skin
- * @param object $skin an instance of Skin class
- * @return void
- */
- public function setSkin(&$skin)
- {
- $this->skin =& $skin;
- return;
- }
-
- /**
- * Actions::setParser()
- * Set the parser
- *
- * @param object $parser an instance of Parser class
- * @return void
- */
- public function setParser(&$parser)
- {
- $this->parser =& $parser;
- return;
+ return array_merge($defined_actions, parent::getAvailableActions());
}
/**
$params = func_get_args();
array_shift($params);
+<<<<<<< HEAD
return call_user_func_array(array(&$plugin, 'doIf'), $params);
+=======
+ return call_user_func_array(array($plugin, 'doIf'), $params);
+>>>>>>> skinnable-master
}
/**
{
return $blog->isValidCategory($catid);
}
-
// check category name
- if ( $name == 'catname' )
+ else if ( $name == 'catname' )
{
$value = $blog->getCategoryIdFromName($value);
if ( $value == $catid )
return $blog->isValidCategory($catid);
}
}
-
// check category id
- if ( ($name == 'catid') && ($value == $catid) )
+ else if ( ($name == 'catid') && ($value == $catid) )
{
return $blog->isValidCategory($catid);
}
// TODO: Move request uri to linkparams. this is ugly. sorry for that.
$startpos = (integer) $startpos;
$parsed = parse_url(serverVar('REQUEST_URI'));
+<<<<<<< HEAD
$path = $parsed['path'];
$parsed = $parsed['query'];
+=======
+ $path = ( in_array('path', $parsed) ) ? $parsed['path'] : '';
+ $parsed = ( in_array('query', $parsed) ) ? $parsed['query'] : '';
+>>>>>>> skinnable-master
$url = '';
if ( $direction == 'prev' )
}
if ( $sqlquery )
{
- $iAmountOnPage = intval(quickQuery($sqlquery)) - intval($startpos);
+ $iAmountOnPage = intval(DB::getValue($sqlquery)) - intval($startpos);
}
}
private function preBlogContent($type, &$blog)
{
global $manager;
+<<<<<<< HEAD
$manager->notify('PreBlogContent',array('blog' => &$blog, 'type' => $type));
+=======
+ $data = array('blog' => &$blog, 'type' => $type);
+ $manager->notify('PreBlogContent', $data);
+>>>>>>> skinnable-master
return;
}
private function postBlogContent($type, &$blog)
{
global $manager;
+<<<<<<< HEAD
$manager->notify('PostBlogContent', array('blog' => &$blog, 'type' => $type));
+=======
+ $data = array('blog' => &$blog, 'type' => $type);
+ $manager->notify('PostBlogContent', $data);
+>>>>>>> skinnable-master
return;
}
* Actions::parse_archivedate()
* %archivedate(locale,date format)%
*
+<<<<<<< HEAD
* @param string $locale
* @return void
*/
}
*/
+=======
+ * @param deprecated $locale
+ * @return void
+ */
+ public function parse_archivedate($locale='')
+ {
+ global $archive;
+
+>>>>>>> skinnable-master
// get archive date
sscanf($archive,'%d-%d-%d',$y,$m,$d);
public function parse_callback($eventName, $type)
{
global $manager;
+<<<<<<< HEAD
$manager->notify($eventName, array('type' => $type));
+=======
+ $data = array('type' => $type);
+ $manager->notify($eventName, $data);
+>>>>>>> skinnable-master
return;
}
}
/**
- * Actions::parse_charset()
- * Parse skinvar charset
- *
- * @param void
- * @return void
- */
- public function parse_charset()
- {
- echo i18n::get_current_charset();
- return;
- }
-
- /**
* Actions::parse_commentform()
* Parse skinvar commentform
*
*/
public function parse_comments($template)
{
- global $itemid, $manager, $blog, $highlight;
+ global $manager, $blog, $highlight, $itemid;
+
$template =& $manager->getTemplate($template);
+<<<<<<< HEAD
+ $item =& $manager->getItem($itemid, 0, 0);
+=======
+ $item =& $manager->getitem($itemid, 0, 0);
+>>>>>>> skinnable-master
// create parser object & action handler
$handler = new ItemActions($blog);
- $parser = new Parser($actions->getDefinedActions(),$handler);
$handler->setTemplate($template);
- $handler->setParser($parser);
- $item = Item::getitem($itemid, 0, 0);
$handler->setCurrentItem($item);
+ $parser = new Parser($handler);
+
$comments = new Comments($itemid);
$comments->setItemActions($handler);
// shows ALL comments
public function parse_itemtitle($format = '')
{
global $manager, $itemid;
+<<<<<<< HEAD
$item =& $manager->getItem($itemid,0,0);
+=======
+ $item =& $manager->getItem($itemid, 1, 1);
+>>>>>>> skinnable-master
switch ( $format )
{
// add skin type on front
array_unshift($params, $this->skintype);
+<<<<<<< HEAD
call_user_func_array(array(&$plugin,'doSkinVar'), $params);
+=======
+ call_user_func_array(array($plugin,'doSkinVar'), $params);
+>>>>>>> skinnable-master
return;
}
*/
public function parse_skinname()
{
- echo $this->skin->getName();
+ echo $this->parser->skin->getName();
return;
}
* @param string $template name of template
* @return void
*/
+<<<<<<< HEAD
public function parse_sticky($itemnumber = 0, $template = '')
{
global $manager;
$this->preBlogContent('sticky',$b);
$this->amountfound = $b->readLogFromList($itemarray, $template);
$this->postBlogContent('sticky',$b);
+=======
+ public function parse_sticky($itemid = 0, $template = '')
+ {
+ global $manager;
+
+ $itemid = (integer) $itemid;
+ $itemarray = array($itemid);
+
+ $item =& $manager->getItem($post['itemid'], 1, 1);
+ $blog =& $manager->getBlog($item['blogid']);
+
+ $this->preBlogContent('sticky', $blog);
+ $this->amountfound = $blog->readLogFromList($itemarray, $template);
+ $this->postBlogContent('sticky', $blog);
+>>>>>>> skinnable-master
return;
}
}