@@ -18,59 +18,59 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class SmartFormSelectElement extends \XoopsFormSelect |
| 20 | 20 | { |
| 21 | - public $multiple = false; |
|
| 21 | + public $multiple = false; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * SmartFormSelectElement constructor. |
|
| 25 | - * @param string $object |
|
| 26 | - * @param string $key |
|
| 27 | - */ |
|
| 28 | - public function __construct($object, $key) |
|
| 29 | - { |
|
| 30 | - $var = $object->vars[$key]; |
|
| 31 | - $size = isset($var['size']) ? $var['size'] : ($this->multiple ? 5 : 1); |
|
| 23 | + /** |
|
| 24 | + * SmartFormSelectElement constructor. |
|
| 25 | + * @param string $object |
|
| 26 | + * @param string $key |
|
| 27 | + */ |
|
| 28 | + public function __construct($object, $key) |
|
| 29 | + { |
|
| 30 | + $var = $object->vars[$key]; |
|
| 31 | + $size = isset($var['size']) ? $var['size'] : ($this->multiple ? 5 : 1); |
|
| 32 | 32 | |
| 33 | - // Adding the options inside this SelectBox |
|
| 34 | - // If the custom method is not from a module, than it's from the core |
|
| 35 | - $control = $object->getControl($key); |
|
| 33 | + // Adding the options inside this SelectBox |
|
| 34 | + // If the custom method is not from a module, than it's from the core |
|
| 35 | + $control = $object->getControl($key); |
|
| 36 | 36 | |
| 37 | - $value = isset($control['value']) ? $control['value'] : $object->getVar($key, 'e'); |
|
| 37 | + $value = isset($control['value']) ? $control['value'] : $object->getVar($key, 'e'); |
|
| 38 | 38 | |
| 39 | - parent::__construct($var['form_caption'], $key, $value, $size, $this->multiple); |
|
| 39 | + parent::__construct($var['form_caption'], $key, $value, $size, $this->multiple); |
|
| 40 | 40 | |
| 41 | - if (isset($control['options'])) { |
|
| 42 | - $this->addOptionArray($control['options']); |
|
| 43 | - } else { |
|
| 44 | - // let's find if the method we need to call comes from an already defined object |
|
| 45 | - if (isset($control['object'])) { |
|
| 46 | - if (method_exists($control['object'], $control['method'])) { |
|
| 47 | - if ($option_array = $control['object']->{$control['method']}()) { |
|
| 48 | - // Adding the options array to the XoopsFormSelect |
|
| 49 | - $this->addOptionArray($option_array); |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - } else { |
|
| 53 | - // finding the itemHandler; if none, let's take the itemHandler of the $object |
|
| 54 | - if (isset($control['itemHandler'])) { |
|
| 55 | - if (!$control['module']) { |
|
| 56 | - // Creating the specified core object handler |
|
| 57 | - $controlHandler = xoops_getHandler($control['itemHandler']); |
|
| 58 | - } else { |
|
| 59 | - $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
|
| 60 | - } |
|
| 61 | - } else { |
|
| 62 | - $controlHandler = $object->handler; |
|
| 63 | - } |
|
| 41 | + if (isset($control['options'])) { |
|
| 42 | + $this->addOptionArray($control['options']); |
|
| 43 | + } else { |
|
| 44 | + // let's find if the method we need to call comes from an already defined object |
|
| 45 | + if (isset($control['object'])) { |
|
| 46 | + if (method_exists($control['object'], $control['method'])) { |
|
| 47 | + if ($option_array = $control['object']->{$control['method']}()) { |
|
| 48 | + // Adding the options array to the XoopsFormSelect |
|
| 49 | + $this->addOptionArray($option_array); |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + } else { |
|
| 53 | + // finding the itemHandler; if none, let's take the itemHandler of the $object |
|
| 54 | + if (isset($control['itemHandler'])) { |
|
| 55 | + if (!$control['module']) { |
|
| 56 | + // Creating the specified core object handler |
|
| 57 | + $controlHandler = xoops_getHandler($control['itemHandler']); |
|
| 58 | + } else { |
|
| 59 | + $controlHandler = xoops_getModuleHandler($control['itemHandler'], $control['module']); |
|
| 60 | + } |
|
| 61 | + } else { |
|
| 62 | + $controlHandler = $object->handler; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - // Checking if the specified method exists |
|
| 66 | - if (method_exists($controlHandler, $control['method'])) { |
|
| 67 | - // TODO: How could I pass the parameters in the following call ... |
|
| 68 | - if ($option_array = $controlHandler->{$control['method']}()) { |
|
| 69 | - // Adding the options array to the XoopsFormSelect |
|
| 70 | - $this->addOptionArray($option_array); |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - } |
|
| 65 | + // Checking if the specified method exists |
|
| 66 | + if (method_exists($controlHandler, $control['method'])) { |
|
| 67 | + // TODO: How could I pass the parameters in the following call ... |
|
| 68 | + if ($option_array = $controlHandler->{$control['method']}()) { |
|
| 69 | + // Adding the options array to the XoopsFormSelect |
|
| 70 | + $this->addOptionArray($option_array); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | } |
@@ -18,31 +18,31 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class SmartFormUrlLinkElement extends \XoopsFormElementTray |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * SmartFormUrlLinkElement constructor. |
|
| 23 | - * @param string $form_caption |
|
| 24 | - * @param string $key |
|
| 25 | - * @param string $object |
|
| 26 | - */ |
|
| 27 | - public function __construct($form_caption, $key, $object) |
|
| 28 | - { |
|
| 29 | - parent::__construct($form_caption, ' '); |
|
| 30 | - |
|
| 31 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URLLINK_URL)); |
|
| 32 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 33 | - |
|
| 34 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_CAPTION)); |
|
| 35 | - $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
| 36 | - |
|
| 37 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_DESC . '<br>')); |
|
| 38 | - $this->addElement(new \XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
| 39 | - |
|
| 40 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URLLINK_TARGET)); |
|
| 41 | - $targ_val = $object->getVar('target'); |
|
| 42 | - $targetRadio = new \XoopsFormRadio('', 'target_' . $key, '' !== $targ_val ? $targ_val : '_blank'); |
|
| 43 | - $control = $object->getControl('target'); |
|
| 44 | - $targetRadio->addOptionArray($control['options']); |
|
| 45 | - |
|
| 46 | - $this->addElement($targetRadio); |
|
| 47 | - } |
|
| 21 | + /** |
|
| 22 | + * SmartFormUrlLinkElement constructor. |
|
| 23 | + * @param string $form_caption |
|
| 24 | + * @param string $key |
|
| 25 | + * @param string $object |
|
| 26 | + */ |
|
| 27 | + public function __construct($form_caption, $key, $object) |
|
| 28 | + { |
|
| 29 | + parent::__construct($form_caption, ' '); |
|
| 30 | + |
|
| 31 | + $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URLLINK_URL)); |
|
| 32 | + $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 33 | + |
|
| 34 | + $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_CAPTION)); |
|
| 35 | + $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
| 36 | + |
|
| 37 | + $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_DESC . '<br>')); |
|
| 38 | + $this->addElement(new \XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
| 39 | + |
|
| 40 | + $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URLLINK_TARGET)); |
|
| 41 | + $targ_val = $object->getVar('target'); |
|
| 42 | + $targetRadio = new \XoopsFormRadio('', 'target_' . $key, '' !== $targ_val ? $targ_val : '_blank'); |
|
| 43 | + $control = $object->getControl('target'); |
|
| 44 | + $targetRadio->addOptionArray($control['options']); |
|
| 45 | + |
|
| 46 | + $this->addElement($targetRadio); |
|
| 47 | + } |
|
| 48 | 48 | } |
@@ -28,18 +28,18 @@ |
||
| 28 | 28 | { |
| 29 | 29 | parent::__construct($form_caption, ' '); |
| 30 | 30 | |
| 31 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URLLINK_URL)); |
|
| 32 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 31 | + $this->addElement(new \XoopsFormLabel('', '<br>'._CO_SOBJECT_URLLINK_URL)); |
|
| 32 | + $this->addElement(new SmartFormTextElement($object, 'url_'.$key)); |
|
| 33 | 33 | |
| 34 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_CAPTION)); |
|
| 35 | - $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
| 34 | + $this->addElement(new \XoopsFormLabel('', '<br>'._CO_SOBJECT_CAPTION)); |
|
| 35 | + $this->addElement(new SmartFormTextElement($object, 'caption_'.$key)); |
|
| 36 | 36 | |
| 37 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_DESC . '<br>')); |
|
| 38 | - $this->addElement(new \XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
| 37 | + $this->addElement(new \XoopsFormLabel('', '<br>'._CO_SOBJECT_DESC.'<br>')); |
|
| 38 | + $this->addElement(new \XoopsFormTextArea('', 'desc_'.$key, $object->getVar('description'))); |
|
| 39 | 39 | |
| 40 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URLLINK_TARGET)); |
|
| 40 | + $this->addElement(new \XoopsFormLabel('', '<br>'._CO_SOBJECT_URLLINK_TARGET)); |
|
| 41 | 41 | $targ_val = $object->getVar('target'); |
| 42 | - $targetRadio = new \XoopsFormRadio('', 'target_' . $key, '' !== $targ_val ? $targ_val : '_blank'); |
|
| 42 | + $targetRadio = new \XoopsFormRadio('', 'target_'.$key, '' !== $targ_val ? $targ_val : '_blank'); |
|
| 43 | 43 | $control = $object->getControl('target'); |
| 44 | 44 | $targetRadio->addOptionArray($control['options']); |
| 45 | 45 | |
@@ -26,20 +26,20 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class SmartFormHidden extends \XoopsFormHidden |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @return string |
|
| 31 | - */ |
|
| 32 | - public function render() |
|
| 33 | - { |
|
| 34 | - if (is_array($this->getValue())) { |
|
| 35 | - $ret = ''; |
|
| 36 | - foreach ($this->getValue() as $value) { |
|
| 37 | - $ret .= "<input type='hidden' name='" . $this->getName() . "[]' id='" . $this->getName() . "' value='" . $value . "'>\n"; |
|
| 38 | - } |
|
| 39 | - } else { |
|
| 40 | - $ret = "<input type='hidden' name='" . $this->getName() . "' id='" . $this->getName() . "' value='" . $this->getValue() . "'>"; |
|
| 41 | - } |
|
| 29 | + /** |
|
| 30 | + * @return string |
|
| 31 | + */ |
|
| 32 | + public function render() |
|
| 33 | + { |
|
| 34 | + if (is_array($this->getValue())) { |
|
| 35 | + $ret = ''; |
|
| 36 | + foreach ($this->getValue() as $value) { |
|
| 37 | + $ret .= "<input type='hidden' name='" . $this->getName() . "[]' id='" . $this->getName() . "' value='" . $value . "'>\n"; |
|
| 38 | + } |
|
| 39 | + } else { |
|
| 40 | + $ret = "<input type='hidden' name='" . $this->getName() . "' id='" . $this->getName() . "' value='" . $this->getValue() . "'>"; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - return $ret; |
|
| 44 | - } |
|
| 43 | + return $ret; |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -32,10 +32,10 @@ |
||
| 32 | 32 | if (is_array($this->getValue())) { |
| 33 | 33 | $ret = ''; |
| 34 | 34 | foreach ($this->getValue() as $value) { |
| 35 | - $ret .= "<input type='hidden' name='" . $this->getName() . "[]' id='" . $this->getName() . "' value='" . $value . "'>\n"; |
|
| 35 | + $ret .= "<input type='hidden' name='".$this->getName()."[]' id='".$this->getName()."' value='".$value."'>\n"; |
|
| 36 | 36 | } |
| 37 | 37 | } else { |
| 38 | - $ret = "<input type='hidden' name='" . $this->getName() . "' id='" . $this->getName() . "' value='" . $this->getValue() . "'>"; |
|
| 38 | + $ret = "<input type='hidden' name='".$this->getName()."' id='".$this->getName()."' value='".$this->getValue()."'>"; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | return $ret; |
@@ -18,39 +18,39 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class SmartFormImageElement extends \XoopsFormElementTray |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * SmartFormImageElement constructor. |
|
| 23 | - * @param string $object |
|
| 24 | - * @param string $key |
|
| 25 | - */ |
|
| 26 | - public function __construct($object, $key) |
|
| 27 | - { |
|
| 28 | - $var = $object->vars[$key]; |
|
| 29 | - $object_imageurl = $object->getImageDir(); |
|
| 30 | - parent::__construct($var['form_caption'], ' '); |
|
| 31 | - |
|
| 32 | - $objectArray['image'] = str_replace('{XOOPS_URL}', XOOPS_URL, $objectArray['image']); |
|
| 33 | - |
|
| 34 | - if ('' !== $object->getVar($key) |
|
| 35 | - && (0 === strpos($object->getVar($key), 'http') |
|
| 36 | - || 0 === strpos($object->getVar($key), '{XOOPS_URL}'))) { |
|
| 37 | - $this->addElement(new \XoopsFormLabel('', "<img src='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar($key)) . "' alt=''><br><br>")); |
|
| 38 | - } elseif ('' !== $object->getVar($key)) { |
|
| 39 | - $this->addElement(new \XoopsFormLabel('', "<img src='" . $object_imageurl . $object->getVar($key) . "' alt=''><br><br>")); |
|
| 40 | - } |
|
| 21 | + /** |
|
| 22 | + * SmartFormImageElement constructor. |
|
| 23 | + * @param string $object |
|
| 24 | + * @param string $key |
|
| 25 | + */ |
|
| 26 | + public function __construct($object, $key) |
|
| 27 | + { |
|
| 28 | + $var = $object->vars[$key]; |
|
| 29 | + $object_imageurl = $object->getImageDir(); |
|
| 30 | + parent::__construct($var['form_caption'], ' '); |
|
| 31 | + |
|
| 32 | + $objectArray['image'] = str_replace('{XOOPS_URL}', XOOPS_URL, $objectArray['image']); |
|
| 33 | + |
|
| 34 | + if ('' !== $object->getVar($key) |
|
| 35 | + && (0 === strpos($object->getVar($key), 'http') |
|
| 36 | + || 0 === strpos($object->getVar($key), '{XOOPS_URL}'))) { |
|
| 37 | + $this->addElement(new \XoopsFormLabel('', "<img src='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar($key)) . "' alt=''><br><br>")); |
|
| 38 | + } elseif ('' !== $object->getVar($key)) { |
|
| 39 | + $this->addElement(new \XoopsFormLabel('', "<img src='" . $object_imageurl . $object->getVar($key) . "' alt=''><br><br>")); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | // require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php'; |
| 43 | - $this->addElement(new SmartFormFileUploadElement($object, $key)); |
|
| 43 | + $this->addElement(new SmartFormFileUploadElement($object, $key)); |
|
| 44 | 44 | |
| 45 | - $this->addElement(new \XoopsFormLabel('<div style="height: 10px; padding-top: 8px; font-size: 80%;">' . _CO_SOBJECT_URL_FILE_DSC . '</div>', '')); |
|
| 45 | + $this->addElement(new \XoopsFormLabel('<div style="height: 10px; padding-top: 8px; font-size: 80%;">' . _CO_SOBJECT_URL_FILE_DSC . '</div>', '')); |
|
| 46 | 46 | // require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformtextelement.php'; |
| 47 | 47 | // require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformcheckelement.php'; |
| 48 | 48 | |
| 49 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE)); |
|
| 50 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 51 | - $this->addElement(new \XoopsFormLabel('', '<br><br>')); |
|
| 52 | - $delete_check = new SmartFormCheckElement('', 'delete_' . $key); |
|
| 53 | - $delete_check->addOption(1, '<span style="color:red;">' . _CO_SOBJECT_DELETE . '</span>'); |
|
| 54 | - $this->addElement($delete_check); |
|
| 55 | - } |
|
| 49 | + $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE)); |
|
| 50 | + $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 51 | + $this->addElement(new \XoopsFormLabel('', '<br><br>')); |
|
| 52 | + $delete_check = new SmartFormCheckElement('', 'delete_' . $key); |
|
| 53 | + $delete_check->addOption(1, '<span style="color:red;">' . _CO_SOBJECT_DELETE . '</span>'); |
|
| 54 | + $this->addElement($delete_check); |
|
| 55 | + } |
|
| 56 | 56 | } |
@@ -34,23 +34,23 @@ |
||
| 34 | 34 | if ('' !== $object->getVar($key) |
| 35 | 35 | && (0 === strpos($object->getVar($key), 'http') |
| 36 | 36 | || 0 === strpos($object->getVar($key), '{XOOPS_URL}'))) { |
| 37 | - $this->addElement(new \XoopsFormLabel('', "<img src='" . str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar($key)) . "' alt=''><br><br>")); |
|
| 37 | + $this->addElement(new \XoopsFormLabel('', "<img src='".str_replace('{XOOPS_URL}', XOOPS_URL, $object->getVar($key))."' alt=''><br><br>")); |
|
| 38 | 38 | } elseif ('' !== $object->getVar($key)) { |
| 39 | - $this->addElement(new \XoopsFormLabel('', "<img src='" . $object_imageurl . $object->getVar($key) . "' alt=''><br><br>")); |
|
| 39 | + $this->addElement(new \XoopsFormLabel('', "<img src='".$object_imageurl.$object->getVar($key)."' alt=''><br><br>")); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformfileuploadelement.php'; |
| 43 | 43 | $this->addElement(new SmartFormFileUploadElement($object, $key)); |
| 44 | 44 | |
| 45 | - $this->addElement(new \XoopsFormLabel('<div style="height: 10px; padding-top: 8px; font-size: 80%;">' . _CO_SOBJECT_URL_FILE_DSC . '</div>', '')); |
|
| 45 | + $this->addElement(new \XoopsFormLabel('<div style="height: 10px; padding-top: 8px; font-size: 80%;">'._CO_SOBJECT_URL_FILE_DSC.'</div>', '')); |
|
| 46 | 46 | // require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformtextelement.php'; |
| 47 | 47 | // require_once SMARTOBJECT_ROOT_PATH . 'class/form/elements/smartformcheckelement.php'; |
| 48 | 48 | |
| 49 | - $this->addElement(new \XoopsFormLabel('', '<br>' . _CO_SOBJECT_URL_FILE)); |
|
| 50 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
| 49 | + $this->addElement(new \XoopsFormLabel('', '<br>'._CO_SOBJECT_URL_FILE)); |
|
| 50 | + $this->addElement(new SmartFormTextElement($object, 'url_'.$key)); |
|
| 51 | 51 | $this->addElement(new \XoopsFormLabel('', '<br><br>')); |
| 52 | - $delete_check = new SmartFormCheckElement('', 'delete_' . $key); |
|
| 53 | - $delete_check->addOption(1, '<span style="color:red;">' . _CO_SOBJECT_DELETE . '</span>'); |
|
| 52 | + $delete_check = new SmartFormCheckElement('', 'delete_'.$key); |
|
| 53 | + $delete_check->addOption(1, '<span style="color:red;">'._CO_SOBJECT_DELETE.'</span>'); |
|
| 54 | 54 | $this->addElement($delete_check); |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -18,24 +18,24 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class SmartFormTextElement extends \XoopsFormText |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * SmartFormTextElement constructor. |
|
| 23 | - * @param string $object |
|
| 24 | - * @param string $key |
|
| 25 | - */ |
|
| 26 | - public function __construct($object, $key) |
|
| 27 | - { |
|
| 28 | - $var = $object->vars[$key]; |
|
| 21 | + /** |
|
| 22 | + * SmartFormTextElement constructor. |
|
| 23 | + * @param string $object |
|
| 24 | + * @param string $key |
|
| 25 | + */ |
|
| 26 | + public function __construct($object, $key) |
|
| 27 | + { |
|
| 28 | + $var = $object->vars[$key]; |
|
| 29 | 29 | |
| 30 | - if (isset($object->controls[$key])) { |
|
| 31 | - $control = $object->controls[$key]; |
|
| 32 | - $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255); |
|
| 33 | - $form_size = isset($control['size']) ? $control['size'] : 50; |
|
| 34 | - } else { |
|
| 35 | - $form_maxlength = 255; |
|
| 36 | - $form_size = 50; |
|
| 37 | - } |
|
| 30 | + if (isset($object->controls[$key])) { |
|
| 31 | + $control = $object->controls[$key]; |
|
| 32 | + $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255); |
|
| 33 | + $form_size = isset($control['size']) ? $control['size'] : 50; |
|
| 34 | + } else { |
|
| 35 | + $form_maxlength = 255; |
|
| 36 | + $form_size = 50; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e')); |
|
| 40 | - } |
|
| 39 | + parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e')); |
|
| 40 | + } |
|
| 41 | 41 | } |
@@ -31,93 +31,93 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | class SmartobjectRatingHandler extends Smartobject\SmartPersistableObjectHandler |
| 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', '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 SmartPluginHandler(); |
|
| 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', '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 SmartPluginHandler(); |
|
| 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', '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; |
@@ -27,44 +27,44 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class SmartHookHandler |
| 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\SmartHookHandler |
|
| 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\SmartHookHandler |
|
| 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 | } |
@@ -27,57 +27,57 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class SmartPluginHandler |
| 29 | 29 | { |
| 30 | - public $pluginPatterns = false; |
|
| 30 | + public $pluginPatterns = false; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @param $dirname |
|
| 34 | - * @return bool|SmartPlugin |
|
| 35 | - */ |
|
| 36 | - public function getPlugin($dirname) |
|
| 37 | - { |
|
| 38 | - $pluginName = SMARTOBJECT_ROOT_PATH . 'plugins/' . $dirname . '.php'; |
|
| 39 | - if (file_exists($pluginName)) { |
|
| 40 | - require_once $pluginName; |
|
| 41 | - $function = 'smartobject_plugin_' . $dirname; |
|
| 42 | - if (function_exists($function)) { |
|
| 43 | - $array = $function(); |
|
| 44 | - $ret = new SmartPlugin($array); |
|
| 32 | + /** |
|
| 33 | + * @param $dirname |
|
| 34 | + * @return bool|SmartPlugin |
|
| 35 | + */ |
|
| 36 | + public function getPlugin($dirname) |
|
| 37 | + { |
|
| 38 | + $pluginName = SMARTOBJECT_ROOT_PATH . 'plugins/' . $dirname . '.php'; |
|
| 39 | + if (file_exists($pluginName)) { |
|
| 40 | + require_once $pluginName; |
|
| 41 | + $function = 'smartobject_plugin_' . $dirname; |
|
| 42 | + if (function_exists($function)) { |
|
| 43 | + $array = $function(); |
|
| 44 | + $ret = new SmartPlugin($array); |
|
| 45 | 45 | |
| 46 | - return $ret; |
|
| 47 | - } |
|
| 48 | - } |
|
| 46 | + return $ret; |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return false; |
|
| 51 | - } |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @return array |
|
| 55 | - */ |
|
| 56 | - public function getPluginsArray() |
|
| 57 | - { |
|
| 58 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 53 | + /** |
|
| 54 | + * @return array |
|
| 55 | + */ |
|
| 56 | + public function getPluginsArray() |
|
| 57 | + { |
|
| 58 | + require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 59 | 59 | |
| 60 | - $moduleHandler = xoops_getHandler('module'); |
|
| 61 | - $criteria = new \CriteriaCompo(); |
|
| 62 | - $criteria->add(new \Criteria('isactive', 1)); |
|
| 63 | - $tempModulesObj = $moduleHandler->getObjects($criteria); |
|
| 64 | - $modulesObj = []; |
|
| 65 | - foreach ($tempModulesObj as $moduleObj) { |
|
| 66 | - $modulesObj[$moduleObj->getVar('dirname')] = $moduleObj; |
|
| 67 | - } |
|
| 60 | + $moduleHandler = xoops_getHandler('module'); |
|
| 61 | + $criteria = new \CriteriaCompo(); |
|
| 62 | + $criteria->add(new \Criteria('isactive', 1)); |
|
| 63 | + $tempModulesObj = $moduleHandler->getObjects($criteria); |
|
| 64 | + $modulesObj = []; |
|
| 65 | + foreach ($tempModulesObj as $moduleObj) { |
|
| 66 | + $modulesObj[$moduleObj->getVar('dirname')] = $moduleObj; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - $aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH . 'plugins/'); |
|
| 70 | - $ret = []; |
|
| 71 | - foreach ($aFiles as $file) { |
|
| 72 | - if ('.php' === substr($file, strlen($file) - 4, 4)) { |
|
| 73 | - $pluginName = str_replace('.php', '', $file); |
|
| 74 | - $module_xoops_version_file = XOOPS_ROOT_PATH . "/modules/$pluginName/xoops_version.php"; |
|
| 75 | - if (file_exists($module_xoops_version_file) && isset($modulesObj[$pluginName])) { |
|
| 76 | - $ret[$pluginName] = $modulesObj[$pluginName]->getVar('name'); |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - } |
|
| 69 | + $aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH . 'plugins/'); |
|
| 70 | + $ret = []; |
|
| 71 | + foreach ($aFiles as $file) { |
|
| 72 | + if ('.php' === substr($file, strlen($file) - 4, 4)) { |
|
| 73 | + $pluginName = str_replace('.php', '', $file); |
|
| 74 | + $module_xoops_version_file = XOOPS_ROOT_PATH . "/modules/$pluginName/xoops_version.php"; |
|
| 75 | + if (file_exists($module_xoops_version_file) && isset($modulesObj[$pluginName])) { |
|
| 76 | + $ret[$pluginName] = $modulesObj[$pluginName]->getVar('name'); |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - return $ret; |
|
| 82 | - } |
|
| 81 | + return $ret; |
|
| 82 | + } |
|
| 83 | 83 | } |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function getPlugin($dirname) |
| 37 | 37 | { |
| 38 | - $pluginName = SMARTOBJECT_ROOT_PATH . 'plugins/' . $dirname . '.php'; |
|
| 38 | + $pluginName = SMARTOBJECT_ROOT_PATH.'plugins/'.$dirname.'.php'; |
|
| 39 | 39 | if (file_exists($pluginName)) { |
| 40 | 40 | require_once $pluginName; |
| 41 | - $function = 'smartobject_plugin_' . $dirname; |
|
| 41 | + $function = 'smartobject_plugin_'.$dirname; |
|
| 42 | 42 | if (function_exists($function)) { |
| 43 | 43 | $array = $function(); |
| 44 | 44 | $ret = new SmartPlugin($array); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function getPluginsArray() |
| 57 | 57 | { |
| 58 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 58 | + require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 59 | 59 | |
| 60 | 60 | $moduleHandler = xoops_getHandler('module'); |
| 61 | 61 | $criteria = new \CriteriaCompo(); |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | $modulesObj[$moduleObj->getVar('dirname')] = $moduleObj; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - $aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH . 'plugins/'); |
|
| 69 | + $aFiles = XoopsLists::getFileListAsArray(SMARTOBJECT_ROOT_PATH.'plugins/'); |
|
| 70 | 70 | $ret = []; |
| 71 | 71 | foreach ($aFiles as $file) { |
| 72 | 72 | if ('.php' === substr($file, strlen($file) - 4, 4)) { |
| 73 | 73 | $pluginName = str_replace('.php', '', $file); |
| 74 | - $module_xoops_version_file = XOOPS_ROOT_PATH . "/modules/$pluginName/xoops_version.php"; |
|
| 74 | + $module_xoops_version_file = XOOPS_ROOT_PATH."/modules/$pluginName/xoops_version.php"; |
|
| 75 | 75 | if (file_exists($module_xoops_version_file) && isset($modulesObj[$pluginName])) { |
| 76 | 76 | $ret[$pluginName] = $modulesObj[$pluginName]->getVar('name'); |
| 77 | 77 | } |
@@ -81,51 +81,51 @@ |
||
| 81 | 81 | */ |
| 82 | 82 | class SmartUploader 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 |