Completed
Push — master ( 88111b...b3fce7 )
by Michael
05:58
created
class/PluginHandler.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -27,57 +27,57 @@
 block discarded – undo
27 27
  */
28 28
 class PluginHandler
29 29
 {
30
-    public $pluginPatterns = false;
30
+	public $pluginPatterns = false;
31 31
 
32
-    /**
33
-     * @param $dirname
34
-     * @return bool|Plugin
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 Plugin($array);
32
+	/**
33
+	 * @param $dirname
34
+	 * @return bool|Plugin
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 Plugin($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
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
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 Plugin($array);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
class/Export.php 1 patch
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -41,116 +41,116 @@
 block discarded – undo
41 41
  */
42 42
 class Export
43 43
 {
44
-    public $handler;
45
-    public $criteria;
46
-    public $fields;
47
-    public $format;
48
-    public $filename;
49
-    public $filepath;
50
-    public $options;
51
-    public $outputMethods = false;
52
-    public $notDisplayFields;
44
+	public $handler;
45
+	public $criteria;
46
+	public $fields;
47
+	public $format;
48
+	public $filename;
49
+	public $filepath;
50
+	public $options;
51
+	public $outputMethods = false;
52
+	public $notDisplayFields;
53 53
 
54
-    /**
55
-     * Constructor
56
-     *
57
-     * @param PersistableObjectHandler $objectHandler SmartObjectHandler handling the data we want to export
58
-     * @param \CriteriaElement         $criteria      containing the criteria of the query fetching the objects to be exported
59
-     * @param array|bool               $fields        fields to be exported. If FALSE then all fields will be exported
60
-     * @param bool|string              $filename      name of the file to be created
61
-     * @param bool|string              $filepath      path where the file will be saved
62
-     * @param string                   $format        format of the ouputed export. Currently only supports CSV
63
-     * @param array|bool               $options       options of the format to be exported in
64
-     */
65
-    public function __construct(
66
-        PersistableObjectHandler $objectHandler,
67
-        \CriteriaElement $criteria = null,
68
-        $fields = false,
69
-        $filename = false,
70
-        $filepath = false,
71
-        $format = 'csv',
72
-        $options = false
73
-    ) {
74
-        $this->handler          = $objectHandler;
75
-        $this->criteria         = $criteria;
76
-        $this->fields           = $fields;
77
-        $this->filename         = $filename;
78
-        $this->format           = $format;
79
-        $this->options          = $options;
80
-        $this->notDisplayFields = false;
81
-    }
54
+	/**
55
+	 * Constructor
56
+	 *
57
+	 * @param PersistableObjectHandler $objectHandler SmartObjectHandler handling the data we want to export
58
+	 * @param \CriteriaElement         $criteria      containing the criteria of the query fetching the objects to be exported
59
+	 * @param array|bool               $fields        fields to be exported. If FALSE then all fields will be exported
60
+	 * @param bool|string              $filename      name of the file to be created
61
+	 * @param bool|string              $filepath      path where the file will be saved
62
+	 * @param string                   $format        format of the ouputed export. Currently only supports CSV
63
+	 * @param array|bool               $options       options of the format to be exported in
64
+	 */
65
+	public function __construct(
66
+		PersistableObjectHandler $objectHandler,
67
+		\CriteriaElement $criteria = null,
68
+		$fields = false,
69
+		$filename = false,
70
+		$filepath = false,
71
+		$format = 'csv',
72
+		$options = false
73
+	) {
74
+		$this->handler          = $objectHandler;
75
+		$this->criteria         = $criteria;
76
+		$this->fields           = $fields;
77
+		$this->filename         = $filename;
78
+		$this->format           = $format;
79
+		$this->options          = $options;
80
+		$this->notDisplayFields = false;
81
+	}
82 82
 
83
-    /**
84
-     * Renders the export
85
-     * @param $filename
86
-     */
87
-    public function render($filename)
88
-    {
89
-        $this->filename = $filename;
83
+	/**
84
+	 * Renders the export
85
+	 * @param $filename
86
+	 */
87
+	public function render($filename)
88
+	{
89
+		$this->filename = $filename;
90 90
 
91
-        $objects        = $this->handler->getObjects($this->criteria);
92
-        $rows           = [];
93
-        $columnsHeaders = [];
94
-        $firstObject    = true;
95
-        foreach ($objects as $object) {
96
-            $row = [];
97
-            foreach ($object->vars as $key => $var) {
98
-                if ((!$this->fields || in_array($key, $this->fields)) && !in_array($key, $this->notDisplayFields)) {
99
-                    if ($this->outputMethods && isset($this->outputMethods[$key])
100
-                        && method_exists($object, $this->outputMethods[$key])) {
101
-                        $method    = $this->outputMethods[$key];
102
-                        $row[$key] = $object->$method();
103
-                    } else {
104
-                        $row[$key] = $object->getVar($key);
105
-                    }
106
-                    if ($firstObject) {
107
-                        // then set the columnsHeaders array as well
108
-                        $columnsHeaders[$key] = $var['form_caption'];
109
-                    }
110
-                }
111
-            }
112
-            $firstObject = false;
113
-            $rows[]      = $row;
114
-            unset($row);
115
-        }
116
-        $data                   = [];
117
-        $data['rows']           = $rows;
118
-        $data['columnsHeaders'] = $columnsHeaders;
119
-        $smartExportRenderer    = new ExportRenderer($data, $this->filename, $this->filepath, $this->format, $this->options);
120
-        $smartExportRenderer->execute();
121
-    }
91
+		$objects        = $this->handler->getObjects($this->criteria);
92
+		$rows           = [];
93
+		$columnsHeaders = [];
94
+		$firstObject    = true;
95
+		foreach ($objects as $object) {
96
+			$row = [];
97
+			foreach ($object->vars as $key => $var) {
98
+				if ((!$this->fields || in_array($key, $this->fields)) && !in_array($key, $this->notDisplayFields)) {
99
+					if ($this->outputMethods && isset($this->outputMethods[$key])
100
+						&& method_exists($object, $this->outputMethods[$key])) {
101
+						$method    = $this->outputMethods[$key];
102
+						$row[$key] = $object->$method();
103
+					} else {
104
+						$row[$key] = $object->getVar($key);
105
+					}
106
+					if ($firstObject) {
107
+						// then set the columnsHeaders array as well
108
+						$columnsHeaders[$key] = $var['form_caption'];
109
+					}
110
+				}
111
+			}
112
+			$firstObject = false;
113
+			$rows[]      = $row;
114
+			unset($row);
115
+		}
116
+		$data                   = [];
117
+		$data['rows']           = $rows;
118
+		$data['columnsHeaders'] = $columnsHeaders;
119
+		$smartExportRenderer    = new ExportRenderer($data, $this->filename, $this->filepath, $this->format, $this->options);
120
+		$smartExportRenderer->execute();
121
+	}
122 122
 
123
-    /**
124
-     * Set an array contaning the alternate methods to use instead of the default getVar()
125
-     *
126
-     * $outputMethods array example: 'uid' => 'getUserName'...
127
-     * @param $outputMethods
128
-     */
129
-    public function setOuptutMethods($outputMethods)
130
-    {
131
-        $this->outputMethods = $outputMethods;
132
-    }
123
+	/**
124
+	 * Set an array contaning the alternate methods to use instead of the default getVar()
125
+	 *
126
+	 * $outputMethods array example: 'uid' => 'getUserName'...
127
+	 * @param $outputMethods
128
+	 */
129
+	public function setOuptutMethods($outputMethods)
130
+	{
131
+		$this->outputMethods = $outputMethods;
132
+	}
133 133
 
134
-    /*
134
+	/*
135 135
      * Set an array of fields that we don't want in export
136 136
      */
137
-    /**
138
-     * @param $fields
139
-     */
140
-    public function setNotDisplayFields($fields)
141
-    {
142
-        if (!$this->notDisplayFields) {
143
-            if (is_array($fields)) {
144
-                $this->notDisplayFields = $fields;
145
-            } else {
146
-                $this->notDisplayFields = [$fields];
147
-            }
148
-        } else {
149
-            if (is_array($fields)) {
150
-                $this->notDisplayFields = array_merge($this->notDisplayFields, $fields);
151
-            } else {
152
-                $this->notDisplayFields[] = $fields;
153
-            }
154
-        }
155
-    }
137
+	/**
138
+	 * @param $fields
139
+	 */
140
+	public function setNotDisplayFields($fields)
141
+	{
142
+		if (!$this->notDisplayFields) {
143
+			if (is_array($fields)) {
144
+				$this->notDisplayFields = $fields;
145
+			} else {
146
+				$this->notDisplayFields = [$fields];
147
+			}
148
+		} else {
149
+			if (is_array($fields)) {
150
+				$this->notDisplayFields = array_merge($this->notDisplayFields, $fields);
151
+			} else {
152
+				$this->notDisplayFields[] = $fields;
153
+			}
154
+		}
155
+	}
156 156
 }
Please login to merge, or discard this patch.
class/Tag.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@
 block discarded – undo
28 28
  */
29 29
 class Tag extends MlObject
30 30
 {
31
-    /**
32
-     * SmartobjectTag constructor.
33
-     */
34
-    public function __construct()
35
-    {
36
-        $this->initVar('tagid', XOBJ_DTYPE_INT, '', true);
37
-        $this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true);
38
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC);
39
-        $this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC);
31
+	/**
32
+	 * SmartobjectTag constructor.
33
+	 */
34
+	public function __construct()
35
+	{
36
+		$this->initVar('tagid', XOBJ_DTYPE_INT, '', true);
37
+		$this->initVar('name', XOBJ_DTYPE_TXTBOX, '', true, 255, '', false, _CO_SOBJECT_TAG_TAGID_CAPTION, _CO_SOBJECT_TAG_TAGID_DSC, true);
38
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA, '', true, null, '', false, _CO_SOBJECT_TAG_DESCRIPTION_CAPTION, _CO_SOBJECT_TAG_DESCRIPTION_DSC);
39
+		$this->initVar('value', XOBJ_DTYPE_TXTAREA, '', true, null, '', true, _CO_SOBJECT_TAG_VALUE_CAPTION, _CO_SOBJECT_TAG_VALUE_DSC);
40 40
 
