1
|
|
|
<?php |
|
|
|
|
2
|
|
|
/* |
3
|
|
|
You may not change or alter any portion of this comment or credits |
4
|
|
|
of supporting developers from this source code or any supporting source code |
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
/** |
12
|
|
|
* PublisherUtilities Class |
13
|
|
|
* |
14
|
|
|
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ |
15
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU public license |
16
|
|
|
* @author XOOPS Development Team |
17
|
|
|
* @package Publisher |
18
|
|
|
* @since 1.03 |
19
|
|
|
* @version $Id: breadcrumb.php 12277 2014-01-26 01:21:57Z beckmi $ |
20
|
|
|
* |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
include_once dirname(__DIR__) . '/include/common.php'; |
24
|
|
|
|
25
|
|
|
//namespace Publisher; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Class PublisherUtilities |
29
|
|
|
*/ |
30
|
|
|
class PublisherUtilities |
|
|
|
|
31
|
|
|
{ |
32
|
|
|
/** |
33
|
|
|
* Function responsible for checking if a directory exists, we can also write in and create an index.html file |
34
|
|
|
* |
35
|
|
|
* @param string $folder The full path of the directory to check |
36
|
|
|
* |
37
|
|
|
* @return void |
38
|
|
|
*/ |
39
|
|
|
public static function createFolder($folder) |
40
|
|
|
{ |
41
|
|
|
try { |
42
|
|
|
if (!@mkdir($folder) && !is_dir($folder)) { |
43
|
|
|
throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
44
|
|
|
} else { |
45
|
|
|
file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
46
|
|
|
} |
47
|
|
|
} catch (Exception $e) { |
48
|
|
|
echo 'Caught exception: ', $e->getMessage(), "\n", '<br/>'; |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param $file |
54
|
|
|
* @param $folder |
55
|
|
|
* @return bool |
56
|
|
|
*/ |
57
|
|
|
public static function copyFile($file, $folder) |
58
|
|
|
{ |
59
|
|
|
return copy($file, $folder); |
60
|
|
|
// try { |
|
|
|
|
61
|
|
|
// if (!is_dir($folder)) { |
62
|
|
|
// throw new \RuntimeException(sprintf('Unable to copy file as: %s ', $folder)); |
63
|
|
|
// } else { |
64
|
|
|
// return copy($file, $folder); |
65
|
|
|
// } |
66
|
|
|
// } catch (Exception $e) { |
67
|
|
|
// echo 'Caught exception: ', $e->getMessage(), "\n", "<br/>"; |
68
|
|
|
// } |
69
|
|
|
// return false; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param $src |
74
|
|
|
* @param $dst |
75
|
|
|
*/ |
76
|
|
|
public static function recurseCopy($src, $dst) |
77
|
|
|
{ |
78
|
|
|
$dir = opendir($src); |
79
|
|
|
// @mkdir($dst); |
80
|
|
|
while (false !== ($file = readdir($dir))) { |
81
|
|
|
if (($file !== '.') && ($file !== '..')) { |
82
|
|
|
if (is_dir($src . '/' . $file)) { |
83
|
|
|
self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
84
|
|
|
} else { |
85
|
|
|
copy($src . '/' . $file, $dst . '/' . $file); |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
closedir($dir); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
// auto create folders---------------------------------------- |
93
|
|
|
//TODO rename this function? And exclude image folder? |
94
|
|
|
public static function createDir() |
95
|
|
|
{ |
96
|
|
|
// auto crate folders |
97
|
|
|
// $thePath = publisherGetUploadDir(); |
|
|
|
|
98
|
|
|
|
99
|
|
View Code Duplication |
if (publisherGetPathStatus('root', true) < 0) { |
|
|
|
|
100
|
|
|
$thePath = publisherGetUploadDir(); |
101
|
|
|
$res = publisherMkdir($thePath); |
102
|
|
|
$msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED; |
|
|
|
|
103
|
|
|
} |
104
|
|
|
|
105
|
|
View Code Duplication |
if (publisherGetPathStatus('images', true) < 0) { |
|
|
|
|
106
|
|
|
$thePath = publisherGetImageDir(); |
107
|
|
|
$res = publisherMkdir($thePath); |
108
|
|
|
|
109
|
|
|
if ($res) { |
110
|
|
|
$source = PUBLISHER_ROOT_PATH . '/assets/images/blank.png'; |
111
|
|
|
$dest = $thePath . 'blank.png'; |
112
|
|
|
publisherCopyr($source, $dest); |
113
|
|
|
} |
114
|
|
|
$msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED; |
|
|
|
|
115
|
|
|
} |
116
|
|
|
|
117
|
|
View Code Duplication |
if (publisherGetPathStatus('images/category', true) < 0) { |
|
|
|
|
118
|
|
|
$thePath = publisherGetImageDir('category'); |
119
|
|
|
$res = publisherMkdir($thePath); |
120
|
|
|
|
121
|
|
|
if ($res) { |
122
|
|
|
$source = PUBLISHER_ROOT_PATH . '/assets/images/blank.png'; |
123
|
|
|
$dest = $thePath . 'blank.png'; |
124
|
|
|
publisherCopyr($source, $dest); |
125
|
|
|
} |
126
|
|
|
$msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED; |
|
|
|
|
127
|
|
|
} |
128
|
|
|
|
129
|
|
View Code Duplication |
if (publisherGetPathStatus('images/item', true) < 0) { |
|
|
|
|
130
|
|
|
$thePath = publisherGetImageDir('item'); |
131
|
|
|
$res = publisherMkdir($thePath); |
132
|
|
|
|
133
|
|
|
if ($res) { |
134
|
|
|
$source = PUBLISHER_ROOT_PATH . '/assets/images/blank.png'; |
135
|
|
|
$dest = $thePath . 'blank.png'; |
136
|
|
|
publisherCopyr($source, $dest); |
137
|
|
|
} |
138
|
|
|
$msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED; |
|
|
|
|
139
|
|
|
} |
140
|
|
|
|
141
|
|
View Code Duplication |
if (publisherGetPathStatus('content', true) < 0) { |
|
|
|
|
142
|
|
|
$thePath = publisherGetUploadDir(true, 'content'); |
|
|
|
|
143
|
|
|
$res = publisherMkdir($thePath); |
144
|
|
|
$msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED; |
|
|
|
|
145
|
|
|
} |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
public static function buildTableItemTitleRow() |
149
|
|
|
{ |
150
|
|
|
echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
151
|
|
|
echo '<tr>'; |
152
|
|
|
echo "<th width='40px' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ITEMID . '</strong></td>'; |
153
|
|
|
echo "<th width='100px' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ITEMCAT . '</strong></td>'; |
154
|
|
|
echo "<th class='bg3' align='center'><strong>" . _AM_PUBLISHER_TITLE . '</strong></td>'; |
155
|
|
|
echo "<th width='100px' class='bg3' align='center'><strong>" . _AM_PUBLISHER_CREATED . '</strong></td>'; |
156
|
|
|
|
157
|
|
|
echo "<th width='50px' class='bg3' align='center'><strong>" . _CO_PUBLISHER_WEIGHT . '</strong></td>'; |
158
|
|
|
echo "<th width='50px' class='bg3' align='center'><strong>" . _AM_PUBLISHER_HITS . '</strong></td>'; |
159
|
|
|
echo "<th width='60px' class='bg3' align='center'><strong>" . _AM_PUBLISHER_RATE . '</strong></td>'; |
160
|
|
|
echo "<th width='50px' class='bg3' align='center'><strong>" . _AM_PUBLISHER_VOTES . '</strong></td>'; |
161
|
|
|
echo "<th width='60px' class='bg3' align='center'><strong>" . _AM_PUBLISHER_COMMENTS_COUNT . '</strong></td>'; |
162
|
|
|
|
163
|
|
|
echo "<th width='90px' class='bg3' align='center'><strong>" . _CO_PUBLISHER_STATUS . '</strong></td>'; |
164
|
|
|
echo "<th width='90px' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>'; |
165
|
|
|
echo '</tr>'; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @param $categoryObj |
170
|
|
|
* @param int $level |
171
|
|
|
*/ |
172
|
|
|
public static function displayCategory(PublisherCategory $categoryObj, $level = 0) |
173
|
|
|
{ |
174
|
|
|
$publisher = PublisherPublisher::getInstance(); |
175
|
|
|
|
176
|
|
|
$description = $categoryObj->description(); |
177
|
|
|
if (!XOOPS_USE_MULTIBYTES) { |
178
|
|
|
if (strlen($description) >= 100) { |
179
|
|
|
$description = substr($description, 0, 100 - 1) . '...'; |
|
|
|
|
180
|
|
|
} |
181
|
|
|
} |
182
|
|
|
$modify = "<a href='category.php?op=mod&categoryid=" . $categoryObj->categoryid() . '&parentid=' . $categoryObj->parentid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITCOL . "' alt='" . _AM_PUBLISHER_EDITCOL . "' /></a>"; |
183
|
|
|
$delete = "<a href='category.php?op=del&categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETECOL . "' alt='" . _AM_PUBLISHER_DELETECOL . "' /></a>"; |
184
|
|
|
|
185
|
|
|
$spaces = ''; |
186
|
|
|
for ($j = 0; $j < $level; ++$j) { |
187
|
|
|
$spaces .= ' '; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
echo '<tr>'; |
191
|
|
|
echo "<td class='even' align='center'>" . $categoryObj->categoryid() . '</td>'; |
192
|
|
|
echo "<td class='even' align='left'>" . $spaces . "<a href='" . PUBLISHER_URL . '/category.php?categoryid=' . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/subcat.gif' alt='' /> " . $categoryObj->name() . '</a></td>'; |
193
|
|
|
echo "<td class='even' align='center'>" . $categoryObj->weight() . '</td>'; |
194
|
|
|
echo "<td class='even' align='center'> $modify $delete </td>"; |
195
|
|
|
echo '</tr>'; |
196
|
|
|
$subCategoriesObj = $publisher->getHandler('category')->getCategories(0, 0, $categoryObj->categoryid()); |
197
|
|
|
if (count($subCategoriesObj) > 0) { |
198
|
|
|
++$level; |
199
|
|
|
foreach ($subCategoriesObj as $key => $thiscat) { |
200
|
|
|
self::displayCategory($thiscat, $level); |
201
|
|
|
} |
202
|
|
|
unset($key, $thiscat); |
203
|
|
|
} |
204
|
|
|
// unset($categoryObj); |
|
|
|
|
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* @param bool $showmenu |
209
|
|
|
* @param int $categoryId |
210
|
|
|
* @param int $nbSubCats |
211
|
|
|
* @param null $categoryObj |
212
|
|
|
*/ |
213
|
|
|
public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCats = 4, $categoryObj = null) |
|
|
|
|
214
|
|
|
{ |
215
|
|
|
$publisher = PublisherPublisher::getInstance(); |
216
|
|
|
|
217
|
|
|
// if there is a parameter, and the id exists, retrieve data: we're editing a category |
218
|
|
|
if ($categoryId != 0) { |
219
|
|
|
// Creating the category object for the selected category |
220
|
|
|
$categoryObj = $publisher->getHandler('category')->get($categoryId); |
221
|
|
|
if ($categoryObj->notLoaded()) { |
222
|
|
|
redirect_header('category.php', 1, _AM_PUBLISHER_NOCOLTOEDIT); |
223
|
|
|
// exit(); |
224
|
|
|
} |
225
|
|
|
} else { |
226
|
|
|
if (!$categoryObj) { |
227
|
|
|
$categoryObj = $publisher->getHandler('category')->create(); |
228
|
|
|
} |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
if ($categoryId != 0) { |
232
|
|
|
echo "<br />\n"; |
233
|
|
|
publisherOpenCollapsableBar('edittable', 'edittableicon', _AM_PUBLISHER_EDITCOL, _AM_PUBLISHER_CATEGORY_EDIT_INFO); |
234
|
|
|
} else { |
235
|
|
|
publisherOpenCollapsableBar('createtable', 'createtableicon', _AM_PUBLISHER_CATEGORY_CREATE, _AM_PUBLISHER_CATEGORY_CREATE_INFO); |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
$sform = $categoryObj->getForm($nbSubCats); |
239
|
|
|
$sform->display(); |
240
|
|
|
|
241
|
|
|
if (!$categoryId) { |
242
|
|
|
publisherCloseCollapsableBar('createtable', 'createtableicon'); |
243
|
|
|
} else { |
244
|
|
|
publisherCloseCollapsableBar('edittable', 'edittableicon'); |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
//Added by fx2024 |
248
|
|
|
if ($categoryId) { |
249
|
|
|
$selCat = $categoryId; |
250
|
|
|
|
251
|
|
|
publisherOpenCollapsableBar('subcatstable', 'subcatsicon', _AM_PUBLISHER_SUBCAT_CAT, _AM_PUBLISHER_SUBCAT_CAT_DSC); |
252
|
|
|
// Get the total number of sub-categories |
253
|
|
|
$categoriesObj = $publisher->getHandler('category')->get($selCat); |
254
|
|
|
$totalsubs = $publisher->getHandler('category')->getCategoriesCount($selCat); |
255
|
|
|
// creating the categories objects that are published |
256
|
|
|
$subcatsObj = $publisher->getHandler('category')->getCategories(0, 0, $categoriesObj->categoryid()); |
257
|
|
|
$totalSCOnPage = count($subcatsObj); |
|
|
|
|
258
|
|
|
echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
259
|
|
|
echo '<tr>'; |
260
|
|
|
echo "<td width='60' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATID . '</strong></td>'; |
261
|
|
|
echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATCOLNAME . '</strong></td>'; |
262
|
|
|
echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_SUBDESCRIPT . '</strong></td>'; |
263
|
|
|
echo "<td width='60' class='bg3' align='right'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>'; |
264
|
|
|
echo '</tr>'; |
265
|
|
|
if ($totalsubs > 0) { |
266
|
|
|
foreach ($subcatsObj as $subcat) { |
267
|
|
|
$modify = "<a href='category.php?op=mod&categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_MODIFY . "' alt='" . _AM_PUBLISHER_MODIFY . "' /></a>"; |
|
|
|
|
268
|
|
|
$delete = "<a href='category.php?op=del&categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETE . "' alt='" . _AM_PUBLISHER_DELETE . "' /></a>"; |
|
|
|
|
269
|
|
|
echo '<tr>'; |
270
|
|
|
echo "<td class='head' align='left'>" . $subcat->categoryid() . '</td>'; |
271
|
|
|
echo "<td class='even' align='left'><a href='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . '/category.php?categoryid=' . $subcat->categoryid() . '&parentid=' . $subcat->parentid() . "'>" . $subcat->name() . '</a></td>'; |
|
|
|
|
272
|
|
|
echo "<td class='even' align='left'>" . $subcat->description() . '</td>'; |
273
|
|
|
echo "<td class='even' align='right'> {$modify} {$delete} </td>"; |
274
|
|
|
echo '</tr>'; |
275
|
|
|
} |
276
|
|
|
// unset($subcat); |
|
|
|
|
277
|
|
|
} else { |
278
|
|
|
echo '<tr>'; |
279
|
|
|
echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOSUBCAT . '</td>'; |
280
|
|
|
echo '</tr>'; |
281
|
|
|
} |
282
|
|
|
echo "</table>\n"; |
283
|
|
|
echo "<br />\n"; |
284
|
|
|
publisherCloseCollapsableBar('subcatstable', 'subcatsicon'); |
285
|
|
|
|
286
|
|
|
publisherOpenCollapsableBar('bottomtable', 'bottomtableicon', _AM_PUBLISHER_CAT_ITEMS, _AM_PUBLISHER_CAT_ITEMS_DSC); |
287
|
|
|
$startitem = XoopsRequest::getInt('startitem'); |
288
|
|
|
// Get the total number of published ITEMS |
289
|
|
|
$totalitems = $publisher->getHandler('item')->getItemsCount($selCat, array(PublisherConstants::PUBLISHER_STATUS_PUBLISHED)); |
290
|
|
|
// creating the items objects that are published |
291
|
|
|
$itemsObj = $publisher->getHandler('item')->getAllPublished($publisher->getConfig('idxcat_perpage'), $startitem, $selCat); |
292
|
|
|
$totalitemsOnPage = count($itemsObj); |
293
|
|
|
$allcats = $publisher->getHandler('category')->getObjects(null, true); |
294
|
|
|
echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
295
|
|
|
echo '<tr>'; |
296
|
|
|
echo "<td width='40' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ITEMID . '</strong></td>'; |
297
|
|
|
echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMCOLNAME . '</strong></td>'; |
298
|
|
|
echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMDESC . '</strong></td>'; |
299
|
|
|
echo "<td width='90' class='bg3' align='center'><strong>" . _AM_PUBLISHER_CREATED . '</strong></td>'; |
300
|
|
|
echo "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>'; |
301
|
|
|
echo '</tr>'; |
302
|
|
|
if ($totalitems > 0) { |
303
|
|
|
for ($i = 0; $i < $totalitemsOnPage; ++$i) { |
304
|
|
|
$categoryObj = $allcats[$itemsObj[$i]->categoryid()]; |
305
|
|
|
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITITEM . "' alt='" . _AM_PUBLISHER_EDITITEM . "' /></a>"; |
|
|
|
|
306
|
|
|
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'/></a>"; |
|
|
|
|
307
|
|
|
echo '<tr>'; |
308
|
|
|
echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . '</td>'; |
309
|
|
|
echo "<td class='even' align='left'>" . $categoryObj->name() . '</td>'; |
310
|
|
|
echo "<td class='even' align='left'>" . $itemsObj[$i]->getitemLink() . '</td>'; |
311
|
|
|
echo "<td class='even' align='center'>" . $itemsObj[$i]->getDatesub('s') . '</td>'; |
312
|
|
|
echo "<td class='even' align='center'> $modify $delete </td>"; |
313
|
|
|
echo '</tr>'; |
314
|
|
|
} |
315
|
|
|
} else { |
316
|
|
|
$itemid = -1; |
|
|
|
|
317
|
|
|
echo '<tr>'; |
318
|
|
|
echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOITEMS . '</td>'; |
319
|
|
|
echo '</tr>'; |
320
|
|
|
} |
321
|
|
|
echo "</table>\n"; |
322
|
|
|
echo "<br />\n"; |
323
|
|
|
$parentid = XoopsRequest::getInt('parentid', 0, 'GET'); |
324
|
|
|
$pagenavExtraArgs = "op=mod&categoryid=$selCat&parentid=$parentid"; |
325
|
|
|
xoops_load('XoopsPageNav'); |
326
|
|
|
$pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $startitem, 'startitem', $pagenavExtraArgs); |
327
|
|
|
echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
328
|
|
|
echo "<input type='button' name='button' onclick=\"location='item.php?op=mod&categoryid=" . $selCat . "'\" value='" . _AM_PUBLISHER_CREATEITEM . "'> "; |
329
|
|
|
echo '</div>'; |
330
|
|
|
} |
331
|
|
|
//end of fx2024 code |
332
|
|
|
} |
333
|
|
|
} |
334
|
|
|
|
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.