From: samhemelryk Date: Mon, 25 May 2009 08:27:25 +0000 (+0000) Subject: lib MDL-19236 added phpdocs and copyrights X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ba21c9d4409354869b97529432f270c3cb1806b4;p=moodle.git lib MDL-19236 added phpdocs and copyrights --- diff --git a/lib/filelib.php b/lib/filelib.php index fc65e0b9f0..18d6121112 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -35,6 +35,9 @@ require_once("$CFG->libdir/packer/zip_packer.php"); /** * Given a physical path to a file, returns the URL through which it can be reached in Moodle. + * + * @global object + * @global string * @param string $path Physical path to a file * @param array $options associative array of GET variables to append to the URL * @param string $type (questionfile|rssfile|user|usergroup|httpscoursefile|coursefile) @@ -104,7 +107,9 @@ function get_file_url($path, $options=null, $type='coursefile') { /** * Encodes file serving url - * TODO: decide if we really need this + * + * @todo decide if we really need this + * @global object * @param string $urlbase * @param string $path /filearea/itemid/dir/dir/file.exe * @param bool $forcedownload @@ -139,6 +144,7 @@ function file_encode_url($urlbase, $path, $forcedownload=false, $https=false) { /** * Prepares standardised text field fro editing with Editor formslib element + * * @param object $data $database entry field * @param string $field name of data field * @param array $options various options @@ -206,6 +212,7 @@ function file_prepare_standard_editor($data, $field, array $options, $context=nu /** * Prepares editing with File manager formslib element + * * @param object $data $database entry field * @param string $field name of data field * @param array $options various options @@ -252,6 +259,7 @@ function file_postupdate_standard_editor($data, $field, array $options, $context /** * Saves text and files modified by Editor formslib element + * * @param object $data $database entry field * @param string $field name of data field * @param array $options various options @@ -281,6 +289,7 @@ function file_prepare_standard_filemanager($data, $field, array $options, $conte /** * Saves files modified by File manager formslib element + * * @param object $data $database entry field * @param string $field name of data field * @param array $options various options @@ -319,6 +328,9 @@ function file_postupdate_standard_filemanager($data, $field, array $options, $co } /** + * + * @global object + * @global object * @return int a random but available draft itemid that can be used to create a new draft * file area. */ @@ -346,6 +358,9 @@ function file_get_unused_draft_itemid() { * Initialise a draft file area from a real one by copying the files. A draft * area will be created if one does not already exist. Normally you should * get $draftitemid by calling file_get_submitted_draft_itemid('elementname'); + * + * @global object + * @global object * @param int &$draftitemid the id of the draft area to use, or 0 to create a new one, in which case this parameter is updated. * @param integer $contextid This parameter and the next two identify the file area to copy files from. * @param string $filearea helps indentify the file area. @@ -394,6 +409,8 @@ function file_prepare_draft_area(&$draftitemid, $contextid, $filearea, $itemid, /** * Convert encoded URLs in $text from the @@PLUGINFILE@@/... form to an actual URL. + * + * @global object * @param string $text The content that may contain ULRs in need of rewriting. * @param string $file The script that should be used to serve these files. pluginfile.php, draftfile.php, etc. * @param integer $contextid This parameter and the next two identify the file area to use. @@ -429,6 +446,9 @@ function file_rewrite_pluginfile_urls($text, $file, $contextid, $filearea, $item /** * Returns information about files in a draft area. + * + * @global object + * @global object * @param integer $draftitemid the draft area item id. * @return array with the following entries: * 'filecount' => number of files in the draft area. @@ -451,6 +471,7 @@ function file_get_draft_area_info($draftitemid) { /** * Returns draft area itemid for a given element. + * * @param string $elname name of formlib editor element, or a hidden form field that stores the draft area item id, etc. * @return inteter the itemid, or 0 if there is not one yet. */ @@ -468,12 +489,15 @@ function file_get_submitted_draft_itemid($elname) { /** * Saves files from a draft file area to a real one (merging the list of files). * Can rewrite URLs in some content at the same time if desired. - * @param int $draftitemid the id of the draft area to use. Normally obtained + * + * @global object + * @global object + * @param integer $draftitemid the id of the draft area to use. Normally obtained * from file_get_submitted_draft_itemid('elementname') or similar. * @param integer $contextid This parameter and the next two identify the file area to save to. * @param string $filearea indentifies the file area. * @param integer $itemid helps identifies the file area. - * @param array $optionss area options (subdirs=>false, maxfiles=-1, maxbytes=0) + * @param array $options area options (subdirs=>false, maxfiles=-1, maxbytes=0) * @param string $text some html content that needs to have embedded links rewritten * to the @@PLUGINFILE@@ form for saving in the database. * @param boolean $forcehttps force https urls. @@ -598,8 +622,9 @@ function file_save_draft_area_files($draftitemid, $contextid, $filearea, $itemid /** * Returns description of upload error + * * @param int $errorcode found in $_FILES['filename.ext']['error'] - * @return error description string, '' if ok + * @return string error description string, '' if ok */ function file_get_upload_error($errorcode) { @@ -649,6 +674,7 @@ function file_get_upload_error($errorcode) { * Fetches content of file from Internet (using proxy if defined). Uses cURL extension if present. * Due to security concerns only downloads from http(s) sources are supported. * + * @global object * @param string $url file url starting with http(s):// * @param array $headers http headers, null if none. If set, should be an * associative array of header name => value pairs. @@ -839,7 +865,7 @@ function download_file_content($url, $headers=null, $postdata=null, $fullrespons } /** - * @return List of information about file types based on extensions. + * @return array List of information about file types based on extensions. * Associative array of extension (lower-case) to associative array * from 'element name' to data. Current element names are 'type' and 'icon'. * Unknown types should use the 'xxx' entry which includes defaults. @@ -1014,6 +1040,8 @@ function get_mimetypes_array() { * Obtains information about a filetype based on its extension. Will * use a default if no information is present about that particular * extension. + * + * @global object * @param string $element Desired information (usually 'icon' * for icon filename or 'type' for MIME type) * @param string $filename Filename we're looking up @@ -1054,6 +1082,7 @@ function mimeinfo($element, $filename) { /** * Obtains information about a filetype based on the MIME type rather than * the other way around. + * * @param string $element Desired information (usually 'icon') * @param string $mimetype MIME type we're looking up * @return string Requested piece of information from array @@ -1074,6 +1103,7 @@ function mimeinfo_from_type($element, $mimetype) { /** * Get information about a filetype based on the icon file. + * * @param string $element Desired information (usually 'icon') * @param string $icon Icon file path. * @param boolean $all return all matching entries (defaults to false - last match) @@ -1103,6 +1133,7 @@ function mimeinfo_from_icon($element, $icon, $all=false) { /** * Obtains descriptions for file types (e.g. 'Microsoft Word document') from the * mimetypes.php language file. + * * @param string $mimetype MIME type (can be obtained using the mimeinfo function) * @param bool $capitalise If true, capitalises first character of result * @return string Text description @@ -1122,6 +1153,7 @@ function get_mimetype_description($mimetype,$capitalise=false) { /** * Reprot file is not found or not accessible + * * @return does not return, terminates script */ function send_file_not_found() { @@ -1133,6 +1165,8 @@ function send_file_not_found() { /** * Handles the sending of temporary file to user, download is forced. * File is deleted after abort or succesful sending. + * + * @global object * @param string $path path to file, preferably from moodledata/temp/something; or content of file itself * @param string $filename proposed file name when saving file * @param bool $path is content of file @@ -1200,6 +1234,10 @@ function send_temp_file_finished($path) { /** * Handles the sending of file data to the user's browser, including support for * byteranges etc. + * + * @global object + * @global object + * @global object * @param string $path Path of file on disk (including real filename), or actual content of file as string * @param string $filename Filename to send * @param int $lifetime Number of seconds before the file should expire from caches (default 24 hours) @@ -1414,17 +1452,20 @@ function send_file($path, $filename, $lifetime = 'default' , $filter=0, $pathiss /** * Handles the sending of file data to the user's browser, including support for * byteranges etc. + * + * @global object + * @global object + * @global object * @param object $stored_file local file object * @param int $lifetime Number of seconds before the file should expire from caches (default 24 hours) * @param int $filter 0 (default)=no filtering, 1=all files, 2=html files only * @param bool $forcedownload If true (default false), forces download of file rather than view in browser/plugin * @param string $filename Override filename - * @param string $mimetype Include to specify the MIME type; leave blank to have it guess the type from $filename * @param bool $dontdie - return control to caller afterwards. this is not recommended and only used for cleanup tasks. * if this is passed as true, ignore_user_abort is called. if you don't want your processing to continue on cancel, * you must detect this case when control is returned using connection_aborted. Please not that session is closed * and should not be reopened. - * @return no return or void, script execution stopped unless $dontdie is true + * @return void no return or void, script execution stopped unless $dontdie is true */ function send_stored_file($stored_file, $lifetime=86400 , $filter=0, $forcedownload=false, $filename=null, $dontdie=false) { global $CFG, $COURSE, $SESSION; @@ -1594,6 +1635,16 @@ function send_stored_file($stored_file, $lifetime=86400 , $filter=0, $forcedownl die; //no more chars to output!!! } +/** + * Retreievs an array of records from a CSV file and places + * them into a given table structure + * + * @global object + * @global object + * @param string $file The path to a CSV file + * @param string $table The table to retrieve columns from + * @return bool|array Returns an array of CSV records or false + */ function get_records_csv($file, $table) { global $CFG, $DB; @@ -1634,6 +1685,15 @@ function get_records_csv($file, $table) { return $rows; } +/** + * + * @global object + * @global object + * @param string $file The file to put the CSV content into + * @param array $records An array of records to write to a CSV file + * @param string $table The table to get columns from + * @return bool success + */ function put_records_csv($file, $records, $table = NULL) { global $CFG, $DB; @@ -1701,6 +1761,7 @@ function put_records_csv($file, $records, $table = NULL) { * considered an error. * * @param $location the path to remove. + * @return bool */ function fulldelete($location) { if (is_dir($location)) { @@ -1734,6 +1795,11 @@ function fulldelete($location) { /** * Send requested byterange of file. + * + * @param object $handle A file handle + * @param string $mimetype The mimetype for the output + * @param array $ranges An array of ranges to send + * @param string $filesize The size of the content if only one range is used */ function byteserving_send_file($handle, $mimetype, $ranges, $filesize) { $chunksize = 1*(1024*1024); // 1MB chunks - must be less than 2MB! @@ -1791,8 +1857,10 @@ function byteserving_send_file($handle, $mimetype, $ranges, $filesize) { /** * add includes (js and css) into uploaded files * before returning them, useful for themes and utf.js includes - * @param string text - text to search and replace - * @return string - text with added head includes + * + * @global object + * @param string $text text to search and replace + * @return string text with added head includes */ function file_modify_html_header($text) { // first look for tag @@ -1842,7 +1910,7 @@ function file_modify_html_header($text) { * RESTful cURL class * * This is a wrapper class for curl, it is quite easy to use: - * + * * $c = new curl; * // enable cache * $c = new curl(array('cache'=>true)); @@ -1857,28 +1925,40 @@ function file_modify_html_header($text) { * $html = $c->post('http://example.com/', array('q'=>'words', 'name'=>'moodle')); * // HTTP PUT Method * $html = $c->put('http://example.com/', array('file'=>'/var/www/test.txt'); + * * + * @package moodlecore * @author Dongsheng Cai - * @version 0.4 dev * @license http://www.gnu.org/copyleft/gpl.html GNU Public License */ class curl { + /** @var bool */ public $cache = false; public $proxy = false; + /** @var string */ public $version = '0.4 dev'; + /** @var array */ public $response = array(); public $header = array(); + /** @var string */ public $info; public $error; - + + /** @var array */ private $options; + /** @var string */ private $proxy_host = ''; private $proxy_auth = ''; private $proxy_type = ''; + /** @var bool */ private $debug = false; private $cookie = false; + /** + * @global object + * @param array $options + */ public function __construct($options = array()){ global $CFG; if (!function_exists('curl_init')) { @@ -1933,6 +2013,9 @@ class curl { $this->proxy = array('proxy'=>$this->proxy_host); } } + /** + * Resets the CURL options that have already been set + */ public function resetopt(){ $this->options = array(); $this->options['CURLOPT_USERAGENT'] = 'MoodleBot/1.0'; @@ -1958,10 +2041,6 @@ class curl { /** * Reset Cookie - * - * @param array $options If array is null, this function will - * reset the options to default value. - * */ public function resetcookie() { if (!empty($this->cookie)) { @@ -2032,6 +2111,9 @@ class curl { * private callback function * Formatting HTTP Response Header * + * @param mixed $ch Apparently not used + * @param string $header + * @return int The strlen of the header */ private function formatHeader($ch, $header) { @@ -2058,6 +2140,10 @@ class curl { /** * Set options for individual curl instance + * + * @param object $curl A curl handle + * @param array $options + * @return object The curl handle */ private function apply_opt($curl, $options) { // Clean up @@ -2102,13 +2188,22 @@ class curl { } return $curl; } - /* + /** * Download multiple files in parallel + * + * Calls {@link multi()} with specific download headers + * + * * $c = new curl; * $c->download(array( * array('url'=>'http://localhost/', 'file'=>fopen('a', 'wb')), * array('url'=>'http://localhost/20/', 'file'=>fopen('b', 'wb')) * )); + * + * + * @param array $requests An array of files to request + * @param array $options An array of options to set + * @return array An array of results */ public function download($requests, $options = array()) { $options['CURLOPT_BINARYTRANSFER'] = 1; @@ -2118,6 +2213,10 @@ class curl { /* * Mulit HTTP Requests * This function could run multi-requests in parallel. + * + * @param array $requests An array of files to request + * @param array $options An array of options to set + * @return array An array of results */ protected function multi($requests, $options = array()) { $count = count($requests); @@ -2150,6 +2249,10 @@ class curl { } /** * Single HTTP Request + * + * @param string $url The URL to request + * @param array $options + * @return bool */ protected function request($url, $options = array()){ // create curl instance @@ -2188,6 +2291,12 @@ class curl { /** * HTTP HEAD method + * + * @see request() + * + * @param string $url + * @param array $options + * @return bool */ public function head($url, $options = array()){ $options['CURLOPT_HTTPGET'] = 0; @@ -2198,6 +2307,11 @@ class curl { /** * HTTP POST method + * + * @param string $url + * @param array|string $params + * @param array $options + * @return bool */ public function post($url, $params = '', $options = array()){ $options['CURLOPT_POST'] = 1; @@ -2221,6 +2335,11 @@ class curl { /** * HTTP GET method + * + * @param string $url + * @param array $params + * @param array $options + * @return bool */ public function get($url, $params = array(), $options = array()){ $options['CURLOPT_HTTPGET'] = 1; @@ -2234,6 +2353,11 @@ class curl { /** * HTTP PUT method + * + * @param string $url + * @param array $params + * @param array $options + * @return bool */ public function put($url, $params = array(), $options = array()){ $file = $params['file']; @@ -2255,6 +2379,11 @@ class curl { /** * HTTP DELETE method + * + * @param string $url + * @param array $params + * @param array $options + * @return bool */ public function delete($url, $param = array(), $options = array()){ $options['CURLOPT_CUSTOMREQUEST'] = 'DELETE'; @@ -2266,6 +2395,10 @@ class curl { } /** * HTTP TRACE method + * + * @param string $url + * @param array $options + * @return bool */ public function trace($url, $options = array()){ $options['CURLOPT_CUSTOMREQUEST'] = 'TRACE'; @@ -2274,6 +2407,10 @@ class curl { } /** * HTTP OPTIONS method + * + * @param string $url + * @param array $options + * @return bool */ public function options($url, $options = array()){ $options['CURLOPT_CUSTOMREQUEST'] = 'OPTIONS'; @@ -2285,19 +2422,26 @@ class curl { /** * This class is used by cURL class, use case: * + * * $CFG->repositorycacheexpire = 120; * $CFG->curlcache = 120; * * $c = new curl(array('cache'=>true), 'module_cache'=>'repository'); * $ret = $c->get('http://www.google.com'); + * * + * @package moodlecore + * @subpackage file + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class curl_cache { + /** @var string */ public $dir = ''; /** * - * @global $CFG - * @param string @module, which module is using curl_cache + * @global object + * @param string @module which module is using curl_cache * */ function __construct($module = 'repository'){ @@ -2324,7 +2468,12 @@ class curl_cache { } /** - * TODO Document + * @todo Document this function + * + * @global object + * @global object + * @param mixed $param + * @return bool|string */ public function get($param){ global $CFG, $USER; @@ -2346,7 +2495,12 @@ class curl_cache { } /** - * TODO Document + * @todo Document this function + * + * @global object + * @global object + * @param mixed $param + * @param mixed $val */ public function set($param, $val){ global $CFG, $USER; @@ -2357,7 +2511,9 @@ class curl_cache { } /** - * TODO Document + * @todo Document this function + * + * @param int $expire The number os seconds before expiry */ public function cleanup($expire){ if($dir = opendir($this->dir)){ @@ -2374,7 +2530,8 @@ class curl_cache { /** * delete current user's cache file * - * @return null + * @global object + * @global object */ public function refresh(){ global $CFG, $USER; @@ -2391,9 +2548,19 @@ class curl_cache { } /** - * TODO Document + * @todo Document this class + * + * @package moodlecore + * @subpackage file + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class file_type_to_ext { + /** + * @todo Document this function + * @global object + * @param string $file + */ public function __construct($file = '') { global $CFG; if (empty($file)) { @@ -2406,7 +2573,9 @@ class file_type_to_ext { } /** - * TODO Document + * @todo Document this function + * @param array $parent + * @param array $types */ private function _browse_nodes($parent, $types) { $key = (string)$parent['TEXT']; @@ -2425,7 +2594,8 @@ class file_type_to_ext { } /** - * TODO Document + * @todo Document this function + * @param array $parent */ private function _select_nodes($parent){ if(isset($parent->node)) { @@ -2439,7 +2609,9 @@ class file_type_to_ext { /** - * TODO Document + * @todo Document this function + * @param array $types + * @return mixed */ public function get_file_ext($types) { $this->result = array(); diff --git a/lib/filterlib.php b/lib/filterlib.php index ac61b1819a..50a0dfc248 100644 --- a/lib/filterlib.php +++ b/lib/filterlib.php @@ -1,41 +1,35 @@ -. /** * Library functions for managing text filter plugins. * - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -/** - * The states a filter can be in, stored in the filter_active table. - */ +/** The states a filter can be in, stored in the filter_active table. */ define('TEXTFILTER_ON', 1); +/** The states a filter can be in, stored in the filter_active table. */ define('TEXTFILTER_INHERIT', 0); +/** The states a filter can be in, stored in the filter_active table. */ define('TEXTFILTER_OFF', -1); +/** The states a filter can be in, stored in the filter_active table. */ define('TEXTFILTER_DISABLED', -9999); /** @@ -44,20 +38,28 @@ define('TEXTFILTER_DISABLED', -9999); * format_text and format_string functions. * * This class is a singleton. + * + * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class filter_manager { - /** This list of active filters, by context, for filtering content. - * An array contextid => array of filter objects. */ + /** + * @var array This list of active filters, by context, for filtering content. + * An array contextid => array of filter objects. + */ protected $textfilters = array(); - /** This list of active filters, by context, for filtering strings. - * An array contextid => array of filter objects. */ + /** + * @var array This list of active filters, by context, for filtering strings. + * An array contextid => array of filter objects. + */ protected $stringfilters = array(); - /** Exploded version of $CFG->stringfilters. */ + /** @var array Exploded version of $CFG->stringfilters. */ protected $stringfilternames = array(); - /** Holds the singleton instance. */ + /** @var object Holds the singleton instance. */ protected static $singletoninstance; protected function __construct() { @@ -65,7 +67,8 @@ class filter_manager { } /** - * @return the singleton instance. + * @global object + * @return object the singleton instance. */ public static function instance() { if (is_null(self::$singletoninstance)) { @@ -79,7 +82,12 @@ class filter_manager { return self::$singletoninstance; } - /** Load all the filters required by this context. */ + /** + * Load all the filters required by this context. + * + * @param object $context + * @param int $courseid + */ protected function load_filters($context, $courseid) { $filters = filter_get_active_in_context($context); $this->textfilters[$context->id] = array(); @@ -97,12 +105,14 @@ class filter_manager { } /** - * Factory method for creating a filter. + * Factory method for creating a filter + * + * @global object * @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'. - * @param $context context object. - * @param $courseid course if. - * @param $localconfig array of local configuration variables for this filter. - * @return moodle_text_filter The filter, or null, if this type of filter is + * @param object $context context object. + * @param int $courseid course id. + * @param array $localconfig array of local configuration variables for this filter. + * @return object moodle_text_filter The filter, or null, if this type of filter is * not recognised or could not be created. */ protected function make_filter_object($filtername, $context, $courseid, $localconfig) { @@ -126,6 +136,12 @@ class filter_manager { return null; } + /** + * @todo Document this function + * @param string $text + * @param array $filterchain + * @return string $text + */ protected function apply_filter_chain($text, $filterchain) { foreach ($filterchain as $filter) { $text = $filter->filter($text); @@ -133,6 +149,12 @@ class filter_manager { return $text; } + /** + * @todo Document this function + * @param object $context + * @param int $courseid + * @return object A text filter + */ protected function get_text_filters($context, $courseid) { if (!isset($this->textfilters[$context->id])) { $this->load_filters($context, $courseid); @@ -140,6 +162,12 @@ class filter_manager { return $this->textfilters[$context->id]; } + /** + * @todo Document this function + * @param object $context + * @param int $courseid + * @return object A string filter + */ protected function get_string_filters($context, $courseid) { if (!isset($this->stringfilters[$context->id])) { $this->load_filters($context, $courseid); @@ -147,6 +175,14 @@ class filter_manager { return $this->stringfilters[$context->id]; } + /** + * Filter some text + * + * @param string $text The text to filter + * @param object $context + * @param int $courseid + * @return string resulting text + */ public function filter_text($text, $context, $courseid) { $text = $this->apply_filter_chain($text, $this->get_text_filters($context, $courseid)); /// tags removed for XHTML compatibility @@ -154,10 +190,24 @@ class filter_manager { return $text; } + /** + * Filter a peice of string + * + * @param string $string The text to filter + * @param object $context + * @param int $courseid + * @return string resulting string + */ public function filter_string($string, $context, $courseid) { return $this->apply_filter_chain($string, $this->get_string_filters($context, $courseid)); } + /** + * @todo Document this function + * @param object $context + * @param int $courseid + * @return object A string filter + */ public function text_filtering_hash($context, $courseid) { $filters = $this->get_text_filters($context, $courseid); $hashes = array(); @@ -171,16 +221,31 @@ class filter_manager { /** * Filter manager subclass that does nothing. Having this simplifies the logic * of format_text, etc. + * + * @todo Document this class + * + * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class null_filter_manager { + /** + * @return string + */ public function filter_text($text, $context, $courseid) { return $text; } + /** + * @return string + */ public function filter_string($string, $context, $courseid) { return $string; } + /** + * @return string + */ public function text_filtering_hash() { return ''; } @@ -188,27 +253,56 @@ class null_filter_manager { /** * Filter manager subclass that tacks how much work it does. + * + * @todo Document this class + * + * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class performance_measuring_filter_manager extends filter_manager { + /** @var int */ protected $filterscreated = 0; protected $textsfiltered = 0; protected $stringsfiltered = 0; + /** + * @param string $filtername + * @param object $context + * @param int $courseid + * @param mixed $localconfig + * @return mixed + */ protected function make_filter_object($filtername, $context, $courseid, $localconfig) { $this->filterscreated++; return parent::make_filter_object($filtername, $context, $courseid, $localconfig); } + /** + * @param string $text + * @param object $context + * @param int $courseid + * @return mixed + */ public function filter_text($text, $context, $courseid) { $this->textsfiltered++; return parent::filter_text($text, $context, $courseid); } + /** + * @param string $string + * @param object $context + * @param int $courseid + * @return mixed + */ public function filter_string($string, $context, $courseid) { $this->stringsfiltered++; return parent::filter_string($string, $context, $courseid); } + /** + * @return array + */ public function get_performance_summary() { return array(array( 'contextswithfilters' => count($this->textfilters), @@ -227,13 +321,17 @@ class performance_measuring_filter_manager extends filter_manager { /** * Base class for text filters. You just need to override this class and * implement the filter method. + * + * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class moodle_text_filter { - /** The course we are in. */ + /** @var int The course we are in. */ protected $courseid; - /** The context we are in. */ + /** @var object The context we are in. */ protected $context; - /** Any local configuration for this filter in this context. */ + /** @var object Any local configuration for this filter in this context. */ protected $localconfig; /** @@ -248,12 +346,16 @@ abstract class moodle_text_filter { $this->localconfig = $localconfig; } + /** + * @return string The class name of the current class + */ public function hash() { return __CLASS__; } /** * Override this funciton to actually implement the filtering. + * * @param $text some HTML content. * @return the HTML content after the filtering has been applied. */ @@ -263,12 +365,18 @@ abstract class moodle_text_filter { /** * moodle_text_filter implementation that encapsulates an old-style filter that * only defines a function, not a class. + * + * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class legacy_filter extends moodle_text_filter { + /** @var string */ protected $filterfunction; /** * Set any context-specific configuration for this filter. + * * @param string $filterfunction * @param object $context The current course id. * @param object $context The current context. @@ -279,27 +387,40 @@ class legacy_filter extends moodle_text_filter { $this->filterfunction = $filterfunction; } + /** + * @param string $text + * @return mixed + */ public function filter($text) { return call_user_func($this->filterfunction, $this->courseid, $text); } } -/// Define one exclusive separator that we'll use in the temp saved tags -/// keys. It must be something rare enough to avoid having matches with -/// filterobjects. MDL-18165 +/** + * Define one exclusive separator that we'll use in the temp saved tags + * keys. It must be something rare enough to avoid having matches with + * filterobjects. MDL-18165 + */ define('EXCL_SEPARATOR', '-%-'); /** * This is just a little object to define a phrase and some instructions * for how to process it. Filters can create an array of these to pass * to the filter_phrases function below. + * + * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later **/ class filterobject { + /** @var string */ var $phrase; var $hreftagbegin; var $hreftagend; + /** @var bool */ var $casesensitive; var $fullmatch; + /** @var mixed */ var $replacementphrase; var $work_phrase; var $work_hreftagbegin; @@ -307,9 +428,19 @@ class filterobject { var $work_casesensitive; var $work_fullmatch; var $work_replacementphrase; + /** @var bool */ var $work_calculated; - /// a constructor just because I like constructing + /** + * A constructor just because I like constructing + * + * @param string $phrase + * @param string $hreftagbegin + * @param string $hreftagend + * @param bool $casesensitive + * @param bool $fullmatch + * @param mixed $replacementphrase + */ function filterobject($phrase, $hreftagbegin='', $hreftagend='', $casesensitive=false, @@ -333,7 +464,7 @@ class filterobject { * else if $filterlocation = 'filter' then does get_string('filtername', 'filter_' . $filter); * with a fallback to get_string('filtername', $filter) for backwards compatibility. * These are the only two options supported at the moment. - * @param string $filterlocation 'filter' or 'mod'. + * * @param string $filter the folder name where the filter lives. * @return string the human-readable name for this filter. */ @@ -362,6 +493,8 @@ function filter_get_name($filter) { /** * Get the names of all the filters installed in this Moodle. + * + * @global object * @return array path => filter name from the appropriate lang file. e.g. * array('mod/glossary' => 'Glossary Auto-linking', 'filter/tex' => 'TeX Notation'); * sorted in alphabetical order of name. @@ -386,6 +519,8 @@ function filter_get_all_installed() { /** * Set the global activated state for a text filter. + * + * @global object * @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'. * @param integer $state One of the values TEXTFILTER_ON, TEXTFILTER_OFF or TEXTFILTER_DISABLED. * @param integer $sortorder (optional) a position in the sortorder to place this filter. @@ -479,6 +614,8 @@ function filter_is_enabled($filter) { /** * Return a list of all the filters that may be in use somewhere. + * + * @staticvar array $enabledfilters * @return array where the keys and values are both the filter name, like 'filter/tex'. */ function filter_get_globally_enabled() { @@ -498,6 +635,8 @@ function filter_get_globally_enabled() { /** * Return the names of the filters that should also be applied to strings * (when they are enabled). + * + * @global object * @return array where the keys and values are both the filter name, like 'filter/tex'. */ function filter_get_string_filters() { @@ -513,6 +652,7 @@ function filter_get_string_filters() { /** * Sets whether a particular active filter should be applied to all strings by * format_string, or just used by format_text. + * * @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'. * @param boolean $applytostrings if true, this filter will apply to format_string * and format_text, when it is enabled. @@ -533,9 +673,12 @@ function filter_set_applies_to_strings($filter, $applytostrings) { /** * Set the local activated state for a text filter. + * + * @global object * @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'. * @param integer $contextid The id of the context to get the local config for. * @param integer $state One of the values TEXTFILTER_ON, TEXTFILTER_OFF or TEXTFILTER_INHERIT. + * @return void */ function filter_set_local_state($filter, $contextid, $state) { global $DB; @@ -576,6 +719,8 @@ function filter_set_local_state($filter, $contextid, $state) { /** * Set a particular local config variable for a filter in a context. + * + * @global object * @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'. * @param integer $contextid The id of the context to get the local config for. * @param string $name the setting name. @@ -604,6 +749,8 @@ function filter_set_local_config($filter, $contextid, $name, $value) { /** * Remove a particular local config variable for a filter in a context. + * + * @global object * @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'. * @param integer $contextid The id of the context to get the local config for. * @param string $name the setting name. @@ -618,6 +765,8 @@ function filter_unset_local_config($filter, $contextid, $name) { * filter is running) you don't need to call this, becuase the config is fetched * for you automatically. You only need this, for example, when you are getting * the config so you can show the user an editing from. + * + * @global object * @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'. * @param integer $contextid The ID of the context to get the local config for. * @return array of name => value pairs. @@ -630,7 +779,10 @@ function filter_get_local_config($filter, $contextid) { /** * This function is for use by backup. Gets all the filter information specific * to one context. - * @return array with two elements. The first element is an array of objects with + * + * @global object + * @param int $contextid + * @return array Array with two elements. The first element is an array of objects with * fields filter and active. These come from the filter_active table. The * second element is an array of objects with fields filter, name and value * from the filter_config table. @@ -648,8 +800,8 @@ function filter_get_all_local_settings($contextid) { * Get the list of active filters, in the order that they should be used * for a particular context, along with any local configuration variables. * + * @global object * @param object $context a context - * * @return array an array where the keys are the filter names, for example * 'filter/tex' or 'mod/glossary' and the values are any local * configuration for that filter, as an array of name => value pairs @@ -695,6 +847,8 @@ function filter_get_active_in_context($context) { /** * List all of the filters that are available in this context, and what the * local and interited states of that filter are. + * + * @global object * @param object $context a context that is not the system context. * @return array an array with filter names, for example 'filter/tex' or * 'mod/glossary' as keys. and and the values are objects with fields: @@ -736,6 +890,8 @@ function filter_get_available_in_context($context) { /** * This function is for use by the filter administration page. + * + * @global object * @return array 'filtername' => object with fields 'filter' (=filtername), 'active' and 'sortorder' */ function filter_get_global_states() { @@ -746,6 +902,8 @@ function filter_get_global_states() { /** * Delete all the data in the database relating to a filter, prior to deleting it. + * + * @global object * @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'. */ function filter_delete_all_for_filter($filter) { @@ -759,6 +917,8 @@ function filter_delete_all_for_filter($filter) { /** * Delete all the data in the database relating to a context, used when contexts are deleted. + * + * @global object * @param integer $contextid The id of the context being deleted. */ function filter_delete_all_for_context($contextid) { @@ -772,6 +932,7 @@ function filter_delete_all_for_context($contextid) { * (The settings page for a filter must be called, for example, * filtersettingfiltertex or filtersettingmodglossay.) * + * @global object * @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'. * @return boolean Whether there should be a 'Settings' link on the config page. */ @@ -784,6 +945,7 @@ function filter_has_global_settings($filter) { /** * Does this filter have local (per-context) settings? * + * @global object * @param string $filter The filter name, for example 'filter/tex' or 'mod/glossary'. * @return boolean Whether there should be a 'Settings' link on the manage filters in context page. */ @@ -796,6 +958,7 @@ function filter_has_local_settings($filter) { /** * Certain types of context (block and user) may not have local filter settings. * the function checks a context to see whether it may have local config. + * * @param object $context a context. * @return boolean whether this context may have local filter settings. */ @@ -806,10 +969,13 @@ function filter_context_may_have_filter_settings($context) { /** * Process phrases intelligently found within a HTML text (such as adding links) * - * param text the text that we are filtering - * param link_array an array of filterobjects - * param ignoretagsopen an array of opening tags that we should ignore while filtering - * param ignoretagsclose an array of corresponding closing tags + * @global object + * @staticvar array $usedpharses + * @param string $text the text that we are filtering + * @param array $link_array an array of filterobjects + * @param array $ignoretagsopen an array of opening tags that we should ignore while filtering + * @param array $ignoretagsclose an array of corresponding closing tags + * @return string **/ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagsclose=NULL) { @@ -1005,6 +1171,11 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl return $text; } +/** + * @todo Document this function + * @param array $linkarray + * @return array + */ function filter_remove_duplicates($linkarray) { $concepts = array(); // keep a record of concepts as we cycle through @@ -1035,10 +1206,10 @@ function filter_remove_duplicates($linkarray) { * converted with some <#xEXCL_SEPARATORx#> codes replacing the extracted text. Such extracted * texts are returned in the ignoretags array (as values), with codes as keys. * - * param text the text that we are filtering (in/out) - * param filterignoretagsopen an array of open tags to start searching - * param filterignoretagsclose an array of close tags to end searching - * param ignoretags an array of saved strings useful to rebuild the original text (in/out) + * @param string $text the text that we are filtering (in/out) + * @param array $filterignoretagsopen an array of open tags to start searching + * @param array $filterignoretagsclose an array of close tags to end searching + * @param array $ignoretags an array of saved strings useful to rebuild the original text (in/out) **/ function filter_save_ignore_tags(&$text,$filterignoretagsopen,$filterignoretagsclose,&$ignoretags) { @@ -1066,8 +1237,8 @@ function filter_save_ignore_tags(&$text,$filterignoretagsopen,$filterignoretagsc * It returns the text converted with some <%xEXCL_SEPARATORx%> codes replacing the extracted text. Such extracted * texts are returned in the tags array (as values), with codes as keys. * - * param text the text that we are filtering (in/out) - * param tags an array of saved strings useful to rebuild the original text (in/out) + * @param string $text the text that we are filtering (in/out) + * @param array $tags an array of saved strings useful to rebuild the original text (in/out) **/ function filter_save_tags(&$text,&$tags) { @@ -1083,6 +1254,10 @@ function filter_save_tags(&$text,&$tags) { /** * Add missing openpopup javascript to HTML files. + * + * @global object + * @param string $text + * @return string */ function filter_add_javascript($text) { global $CFG; diff --git a/lib/flickrlib.php b/lib/flickrlib.php index a5fc7abfa1..efde966a06 100755 --- a/lib/flickrlib.php +++ b/lib/flickrlib.php @@ -1,31 +1,35 @@ - * ChangeLog: - * 1. Remove PEAR HTTP LIB, use curl.class.php (created by myself) - * 2. Remove PEAR DB LIB - * 3. Remove all cache code, it will implement in curl class. - * 4. Clean up session code - * - * @version $Id$ - * - */ -/* phpFlickr Class 2.2.0 + * phpFlickr Class 2.2.0 * Written by Dan Coulter (dan@dancoulter.com) - * Sourceforge Project Page: http://www.sourceforge.net/projects/phpflickr/ - * Released under GNU Lesser General Public License (http://www.gnu.org/copyleft/lgpl.html) + * Sourceforge Project Page: {@link http://www.sourceforge.net/projects/phpflickr/} + * Released under GNU Lesser General Public License ({@link http://www.gnu.org/copyleft/lgpl.html}) * For more information about the class and upcoming tools and toys using it, - * visit http://www.phpflickr.com/ or http://phpflickr.sourceforge.net + * visit {@link http://www.phpflickr.com/} or {@link http://phpflickr.sourceforge.net} * * For installation instructions, open the README.txt file packaged with this * class. If you don't have a copy, you can see it at: - * http://www.phpflickr.com/README.txt + * {@link http://www.phpflickr.com/README.txt} * * Please submit all problems or questions to the Help Forum on my project page: - * http://sourceforge.net/forum/forum.php?forum_id=469652 + * {@link http://sourceforge.net/forum/forum.php?forum_id=469652} + * + * Modified by Dongsheng Cai + * ChangeLog: + * 1. Remove PEAR HTTP LIB, use curl.class.php (created by myself) + * 2. Remove PEAR DB LIB + * 3. Remove all cache code, it will implement in curl class. + * 4. Clean up session code * + * @package moodlecore + * @subpackage 3rd-party */ +/** + * Flickr Class + * @package moodlecore + * @subpackage 3rd-party + */ class phpFlickr { var $api_key; var $secret; @@ -41,7 +45,7 @@ class phpFlickr { var $token; var $php_version; - /* + /** * When your database cache table hits this many rows, a cleanup * will occur to get rid of all of the old rows and cleanup the * garbage in the table. For most personal apps, 1000 rows should @@ -50,6 +54,8 @@ class phpFlickr { * You should try to set it high enough that the cleanup only * happens every once in a while, so this will depend on the growth * of your table. + * + * @global object */ function __construct ($api_key, $secret = NULL, $token = '') @@ -190,7 +196,7 @@ class phpFlickr { return $this->error_msg; } - /* These functions are front ends for the flickr calls */ + /** These functions are front ends for the flickr calls */ function buildPhotoURL ($photo, $size = "Medium") { @@ -220,7 +226,7 @@ class phpFlickr { } function getFriendlyGeodata($lat, $lon) { - /* I've added this method to get the friendly geodata (i.e. 'in New York, NY') that the + /** I've added this method to get the friendly geodata (i.e. 'in New York, NY') that the * website provides, but isn't available in the API. I'm providing this service as long * as it doesn't flood my server with requests and crash it all the time. */ @@ -241,15 +247,13 @@ class phpFlickr { return $url; } - /******************************* - - To use the phpFlickr::call method, pass a string containing the API method you want - to use and an associative array of arguments. For example: - $result = $f->call("flickr.photos.comments.getList", array("photo_id"=>'34952612')); - This method will allow you to make calls to arbitrary methods that haven't been - implemented in phpFlickr yet. - - *******************************/ + /** + * To use the phpFlickr::call method, pass a string containing the API method you want + * to use and an associative array of arguments. For example: + * $result = $f->call("flickr.photos.comments.getList", array("photo_id"=>'34952612')); + * This method will allow you to make calls to arbitrary methods that haven't been + * implemented in phpFlickr yet. + */ function call($method, $arguments) { @@ -257,98 +261,98 @@ class phpFlickr { return $this->parsed_response ? $this->parsed_response : false; } - /* - These functions are the direct implementations of flickr calls. - For method documentation, including arguments, visit the address - included in a comment in the function. + /** + * These functions are the direct implementations of flickr calls. + * For method documentation, including arguments, visit the address + * included in a comment in the function. */ - /* Activity methods */ + /** Activity methods */ function activity_userComments ($per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.activity.userComments.html */ + /** http://www.flickr.com/services/api/flickr.activity.userComments.html */ $this->request('flickr.activity.userComments', array("per_page" => $per_page, "page" => $page)); return $this->parsed_response ? $this->parsed_response['items']['item'] : false; } function activity_userPhotos ($timeframe = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.activity.userPhotos.html */ + /** http://www.flickr.com/services/api/flickr.activity.userPhotos.html */ $this->request('flickr.activity.userPhotos', array("timeframe" => $timeframe, "per_page" => $per_page, "page" => $page)); return $this->parsed_response ? $this->parsed_response['items']['item'] : false; } - /* Authentication methods */ + /** Authentication methods */ function auth_checkToken () { - /* http://www.flickr.com/services/api/flickr.auth.checkToken.html */ + /** http://www.flickr.com/services/api/flickr.auth.checkToken.html */ $this->request('flickr.auth.checkToken'); return $this->parsed_response ? $this->parsed_response['auth'] : false; } function auth_getFrob () { - /* http://www.flickr.com/services/api/flickr.auth.getFrob.html */ + /** http://www.flickr.com/services/api/flickr.auth.getFrob.html */ $this->request('flickr.auth.getFrob'); return $this->parsed_response ? $this->parsed_response['frob'] : false; } function auth_getFullToken ($mini_token) { - /* http://www.flickr.com/services/api/flickr.auth.getFullToken.html */ + /** http://www.flickr.com/services/api/flickr.auth.getFullToken.html */ $this->request('flickr.auth.getFullToken', array('mini_token'=>$mini_token)); return $this->parsed_response ? $this->parsed_response['auth'] : false; } function auth_getToken ($frob) { - /* http://www.flickr.com/services/api/flickr.auth.getToken.html */ + /** http://www.flickr.com/services/api/flickr.auth.getToken.html */ $this->request('flickr.auth.getToken', array('frob'=>$frob)); $this->token = $this->parsed_response['auth']['token']; return $this->parsed_response ? $this->parsed_response['auth'] : false; } - /* Blogs methods */ + /** Blogs methods */ function blogs_getList () { - /* http://www.flickr.com/services/api/flickr.blogs.getList.html */ + /** http://www.flickr.com/services/api/flickr.blogs.getList.html */ $this->request('flickr.blogs.getList'); return $this->parsed_response ? $this->parsed_response['blogs']['blog'] : false; } function blogs_postPhoto($blog_id, $photo_id, $title, $description, $blog_password = NULL) { - /* http://www.flickr.com/services/api/flickr.blogs.postPhoto.html */ + /** http://www.flickr.com/services/api/flickr.blogs.postPhoto.html */ $this->request('flickr.blogs.postPhoto', array('blog_id'=>$blog_id, 'photo_id'=>$photo_id, 'title'=>$title, 'description'=>$description, 'blog_password'=>$blog_password), TRUE); return $this->parsed_response ? true : false; } - /* Contacts Methods */ + /** Contacts Methods */ function contacts_getList ($filter = NULL, $page = NULL, $per_page = NULL) { - /* http://www.flickr.com/services/api/flickr.contacts.getList.html */ + /** http://www.flickr.com/services/api/flickr.contacts.getList.html */ $this->request('flickr.contacts.getList', array('filter'=>$filter, 'page'=>$page, 'per_page'=>$per_page)); return $this->parsed_response ? $this->parsed_response['contacts'] : false; } function contacts_getPublicList($user_id, $page = NULL, $per_page = NULL) { - /* http://www.flickr.com/services/api/flickr.contacts.getPublicList.html */ + /** http://www.flickr.com/services/api/flickr.contacts.getPublicList.html */ $this->request('flickr.contacts.getPublicList', array('user_id'=>$user_id, 'page'=>$page, 'per_page'=>$per_page)); return $this->parsed_response ? $this->parsed_response['contacts'] : false; } - /* Favorites Methods */ + /** Favorites Methods */ function favorites_add ($photo_id) { - /* http://www.flickr.com/services/api/flickr.favorites.add.html */ + /** http://www.flickr.com/services/api/flickr.favorites.add.html */ $this->request('flickr.favorites.add', array('photo_id'=>$photo_id), TRUE); return $this->parsed_response ? true : false; } function favorites_getList($user_id = NULL, $extras = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.favorites.getList.html */ + /** http://www.flickr.com/services/api/flickr.favorites.getList.html */ if (is_array($extras)) { $extras = implode(",", $extras); } $this->request("flickr.favorites.getList", array("user_id"=>$user_id, "extras"=>$extras, "per_page"=>$per_page, "page"=>$page)); return $this->parsed_response ? $this->parsed_response['photos'] : false; @@ -356,7 +360,7 @@ class phpFlickr { function favorites_getPublicList($user_id = NULL, $extras = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.favorites.getPublicList.html */ + /** http://www.flickr.com/services/api/flickr.favorites.getPublicList.html */ if (is_array($extras)) { $extras = implode(",", $extras); } @@ -366,58 +370,58 @@ class phpFlickr { function favorites_remove($photo_id) { - /* http://www.flickr.com/services/api/flickr.favorites.remove.html */ + /** http://www.flickr.com/services/api/flickr.favorites.remove.html */ $this->request("flickr.favorites.remove", array("photo_id"=>$photo_id), TRUE); return $this->parsed_response ? true : false; } - /* Groups Methods */ + /** Groups Methods */ function groups_browse ($cat_id = NULL) { - /* http://www.flickr.com/services/api/flickr.groups.browse.html */ + /** http://www.flickr.com/services/api/flickr.groups.browse.html */ $this->request("flickr.groups.browse", array("cat_id"=>$cat_id)); return $this->parsed_response ? $this->parsed_response['category'] : false; } function groups_getInfo ($group_id) { - /* http://www.flickr.com/services/api/flickr.groups.getInfo.html */ + /** http://www.flickr.com/services/api/flickr.groups.getInfo.html */ $this->request("flickr.groups.getInfo", array("group_id"=>$group_id)); return $this->parsed_response ? $this->parsed_response['group'] : false; } function groups_search ($text, $per_page=NULL, $page=NULL) { - /* http://www.flickr.com/services/api/flickr.groups.search.html */ + /** http://www.flickr.com/services/api/flickr.groups.search.html */ $this->request("flickr.groups.search", array("text"=>$text,"per_page"=>$per_page,"page"=>$page)); return $this->parsed_response ? $this->parsed_response['groups'] : false; } - /* Groups Pools Methods */ + /** Groups Pools Methods */ function groups_pools_add ($photo_id, $group_id) { - /* http://www.flickr.com/services/api/flickr.groups.pools.add.html */ + /** http://www.flickr.com/services/api/flickr.groups.pools.add.html */ $this->request("flickr.groups.pools.add", array("photo_id"=>$photo_id, "group_id"=>$group_id), TRUE); return $this->parsed_response ? true : false; } function groups_pools_getContext ($photo_id, $group_id) { - /* http://www.flickr.com/services/api/flickr.groups.pools.getContext.html */ + /** http://www.flickr.com/services/api/flickr.groups.pools.getContext.html */ $this->request("flickr.groups.pools.getContext", array("photo_id"=>$photo_id, "group_id"=>$group_id)); return $this->parsed_response ? $this->parsed_response : false; } function groups_pools_getGroups ($page = NULL, $per_page = NULL) { - /* http://www.flickr.com/services/api/flickr.groups.pools.getGroups.html */ + /** http://www.flickr.com/services/api/flickr.groups.pools.getGroups.html */ $this->request("flickr.groups.pools.getGroups", array('page'=>$page, 'per_page'=>$per_page)); return $this->parsed_response ? $this->parsed_response['groups'] : false; } function groups_pools_getPhotos ($group_id, $tags = NULL, $user_id = NULL, $extras = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.groups.pools.getPhotos.html */ + /** http://www.flickr.com/services/api/flickr.groups.pools.getPhotos.html */ if (is_array($extras)) { $extras = implode(",", $extras); } @@ -427,15 +431,15 @@ class phpFlickr { function groups_pools_remove ($photo_id, $group_id) { - /* http://www.flickr.com/services/api/flickr.groups.pools.remove.html */ + /** http://www.flickr.com/services/api/flickr.groups.pools.remove.html */ $this->request("flickr.groups.pools.remove", array("photo_id"=>$photo_id, "group_id"=>$group_id), TRUE); return $this->parsed_response ? true : false; } - /* Interestingness methods */ + /** Interestingness methods */ function interestingness_getList($date = NULL, $extras = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.interestingness.getList.html */ + /** http://www.flickr.com/services/api/flickr.interestingness.getList.html */ if (is_array($extras)) { $extras = implode(",", $extras); } @@ -444,37 +448,37 @@ class phpFlickr { return $this->parsed_response ? $this->parsed_response['photos'] : false; } - /* People methods */ + /** People methods */ function people_findByEmail ($find_email) { - /* http://www.flickr.com/services/api/flickr.people.findByEmail.html */ + /** http://www.flickr.com/services/api/flickr.people.findByEmail.html */ $this->request("flickr.people.findByEmail", array("find_email"=>$find_email)); return $this->parsed_response ? $this->parsed_response['user'] : false; } function people_findByUsername ($username) { - /* http://www.flickr.com/services/api/flickr.people.findByUsername.html */ + /** http://www.flickr.com/services/api/flickr.people.findByUsername.html */ $this->request("flickr.people.findByUsername", array("username"=>$username)); return $this->parsed_response ? $this->parsed_response['user'] : false; } function people_getInfo($user_id) { - /* http://www.flickr.com/services/api/flickr.people.getInfo.html */ + /** http://www.flickr.com/services/api/flickr.people.getInfo.html */ $this->request("flickr.people.getInfo", array("user_id"=>$user_id)); return $this->parsed_response ? $this->parsed_response['person'] : false; } function people_getPublicGroups($user_id) { - /* http://www.flickr.com/services/api/flickr.people.getPublicGroups.html */ + /** http://www.flickr.com/services/api/flickr.people.getPublicGroups.html */ $this->request("flickr.people.getPublicGroups", array("user_id"=>$user_id)); return $this->parsed_response ? $this->parsed_response['groups']['group'] : false; } function people_getPublicPhotos($user_id, $extras = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html */ + /** http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html */ if (is_array($extras)) { $extras = implode(",", $extras); } @@ -485,87 +489,87 @@ class phpFlickr { function people_getUploadStatus() { - /* http://www.flickr.com/services/api/flickr.people.getUploadStatus.html */ - /* Requires Authentication */ + /** http://www.flickr.com/services/api/flickr.people.getUploadStatus.html */ + /** Requires Authentication */ $this->request("flickr.people.getUploadStatus"); return $this->parsed_response ? $this->parsed_response['user'] : false; } - /* Photos Methods */ + /** Photos Methods */ function photos_addTags ($photo_id, $tags) { - /* http://www.flickr.com/services/api/flickr.photos.addTags.html */ + /** http://www.flickr.com/services/api/flickr.photos.addTags.html */ $this->request("flickr.photos.addTags", array("photo_id"=>$photo_id, "tags"=>$tags), TRUE); return $this->parsed_response ? true : false; } function photos_delete($photo_id) { - /* http://www.flickr.com/services/api/flickr.photos.delete.html */ + /** http://www.flickr.com/services/api/flickr.photos.delete.html */ $this->request("flickr.photos.delete", array("photo_id"=>$photo_id), TRUE); return $this->parsed_response ? true : false; } function photos_getAllContexts ($photo_id) { - /* http://www.flickr.com/services/api/flickr.photos.getAllContexts.html */ + /** http://www.flickr.com/services/api/flickr.photos.getAllContexts.html */ $this->request("flickr.photos.getAllContexts", array("photo_id"=>$photo_id)); return $this->parsed_response ? $this->parsed_response : false; } function photos_getContactsPhotos ($count = NULL, $just_friends = NULL, $single_photo = NULL, $include_self = NULL, $extras = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html */ + /** http://www.flickr.com/services/api/flickr.photos.getContactsPhotos.html */ $this->request("flickr.photos.getContactsPhotos", array("count"=>$count, "just_friends"=>$just_friends, "single_photo"=>$single_photo, "include_self"=>$include_self, "extras"=>$extras)); return $this->parsed_response ? $this->parsed_response['photos']['photo'] : false; } function photos_getContactsPublicPhotos ($user_id, $count = NULL, $just_friends = NULL, $single_photo = NULL, $include_self = NULL, $extras = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html */ + /** http://www.flickr.com/services/api/flickr.photos.getContactsPublicPhotos.html */ $this->request("flickr.photos.getContactsPublicPhotos", array("user_id"=>$user_id, "count"=>$count, "just_friends"=>$just_friends, "single_photo"=>$single_photo, "include_self"=>$include_self, "extras"=>$extras)); return $this->parsed_response ? $this->parsed_response['photos']['photo'] : false; } function photos_getContext ($photo_id) { - /* http://www.flickr.com/services/api/flickr.photos.getContext.html */ + /** http://www.flickr.com/services/api/flickr.photos.getContext.html */ $this->request("flickr.photos.getContext", array("photo_id"=>$photo_id)); return $this->parsed_response ? $this->parsed_response : false; } function photos_getCounts ($dates = NULL, $taken_dates = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.getCounts.html */ + /** http://www.flickr.com/services/api/flickr.photos.getCounts.html */ $this->request("flickr.photos.getCounts", array("dates"=>$dates, "taken_dates"=>$taken_dates)); return $this->parsed_response ? $this->parsed_response['photocounts']['photocount'] : false; } function photos_getExif ($photo_id, $secret = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.getExif.html */ + /** http://www.flickr.com/services/api/flickr.photos.getExif.html */ $this->request("flickr.photos.getExif", array("photo_id"=>$photo_id, "secret"=>$secret)); return $this->parsed_response ? $this->parsed_response['photo'] : false; } function photos_getFavorites($photo_id, $page = NULL, $per_page = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.getFavorites.html */ + /** http://www.flickr.com/services/api/flickr.photos.getFavorites.html */ $this->request("flickr.photos.getFavorites", array("photo_id"=>$photo_id, "page"=>$page, "per_page"=>$per_page)); return $this->parsed_response ? $this->parsed_response['photo'] : false; } function photos_getInfo($photo_id, $secret = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.getInfo.html */ + /** http://www.flickr.com/services/api/flickr.photos.getInfo.html */ $this->request("flickr.photos.getInfo", array("photo_id"=>$photo_id, "secret"=>$secret)); return $this->parsed_response ? $this->parsed_response['photo'] : false; } function photos_getNotInSet($min_upload_date = NULL, $max_upload_date = NULL, $min_taken_date = NULL, $max_taken_date = NULL, $privacy_filter = NULL, $extras = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.getNotInSet.html */ + /** http://www.flickr.com/services/api/flickr.photos.getNotInSet.html */ if (is_array($extras)) { $extras = implode(",", $extras); } @@ -575,14 +579,14 @@ class phpFlickr { function photos_getPerms($photo_id) { - /* http://www.flickr.com/services/api/flickr.photos.getPerms.html */ + /** http://www.flickr.com/services/api/flickr.photos.getPerms.html */ $this->request("flickr.photos.getPerms", array("photo_id"=>$photo_id)); return $this->parsed_response ? $this->parsed_response['perms'] : false; } function photos_getRecent($extras = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.getRecent.html */ + /** http://www.flickr.com/services/api/flickr.photos.getRecent.html */ if (is_array($extras)) { $extras = implode(",", $extras); @@ -593,14 +597,14 @@ class phpFlickr { function photos_getSizes($photo_id) { - /* http://www.flickr.com/services/api/flickr.photos.getSizes.html */ + /** http://www.flickr.com/services/api/flickr.photos.getSizes.html */ $this->request("flickr.photos.getSizes", array("photo_id"=>$photo_id)); return $this->parsed_response ? $this->parsed_response['sizes']['size'] : false; } function photos_getUntagged($min_upload_date = NULL, $max_upload_date = NULL, $min_taken_date = NULL, $max_taken_date = NULL, $privacy_filter = NULL, $extras = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.getUntagged.html */ + /** http://www.flickr.com/services/api/flickr.photos.getUntagged.html */ if (is_array($extras)) { $extras = implode(",", $extras); } @@ -609,12 +613,12 @@ class phpFlickr { } function photos_getWithGeoData($args = NULL) { - /* See the documentation included with the photos_search() function. + /** See the documentation included with the photos_search() function. * I'm using the same style of arguments for this function. The only * difference here is that this doesn't require any arguments. The * flickr.photos.search method requires at least one search parameter. */ - /* http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html */ + /** http://www.flickr.com/services/api/flickr.photos.getWithGeoData.html */ if (is_null($args)) { $args = array(); } @@ -623,12 +627,12 @@ class phpFlickr { } function photos_getWithoutGeoData($args = NULL) { - /* See the documentation included with the photos_search() function. + /** See the documentation included with the photos_search() function. * I'm using the same style of arguments for this function. The only * difference here is that this doesn't require any arguments. The * flickr.photos.search method requires at least one search parameter. */ - /* http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html */ + /** http://www.flickr.com/services/api/flickr.photos.getWithoutGeoData.html */ if (is_null($args)) { $args = array(); } @@ -638,7 +642,7 @@ class phpFlickr { function photos_recentlyUpdated($min_date = NULL, $extras = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.getUntagged.html */ + /** http://www.flickr.com/services/api/flickr.photos.getUntagged.html */ if (is_array($extras)) { $extras = implode(",", $extras); } @@ -648,14 +652,14 @@ class phpFlickr { function photos_removeTag($tag_id) { - /* http://www.flickr.com/services/api/flickr.photos.removeTag.html */ + /** http://www.flickr.com/services/api/flickr.photos.removeTag.html */ $this->request("flickr.photos.removeTag", array("tag_id"=>$tag_id), TRUE); return $this->parsed_response ? true : false; } function photos_search($args) { - /* This function strays from the method of arguments that I've + /** This function strays from the method of arguments that I've * used in the other functions for the fact that there are just * so many arguments to this API method. What you'll need to do * is pass an associative array to the function containing the @@ -666,162 +670,162 @@ class phpFlickr { * list of arguments. */ - /* http://www.flickr.com/services/api/flickr.photos.search.html */ + /** http://www.flickr.com/services/api/flickr.photos.search.html */ $this->request("flickr.photos.search", $args); return $this->parsed_response ? $this->parsed_response['photos'] : false; } function photos_setContentType ($photo_id, $content_type) { - /* http://www.flickr.com/services/api/flickr.photos.setContentType.html */ + /** http://www.flickr.com/services/api/flickr.photos.setContentType.html */ return $this->call('flickr.photos.setContentType', array('photo_id' => $photo_id, 'content_type' => $content_type)); } function photos_setDates($photo_id, $date_posted = NULL, $date_taken = NULL, $date_taken_granularity = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.setDates.html */ + /** http://www.flickr.com/services/api/flickr.photos.setDates.html */ $this->request("flickr.photos.setDates", array("photo_id"=>$photo_id, "date_posted"=>$date_posted, "date_taken"=>$date_taken, "date_taken_granularity"=>$date_taken_granularity), TRUE); return $this->parsed_response ? true : false; } function photos_setMeta($photo_id, $title, $description) { - /* http://www.flickr.com/services/api/flickr.photos.setMeta.html */ + /** http://www.flickr.com/services/api/flickr.photos.setMeta.html */ $this->request("flickr.photos.setMeta", array("photo_id"=>$photo_id, "title"=>$title, "description"=>$description), TRUE); return $this->parsed_response ? true : false; } function photos_setPerms($photo_id, $is_public, $is_friend, $is_family, $perm_comment, $perm_addmeta) { - /* http://www.flickr.com/services/api/flickr.photos.setPerms.html */ + /** http://www.flickr.com/services/api/flickr.photos.setPerms.html */ $this->request("flickr.photos.setPerms", array("photo_id"=>$photo_id, "is_public"=>$is_public, "is_friend"=>$is_friend, "is_family"=>$is_family, "perm_comment"=>$perm_comment, "perm_addmeta"=>$perm_addmeta), TRUE); return $this->parsed_response ? true : false; } function photos_setSafetyLevel ($photo_id, $safety_level, $hidden = null) { - /* http://www.flickr.com/services/api/flickr.photos.setSafetyLevel.html */ + /** http://www.flickr.com/services/api/flickr.photos.setSafetyLevel.html */ return $this->call('flickr.photos.setSafetyLevel', array('photo_id' => $photo_id, 'safety_level' => $safety_level, 'hidden' => $hidden)); } function photos_setTags($photo_id, $tags) { - /* http://www.flickr.com/services/api/flickr.photos.setTags.html */ + /** http://www.flickr.com/services/api/flickr.photos.setTags.html */ $this->request("flickr.photos.setTags", array("photo_id"=>$photo_id, "tags"=>$tags), TRUE); return $this->parsed_response ? true : false; } - /* Photos - Comments Methods */ + /** Photos - Comments Methods */ function photos_comments_addComment($photo_id, $comment_text) { - /* http://www.flickr.com/services/api/flickr.photos.comments.addComment.html */ + /** http://www.flickr.com/services/api/flickr.photos.comments.addComment.html */ $this->request("flickr.photos.comments.addComment", array("photo_id" => $photo_id, "comment_text"=>$comment_text), TRUE); return $this->parsed_response ? $this->parsed_response['comment'] : false; } function photos_comments_deleteComment($comment_id) { - /* http://www.flickr.com/services/api/flickr.photos.comments.deleteComment.html */ + /** http://www.flickr.com/services/api/flickr.photos.comments.deleteComment.html */ $this->request("flickr.photos.comments.deleteComment", array("comment_id" => $comment_id), TRUE); return $this->parsed_response ? true : false; } function photos_comments_editComment($comment_id, $comment_text) { - /* http://www.flickr.com/services/api/flickr.photos.comments.editComment.html */ + /** http://www.flickr.com/services/api/flickr.photos.comments.editComment.html */ $this->request("flickr.photos.comments.editComment", array("comment_id" => $comment_id, "comment_text"=>$comment_text), TRUE); return $this->parsed_response ? true : false; } function photos_comments_getList($photo_id) { - /* http://www.flickr.com/services/api/flickr.photos.comments.getList.html */ + /** http://www.flickr.com/services/api/flickr.photos.comments.getList.html */ $this->request("flickr.photos.comments.getList", array("photo_id"=>$photo_id)); return $this->parsed_response ? $this->parsed_response['comments'] : false; } - /* Photos - Geo Methods */ + /** Photos - Geo Methods */ function photos_geo_getLocation($photo_id) { - /* http://www.flickr.com/services/api/flickr.photos.geo.getLocation.html */ + /** http://www.flickr.com/services/api/flickr.photos.geo.getLocation.html */ $this->request("flickr.photos.geo.getLocation", array("photo_id"=>$photo_id)); return $this->parsed_response ? $this->parsed_response['photo'] : false; } function photos_geo_getPerms($photo_id) { - /* http://www.flickr.com/services/api/flickr.photos.geo.getPerms.html */ + /** http://www.flickr.com/services/api/flickr.photos.geo.getPerms.html */ $this->request("flickr.photos.geo.getPerms", array("photo_id"=>$photo_id)); return $this->parsed_response ? $this->parsed_response['perms'] : false; } function photos_geo_removeLocation($photo_id) { - /* http://www.flickr.com/services/api/flickr.photos.geo.removeLocation.html */ + /** http://www.flickr.com/services/api/flickr.photos.geo.removeLocation.html */ $this->request("flickr.photos.geo.removeLocation", array("photo_id"=>$photo_id), TRUE); return $this->parsed_response ? true : false; } function photos_geo_setLocation($photo_id, $lat, $lon, $accuracy = NULL) { - /* http://www.flickr.com/services/api/flickr.photos.geo.setLocation.html */ + /** http://www.flickr.com/services/api/flickr.photos.geo.setLocation.html */ $this->request("flickr.photos.geo.setLocation", array("photo_id"=>$photo_id, "lat"=>$lat, "lon"=>$lon, "accuracy"=>$accuracy), TRUE); return $this->parsed_response ? true : false; } function photos_geo_setPerms($photo_id, $is_public, $is_contact, $is_friend, $is_family) { - /* http://www.flickr.com/services/api/flickr.photos.geo.setPerms.html */ + /** http://www.flickr.com/services/api/flickr.photos.geo.setPerms.html */ $this->request("flickr.photos.geo.setPerms", array("photo_id"=>$photo_id, "is_public"=>$is_public, "is_contact"=>$is_contact, "is_friend"=>$is_friend, "is_family"=>$is_family), TRUE); return $this->parsed_response ? true : false; } - /* Photos - Licenses Methods */ + /** Photos - Licenses Methods */ function photos_licenses_getInfo() { - /* http://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html */ + /** http://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html */ $this->request("flickr.photos.licenses.getInfo"); return $this->parsed_response ? $this->parsed_response['licenses']['license'] : false; } function photos_licenses_setLicense($photo_id, $license_id) { - /* http://www.flickr.com/services/api/flickr.photos.licenses.setLicense.html */ - /* Requires Authentication */ + /** http://www.flickr.com/services/api/flickr.photos.licenses.setLicense.html */ + /** Requires Authentication */ $this->request("flickr.photos.licenses.setLicense", array("photo_id"=>$photo_id, "license_id"=>$license_id), TRUE); return $this->parsed_response ? true : false; } - /* Photos - Notes Methods */ + /** Photos - Notes Methods */ function photos_notes_add($photo_id, $note_x, $note_y, $note_w, $note_h, $note_text) { - /* http://www.flickr.com/services/api/flickr.photos.notes.add.html */ + /** http://www.flickr.com/services/api/flickr.photos.notes.add.html */ $this->request("flickr.photos.notes.add", array("photo_id" => $photo_id, "note_x" => $note_x, "note_y" => $note_y, "note_w" => $note_w, "note_h" => $note_h, "note_text" => $note_text), TRUE); return $this->parsed_response ? $this->parsed_response['note'] : false; } function photos_notes_delete($note_id) { - /* http://www.flickr.com/services/api/flickr.photos.notes.delete.html */ + /** http://www.flickr.com/services/api/flickr.photos.notes.delete.html */ $this->request("flickr.photos.notes.delete", array("note_id" => $note_id), TRUE); return $this->parsed_response ? true : false; } function photos_notes_edit($note_id, $note_x, $note_y, $note_w, $note_h, $note_text) { - /* http://www.flickr.com/services/api/flickr.photos.notes.edit.html */ + /** http://www.flickr.com/services/api/flickr.photos.notes.edit.html */ $this->request("flickr.photos.notes.edit", array("note_id" => $note_id, "note_x" => $note_x, "note_y" => $note_y, "note_w" => $note_w, "note_h" => $note_h, "note_text" => $note_text), TRUE); return $this->parsed_response ? true : false; } - /* Photos - Transform Methods */ + /** Photos - Transform Methods */ function photos_transform_rotate($photo_id, $degrees) { - /* http://www.flickr.com/services/api/flickr.photos.transform.rotate.html */ + /** http://www.flickr.com/services/api/flickr.photos.transform.rotate.html */ $this->request("flickr.photos.transform.rotate", array("photo_id" => $photo_id, "degrees" => $degrees), TRUE); return $this->parsed_response ? true : false; } - /* Photos - Upload Methods */ + /** Photos - Upload Methods */ function photos_upload_checkTickets($tickets) { - /* http://www.flickr.com/services/api/flickr.photos.upload.checkTickets.html */ + /** http://www.flickr.com/services/api/flickr.photos.upload.checkTickets.html */ if (is_array($tickets)) { $tickets = implode(",", $tickets); } @@ -829,73 +833,73 @@ class phpFlickr { return $this->parsed_response ? $this->parsed_response['uploader']['ticket'] : false; } - /* Photosets Methods */ + /** Photosets Methods */ function photosets_addPhoto($photoset_id, $photo_id) { - /* http://www.flickr.com/services/api/flickr.photosets.addPhoto.html */ + /** http://www.flickr.com/services/api/flickr.photosets.addPhoto.html */ $this->request("flickr.photosets.addPhoto", array("photoset_id" => $photoset_id, "photo_id" => $photo_id), TRUE); return $this->parsed_response ? true : false; } function photosets_create($title, $description, $primary_photo_id) { - /* http://www.flickr.com/services/api/flickr.photosets.create.html */ + /** http://www.flickr.com/services/api/flickr.photosets.create.html */ $this->request("flickr.photosets.create", array("title" => $title, "primary_photo_id" => $primary_photo_id, "description" => $description), TRUE); return $this->parsed_response ? $this->parsed_response['photoset'] : false; } function photosets_delete($photoset_id) { - /* http://www.flickr.com/services/api/flickr.photosets.delete.html */ + /** http://www.flickr.com/services/api/flickr.photosets.delete.html */ $this->request("flickr.photosets.delete", array("photoset_id" => $photoset_id), TRUE); return $this->parsed_response ? true : false; } function photosets_editMeta($photoset_id, $title, $description = NULL) { - /* http://www.flickr.com/services/api/flickr.photosets.editMeta.html */ + /** http://www.flickr.com/services/api/flickr.photosets.editMeta.html */ $this->request("flickr.photosets.editMeta", array("photoset_id" => $photoset_id, "title" => $title, "description" => $description), TRUE); return $this->parsed_response ? true : false; } function photosets_editPhotos($photoset_id, $primary_photo_id, $photo_ids) { - /* http://www.flickr.com/services/api/flickr.photosets.editPhotos.html */ + /** http://www.flickr.com/services/api/flickr.photosets.editPhotos.html */ $this->request("flickr.photosets.editPhotos", array("photoset_id" => $photoset_id, "primary_photo_id" => $primary_photo_id, "photo_ids" => $photo_ids), TRUE); return $this->parsed_response ? true : false; } function photosets_getContext($photo_id, $photoset_id) { - /* http://www.flickr.com/services/api/flickr.photosets.getContext.html */ + /** http://www.flickr.com/services/api/flickr.photosets.getContext.html */ $this->request("flickr.photosets.getContext", array("photo_id" => $photo_id, "photoset_id" => $photoset_id)); return $this->parsed_response ? $this->parsed_response : false; } function photosets_getInfo($photoset_id) { - /* http://www.flickr.com/services/api/flickr.photosets.getInfo.html */ + /** http://www.flickr.com/services/api/flickr.photosets.getInfo.html */ $this->request("flickr.photosets.getInfo", array("photoset_id" => $photoset_id)); return $this->parsed_response ? $this->parsed_response['photoset'] : false; } function photosets_getList($user_id = NULL) { - /* http://www.flickr.com/services/api/flickr.photosets.getList.html */ + /** http://www.flickr.com/services/api/flickr.photosets.getList.html */ $this->request("flickr.photosets.getList", array("user_id" => $user_id)); return $this->parsed_response ? $this->parsed_response['photosets'] : false; } function photosets_getPhotos($photoset_id, $extras = NULL, $privacy_filter = NULL, $per_page = NULL, $page = NULL) { - /* http://www.flickr.com/services/api/flickr.photosets.getPhotos.html */ + /** http://www.flickr.com/services/api/flickr.photosets.getPhotos.html */ $this->request("flickr.photosets.getPhotos", array("photoset_id" => $photoset_id, "extras" => $extras, "privacy_filter" => $privacy_filter, "per_page" => $per_page, "page" => $page)); return $this->parsed_response ? $this->parsed_response['photoset'] : false; } function photosets_orderSets($photoset_ids) { - /* http://www.flickr.com/services/api/flickr.photosets.orderSets.html */ + /** http://www.flickr.com/services/api/flickr.photosets.orderSets.html */ if (is_array($photoset_ids)) { $photoset_ids = implode(",", $photoset_ids); } @@ -905,178 +909,178 @@ class phpFlickr { function photosets_removePhoto($photoset_id, $photo_id) { - /* http://www.flickr.com/services/api/flickr.photosets.removePhoto.html */ + /** http://www.flickr.com/services/api/flickr.photosets.removePhoto.html */ $this->request("flickr.photosets.removePhoto", array("photoset_id" => $photoset_id, "photo_id" => $photo_id), TRUE); return $this->parsed_response ? true : false; } - /* Photosets Comments Methods */ + /** Photosets Comments Methods */ function photosets_comments_addComment($photoset_id, $comment_text) { - /* http://www.flickr.com/services/api/flickr.photosets.comments.addComment.html */ + /** http://www.flickr.com/services/api/flickr.photosets.comments.addComment.html */ $this->request("flickr.photosets.comments.addComment", array("photoset_id" => $photoset_id, "comment_text"=>$comment_text), TRUE); return $this->parsed_response ? $this->parsed_response['comment'] : false; } function photosets_comments_deleteComment($comment_id) { - /* http://www.flickr.com/services/api/flickr.photosets.comments.deleteComment.html */ + /** http://www.flickr.com/services/api/flickr.photosets.comments.deleteComment.html */ $this->request("flickr.photosets.comments.deleteComment", array("comment_id" => $comment_id), TRUE); return $this->parsed_response ? true : false; } function photosets_comments_editComment($comment_id, $comment_text) { - /* http://www.flickr.com/services/api/flickr.photosets.comments.editComment.html */ + /** http://www.flickr.com/services/api/flickr.photosets.comments.editComment.html */ $this->request("flickr.photosets.comments.editComment", array("comment_id" => $comment_id, "comment_text"=>$comment_text), TRUE); return $this->parsed_response ? true : false; } function photosets_comments_getList($photoset_id) { - /* http://www.flickr.com/services/api/flickr.photosets.comments.getList.html */ + /** http://www.flickr.com/services/api/flickr.photosets.comments.getList.html */ $this->request("flickr.photosets.comments.getList", array("photoset_id"=>$photoset_id)); return $this->parsed_response ? $this->parsed_response['comments'] : false; } - /* Places Methods */ + /** Places Methods */ function places_resolvePlaceId ($place_id) { - /* http://www.flickr.com/services/api/flickr.places.resolvePlaceId.html */ + /** http://www.flickr.com/services/api/flickr.places.resolvePlaceId.html */ $rsp = $this->call('flickr.places.resolvePlaceId', array('place_id' => $place_id)); return $rsp ? $rsp['location'] : $rsp; } function places_resolvePlaceURL ($url) { - /* http://www.flickr.com/services/api/flickr.places.resolvePlaceURL.html */ + /** http://www.flickr.com/services/api/flickr.places.resolvePlaceURL.html */ $rsp = $this->call('flickr.places.resolvePlaceURL', array('url' => $url)); return $rsp ? $rsp['location'] : $rsp; } - /* Prefs Methods */ + /** Prefs Methods */ function prefs_getContentType () { - /* http://www.flickr.com/services/api/flickr.prefs.getContentType.html */ + /** http://www.flickr.com/services/api/flickr.prefs.getContentType.html */ $rsp = $this->call('flickr.prefs.getContentType', array()); return $rsp ? $rsp['person'] : $rsp; } function prefs_getHidden () { - /* http://www.flickr.com/services/api/flickr.prefs.getHidden.html */ + /** http://www.flickr.com/services/api/flickr.prefs.getHidden.html */ $rsp = $this->call('flickr.prefs.getHidden', array()); return $rsp ? $rsp['person'] : $rsp; } function prefs_getPrivacy () { - /* http://www.flickr.com/services/api/flickr.prefs.getPrivacy.html */ + /** http://www.flickr.com/services/api/flickr.prefs.getPrivacy.html */ $rsp = $this->call('flickr.prefs.getPrivacy', array()); return $rsp ? $rsp['person'] : $rsp; } function prefs_getSafetyLevel () { - /* http://www.flickr.com/services/api/flickr.prefs.getSafetyLevel.html */ + /** http://www.flickr.com/services/api/flickr.prefs.getSafetyLevel.html */ $rsp = $this->call('flickr.prefs.getSafetyLevel', array()); return $rsp ? $rsp['person'] : $rsp; } - /* Reflection Methods */ + /** Reflection Methods */ function reflection_getMethodInfo($method_name) { - /* http://www.flickr.com/services/api/flickr.reflection.getMethodInfo.html */ + /** http://www.flickr.com/services/api/flickr.reflection.getMethodInfo.html */ $this->request("flickr.reflection.getMethodInfo", array("method_name" => $method_name)); return $this->parsed_response ? $this->parsed_response : false; } function reflection_getMethods() { - /* http://www.flickr.com/services/api/flickr.reflection.getMethods.html */ + /** http://www.flickr.com/services/api/flickr.reflection.getMethods.html */ $this->request("flickr.reflection.getMethods"); return $this->parsed_response ? $this->parsed_response['methods']['method'] : false; } - /* Tags Methods */ + /** Tags Methods */ function tags_getHotList($period = NULL, $count = NULL) { - /* http://www.flickr.com/services/api/flickr.tags.getHotList.html */ + /** http://www.flickr.com/services/api/flickr.tags.getHotList.html */ $this->request("flickr.tags.getHotList", array("period" => $period, "count" => $count)); return $this->parsed_response ? $this->parsed_response['hottags'] : false; } function tags_getListPhoto($photo_id) { - /* http://www.flickr.com/services/api/flickr.tags.getListPhoto.html */ + /** http://www.flickr.com/services/api/flickr.tags.getListPhoto.html */ $this->request("flickr.tags.getListPhoto", array("photo_id" => $photo_id)); return $this->parsed_response ? $this->parsed_response['photo']['tags']['tag'] : false; } function tags_getListUser($user_id = NULL) { - /* http://www.flickr.com/services/api/flickr.tags.getListUser.html */ + /** http://www.flickr.com/services/api/flickr.tags.getListUser.html */ $this->request("flickr.tags.getListUser", array("user_id" => $user_id)); return $this->parsed_response ? $this->parsed_response['who']['tags']['tag'] : false; } function tags_getListUserPopular($user_id = NULL, $count = NULL) { - /* http://www.flickr.com/services/api/flickr.tags.getListUserPopular.html */ + /** http://www.flickr.com/services/api/flickr.tags.getListUserPopular.html */ $this->request("flickr.tags.getListUserPopular", array("user_id" => $user_id, "count" => $count)); return $this->parsed_response ? $this->parsed_response['who']['tags']['tag'] : false; } function tags_getListUserRaw($tag) { - /* http://www.flickr.com/services/api/flickr.tags.getListUserRaw.html */ + /** http://www.flickr.com/services/api/flickr.tags.getListUserRaw.html */ $this->request("flickr.tags.getListUserRaw", array("tag" => $tag)); return $this->parsed_response ? $this->parsed_response['who']['tags']['tag'][0]['raw'] : false; } function tags_getRelated($tag) { - /* http://www.flickr.com/services/api/flickr.tags.getRelated.html */ + /** http://www.flickr.com/services/api/flickr.tags.getRelated.html */ $this->request("flickr.tags.getRelated", array("tag" => $tag)); return $this->parsed_response ? $this->parsed_response['tags'] : false; } function test_echo($args = array()) { - /* http://www.flickr.com/services/api/flickr.test.echo.html */ + /** http://www.flickr.com/services/api/flickr.test.echo.html */ $this->request("flickr.test.echo", $args); return $this->parsed_response ? $this->parsed_response : false; } function test_login() { - /* http://www.flickr.com/services/api/flickr.test.login.html */ + /** http://www.flickr.com/services/api/flickr.test.login.html */ $this->request("flickr.test.login"); return $this->parsed_response ? $this->parsed_response['user'] : false; } function urls_getGroup($group_id) { - /* http://www.flickr.com/services/api/flickr.urls.getGroup.html */ + /** http://www.flickr.com/services/api/flickr.urls.getGroup.html */ $this->request("flickr.urls.getGroup", array("group_id"=>$group_id)); return $this->parsed_response ? $this->parsed_response['group']['url'] : false; } function urls_getUserPhotos($user_id = NULL) { - /* http://www.flickr.com/services/api/flickr.urls.getUserPhotos.html */ + /** http://www.flickr.com/services/api/flickr.urls.getUserPhotos.html */ $this->request("flickr.urls.getUserPhotos", array("user_id"=>$user_id)); return $this->parsed_response ? $this->parsed_response['user']['url'] : false; } function urls_getUserProfile($user_id = NULL) { - /* http://www.flickr.com/services/api/flickr.urls.getUserProfile.html */ + /** http://www.flickr.com/services/api/flickr.urls.getUserProfile.html */ $this->request("flickr.urls.getUserProfile", array("user_id"=>$user_id)); return $this->parsed_response ? $this->parsed_response['user']['url'] : false; } function urls_lookupGroup($url) { - /* http://www.flickr.com/services/api/flickr.urls.lookupGroup.html */ + /** http://www.flickr.com/services/api/flickr.urls.lookupGroup.html */ $this->request("flickr.urls.lookupGroup", array("url"=>$url)); return $this->parsed_response ? $this->parsed_response['group'] : false; } function urls_lookupUser($url) { - /* http://www.flickr.com/services/api/flickr.photos.notes.edit.html */ + /** http://www.flickr.com/services/api/flickr.photos.notes.edit.html */ $this->request("flickr.urls.lookupUser", array("url"=>$url)); return $this->parsed_response ? $this->parsed_response['user'] : false; } diff --git a/lib/formslib.php b/lib/formslib.php index 444a0b313c..ca850787d7 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -1,4 +1,19 @@ -. + /** * formslib.php - library of classes for creating forms in Moodle, based on PEAR QuickForms. * @@ -16,11 +31,12 @@ * elements, these elements clean themselves. * * - * @author Jamie Pratt - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License + * @copyright Jamie Pratt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package moodlecore */ -//setup.php icludes our hacked pear libs first +/** setup.php icludes our hacked pear libs first */ require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/DHTMLRulesTableless.php'; require_once 'HTML/QuickForm/Renderer/Tableless.php'; @@ -45,6 +61,11 @@ if ($CFG->debug >= DEBUG_ALL){ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'pear_handle_error'); } +/** + * @global object + * @staticvar bool $done + * @todo This is NOT xhtml strict, we will need something like require_css() + */ function form_init_date_js() { global $CFG; static $done = false; @@ -65,13 +86,18 @@ function form_init_date_js() { * subclass such a moodleform_mod for each form you want to display and/or process with formslib. * * You will write your own definition() method which performs the form set up. + * + * @package moodlecore + * @copyright Jamie Pratt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class moodleform { + /** @var string */ protected $_formname; // form name /** * quickform object definition * - * @var MoodleQuickForm + * @var object MoodleQuickForm */ protected $_form; /** @@ -82,7 +108,7 @@ class moodleform { protected $_customdata; /** * definition_after_data executed flag - * @var definition_finalized + * @var object definition_finalized */ protected $_definition_finalized = false; @@ -108,7 +134,8 @@ class moodleform { * it if you don't need to as the target attribute is deprecated in xhtml * strict. * @param mixed $attributes you can pass a string of html attributes here or an array. - * @return moodleform + * @param bool $editable + * @return object moodleform */ function moodleform($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) { if (empty($action)){ @@ -175,6 +202,8 @@ class moodleform { /** * Internal method. Alters submitted data to be suitable for quickforms processing. * Must be called when the form is fully set up. + * + * @param string $method */ function _process_submission($method) { $submission = array(); @@ -203,6 +232,11 @@ class moodleform { /** * Internal method. Validates all old-style uploaded files. + * + * @global object + * @global object + * @param array $files + * @return bool|array Success or an array of errors */ function _validate_files(&$files) { global $CFG, $COURSE; @@ -305,6 +339,9 @@ class moodleform { $this->_form->setDefaults($default_values); } + /** + * @param bool $um + */ function set_upload_manager($um=false) { debugging('Not used anymore, please fix code!'); } @@ -318,6 +355,9 @@ class moodleform { return $this->_form->isSubmitted(); } + /** + * @staticvar bool $nosubmit + */ function no_submit_button_pressed(){ static $nosubmit = null; // one check is enough if (!is_null($nosubmit)){ @@ -341,6 +381,7 @@ class moodleform { /** * Check that form data is valid. * + * @staticvar bool $validated * @return bool true if form data valid */ function is_validated() { @@ -456,6 +497,8 @@ class moodleform { /** * Save verified uploaded files into directory. Upload process can be customised from definition() * NOTE: please use save_stored_file() or save_file() + * + * @return bool Always false */ function save_files($destination) { debugging('Not used anymore, please fix code! Use save_stored_file() or save_file() instead'); @@ -464,6 +507,8 @@ class moodleform { /** * Returns name of uploaded file. + * + * @global object * @param string $elname, first element if null * @return mixed false in case of failure, string if ok */ @@ -512,6 +557,8 @@ class moodleform { /** * Save file to standard filesystem + * + * @global object * @param string $elname name of element * @param string $pathname full path name of file * @param bool $override override file if exists @@ -560,6 +607,8 @@ class moodleform { /** * Save file to local filesystem pool + * + * @global object * @param string $elname name of element * @param int $newcontextid * @param string $newfilearea @@ -632,6 +681,8 @@ class moodleform { /** * Get content of uploaded file. + * + * @global object * @param $element name of file upload element * @return mixed false in case of failure, string if ok */ @@ -821,8 +872,10 @@ class moodleform { /** * Adds a link/button that controls the checked state of a group of checkboxes. + * + * @global object * @param int $groupid The id of the group of advcheckboxes this element controls - * @param string $text The text of the link. Defaults to "select all/none" + * @param string $buttontext The text of the link. Defaults to "select all/none" * @param array $attributes associative array of HTML attributes * @param int $originalValue The original general state of the checkboxes before the user first clicks this element */ @@ -926,8 +979,12 @@ EOS; * call methods on this class from within abstract methods that you override on moodleform such * as definition and definition_after_data * + * @package moodlecore + * @copyright Jamie Pratt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { + /** @var array */ var $_types = array(); var $_dependencies = array(); /** @@ -975,12 +1032,14 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { /** * Class constructor - same parameters as HTML_QuickForm_DHTMLRulesTableless + * + * @global object + * @staticvar int $formcounter * @param string $formName Form's name. * @param string $method (optional)Form's method defaults to 'POST' * @param mixed $action (optional)Form's action - string or moodle_url * @param string $target (optional)Form's target defaults to none * @param mixed $attributes (optional)Extra attributes for
tag - * @param bool $trackSubmit (optional)Whether to track if the form was submitted by adding a special hidden field * @access public */ function MoodleQuickForm($formName, $method, $action, $target='', $attributes=null){ @@ -1084,8 +1143,7 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { /** * Accepts a renderer * - * @param HTML_QuickForm_Renderer An HTML_QuickForm_Renderer object - * @since 3.0 + * @param object $renderer HTML_QuickForm_Renderer An HTML_QuickForm_Renderer object * @access public * @return void */ @@ -1131,8 +1189,9 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { parent::accept($renderer); } - - + /** + * @param string $elementName + */ function closeHeaderBefore($elementName){ $renderer =& $this->defaultRenderer(); $renderer->addStopFieldsetElements($elementName); @@ -1169,6 +1228,10 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { $this->_types = $paramtypes + $this->_types; } + /** + * @param array $submission + * @param array $files + */ function updateSubmission($submission, $files) { $this->_flagSubmitted = false; @@ -1197,10 +1260,16 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { } } + /** + * @return string + */ function getReqHTML(){ return $this->_reqHTML; } - + + /** + * @return string + */ function getAdvancedHTML(){ return $this->_advancedHTML; } @@ -1223,7 +1292,8 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { * Add an array of buttons to the form * @param array $buttons An associative array representing help button to attach to * to the form. keys of array correspond to names of elements in form. - * + * @param bool $suppresscheck + * @param string $function * @access public */ function setHelpButtons($buttons, $suppresscheck=false, $function='helpbutton'){ @@ -1236,10 +1306,11 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { * Add a single button. * * @param string $elementname name of the element to add the item to - * @param array $button - arguments to pass to function $function - * @param boolean $suppresscheck - whether to throw an error if the element + * @param array $button arguments to pass to function $function + * @param boolean $suppresscheck whether to throw an error if the element * doesn't exist. * @param string $function - function to generate html from the arguments in $button + * @param string $function */ function setHelpButton($elementname, $button, $suppresscheck=false, $function='helpbutton'){ if (array_key_exists($elementname, $this->_elementIndex)){ @@ -1261,6 +1332,7 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { /** * Set constant value not overriden by _POST or _GET * note: this does not work for complex names with [] :-( + * * @param string $elname name of element * @param mixed $value * @return void @@ -1271,6 +1343,9 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { $element->onQuickFormEvent('updateValue', null, $this); } + /** + * @param string $elementList + */ function exportValues($elementList = null){ $unfiltered = array(); if (null === $elementList) { @@ -1318,9 +1393,7 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { * @param string $validation (optional)Where to perform validation: "server", "client" * @param boolean $reset Client-side validation: reset the form element to its original value if there is an error? * @param boolean $force Force the rule to be applied, even if the target form element does not exist - * @since 1.0 * @access public - * @throws HTML_QuickForm_Error */ function addRule($element, $message, $type, $format=null, $validation='server', $reset = false, $force = false) { @@ -1346,9 +1419,7 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { * @param int $howmany (optional)How many valid elements should be in the group * @param string $validation (optional)Where to perform validation: "server", "client" * @param bool $reset Client-side: whether to reset the element's value to its original state if validation failed. - * @since 2.5 * @access public - * @throws HTML_QuickForm_Error */ function addGroupRule($group, $arg1, $type='', $format=null, $howmany=0, $validation = 'server', $reset = false) { @@ -1568,6 +1639,9 @@ function validate_' . $this->_formName . '(frm) { } } + /** + * @return string + */ function getLockOptionEndScript(){ $iname = $this->getAttribute('id').'items'; @@ -1605,6 +1679,10 @@ function validate_' . $this->_formName . '(frm) { return $js; } + /** + * @param mixed $element + * @return array + */ function _getElNamesRecursive($element) { if (is_string($element)) { if (!$this->elementExists($element)) { @@ -1671,10 +1749,17 @@ function validate_' . $this->_formName . '(frm) { $this->_noSubmitButtons[]=$buttonname; } + /** + * @param string $buttonname + * @return mixed + */ function isNoSubmitButton($buttonname){ return (array_search($buttonname, $this->_noSubmitButtons)!==FALSE); } + /** + * @param string $buttonname + */ function _registerCancelButton($addfieldsname){ $this->_cancelButtons[]=$addfieldsname; } @@ -1687,9 +1772,7 @@ function validate_' . $this->_formName . '(frm) { * This function also removes all previously defined rules. * * @param mixed $elementList array or string of element(s) to be frozen - * @since 1.0 * @access public - * @throws HTML_QuickForm_Error */ function hardFreeze($elementList=null) { @@ -1730,10 +1813,10 @@ function validate_' . $this->_formName . '(frm) { * * This function also removes all previously defined rules of elements it freezes. * + * throws HTML_QuickForm_Error + * * @param array $elementList array or string of element(s) not to be frozen - * @since 1.0 * @access public - * @throws HTML_QuickForm_Error */ function hardFreezeAllVisibleExcept($elementList) { @@ -1781,8 +1864,9 @@ function validate_' . $this->_formName . '(frm) { * * Stylesheet is part of standard theme and should be automatically included. * - * @author Jamie Pratt - * @license gpl license + * @package moodlecore + * @copyright Jamie Pratt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ @@ -1855,6 +1939,9 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ parent::HTML_QuickForm_Renderer_Tableless(); } + /** + * @param array $elements + */ function setAdvancedElements($elements){ $this->_advancedElements = $elements; } @@ -1862,7 +1949,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ /** * What to do when starting the form * - * @param MoodleQuickForm $form + * @param object $form MoodleQuickForm */ function startForm(&$form){ $this->_reqHTML = $form->getReqHTML(); @@ -1878,7 +1965,12 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ } - + + /** + * @param object $group Passed by reference + * @param mixed $required + * @param mixed $error + */ function startGroup(&$group, $required, $error){ if (method_exists($group, 'getElementTemplateType')){ $html = $this->_elementTemplates[$group->getElementTemplateType()]; @@ -1918,7 +2010,11 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ } parent::startGroup($group, $required, $error); } - + /** + * @param object $element + * @param mixed $required + * @param mixed $error + */ function renderElement(&$element, $required, $error){ //manipulate id of all elements before rendering if (!is_null($element->getAttribute('id'))) { @@ -1976,6 +2072,9 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ parent::renderElement($element, $required, $error); } + /** + * @param object $form Passed by reference + */ function finishForm(&$form){ if ($form->isFrozen()){ $this->_hiddenHtml = ''; @@ -1989,7 +2088,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{ /** * Called when visiting a header element * - * @param object An HTML_QuickForm_header element being visited + * @param object $header An HTML_QuickForm_header element being visited * @access public * @return void */ @@ -2061,10 +2160,13 @@ showAdvancedInit('{$name}_script', '$elementName', '$buttonlabel', '$hidetext', } } - +/** + * @global object $GLOBALS['_HTML_QuickForm_default_renderer'] + * @name $_HTML_QuickForm_default_renderer + */ $GLOBALS['_HTML_QuickForm_default_renderer'] =& new MoodleQuickForm_Renderer(); -// Please keep this list in alphabetical order. +/** Please keep this list in alphabetical order. */ MoodleQuickForm::registerElementType('advcheckbox', "$CFG->libdir/form/advcheckbox.php", 'MoodleQuickForm_advcheckbox'); MoodleQuickForm::registerElementType('button', "$CFG->libdir/form/button.php", 'MoodleQuickForm_button'); MoodleQuickForm::registerElementType('cancel', "$CFG->libdir/form/cancel.php", 'MoodleQuickForm_cancel'); diff --git a/lib/gdlib.php b/lib/gdlib.php index 7bb5b8b5e9..db8a2c2e6e 100644 --- a/lib/gdlib.php +++ b/lib/gdlib.php @@ -1,31 +1,44 @@ . + /** * gdlib.php - Collection of routines in Moodle related to * processing images using GD * - * @author Martin Dougiamas etc - * @version $Id$ - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** - * short description (optional) * * long description - * @uses $CFG - * @param type? $dst_img description? - * @param type? $src_img description? - * @param type? $dst_x description? - * @param type? $dst_y description? - * @param type? $src_x description? - * @param type? $src_y description? - * @param type? $dst_w description? - * @param type? $dst_h description? - * @param type? $src_w description? - * @param type? $src_h description? - * @return ? + * @global object + * @param object $dst_img + * @param object $src_img + * @param int $dst_x + * @param int $dst_y + * @param int $src_x + * @param int $src_y + * @param int $dst_w + * @param int $dst_h + * @param int $src_w + * @param int $src_h + * @return bool * @todo Finish documenting this function */ function ImageCopyBicubic ($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) { @@ -73,6 +86,8 @@ function ImageCopyBicubic ($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $ /** * Delete profile images associated with user or group + * + * @global object * @param int $id user or group id * @param string $dir type of entity - 'groups' or 'users' * @return boolean success @@ -94,6 +109,7 @@ function delete_profile_image($id, $dir='users') { * Given an upload manager with the right settings, this function performs a virus scan, and then scales and crops * it and saves it in the right place to be a "user" or "group" image. * + * @global object * @param int $id user or group id * @param string $dir type of entity - groups, user, ... * @return string $destination (profile image destination path) or false on error @@ -153,7 +169,7 @@ function save_profile_image($id, $userform, $dir='user') { * Given a path to an image file this function scales and crops it and saves it in * the right place to be a "user" or "group" image. * - * @uses $CFG + * @global object * @param string $originalfile the path of the original image file * @param string $destination the final destination directory of the profile image * @return boolean @@ -256,8 +272,9 @@ function process_profile_image($originalfile, $destination) { * Given a user id this function scales and crops the user images to remove * the one pixel black border. * - * @uses $CFG - * @param int $id description? + * @global object + * @param int $id + * @param string $dir * @return boolean */ function upgrade_profile_image($id, $dir='users') { diff --git a/lib/googleapi.php b/lib/googleapi.php index e2bb069a31..a31d798cd6 100644 --- a/lib/googleapi.php +++ b/lib/googleapi.php @@ -1,4 +1,4 @@ -. * - * @package moodle + * @package moodlecore * @subpackage lib - * @author Dan Poltawski - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL + * @copyright Dan Poltawski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * * Simple implementation of some Google API functions for Moodle. */ + /** Include essential file */ require_once($CFG->libdir.'/filelib.php'); /** @@ -33,6 +34,11 @@ require_once($CFG->libdir.'/filelib.php'); * Most Google API Calls required that requests are sent with an * Authorization header + token. This class extends the curl class * to aid this + * + * @package moodlecore + * @subpackage lib + * @copyright Dan Poltawski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class google_auth_request extends curl{ protected $token = ''; @@ -78,6 +84,11 @@ abstract class google_auth_request extends curl{ /** * Used to uprade a google AuthSubRequest one-time token into * a session token which can be used long term. + * + * @package moodlecore + * @subpackage lib + * @copyright Dan Poltawski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class google_authsub_request extends google_auth_request { const AUTHSESSION_URL = 'https://www.google.com/accounts/AuthSubSessionToken'; @@ -114,6 +125,11 @@ class google_authsub_request extends google_auth_request { /** * Allows http calls using google subauth authorisation + * + * @package moodlecore + * @subpackage lib + * @copyright Dan Poltawski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class google_authsub extends google_auth_request { const LOGINAUTH_URL = 'https://www.google.com/accounts/AuthSubRequest'; @@ -199,7 +215,12 @@ class google_authsub extends google_auth_request { /** * Class for manipulating google documents through the google data api * Docs for this can be found here: - * http://code.google.com/apis/documents/docs/2.0/developers_guide_protocol.html + * {@link http://code.google.com/apis/documents/docs/2.0/developers_guide_protocol.html} + * + * @package moodlecore + * @subpackage lib + * @copyright Dan Poltawski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class google_docs { // need both docs and the spreadsheets realm @@ -320,7 +341,12 @@ class google_docs { /** * Class for manipulating picasa through the google data api * Docs for this can be found here: - * http://code.google.com/apis/picasaweb/developers_guide_protocol.html + * {@link http://code.google.com/apis/picasaweb/developers_guide_protocol.html} + * + * @package moodlecore + * @subpackage lib + * @copyright Dan Poltawski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class google_picasa { const REALM = 'http://picasaweb.google.com/data/'; @@ -502,10 +528,15 @@ class google_picasa { /** * Beginings of an implementation of Clientogin authenticaton for google * accounts as documented here: - * http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#ClientLogin + * {@link http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#ClientLogin} * * With this authentication we have to accept a username and password and to post * it to google. Retrieving a token for use afterwards. + * + * @package moodlecore + * @subpackage lib + * @copyright Dan Poltawski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class google_authclient extends google_auth_request { const LOGIN_URL = 'https://www.google.com/accounts/ClientLogin'; diff --git a/lib/gradelib.php b/lib/gradelib.php index 3dea2ee889..015b09015d 100644 --- a/lib/gradelib.php +++ b/lib/gradelib.php @@ -1,36 +1,29 @@ -. /** * Library of functions for gradebook - both public and internal * - * @author Moodle HQ developers - * @version $Id$ - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package moodlecore + * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + /** Include essential files */ require_once($CFG->libdir . '/grade/constants.php'); require_once($CFG->libdir . '/grade/grade_category.php'); @@ -52,7 +45,10 @@ require_once($CFG->libdir . '/grade/grade_outcome.php'); * 'grademin', 'scaleid', 'multfactor', 'plusfactor', 'deleted' and 'hidden'. 'reset' means delete all current grades including locked ones. * * Manual, course or category items can not be updated by this function. - * @public + * @access public + * @global object + * @global object + * @global object * @param string $source source of the grade such as 'mod/assignment' * @param int $courseid id of course * @param string $itemtype type of grade item - mod, block @@ -304,7 +300,8 @@ function grade_update($source, $courseid, $itemtype, $itemmodule, $iteminstance, /** * Updates outcomes of user * Manual outcomes can not be updated. - * @public + * + * @access public * @param string $source source of the grade such as 'mod/assignment' * @param int $courseid id of course * @param string $itemtype 'mod', 'block' @@ -328,13 +325,15 @@ function grade_update_outcomes($source, $courseid, $itemtype, $itemmodule, $item /** * Returns grading information for given activity - optionally with users grades * Manual, course or category items can not be queried. - * @public + * + * @access public + * @global object * @param int $courseid id of course * @param string $itemtype 'mod', 'block' * @param string $itemmodule 'forum, 'quiz', etc. * @param int $iteminstance id of the item module * @param int $userid_or_ids optional id of the graded user or array of ids; if userid not used, returns only information about grade_item - * @return array of grade information objects (scaleid, name, grade and locked status, etc.) indexed with itemnumbers + * @return array Array of grade information objects (scaleid, name, grade and locked status, etc.) indexed with itemnumbers */ function grade_get_grades($courseid, $itemtype, $itemmodule, $iteminstance, $userid_or_ids=null) { global $CFG; @@ -547,8 +546,11 @@ function grade_get_grades($courseid, $itemtype, $itemmodule, $iteminstance, $use /** * Returns course gradebook setting + * + * @global object * @param int $courseid * @param string $name of setting, maybe null if reset only + * @param string $default * @param bool $resetcache force reset of internal static cache * @return string value, NULL if no setting */ @@ -583,6 +585,8 @@ function grade_get_setting($courseid, $name, $default=null, $resetcache=false) { /** * Returns all course gradebook settings as object properties + * + * @global object * @param int $courseid * @return object */ @@ -603,6 +607,8 @@ function grade_get_settings($courseid) { /** * Add/update course gradebook setting + * + * @global object * @param int $courseid * @param string $name of setting * @param string value, NULL means no setting==remove @@ -633,11 +639,12 @@ function grade_set_setting($courseid, $name, $value) { /** * Returns string representation of grade value + * * @param float $value grade value * @param object $grade_item - by reference to prevent scale reloading * @param bool $localized use localised decimal separator * @param int $displaytype type of display - GRADE_DISPLAY_TYPE_REAL, GRADE_DISPLAY_TYPE_PERCENTAGE, GRADE_DISPLAY_TYPE_LETTER - * @param int $decimalplaces number of decimal places when displaying float values + * @param int $decimals number of decimal places when displaying float values * @return string */ function grade_format_gradevalue($value, &$grade_item, $localized=true, $displaytype=null, $decimals=null) { @@ -701,6 +708,9 @@ function grade_format_gradevalue($value, &$grade_item, $localized=true, $display } } +/** + * @todo Document this function + */ function grade_format_gradevalue_real($value, $grade_item, $decimals, $localized) { if ($grade_item->gradetype == GRADE_TYPE_SCALE) { if (!$scale = $grade_item->load_scale()) { @@ -714,7 +724,9 @@ function grade_format_gradevalue_real($value, $grade_item, $decimals, $localized return format_float($value, $decimals, $localized); } } - +/** + * @todo Document this function + */ function grade_format_gradevalue_percentage($value, $grade_item, $decimals, $localized) { $min = $grade_item->grademin; $max = $grade_item->grademax; @@ -725,7 +737,9 @@ function grade_format_gradevalue_percentage($value, $grade_item, $decimals, $loc $percentage = (($value-$min)*100)/($max-$min); return format_float($percentage, $decimals, $localized).' %'; } - +/** + * @todo Document this function + */ function grade_format_gradevalue_letter($value, $grade_item) { $context = get_context_instance(CONTEXT_COURSE, $grade_item->courseid); if (!$letters = grade_get_letters($context)) { @@ -749,6 +763,7 @@ function grade_format_gradevalue_letter($value, $grade_item) { /** * Returns grade options for gradebook category menu + * * @param int $courseid * @param bool $includenew include option for new category (-1) * @return array of grade categories in course @@ -783,6 +798,7 @@ function grade_get_categories_menu($courseid, $includenew=false) { /** * Returns grade letters array used in context + * * @param object $context object or null for defaults * @return array of grade_boundary=>letter_string */ @@ -830,10 +846,12 @@ function grade_get_letters($context=null) { /** * Verify new value of idnumber - checks for uniqueness of new idnumbers, old are kept intact + * + * @global object * @param string idnumber string (with magic quotes) - * @param int $courseid - id numbers are course unique only + * @param int $courseid id numbers are course unique only + * @param object $grade_item is item idnumber * @param object $cm used for course module idnumbers and items attached to modules - * @param object $gradeitem is item idnumber * @return boolean true means idnumber ok */ function grade_verify_idnumber($idnumber, $courseid, $grade_item=null, $cm=null) { @@ -864,6 +882,8 @@ function grade_verify_idnumber($idnumber, $courseid, $grade_item=null, $cm=null) /** * Force final grade recalculation in all course items + * + * @global object * @param int $courseid */ function grade_force_full_regrading($courseid) { @@ -873,6 +893,8 @@ function grade_force_full_regrading($courseid) { /** * Forces regrading of all site grades - usualy when chanign site setings + * @global object + * @global object */ function grade_force_site_regrading() { global $CFG, $DB; @@ -998,9 +1020,12 @@ function grade_regrade_final_grades($courseid, $userid=null, $updated_item=null) /** * Refetches data from all course activities + * + * @global object + * @global object * @param int $courseid * @param string $modname - * @return success + * @return void */ function grade_grab_course_grades($courseid, $modname=null) { global $CFG, $DB; @@ -1049,7 +1074,11 @@ function grade_grab_course_grades($courseid, $modname=null) { /** * Force full update of module grades in central gradebook + * + * @global object + * @global object * @param object $modinstance object with extra cmidnumber and modname property + * @param int $userid * @return boolean success */ function grade_update_mod_grades($modinstance, $userid=0) { @@ -1079,7 +1108,10 @@ function grade_update_mod_grades($modinstance, $userid=0) { /** * Remove grade letters for given context + * + * @global object * @param object $context + * @param bool $showfeedback */ function remove_grade_letters($context, $showfeedback) { global $DB; @@ -1093,6 +1125,8 @@ function remove_grade_letters($context, $showfeedback) { } /** * Remove all grade related course data - history is kept + * + * @global object * @param int $courseid * @param bool $showfeedback print feedback */ @@ -1134,6 +1168,8 @@ function remove_course_grades($courseid, $showfeedback) { /** * Called when course category deleted - cleanup gradebook + * + * @global object * @param int $categoryid course category id * @param int $newparentid empty means everything deleted, otherwise id of category where content moved * @param bool $showfeedback print feedback @@ -1147,6 +1183,10 @@ function grade_course_category_delete($categoryid, $newparentid, $showfeedback) /** * Does gradebook cleanup when module uninstalled. + * + * @global object + * @global object + * @param string $modname */ function grade_uninstalled_module($modname) { global $CFG, $DB; @@ -1167,6 +1207,9 @@ function grade_uninstalled_module($modname) { /** * Grading cron job + * + * @global object + * @global object */ function grade_cron() { global $CFG, $DB; @@ -1221,8 +1264,9 @@ function grade_cron() { /** * Resel all course grades + * * @param int $courseid - * @return success + * @return bool success */ function grade_course_reset($courseid) { @@ -1245,7 +1289,8 @@ function grade_course_reset($courseid) { /** * Convert number to 5 decimalfloat, empty tring or null db compatible format * (we need this to decide if db value changed) - * @param mixed number + * + * @param mixed $number * @return mixed float or null */ function grade_floatval($number) { @@ -1260,9 +1305,10 @@ function grade_floatval($number) { /** * Compare two float numbers safely. Uses 5 decimals php precision. Nulls accepted too. * Used for skipping of db updates + * * @param float $f1 * @param float $f2 - * @return true if different + * @return bool true if different */ function grade_floats_different($f1, $f2) { // note: db rounding for 10,5 is different from php round() function