Cheetah
ChWallConfig.php
Go to the documentation of this file.
1 <?php
2 
8 require_once(CH_DIRECTORY_PATH_CLASSES . 'ChWsbConfig.php');
9 
11 {
12  var $_oDb;
15  var $_bJsMode;
29 
32 
37 
39 
41  {
42  parent::__construct($aModule);
43 
44  $sName = 'ch_wall';
45 
46  $this->_bJsMode = false;
47 
48  $this->_sAlertSystemName = $sName;
49  $this->_sCommentSystemName = $sName;
50  $this->_sVotingSystemName = $sName;
51 
52  $this->_aRepostDefaults = array(
53  'show_do_repost_as_button' => false,
54  'show_do_repost_as_button_small' => false,
55  'show_do_repost_icon' => false,
56  'show_do_repost_label' => true,
57  'show_counter' => true
58  );
59 
60  $this->_sCommonPostPrefix = 'wall_common_';
61  $this->_aPrefixes = array(
62  'style' => 'wall',
63  'language' => '_wall',
64  'option' => 'wall_',
65  'common_post' => $this->_sCommonPostPrefix
66  );
67 
68  $this->_sAnimationEffect = 'fade';
69  $this->_iAnimationSpeed = 'slow';
70  $this->_sDividerDateFormat = getLocaleFormat(CH_WSB_LOCALE_DATE_SHORT, CH_WSB_LOCALE_DB);
71 
72  $this->_aHideEventsTimeline = array();
73  $this->_aHideEventsOutline = array();
74  $this->_aHideUploadersTimeline = array();
75  $this->_aHandlers = array();
76 
77  $this->_aJsClasses = array(
78  'post' => 'ChWallPost',
79  'repost' => 'ChWallRepost',
80  'view' => 'ChWallView',
81  'outline' => 'ChWallOutline'
82  );
83 
84  $this->_aJsObjects = array(
85  'post' => 'oWallPost',
86  'repost' => 'oWallRepost',
87  'view' => 'oWallView',
88  'outline' => 'oWallOutline',
89  'voting' => 'oWallVoting',
90  );
91 
92  $sHtmlPrefix = str_replace('_', '-', $sName);
93  $this->_aHtmlIds = array(
94  'post' => array(
95  'loading' => $sHtmlPrefix . '-post-loading',
96  ),
97  'repost' => array(
98  'main' => $sHtmlPrefix . '-repost-',
99  'counter' => $sHtmlPrefix . '-repost-counter-',
100  'by_popup' => $sHtmlPrefix . '-repost-by-',
101  )
102  );
103  }
104 
105  function init(&$oDb)
106  {
107  $this->_oDb = &$oDb;
108 
109  $this->_bAllowDelete = $this->_oDb->getParam('wall_enable_delete') == 'on';
110  $this->_iPerPageProfileTl = (int)$this->_oDb->getParam('wall_events_per_page_profile_tl');
111  $this->_iPerPageAccountTl = (int)$this->_oDb->getParam('wall_events_per_page_account_tl');
112  $this->_iPerPageIndexTl = (int)$this->_oDb->getParam('wall_events_per_page_index_tl');
113  $this->_iPerPageIndexOl = (int)$this->_oDb->getParam('wall_events_per_page_index_ol');
114  $this->_iCharsDisplayMax = (int)$this->_oDb->getParam('wall_events_chars_display_max');
115  $this->_iRssLength = (int)$this->_oDb->getParam('wall_rss_length');
116 
117  $sHideUploadersTimeline = $this->_oDb->getParam('wall_uploaders_hide_timeline');
118  if(!empty($sHideUploadersTimeline))
119  $this->_aHideUploadersTimeline = explode(',', $sHideUploadersTimeline);
120 
121  $sHideEventsTimeline = $this->_oDb->getParam('wall_events_hide_timeline');
122  if(!empty($sHideEventsTimeline))
123  $this->_aHideEventsTimeline = explode(',', $sHideEventsTimeline);
124 
125  $sHideEventsOutline = $this->_oDb->getParam('wall_events_hide_outline');
126  if(!empty($sHideEventsOutline))
127  $this->_aHideEventsOutline = explode(',', $sHideEventsOutline);
128 
129  $aHandlers = $this->_oDb->getHandlers();
130  foreach($aHandlers as $aHandler)
131  $this->_aHandlers[$aHandler['alert_unit'] . '_' . $aHandler['alert_action']] = $aHandler;
132  }
134  {
136  }
138  {
139  return $this->_sAlertSystemName;
140  }
142  {
144  }
146  {
148  }
150  {
152  }
153  function getPerPage($sPage = 'profile')
154  {
155  $iResult = 10;
156  switch($sPage) {
157  case 'profile':
158  $iResult = $this->_iPerPageProfileTl;
159  break;
160  case 'account':
161  $iResult = $this->_iPerPageAccountTl;
162  break;
163  case 'index_tl':
164  $iResult = $this->_iPerPageIndexTl;
165  break;
166  case 'index_ol':
167  $iResult = $this->_iPerPageIndexOl;
168  break;
169  }
170 
171  return $iResult;
172  }
173  function getRepostDefaults()
174  {
176  }
178  {
180  }
181  function getAnimationSpeed()
182  {
184  }
185  public function getCharsDisplayMax()
186  {
188  }
189  function getRssLength()
190  {
191  return $this->_iRssLength;
192  }
193  function getPrefix($sType = '')
194  {
195  if(empty($sType))
196  return $this->_aPrefixes;
197 
198  return isset($this->_aPrefixes[$sType]) ? $this->_aPrefixes[$sType] : '';
199  }
200  function getJsClass($sType)
201  {
202  return $this->_aJsClasses[$sType];
203  }
204  function getJsObject($sType)
205  {
206  return $this->_aJsObjects[$sType];
207  }
209  {
210  $aResult = array();
211 
212  switch($sType) {
215  break;
218  break;
219  }
220 
221  return $aResult;
222  }
224  {
225  $aResult = array();
226 
227  switch($sType) {
230  break;
232  $aResult = array();
233  break;
234  }
235 
236  return $aResult;
237  }
238  function getHtmlIds($sType, $sKey = '')
239  {
240  if(empty($sKey))
241  return isset($this->_aHtmlIds[$sType]) ? $this->_aHtmlIds[$sType] : array();
242 
243  return isset($this->_aHtmlIds[$sType][$sKey]) ? $this->_aHtmlIds[$sType][$sKey] : '';
244  }
245  function getHandlers($sKey = '')
246  {
247  if($sKey == '')
248  return $this->_aHandlers;
249 
250  return $this->_aHandlers[$sKey];
251  }
252  function isHandler($sKey = '')
253  {
254  return isset($this->_aHandlers[$sKey]);
255  }
256  function setJsMode($bJsMode)
257  {
258  $this->_bJsMode = $bJsMode;
259  }
260  function getJsMode()
261  {
262  return $this->_bJsMode;
263  }
264  function isJsMode()
265  {
266  return $this->_bJsMode;
267  }
269  {
270  $sPrefix = $this->getCommonPostPrefix();
271  return strpos($sType, $sPrefix) === false && !empty($sAction);
272  }
273  function getSystemData(&$aEvent, $sDisplayType = CH_WALL_VIEW_TIMELINE)
274  {
275  $sHandler = $aEvent['type'] . '_' . $aEvent['action'];
276  if(!$this->isHandler($sHandler))
277  return false;
278 
279  $aHandler = $this->getHandlers($sHandler);
280  if(empty($aHandler['module_uri']) || empty($aHandler['module_class']) || empty($aHandler['module_method']))
281  return false;
282 
283  return ChWsbService::call($aHandler['module_uri'], $aHandler['module_method'] . ($sDisplayType == CH_WALL_VIEW_OUTLINE ? '_' . CH_WALL_VIEW_OUTLINE : ''), array($aEvent), $aHandler['module_class']);
284  }
285  function getSystemDataByDescriptor($sType, $sAction, $iObjectId, $sDisplayType = CH_WALL_VIEW_TIMELINE)
286  {
287  $aDescriptor = array(
288  'type' => $sType,
289  'action' => $sAction,
290  'object_id' => $iObjectId
291  );
292  return $this->getSystemData($aDescriptor, $sDisplayType);
293  }
294 
296  {
297  return strcmp($sType, 'comment') === 0 && strcmp($sAction, 'add') === 0;
298  }
299 
300  function isGrouped($sType, $sAction, $mixedObjectId)
301  {
302  $sHandler = $sType . '_' . $sAction;
303  if(!$this->isHandler($sHandler))
304  return false;
305 
306  $aHandler = $this->getHandlers($sHandler);
307  if((int)$aHandler['groupable'] == 0 || empty($aHandler['group_by']))
308  return false;
309 
310  return $this->isGroupedObject($mixedObjectId);
311  }
312 
313  function isGroupedObject($mixedObjectId)
314  {
315  return strpos($mixedObjectId, CH_WALL_DIVIDER_OBJECT_ID) !== false;
316  }
317 
319  {
320  return strtolower(str_replace('ch_', '', $sName));
321  }
322 
324  {
325  return 'ch_' . $sType;
326  }
327 }
ChWallConfig\$_iRssLength
$_iRssLength
Definition: ChWallConfig.php:24
ChWallConfig\getRepostDefaults
getRepostDefaults()
Definition: ChWallConfig.php:173
ChWallConfig\getJsMode
getJsMode()
Definition: ChWallConfig.php:260
ChWallConfig\$_bAllowDelete
$_bAllowDelete
Definition: ChWallConfig.php:13
ChWallConfig\isSystem
isSystem($sType, $sAction)
Definition: ChWallConfig.php:268
ChWallConfig\getJsObject
getJsObject($sType)
Definition: ChWallConfig.php:204
ChWallConfig
Definition: ChWallConfig.php:11
ChWallConfig\getSystemDataByDescriptor
getSystemDataByDescriptor($sType, $sAction, $iObjectId, $sDisplayType=CH_WALL_VIEW_TIMELINE)
Definition: ChWallConfig.php:285
ChWallConfig\getCommonPostPrefix
getCommonPostPrefix()
Definition: ChWallConfig.php:141
ChWallConfig\$_aHtmlIds
$_aHtmlIds
Definition: ChWallConfig.php:33
ChWallConfig\getVotingSystemName
getVotingSystemName()
Definition: ChWallConfig.php:149
ChWallConfig\isHandler
isHandler($sKey='')
Definition: ChWallConfig.php:252
ChWallConfig\getHandlers
getHandlers($sKey='')
Definition: ChWallConfig.php:245
ChWallConfig\isSystemComment
isSystemComment($sType, $sAction)
Definition: ChWallConfig.php:295
ChWallConfig\$_aPrefixes
$_aPrefixes
Definition: ChWallConfig.php:34
ChWallConfig\$_sDividerDateFormat
$_sDividerDateFormat
Definition: ChWallConfig.php:16
ChWallConfig\$_aHandlers
$_aHandlers
Definition: ChWallConfig.php:38
ChWallConfig\getCommentSystemName
getCommentSystemName()
Definition: ChWallConfig.php:145
ChWallConfig\getPerPage
getPerPage($sPage='profile')
Definition: ChWallConfig.php:153
CH_WALL_DIVIDER_OBJECT_ID
const CH_WALL_DIVIDER_OBJECT_ID
Definition: ChWallModule.php:36
ChWallConfig\getCommonName
getCommonName($sType)
Definition: ChWallConfig.php:323
$aModule
$aModule
Definition: classifieds.php:21
ChWallConfig\$_oDb
$_oDb
Definition: ChWallConfig.php:12
ChWallConfig\$_iPerPageProfileTl
$_iPerPageProfileTl
Definition: ChWallConfig.php:20
ChWallConfig\getRssLength
getRssLength()
Definition: ChWallConfig.php:189
ChWallConfig\$_aJsClasses
$_aJsClasses
Definition: ChWallConfig.php:35
$aResult
$aResult
Definition: index.php:19
ChWallConfig\getPrefix
getPrefix($sType='')
Definition: ChWallConfig.php:193
ChWallConfig\__construct
__construct($aModule)
Definition: ChWallConfig.php:40
ChWallConfig\$_iPerPageIndex
$_iPerPageIndex
Definition: ChWallConfig.php:22
ChWallConfig\getHtmlIds
getHtmlIds($sType, $sKey='')
Definition: ChWallConfig.php:238
php
ChWallConfig\setJsMode
setJsMode($bJsMode)
Definition: ChWallConfig.php:256
ChWallConfig\$_aJsObjects
$_aJsObjects
Definition: ChWallConfig.php:36
ChWallConfig\$_iCharsDisplayMax
$_iCharsDisplayMax
Definition: ChWallConfig.php:23
ChWallConfig\$_sCommonPostPrefix
$_sCommonPostPrefix
Definition: ChWallConfig.php:17
CH_WALL_VIEW_OUTLINE
const CH_WALL_VIEW_OUTLINE
Definition: ChWallModule.php:24
ChWallConfig\isGrouped
isGrouped($sType, $sAction, $mixedObjectId)
Definition: ChWallConfig.php:300
ChWallConfig\getSystemData
getSystemData(&$aEvent, $sDisplayType=CH_WALL_VIEW_TIMELINE)
Definition: ChWallConfig.php:273
CH_WALL_VIEW_TIMELINE
const CH_WALL_VIEW_TIMELINE
Definition: ChWallModule.php:23
ChWallConfig\$_bJsMode
$_bJsMode
Definition: ChWallConfig.php:15
ChWallConfig\$_aHideEventsOutline
$_aHideEventsOutline
Definition: ChWallConfig.php:26
$sType
$sType
Definition: actions.inc.php:11
ChWallConfig\isJsMode
isJsMode()
Definition: ChWallConfig.php:264
ChWallConfig\$_aRepostDefaults
$_aRepostDefaults
Definition: ChWallConfig.php:28
ChWallConfig\$_aHideUploadersTimeline
$_aHideUploadersTimeline
Definition: ChWallConfig.php:27
ChWallConfig\getDividerDateFormat
getDividerDateFormat()
Definition: ChWallConfig.php:133
ChWallConfig\getJsClass
getJsClass($sType)
Definition: ChWallConfig.php:200
ChWallConfig\$_bFullCompilation
$_bFullCompilation
Definition: ChWallConfig.php:14
$oDb
global $oDb
Definition: db.inc.php:39
ChWallConfig\getCharsDisplayMax
getCharsDisplayMax()
Definition: ChWallConfig.php:185
ChWallConfig\getAlertSystemName
getAlertSystemName()
Definition: ChWallConfig.php:137
CH_WSB_LOCALE_DATE_SHORT
const CH_WSB_LOCALE_DATE_SHORT
Definition: utils.inc.php:15
ChWsbConfig
Definition: ChWsbConfig.php:38
ChWallConfig\getUploadersHidden
getUploadersHidden($sType)
Definition: ChWallConfig.php:223
ChWallConfig\getHandlersHidden
getHandlersHidden($sType)
Definition: ChWallConfig.php:208
ChWallConfig\$_sVotingSystemName
$_sVotingSystemName
Definition: ChWallConfig.php:19
CH_WSB_LOCALE_DB
const CH_WSB_LOCALE_DB
Definition: utils.inc.php:19
ChWallConfig\$_sCommentSystemName
$_sCommentSystemName
Definition: ChWallConfig.php:18
ChWallConfig\$_aHideEventsTimeline
$_aHideEventsTimeline
Definition: ChWallConfig.php:25
ChWallConfig\$_sAnimationEffect
$_sAnimationEffect
Definition: ChWallConfig.php:30
ChWallConfig\$_iAnimationSpeed
$_iAnimationSpeed
Definition: ChWallConfig.php:31
getLocaleFormat
getLocaleFormat($iCode=CH_WSB_LOCALE_DATE_SHORT, $iType=CH_WSB_LOCALE_PHP)
Definition: utils.inc.php:89
ChWallConfig\getCommonType
getCommonType($sName)
Definition: ChWallConfig.php:318
ChWallConfig\init
init(&$oDb)
Definition: ChWallConfig.php:105
$sAction
$sAction
Definition: categories.php:274
ChWallConfig\isGroupedObject
isGroupedObject($mixedObjectId)
Definition: ChWallConfig.php:313
ChWallConfig\getAnimationEffect
getAnimationEffect()
Definition: ChWallConfig.php:177
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
ChWsbService\call
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
Definition: ChWsbService.php:32
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
$sName
$sName
Definition: ChWsbAdminTools.php:853
ChWallConfig\getAnimationSpeed
getAnimationSpeed()
Definition: ChWallConfig.php:181
ChWallConfig\$_iPerPageAccountTl
$_iPerPageAccountTl
Definition: ChWallConfig.php:21