41
-        // call parent constructor to get Multilanguage field initiated
42
-        $this->SmartMlObject();
43
-    }
41
+		// call parent constructor to get Multilanguage field initiated
42
+		$this->SmartMlObject();
43
+	}
44 44
 }
Please login to merge, or discard this patch.
class/Tree.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -30,17 +30,17 @@
 block discarded – undo
30 30
  */
31 31
 class Tree extends \XoopsObjectTree
32 32
 {
33
-    public function _initialize()
34
-    {
35
-        foreach (array_keys($this->_objects) as $i) {
36
-            $key1                         = $this->_objects[$i]->getVar($this->_myId);
37
-            $this->tree[$key1]['obj']     = $this->_objects[$i];
38
-            $key2                         = $this->_objects[$i]->getVar($this->_parentId, 'e');
39
-            $this->tree[$key1]['parent']  = $key2;
40
-            $this->tree[$key2]['child'][] = $key1;
41
-            if (isset($this->_rootId)) {
42
-                $this->tree[$key1]['root'] = $this->_objects[$i]->getVar($this->_rootId);
43
-            }
44
-        }
45
-    }
33
+	public function _initialize()
34
+	{
35
+		foreach (array_keys($this->_objects) as $i) {
36
+			$key1                         = $this->_objects[$i]->getVar($this->_myId);
37
+			$this->tree[$key1]['obj']     = $this->_objects[$i];
38
+			$key2                         = $this->_objects[$i]->getVar($this->_parentId, 'e');
39
+			$this->tree[$key1]['parent']  = $key2;
40
+			$this->tree[$key2]['child'][] = $key1;
41
+			if (isset($this->_rootId)) {
42
+				$this->tree[$key1]['root'] = $this->_objects[$i]->getVar($this->_rootId);
43
+			}
44
+		}
45
+	}
46 46
 }
