Mastering Joomla! 1.5 Extension and Framework Development phần 10 ppsx

53 298 0
Mastering Joomla! 1.5 Extension and Framework Development phần 10 ppsx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Appendix [ 419 ] getName( ) : string Gets the name of the element. Returns Element name render( &xmlElement : JSimpleXMLElement, value : string, control_ name : string='params' ) : array Gets an array containing the rendered parts and attributes of the element. The array contains six items in order, tooltip [0], rendered input element [1], description [2], label [3], value [4], and name [5]. Parameters xmlElement JSimpleXMLElement element denition value Element value [control_name] Name of the control Returns An array containing rendered parts and attributes of the element JParameter extends JRegistry Handles INI string parameters. This class is used in conjunction with JElement subclasses and XML les that dene the nature of parameters. INI strings are used in database tables for values that do not have a specic eld. An instance of the class can be used to handle multiple INI strings (with different XML denitions), using groups to separate each one. When dealing with one INI string, omitting the group will always use the default group, '_default'. For more information about JParameter refer to the Parameters (Core JElements) section in this Appendix. Properties _elementPath : array Array of paths in which to nd JElement subclasses (not restricted to groups) _elements : array Associative array of JElement objects (not restricted to groups) _raw : string INI string _xml : array Associative array of JSimpleXMLElement objects that dene parameters (one object per group) Constructors __construct( data : string, path : string='' ) : JParameter Builds a new JParameter object and loads data and, if specied, the XML le. Parameters data INI string [path] Path to XML le Appendix [ 420 ] Methods addElemenrPath( path : mixed ) : void Adds a path, or array of paths, to search for JElement subclass les. Parameters path Path or array of paths bind( data : mixed, group : string=' _default' ) : boolean Binds data with parameters in the specied group. data can be an associative array, an object, or an INI string. Parameters data Data to bind [group] Parameter group Returns true on success def( key : string, value : string='', group : string= '_default' ) : string If the parameter is not dened, sets the value of the parameter in the specied group. Parameters key Parameter to get [value] Value if not dened [group] Parameter group Returns Up-to-date value of the parameter get( key : string, default : string='', group : string='_default' ) : string Gets the value of a parameter in the specied group. Returns the default value if the parameter is not set. Parameters key Parameter to retrieve [default] Default value to return [group] Parameter group Returns Value of the parameter getGroups( ) : mixed Gets an associative array of the group names and the number of parameters in each, dened by the corresponding JSimpleXMLElement object. Groups that do not have a JSimpleXMLElement object will not be included. Returns Associative array of group names and number of parameters in each. Returns false if no XML has been successfully loaded. Appendix [ 421 ] getNumParams( group : string=' _default' ) : mixed Gets the number of parameters dened by the associated JSimpleXMLElement object, in the specied group. Parameters [group] Parameter group Returns Number of parameters; false if no JSimpleXMLElement object exists getParam( &node : JSimpleXMLElement, control_name : string='params', group : string=' _default' ) : mixed Gets an array of parameter details from a group. The array contains six items in order: tooltip [0], HTML rendered string [1], description [2], label [3], value [4], and name [5]. Parameters Node JSimpleXMLElement parameter to render [control_name] Input names [group] Parameter group Returns Array of parameter details from a group getParams( name : string='params', group : string=' _default' ) : mixed Gets a two-dimensional array of all the parameters in a group. The inner arrays contain six items in order: tooltip [0], HTML rendered string [1], description [2], label [3], value [4], and name [5]. Parameters [name] Input names and ID prex [group] Parameter group Returns Two-dimensional array of all the parameters in a group; false on failure &loadElement( type : string, new : boolean=false ) : mixed Gets an instance of a JElement subclass object based on type. If an instance of the specied type does not exist, it will be created. If new is true, a new instance will be created even if there is an existing instance. JElements subclass objects are not restricted to groups. Parameters path Path to XML le [new] Force create new instance Returns Instance of a JElement object; false on failure loadSetupFile( path : string ) : boolean Builds a JSimpleXMLElement object from an XML le. The XML le can include the group name; if it does not, the group '_default' will be assumed. Parameters path Path to XML le Returns true on success Appendix [ 422 ] render( name : string='params', group : string=' _default' ) : mixed Renders a group within the parameters and returns an HTML string. Parameters [name] Input names and ID prex [group] Parameter group Returns HTML rendered string; false on failure renderToArray( name : string='params', group : string=' _default' ) : mixed Renders a group within the parameters and returns an array of HTML strings. Parameters [name] Input names and ID prex [group] Parameter group Returns Array of HTML rendered parameters; false on failure set( key : string, value : string='', group : string='_default' ) : string Sets the value of a parameter in the specied group. Parameters key Parameter to set [value] New value [group] Parameter group Returns Previous value of the parameter setXML( &xml : JSimpleXMLElement ) : void Sets an XML denition; the group is extracted from the group attribute of the object. Parameters [xml] JSimpleXMLElement object to add JCache abstract, extends JObject Handles caching. Several subclasses exist for caching different items; subclasses are sometimes referred to as JCache types. JCache uses JCacheStorage subclass objects to store and retrieve cache data. Properties _handler : JCacheStorage Storage handler _options : array Cache handling options Appendix [ 423 ] Constructors __construct( options : array ) : JCache Builds a new JCache object. The options associative array can contain the keys language, cachebase, defaultgroup, caching, and storage. language is used to create separate caches for different languages. cachebase is used as the path to the base cache folder. defaultgroup is the group name used when no group is specied in other methods. caching is a Boolean value; if true caching is enabled. Cached data is identied by an ID and a group. The way the cache is stored differs, depending on the chosen storage handler. storage is a string that denes the default storage handler type. Parameters options Associative array of options Methods clean( group : string=null, mode : string='group' ) : boolean Removes all cached items in group. If mode is 'group', removes all cached data in group, if mode is 'notgroup', removes all cached data in other groups. Parameters [group] Selected group [mode] Cleaning mode Returns true on success gc( ) : boolean Removes any redundant cached data (data that has expired). Returns true on success get( id : string, group : string=null ) : mixed Gets cached data. Cached data is identied by an ID and a group. Returns false if no cached data is available. Parameters id Cached data ID [group] Cached data group Returns Cached data; false if no cached data is found static &getInstance( type : string='output', options : array=array() ) : JCache Gets a new instance of a JCache subclass object based on type. options is passed to the constructor. Parameters [type] JRegistry instance identier [options] Options to pass to the constructor Returns A new instance of a JCache derived object Appendix [ 424 ] static getStores( ) : array Gets an array of storage handler names that will operate correctly in the current environment. Returns Array of storage handler names remove( id : string, group : string=null ) : boolean Removes cached data, identied by id and group. Parameters id Cached data ID [group] Cached data group Returns true if the data is removed setCacheValidation( ) : void Deprecated; this method no longer performs any action, and there is no replacement function or method. setCaching( enabled : boolean ) : void Enables and disables caching. Parameters enabled Turn caching on or off setLifeTime( lt : int ) : void Sets the maximum lifetime of cached items in seconds. Parameters lt Lifetime of cached items in seconds store( data : string, id : string, group : string=null ) : boolean Adds data to the cache, identied by id and group. Parameters data Data to chache id Cached data ID [group] Cached data group Returns true if the item is stored &_getStorageHandler( ) : JCacheStorage Gets the cache storage handler. If the handler does not exist it will be created. Returns Cache storage object JMail extends PHPMailer Sends emails. Appendix [ 425 ] Constructors JMail( ) : JMail Builds a new JMail object. Methods addAtachment( attachment : mixed ) : void Adds one attachment if attachment is a string (lename). Adds multiple attachments if attachment is an array (lenames). Parameters attachment Attachment le path or array of attachment le paths addBCC( bcc : mixed ) : void Adds one blind carbon copy recipient if bcc is a string. Adds multiple blind carbon copy recipients if bcc is an array. Parameters bcc Email address string or array of email addresses addCC( cc : mixed ) : void Adds one carbon copy recipient if cc is a string. Adds multiple carbon copy recipients if cc is an array. Parameters cc Email address string or array of email addresses addRecipient( recipient : mixed ) : void Adds one recipient if recipient is a string. Adds multiple recipients if recipient is an array. Parameters recipient Email address string or array of email addresses addReplyTo( replyto : array ) : void Sets the reply-to email address and name. replyto can be an array of two elements array('email@address', 'name') or an array of arrays in this format. Parameters from Email address array Appendix [ 426 ] static &getInstance( id : string='Joomla' ) : JMail Gets a reference to a global instance of a JMail object. If the object does not exist it will be created. id identies the JMail object to return. Parameters [id] JMail ID Returns Reference to a global JMail object &Send( ) : mixed Sends the email. Returns true on success, error on failure setBody( content : string ) : void Sets the email body. Parameters content Email body setSender( from : mixed ) : void Sets the sender's email address and name. from can either be an array of two elements— array('email@address', 'name')—or a string consisting of one email address Parameters from Email address string or array of email address and email name setSubject( subject : string ) : void Sets the email subject line. Parameters subject Email subject line useSendmail( sendmail : string=null ) : boolean If sendmail is specied, sets the object to use the sendmail path. If sendmail is not specied, sets the object to use the PHP mail() function. Parameters [sendmail] Path to sendmail Returns true if sendmail is enabled useSMTP( auth : boolean=null, host : string=null, user : string=null, pass : string=null ) : boolean If all parameters are specied, sets the object to use SMTP. If any of the parameters are not specied, sets the object to use the PHP mail() function. Parameters [auth] Use SMTP authorization [host] SMTP host [user] Username [pass] Password Returns true if SMTP is enabled Appendix [ 427 ] JMailHelper static Performs mail functions that are not specic to an individual JMail object. Methods static cleanAddress( address : string ) : mixed Determines if an email address is clean. An unclean email address may include spaces, semicolons, and commas. Parameters address Address to clean Returns Email address or false if the address is deemed to be unclean static cleanBody( body : string ) : string Cleans a multi-line string for use in an email body. Removes unsafe characters and potentially confusing MIME header strings. Parameters body String to clean Returns Cleaned string static cleanLine( value : string ) : string Cleans a line for use in an email. Removes unsafe characters. Parameters value String to clean Returns Cleaned string static cleanSubject( subject : string ) : string Cleans an email subject line. Removes unsafe characters and potentially confusing MIME header strings. Parameters subject String to clean Returns Cleaned string static cleanText( value : string) : string Cleans a multi-line string for use in an email. Removes unsafe characters and potentially confusing MIME header strings. Parameters value String to clean Returns Cleaned string Appendix [ 428 ] static isEmailAddress( email : string ) : boolean Checks if email is a valid email address. Parameters email Email to validate Returns true if email is in a valid format JFactory static Joomla! static factory class for accessing global objects and building new objects. Methods static &getACL( ) : JAuthorization Gets the global authorization object. If the authorization object does not exist it will be created. Returns Global authorization object static &getCache( group : string='', handler : string='callback', storage : string=null ) : JCache Gets the global cache object. If the cache object does not exist it will be created. group is the group to which the cache belongs.to which the cache belongs.which the cache belongs. handler is the handler to use; this can be callback, output, page, or view. storage is the storage mechanism to use; this can be apc, eaccelerator, file, memcache, or xcache. In most instances, it will not be necessary to dene handler or storage. Parameters [group] Cache group [handler] Handler type [storage] Storage type Returns Global cache object static &getConfig( file : string=null, type : string='PHP' ) : JRegistry Gets the global conguration object. If the object does not exist, it will be created. file is the path, including the name, of the conguration le. type is the format of conguration le; this currently has no effect. The parameters need only be specied the rst time this method is run. Parameters le Path and name of the conguration le [type] Type of conguration le Returns Global conguration object [...]... formats are INI, PHP, and XML If the namespace is not specified, the default namespace will be used params is passed to the format handler objectToString() method; use of params depends upon format Some format handlers are restricted to a maximum depth [format] Registry format handler name Parameters [namespace] [params] Returns The namespace to get Options to pass to the format handler String representation... expired, destroyed, or error) _store : JSessionStorage Session storage handler Constructors construct( store : string='none', options : array=array() ) : JSession Builds a new JSession object store is the storage handler type, normally database Parameters [store] Storage handler type [options] Options to pass to the storage handler [ 434 ] Appendix Methods clear( name : string, namespace : string='default'... null if the session has been destroyed Returns Session ID [ 435 ] Appendix static &getInstance( handler : string, options : array ) : JSession Gets the global instance of JSession If it doesn't already exist it will be created Parameters handler Storage handler type options Options to pass to the storage handler Returns Global session object getName( ) : string Gets the name of the session Returns null... internal URIs No processing will be performed if we are in the administrative area xhtml determines if ampersands should be encoded as HTML special character & url URI to convert Parameters xhtml Returns Make URI XHTML standard ssl URI is SSL Converted URI JMenu extends JObject Handles menus and menu items Properties _active : int ID of the current menu item _default : int ID of the default homepage... not use – and – Use default –; these options have the values -1 and null respectively Parameters [directory] [exclude] [filter] [hide_default] [hide_none] [stripExt] Directory where the files are located, relative to the root of Joomla! RE file exclusion, applied after filter RE filter to apply to file names Hide the 'use default' option; Boolean Hide the 'do not use' option; Boolean Remove extensions... use – and – Use default –; these options have the values -1 and null respectively [directory] Directory where the folders are located, relative to the root of Joomla! [exclude] [filter] [hide_default] [hide_none] [stripExt] Parameters RE folder exclusion, applied after filter RE filter to apply to folder names Hide the 'use default' option; Boolean Hide the 'do not use' option; Boolean Remove extensions... include the options – Do not use – and – Use default –; these options have the values -1 and null respectively [directory] Directory where the folders are located, relative Parameters to the root of Joomla! [exclude] RE file exclusion, applied after filter [hide_default] Hide the 'use default' option; Boolean [hide_none] Hide the 'do not use' option; Boolean [stripExt] Remove extensions from the file list;... query and gets the value in the first field of the first record Returns Value in the first field of the first record loadResultArray( numinarray : int= 0 ) : array Executes the current query and gets an array of the specified column/field number from the resultant records Parameters [numinarray] Column/Field number Returns Array of column from records loadRow( ) : array Executes the current query and. .. PageExecute( sql : string, nrows : int, page : int, inputarr : boolean=false, sec2cache : int=0 ) : JRecordSet Emulates ADOdb functionality Executes query and returns the results in a JRecordSet object nrows and page are used to determine the offset and limit sql Query to execute Parameters nrows Results page (pagination) [inputarr] Ignored; emulation purposes only [secs2cache] Returns Number of records... expired, destroyed, or error) Returns State of the session getStores( ) : array Gets the names of session storage handlers that work in the current environment Returns Array of session storage handler names getToken( forceNew : boolean=false ) : string Gets the session token The token is a random alphanumeric string that can be used to increase security of requests Parameters [forceNew] Create a new token . rendered parts and attributes of the element. The array contains six items in order, tooltip [0], rendered input element [1] , description [2], label [3], value [4], and name [5] . Parameters xmlElement. items in order: tooltip [0], HTML rendered string [1] , description [2], label [3], value [4], and name [5] . Parameters [name] Input names and ID prex [group] Parameter group Returns Two-dimensional. object. store is the storage handler type, normally database. Parameters [store] Storage handler type [options] Options to pass to the storage handler Appendix [ 4 35 ] Methods clear( name : string,

Ngày đăng: 14/08/2014, 11:21

Từ khóa liên quan

Mục lục

  • Mastering Joomla! 1.5 Extension and Framework Development

    • Appendix

      • Classes

        • JParameter

          • Properties

          • Constructors

          • Methods

          • JCache

            • Properties

            • Constructors

            • Methods

            • JMail

              • Constructors

              • Methods

              • JMailHelper

                • Methods

                • JFactory

                  • Methods

                  • JRegistry

                    • Properties

                    • Constructors

                    • Methods

                    • JSession

                      • Properties

                      • Constructors

                      • Methods

                      • JRoute

                        • Methods

                        • JMenu

                          • Properties

                          • Constructors

                          • Methods

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan