@@ -30,12 +30,12 @@ |
||
30 | 30 | */ |
31 | 31 | class UrlLinkHandler extends Smartobject\PersistableObjectHandler |
32 | 32 | { |
33 | - /** |
|
34 | - * SmartobjectUrlLinkHandler constructor. |
|
35 | - * @param \XoopsDatabase $db |
|
36 | - */ |
|
37 | - public function __construct(\XoopsDatabase $db) |
|
38 | - { |
|
39 | - parent::__construct($db, 'urllink', 'urllinkid', 'caption', 'desc', 'smartobject'); |
|
40 | - } |
|
33 | + /** |
|
34 | + * SmartobjectUrlLinkHandler constructor. |
|
35 | + * @param \XoopsDatabase $db |
|
36 | + */ |
|
37 | + public function __construct(\XoopsDatabase $db) |
|
38 | + { |
|
39 | + parent::__construct($db, 'urllink', 'urllinkid', 'caption', 'desc', 'smartobject'); |
|
40 | + } |
|
41 | 41 | } |
@@ -20,121 +20,121 @@ |
||
20 | 20 | */ |
21 | 21 | class Category extends Smartobject\SeoObject |
22 | 22 | { |
23 | - public $_categoryPath; |
|
24 | - |
|
25 | - /** |
|
26 | - * SmartobjectCategory constructor. |
|
27 | - */ |
|
28 | - public function __construct() |
|
29 | - { |
|
30 | - $this->initVar('categoryid', XOBJ_DTYPE_INT, '', true); |
|
31 | - $this->initVar('parentid', XOBJ_DTYPE_INT, '', false, null, '', false, _CO_SOBJECT_CATEGORY_PARENTID, _CO_SOBJECT_CATEGORY_PARENTID_DSC); |
|
32 | - $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_NAME, _CO_SOBJECT_CATEGORY_NAME_DSC); |
|
33 | - $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', false, null, '', false, _CO_SOBJECT_CATEGORY_DESCRIPTION, _CO_SOBJECT_CATEGORY_DESCRIPTION_DSC); |
|
34 | - $this->initVar('image', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_IMAGE, _CO_SOBJECT_CATEGORY_IMAGE_DSC); |
|
35 | - |
|
36 | - $this->initCommonVar('doxcode'); |
|
37 | - |
|
38 | - $this->setControl('image', ['name' => 'image']); |
|
39 | - $this->setControl('parentid', ['name' => 'parentcategory']); |
|
40 | - $this->setControl('description', [ |
|
41 | - 'name' => 'textarea', |
|
42 | - 'itemHandler' => false, |
|
43 | - 'method' => false, |
|
44 | - 'module' => false, |
|
45 | - 'form_editor' => 'default' |
|
46 | - ]); |
|
47 | - |
|
48 | - // call parent constructor to get SEO fields initiated |
|
49 | - parent::__construct(); |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * returns a specific variable for the object in a proper format |
|
54 | - * |
|
55 | - * @access public |
|
56 | - * @param string $key key of the object's variable to be returned |
|
57 | - * @param string $format format to use for the output |
|
58 | - * @return mixed formatted value of the variable |
|
59 | - */ |
|
60 | - public function getVar($key, $format = 's') |
|
61 | - { |
|
62 | - if ('s' === $format && in_array($key, ['description', 'image'])) { |
|
63 | - // return call_user_func(array($this, $key)); |
|
64 | - return $this->{$key}(); |
|
65 | - } |
|
66 | - |
|
67 | - return parent::getVar($key, $format); |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - public function description() |
|
74 | - { |
|
75 | - return $this->getValueFor('description', false); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * @return bool|mixed |
|
80 | - */ |
|
81 | - public function image() |
|
82 | - { |
|
83 | - $ret = $this->getVar('image', 'e'); |
|
84 | - if ('-1' == $ret) { |
|
85 | - return false; |
|
86 | - } else { |
|
87 | - return $ret; |
|
88 | - } |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * @return array |
|
93 | - */ |
|
94 | - public function toArray() |
|
95 | - { |
|
96 | - $this->setVar('doxcode', true); |
|
97 | - global $myts; |
|
98 | - $objectArray = parent::toArray(); |
|
99 | - if ($objectArray['image']) { |
|
100 | - $objectArray['image'] = $this->getImageDir() . $objectArray['image']; |
|
101 | - } |
|
102 | - |
|
103 | - return $objectArray; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * Create the complete path of a category |
|
108 | - * |
|
109 | - * @todo this could be improved as it uses multiple queries |
|
110 | - * @param bool $withAllLink make all name clickable |
|
111 | - * @param bool $currentCategory |
|
112 | - * @return string complete path (breadcrumb) |
|
113 | - */ |
|
114 | - public function getCategoryPath($withAllLink = true, $currentCategory = false) |
|
115 | - { |
|
23 | + public $_categoryPath; |
|
24 | + |
|
25 | + /** |
|
26 | + * SmartobjectCategory constructor. |
|
27 | + */ |
|
28 | + public function __construct() |
|
29 | + { |
|
30 | + $this->initVar('categoryid', XOBJ_DTYPE_INT, '', true); |
|
31 | + $this->initVar('parentid', XOBJ_DTYPE_INT, '', false, null, '', false, _CO_SOBJECT_CATEGORY_PARENTID, _CO_SOBJECT_CATEGORY_PARENTID_DSC); |
|
32 | + $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_NAME, _CO_SOBJECT_CATEGORY_NAME_DSC); |
|
33 | + $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', false, null, '', false, _CO_SOBJECT_CATEGORY_DESCRIPTION, _CO_SOBJECT_CATEGORY_DESCRIPTION_DSC); |
|
34 | + $this->initVar('image', XOBJ_DTYPE_TXTBOX, '', false, null, '', false, _CO_SOBJECT_CATEGORY_IMAGE, _CO_SOBJECT_CATEGORY_IMAGE_DSC); |
|
35 | + |
|
36 | + $this->initCommonVar('doxcode'); |
|
37 | + |
|
38 | + $this->setControl('image', ['name' => 'image']); |
|
39 | + $this->setControl('parentid', ['name' => 'parentcategory']); |
|
40 | + $this->setControl('description', [ |
|
41 | + 'name' => 'textarea', |
|
42 | + 'itemHandler' => false, |
|
43 | + 'method' => false, |
|
44 | + 'module' => false, |
|
45 | + 'form_editor' => 'default' |
|
46 | + ]); |
|
47 | + |
|
48 | + // call parent constructor to get SEO fields initiated |
|
49 | + parent::__construct(); |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * returns a specific variable for the object in a proper format |
|
54 | + * |
|
55 | + * @access public |
|
56 | + * @param string $key key of the object's variable to be returned |
|
57 | + * @param string $format format to use for the output |
|
58 | + * @return mixed formatted value of the variable |
|
59 | + */ |
|
60 | + public function getVar($key, $format = 's') |
|
61 | + { |
|
62 | + if ('s' === $format && in_array($key, ['description', 'image'])) { |
|
63 | + // return call_user_func(array($this, $key)); |
|
64 | + return $this->{$key}(); |
|
65 | + } |
|
66 | + |
|
67 | + return parent::getVar($key, $format); |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + public function description() |
|
74 | + { |
|
75 | + return $this->getValueFor('description', false); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * @return bool|mixed |
|
80 | + */ |
|
81 | + public function image() |
|
82 | + { |
|
83 | + $ret = $this->getVar('image', 'e'); |
|
84 | + if ('-1' == $ret) { |
|
85 | + return false; |
|
86 | + } else { |
|
87 | + return $ret; |
|
88 | + } |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * @return array |
|
93 | + */ |
|
94 | + public function toArray() |
|
95 | + { |
|
96 | + $this->setVar('doxcode', true); |
|
97 | + global $myts; |
|
98 | + $objectArray = parent::toArray(); |
|
99 | + if ($objectArray['image']) { |
|
100 | + $objectArray['image'] = $this->getImageDir() . $objectArray['image']; |
|
101 | + } |
|
102 | + |
|
103 | + return $objectArray; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * Create the complete path of a category |
|
108 | + * |
|
109 | + * @todo this could be improved as it uses multiple queries |
|
110 | + * @param bool $withAllLink make all name clickable |
|
111 | + * @param bool $currentCategory |
|
112 | + * @return string complete path (breadcrumb) |
|
113 | + */ |
|
114 | + public function getCategoryPath($withAllLink = true, $currentCategory = false) |
|
115 | + { |
|
116 | 116 | // require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
117 | - $controller = new ObjectController($this->handler); |
|
118 | - |
|
119 | - if (!$this->_categoryPath) { |
|
120 | - if ($withAllLink && !$currentCategory) { |
|
121 | - $ret = $controller->getItemLink($this); |
|
122 | - } else { |
|
123 | - $currentCategory = false; |
|
124 | - $ret = $this->getVar('name'); |
|
125 | - } |
|
126 | - $parentid = $this->getVar('parentid'); |
|
127 | - if (0 != $parentid) { |
|
128 | - $parentObj = $this->handler->get($parentid); |
|
129 | - if ($parentObj->isNew()) { |
|
130 | - exit; |
|
131 | - } |
|
132 | - $parentid = $parentObj->getVar('parentid'); |
|
133 | - $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . ' > ' . $ret; |
|
134 | - } |
|
135 | - $this->_categoryPath = $ret; |
|
136 | - } |
|
137 | - |
|
138 | - return $this->_categoryPath; |
|
139 | - } |
|
117 | + $controller = new ObjectController($this->handler); |
|
118 | + |
|
119 | + if (!$this->_categoryPath) { |
|
120 | + if ($withAllLink && !$currentCategory) { |
|
121 | + $ret = $controller->getItemLink($this); |
|
122 | + } else { |
|
123 | + $currentCategory = false; |
|
124 | + $ret = $this->getVar('name'); |
|
125 | + } |
|
126 | + $parentid = $this->getVar('parentid'); |
|
127 | + if (0 != $parentid) { |
|
128 | + $parentObj = $this->handler->get($parentid); |
|
129 | + if ($parentObj->isNew()) { |
|
130 | + exit; |
|
131 | + } |
|
132 | + $parentid = $parentObj->getVar('parentid'); |
|
133 | + $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . ' > ' . $ret; |
|
134 | + } |
|
135 | + $this->_categoryPath = $ret; |
|
136 | + } |
|
137 | + |
|
138 | + return $this->_categoryPath; |
|
139 | + } |
|
140 | 140 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | global $myts; |
98 | 98 | $objectArray = parent::toArray(); |
99 | 99 | if ($objectArray['image']) { |
100 | - $objectArray['image'] = $this->getImageDir() . $objectArray['image']; |
|
100 | + $objectArray['image'] = $this->getImageDir().$objectArray['image']; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | return $objectArray; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | exit; |
131 | 131 | } |
132 | 132 | $parentid = $parentObj->getVar('parentid'); |
133 | - $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . ' > ' . $ret; |
|
133 | + $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory).' > '.$ret; |
|
134 | 134 | } |
135 | 135 | $this->_categoryPath = $ret; |
136 | 136 | } |
@@ -31,66 +31,66 @@ |
||
31 | 31 | |
32 | 32 | class AddTo |
33 | 33 | { |
34 | - public $_layout; |
|
35 | - public $_method; |
|
36 | - |
|
37 | - /** |
|
38 | - * Constructor of SmartAddTo |
|
39 | - * |
|
40 | - * @param int $layout 0=Horizontal 1 row, 1=Horizontal 2 rows, 2=Vertical with icons, 3=Vertical no icons |
|
41 | - * @param int $method 0=directpage, 1=popup |
|
42 | - */ |
|
43 | - public function __construct($layout = 0, $method = 1) |
|
44 | - { |
|
45 | - $layout = (int)$layout; |
|
46 | - if ($layout < 0 || $layout > 3) { |
|
47 | - $layout = 0; |
|
48 | - } |
|
49 | - $this->_layout = $layout; |
|
50 | - |
|
51 | - $method = (int)$method; |
|
52 | - if ($method < 0 || $method > 1) { |
|
53 | - $method = 1; |
|
54 | - } |
|
55 | - $this->_method = $method; |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * @param bool $fetchOnly |
|
60 | - * @return mixed|string|void |
|
61 | - */ |
|
62 | - public function render($fetchOnly = false) |
|
63 | - { |
|
64 | - global $xoTheme, $xoopsTpl; |
|
65 | - |
|
66 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'include/addto/addto.css'); |
|
67 | - |
|
68 | - $xoopsTpl->assign('smartobject_addto_method', $this->_method); |
|
69 | - $xoopsTpl->assign('smartobject_addto_layout', $this->_layout); |
|
70 | - |
|
71 | - $xoopsTpl->assign('smartobject_addto_url', SMARTOBJECT_URL . 'include/addto/'); |
|
72 | - |
|
73 | - if ($fetchOnly) { |
|
74 | - return $xoopsTpl->fetch('db:smartobject_addto.tpl'); |
|
75 | - } else { |
|
76 | - $xoopsTpl->display('db:smartobject_addto.tpl'); |
|
77 | - } |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * @return array |
|
82 | - */ |
|
83 | - public function renderForBlock() |
|
84 | - { |
|
85 | - global $xoTheme; |
|
86 | - |
|
87 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'include/addto/addto.css'); |
|
88 | - |
|
89 | - $block = []; |
|
90 | - $block['smartobject_addto_method'] = $this->_method; |
|
91 | - $block['smartobject_addto_layout'] = $this->_layout; |
|
92 | - $block['smartobject_addto_url'] = SMARTOBJECT_URL . 'include/addto/'; |
|
93 | - |
|
94 | - return $block; |
|
95 | - } |
|
34 | + public $_layout; |
|
35 | + public $_method; |
|
36 | + |
|
37 | + /** |
|
38 | + * Constructor of SmartAddTo |
|
39 | + * |
|
40 | + * @param int $layout 0=Horizontal 1 row, 1=Horizontal 2 rows, 2=Vertical with icons, 3=Vertical no icons |
|
41 | + * @param int $method 0=directpage, 1=popup |
|
42 | + */ |
|
43 | + public function __construct($layout = 0, $method = 1) |
|
44 | + { |
|
45 | + $layout = (int)$layout; |
|
46 | + if ($layout < 0 || $layout > 3) { |
|
47 | + $layout = 0; |
|
48 | + } |
|
49 | + $this->_layout = $layout; |
|
50 | + |
|
51 | + $method = (int)$method; |
|
52 | + if ($method < 0 || $method > 1) { |
|
53 | + $method = 1; |
|
54 | + } |
|
55 | + $this->_method = $method; |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * @param bool $fetchOnly |
|
60 | + * @return mixed|string|void |
|
61 | + */ |
|
62 | + public function render($fetchOnly = false) |
|
63 | + { |
|
64 | + global $xoTheme, $xoopsTpl; |
|
65 | + |
|
66 | + $xoTheme->addStylesheet(SMARTOBJECT_URL . 'include/addto/addto.css'); |
|
67 | + |
|
68 | + $xoopsTpl->assign('smartobject_addto_method', $this->_method); |
|
69 | + $xoopsTpl->assign('smartobject_addto_layout', $this->_layout); |
|
70 | + |
|
71 | + $xoopsTpl->assign('smartobject_addto_url', SMARTOBJECT_URL . 'include/addto/'); |
|
72 | + |
|
73 | + if ($fetchOnly) { |
|
74 | + return $xoopsTpl->fetch('db:smartobject_addto.tpl'); |
|
75 | + } else { |
|
76 | + $xoopsTpl->display('db:smartobject_addto.tpl'); |
|
77 | + } |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * @return array |
|
82 | + */ |
|
83 | + public function renderForBlock() |
|
84 | + { |
|
85 | + global $xoTheme; |
|
86 | + |
|
87 | + $xoTheme->addStylesheet(SMARTOBJECT_URL . 'include/addto/addto.css'); |
|
88 | + |
|
89 | + $block = []; |
|
90 | + $block['smartobject_addto_method'] = $this->_method; |
|
91 | + $block['smartobject_addto_layout'] = $this->_layout; |
|
92 | + $block['smartobject_addto_url'] = SMARTOBJECT_URL . 'include/addto/'; |
|
93 | + |
|
94 | + return $block; |
|
95 | + } |
|
96 | 96 | } |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct($layout = 0, $method = 1) |
23 | 23 | { |
24 | - $layout = (int)$layout; |
|
24 | + $layout = (int) $layout; |
|
25 | 25 | if ($layout < 0 || $layout > 3) { |
26 | 26 | $layout = 0; |
27 | 27 | } |
28 | 28 | $this->_layout = $layout; |
29 | 29 | |
30 | - $method = (int)$method; |
|
30 | + $method = (int) $method; |
|
31 | 31 | if ($method < 0 || $method > 1) { |
32 | 32 | $method = 1; |
33 | 33 | } |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | { |
43 | 43 | global $xoTheme, $xoopsTpl; |
44 | 44 | |
45 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'include/addto/addto.css'); |
|
45 | + $xoTheme->addStylesheet(SMARTOBJECT_URL.'include/addto/addto.css'); |
|
46 | 46 | |
47 | 47 | $xoopsTpl->assign('smartobject_addto_method', $this->_method); |
48 | 48 | $xoopsTpl->assign('smartobject_addto_layout', $this->_layout); |
49 | 49 | |
50 | - $xoopsTpl->assign('smartobject_addto_url', SMARTOBJECT_URL . 'include/addto/'); |
|
50 | + $xoopsTpl->assign('smartobject_addto_url', SMARTOBJECT_URL.'include/addto/'); |
|
51 | 51 | |
52 | 52 | if ($fetchOnly) { |
53 | 53 | return $xoopsTpl->fetch('db:smartobject_addto.tpl'); |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | { |
64 | 64 | global $xoTheme; |
65 | 65 | |
66 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'include/addto/addto.css'); |
|
66 | + $xoTheme->addStylesheet(SMARTOBJECT_URL.'include/addto/addto.css'); |
|
67 | 67 | |
68 | 68 | $block = []; |
69 | 69 | $block['smartobject_addto_method'] = $this->_method; |
70 | 70 | $block['smartobject_addto_layout'] = $this->_layout; |
71 | - $block['smartobject_addto_url'] = SMARTOBJECT_URL . 'include/addto/'; |
|
71 | + $block['smartobject_addto_url'] = SMARTOBJECT_URL.'include/addto/'; |
|
72 | 72 | |
73 | 73 | return $block; |
74 | 74 | } |
@@ -22,37 +22,37 @@ |
||
22 | 22 | */ |
23 | 23 | class ObjectRow |
24 | 24 | { |
25 | - public $_keyname; |
|
26 | - public $_align; |
|
27 | - public $_customMethodForValue; |
|
28 | - public $_header; |
|
29 | - public $_class; |
|
25 | + public $_keyname; |
|
26 | + public $_align; |
|
27 | + public $_customMethodForValue; |
|
28 | + public $_header; |
|
29 | + public $_class; |
|
30 | 30 | |
31 | - /** |
|
32 | - * SmartObjectRow constructor. |
|
33 | - * @param $keyname |
|
34 | - * @param bool $customMethodForValue |
|
35 | - * @param bool $header |
|
36 | - * @param bool $class |
|
37 | - */ |
|
38 | - public function __construct($keyname, $customMethodForValue = false, $header = false, $class = false) |
|
39 | - { |
|
40 | - $this->_keyname = $keyname; |
|
41 | - $this->_customMethodForValue = $customMethodForValue; |
|
42 | - $this->_header = $header; |
|
43 | - $this->_class = $class; |
|
44 | - } |
|
31 | + /** |
|
32 | + * SmartObjectRow constructor. |
|
33 | + * @param $keyname |
|
34 | + * @param bool $customMethodForValue |
|
35 | + * @param bool $header |
|
36 | + * @param bool $class |
|
37 | + */ |
|
38 | + public function __construct($keyname, $customMethodForValue = false, $header = false, $class = false) |
|
39 | + { |
|
40 | + $this->_keyname = $keyname; |
|
41 | + $this->_customMethodForValue = $customMethodForValue; |
|
42 | + $this->_header = $header; |
|
43 | + $this->_class = $class; |
|
44 | + } |
|
45 | 45 | |
46 | - public function getKeyName() |
|
47 | - { |
|
48 | - return $this->_keyname; |
|
49 | - } |
|
46 | + public function getKeyName() |
|
47 | + { |
|
48 | + return $this->_keyname; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @return bool |
|
53 | - */ |
|
54 | - public function isHeader() |
|
55 | - { |
|
56 | - return $this->_header; |
|
57 | - } |
|
51 | + /** |
|
52 | + * @return bool |
|
53 | + */ |
|
54 | + public function isHeader() |
|
55 | + { |
|
56 | + return $this->_header; |
|
57 | + } |
|
58 | 58 | } |
@@ -31,93 +31,93 @@ |
||
31 | 31 | */ |
32 | 32 | class RatingHandler extends Smartobject\PersistableObjectHandler |
33 | 33 | { |
34 | - public $_rateOptions = []; |
|
35 | - public $_moduleList = false; |
|
36 | - public $pluginsObject; |
|
37 | - |
|
38 | - /** |
|
39 | - * SmartobjectRatingHandler constructor. |
|
40 | - * @param \XoopsDatabase $db |
|
41 | - */ |
|
42 | - public function __construct(\XoopsDatabase $db) |
|
43 | - { |
|
44 | - parent::__construct($db, Rating::class, 'ratingid', 'rate', '', 'smartobject'); |
|
45 | - $this->generalSQL = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->db->prefix('users') . ' AS user ON ' . $this->_itemname . '.uid=user.uid'; |
|
46 | - |
|
47 | - $this->_rateOptions[1] = 1; |
|
48 | - $this->_rateOptions[2] = 2; |
|
49 | - $this->_rateOptions[3] = 3; |
|
50 | - $this->_rateOptions[4] = 4; |
|
51 | - $this->_rateOptions[5] = 5; |
|
52 | - |
|
53 | - $this->pluginsObject = new PluginHandler(); |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * @return bool |
|
58 | - */ |
|
59 | - public function getModuleList() |
|
60 | - { |
|
61 | - if (!$this->_moduleList) { |
|
62 | - $moduleArray = $this->pluginsObject->getPluginsArray(); |
|
63 | - $this->_moduleList[0] = _CO_SOBJECT_MAKE_SELECTION; |
|
64 | - foreach ($moduleArray as $k => $v) { |
|
65 | - $this->_moduleList[$k] = $v; |
|
66 | - } |
|
67 | - } |
|
68 | - |
|
69 | - return $this->_moduleList; |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * @return array |
|
74 | - */ |
|
75 | - public function getRateList() |
|
76 | - { |
|
77 | - return $this->_rateOptions; |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * @param $itemid |
|
82 | - * @param $dirname |
|
83 | - * @param $item |
|
84 | - * @return int |
|
85 | - */ |
|
86 | - public function getRatingAverageByItemId($itemid, $dirname, $item) |
|
87 | - { |
|
88 | - $sql = 'SELECT AVG(rate), COUNT(ratingid) FROM ' . $this->table . " WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid"; |
|
89 | - $result = $this->db->query($sql); |
|
90 | - if (!$result) { |
|
91 | - return 0; |
|
92 | - } |
|
93 | - list($average, $sum) = $this->db->fetchRow($result); |
|
94 | - $ret['average'] = isset($average) ? $average : 0; |
|
95 | - $ret['sum'] = isset($sum) ? $sum : 0; |
|
96 | - |
|
97 | - return $ret; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * @param $item |
|
102 | - * @param $itemid |
|
103 | - * @param $dirname |
|
104 | - * @param $uid |
|
105 | - * @return bool |
|
106 | - */ |
|
107 | - public function already_rated($item, $itemid, $dirname, $uid) |
|
108 | - { |
|
109 | - $criteria = new \CriteriaCompo(); |
|
110 | - $criteria->add(new \Criteria('item', $item)); |
|
111 | - $criteria->add(new \Criteria('itemid', $itemid)); |
|
112 | - $criteria->add(new \Criteria('dirname', $dirname)); |
|
113 | - $criteria->add(new \Criteria('user.uid', $uid)); |
|
114 | - |
|
115 | - $ret =& $this->getObjects($criteria); |
|
116 | - |
|
117 | - if (!$ret) { |
|
118 | - return false; |
|
119 | - } else { |
|
120 | - return $ret[0]; |
|
121 | - } |
|
122 | - } |
|
34 | + public $_rateOptions = []; |
|
35 | + public $_moduleList = false; |
|
36 | + public $pluginsObject; |
|
37 | + |
|
38 | + /** |
|
39 | + * SmartobjectRatingHandler constructor. |
|
40 | + * @param \XoopsDatabase $db |
|
41 | + */ |
|
42 | + public function __construct(\XoopsDatabase $db) |
|
43 | + { |
|
44 | + parent::__construct($db, Rating::class, 'ratingid', 'rate', '', 'smartobject'); |
|
45 | + $this->generalSQL = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->db->prefix('users') . ' AS user ON ' . $this->_itemname . '.uid=user.uid'; |
|
46 | + |
|
47 | + $this->_rateOptions[1] = 1; |
|
48 | + $this->_rateOptions[2] = 2; |
|
49 | + $this->_rateOptions[3] = 3; |
|
50 | + $this->_rateOptions[4] = 4; |
|
51 | + $this->_rateOptions[5] = 5; |
|
52 | + |
|
53 | + $this->pluginsObject = new PluginHandler(); |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * @return bool |
|
58 | + */ |
|
59 | + public function getModuleList() |
|
60 | + { |
|
61 | + if (!$this->_moduleList) { |
|
62 | + $moduleArray = $this->pluginsObject->getPluginsArray(); |
|
63 | + $this->_moduleList[0] = _CO_SOBJECT_MAKE_SELECTION; |
|
64 | + foreach ($moduleArray as $k => $v) { |
|
65 | + $this->_moduleList[$k] = $v; |
|
66 | + } |
|
67 | + } |
|
68 | + |
|
69 | + return $this->_moduleList; |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * @return array |
|
74 | + */ |
|
75 | + public function getRateList() |
|
76 | + { |
|
77 | + return $this->_rateOptions; |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * @param $itemid |
|
82 | + * @param $dirname |
|
83 | + * @param $item |
|
84 | + * @return int |
|
85 | + */ |
|
86 | + public function getRatingAverageByItemId($itemid, $dirname, $item) |
|
87 | + { |
|
88 | + $sql = 'SELECT AVG(rate), COUNT(ratingid) FROM ' . $this->table . " WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid"; |
|
89 | + $result = $this->db->query($sql); |
|
90 | + if (!$result) { |
|
91 | + return 0; |
|
92 | + } |
|
93 | + list($average, $sum) = $this->db->fetchRow($result); |
|
94 | + $ret['average'] = isset($average) ? $average : 0; |
|
95 | + $ret['sum'] = isset($sum) ? $sum : 0; |
|
96 | + |
|
97 | + return $ret; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * @param $item |
|
102 | + * @param $itemid |
|
103 | + * @param $dirname |
|
104 | + * @param $uid |
|
105 | + * @return bool |
|
106 | + */ |
|
107 | + public function already_rated($item, $itemid, $dirname, $uid) |
|
108 | + { |
|
109 | + $criteria = new \CriteriaCompo(); |
|
110 | + $criteria->add(new \Criteria('item', $item)); |
|
111 | + $criteria->add(new \Criteria('itemid', $itemid)); |
|
112 | + $criteria->add(new \Criteria('dirname', $dirname)); |
|
113 | + $criteria->add(new \Criteria('user.uid', $uid)); |
|
114 | + |
|
115 | + $ret =& $this->getObjects($criteria); |
|
116 | + |
|
117 | + if (!$ret) { |
|
118 | + return false; |
|
119 | + } else { |
|
120 | + return $ret[0]; |
|
121 | + } |
|
122 | + } |
|
123 | 123 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function __construct(\XoopsDatabase $db) |
43 | 43 | { |
44 | 44 | parent::__construct($db, Rating::class, 'ratingid', 'rate', '', 'smartobject'); |
45 | - $this->generalSQL = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->db->prefix('users') . ' AS user ON ' . $this->_itemname . '.uid=user.uid'; |
|
45 | + $this->generalSQL = 'SELECT * FROM '.$this->table.' AS '.$this->_itemname.' INNER JOIN '.$this->db->prefix('users').' AS user ON '.$this->_itemname.'.uid=user.uid'; |
|
46 | 46 | |
47 | 47 | $this->_rateOptions[1] = 1; |
48 | 48 | $this->_rateOptions[2] = 2; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function getRatingAverageByItemId($itemid, $dirname, $item) |
87 | 87 | { |
88 | - $sql = 'SELECT AVG(rate), COUNT(ratingid) FROM ' . $this->table . " WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid"; |
|
88 | + $sql = 'SELECT AVG(rate), COUNT(ratingid) FROM '.$this->table." WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid"; |
|
89 | 89 | $result = $this->db->query($sql); |
90 | 90 | if (!$result) { |
91 | 91 | return 0; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $criteria->add(new \Criteria('dirname', $dirname)); |
113 | 113 | $criteria->add(new \Criteria('user.uid', $uid)); |
114 | 114 | |
115 | - $ret =& $this->getObjects($criteria); |
|
115 | + $ret = & $this->getObjects($criteria); |
|
116 | 116 | |
117 | 117 | if (!$ret) { |
118 | 118 | return false; |
@@ -25,66 +25,66 @@ |
||
25 | 25 | */ |
26 | 26 | class Plugin |
27 | 27 | { |
28 | - public $_infoArray; |
|
28 | + public $_infoArray; |
|
29 | 29 | |
30 | - /** |
|
31 | - * SmartPlugin constructor. |
|
32 | - * @param $array |
|
33 | - */ |
|
34 | - public function __construct($array) |
|
35 | - { |
|
36 | - $this->_infoArray = $array; |
|
37 | - } |
|
30 | + /** |
|
31 | + * SmartPlugin constructor. |
|
32 | + * @param $array |
|
33 | + */ |
|
34 | + public function __construct($array) |
|
35 | + { |
|
36 | + $this->_infoArray = $array; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param $item |
|
41 | - * @return bool |
|
42 | - */ |
|
43 | - public function getItemInfo($item) |
|
44 | - { |
|
45 | - if (isset($this->_infoArray['items'][$item])) { |
|
46 | - return $this->_infoArray['items'][$item]; |
|
47 | - } else { |
|
48 | - return false; |
|
49 | - } |
|
50 | - } |
|
39 | + /** |
|
40 | + * @param $item |
|
41 | + * @return bool |
|
42 | + */ |
|
43 | + public function getItemInfo($item) |
|
44 | + { |
|
45 | + if (isset($this->_infoArray['items'][$item])) { |
|
46 | + return $this->_infoArray['items'][$item]; |
|
47 | + } else { |
|
48 | + return false; |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @return mixed |
|
54 | - */ |
|
55 | - public function getItemList() |
|
56 | - { |
|
57 | - $itemsArray = $this->_infoArray['items']; |
|
58 | - foreach ($itemsArray as $k => $v) { |
|
59 | - $ret[$k] = $v['caption']; |
|
60 | - } |
|
52 | + /** |
|
53 | + * @return mixed |
|
54 | + */ |
|
55 | + public function getItemList() |
|
56 | + { |
|
57 | + $itemsArray = $this->_infoArray['items']; |
|
58 | + foreach ($itemsArray as $k => $v) { |
|
59 | + $ret[$k] = $v['caption']; |
|
60 | + } |
|
61 | 61 | |
62 | - return $ret; |
|
63 | - } |
|
62 | + return $ret; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return bool|int|string |
|
67 | - */ |
|
68 | - public function getItem() |
|
69 | - { |
|
70 | - $ret = false; |
|
71 | - foreach ($this->_infoArray['items'] as $k => $v) { |
|
72 | - $search_str = str_replace('%u', '', $v['url']); |
|
73 | - if (strpos($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'], $search_str) > 0) { |
|
74 | - $ret = $k; |
|
75 | - break; |
|
76 | - } |
|
77 | - } |
|
65 | + /** |
|
66 | + * @return bool|int|string |
|
67 | + */ |
|
68 | + public function getItem() |
|
69 | + { |
|
70 | + $ret = false; |
|
71 | + foreach ($this->_infoArray['items'] as $k => $v) { |
|
72 | + $search_str = str_replace('%u', '', $v['url']); |
|
73 | + if (strpos($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'], $search_str) > 0) { |
|
74 | + $ret = $k; |
|
75 | + break; |
|
76 | + } |
|
77 | + } |
|
78 | 78 | |
79 | - return $ret; |
|
80 | - } |
|
79 | + return $ret; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @param $item |
|
84 | - * @return mixed |
|
85 | - */ |
|
86 | - public function getItemIdForItem($item) |
|
87 | - { |
|
88 | - return $_REQUEST[$this->_infoArray['items'][$item]['request']]; |
|
89 | - } |
|
82 | + /** |
|
83 | + * @param $item |
|
84 | + * @return mixed |
|
85 | + */ |
|
86 | + public function getItemIdForItem($item) |
|
87 | + { |
|
88 | + return $_REQUEST[$this->_infoArray['items'][$item]['request']]; |
|
89 | + } |
|
90 | 90 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $ret = false; |
71 | 71 | foreach ($this->_infoArray['items'] as $k => $v) { |
72 | 72 | $search_str = str_replace('%u', '', $v['url']); |
73 | - if (strpos($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'], $search_str) > 0) { |
|
73 | + if (strpos($_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'], $search_str) > 0) { |
|
74 | 74 | $ret = $k; |
75 | 75 | break; |
76 | 76 | } |
@@ -26,80 +26,80 @@ |
||
26 | 26 | */ |
27 | 27 | class MlObject extends Smartobject\BaseSmartObject |
28 | 28 | { |
29 | - /** |
|
30 | - * SmartMlObject constructor. |
|
31 | - */ |
|
32 | - public function __construct() |
|
33 | - { |
|
34 | - $this->initVar('language', XOBJ_DTYPE_TXTBOX, 'english', false, null, '', true, _CO_SOBJECT_LANGUAGE_CAPTION, _CO_SOBJECT_LANGUAGE_DSC, true, true); |
|
35 | - $this->setControl('language', 'language'); |
|
36 | - } |
|
29 | + /** |
|
30 | + * SmartMlObject constructor. |
|
31 | + */ |
|
32 | + public function __construct() |
|
33 | + { |
|
34 | + $this->initVar('language', XOBJ_DTYPE_TXTBOX, 'english', false, null, '', true, _CO_SOBJECT_LANGUAGE_CAPTION, _CO_SOBJECT_LANGUAGE_DSC, true, true); |
|
35 | + $this->setControl('language', 'language'); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * If object is not new, change the control of the not-multilanguage fields |
|
40 | - * |
|
41 | - * We need to intercept this function from SmartObject because if the object is not new... |
|
42 | - */ |
|
43 | - // function getForm() { |
|
38 | + /** |
|
39 | + * If object is not new, change the control of the not-multilanguage fields |
|
40 | + * |
|
41 | + * We need to intercept this function from SmartObject because if the object is not new... |
|
42 | + */ |
|
43 | + // function getForm() { |
|
44 | 44 | |
45 | - //} |
|
45 | + //} |
|
46 | 46 | |
47 | - /** |
|
48 | - * Strip Multilanguage Fields |
|
49 | - * |
|
50 | - * Get rid of all the multilanguage fields to have an object with only global fields. |
|
51 | - * This will be usefull when creating the ML object for the first time. Then we will be able |
|
52 | - * to create translations. |
|
53 | - */ |
|
54 | - public function stripMultilanguageFields() |
|
55 | - { |
|
56 | - $objectVars =& $this->getVars(); |
|
57 | - $newObjectVars = []; |
|
58 | - foreach ($objectVars as $key => $var) { |
|
59 | - if (!$var['multilingual']) { |
|
60 | - $newObjectVars[$key] = $var; |
|
61 | - } |
|
62 | - } |
|
63 | - $this->vars = $newObjectVars; |
|
64 | - } |
|
47 | + /** |
|
48 | + * Strip Multilanguage Fields |
|
49 | + * |
|
50 | + * Get rid of all the multilanguage fields to have an object with only global fields. |
|
51 | + * This will be usefull when creating the ML object for the first time. Then we will be able |
|
52 | + * to create translations. |
|
53 | + */ |
|
54 | + public function stripMultilanguageFields() |
|
55 | + { |
|
56 | + $objectVars =& $this->getVars(); |
|
57 | + $newObjectVars = []; |
|
58 | + foreach ($objectVars as $key => $var) { |
|
59 | + if (!$var['multilingual']) { |
|
60 | + $newObjectVars[$key] = $var; |
|
61 | + } |
|
62 | + } |
|
63 | + $this->vars = $newObjectVars; |
|
64 | + } |
|
65 | 65 | |
66 | - public function stripNonMultilanguageFields() |
|
67 | - { |
|
68 | - $objectVars =& $this->getVars(); |
|
69 | - $newObjectVars = []; |
|
70 | - foreach ($objectVars as $key => $var) { |
|
71 | - if ($var['multilingual'] || $key == $this->handler->keyName) { |
|
72 | - $newObjectVars[$key] = $var; |
|
73 | - } |
|
74 | - } |
|
75 | - $this->vars = $newObjectVars; |
|
76 | - } |
|
66 | + public function stripNonMultilanguageFields() |
|
67 | + { |
|
68 | + $objectVars =& $this->getVars(); |
|
69 | + $newObjectVars = []; |
|
70 | + foreach ($objectVars as $key => $var) { |
|
71 | + if ($var['multilingual'] || $key == $this->handler->keyName) { |
|
72 | + $newObjectVars[$key] = $var; |
|
73 | + } |
|
74 | + } |
|
75 | + $this->vars = $newObjectVars; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Make non multilanguage fields read only |
|
80 | - * |
|
81 | - * This is used when we are creating/editing a translation. |
|
82 | - * We only want to edit the multilanguag fields, not the global one. |
|
83 | - */ |
|
84 | - public function makeNonMLFieldReadOnly() |
|
85 | - { |
|
86 | - foreach ($this->getVars() as $key => $var) { |
|
87 | - //if (($key == 'language') || (!$var['multilingual'] && $key <> $this->handler->keyName)) { |
|
88 | - if (!$var['multilingual'] && $key != $this->handler->keyName) { |
|
89 | - $this->setControl($key, 'label'); |
|
90 | - } |
|
91 | - } |
|
92 | - } |
|
78 | + /** |
|
79 | + * Make non multilanguage fields read only |
|
80 | + * |
|
81 | + * This is used when we are creating/editing a translation. |
|
82 | + * We only want to edit the multilanguag fields, not the global one. |
|
83 | + */ |
|
84 | + public function makeNonMLFieldReadOnly() |
|
85 | + { |
|
86 | + foreach ($this->getVars() as $key => $var) { |
|
87 | + //if (($key == 'language') || (!$var['multilingual'] && $key <> $this->handler->keyName)) { |
|
88 | + if (!$var['multilingual'] && $key != $this->handler->keyName) { |
|
89 | + $this->setControl($key, 'label'); |
|
90 | + } |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * @param bool $onlyUrl |
|
96 | - * @param bool $withimage |
|
97 | - * @return string |
|
98 | - */ |
|
99 | - public function getEditLanguageLink($onlyUrl = false, $withimage = true) |
|
100 | - { |
|
101 | - $controller = new ObjectController($this->handler); |
|
94 | + /** |
|
95 | + * @param bool $onlyUrl |
|
96 | + * @param bool $withimage |
|
97 | + * @return string |
|
98 | + */ |
|
99 | + public function getEditLanguageLink($onlyUrl = false, $withimage = true) |
|
100 | + { |
|
101 | + $controller = new ObjectController($this->handler); |
|
102 | 102 | |
103 | - return $controller->getEditLanguageLink($this, $onlyUrl, $withimage); |
|
104 | - } |
|
103 | + return $controller->getEditLanguageLink($this, $onlyUrl, $withimage); |
|
104 | + } |
|
105 | 105 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function stripMultilanguageFields() |
55 | 55 | { |
56 | - $objectVars =& $this->getVars(); |
|
56 | + $objectVars = & $this->getVars(); |
|
57 | 57 | $newObjectVars = []; |
58 | 58 | foreach ($objectVars as $key => $var) { |
59 | 59 | if (!$var['multilingual']) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | public function stripNonMultilanguageFields() |
67 | 67 | { |
68 | - $objectVars =& $this->getVars(); |
|
68 | + $objectVars = & $this->getVars(); |
|
69 | 69 | $newObjectVars = []; |
70 | 70 | foreach ($objectVars as $key => $var) { |
71 | 71 | if ($var['multilingual'] || $key == $this->handler->keyName) { |
@@ -81,51 +81,51 @@ |
||
81 | 81 | */ |
82 | 82 | class Uploader extends \XoopsMediaUploader |
83 | 83 | { |
84 | - public $ext; |
|
85 | - public $dimension; |
|
84 | + public $ext; |
|
85 | + public $dimension; |
|
86 | 86 | |
87 | - /** |
|
88 | - * No admin check for uploads |
|
89 | - */ |
|
90 | - public $noAdminSizeCheck; |
|
87 | + /** |
|
88 | + * No admin check for uploads |
|
89 | + */ |
|
90 | + public $noAdminSizeCheck; |
|
91 | 91 | |
92 | - /** |
|
93 | - * Constructor |
|
94 | - * |
|
95 | - * @param string $uploadDir |
|
96 | - * @param array|int $allowedMimeTypes |
|
97 | - * @param int $maxFileSize |
|
98 | - * @param int $maxWidth |
|
99 | - * @param int $maxHeight |
|
100 | - * @internal param int $cmodvalue |
|
101 | - */ |
|
102 | - public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize, $maxWidth = 0, $maxHeight = 0) |
|
103 | - { |
|
104 | - parent::__construct($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight); |
|
105 | - } |
|
92 | + /** |
|
93 | + * Constructor |
|
94 | + * |
|
95 | + * @param string $uploadDir |
|
96 | + * @param array|int $allowedMimeTypes |
|
97 | + * @param int $maxFileSize |
|
98 | + * @param int $maxWidth |
|
99 | + * @param int $maxHeight |
|
100 | + * @internal param int $cmodvalue |
|
101 | + */ |
|
102 | + public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize, $maxWidth = 0, $maxHeight = 0) |
|
103 | + { |
|
104 | + parent::__construct($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight); |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * @param $value |
|
109 | - */ |
|
110 | - public function noAdminSizeCheck($value) |
|
111 | - { |
|
112 | - $this->noAdminSizeCheck = $value; |
|
113 | - } |
|
107 | + /** |
|
108 | + * @param $value |
|
109 | + */ |
|
110 | + public function noAdminSizeCheck($value) |
|
111 | + { |
|
112 | + $this->noAdminSizeCheck = $value; |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * Is the file the right size? |
|
117 | - * |
|
118 | - * @return bool |
|
119 | - */ |
|
120 | - public function checkMaxFileSize() |
|
121 | - { |
|
122 | - if ($this->noAdminSizeCheck) { |
|
123 | - return true; |
|
124 | - } |
|
125 | - if ($this->mediaSize > $this->maxFileSize) { |
|
126 | - return false; |
|
127 | - } |
|
115 | + /** |
|
116 | + * Is the file the right size? |
|
117 | + * |
|
118 | + * @return bool |
|
119 | + */ |
|
120 | + public function checkMaxFileSize() |
|
121 | + { |
|
122 | + if ($this->noAdminSizeCheck) { |
|
123 | + return true; |
|
124 | + } |
|
125 | + if ($this->mediaSize > $this->maxFileSize) { |
|
126 | + return false; |
|
127 | + } |
|
128 | 128 | |
129 | - return true; |
|
130 | - } |
|
129 | + return true; |
|
130 | + } |
|
131 | 131 | } |
@@ -69,9 +69,9 @@ |
||
69 | 69 | * @link http://smartfactory.ca The SmartFactory |
70 | 70 | * @package SmartObject |
71 | 71 | */ |
72 | -mt_srand((double)microtime() * 1000000); |
|
72 | +mt_srand((double) microtime() * 1000000); |
|
73 | 73 | |
74 | -require_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
74 | +require_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Class SmartUploader |
@@ -27,44 +27,44 @@ |
||
27 | 27 | */ |
28 | 28 | class HookHandler |
29 | 29 | { |
30 | - /** |
|
31 | - * SmartHookHandler constructor. |
|
32 | - */ |
|
33 | - public function __construct() |
|
34 | - { |
|
35 | - } |
|
30 | + /** |
|
31 | + * SmartHookHandler constructor. |
|
32 | + */ |
|
33 | + public function __construct() |
|
34 | + { |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Access the only instance of this class |
|
39 | - * |
|
40 | - * @return \XoopsModules\Smartobject\HookHandler |
|
41 | - * |
|
42 | - * @static |
|
43 | - * @staticvar object |
|
44 | - */ |
|
45 | - public static function getInstance() |
|
46 | - { |
|
47 | - static $instance; |
|
48 | - if (null === $instance) { |
|
49 | - $instance = new static(); |
|
50 | - } |
|
37 | + /** |
|
38 | + * Access the only instance of this class |
|
39 | + * |
|
40 | + * @return \XoopsModules\Smartobject\HookHandler |
|
41 | + * |
|
42 | + * @static |
|
43 | + * @staticvar object |
|
44 | + */ |
|
45 | + public static function getInstance() |
|
46 | + { |
|
47 | + static $instance; |
|
48 | + if (null === $instance) { |
|
49 | + $instance = new static(); |
|
50 | + } |
|
51 | 51 | |
52 | - return $instance; |
|
53 | - } |
|
52 | + return $instance; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @param $hook_name |
|
57 | - */ |
|
58 | - public function executeHook($hook_name) |
|
59 | - { |
|
60 | - $lower_hook_name = strtolower($hook_name); |
|
61 | - $filename = SMARTOBJECT_ROOT_PATH . 'include/custom_code/' . $lower_hook_name . '.php'; |
|
62 | - if (file_exists($filename)) { |
|
63 | - require_once $filename; |
|
64 | - $function = 'smarthook_' . $lower_hook_name; |
|
65 | - if (function_exists($function)) { |
|
66 | - $function(); |
|
67 | - } |
|
68 | - } |
|
69 | - } |
|
55 | + /** |
|
56 | + * @param $hook_name |
|
57 | + */ |
|
58 | + public function executeHook($hook_name) |
|
59 | + { |
|
60 | + $lower_hook_name = strtolower($hook_name); |
|
61 | + $filename = SMARTOBJECT_ROOT_PATH . 'include/custom_code/' . $lower_hook_name . '.php'; |
|
62 | + if (file_exists($filename)) { |
|
63 | + require_once $filename; |
|
64 | + $function = 'smarthook_' . $lower_hook_name; |
|
65 | + if (function_exists($function)) { |
|
66 | + $function(); |
|
67 | + } |
|
68 | + } |
|
69 | + } |
|
70 | 70 | } |
@@ -37,10 +37,10 @@ |
||
37 | 37 | public function executeHook($hook_name) |
38 | 38 | { |
39 | 39 | $lower_hook_name = strtolower($hook_name); |
40 | - $filename = SMARTOBJECT_ROOT_PATH . 'include/custom_code/' . $lower_hook_name . '.php'; |
|
40 | + $filename = SMARTOBJECT_ROOT_PATH.'include/custom_code/'.$lower_hook_name.'.php'; |
|
41 | 41 | if (file_exists($filename)) { |
42 | 42 | require_once $filename; |
43 | - $function = 'smarthook_' . $lower_hook_name; |
|
43 | + $function = 'smarthook_'.$lower_hook_name; |
|
44 | 44 | if (function_exists($function)) { |
45 | 45 | $function(); |
46 | 46 | } |