Please login to merge, or discard this patch.
class/CategoryHandler.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -21,91 +21,91 @@
 block discarded – undo
21 21
  */
22 22
 class CategoryHandler extends Smartobject\PersistableObjectHandler
23 23
 {
24
-    public $allCategoriesObj = false;
25
-    public $_allCategoriesId = false;
26
-
27
-    /**
28
-     * SmartobjectCategoryHandler constructor.
29
-     * @param \XoopsDatabase       $db
30
-     * @param                      $modulename
31
-     */
32
-    public function __construct(\XoopsDatabase $db, $modulename)
33
-    {
34
-        parent::__construct($db, 'category', 'categoryid', 'name', 'description', $modulename);
35
-    }
36
-
37
-    /**
38
-     * @param  int    $parentid
39
-     * @param  bool   $perm_name
40
-     * @param  string $sort
41
-     * @param  string $order
42
-     * @return array|bool
43
-     */
44
-    public function getAllCategoriesArray($parentid = 0, $perm_name = false, $sort = 'parentid', $order = 'ASC')
45
-    {
46
-        if (!$this->allCategoriesObj) {
47
-            $criteria = new \CriteriaCompo();
48
-            $criteria->setSort($sort);
49
-            $criteria->setOrder($order);
50
-            global $xoopsUser;
51
-            $userIsAdmin = is_object($xoopsUser) && $xoopsUser->isAdmin();
52
-
53
-            if ($perm_name && !$userIsAdmin) {
54
-                if (!$this->setGrantedObjectsCriteria($criteria, $perm_name)) {
55
-                    return false;
56
-                }
57
-            }
58
-
59
-            $this->allCategoriesObj =& $this->getObjects($criteria, 'parentid');
60
-        }
61
-
62
-        $ret = [];
63
-        if (isset($this->allCategoriesObj[$parentid])) {
64
-            foreach ($this->allCategoriesObj[$parentid] as $categoryid => $categoryObj) {
65
-                $ret[$categoryid]['self'] = $categoryObj->toArray();
66
-                if (isset($this->allCategoriesObj[$categoryid])) {
67
-                    $ret[$categoryid]['sub']          = $this->getAllCategoriesArray($categoryid);
68
-                    $ret[$categoryid]['subcatscount'] = count($ret[$categoryid]['sub']);
69
-                }
70
-            }
71
-        }
72
-
73
-        return $ret;
74
-    }
75
-
76
-    /**
77
-     * @param               $parentid
78
-     * @param  bool         $asString
79
-     * @return array|string
80
-     */
81
-    public function getParentIds($parentid, $asString = true)
82
-    {
83
-        if (!$this->allCategoriesId) {
84
-            $ret = [];
85
-            $sql = 'SELECT categoryid, parentid FROM ' . $this->table . ' AS ' . $this->_itemname . ' ORDER BY parentid';
86
-
87
-            $result = $this->db->query($sql);
88
-
89
-            if (!$result) {
90
-                return $ret;
91
-            }
92
-
93
-            while (false !== ($myrow = $this->db->fetchArray($result))) {
94
-                $this->allCategoriesId[$myrow['categoryid']] = $myrow['parentid'];
95
-            }
96
-        }
97
-
98
-        $retArray = [$parentid];
99
-        while (0 != $parentid) {
100
-            $parentid = $this->allCategoriesId[$parentid];
101
-            if (0 != $parentid) {
102
-                $retArray[] = $parentid;
103
-            }
104
-        }
105
-        if ($asString) {
106
-            return implode(', ', $retArray);
107
-        } else {
108
-            return $retArray;
109
-        }
110
-    }
24
+	public $allCategoriesObj = false;
25
+	public $_allCategoriesId = false;
26
+
27
+	/**
28
+	 * SmartobjectCategoryHandler constructor.
29
+	 * @param \XoopsDatabase       $db
30
+	 * @param                      $modulename
31
+	 */
32
+	public function __construct(\XoopsDatabase $db, $modulename)
33
+	{
34
+		parent::__construct($db, 'category', 'categoryid', 'name', 'description', $modulename);
35
+	}
36
+
37
+	/**
38
+	 * @param  int    $parentid
39
+	 * @param  bool   $perm_name
40
+	 * @param  string $sort
41
+	 * @param  string $order
42
+	 * @return array|bool
43
+	 */
44
+	public function getAllCategoriesArray($parentid = 0, $perm_name = false, $sort = 'parentid', $order = 'ASC')
45
+	{
46
+		if (!$this->allCategoriesObj) {
47
+			$criteria = new \CriteriaCompo();
48
+			$criteria->setSort($sort);
49
+			$criteria->setOrder($order);
50
+			global $xoopsUser;
51
+			$userIsAdmin = is_object($xoopsUser) && $xoopsUser->isAdmin();
52
+
53
+			if ($perm_name && !$userIsAdmin) {
54
+				if (!$this->setGrantedObjectsCriteria($criteria, $perm_name)) {
55
+					return false;
56
+				}
57
+			}
58
+
59
+			$this->allCategoriesObj =& $this->getObjects($criteria, 'parentid');
60
+		}
61
+
62
+		$ret = [];
63
+		if (isset($this->allCategoriesObj[$parentid])) {
64
+			foreach ($this->allCategoriesObj[$parentid] as $categoryid => $categoryObj) {
65
+				$ret[$categoryid]['self'] = $categoryObj->toArray();
66
+				if (isset($this->allCategoriesObj[$categoryid])) {
67
+					$ret[$categoryid]['sub']          = $this->getAllCategoriesArray($categoryid);
68
+					$ret[$categoryid]['subcatscount'] = count($ret[$categoryid]['sub']);
69
+				}
70
+			}
71
+		}
72
+
73
+		return $ret;
74
+	}
75
+
76
+	/**
77
+	 * @param               $parentid
78
+	 * @param  bool         $asString
79
+	 * @return array|string
80
+	 */
81
+	public function getParentIds($parentid, $asString = true)
82
+	{
83
+		if (!$this->allCategoriesId) {
84
+			$ret = [];
85
+			$sql = 'SELECT categoryid, parentid FROM ' . $this->table . ' AS ' . $this->_itemname . ' ORDER BY parentid';
86
+
87
+			$result = $this->db->query($sql);
88
+
89
+			if (!$result) {
90
+				return $ret;
91
+			}
92
+
93
+			while (false !== ($myrow = $this->db->fetchArray($result))) {
94
+				$this->allCategoriesId[$myrow['categoryid']] = $myrow['parentid'];
95
+			}
96
+		}
97
+
98
+		$retArray = [$parentid];
99
+		while (0 != $parentid) {
100
+			$parentid = $this->allCategoriesId[$parentid];
101
+			if (0 != $parentid) {
102
+				$retArray[] = $parentid;
103
+			}
104
+		}
105
+		if ($asString) {
106
+			return implode(', ', $retArray);
107
+		} else {
108
+			return $retArray;
109
+		}
110
+	}
111 111
 }
