/**
* 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)
/**
* 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
/**
* 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
/**
* 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
/**
* 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
/**
* 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
}
/**
+ *
+ * @global object
+ * @global object
* @return int a random but available draft itemid that can be used to create a new draft
* file area.
*/
* 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.
/**
* 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.
/**
* 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.
/**
* 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.
*/
/**
* 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.
/**
* 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) {
* 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.
}
/**
- * @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.
* 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
/**
* 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
/**
* 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)
/**
* 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
/**
* Reprot file is not found or not accessible
+ *
* @return does not return, terminates script
*/
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
/**
* 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)
/**
* 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;
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;
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;
* considered an error.
*
* @param $location the path to remove.
+ * @return bool
*/
function fulldelete($location) {
if (is_dir($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!
/**
* 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 <head> tag
* RESTful cURL class
*
* This is a wrapper class for curl, it is quite easy to use:
- *
+ * <code>
* $c = new curl;
* // enable cache
* $c = new curl(array('cache'=>true));
* $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');
+ * </code>
*
+ * @package moodlecore
* @author Dongsheng Cai <dongsheng@cvs.moodle.org>
- * @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')) {
$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';
/**
* 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)) {
* 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)
{
/**
* 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
}
return $curl;
}
- /*
+ /**
* Download multiple files in parallel
+ *
+ * Calls {@link multi()} with specific download headers
+ *
+ * <code>
* $c = new curl;
* $c->download(array(
* array('url'=>'http://localhost/', 'file'=>fopen('a', 'wb')),
* array('url'=>'http://localhost/20/', 'file'=>fopen('b', 'wb'))
* ));
+ * </code>
+ *
+ * @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;
/*
* 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);
}
/**
* Single HTTP Request
+ *
+ * @param string $url The URL to request
+ * @param array $options
+ * @return bool
*/
protected function request($url, $options = array()){
// create curl instance
/**
* HTTP HEAD method
+ *
+ * @see request()
+ *
+ * @param string $url
+ * @param array $options
+ * @return bool
*/
public function head($url, $options = array()){
$options['CURLOPT_HTTPGET'] = 0;
/**
* 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;
/**
* 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;
/**
* 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'];
/**
* 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';
}
/**
* HTTP TRACE method
+ *
+ * @param string $url
+ * @param array $options
+ * @return bool
*/
public function trace($url, $options = array()){
$options['CURLOPT_CUSTOMREQUEST'] = 'TRACE';
}
/**
* HTTP OPTIONS method
+ *
+ * @param string $url
+ * @param array $options
+ * @return bool
*/
public function options($url, $options = array()){
$options['CURLOPT_CUSTOMREQUEST'] = 'OPTIONS';
/**
* This class is used by cURL class, use case:
*
+ * <code>
* $CFG->repositorycacheexpire = 120;
* $CFG->curlcache = 120;
*
* $c = new curl(array('cache'=>true), 'module_cache'=>'repository');
* $ret = $c->get('http://www.google.com');
+ * </code>
*
+ * @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'){
}
/**
- * TODO Document
+ * @todo Document this function
+ *
+ * @global object
+ * @global object
+ * @param mixed $param
+ * @return bool|string
*/
public function get($param){
global $CFG, $USER;
}
/**
- * TODO Document
+ * @todo Document this function
+ *
+ * @global object
+ * @global object
+ * @param mixed $param
+ * @param mixed $val
*/
public function set($param, $val){
global $CFG, $USER;
}
/**
- * TODO Document
+ * @todo Document this function
+ *
+ * @param int $expire The number os seconds before expiry
*/
public function cleanup($expire){
if($dir = opendir($this->dir)){
/**
* delete current user's cache file
*
- * @return null
+ * @global object
+ * @global object
*/
public function refresh(){
global $CFG, $USER;
}
/**
- * 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)) {
}
/**
- * TODO Document
+ * @todo Document this function
+ * @param array $parent
+ * @param array $types
*/
private function _browse_nodes($parent, $types) {
$key = (string)$parent['TEXT'];
}
/**
- * TODO Document
+ * @todo Document this function
+ * @param array $parent
*/
private function _select_nodes($parent){
if(isset($parent->node)) {
/**
- * TODO Document
+ * @todo Document this function
+ * @param array $types
+ * @return mixed
*/
public function get_file_ext($types) {
$this->result = array();
-<?php // $Id$
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.org //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
-// //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* 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);
/**
* 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() {
}
/**
- * @return the singleton instance.
+ * @global object
+ * @return object the singleton instance.
*/
public static function instance() {
if (is_null(self::$singletoninstance)) {
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();
}
/**
- * 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) {
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);
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);
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);
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));
/// <nolink> tags removed for XHTML compatibility
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();
/**
* 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 '';
}
/**
* 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),
/**
* 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;
/**
$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.
*/
/**
* 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.
$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;
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='<span class="highlight">',
$hreftagend='</span>',
$casesensitive=false,
* 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.
*/
/**
* 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.
/**
* 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.
/**
* 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() {
/**
* 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() {
/**
* 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.
/**
* 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;
/**
* 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.
/**
* 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.
* 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.
/**
* 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.
* 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
/**
* 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:
/**
* 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() {
/**
* 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) {
/**
* 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) {
* (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.
*/
/**
* 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.
*/
/**
* 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.
*/
/**
* 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) {
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
* 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) {
* 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) {
/**
* Add missing openpopup javascript to HTML files.
+ *
+ * @global object
+ * @param string $text
+ * @return string
*/
function filter_add_javascript($text) {
global $CFG;
<?php
/**
- * Modified by Dongsheng Cai <dongsheng@cvs.moodle.org>
- * 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 <dongsheng@cvs.moodle.org>
+ * 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;
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
* 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 = '')
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")
{
}
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.
*/
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)
{
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;
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);
}
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);
}
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);
}
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);
}
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);
}
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);
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);
}
}
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();
}
}
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();
}
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);
}
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
* 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);
}
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);
}
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;
}
-<?php // $Id$
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
* formslib.php - library of classes for creating forms in Moodle, based on PEAR QuickForms.
*
* elements, these elements clean themselves.
*
*
- * @author Jamie Pratt
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @copyright Jamie Pratt <me@jamiep.org>
+ * @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';
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;
* 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 <me@jamiep.org>
+ * @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;
/**
protected $_customdata;
/**
* definition_after_data executed flag
- * @var definition_finalized
+ * @var object definition_finalized
*/
protected $_definition_finalized = false;
* 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)){
/**
* 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();
/**
* 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;
$this->_form->setDefaults($default_values);
}
+ /**
+ * @param bool $um
+ */
function set_upload_manager($um=false) {
debugging('Not used anymore, please fix code!');
}
return $this->_form->isSubmitted();
}
+ /**
+ * @staticvar bool $nosubmit
+ */
function no_submit_button_pressed(){
static $nosubmit = null; // one check is enough
if (!is_null($nosubmit)){
/**
* Check that form data is valid.
*
+ * @staticvar bool $validated
* @return bool true if form data valid
*/
function is_validated() {
/**
* 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');
/**
* Returns name of uploaded file.
+ *
+ * @global object
* @param string $elname, first element if null
* @return mixed false in case of failure, string if ok
*/
/**
* 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
/**
* Save file to local filesystem pool
+ *
+ * @global object
* @param string $elname name of element
* @param int $newcontextid
* @param string $newfilearea
/**
* Get content of uploaded file.
+ *
+ * @global object
* @param $element name of file upload element
* @return mixed false in case of failure, string if ok
*/
/**
* 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
*/
* 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 <me@jamiep.org>
+ * @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();
/**
/**
* 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 <form> 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){
/**
* 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
*/
parent::accept($renderer);
}
-
-
+ /**
+ * @param string $elementName
+ */
function closeHeaderBefore($elementName){
$renderer =& $this->defaultRenderer();
$renderer->addStopFieldsetElements($elementName);
$this->_types = $paramtypes + $this->_types;
}
+ /**
+ * @param array $submission
+ * @param array $files
+ */
function updateSubmission($submission, $files) {
$this->_flagSubmitted = false;
}
}
+ /**
+ * @return string
+ */
function getReqHTML(){
return $this->_reqHTML;
}
-
+
+ /**
+ * @return string
+ */
function getAdvancedHTML(){
return $this->_advancedHTML;
}
* 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'){
* 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)){
/**
* 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
$element->onQuickFormEvent('updateValue', null, $this);
}
+ /**
+ * @param string $elementList
+ */
function exportValues($elementList = null){
$unfiltered = array();
if (null === $elementList) {
* @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)
{
* @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)
{
}
}
+ /**
+ * @return string
+ */
function getLockOptionEndScript(){
$iname = $this->getAttribute('id').'items';
return $js;
}
+ /**
+ * @param mixed $element
+ * @return array
+ */
function _getElNamesRecursive($element) {
if (is_string($element)) {
if (!$this->elementExists($element)) {
$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;
}
* 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)
{
*
* 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)
{
*
* Stylesheet is part of standard theme and should be automatically included.
*
- * @author Jamie Pratt <me@jamiep.org>
- * @license gpl license
+ * @package moodlecore
+ * @copyright Jamie Pratt <me@jamiep.org>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
parent::HTML_QuickForm_Renderer_Tableless();
}
+ /**
+ * @param array $elements
+ */
function setAdvancedElements($elements){
$this->_advancedElements = $elements;
}
/**
* What to do when starting the form
*
- * @param MoodleQuickForm $form
+ * @param object $form MoodleQuickForm
*/
function startForm(&$form){
$this->_reqHTML = $form->getReqHTML();
}
-
+
+ /**
+ * @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()];
}
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'))) {
parent::renderElement($element, $required, $error);
}
+ /**
+ * @param object $form Passed by reference
+ */
function finishForm(&$form){
if ($form->isFrozen()){
$this->_hiddenHtml = '';
/**
* 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
*/
}
}
-
+/**
+ * @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');
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
* 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) {
/**
* 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
* 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
* 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
* 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') {
-<?php // $Id$
+<?php
/**
* Moodle - Modular Object-Oriented Dynamic Learning Environment
* http://moodle.org
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- * @package moodle
+ * @package moodlecore
* @subpackage lib
- * @author Dan Poltawski <talktodan@gmail.com>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL
+ * @copyright Dan Poltawski <talktodan@gmail.com>
+ * @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');
/**
* 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 <talktodan@gmail.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class google_auth_request extends curl{
protected $token = '';
/**
* 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 <talktodan@gmail.com>
+ * @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';
/**
* Allows http calls using google subauth authorisation
+ *
+ * @package moodlecore
+ * @subpackage lib
+ * @copyright Dan Poltawski <talktodan@gmail.com>
+ * @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';
/**
* 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 <talktodan@gmail.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class google_docs {
// need both docs and the spreadsheets realm
/**
* 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 <talktodan@gmail.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class google_picasa {
const REALM = 'http://picasaweb.google.com/data/';
/**
* 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 <talktodan@gmail.com>
+ * @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';
-<?php // $Id$
-
-///////////////////////////////////////////////////////////////////////////
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.org //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* 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');
* '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
/**
* 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'
/**
* 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;
/**
* 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
*/
/**
* Returns all course gradebook settings as object properties
+ *
+ * @global object
* @param int $courseid
* @return object
*/
/**
* Add/update course gradebook setting
+ *
+ * @global object
* @param int $courseid
* @param string $name of setting
* @param string value, NULL means no setting==remove
/**
* 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) {
}
}
+/**
+ * @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()) {
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;
$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)) {
/**
* 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
/**
* Returns grade letters array used in context
+ *
* @param object $context object or null for defaults
* @return array of grade_boundary=>letter_string
*/
/**
* 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) {
/**
* Force final grade recalculation in all course items
+ *
+ * @global object
* @param int $courseid
*/
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;
/**
* 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;
/**
* 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) {
/**
* Remove grade letters for given context
+ *
+ * @global object
* @param object $context
+ * @param bool $showfeedback
*/
function remove_grade_letters($context, $showfeedback) {
global $DB;
}
/**
* Remove all grade related course data - history is kept
+ *
+ * @global object
* @param int $courseid
* @param bool $showfeedback print feedback
*/
/**
* 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
/**
* Does gradebook cleanup when module uninstalled.
+ *
+ * @global object
+ * @global object
+ * @param string $modname
*/
function grade_uninstalled_module($modname) {
global $CFG, $DB;
/**
* Grading cron job
+ *
+ * @global object
+ * @global object
*/
function grade_cron() {
global $CFG, $DB;
/**
* Resel all course grades
+ *
* @param int $courseid
- * @return success
+ * @return bool success
*/
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) {
/**
* 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