1
|
|
|
<?php |
|
|
|
|
2
|
|
|
/** |
3
|
|
|
* **************************************************************************** |
4
|
|
|
* - Developers TEAM TDM Xoops - (http://xoops.org) |
5
|
|
|
* **************************************************************************** |
6
|
|
|
* NEWS - MODULE FOR XOOPS |
7
|
|
|
* Copyright (c) 2007 - 2011 |
8
|
|
|
* TXMod Xoops (http://www.txmodxoops.org) |
9
|
|
|
* |
10
|
|
|
* This program is free software; you can redistribute it and/or modify |
11
|
|
|
* it under the terms of the GNU General Public License as published by |
12
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
13
|
|
|
* (at your option) any later version. |
14
|
|
|
* |
15
|
|
|
* You may not change or alter any portion of this comment or credits |
16
|
|
|
* of supporting developers from this source code or any supporting |
17
|
|
|
* source code which is considered copyrighted (c) material of the |
18
|
|
|
* original comment or credit authors. |
19
|
|
|
* |
20
|
|
|
* This program is distributed in the hope that it will be useful, |
21
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
22
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23
|
|
|
* GNU General Public License for more details. |
24
|
|
|
* |
25
|
|
|
* ------------------------------------------------------------------------ |
26
|
|
|
* |
27
|
|
|
* @copyright TXMod Xoops (http://www.txmodxoops.org) |
28
|
|
|
* @license GPL see LICENSE |
29
|
|
|
* @package news |
30
|
|
|
* @author TXMod Xoops ([email protected]) |
31
|
|
|
* |
32
|
|
|
* Version : 1.67 Tue 2012/02/13 22:29:36 : Timgno Exp $ |
33
|
|
|
* **************************************************************************** |
34
|
|
|
*/ |
35
|
|
|
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
|
|
|
|
36
|
|
|
|
37
|
|
|
if (!class_exists('XoopsPersistableObjectHandler')) { |
38
|
|
|
include_once XOOPS_ROOT_PATH . '/kernel/object.php'; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Class news_topics |
43
|
|
|
*/ |
44
|
|
|
class news_topics extends XoopsObject |
|
|
|
|
45
|
|
|
{ |
46
|
|
|
//Constructor |
47
|
|
|
/** |
48
|
|
|
* |
49
|
|
|
*/ |
50
|
|
|
public function __construct() |
51
|
|
|
{ |
52
|
|
|
parent::__construct(); |
53
|
|
|
$this->initVar('topic_id', XOBJ_DTYPE_INT, null, false, 4); |
54
|
|
|
$this->initVar('topic_pid', XOBJ_DTYPE_INT, null, false, 4); |
55
|
|
|
$this->initVar('topic_title', XOBJ_DTYPE_TXTBOX, null, false); |
56
|
|
|
$this->initVar('topic_imgurl', XOBJ_DTYPE_TXTBOX, null, false); |
57
|
|
|
$this->initVar('menu', XOBJ_DTYPE_INT, null, false, 1); |
58
|
|
|
$this->initVar('topic_frontpage', XOBJ_DTYPE_INT, null, false, 1); |
59
|
|
|
$this->initVar('topic_rssurl', XOBJ_DTYPE_TXTBOX, null, false); |
60
|
|
|
$this->initVar('topic_description', XOBJ_DTYPE_TXTAREA, null, false); |
61
|
|
|
$this->initVar('topic_color', XOBJ_DTYPE_TXTBOX, null, false); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Class newsnews_topicsHandler |
67
|
|
|
*/ |
68
|
|
|
class newsnews_topicsHandler extends XoopsPersistableObjectHandler |
|
|
|
|
69
|
|
|
{ |
70
|
|
|
/** |
71
|
|
|
* @param null|object|XoopsDatabase $db |
72
|
|
|
*/ |
73
|
|
|
public function __construct(XoopsDatabase $db) |
74
|
|
|
{ |
75
|
|
|
parent::__construct($db, 'news_topics', 'news_topics', 'topic_id', 'topic_pid'); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.