Please login to merge, or discard this patch.
class/Jax.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@
 block discarded – undo
30 30
  */
31 31
 class Jax extends \Projax
32 32
 {
33
-    public function initiateFromUserside()
34
-    {
35
-        global $xoTheme;
36
-        $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/prototype.js');
37
-        $xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/scriptaculous.js');
38
-    }
33
+	public function initiateFromUserside()
34
+	{
35
+		global $xoTheme;
36
+		$xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/prototype.js');
37
+		$xoTheme->addScript(SMARTOBJECT_URL . 'include/projax/js/scriptaculous.js');
38
+	}
39 39
 }
Please login to merge, or discard this patch.
class/LinkHandler.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@
 block discarded – undo
32 32
 {
33 33
 
34 34
 
35
-    /**
36
-     * LinkHandler constructor.
37
-     * @param \XoopsDatabase $db
38
-     */
39
-    public function __construct(\XoopsDatabase $db)
40
-    {
41
-        parent::__construct($db, Link::class, 'linkid', 'subject', 'body', 'smartobject');
42
-    }
35
+	/**
36
+	 * LinkHandler constructor.
37
+	 * @param \XoopsDatabase $db
38
+	 */
39
+	public function __construct(\XoopsDatabase $db)
40
+	{
41
+		parent::__construct($db, Link::class, 'linkid', 'subject', 'body', 'smartobject');
42
+	}
43 43
 }
