From d4b663a239ad301b3e1c018c0d8fb43995c2bbde Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 15 Aug 2006 05:38:35 +0000 Subject: [PATCH] Adding visiblity indicators to functions, too --- api.php | 62 ++++++--------------- date.php | 22 ++------ db.php | 78 +++++++------------------- db_mysql.php | 46 ++++------------ db_mysqli.php | 26 +++------ db_postgresql.php | 50 +++++------------ functions.php | 62 ++++++--------------- graph_pie.php | 30 +++------- kernel.php | 110 ++++++++++--------------------------- localize.php | 18 ++---- mail.php | 30 +++------- pagination.php | 22 ++------ printer.php | 122 +++++++++++------------------------------ printer_css.php | 50 +++++------------ printer_navigation.php | 22 ++------ template.php | 46 ++++------------ template_fs.php | 18 ++---- xml.php | 38 ++++--------- 18 files changed, 222 insertions(+), 630 deletions(-) diff --git a/api.php b/api.php index fcc00e2..b728349 100644 --- a/api.php +++ b/api.php @@ -160,7 +160,7 @@ class API /** * Constructor: cannot instantiate class directly */ - function __construct(&$registry) + public function __construct(&$registry) { if (!is_subclass_of($this, 'API')) { @@ -179,11 +179,9 @@ class API /** * Constructs an error for the error handler to receive * - * @access protected - * * @param string Error message */ - function error($message) + protected function error($message) { $this->errors[] = $message; @@ -207,11 +205,9 @@ class API * with the error system. It will return an empty array if there are * no errors. * - * @access public - * * @return array Array of errors */ - function check_errors() + public function check_errors() { if (sizeof($this->errors) < 1) { @@ -225,14 +221,12 @@ class API /** * Sets a value, sanitizes it, and verifies it * - * @access public - * * @param string Field name * @param mixed Value * @param bool Do clean? * @param bool Do verify? */ - function set($field, $value, $doclean = true, $doverify = true) + public function set($field, $value, $doclean = true, $doverify = true) { if (!isset($this->fields["$field"])) { @@ -274,11 +268,9 @@ class API * Sets the condition to use in the WHERE clause; if not passed, then * it calculates it from the REQ_AUTO field * - * @access public - * * @param mixed String with WHERE condition; array of fields to use for WHERE builder */ - function set_condition($condition = '') + public function set_condition($condition = '') { if (is_array($condition) AND sizeof($condition) > 0) { @@ -326,10 +318,8 @@ class API // ################################################################### /** * Sets existing data into $values where it's not already present - * - * @access public */ - function set_existing() + public function set_existing() { static $run; if ($run) @@ -355,10 +345,8 @@ class API * Fetches a record based on the condition * * @param bool Populate $this->values[] with data, along with $this->objdata[] ? - * - * @access public */ - function fetch($populate = false) + public function fetch($populate = false) { if ($this->condition == '') { @@ -395,10 +383,8 @@ class API // ################################################################### /** * Inserts a record in the database - * - * @access public */ - function insert() + public function insert() { $this->verify(); @@ -436,10 +422,8 @@ class API // ################################################################### /** * Updates a record in the database using the data in $vaues - * - * @access public */ - function update() + public function update() { if ($this->condition == '') { @@ -463,11 +447,9 @@ class API /** * Deletes a record * - * @access public - * * @param bool Run API->set_existing()? */ - function delete($runset = true) + public function delete($runset = true) { if ($this->condition == '') { @@ -489,10 +471,8 @@ class API // ################################################################### /** * Verifies that all required fields are set - * - * @access private */ - function verify() + private function verify() { foreach ($this->fields AS $name => $options) { @@ -514,11 +494,9 @@ class API /** * Runs a pre- or post-action method for database commands * - * @access private - * * @param string Action to run */ - function run_action_method($method) + private function run_action_method($method) { if (in_array($method, $this->norunners)) { @@ -533,11 +511,9 @@ class API * Determines if it's safe to run a relation; if so, it will return * the WHERE SQL clause * - * @access public - * * @param string Operation to run */ - function call_relations($method) + public function call_relations($method) { if (!is_array($this->dorelations) OR !in_array($method, $this->dorelations)) { @@ -571,13 +547,11 @@ class API * Prepares a value for use in a SQL query; it encases and escapes * strings and string-like values * - * @access private - * * @param string Field name * * @return string Prepared value entry */ - function prepare_field_for_sql($name) + private function prepare_field_for_sql($name) { $type = $this->fields["$name"][F_TYPE]; @@ -602,10 +576,8 @@ class API // ################################################################### /** * Verify field: not a zero value - * - * @access protected */ - function verify_nozero($field) + protected function verify_nozero($field) { if ($this->values["$field"] == 0) { @@ -618,10 +590,8 @@ class API // ################################################################### /** * Verify field: not empty - * - * @access protected */ - function verify_noempty($field) + protected function verify_noempty($field) { if (empty($this->values["$field"])) { diff --git a/date.php b/date.php index 9be597e..27e4cf6 100644 --- a/date.php +++ b/date.php @@ -88,7 +88,7 @@ class Date /** * Constructor: sets the server's timezone */ - function __construct(&$registry) + public function __construct(&$registry) { $this->registry =& $registry; @@ -99,12 +99,10 @@ class Date /** * Sets an ISSO field * - * @access public - * * @param string Field name * @param mixed Value of the field */ - function set($name, $value) + public function set($name, $value) { $this->registry->do_set($name, $value, 'date'); } @@ -113,13 +111,11 @@ class Date /** * Gets an ISSO field * - * @access public - * * @param string Field name * * @return mixed Value of the field */ - function get($fieldname) + public function get($fieldname) { return $this->registry->do_get($fieldname, 'date'); } @@ -128,10 +124,8 @@ class Date /** * Computes the total offset, taking into account all the various * options - * - * @access public */ - function fetch_offset() + public function fetch_offset() { $this->offsettz = $this->servertz - $this->usertz; $this->offset = $this->offsettz * 3600; @@ -142,15 +136,13 @@ class Date * Formats a UNIX timestamp to a certain date format in the proper time * zone * - * @access public - * * @param string Format of the date (same as PHP's date() function) * @param integer UNIX timestamp to format * @param bool Adjust the date to the user's language? * * @return string Formatted date */ - function format($format, $timestamp = TIMENOW, $adjust = true) + public function format($format, $timestamp = TIMENOW, $adjust = true) { if ($adjust) { @@ -164,11 +156,9 @@ class Date /** * Fetches an array of timezones for a \n"; } @@ -585,10 +551,8 @@ JS; // ################################################################### /** * Closes a
tag - * - * @access public */ - function form_end() + public function form_end() { echo "
\n\n"; } @@ -600,14 +564,12 @@ JS; * Creates a table row that spans an entire row; this is used to divide * sections, usually * - * @access public - * * @param string Text to place in the row * @param string Class name to style with; by default it alternates between alt1 and alt2 (use :swap: to do that) * @param string Alignment of the text in the row * @param integer Colspan attribute */ - function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2) + public function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2) { if ($class === ':swap:') { @@ -638,11 +600,9 @@ JS; * conjunction with table_column_head() usually; it takes an array of * values * - * @access public - * * @param array Array of values in form value => alignment key (c for center, l for left, and r for right) */ - function row_multi_item($row_array) + public function row_multi_item($row_array) { $this->registry->modules['functions']->exec_swap_bg(); @@ -683,15 +643,13 @@ JS; * this is used for many other form functions, but can also be used for * non-editable fields * - * @access public - * * @param string Label text * @param string HTML or text to place in the value column * @param string Vertical align (valign attribute) for the row * @param integer Colspan attribute * @param string Class to style the row with; default is to alternate */ - function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1) + public function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1) { global $IS_SETTINGS; @@ -723,8 +681,6 @@ JS; /** * Creates a table row with an text field as the value column * - * @access public - * * @param string Label text * @param string Name of the field * @param string Value of the field @@ -734,7 +690,7 @@ JS; * @param bool Whether to make this a password field * @param string Vertical align (valign attribute) */ - function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top') + public function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top') { $this->row_text($label, "", $lalign, $colspan); } @@ -743,8 +699,6 @@ JS; /** * Creates a table row with a ", 'top', $colspan); } @@ -763,12 +717,10 @@ JS; /** * Creates a table row with the tfoot class * - * @access public - * * @param string Extra text or HTML to insert into the row * @param integer Colspan attribute */ - function row_tfoot($data, $colspan = 2) + public function row_tfoot($data, $colspan = 2) { echo $this->row_span($data, 'tfoot', 'center', $colspan); } @@ -777,14 +729,12 @@ JS; /** * Creates a tfoot table row with submit buttons * - * @access public - * * @param string Extra HTML to imbed in the row after the buttons * @param string Submit button text (by default it uses pre-translated "Submit" from :save:) * @param string Reset button text (default it uses pre-translated "Reset" from :reset:) * @param integer Colspan attribute */ - function row_submit($extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2) + public function row_submit($extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2) { if ($submit === ':save:') { @@ -816,13 +766,11 @@ JS; * Creates an upload row; you need to specify some other paramaters in * form_start() for this to work * - * @access public - * * @param string Label text * @param string Upload name * @param integer Colspan attribute */ - function row_upload($label, $name, $colspan = 2) + public function row_upload($label, $name, $colspan = 2) { $this->row_text($label, "", 'top', $colspan); } @@ -832,13 +780,11 @@ JS; * Adds a name-value pair to an array that is constructed into a * table row from list_item() items * - * @access public - * * @param string Label text * @param string Name of the s * @param integer Colspan attribute */ - function row_checkbox($label, $name, $colspan = 2) + public function row_checkbox($label, $name, $colspan = 2) { global $listitem; @@ -898,14 +840,12 @@ JS; /** * Creates a row with two radio buttons: yes and now * - * @access public - * * @param string Label text * @param string Name of the BOOL flag * @param bool TRUE to select the YES by default; FALSE for NO * @param integer Colspan attribute */ - function row_yesno($label, $name, $value, $colspan = 2) + public function row_yesno($label, $name, $value, $colspan = 2) { $this->row_text($label, " " . $this->registry->modules['localize']->string('Yes') . " " . $this->registry->modules['localize']->string('No'), $colspan); } diff --git a/printer_css.php b/printer_css.php index 2190be6..6850c80 100644 --- a/printer_css.php +++ b/printer_css.php @@ -99,7 +99,7 @@ class Printer_CSS /** * Constructor */ - function __construct(&$registry) + public function __construct(&$registry) { $this->registry =& $registry; } @@ -108,12 +108,10 @@ class Printer_CSS /** * Sets an ISSO field * - * @access public - * * @param string Field name * @param mixed Value of the field */ - function set($name, $value) + public function set($name, $value) { $this->registry->do_set($name, $value, 'printer_css'); } @@ -122,13 +120,11 @@ class Printer_CSS /** * Gets an ISSO field * - * @access public - * * @param string Field name * * @return mixed Value of the field */ - function get($fieldname) + public function get($fieldname) { return $this->registry->do_get($fieldname, 'printer_css'); } @@ -137,13 +133,11 @@ class Printer_CSS /** * Adds a CSS information block to the array for later use * - * @access public - * * @param string Block title to display in thead * @param string CSS class/descriptor/element name * @param bool Show the link CSS information */ - function add_block($title, $descriptor, $dolink) + public function add_block($title, $descriptor, $dolink) { if (isset($this->descriptors["$descriptor"])) { @@ -162,13 +156,11 @@ class Printer_CSS /** * Sets a master data key for a given descriptor and property * - * @access public - * * @param string Descriptor * @param string Property * @param string Value */ - function set_master_data($descriptor, $property, $value) + public function set_master_data($descriptor, $property, $value) { $this->masterdata["$descriptor"]["$property"] = $value; } @@ -177,13 +169,11 @@ class Printer_CSS /** * Sets a custom data key for a given descriptor and property * - * @access public - * * @param string Descriptor * @param string Property * @param string Value */ - function set_custom_data($descriptor, $property, $value) + public function set_custom_data($descriptor, $property, $value) { $this->customdata["$descriptor"]["$property"] = $value; } @@ -192,10 +182,8 @@ class Printer_CSS /** * Generates the HTML needed to output the CSS editing blocks; this is * done in the form of using ISSO.Printer - * - * @access public */ - function generate_blocks() + public function generate_blocks() { $print =& $this->registry->modules['printer']; @@ -372,14 +360,12 @@ class Printer_CSS * Returns the value of a given descriptor and property by comparing * the mater set and custom set then returning the right one * - * @access private - * * @param string Descriptor * @param string Property * * @return string Value of the given property */ - function fetch_value($descriptor, $property) + private function fetch_value($descriptor, $property) { if (!isset($this->customdata["$descriptor"]["$property"])) { @@ -397,14 +383,12 @@ class Printer_CSS * for modified) from the descriptor-property value between the master * set and the custom set of data * - * @access private - * * @param string Descriptor * @param string Property * * @return bool Modified from the master value? */ - function fetch_modified_status($descriptor, $property) + private function fetch_modified_status($descriptor, $property) { if ($this->masterdata["$descriptor"]["$property"] != $this->customdata["$descriptor"]["$property"] AND isset($this->customdata["$descriptor"]["$property"])) { @@ -419,15 +403,13 @@ class Printer_CSS * Fetches a link that shows a revert link for a given property * that uses AJAX to revert when clicked * - * @access private - * * @param string Descriptor * @param string Property * @param string Nominalized text * * @return string Output HTML */ - function fetch_modified_link($descriptor, $property, $name) + private function fetch_modified_link($descriptor, $property, $name) { $status = $this->fetch_modified_status($descriptor, $property); @@ -461,13 +443,11 @@ class Printer_CSS * %5$s - value field * %6$d - Styleid value * - * @access public - * * @param array Array of user-inputted information to be transformed into queries * * @return array Queries that need to be evaluated then ran */ - function generate_change_query($data) + public function generate_change_query($data) { $queries[0] = '--- RESERVED FOR LATER USE ---'; @@ -527,13 +507,11 @@ class Printer_CSS /** * Wrapper for $this->registry->modules[ISSO_DB_LAYER]->escape_string() * - * @access private - * * @param string Unprotected string * * @return string Sanitized string */ - function escape($string) + private function escape($string) { return $this->registry->modules[ISSO_DB_LAYER]->escape_string($string); } @@ -543,11 +521,9 @@ class Printer_CSS * Generates a linkable/usable CSS stylehseet content file; this can * be outputted to the browser * - * @access public - * * @return string CSS output */ - function generate_css_output() + public function generate_css_output() { $data = array(); diff --git a/printer_navigation.php b/printer_navigation.php index 25f65f5..5a18db2 100644 --- a/printer_navigation.php +++ b/printer_navigation.php @@ -82,7 +82,7 @@ class Printer_Navigation /** * Constructor */ - function __construct(&$registry) + public function __construct(&$registry) { $this->registry =& $registry; } @@ -91,12 +91,10 @@ class Printer_Navigation /** * Adds a global link to the array; these cannot be removed once added * - * @access public - * * @param string Link text * @param string HREF of the URL */ - function add_top_link($text, $href) + public function add_top_link($text, $href) { $this->toplinks["$href"] = $text; } @@ -116,15 +114,13 @@ class Printer_Navigation * * Note that the portion in brackets is called the "scope" * - * @access public - * * @param string Scope to add to * @param string Unique key for the scope * @param string Parent key to add to * @param string Text to display (usually localized) * @param string URL to go to when text is clicked */ - function add_component($scope, $key, $parent, $text, $url) + public function add_component($scope, $key, $parent, $text, $url) { if ($scope == 'tab') { @@ -144,13 +140,11 @@ class Printer_Navigation /** * Sets the focus for either a tab or link * - * @access public - * * @param string Scope operator * @param string Unique key in scope * @param string Parent operator (links only) */ - function set_focus($scope, $key, $parent) + public function set_focus($scope, $key, $parent) { if ($scope == 'tab') { @@ -185,11 +179,9 @@ class Printer_Navigation * Generates the header HTML that is called in ISSO.Printer->page_start() * to setup the navigation frame * - * @access public - * * @return string Generated HTML content */ - function generate_header_html() + public function generate_header_html() { $output = '' . "\n\n"; @@ -260,11 +252,9 @@ class Printer_Navigation * Generates the HTML that is inserted in ISSO.Printer->page_end() that * closes all of the navigation HTML stuff * - * @access public - * * @return string Generated HTML content */ - function generate_footer_html() + public function generate_footer_html() { $output = ''; diff --git a/template.php b/template.php index e920098..4f3e289 100644 --- a/template.php +++ b/template.php @@ -134,7 +134,7 @@ class Template /** * Constructor */ - function __construct(&$registry) + public function __construct(&$registry) { $this->registry =& $registry; } @@ -143,11 +143,9 @@ class Template /** * Initializes the class and all subclasses under a common package name * - * @access protected - * * @return string The package name */ - function init_as_package() + protected function init_as_package() { return 'template'; } @@ -156,12 +154,10 @@ class Template /** * Sets an ISSO field * - * @access public - * * @param string Field name * @param mixed Value of the field */ - function set($name, $value) + public function set($name, $value) { $this->registry->do_set($name, $value, 'template'); } @@ -170,13 +166,11 @@ class Template /** * Gets an ISSO field * - * @access public - * * @param string Field name * * @return mixed Value of the field */ - function get($fieldname) + public function get($fieldname) { return $this->registry->do_get($fieldname, 'template'); } @@ -186,11 +180,9 @@ class Template * Takes an array of template names, loads them, and then stores a * parsed version for optimum speed. * - * @access public - * * @param array List of template names to be cached */ - function cache($namearray) + public function cache($namearray) { if (sizeof($this->cache) > 0) { @@ -212,13 +204,11 @@ class Template * Loads a template from the cache or the _load function and stores the * parsed version of it * - * @access public - * * @param string The name of the template * * @return string A parsed and loaded template */ - function fetch($name) + public function fetch($name) { if (isset($this->cache["$name"])) { @@ -246,11 +236,9 @@ class Template /** * Output a template fully compiled to the browser * - * @access public - * * @param string Compiled and ready template */ - function flush($template) + public function flush($template) { ob_start(); @@ -287,13 +275,11 @@ class Template /** * Loads an additional template from the database * - * @access private - * * @param string The name of the template * * @return string Template data from the database */ - function _load($name) + private function _load($name) { if ($template = $this->registry->modules[ISSO_DB_LAYER]->query_first("SELECT * FROM " . $this->tablename . " WHERE " . $this->namecolumn . " = '$name'" . ($this->extrawhere ? ' ' . $this->extrawhere : ''))) { @@ -310,13 +296,11 @@ class Template /** * A wrapper for all the parsing functions and compiling functins * - * @access protected - * * @param string Unparsed template data * * @return string Parsed template data */ - function _parse($template) + protected function _parse($template) { $this->registry->check_isso_fields(get_class($this)); @@ -336,13 +320,11 @@ class Template /** * Prepares language and locale information inside templates * - * @access private - * * @param string Template data to be processed * * @return string Language-ready template data */ - function _parse_phrases($template) + private function _parse_phrases($template) { $tag_start = 'langcall . '(\'' . str_replace(array('\\\"', "'"), array('"', "\'"), $text) . '\') . "'; } @@ -432,13 +412,11 @@ class Template /** * Parser for in-line template conditionals * - * @access private - * * @param string Template data awaiting processing * * @return string Parsed template data */ - function _parse_conditionals($template) + private function _parse_conditionals($template) { // tag data $tag_start = 'registry =& $registry; } @@ -77,12 +77,10 @@ class Template_FS extends Template /** * Sets an ISSO field * - * @access public - * * @param string Field name * @param mixed Value of the field */ - function set($name, $value) + public function set($name, $value) { $this->registry->do_set($name, $value, 'template_fs'); } @@ -91,13 +89,11 @@ class Template_FS extends Template /** * Gets an ISSO field * - * @access public - * * @param string Field name * * @return mixed Value of the field */ - function get($fieldname) + public function get($fieldname) { return $this->do_get($fieldname, 'template_fs'); } @@ -107,11 +103,9 @@ class Template_FS extends Template * Takes an array of template names, loads them, and then stores a * parsed version for optimum speed. * - * @access public - * * @param array List of template names to be cached */ - function cache($namearray) + public function cache($namearray) { if (sizeof($this->cache) > 0) { @@ -134,11 +128,9 @@ class Template_FS extends Template * Loads a template from the file system from the specified * $templatedir with the file extension $extension * - * @access private - * * @param string The name of the template call */ - function _load($name) + private function _load($name) { $this->registry->check_isso_fields(get_class($this)); diff --git a/xml.php b/xml.php index 5b0e1cf..39522b0 100644 --- a/xml.php +++ b/xml.php @@ -93,7 +93,7 @@ class XML /** * Constructor */ - function __construct(&$registry) + public function __construct(&$registry) { $this->registry =& $registry; } @@ -102,12 +102,10 @@ class XML /** * Sets an ISSO field * - * @access public - * * @param string Field name * @param mixed Value of the field */ - function set($name, $value) + public function set($name, $value) { $this->registry->do_set($name, $value, 'xml'); } @@ -116,13 +114,11 @@ class XML /** * Gets an ISSO field * - * @access public - * * @param string Field name * * @return mixed Value of the field */ - function get($fieldname) + public function get($fieldname) { return $this->registry->do_get($fieldname, 'xml'); } @@ -131,14 +127,12 @@ class XML /** * Parse an XML file * - * @access public - * * @param string XML file data * @param string Parse file as UTF-8 instead of ISSO-8859-1 * * @return array Array with all the XML data parsed */ - function parse($data, $utf8 = false) + public function parse($data, $utf8 = false) { $this->registry->check_isso_fields(get_class($this)); @@ -187,13 +181,11 @@ class XML /** * Process the opening location of an XML tag * - * @access private - * * @param integer XML parser * @param string Tag name * @param array Tag attributes */ - function handle_tag_start(&$parser, $name, $attrs) + private function handle_tag_start(&$parser, $name, $attrs) { // we need to keep track of indicies to monitor the last key in $this->attribs static $index; @@ -230,12 +222,10 @@ class XML /** * Process XML CDATA * - * @access private - * * @param integer XML parser * @param string CDATA from tag */ - function handle_cdata(&$parser, $data) + private function handle_cdata(&$parser, $data) { $this->cdata .= $data; } @@ -244,12 +234,10 @@ class XML /** * Process the closing of an XML tag * - * @access private - * * @param integer XML parser * @param string Tag name */ - function handle_tag_end(&$parser, $name) + private function handle_tag_end(&$parser, $name) { // attach data to the node if (($this->cdata = trim($this->cdata)) != '') @@ -281,11 +269,9 @@ class XML /** * Shifts the node tree * - * @access private - * * @param array Node to place into the stack */ - function attach_node(&$node) + private function attach_node(&$node) { // create a new node $this->stack[ sizeof($this->stack) ] =& $node; @@ -297,10 +283,8 @@ class XML // ################################################################### /** * Unshifts the node tree - * - * @access private */ - function detach_node() + private function detach_node() { // drop the newest node unset($this->stack[ sizeof($this->stack) - 1 ]); @@ -318,11 +302,9 @@ class XML * you want the node unified (as in, all single-children would be indexed * numerically, run this function on the node. It works on references. * - * @access public - * * @param array The node to int-index */ - function unify_node(&$node) + public function unify_node(&$node) { if (!isset($node[0])) { -- 2.22.5