@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | $current_path = __FILE__; |
31 | 31 | if (DIRECTORY_SEPARATOR !== '/') { |
32 | - $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
|
32 | + $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
|
33 | 33 | } |
34 | 34 | $url_arr = explode('/', strstr($current_path, '/modules/')); |
35 | 35 | include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/include/vars.php'; |
@@ -8,13 +8,13 @@ |
||
8 | 8 | |
9 | 9 | $current_path = __FILE__; |
10 | 10 | if (DIRECTORY_SEPARATOR !== '/') { |
11 | - $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
|
11 | + $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
|
12 | 12 | } |
13 | 13 | $url_arr = explode('/', strstr($current_path, '/modules/')); |
14 | 14 | include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/include/vars.php'; |
15 | 15 | |
16 | 16 | if (defined($GLOBALS['VAR_PREFIXU'] . '_LANG_EN_MAIN')) { |
17 | - return; |
|
17 | + return; |
|
18 | 18 | } |
19 | 19 | define($GLOBALS['VAR_PREFIXU'] . '_LANG_EN_MAIN', 1); |
20 | 20 |
@@ -8,13 +8,13 @@ |
||
8 | 8 | |
9 | 9 | $current_path = __FILE__; |
10 | 10 | if (DIRECTORY_SEPARATOR !== '/') { |
11 | - $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
|
11 | + $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
|
12 | 12 | } |
13 | 13 | $url_arr = explode('/', strstr($current_path, '/modules/')); |
14 | 14 | include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/include/vars.php'; |
15 | 15 | |
16 | 16 | if (defined($GLOBALS['VAR_PREFIXU'] . '_LANG_EN_ADMIN')) { |
17 | - return; |
|
17 | + return; |
|
18 | 18 | } |
19 | 19 | define($GLOBALS['VAR_PREFIXU'] . '_LANG_EN_ADMIN', 1); |
20 | 20 |
@@ -8,13 +8,13 @@ |
||
8 | 8 | |
9 | 9 | $current_path = __FILE__; |
10 | 10 | if (DIRECTORY_SEPARATOR !== '/') { |
11 | - $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
|
11 | + $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); |
|
12 | 12 | } |
13 | 13 | $url_arr = explode('/', strstr($current_path, '/modules/')); |
14 | 14 | include XOOPS_ROOT_PATH . '/modules/' . $url_arr[2] . '/include/vars.php'; |
15 | 15 | |
16 | 16 | if (defined($GLOBALS['VAR_PREFIXU'] . '_LANG_EN_BLOCKS')) { |
17 | - return; |
|
17 | + return; |
|
18 | 18 | } |
19 | 19 | define($GLOBALS['VAR_PREFIXU'] . '_LANG_EN_BLOCKS', 1); |
20 | 20 |
@@ -30,77 +30,77 @@ |
||
30 | 30 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | if (!class_exists('Xmlrpc_client')) { |
33 | - /** |
|
34 | - * Class Xmlrpc_client |
|
35 | - */ |
|
36 | - class Xmlrpc_client |
|
37 | - { |
|
38 | - /** |
|
39 | - * Xmlrpc_client constructor. |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - } |
|
33 | + /** |
|
34 | + * Class Xmlrpc_client |
|
35 | + */ |
|
36 | + class Xmlrpc_client |
|
37 | + { |
|
38 | + /** |
|
39 | + * Xmlrpc_client constructor. |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param $article |
|
47 | - */ |
|
48 | - public function setObject(&$article) |
|
49 | - { |
|
50 | - $this->$var = $val; |
|
51 | - } |
|
45 | + /** |
|
46 | + * @param $article |
|
47 | + */ |
|
48 | + public function setObject(&$article) |
|
49 | + { |
|
50 | + $this->$var = $val; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @param $var |
|
55 | - * @param $val |
|
56 | - */ |
|
57 | - public function setVar($var, $val) |
|
58 | - { |
|
59 | - $this->$var = $val; |
|
60 | - } |
|
53 | + /** |
|
54 | + * @param $var |
|
55 | + * @param $val |
|
56 | + */ |
|
57 | + public function setVar($var, $val) |
|
58 | + { |
|
59 | + $this->$var = $val; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @param $var |
|
64 | - * @return mixed |
|
65 | - */ |
|
66 | - public function getVar($var) |
|
67 | - { |
|
68 | - return $this->$var; |
|
69 | - } |
|
70 | - } |
|
62 | + /** |
|
63 | + * @param $var |
|
64 | + * @return mixed |
|
65 | + */ |
|
66 | + public function getVar($var) |
|
67 | + { |
|
68 | + return $this->$var; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if (!class_exists('Xmlrpc_server')) { |
74 | - /** |
|
75 | - * Class Xmlrpc_server |
|
76 | - */ |
|
77 | - class Xmlrpc_server |
|
78 | - { |
|
79 | - /** |
|
80 | - * Xmlrpc_server constructor. |
|
81 | - */ |
|
82 | - public function __construct() |
|
83 | - { |
|
84 | - } |
|
74 | + /** |
|
75 | + * Class Xmlrpc_server |
|
76 | + */ |
|
77 | + class Xmlrpc_server |
|
78 | + { |
|
79 | + /** |
|
80 | + * Xmlrpc_server constructor. |
|
81 | + */ |
|
82 | + public function __construct() |
|
83 | + { |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * @param $var |
|
88 | - * @param $val |
|
89 | - */ |
|
90 | - public function setVar($var, $val) |
|
91 | - { |
|
92 | - $this->$var = $val; |
|
93 | - } |
|
86 | + /** |
|
87 | + * @param $var |
|
88 | + * @param $val |
|
89 | + */ |
|
90 | + public function setVar($var, $val) |
|
91 | + { |
|
92 | + $this->$var = $val; |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * @param $var |
|
97 | - * @return mixed |
|
98 | - */ |
|
99 | - public function getVar($var) |
|
100 | - { |
|
101 | - return $this->$var; |
|
102 | - } |
|
103 | - } |
|
95 | + /** |
|
96 | + * @param $var |
|
97 | + * @return mixed |
|
98 | + */ |
|
99 | + public function getVar($var) |
|
100 | + { |
|
101 | + return $this->$var; |
|
102 | + } |
|
103 | + } |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | PlanetUtility::planetParseClass(' |
@@ -44,23 +44,23 @@ |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Bcategory')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Bcategory |
|
49 | - */ |
|
50 | - class Bcategory extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - */ |
|
55 | - public function __construct() |
|
56 | - { |
|
57 | - // $this->ArtObject(); |
|
58 | - $this->table = planet_DB_prefix('category'); |
|
59 | - $this->initVar('cat_id', XOBJ_DTYPE_INT, null, false); |
|
60 | - $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX, '', true); |
|
61 | - $this->initVar('cat_order', XOBJ_DTYPE_INT, 1, false); |
|
62 | - } |
|
63 | - } |
|
47 | + /** |
|
48 | + * Class Bcategory |
|
49 | + */ |
|
50 | + class Bcategory extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + */ |
|
55 | + public function __construct() |
|
56 | + { |
|
57 | + // $this->ArtObject(); |
|
58 | + $this->table = planet_DB_prefix('category'); |
|
59 | + $this->initVar('cat_id', XOBJ_DTYPE_INT, null, false); |
|
60 | + $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX, '', true); |
|
61 | + $this->initVar('cat_order', XOBJ_DTYPE_INT, 1, false); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | 65 | endif; |
66 | 66 | /** |
@@ -44,25 +44,25 @@ |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Bookmark')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Bookmark |
|
49 | - */ |
|
50 | - class bookmark extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - */ |
|
55 | - public function __construct() |
|
56 | - { |
|
57 | - // $this->ArtObject(); |
|
58 | - $this->table = planet_DB_prefix('bookmark'); |
|
59 | - $this->initVar('bm_id', XOBJ_DTYPE_INT, null, false); |
|
60 | - /* user ID */ |
|
61 | - $this->initVar('bm_uid', XOBJ_DTYPE_INT, 0, true); |
|
62 | - /* blog ID */ |
|
63 | - $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
64 | - } |
|
65 | - } |
|
47 | + /** |
|
48 | + * Class Bookmark |
|
49 | + */ |
|
50 | + class bookmark extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + */ |
|
55 | + public function __construct() |
|
56 | + { |
|
57 | + // $this->ArtObject(); |
|
58 | + $this->table = planet_DB_prefix('bookmark'); |
|
59 | + $this->initVar('bm_id', XOBJ_DTYPE_INT, null, false); |
|
60 | + /* user ID */ |
|
61 | + $this->initVar('bm_uid', XOBJ_DTYPE_INT, 0, true); |
|
62 | + /* blog ID */ |
|
63 | + $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | endif; |
67 | 67 | /** |
68 | 68 | * Topic object handler class. |
@@ -44,30 +44,30 @@ discard block |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Bblog')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Bblog |
|
49 | - */ |
|
50 | - class Bblog extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - */ |
|
55 | - public function __construct() |
|
56 | - { |
|
57 | - // parent:__construct(); |
|
58 | - $this->table = planet_DB_prefix('blog'); |
|
59 | - $this->initVar('blog_id', XOBJ_DTYPE_INT, null, false); |
|
60 | - $this->initVar('blog_title', XOBJ_DTYPE_TXTBOX, null, true); |
|
61 | - $this->initVar('blog_desc', XOBJ_DTYPE_TXTBOX, null); |
|
62 | - /* rss URI */ |
|
63 | - $this->initVar('blog_feed', XOBJ_DTYPE_TXTBOX, null, true); |
|
64 | - $this->initVar('blog_language', XOBJ_DTYPE_TXTBOX, null); |
|
65 | - $this->initVar('blog_charset', XOBJ_DTYPE_TXTBOX, null); |
|
66 | - /* blog website */ |
|
67 | - $this->initVar('blog_link', XOBJ_DTYPE_TXTBOX, null); |
|
68 | - $this->initVar('blog_image', XOBJ_DTYPE_TXTBOX, null); |
|
69 | - |
|
70 | - /* regexp for blog article trackback |
|
47 | + /** |
|
48 | + * Class Bblog |
|
49 | + */ |
|
50 | + class Bblog extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + */ |
|
55 | + public function __construct() |
|
56 | + { |
|
57 | + // parent:__construct(); |
|
58 | + $this->table = planet_DB_prefix('blog'); |
|
59 | + $this->initVar('blog_id', XOBJ_DTYPE_INT, null, false); |
|
60 | + $this->initVar('blog_title', XOBJ_DTYPE_TXTBOX, null, true); |
|
61 | + $this->initVar('blog_desc', XOBJ_DTYPE_TXTBOX, null); |
|
62 | + /* rss URI */ |
|
63 | + $this->initVar('blog_feed', XOBJ_DTYPE_TXTBOX, null, true); |
|
64 | + $this->initVar('blog_language', XOBJ_DTYPE_TXTBOX, null); |
|
65 | + $this->initVar('blog_charset', XOBJ_DTYPE_TXTBOX, null); |
|
66 | + /* blog website */ |
|
67 | + $this->initVar('blog_link', XOBJ_DTYPE_TXTBOX, null); |
|
68 | + $this->initVar('blog_image', XOBJ_DTYPE_TXTBOX, null); |
|
69 | + |
|
70 | + /* regexp for blog article trackback |
|
71 | 71 | * From article url to article trackback URI |
72 | 72 | * |
73 | 73 | * For example: http://www.example.com/blog/111.html => http://www.example.com/blog/trackback/111.html |
@@ -78,75 +78,75 @@ discard block |
||
78 | 78 | * The input shall be: pattern[SPACE]replacement |
79 | 79 | * (.*wordpress/)(index.php)?(\?p.*) $1wp-trackback/$3 |
80 | 80 | */ |
81 | - $this->initVar('blog_trackback', XOBJ_DTYPE_TXTBOX, ''); |
|
82 | - |
|
83 | - /* blog submitter: is_numeric - uid; is_string - IP */ |
|
84 | - $this->initVar('blog_submitter', XOBJ_DTYPE_TXTBOX, ''); |
|
85 | - |
|
86 | - /* blog status: 0 - pending; 1 - active; 2 - featured */ |
|
87 | - $this->initVar('blog_status', XOBJ_DTYPE_INT, 1); |
|
88 | - |
|
89 | - /* key for blog content */ |
|
90 | - $this->initVar('blog_key', XOBJ_DTYPE_TXTBOX, ''); |
|
91 | - |
|
92 | - $this->initVar('blog_time', XOBJ_DTYPE_INT, 0); |
|
93 | - $this->initVar('blog_rating', XOBJ_DTYPE_INT, 0); |
|
94 | - $this->initVar('blog_rates', XOBJ_DTYPE_INT, 0); |
|
95 | - /* bookmark times */ |
|
96 | - $this->initVar('blog_marks', XOBJ_DTYPE_INT, 0); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * get formatted publish time of the article |
|
101 | - * |
|
102 | - * {@link Config} |
|
103 | - * |
|
104 | - * @param string $format format of time |
|
105 | - * @return string |
|
106 | - */ |
|
107 | - public function getTime($format = '') |
|
108 | - { |
|
109 | - $time = PlanetUtility::planetFormatTimestamp($this->getVar('blog_time'), $format); |
|
110 | - |
|
111 | - return $time; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * get verified image url of the category |
|
116 | - * |
|
117 | - * @return string |
|
118 | - */ |
|
119 | - public function getImage() |
|
120 | - { |
|
121 | - $image = $this->getVar('blog_image'); |
|
122 | - |
|
123 | - return $image; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * get rating average of the article |
|
128 | - * |
|
129 | - * @param int $decimals decimal length |
|
130 | - * @return numeric |
|
131 | - */ |
|
132 | - public function getRatingAverage($decimals = 1) |
|
133 | - { |
|
134 | - $ave = 3; |
|
135 | - if ($this->getVar('blog_rates')) { |
|
136 | - $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
137 | - } |
|
138 | - |
|
139 | - return $ave; |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * @return numeric |
|
144 | - */ |
|
145 | - public function getStar() |
|
146 | - { |
|
147 | - return $this->getRatingAverage(0); |
|
148 | - } |
|
149 | - } |
|
81 | + $this->initVar('blog_trackback', XOBJ_DTYPE_TXTBOX, ''); |
|
82 | + |
|
83 | + /* blog submitter: is_numeric - uid; is_string - IP */ |
|
84 | + $this->initVar('blog_submitter', XOBJ_DTYPE_TXTBOX, ''); |
|
85 | + |
|
86 | + /* blog status: 0 - pending; 1 - active; 2 - featured */ |
|
87 | + $this->initVar('blog_status', XOBJ_DTYPE_INT, 1); |
|
88 | + |
|
89 | + /* key for blog content */ |
|
90 | + $this->initVar('blog_key', XOBJ_DTYPE_TXTBOX, ''); |
|
91 | + |
|
92 | + $this->initVar('blog_time', XOBJ_DTYPE_INT, 0); |
|
93 | + $this->initVar('blog_rating', XOBJ_DTYPE_INT, 0); |
|
94 | + $this->initVar('blog_rates', XOBJ_DTYPE_INT, 0); |
|
95 | + /* bookmark times */ |
|
96 | + $this->initVar('blog_marks', XOBJ_DTYPE_INT, 0); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * get formatted publish time of the article |
|
101 | + * |
|
102 | + * {@link Config} |
|
103 | + * |
|
104 | + * @param string $format format of time |
|
105 | + * @return string |
|
106 | + */ |
|
107 | + public function getTime($format = '') |
|
108 | + { |
|
109 | + $time = PlanetUtility::planetFormatTimestamp($this->getVar('blog_time'), $format); |
|
110 | + |
|
111 | + return $time; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * get verified image url of the category |
|
116 | + * |
|
117 | + * @return string |
|
118 | + */ |
|
119 | + public function getImage() |
|
120 | + { |
|
121 | + $image = $this->getVar('blog_image'); |
|
122 | + |
|
123 | + return $image; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * get rating average of the article |
|
128 | + * |
|
129 | + * @param int $decimals decimal length |
|
130 | + * @return numeric |
|
131 | + */ |
|
132 | + public function getRatingAverage($decimals = 1) |
|
133 | + { |
|
134 | + $ave = 3; |
|
135 | + if ($this->getVar('blog_rates')) { |
|
136 | + $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
137 | + } |
|
138 | + |
|
139 | + return $ave; |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * @return numeric |
|
144 | + */ |
|
145 | + public function getStar() |
|
146 | + { |
|
147 | + return $this->getRatingAverage(0); |
|
148 | + } |
|
149 | + } |
|
150 | 150 | endif; |
151 | 151 | /** |
152 | 152 | * Topic object handler class. |
@@ -44,116 +44,116 @@ |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Barticle')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Barticle |
|
49 | - */ |
|
50 | - class Barticle extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - * |
|
55 | - * @param int $id ID of the article |
|
56 | - */ |
|
57 | - public function __construct($id = null) |
|
58 | - { |
|
59 | - // $this->ArtObject(); |
|
60 | - $this->table = planet_DB_prefix('article'); |
|
61 | - $this->initVar('art_id', XOBJ_DTYPE_INT, null, false); |
|
62 | - $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
63 | - |
|
64 | - $this->initVar('art_title', XOBJ_DTYPE_TXTBOX, ''); |
|
65 | - $this->initVar('art_content', XOBJ_DTYPE_TXTAREA, ''); |
|
66 | - $this->initVar('art_link', XOBJ_DTYPE_TXTBOX, ''); |
|
67 | - $this->initVar('art_time', XOBJ_DTYPE_INT, 0); |
|
68 | - $this->initVar('art_author', XOBJ_DTYPE_TXTBOX, ''); |
|
69 | - |
|
70 | - $this->initVar('art_views', XOBJ_DTYPE_INT, 0); |
|
71 | - $this->initVar('art_rating', XOBJ_DTYPE_INT, 0); |
|
72 | - $this->initVar('art_rates', XOBJ_DTYPE_INT, 0); |
|
73 | - $this->initVar('art_comments', XOBJ_DTYPE_INT, 0); |
|
74 | - |
|
75 | - $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); |
|
76 | - $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1); |
|
77 | - $this->initVar('doxcode', XOBJ_DTYPE_INT, 1); |
|
78 | - $this->initVar('doimage', XOBJ_DTYPE_INT, 1); |
|
79 | - $this->initVar('dobr', XOBJ_DTYPE_INT, 1); |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * get title of the article |
|
84 | - * |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - public function getTitle() |
|
88 | - { |
|
89 | - $title = $this->getVar('art_title'); |
|
90 | - |
|
91 | - return $title; |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * get formatted publish time of the article |
|
96 | - * |
|
97 | - * {@link Config} |
|
98 | - * |
|
99 | - * @param string $format format of time |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - public function getTime($format = 'c') |
|
103 | - { |
|
104 | - $time = $this->getVar('art_time'); |
|
105 | - if (empty($time)) { |
|
106 | - $time = time(); |
|
107 | - } |
|
108 | - $time = PlanetUtility::planetFormatTimestamp($time, $format); |
|
109 | - |
|
110 | - return $time; |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * get summary of the article |
|
115 | - * |
|
116 | - * @param int $length |
|
117 | - * @return string $summary |
|
118 | - */ |
|
119 | - public function &getSummary($length = 0) |
|
120 | - { |
|
121 | - $content = $this->getVar('art_content'); |
|
122 | - $summary =& PlanetUtility::planetHtml2text($content); |
|
123 | - if (empty($length)) { |
|
124 | - $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
|
125 | - } |
|
126 | - if (!empty($length)) { |
|
127 | - $summary = xoops_substr($summary, 0, $length); |
|
128 | - } |
|
129 | - |
|
130 | - return $summary; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * get rating average of the article |
|
135 | - * |
|
136 | - * @param int $decimals decimal length |
|
137 | - * @return numeric |
|
138 | - */ |
|
139 | - public function getRatingAverage($decimals = 1) |
|
140 | - { |
|
141 | - $ave = 3; |
|
142 | - if ($this->getVar('art_rates')) { |
|
143 | - $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
144 | - } |
|
145 | - |
|
146 | - return $ave; |
|
147 | - } |
|
148 | - |
|
149 | - /** |
|
150 | - * @return numeric |
|
151 | - */ |
|
152 | - public function getStar() |
|
153 | - { |
|
154 | - return $this->getRatingAverage(0); |
|
155 | - } |
|
156 | - } |
|
47 | + /** |
|
48 | + * Class Barticle |
|
49 | + */ |
|
50 | + class Barticle extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + * |
|
55 | + * @param int $id ID of the article |
|
56 | + */ |
|
57 | + public function __construct($id = null) |
|
58 | + { |
|
59 | + // $this->ArtObject(); |
|
60 | + $this->table = planet_DB_prefix('article'); |
|
61 | + $this->initVar('art_id', XOBJ_DTYPE_INT, null, false); |
|
62 | + $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
63 | + |
|
64 | + $this->initVar('art_title', XOBJ_DTYPE_TXTBOX, ''); |
|
65 | + $this->initVar('art_content', XOBJ_DTYPE_TXTAREA, ''); |
|
66 | + $this->initVar('art_link', XOBJ_DTYPE_TXTBOX, ''); |
|
67 | + $this->initVar('art_time', XOBJ_DTYPE_INT, 0); |
|
68 | + $this->initVar('art_author', XOBJ_DTYPE_TXTBOX, ''); |
|
69 | + |
|
70 | + $this->initVar('art_views', XOBJ_DTYPE_INT, 0); |
|
71 | + $this->initVar('art_rating', XOBJ_DTYPE_INT, 0); |
|
72 | + $this->initVar('art_rates', XOBJ_DTYPE_INT, 0); |
|
73 | + $this->initVar('art_comments', XOBJ_DTYPE_INT, 0); |
|
74 | + |
|
75 | + $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); |
|
76 | + $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1); |
|
77 | + $this->initVar('doxcode', XOBJ_DTYPE_INT, 1); |
|
78 | + $this->initVar('doimage', XOBJ_DTYPE_INT, 1); |
|
79 | + $this->initVar('dobr', XOBJ_DTYPE_INT, 1); |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * get title of the article |
|
84 | + * |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + public function getTitle() |
|
88 | + { |
|
89 | + $title = $this->getVar('art_title'); |
|
90 | + |
|
91 | + return $title; |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * get formatted publish time of the article |
|
96 | + * |
|
97 | + * {@link Config} |
|
98 | + * |
|
99 | + * @param string $format format of time |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + public function getTime($format = 'c') |
|
103 | + { |
|
104 | + $time = $this->getVar('art_time'); |
|
105 | + if (empty($time)) { |
|
106 | + $time = time(); |
|
107 | + } |
|
108 | + $time = PlanetUtility::planetFormatTimestamp($time, $format); |
|
109 | + |
|
110 | + return $time; |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * get summary of the article |
|
115 | + * |
|
116 | + * @param int $length |
|
117 | + * @return string $summary |
|
118 | + */ |
|
119 | + public function &getSummary($length = 0) |
|
120 | + { |
|
121 | + $content = $this->getVar('art_content'); |
|
122 | + $summary =& PlanetUtility::planetHtml2text($content); |
|
123 | + if (empty($length)) { |
|
124 | + $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
|
125 | + } |
|
126 | + if (!empty($length)) { |
|
127 | + $summary = xoops_substr($summary, 0, $length); |
|
128 | + } |
|
129 | + |
|
130 | + return $summary; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * get rating average of the article |
|
135 | + * |
|
136 | + * @param int $decimals decimal length |
|
137 | + * @return numeric |
|
138 | + */ |
|
139 | + public function getRatingAverage($decimals = 1) |
|
140 | + { |
|
141 | + $ave = 3; |
|
142 | + if ($this->getVar('art_rates')) { |
|
143 | + $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
144 | + } |
|
145 | + |
|
146 | + return $ave; |
|
147 | + } |
|
148 | + |
|
149 | + /** |
|
150 | + * @return numeric |
|
151 | + */ |
|
152 | + public function getStar() |
|
153 | + { |
|
154 | + return $this->getRatingAverage(0); |
|
155 | + } |
|
156 | + } |
|
157 | 157 | endif; |
158 | 158 | |
159 | 159 | /** |