Please login to merge, or discard this patch.
class/SeoObject.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -28,44 +28,44 @@
 block discarded – undo
28 28
  */
29 29
 class SeoObject extends Smartobject\BaseSmartObject
30 30
 {
31
-    /**
32
-     * SmartSeoObject constructor.
33
-     */
34
-    public function __construct()
35
-    {
36
-        $this->initCommonVar('meta_keywords');
37
-        $this->initCommonVar('meta_description');
38
-        $this->initCommonVar('short_url');
39
-        $this->seoEnabled = true;
40
-    }
31
+	/**
32
+	 * SmartSeoObject constructor.
33
+	 */
34
+	public function __construct()
35
+	{
36
+		$this->initCommonVar('meta_keywords');
37
+		$this->initCommonVar('meta_description');
38
+		$this->initCommonVar('short_url');
39
+		$this->seoEnabled = true;
40
+	}
41 41
 
42
-    /**
43
-     * Return the value of the short_url field of this object
44
-     *
45
-     * @return string
46
-     */
47
-    public function short_url()
48
-    {
49
-        return $this->getVar('short_url');
50
-    }
42
+	/**
43
+	 * Return the value of the short_url field of this object
44
+	 *
45
+	 * @return string
46
+	 */
47
+	public function short_url()
48
+	{
49
+		return $this->getVar('short_url');
50
+	}
51 51
 
52
-    /**
53
-     * Return the value of the meta_keywords field of this object
54
-     *
55
-     * @return string
56
-     */
57
-    public function meta_keywords()
58
-    {
59
-        return $this->getVar('meta_keywords');
60
-    }
52
+	/**
53
+	 * Return the value of the meta_keywords field of this object
54
+	 *
55
+	 * @return string
56
+	 */
57
+	public function meta_keywords()
58
+	{
59
+		return $this->getVar('meta_keywords');
60
+	}
61 61
 
62
-    /**
63
-     * Return the value of the meta_description field of this object
64
-     *
65
-     * @return string
66
-     */
67
-    public function meta_description()
68
-    {
69
-        return $this->getVar('meta_description');
70
-    }
62
+	/**
63
+	 * Return the value of the meta_description field of this object
64
+	 *
65
+	 * @return string
66
+	 */
67
+	public function meta_description()
68
+	{
69
+		return $this->getVar('meta_description');
70
+	}
71 71
 }
