@@ -9,17 +9,17 @@ |
||
9 | 9 | */ |
10 | 10 | class SmartObjectTree extends XoopsObjectTree |
11 | 11 | { |
12 | - public function _initialize() |
|
13 | - { |
|
14 | - foreach (array_keys($this->_objects) as $i) { |
|
15 | - $key1 = $this->_objects[$i]->getVar($this->_myId); |
|
16 | - $this->_tree[$key1]['obj'] = $this->_objects[$i]; |
|
17 | - $key2 = $this->_objects[$i]->getVar($this->_parentId, 'e'); |
|
18 | - $this->_tree[$key1]['parent'] = $key2; |
|
19 | - $this->_tree[$key2]['child'][] = $key1; |
|
20 | - if (isset($this->_rootId)) { |
|
21 | - $this->_tree[$key1]['root'] = $this->_objects[$i]->getVar($this->_rootId); |
|
22 | - } |
|
23 | - } |
|
24 | - } |
|
12 | + public function _initialize() |
|
13 | + { |
|
14 | + foreach (array_keys($this->_objects) as $i) { |
|
15 | + $key1 = $this->_objects[$i]->getVar($this->_myId); |
|
16 | + $this->_tree[$key1]['obj'] = $this->_objects[$i]; |
|
17 | + $key2 = $this->_objects[$i]->getVar($this->_parentId, 'e'); |
|
18 | + $this->_tree[$key1]['parent'] = $key2; |
|
19 | + $this->_tree[$key2]['child'][] = $key1; |
|
20 | + if (isset($this->_rootId)) { |
|
21 | + $this->_tree[$key1]['root'] = $this->_objects[$i]->getVar($this->_rootId); |
|
22 | + } |
|
23 | + } |
|
24 | + } |
|
25 | 25 | } |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file contains the keyhighlighter class that highlight the chosen keyword in the current output buffer. |
|
4 | - * |
|
5 | - * @package keyhighlighter |
|
6 | - */ |
|
3 | + * This file contains the keyhighlighter class that highlight the chosen keyword in the current output buffer. |
|
4 | + * |
|
5 | + * @package keyhighlighter |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * keyhighlighter class |
@@ -19,96 +19,96 @@ discard block |
||
19 | 19 | */ |
20 | 20 | class SmartHighlighter |
21 | 21 | { |
22 | - /** |
|
23 | - * @access private |
|
24 | - */ |
|
25 | - public $preg_keywords = ''; |
|
26 | - /** |
|
27 | - * @access private |
|
28 | - */ |
|
29 | - public $keywords = ''; |
|
30 | - /** |
|
31 | - * @access private |
|
32 | - */ |
|
33 | - public $singlewords = false; |
|
34 | - /** |
|
35 | - * @access private |
|
36 | - */ |
|
37 | - public $replace_callback = null; |
|
22 | + /** |
|
23 | + * @access private |
|
24 | + */ |
|
25 | + public $preg_keywords = ''; |
|
26 | + /** |
|
27 | + * @access private |
|
28 | + */ |
|
29 | + public $keywords = ''; |
|
30 | + /** |
|
31 | + * @access private |
|
32 | + */ |
|
33 | + public $singlewords = false; |
|
34 | + /** |
|
35 | + * @access private |
|
36 | + */ |
|
37 | + public $replace_callback = null; |
|
38 | 38 | |
39 | - public $content; |
|
39 | + public $content; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Main constructor |
|
43 | - * |
|
44 | - * This is the main constructor of keyhighlighter class. <br /> |
|
45 | - * It's the only public method of the class. |
|
46 | - * @param string $keywords the keywords you want to highlight |
|
47 | - * @param boolean $singlewords specify if it has to highlight also the single words. |
|
48 | - * @param callback $replace_callback a custom callback for keyword highlight. |
|
49 | - * <code> |
|
50 | - * <?php |
|
51 | - * require ('keyhighlighter.class.php'); |
|
52 | - * |
|
53 | - * function my_highlighter ($matches) { |
|
54 | - * return '<span style="font-weight: bolder; color: #FF0000;">' . $matches[0] . '</span>'; |
|
55 | - * } |
|
56 | - * |
|
57 | - * new keyhighlighter ('W3C', false, 'my_highlighter'); |
|
58 | - * readfile ('http://www.w3c.org/'); |
|
59 | - * ?> |
|
60 | - * </code> |
|
61 | - */ |
|
62 | - // public function __construct () |
|
63 | - public function __construct($keywords, $singlewords = false, $replace_callback = null) |
|
64 | - { |
|
65 | - $this->keywords = $keywords; |
|
66 | - $this->singlewords = $singlewords; |
|
67 | - $this->replace_callback = $replace_callback; |
|
68 | - } |
|
41 | + /** |
|
42 | + * Main constructor |
|
43 | + * |
|
44 | + * This is the main constructor of keyhighlighter class. <br /> |
|
45 | + * It's the only public method of the class. |
|
46 | + * @param string $keywords the keywords you want to highlight |
|
47 | + * @param boolean $singlewords specify if it has to highlight also the single words. |
|
48 | + * @param callback $replace_callback a custom callback for keyword highlight. |
|
49 | + * <code> |
|
50 | + * <?php |
|
51 | + * require ('keyhighlighter.class.php'); |
|
52 | + * |
|
53 | + * function my_highlighter ($matches) { |
|
54 | + * return '<span style="font-weight: bolder; color: #FF0000;">' . $matches[0] . '</span>'; |
|
55 | + * } |
|
56 | + * |
|
57 | + * new keyhighlighter ('W3C', false, 'my_highlighter'); |
|
58 | + * readfile ('http://www.w3c.org/'); |
|
59 | + * ?> |
|
60 | + * </code> |
|
61 | + */ |
|
62 | + // public function __construct () |
|
63 | + public function __construct($keywords, $singlewords = false, $replace_callback = null) |
|
64 | + { |
|
65 | + $this->keywords = $keywords; |
|
66 | + $this->singlewords = $singlewords; |
|
67 | + $this->replace_callback = $replace_callback; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * @access private |
|
72 | - * @param $replace_matches |
|
73 | - * @return mixed |
|
74 | - */ |
|
75 | - public function replace($replace_matches) |
|
76 | - { |
|
77 | - $patterns = array(); |
|
78 | - if ($this->singlewords) { |
|
79 | - $keywords = explode(' ', $this->preg_keywords); |
|
80 | - foreach ($keywords as $keyword) { |
|
81 | - $patterns[] = '/(?' . '>' . $keyword . '+)/si'; |
|
82 | - } |
|
83 | - } else { |
|
84 | - $patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si'; |
|
85 | - } |
|
70 | + /** |
|
71 | + * @access private |
|
72 | + * @param $replace_matches |
|
73 | + * @return mixed |
|
74 | + */ |
|
75 | + public function replace($replace_matches) |
|
76 | + { |
|
77 | + $patterns = array(); |
|
78 | + if ($this->singlewords) { |
|
79 | + $keywords = explode(' ', $this->preg_keywords); |
|
80 | + foreach ($keywords as $keyword) { |
|
81 | + $patterns[] = '/(?' . '>' . $keyword . '+)/si'; |
|
82 | + } |
|
83 | + } else { |
|
84 | + $patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si'; |
|
85 | + } |
|
86 | 86 | |
87 | - $result = $replace_matches[0]; |
|
87 | + $result = $replace_matches[0]; |
|
88 | 88 | |
89 | - foreach ($patterns as $pattern) { |
|
90 | - if (null !== ($this->replace_callback)) { |
|
91 | - $result = preg_replace_callback($pattern, $this->replace_callback, $result); |
|
92 | - } else { |
|
93 | - $result = preg_replace($pattern, '<span class="highlightedkey">\\0</span>', $result); |
|
94 | - } |
|
95 | - } |
|
89 | + foreach ($patterns as $pattern) { |
|
90 | + if (null !== ($this->replace_callback)) { |
|
91 | + $result = preg_replace_callback($pattern, $this->replace_callback, $result); |
|
92 | + } else { |
|
93 | + $result = preg_replace($pattern, '<span class="highlightedkey">\\0</span>', $result); |
|
94 | + } |
|
95 | + } |
|
96 | 96 | |
97 | - return $result; |
|
98 | - } |
|
97 | + return $result; |
|
98 | + } |
|
99 | 99 | |
100 | - /** |
|
101 | - * @access private |
|
102 | - * @param $buffer |
|
103 | - * @return mixed|string |
|
104 | - */ |
|
105 | - public function highlight($buffer) |
|
106 | - { |
|
107 | - $buffer = '>' . $buffer . '<'; |
|
108 | - $this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords); |
|
109 | - $buffer = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", array(&$this, 'replace'), $buffer); |
|
110 | - $buffer = substr($buffer, 1, -1); |
|
100 | + /** |
|
101 | + * @access private |
|
102 | + * @param $buffer |
|
103 | + * @return mixed|string |
|
104 | + */ |
|
105 | + public function highlight($buffer) |
|
106 | + { |
|
107 | + $buffer = '>' . $buffer . '<'; |
|
108 | + $this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords); |
|
109 | + $buffer = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", array(&$this, 'replace'), $buffer); |
|
110 | + $buffer = substr($buffer, 1, -1); |
|
111 | 111 | |
112 | - return $buffer; |
|
113 | - } |
|
112 | + return $buffer; |
|
113 | + } |
|
114 | 114 | } |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class SmartobjectTag extends SmartMlObject |
37 | 37 | { |
38 | - /** |
|
39 | - * SmartobjectTag constructor. |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - $this->initVar('tagid', XOBJ_DTYPE_INT, '', true); |
|
44 | - $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true); |
|
45 | - $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC); |
|
46 | - $this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC); |
|
38 | + /** |
|
39 | + * SmartobjectTag constructor. |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + $this->initVar('tagid', XOBJ_DTYPE_INT, '', true); |
|
44 | + $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true); |
|
45 | + $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC); |
|
46 | + $this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC); |
|
47 | 47 | |
48 | - // call parent constructor to get Multilanguage field initiated |
|
49 | - $this->SmartMlObject(); |
|
50 | - } |
|
48 | + // call parent constructor to get Multilanguage field initiated |
|
49 | + $this->SmartMlObject(); |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,27 +55,27 @@ discard block |
||
55 | 55 | */ |
56 | 56 | class SmartobjectTagHandler extends SmartPersistableMlObjectHandler |
57 | 57 | { |
58 | - /** |
|
59 | - * SmartobjectTagHandler constructor. |
|
60 | - * @param object|XoopsDatabase $db |
|
61 | - */ |
|
62 | - public function __construct($db) |
|
63 | - { |
|
64 | - parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject'); |
|
65 | - } |
|
58 | + /** |
|
59 | + * SmartobjectTagHandler constructor. |
|
60 | + * @param object|XoopsDatabase $db |
|
61 | + */ |
|
62 | + public function __construct($db) |
|
63 | + { |
|
64 | + parent::__construct($db, 'tag', 'tagid', 'name', 'description', 'smartobject'); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * @return mixed |
|
69 | - */ |
|
70 | - public function getLanguages() |
|
71 | - { |
|
72 | - include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
73 | - $aLanguages = XoopsLists::getLangList(); |
|
74 | - $ret['default'] = _CO_SOBJECT_ALL; |
|
75 | - foreach ($aLanguages as $lang) { |
|
76 | - $ret[$lang] = $lang; |
|
77 | - } |
|
67 | + /** |
|
68 | + * @return mixed |
|
69 | + */ |
|
70 | + public function getLanguages() |
|
71 | + { |
|
72 | + include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
73 | + $aLanguages = XoopsLists::getLangList(); |
|
74 | + $ret['default'] = _CO_SOBJECT_ALL; |
|
75 | + foreach ($aLanguages as $lang) { |
|
76 | + $ret[$lang] = $lang; |
|
77 | + } |
|
78 | 78 | |
79 | - return $ret; |
|
80 | - } |
|
79 | + return $ret; |
|
80 | + } |
|
81 | 81 | } |
@@ -24,44 +24,44 @@ |
||
24 | 24 | */ |
25 | 25 | class SmartSeoObject extends SmartObject |
26 | 26 | { |
27 | - /** |
|
28 | - * SmartSeoObject constructor. |
|
29 | - */ |
|
30 | - public function __construct() |
|
31 | - { |
|
32 | - $this->initCommonVar('meta_keywords'); |
|
33 | - $this->initCommonVar('meta_description'); |
|
34 | - $this->initCommonVar('short_url'); |
|
35 | - $this->seoEnabled = true; |
|
36 | - } |
|
27 | + /** |
|
28 | + * SmartSeoObject constructor. |
|
29 | + */ |
|
30 | + public function __construct() |
|
31 | + { |
|
32 | + $this->initCommonVar('meta_keywords'); |
|
33 | + $this->initCommonVar('meta_description'); |
|
34 | + $this->initCommonVar('short_url'); |
|
35 | + $this->seoEnabled = true; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Return the value of the short_url field of this object |
|
40 | - * |
|
41 | - * @return string |
|
42 | - */ |
|
43 | - public function short_url() |
|
44 | - { |
|
45 | - return $this->getVar('short_url'); |
|
46 | - } |
|
38 | + /** |
|
39 | + * Return the value of the short_url field of this object |
|
40 | + * |
|
41 | + * @return string |
|
42 | + */ |
|
43 | + public function short_url() |
|
44 | + { |
|
45 | + return $this->getVar('short_url'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Return the value of the meta_keywords field of this object |
|
50 | - * |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - public function meta_keywords() |
|
54 | - { |
|
55 | - return $this->getVar('meta_keywords'); |
|
56 | - } |
|
48 | + /** |
|
49 | + * Return the value of the meta_keywords field of this object |
|
50 | + * |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + public function meta_keywords() |
|
54 | + { |
|
55 | + return $this->getVar('meta_keywords'); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Return the value of the meta_description field of this object |
|
60 | - * |
|
61 | - * @return string |
|
62 | - */ |
|
63 | - public function meta_description() |
|
64 | - { |
|
65 | - return $this->getVar('meta_description'); |
|
66 | - } |
|
58 | + /** |
|
59 | + * Return the value of the meta_description field of this object |
|
60 | + * |
|
61 | + * @return string |
|
62 | + */ |
|
63 | + public function meta_description() |
|
64 | + { |
|
65 | + return $this->getVar('meta_description'); |
|
66 | + } |
|
67 | 67 | } |
@@ -36,10 +36,10 @@ |
||
36 | 36 | */ |
37 | 37 | class SmartJax extends Projax |
38 | 38 | { |
39 | - public function initiateFromUserside() |
|
40 | - { |
|
41 | - global $xoTheme; |
|
42 | - $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/prototype.js'); |
|
43 | - $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/scriptaculous.js'); |
|
44 | - } |
|
39 | + public function initiateFromUserside() |
|
40 | + { |
|
41 | + global $xoTheme; |
|
42 | + $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/prototype.js'); |
|
43 | + $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/scriptaculous.js'); |
|
44 | + } |
|
45 | 45 | } |
@@ -24,82 +24,82 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class SmartMlObject extends SmartObject |
26 | 26 | { |
27 | - /** |
|
28 | - * SmartMlObject constructor. |
|
29 | - */ |
|
30 | - public function __construct() |
|
31 | - { |
|
32 | - $this->initVar('language', XOBJ_DTYPE_TXTBOX, 'english', false, null, '', true, _CO_SOBJECT_LANGUAGE_CAPTION, _CO_SOBJECT_LANGUAGE_DSC, true, true); |
|
33 | - $this->setControl('language', 'language'); |
|
34 | - } |
|
35 | - |
|
36 | - /** |
|
37 | - * If object is not new, change the control of the not-multilanguage fields |
|
38 | - * |
|
39 | - * We need to intercept this function from SmartObject because if the object is not new... |
|
40 | - */ |
|
41 | - // function getForm() { |
|
42 | - |
|
43 | - //} |
|
44 | - |
|
45 | - /** |
|
46 | - * Strip Multilanguage Fields |
|
47 | - * |
|
48 | - * Get rid of all the multilanguage fields to have an object with only global fields. |
|
49 | - * This will be usefull when creating the ML object for the first time. Then we will be able |
|
50 | - * to create translations. |
|
51 | - */ |
|
52 | - public function stripMultilanguageFields() |
|
53 | - { |
|
54 | - $objectVars =& $this->getVars(); |
|
55 | - $newObjectVars = array(); |
|
56 | - foreach ($objectVars as $key => $var) { |
|
57 | - if (!$var['multilingual']) { |
|
58 | - $newObjectVars[$key] = $var; |
|
59 | - } |
|
60 | - } |
|
61 | - $this->vars = $newObjectVars; |
|
62 | - } |
|
63 | - |
|
64 | - public function stripNonMultilanguageFields() |
|
65 | - { |
|
66 | - $objectVars =& $this->getVars(); |
|
67 | - $newObjectVars = array(); |
|
68 | - foreach ($objectVars as $key => $var) { |
|
69 | - if ($var['multilingual'] || $key == $this->handler->keyName) { |
|
70 | - $newObjectVars[$key] = $var; |
|
71 | - } |
|
72 | - } |
|
73 | - $this->vars = $newObjectVars; |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * Make non multilanguage fields read only |
|
78 | - * |
|
79 | - * This is used when we are creating/editing a translation. |
|
80 | - * We only want to edit the multilanguag fields, not the global one. |
|
81 | - */ |
|
82 | - public function makeNonMLFieldReadOnly() |
|
83 | - { |
|
84 | - foreach ($this->getVars() as $key => $var) { |
|
85 | - //if (($key == 'language') || (!$var['multilingual'] && $key <> $this->handler->keyName)) { |
|
86 | - if (!$var['multilingual'] && $key <> $this->handler->keyName) { |
|
87 | - $this->setControl($key, 'label'); |
|
88 | - } |
|
89 | - } |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * @param bool $onlyUrl |
|
94 | - * @param bool $withimage |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - public function getEditLanguageLink($onlyUrl = false, $withimage = true) |
|
98 | - { |
|
99 | - $controller = new SmartObjectController($this->handler); |
|
100 | - |
|
101 | - return $controller->getEditLanguageLink($this, $onlyUrl, $withimage); |
|
102 | - } |
|
27 | + /** |
|
28 | + * SmartMlObject constructor. |
|
29 | + */ |
|
30 | + public function __construct() |
|
31 | + { |
|
32 | + $this->initVar('language', XOBJ_DTYPE_TXTBOX, 'english', false, null, '', true, _CO_SOBJECT_LANGUAGE_CAPTION, _CO_SOBJECT_LANGUAGE_DSC, true, true); |
|
33 | + $this->setControl('language', 'language'); |
|
34 | + } |
|
35 | + |
|
36 | + /** |
|
37 | + * If object is not new, change the control of the not-multilanguage fields |
|
38 | + * |
|
39 | + * We need to intercept this function from SmartObject because if the object is not new... |
|
40 | + */ |
|
41 | + // function getForm() { |
|
42 | + |
|
43 | + //} |
|
44 | + |
|
45 | + /** |
|
46 | + * Strip Multilanguage Fields |
|
47 | + * |
|
48 | + * Get rid of all the multilanguage fields to have an object with only global fields. |
|
49 | + * This will be usefull when creating the ML object for the first time. Then we will be able |
|
50 | + * to create translations. |
|
51 | + */ |
|
52 | + public function stripMultilanguageFields() |
|
53 | + { |
|
54 | + $objectVars =& $this->getVars(); |
|
55 | + $newObjectVars = array(); |
|
56 | + foreach ($objectVars as $key => $var) { |
|
57 | + if (!$var['multilingual']) { |
|
58 | + $newObjectVars[$key] = $var; |
|
59 | + } |
|
60 | + } |
|
61 | + $this->vars = $newObjectVars; |
|
62 | + } |
|
63 | + |
|
64 | + public function stripNonMultilanguageFields() |
|
65 | + { |
|
66 | + $objectVars =& $this->getVars(); |
|
67 | + $newObjectVars = array(); |
|
68 | + foreach ($objectVars as $key => $var) { |
|
69 | + if ($var['multilingual'] || $key == $this->handler->keyName) { |
|
70 | + $newObjectVars[$key] = $var; |
|
71 | + } |
|
72 | + } |
|
73 | + $this->vars = $newObjectVars; |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * Make non multilanguage fields read only |
|
78 | + * |
|
79 | + * This is used when we are creating/editing a translation. |
|
80 | + * We only want to edit the multilanguag fields, not the global one. |
|
81 | + */ |
|
82 | + public function makeNonMLFieldReadOnly() |
|
83 | + { |
|
84 | + foreach ($this->getVars() as $key => $var) { |
|
85 | + //if (($key == 'language') || (!$var['multilingual'] && $key <> $this->handler->keyName)) { |
|
86 | + if (!$var['multilingual'] && $key <> $this->handler->keyName) { |
|
87 | + $this->setControl($key, 'label'); |
|
88 | + } |
|
89 | + } |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * @param bool $onlyUrl |
|
94 | + * @param bool $withimage |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + public function getEditLanguageLink($onlyUrl = false, $withimage = true) |
|
98 | + { |
|
99 | + $controller = new SmartObjectController($this->handler); |
|
100 | + |
|
101 | + return $controller->getEditLanguageLink($this, $onlyUrl, $withimage); |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -107,55 +107,55 @@ discard block |
||
107 | 107 | */ |
108 | 108 | class SmartPersistableMlObjectHandler extends SmartPersistableObjectHandler |
109 | 109 | { |
110 | - /** |
|
111 | - * @param null $criteria |
|
112 | - * @param bool $id_as_key |
|
113 | - * @param bool $as_object |
|
114 | - * @param bool $debug |
|
115 | - * @param bool $language |
|
116 | - * @return array |
|
117 | - */ |
|
118 | - public function getObjects($criteria = null, $id_as_key = false, $as_object = true, $debug = false, $language = false) |
|
119 | - { |
|
120 | - // Create the first part of the SQL query to join the "_text" table |
|
121 | - $sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->table . '_text AS ' . $this->_itemname . '_text ON ' . $this->_itemname . '.' . $this->keyName . '=' . $this->_itemname . '_text.' . $this->keyName; |
|
122 | - |
|
123 | - if ($language) { |
|
124 | - // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language |
|
125 | - |
|
126 | - // if no criteria was previously created, let's create it |
|
127 | - if (!$criteria) { |
|
128 | - $criteria = new CriteriaCompo(); |
|
129 | - } |
|
130 | - $criteria->add(new Criteria('language', $language)); |
|
131 | - |
|
132 | - return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
133 | - } |
|
134 | - |
|
135 | - return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * @param mixed $id |
|
140 | - * @param bool $language |
|
141 | - * @param bool $as_object |
|
142 | - * @param bool $debug |
|
143 | - * @return mixed |
|
144 | - */ |
|
145 | - public function &get($id, $language = false, $as_object = true, $debug = false) |
|
146 | - { |
|
147 | - if (!$language) { |
|
148 | - return parent::get($id, $as_object, $debug); |
|
149 | - } else { |
|
150 | - $criteria = new CriteriaCompo(); |
|
151 | - $criteria->add(new Criteria('language', $language)); |
|
152 | - |
|
153 | - return parent::get($id, $as_object, $debug, $criteria); |
|
154 | - } |
|
155 | - } |
|
156 | - |
|
157 | - public function changeTableNameForML() |
|
158 | - { |
|
159 | - $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text'); |
|
160 | - } |
|
110 | + /** |
|
111 | + * @param null $criteria |
|
112 | + * @param bool $id_as_key |
|
113 | + * @param bool $as_object |
|
114 | + * @param bool $debug |
|
115 | + * @param bool $language |
|
116 | + * @return array |
|
117 | + */ |
|
118 | + public function getObjects($criteria = null, $id_as_key = false, $as_object = true, $debug = false, $language = false) |
|
119 | + { |
|
120 | + // Create the first part of the SQL query to join the "_text" table |
|
121 | + $sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->table . '_text AS ' . $this->_itemname . '_text ON ' . $this->_itemname . '.' . $this->keyName . '=' . $this->_itemname . '_text.' . $this->keyName; |
|
122 | + |
|
123 | + if ($language) { |
|
124 | + // If a language was specified, then let's create a WHERE clause to only return the objects associated with this language |
|
125 | + |
|
126 | + // if no criteria was previously created, let's create it |
|
127 | + if (!$criteria) { |
|
128 | + $criteria = new CriteriaCompo(); |
|
129 | + } |
|
130 | + $criteria->add(new Criteria('language', $language)); |
|
131 | + |
|
132 | + return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
133 | + } |
|
134 | + |
|
135 | + return parent::getObjects($criteria, $id_as_key, $as_object, $debug, $sql); |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * @param mixed $id |
|
140 | + * @param bool $language |
|
141 | + * @param bool $as_object |
|
142 | + * @param bool $debug |
|
143 | + * @return mixed |
|
144 | + */ |
|
145 | + public function &get($id, $language = false, $as_object = true, $debug = false) |
|
146 | + { |
|
147 | + if (!$language) { |
|
148 | + return parent::get($id, $as_object, $debug); |
|
149 | + } else { |
|
150 | + $criteria = new CriteriaCompo(); |
|
151 | + $criteria->add(new Criteria('language', $language)); |
|
152 | + |
|
153 | + return parent::get($id, $as_object, $debug, $criteria); |
|
154 | + } |
|
155 | + } |
|
156 | + |
|
157 | + public function changeTableNameForML() |
|
158 | + { |
|
159 | + $this->table = $this->db->prefix($this->_moduleName . '_' . $this->_itemname . '_text'); |
|
160 | + } |
|
161 | 161 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function stripMultilanguageFields() |
53 | 53 | { |
54 | - $objectVars =& $this->getVars(); |
|
54 | + $objectVars = & $this->getVars(); |
|
55 | 55 | $newObjectVars = array(); |
56 | 56 | foreach ($objectVars as $key => $var) { |
57 | 57 | if (!$var['multilingual']) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | public function stripNonMultilanguageFields() |
65 | 65 | { |
66 | - $objectVars =& $this->getVars(); |
|
66 | + $objectVars = & $this->getVars(); |
|
67 | 67 | $newObjectVars = array(); |
68 | 68 | foreach ($objectVars as $key => $var) { |
69 | 69 | if ($var['multilingual'] || $key == $this->handler->keyName) { |
@@ -11,31 +11,31 @@ |
||
11 | 11 | */ |
12 | 12 | class SmartFormUrlLinkElement extends XoopsFormElementTray |
13 | 13 | { |
14 | - /** |
|
15 | - * SmartFormUrlLinkElement constructor. |
|
16 | - * @param string $form_caption |
|
17 | - * @param string $key |
|
18 | - * @param string $object |
|
19 | - */ |
|
20 | - public function __construct($form_caption, $key, $object) |
|
21 | - { |
|
22 | - parent::__construct($form_caption, ' '); |
|
14 | + /** |
|
15 | + * SmartFormUrlLinkElement constructor. |
|
16 | + * @param string $form_caption |
|
17 | + * @param string $key |
|
18 | + * @param string $object |
|
19 | + */ |
|
20 | + public function __construct($form_caption, $key, $object) |
|
21 | + { |
|
22 | + parent::__construct($form_caption, ' '); |
|
23 | 23 | |
24 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_URL)); |
|
25 | - $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
24 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_URL)); |
|
25 | + $this->addElement(new SmartFormTextElement($object, 'url_' . $key)); |
|
26 | 26 | |
27 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_CAPTION)); |
|
28 | - $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
27 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_CAPTION)); |
|
28 | + $this->addElement(new SmartFormTextElement($object, 'caption_' . $key)); |
|
29 | 29 | |
30 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_DESC . '<br/>')); |
|
31 | - $this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
30 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_DESC . '<br/>')); |
|
31 | + $this->addElement(new XoopsFormTextArea('', 'desc_' . $key, $object->getVar('description'))); |
|
32 | 32 | |
33 | - $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_TARGET)); |
|
34 | - $targ_val = $object->getVar('target'); |
|
35 | - $targetRadio = new XoopsFormRadio('', 'target_' . $key, $targ_val != '' ? $targ_val : '_blank'); |
|
36 | - $control = $object->getControl('target'); |
|
37 | - $targetRadio->addOptionArray($control['options']); |
|
33 | + $this->addElement(new XoopsFormLabel('', '<br/>' . _CO_SOBJECT_URLLINK_TARGET)); |
|
34 | + $targ_val = $object->getVar('target'); |
|
35 | + $targetRadio = new XoopsFormRadio('', 'target_' . $key, $targ_val != '' ? $targ_val : '_blank'); |
|
36 | + $control = $object->getControl('target'); |
|
37 | + $targetRadio->addOptionArray($control['options']); |
|
38 | 38 | |
39 | - $this->addElement($targetRadio); |
|
40 | - } |
|
39 | + $this->addElement($targetRadio); |
|
40 | + } |
|
41 | 41 | } |
@@ -11,24 +11,24 @@ |
||
11 | 11 | */ |
12 | 12 | class SmartFormTextElement extends XoopsFormText |
13 | 13 | { |
14 | - /** |
|
15 | - * SmartFormTextElement constructor. |
|
16 | - * @param string $object |
|
17 | - * @param string $key |
|
18 | - */ |
|
19 | - public function __construct($object, $key) |
|
20 | - { |
|
21 | - $var = $object->vars[$key]; |
|
14 | + /** |
|
15 | + * SmartFormTextElement constructor. |
|
16 | + * @param string $object |
|
17 | + * @param string $key |
|
18 | + */ |
|
19 | + public function __construct($object, $key) |
|
20 | + { |
|
21 | + $var = $object->vars[$key]; |
|
22 | 22 | |
23 | - if (isset($object->controls[$key])) { |
|
24 | - $control = $object->controls[$key]; |
|
25 | - $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255); |
|
26 | - $form_size = isset($control['size']) ? $control['size'] : 50; |
|
27 | - } else { |
|
28 | - $form_maxlength = 255; |
|
29 | - $form_size = 50; |
|
30 | - } |
|
23 | + if (isset($object->controls[$key])) { |
|
24 | + $control = $object->controls[$key]; |
|
25 | + $form_maxlength = isset($control['maxlength']) ? $control['maxlength'] : (isset($var['maxlength']) ? $var['maxlength'] : 255); |
|
26 | + $form_size = isset($control['size']) ? $control['size'] : 50; |
|
27 | + } else { |
|
28 | + $form_maxlength = 255; |
|
29 | + $form_size = 50; |
|
30 | + } |
|
31 | 31 | |
32 | - parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e')); |
|
33 | - } |
|
32 | + parent::__construct($var['form_caption'], $key, $form_size, $form_maxlength, $object->getVar($key, 'e')); |
|
33 | + } |
|
34 | 34 | } |
@@ -11,13 +11,13 @@ |
||
11 | 11 | */ |
12 | 12 | class SmartFormDateElement extends XoopsFormTextDateSelect |
13 | 13 | { |
14 | - /** |
|
15 | - * SmartFormDateElement constructor. |
|
16 | - * @param $object |
|
17 | - * @param $key |
|
18 | - */ |
|
19 | - public function __construct($object, $key) |
|
20 | - { |
|
21 | - parent::__construct($object->vars[$key]['form_caption'], $key, 15, $object->getVar($key, 'e')); |
|
22 | - } |
|
14 | + /** |
|
15 | + * SmartFormDateElement constructor. |
|
16 | + * @param $object |
|
17 | + * @param $key |
|
18 | + */ |
|
19 | + public function __construct($object, $key) |
|
20 | + { |
|
21 | + parent::__construct($object->vars[$key]['form_caption'], $key, 15, $object->getVar($key, 'e')); |
|
22 | + } |
|
23 | 23 | } |