1<?php 2/** 3 * Base class from which Zenpage news articles and pages derive 4 * @author Stephen Billard (sbillard), Malte Müller (acrylian) 5 * @package plugins 6 * @subpackage zenpage 7 */ 8class ZenpageItems extends ZenpageRoot { 9 10 /** 11 * Class instantiator 12 */ 13 function __construct() { 14 // no action required 15 } 16 17 /** 18 * Returns the author 19 * 20 * @param bool $fullname Set to true to get the full name (if the author is a vaild user of the site and has the full name defined) 21 * @return string 22 */ 23 function getAuthor($fullname = false) { 24 $author = $this->get("author"); 25 if ($fullname) { 26 return Zenphoto_Administrator::getNameByUser($author); 27 } 28 return $author; 29 } 30 31 /** 32 * 33 * sets the author attribute 34 35 */ 36 function setAuthor($a) { 37 $this->set("author", $a); 38 } 39 40 /** 41 * Returns the content 42 * 43 * @return string 44 */ 45 function getContent($locale = NULL) { 46 $text = $this->get("content"); 47 if ($locale == 'all') { 48 return unTagURLs($text); 49 } else { 50 return applyMacros(unTagURLs(get_language_string($text, $locale))); 51 } 52 } 53 54 /** 55 * 56 * Set the content datum 57 * @param $c full language string 58 */ 59 function setContent($c) { 60 $c = tagURLs($c); 61 $this->set("content", $c); 62 } 63 64 /** 65 * Returns the last change author 66 * 67 * @deprecated Zenphoto 1.6 - Use getLastChangeUser() instead 68 * 69 * @return string 70 */ 71 function getLastchangeAuthor() { 72 return $this->getLastChangeUser(); 73 } 74 75 /** 76 * 77 * stores the last change author 78 * 79 * @deprecated Zenphoto 1.6 - Use setLastChangeUser() instead 80 */ 81 function setLastchangeAuthor($a) { 82 $this->setLastchangeUser($a); 83 } 84 85 /** 86 * Returns the locked status , "1" if locked (only used on the admin) 87 * 88 * @return string 89 */ 90 function getLocked() { 91 return $this->get("locked"); 92 } 93 94 /** 95 * sets the locked status , "1" if locked (only used on the admin) 96 * 97 */ 98 function setLocked($l) { 99 $this->set("locked", $l); 100 } 101 102 /** 103 * Returns the extra content 104 * 105 * @return string 106 */ 107 function getExtraContent($locale = NULL) { 108 $text = $this->get("extracontent"); 109 if ($locale == 'all') { 110 return unTagURLs($text); 111 } else { 112 return applyMacros(unTagURLs(get_language_string($text, $locale))); 113 } 114 } 115 116 /** 117 * sets the extra content 118 * 119 */ 120 function setExtraContent($ec) { 121 $this->set("extracontent", tagURLs($ec)); 122 } 123 124 /** 125 * Returns the expire date 126 * 127 * @return string 128 */ 129 function getExpireDate() { 130 $dt = $this->get("expiredate"); 131 if ($dt == '0000-00-00 00:00:00') { 132 return NULL; 133 } else { 134 return $dt; 135 } 136 } 137 138 /** 139 * sets the expire date 140 * 141 */ 142 function setExpireDate($ed) { 143 if ($ed) { 144 $newtime = dateTimeConvert($ed); 145 if ($newtime === false) 146 return; 147 $this->set('expiredate', $newtime); 148 } else { 149 $this->set('expiredate', NULL); 150 } 151 } 152 153}