Please login to merge, or discard this patch.
class/UrlLink.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@
 block discarded – undo
29 29
  */
30 30
 class UrlLink extends Smartobject\BaseSmartObjectBasedUrl
31 31
 {
32
-    /**
33
-     * SmartobjectUrlLink constructor.
34
-     */
35
-    public function __construct()
36
-    {
37
-        parent::__construct();
38
-        $this->quickInitVar('urllinkid', XOBJ_DTYPE_TXTBOX, true);
39
-        $this->quickInitVar('target', XOBJ_DTYPE_TXTBOX, true);
32
+	/**
33
+	 * SmartobjectUrlLink constructor.
34
+	 */
35
+	public function __construct()
36
+	{
37
+		parent::__construct();
38
+		$this->quickInitVar('urllinkid', XOBJ_DTYPE_TXTBOX, true);
39
+		$this->quickInitVar('target', XOBJ_DTYPE_TXTBOX, true);
40 40
 
41
-        $this->setControl('target', [
42
-            'options' => [
43
-                '_self'  => _CO_SOBJECT_URLLINK_SELF,
44
-                '_blank' => _CO_SOBJECT_URLLINK_BLANK
45
-            ]
46
-        ]);
47
-    }
41
+		$this->setControl('target', [
42
+			'options' => [
43
+				'_self'  => _CO_SOBJECT_URLLINK_SELF,
44
+				'_blank' => _CO_SOBJECT_URLLINK_BLANK
45
+			]
46
+		]);
47
+	}
48 48
 }
Please login to merge, or discard this patch.