[ticket/10752] More fixes for acp_styles

Fixing return doc blocks, spacing, incorrect sorting function and other minor fixes

PHPBB3-10752
This commit is contained in:
Vjacheslav Trushkin 2012-04-03 00:19:16 +03:00
parent e558a3cb05
commit a46b5480e1

View file

@ -377,7 +377,7 @@ class acp_styles
// Get all styles // Get all styles
$styles = $this->get_styles(); $styles = $this->get_styles();
usort($styles, 'acp_styles::sort_styles'); usort($styles, array($this, 'sort_styles'));
// Find current style // Find current style
$style = false; $style = false;
@ -485,7 +485,7 @@ class acp_styles
{ {
// Update styles tree // Update styles tree
$styles = $this->get_styles(); $styles = $this->get_styles();
if ($this->update_styles_tree(&$styles, $style)) if ($this->update_styles_tree($styles, $style))
{ {
// Something was changed in styles tree, purge all cache // Something was changed in styles tree, purge all cache
$this->cache->purge(); $this->cache->purge();
@ -550,7 +550,7 @@ class acp_styles
trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
usort($styles, 'acp_styles::sort_styles'); usort($styles, array($this, 'sort_styles'));
// Get users // Get users
$users = $this->get_users(); $users = $this->get_users();
@ -616,7 +616,7 @@ class acp_styles
trigger_error($this->user->lang['NO_UNINSTALLED_STYLE'] . adm_back_link($this->u_base_action), E_USER_NOTICE); trigger_error($this->user->lang['NO_UNINSTALLED_STYLE'] . adm_back_link($this->u_base_action), E_USER_NOTICE);
} }
usort($styles, 'acp_styles::sort_styles'); usort($styles, array($this, 'sort_styles'));
$this->styles_list_cols = 3; $this->styles_list_cols = 3;
$this->template->assign_vars(array( $this->template->assign_vars(array(
@ -653,7 +653,7 @@ class acp_styles
{ {
if (empty($style['_shown'])) if (empty($style['_shown']))
{ {
$this->list_style(&$style, 0); $this->list_style($style, 0);
} }
} }
@ -672,7 +672,7 @@ class acp_styles
* Find styles available for installation * Find styles available for installation
* *
* @param bool $all if true, function will return all installable styles. if false, function will return only styles that can be installed * @param bool $all if true, function will return all installable styles. if false, function will return only styles that can be installed
* @returns array list of styles * @return array List of styles
*/ */
function find_available($all) function find_available($all)
{ {
@ -799,7 +799,7 @@ class acp_styles
* *
* @param array $styles Styles list, passed as reference * @param array $styles Styles list, passed as reference
* @param array $style Current style, false if root * @param array $style Current style, false if root
* @returns true if something was updated, false if not * @return bool True if something was updated, false if not
*/ */
function update_styles_tree(&$styles, $style = false) function update_styles_tree(&$styles, $style = false)
{ {
@ -837,7 +837,7 @@ class acp_styles
* @param int $id id of style * @param int $id id of style
* @param int $parent current parent style id * @param int $parent current parent style id
* @param int $level current tree level * @param int $level current tree level
* @returns array of style ids, names and levels * @return array Style ids, names and levels
*/ */
function find_possible_parents($styles, $id = -1, $parent = 0, $level = 0) function find_possible_parents($styles, $id = -1, $parent = 0, $level = 0)
{ {
@ -994,7 +994,7 @@ class acp_styles
/** /**
* Find all directories that have styles * Find all directories that have styles
* *
* @returns array of directory names * @return array Directory names
*/ */
function find_style_dirs() function find_style_dirs()
{ {
@ -1042,8 +1042,7 @@ class acp_styles
* Read style configuration file * Read style configuration file
* *
* @param string $dir style directory * @param string $dir style directory
* @returns array of style data * @return array|bool Style data, false on error
* @returns false on error
*/ */
function read_style_cfg($dir) function read_style_cfg($dir)
{ {
@ -1076,7 +1075,7 @@ class acp_styles
* Install style * Install style
* *
* @param $style style data * @param $style style data
* @returns int style id * @return int Style id
*/ */
function install_style($style) function install_style($style)
{ {
@ -1109,7 +1108,7 @@ class acp_styles
/** /**
* Lists all styles * Lists all styles
* *
* @returns array of rows with styles data * @return array Rows with styles data
*/ */
function get_styles() function get_styles()
{ {
@ -1126,7 +1125,7 @@ class acp_styles
/** /**
* Count users for each style * Count users for each style
* *
* @returns array of styles in following format: [style_id] = number of users * @return array Styles in following format: [style_id] = number of users
*/ */
function get_users() function get_users()
{ {
@ -1149,7 +1148,7 @@ class acp_styles
* Uninstall style * Uninstall style
* *
* @param array $style Style data * @param array $style Style data
* @returns true on success, error message on error * @return bool|string True on success, error message on error
*/ */
function uninstall_style($style) function uninstall_style($style)
{ {
@ -1159,7 +1158,7 @@ class acp_styles
// Check if style has child styles // Check if style has child styles
$sql = 'SELECT style_id $sql = 'SELECT style_id
FROM ' . STYLES_TABLE . ' FROM ' . STYLES_TABLE . '
WHERE style_parent_id = ' . $id . " OR style_parent_tree = '" . $this->db->sql_escape($path) . "'"; WHERE style_parent_id = ' . (int) $id . " OR style_parent_tree = '" . $this->db->sql_escape($path) . "'";
$result = $this->db->sql_query($sql); $result = $this->db->sql_query($sql);
$conflict = $this->db->sql_fetchrow($result); $conflict = $this->db->sql_fetchrow($result);
@ -1188,7 +1187,7 @@ class acp_styles
* *
* @param string $path Style directory * @param string $path Style directory
* @param string $dir Directory to remove inside style's directory * @param string $dir Directory to remove inside style's directory
* @returns true on success, false on error * @return bool True on success, false on error
*/ */
function delete_style_files($path, $dir = '') function delete_style_files($path, $dir = '')
{ {
@ -1237,7 +1236,7 @@ class acp_styles
* @param string $name Variable name * @param string $name Variable name
* @param $default Default value for array: string or number * @param $default Default value for array: string or number
* @param bool $error If true, error will be triggered if list is empty * @param bool $error If true, error will be triggered if list is empty
* @returns array of items * @return array Items
*/ */
function request_vars($name, $default, $error = false) function request_vars($name, $default, $error = false)
{ {
@ -1265,7 +1264,7 @@ class acp_styles
/** /**
* Generates hardcoded bitfield * Generates hardcoded bitfield
* *
* @returns bitfield string * @return string Bitfield
*/ */
function default_bitfield() function default_bitfield()
{ {