idx
int64 0
60.3k
| question
stringlengths 64
4.24k
| target
stringlengths 5
618
|
|---|---|---|
46,300
|
public function trigger ( Event $ event ) { $ this -> called = true ; if ( $ this -> listener instanceof Closure ) { $ response = call_user_func ( $ this -> listener , $ event ) ; } else { $ response = call_user_func ( array ( $ this -> listener , $ event -> getName ( ) ) , $ event ) ; } if ( $ event -> isStopped ( ) ) { $ this -> stoppedPropagation = true ; } return $ response ; }
|
Did this listener stop propagation?
|
46,301
|
private function convertDateKeysInObjects ( $ object ) { if ( ! is_object ( $ object ) ) { return $ object ; } foreach ( array_keys ( get_object_vars ( $ object ) ) as $ key ) { if ( in_array ( $ key , $ this -> dateKeys ) ) { $ object -> $ key = with ( new Date ( $ object -> $ key ) ) -> format ( 'Y-m-d\TH:i:s\Z' ) ; } } return $ object ; }
|
Convert dates from SQL format to ISO 8601
|
46,302
|
public function render ( $ error ) { try { if ( ! $ this -> document ) { exit ( $ error -> getMessage ( ) ) ; } $ this -> document -> setType ( 'error' ) ; $ this -> document -> setError ( $ error ) ; if ( ob_get_contents ( ) ) { ob_end_clean ( ) ; } $ this -> document -> setTitle ( \ Lang :: txt ( 'Error' ) . ': ' . $ error -> getCode ( ) ) ; $ template = $ this -> template -> load ( ) ; $ data = $ this -> document -> render ( false , array ( 'template' => $ template -> template , 'directory' => dirname ( $ template -> path ) , 'debug' => $ this -> debug ) ) ; if ( empty ( $ data ) ) { exit ( $ error -> getMessage ( ) . ' in ' . $ error -> getFile ( ) . ':' . $ error -> getLine ( ) ) ; } else { $ status = $ error -> getCode ( ) ? $ error -> getCode ( ) : 500 ; $ status = ( $ status < 100 || $ status >= 600 ) ? 500 : $ status ; $ response = new Response ( $ data , $ status ) ; $ response -> send ( ) ; exit ( ) ; } } catch ( Exception $ e ) { $ plain = new Plain ( $ this -> debug ) ; $ plain -> render ( $ e ) ; } }
|
Render the error page based on an exception .
|
46,303
|
public function instance ( $ type = null , $ options = array ( ) ) { $ type = $ type ? : $ this -> getType ( ) ; $ signature = serialize ( array ( $ type , $ options ) ) ; if ( ! isset ( $ this -> types [ $ signature ] ) ) { try { $ document = $ this -> createType ( $ type , $ options ) ; } catch ( Exception $ e ) { $ document = $ this -> createType ( 'html' , $ options ) ; } $ this -> types [ $ signature ] = $ document ; } return $ this -> types [ $ signature ] ; }
|
Get a type instance .
|
46,304
|
protected function createType ( $ type , $ options = array ( ) ) { $ type = preg_replace ( '/[^A-Z0-9_\.-]/i' , '' , $ type ) ; $ class = __NAMESPACE__ . '\\Type\\' . ucfirst ( $ type ) ; if ( ! class_exists ( $ class ) ) { throw new InvalidArgumentException ( "Type [$type] not supported." ) ; } return new $ class ( $ options ) ; }
|
Create a new type instance .
|
46,305
|
public static function find ( $ type , $ authenticator , $ domain , $ username ) { $ hzad = Domain :: find_or_create ( $ type , $ authenticator , $ domain ) ; if ( ! is_object ( $ hzad ) ) { return false ; } if ( empty ( $ username ) ) { return false ; } $ row = self :: all ( ) -> whereEquals ( 'auth_domain_id' , $ hzad -> get ( 'id' ) ) -> whereEquals ( 'username' , $ username ) -> row ( ) ; if ( ! $ row || ! $ row -> get ( 'id' ) ) { return false ; } return $ row ; }
|
Find existing auth_link entry return false if none exists
|
46,306
|
public static function find_or_create ( $ type , $ authenticator , $ domain , $ username ) { $ hzad = Domain :: find_or_create ( $ type , $ authenticator , $ domain ) ; if ( ! $ hzad ) { return false ; } if ( empty ( $ username ) ) { return false ; } $ row = self :: all ( ) -> whereEquals ( 'auth_domain_id' , $ hzad -> get ( 'id' ) ) -> whereEquals ( 'username' , $ username ) -> row ( ) ; if ( ! $ row || ! $ row -> get ( 'id' ) ) { $ row = self :: blank ( ) ; $ row -> set ( 'auth_domain_id' , $ hzad -> get ( 'id' ) ) ; $ row -> set ( 'username' , $ username ) ; $ row -> save ( ) ; } if ( ! $ row -> get ( 'id' ) ) { return false ; } return $ row ; }
|
Find a record creating it if not found .
|
46,307
|
public static function find_by_user_id ( $ user_id = null ) { if ( empty ( $ user_id ) ) { return false ; } $ l = self :: blank ( ) -> getTableName ( ) ; $ d = Domain :: blank ( ) -> getTableName ( ) ; $ results = self :: all ( ) -> select ( $ l . '.*' ) -> select ( $ d . '.authenticator' , 'auth_domain_name' ) -> join ( $ d , $ d . '.id' , $ l . '.auth_domain_id' , 'inner' ) -> whereEquals ( $ l . '.user_id' , $ user_id ) -> rows ( ) ; if ( empty ( $ results ) ) { return false ; } return $ results -> toArray ( ) ; }
|
Return array of linked accounts associated with a given user id Also include auth domain name for easy display of domain name
|
46,308
|
public static function find_trusted_emails ( $ user_id ) { if ( empty ( $ user_id ) || ! is_numeric ( $ user_id ) ) { return false ; } $ results = self :: all ( ) -> whereEquals ( 'user_id' , $ user_id ) -> rows ( ) -> fieldsByKey ( 'email' ) ; if ( empty ( $ results ) ) { return false ; } return $ results ; }
|
Find trusted emails by User ID
|
46,309
|
public static function delete_by_user_id ( $ user_id = null ) { if ( empty ( $ user_id ) ) { return true ; } $ results = self :: all ( ) -> whereEquals ( 'user_id' , $ user_id ) -> rows ( ) ; foreach ( $ results as $ result ) { if ( ! $ result -> destroy ( ) ) { return false ; } } return true ; }
|
Delete a record by User ID
|
46,310
|
public static function find_by_email ( $ email , $ exclude = array ( ) ) { if ( empty ( $ email ) ) { return false ; } $ query = self :: all ( ) -> whereEquals ( 'email' , $ email ) ; if ( ! empty ( $ exclude [ 0 ] ) ) { foreach ( $ exclude as $ e ) { $ query -> where ( 'auth_domain_id' , '!=' , $ e ) ; } } $ rows = $ query -> rows ( ) ; $ results = array ( ) ; foreach ( $ rows as $ row ) { $ result = $ row -> toArray ( ) ; $ result [ 'auth_domain_name' ] = $ row -> domain -> get ( 'authenticator' ) ; $ results [ ] = $ result ; } if ( empty ( $ results ) ) { return false ; } return $ results ; }
|
Return array of linked accounts associated with a given email address Also include auth domain name for easy display of domain name
|
46,311
|
public function close ( $ value ) { if ( ! ( $ value instanceof Closure ) ) { $ value = function ( $ uri ) use ( $ value ) { if ( is_callable ( $ value ) ) { return call_user_func_array ( $ value , array ( $ uri ) ) ; } return $ value ; } ; } return $ value ; }
|
Wrap value in a Closure
|
46,312
|
public function append ( $ key , $ value ) { if ( ! $ this -> has ( $ key , $ value ) ) { $ this -> data [ $ key ] = $ this -> close ( $ value ) ; } return $ this ; }
|
Add item to the end of the array
|
46,313
|
public function prepend ( $ key , $ value ) { if ( $ this -> has ( $ key ) ) { unset ( $ this -> data [ $ key ] ) ; } $ data = array ( $ key => $ this -> close ( $ value ) ) ; $ this -> data = $ data + $ this -> data ; return $ this ; }
|
Add item to the beginning of the array
|
46,314
|
public function set ( $ key , $ value ) { $ this -> data [ $ key ] = $ this -> close ( $ value ) ; return $ this ; }
|
Get all of the rules from the bag for a given key
|
46,315
|
public function clear ( ) { $ classvars = get_class_vars ( __CLASS__ ) ; foreach ( $ classvars as $ property => $ value ) { if ( '_s_' == substr ( $ property , 0 , 3 ) ) { continue ; } unset ( $ this -> $ property ) ; $ this -> $ property = $ value ; } $ objvars = get_object_vars ( $ this ) ; foreach ( $ objvars as $ property => $ value ) { if ( ! array_key_exists ( $ property , $ classvars ) ) { unset ( $ this -> $ property ) ; } } return true ; }
|
Reset all properties making an empty profile object
|
46,316
|
private function _mysql_load ( $ user ) { $ db = \ App :: get ( 'db' ) ; if ( empty ( $ user ) ) { $ this -> setError ( 'No user specified' ) ; return false ; } if ( is_numeric ( $ user ) ) { $ query = "SELECT * FROM `#__xprofiles` WHERE uidNumber = " . $ db -> quote ( intval ( $ user ) ) . ";" ; } else { $ query = "SELECT * FROM `#__xprofiles` WHERE username = " . $ db -> quote ( $ user ) . " AND uidNumber>0;" ; } $ db -> setQuery ( $ query ) ; $ result = $ db -> loadAssoc ( ) ; if ( $ result === false ) { $ this -> setError ( 'Error retrieving data from xprofiles table: ' . $ db -> getErrorMsg ( ) ) ; return false ; } if ( empty ( $ result ) ) { $ this -> setError ( 'No such user [' . $ user . ']' ) ; return false ; } $ this -> clear ( ) ; $ this -> _params = new Registry ( $ result [ 'params' ] ) ; foreach ( $ result as $ property => $ value ) { $ this -> set ( $ property , $ value ) ; } $ classvars = get_class_vars ( __CLASS__ ) ; foreach ( $ classvars as $ property => $ value ) { if ( '_auxv_' == substr ( $ property , 0 , 6 ) || '_auxs_' == substr ( $ property , 0 , 6 ) ) { $ this -> $ property = false ; } } $ this -> _params -> merge ( $ this -> params ) ; return true ; }
|
Load a record from the MySQL database
|
46,317
|
private function _mysql_author_load ( $ authorid ) { static $ _propertyauthormap = array ( 'uidNumber' => 'id' , 'givenName' => 'firstname' , 'middleName' => 'middlename' , 'surname' => 'lastname' , 'organization' => 'org' , 'bio' => 'bio' , 'url' => 'url' , 'picture' => 'picture' , 'vip' => 'principal_investigator' ) ; $ db = \ App :: get ( 'db' ) ; $ query = "SELECT * FROM `#__author` WHERE id=" . $ db -> quote ( $ authorid ) ; $ db -> setQuery ( $ query ) ; $ result = $ db -> loadAssoc ( ) ; if ( $ result === false ) { $ this -> setError ( 'Error retrieving data from author table: ' . $ db -> getErrorMsg ( ) ) ; return false ; } if ( empty ( $ result ) ) { $ this -> setError ( 'No such author [' . $ authorid . ']' ) ; return false ; } $ this -> clear ( ) ; foreach ( $ _propertyauthormap as $ property => $ aproperty ) { if ( ! empty ( $ result [ $ aproperty ] ) ) { $ this -> set ( $ property , $ result [ $ aproperty ] ) ; } } return true ; }
|
Load an author record into this profile
|
46,318
|
private function _xregistration_load ( $ registration ) { static $ _propertyregmap = array ( 'username' => 'login' , 'name' => 'name' , 'email' => 'email' , 'orcid' => 'orcid' , 'orgtype' => 'orgtype' , 'organization' => 'org' , 'countryresident' => 'countryresident' , 'countryorigin' => 'countryorigin' , 'gender' => 'sex' , 'url' => 'web' , 'reason' => 'reason' , 'mailPreferenceOption' => 'mailPreferenceOption' , 'usageAgreement' => 'usageAgreement' , 'nativeTribe' => 'nativeTribe' , 'phone' => 'phone' , 'disability' => 'disability' , 'hispanic' => 'hispanic' , 'race' => 'race' , 'admin' => 'admin' , 'host' => 'host' , 'edulevel' => 'edulevel' , 'role' => 'role' , 'givenName' => 'givenName' , 'middleName' => 'middleName' , 'surname' => 'surname' ) ; if ( ! is_object ( $ registration ) ) { $ this -> setError ( "Invalid XRegistration object" ) ; return false ; } foreach ( $ _propertyregmap as $ property => $ rproperty ) { if ( $ registration -> get ( $ rproperty ) !== null ) { $ this -> set ( $ property , $ registration -> get ( $ rproperty ) ) ; } } $ this -> set ( 'mailPreferenceOption' , $ this -> get ( 'mailPreferenceOption' ) ? $ this -> get ( 'mailPreferenceOption' ) : '-1' ) ; $ this -> set ( 'usageAgreement' , $ this -> get ( 'usageAgreement' ) ? '1' : '0' ) ; return true ; }
|
Bind registration data
|
46,319
|
public function loadRegistration ( & $ registration ) { if ( ! is_object ( $ registration ) ) { return false ; } $ keys = array ( 'email' , 'name' , 'orgtype' , 'countryresident' , 'countryorigin' , 'disability' , 'hispanic' , 'race' , 'phone' , 'reason' , 'edulevel' , 'role' , 'surname' , 'givenName' , 'middleName' , 'orcid' ) ; foreach ( $ keys as $ key ) { if ( $ registration -> get ( $ key ) !== null ) { $ this -> set ( $ key , $ registration -> get ( $ key ) ) ; } } if ( $ registration -> get ( 'login' ) !== null ) { $ this -> set ( 'username' , $ registration -> get ( 'login' ) ) ; } if ( $ registration -> get ( 'password' ) !== null ) { $ this -> set ( 'password' , $ registration -> get ( 'password' ) ) ; } if ( $ registration -> get ( 'org' ) !== null || $ registration -> get ( 'orgtext' ) !== null ) { $ this -> set ( 'organization' , $ registration -> get ( 'org' ) ) ; if ( $ registration -> get ( 'orgtext' ) ) { $ this -> set ( 'organization' , $ registration -> get ( 'orgtext' ) ) ; } } if ( $ registration -> get ( 'sex' ) !== null ) { $ this -> set ( 'gender' , $ registration -> get ( 'sex' ) ) ; } if ( $ registration -> get ( 'nativetribe' ) !== null ) { $ this -> set ( 'nativeTribe' , $ registration -> get ( 'nativetribe' ) ) ; } if ( $ registration -> get ( 'web' ) !== null ) { $ this -> set ( 'url' , $ registration -> get ( 'web' ) ) ; } if ( $ registration -> get ( 'mailPreferenceOption' ) !== null ) { $ this -> set ( 'mailPreferenceOption' , $ registration -> get ( 'mailPreferenceOption' ) ? $ registration -> get ( 'mailPreferenceOption' ) : '-1' ) ; } if ( $ registration -> get ( 'usageAgreement' ) !== null ) { $ this -> set ( 'usageAgreement' , $ registration -> get ( 'usageAgreement' ) ? true : false ) ; } return true ; }
|
Load registration data
|
46,320
|
public function load ( $ user , $ storage = 'mysql' ) { if ( ! empty ( $ storage ) && ! in_array ( $ storage , array ( 'mysql' , 'author' , 'xregistration' ) ) ) { $ this -> setError ( 'Invalid storage option requested [' . $ storage . ']' ) ; return false ; } if ( $ storage == 'mysql' ) { return $ this -> _mysql_load ( $ user ) ; } if ( $ storage == 'author' ) { return $ this -> _mysql_load_author ( $ user ) ; } if ( $ storage == 'xregistration' ) { return $ this -> _xregistration_load ( $ user ) ; } return true ; }
|
Load a record
|
46,321
|
public static function getInstance ( $ id = null ) { static $ instances ; static $ usernames ; if ( ! isset ( $ instances ) ) { $ instances = array ( ) ; } if ( ! isset ( $ usernames ) ) { $ usernames = array ( ) ; } if ( ! is_numeric ( $ id ) ) { $ id = strtolower ( trim ( $ id ) ) ; if ( ! isset ( $ usernames [ $ id ] ) ) { $ user = new self ( $ id ) ; $ usernames [ $ id ] = $ user -> get ( 'uidNumber' ) ; $ instances [ $ usernames [ $ id ] ] = $ user ; } $ id = $ usernames [ $ id ] ; } if ( empty ( $ instances [ $ id ] ) || $ instances [ $ id ] -> get ( 'uidNumber' ) != $ id ) { $ user = new self ( $ id ) ; $ instances [ $ id ] = $ user ; } if ( ! $ instances [ $ id ] -> get ( 'uidNumber' ) ) { return false ; } return $ instances [ $ id ] ; }
|
Returns a reference to the global User object only creating it if it doesn t already exist .
|
46,322
|
public function create ( ) { $ db = \ App :: get ( 'db' ) ; $ modifiedDate = gmdate ( 'Y-m-d H:i:s' ) ; if ( is_numeric ( $ this -> get ( 'uidNumber' ) ) ) { $ query = "INSERT INTO `#__xprofiles` (uidNumber,username,modifiedDate) VALUE (" . $ db -> quote ( $ this -> get ( 'uidNumber' ) ) . ',' . $ db -> quote ( $ this -> get ( 'username' ) ) . ',' . $ db -> quote ( $ modifiedDate ) . ");" ; $ db -> setQuery ( $ query ) ; if ( ! $ db -> query ( ) ) { $ errno = $ db -> getErrorNum ( ) ; if ( $ errno == 1062 ) { $ this -> setError ( 'uidNumber (' . $ this -> get ( 'uidNumber' ) . ') already exists' . ' in xprofiles table' ) ; } else { $ this -> setError ( 'Error inserting user data to xprofiles table: ' . $ db -> getErrorMsg ( ) ) ; } return false ; } } else { $ token = uniqid ( ) ; $ query = "INSERT INTO `#__xprofiles` (uidNumber,username,modifiedDate) SELECT " . "IF(MIN(uidNumber)>0,-1,MIN(uidNumber)-1)," . $ db -> quote ( $ token ) . ',' . $ db -> quote ( $ modifiedDate ) . " FROM #__xprofiles;" ; $ db -> setQuery ( $ query ) ; if ( ! $ db -> query ( ) ) { $ this -> setError ( 'Error inserting non-user data to xprofiles table: ' . $ db -> getErrorMsg ( ) ) ; return false ; } $ query = "SELECT uidNumber FROM `#__xprofiles` WHERE username=" . $ db -> quote ( $ token ) . " AND modifiedDate=" . $ db -> quote ( $ modifiedDate ) ; $ db -> setQuery ( $ query ) ; $ result = $ db -> loadColumn ( ) ; if ( $ result === false ) { $ this -> setError ( 'Error adding data to xprofiles table: ' . $ db -> getErrorMsg ( ) ) ; return false ; } if ( count ( $ result ) > 1 ) { $ this -> setError ( 'Error adding data to xprofiles table: ' . $ db -> getErrorMsg ( ) ) ; return false ; } $ this -> set ( 'uidNumber' , $ result [ 0 ] ) ; } $ this -> set ( 'modifiedDate' , $ modifiedDate ) ; if ( $ this -> update ( ) === false ) { return false ; } return true ; }
|
Create a new entry in the profiles table
|
46,323
|
public function get ( $ property , $ default = null ) { if ( $ property == 'password' ) { return $ this -> _password ; } if ( '_' == substr ( $ property , 0 , 1 ) ) { $ this -> setError ( "Can't access private properties" ) ; return false ; } if ( ! property_exists ( __CLASS__ , $ property ) ) { if ( property_exists ( __CLASS__ , '_auxs_' . $ property ) ) { $ property = '_auxs_' . $ property ; } else if ( property_exists ( __CLASS__ , '_auxv_' . $ property ) ) { $ property = '_auxv_' . $ property ; } else { $ this -> setError ( "Unknown property: $property" ) ; return false ; } } if ( $ this -> $ property === false ) { $ db = \ App :: get ( 'db' ) ; $ property_name = substr ( $ property , 6 ) ; $ query = "SELECT $property_name FROM `#__xprofiles` AS x, `#__xprofiles_$property_name` AS xp WHERE x.uidNumber=xp.uidNumber AND xp.uidNumber=" . $ db -> quote ( $ this -> get ( 'uidNumber' ) ) . " ORDER BY $property_name ASC;" ; $ db -> setQuery ( $ query ) ; $ result = $ db -> loadColumn ( ) ; if ( $ result === false ) { $ this -> setError ( "Error retrieving data from xprofiles $property table: " . $ db -> getErrorMsg ( ) ) ; } else if ( '_auxs_' == substr ( $ property , 0 , 6 ) ) { if ( isset ( $ result [ 0 ] ) ) { $ this -> set ( $ property_name , $ result [ 0 ] ) ; } else { $ this -> set ( $ property_name , '' ) ; } } else { if ( is_array ( $ result ) && count ( $ result ) <= 1 && empty ( $ result [ 0 ] ) ) { $ this -> set ( $ property_name , array ( ) ) ; } else { $ this -> set ( $ property_name , $ result ) ; } } } return $ this -> $ property ; }
|
Get a property s value
|
46,324
|
public function set ( $ property , $ value = null ) { if ( $ property == 'password' ) { if ( $ value != '' ) { $ this -> userPassword = \ Hubzero \ User \ Password :: getPasshash ( $ value ) ; } else { $ this -> userPassword = '' ; } $ this -> _password = $ value ; return true ; } if ( '_' == substr ( $ property , 0 , 1 ) ) { $ this -> setError ( "Can't access private properties" ) ; return false ; } if ( ! property_exists ( __CLASS__ , $ property ) ) { if ( property_exists ( __CLASS__ , '_auxs_' . $ property ) ) { $ property = '_auxs_' . $ property ; } else if ( property_exists ( __CLASS__ , '_auxv_' . $ property ) ) { $ property = '_auxv_' . $ property ; } else { $ this -> setError ( "Unknown property: $property" ) ; return false ; } } if ( '_auxv_' == substr ( $ property , 0 , 6 ) ) { if ( empty ( $ value ) ) { $ value = array ( ) ; } else { if ( ! is_array ( $ value ) ) { $ value = array ( $ value ) ; } $ list = array_unique ( $ value ) ; sort ( $ list ) ; unset ( $ value ) ; foreach ( $ list as $ v ) { $ value [ ] = strval ( $ v ) ; } } } elseif ( is_string ( $ value ) ) { $ value = strval ( $ value ) ; } $ this -> $ property = $ value ; if ( $ property == 'userPassword' ) { $ this -> _password = '' ; } return true ; }
|
Set a property s value
|
46,325
|
public function add ( $ property , $ value ) { if ( '_' == substr ( $ property , 0 , 1 ) ) { $ this -> setError ( "Can't access private properties" ) ; return false ; } if ( property_exists ( __CLASS__ , $ property ) || property_exists ( __CLASS__ , '_auxs_' . $ property ) ) { $ this -> setError ( "Can't add value(s) to non-array property." ) ; return false ; } if ( ! property_exists ( __CLASS__ , '_auxv_' . $ property ) ) { $ this -> setError ( "Unknown property: $property" ) ; return false ; } if ( empty ( $ value ) ) { return true ; } if ( ! is_array ( $ value ) ) { $ value = array ( $ value ) ; } $ property = '_auxv_' . $ property ; foreach ( $ value as $ v ) { $ v = strval ( $ v ) ; if ( ! in_array ( $ v , $ this -> $ property ) ) { array_push ( $ this -> $ property , $ v ) ; } } sort ( $ this -> $ property ) ; return true ; }
|
Add to a list of values for multi - value properties
|
46,326
|
public function remove ( $ property , $ value ) { if ( '_' == substr ( $ property , 0 , 1 ) ) { $ this -> setError ( "Can't access private properties" ) ; return false ; } if ( property_exists ( __CLASS__ , $ property ) || property_exists ( __CLASS__ , '_auxs_' . $ property ) ) { $ this -> setError ( "Can't remove value(s) from non-array property." ) ; return false ; } if ( ! property_exists ( __CLASS__ , '_auxv_' . $ property ) ) { $ this -> setError ( "Unknown property: $property" ) ; return false ; } if ( ! isset ( $ value ) ) { return true ; } if ( ! is_array ( $ value ) ) { $ value = array ( $ value ) ; } $ property = '_auxv_' . $ property ; foreach ( $ value as $ v ) { $ v = strval ( $ v ) ; if ( in_array ( $ v , $ this -> $ property ) ) { $ this -> $ property = array_diff ( $ this -> $ property , array ( $ v ) ) ; } } return true ; }
|
Remove from a list of values for multi - value properties
|
46,327
|
public static function userHasPermissionForGroupAction ( $ group , $ action ) { $ roles = self :: getGroupMemberRoles ( \ User :: get ( 'id' ) , $ group -> get ( 'gidNumber' ) ) ; foreach ( $ roles as $ role ) { $ permissions = json_decode ( $ role [ 'permissions' ] ) ; $ permissions = ( is_object ( $ permissions ) ) ? $ permissions : new \ stdClass ; if ( property_exists ( $ permissions , $ action ) && $ permissions -> $ action == 1 ) { return true ; } } return false ; }
|
Check to see if user has permission to perform task
|
46,328
|
public function getGroups ( $ role = 'all' ) { static $ groups ; if ( ! isset ( $ groups ) ) { $ groups = array ( 'applicants' => array ( ) , 'invitees' => array ( ) , 'members' => array ( ) , 'managers' => array ( ) , 'all' => array ( ) ) ; $ groups [ 'all' ] = Helper :: getGroups ( $ this -> get ( 'uidNumber' ) , 'all' , 1 ) ; if ( $ groups [ 'all' ] ) { foreach ( $ groups [ 'all' ] as $ item ) { if ( $ item -> registered ) { if ( ! $ item -> regconfirmed ) { $ groups [ 'applicants' ] [ ] = $ item ; } else { if ( $ item -> manager ) { $ groups [ 'managers' ] [ ] = $ item ; } else { $ groups [ 'members' ] [ ] = $ item ; } } } else { $ groups [ 'invitees' ] [ ] = $ item ; } } } } if ( $ role ) { return ( isset ( $ groups [ $ role ] ) ) ? $ groups [ $ role ] : false ; } return $ groups ; }
|
Get the groups for a user
|
46,329
|
public function setPath ( $ key , $ path ) { $ this -> paths [ ( string ) $ key ] = ( string ) $ path ; return $ this ; }
|
Set path for a key
|
46,330
|
public function load ( $ client_id = null ) { if ( ! is_null ( $ client_id ) ) { $ client = ClientManager :: client ( $ client_id , ( ! is_numeric ( $ client_id ) ) ) ; } else { $ client = $ this -> app [ 'client' ] ; } if ( ! $ client ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid client type of "%s".' , $ client_id ) ) ; } return $ this -> getTemplate ( ( int ) $ client -> id , $ this -> style ) ; }
|
Load a template by client
|
46,331
|
public function getSystemTemplate ( ) { static $ template ; if ( ! isset ( $ template ) ) { $ template = new stdClass ; $ template -> id = 0 ; $ template -> home = 0 ; $ template -> template = 'system' ; $ template -> params = new Registry ( ) ; $ template -> protected = 1 ; $ template -> path = $ this -> getPath ( 'core' ) . DIRECTORY_SEPARATOR . $ template -> template ; } return $ template ; }
|
Get the system template
|
46,332
|
public static function allForScope ( $ scope , $ scope_id = 0 ) { if ( ! is_array ( $ scope ) ) { $ scope = array ( $ scope ) ; } $ recipient = self :: all ( ) ; $ r = $ recipient -> getTableName ( ) ; $ l = \ Hubzero \ Activity \ Log :: blank ( ) -> getTableName ( ) ; $ recipient -> select ( $ r . '.*' ) -> including ( 'log' ) -> join ( $ l , $ l . '.id' , $ r . '.log_id' ) -> whereIn ( $ r . '.scope' , $ scope ) -> whereEquals ( $ r . '.scope_id' , $ scope_id ) ; return $ recipient ; }
|
Get all entries for a scope
|
46,333
|
public static function removeDirectories ( $ directories = null ) { if ( is_null ( $ directories ) ) { static :: $ directories = array ( ) ; } else { static :: $ directories = array_diff ( static :: $ directories , ( array ) $ directories ) ; } }
|
Remove directories from the class loader .
|
46,334
|
protected function normalizePermissions ( $ permissions ) { $ permissions = substr ( $ permissions , 1 ) ; $ map = array ( '-' => '0' , 'r' => '4' , 'w' => '2' , 'x' => '1' ) ; $ permissions = strtr ( $ permissions , $ map ) ; $ parts = str_split ( $ permissions , 3 ) ; $ mapper = function ( $ part ) { return array_sum ( str_split ( $ part ) ) ; } ; return array_sum ( array_map ( $ mapper , $ parts ) ) ; }
|
Normalize a permissions string .
|
46,335
|
public function instance ( ) { try { $ editor = App :: get ( 'editor' ) ; } catch ( Exception $ e ) { $ editor = \ Hubzero \ Html \ Editor :: getInstance ( 'none' ) ; } return $ editor ; }
|
Get the editor object .
|
46,336
|
public function params ( $ type , $ plugin ) { $ result = $ this -> byType ( $ type , $ plugin ) ; if ( ! $ result || empty ( $ result ) ) { $ result = new stdClass ; $ result -> params = '' ; } if ( is_string ( $ result -> params ) ) { $ result -> params = new Registry ( $ result -> params ) ; } return $ result -> params ; }
|
Get the params for a specific plugin
|
46,337
|
public function import ( $ type , $ plugin = null , $ autocreate = true , $ dispatcher = null ) { static $ loaded = array ( ) ; $ defaults = false ; if ( is_null ( $ plugin ) && $ autocreate == true && is_null ( $ dispatcher ) ) { $ defaults = true ; } if ( ! isset ( $ loaded [ $ type ] ) || ! $ defaults ) { $ results = null ; if ( ! ( $ dispatcher instanceof DispatcherInterface ) ) { $ dispatcher = App :: get ( 'dispatcher' ) ; } foreach ( $ this -> all ( ) as $ plug ) { if ( $ plug -> type == $ type && ( $ plugin === null || $ plug -> name == $ plugin ) ) { if ( $ p = $ this -> init ( $ plug , $ autocreate ) ) { $ dispatcher -> addListener ( $ p ) ; } $ results = true ; } } if ( ! $ defaults ) { return $ results ; } $ loaded [ $ type ] = $ results ; } return $ loaded [ $ type ] ; }
|
Loads all the plugin files for a particular type if no specific plugin is specified otherwise only the specific plugin is loaded .
|
46,338
|
protected function init ( & $ plugin , $ autocreate = true , $ dispatcher = null ) { $ plugin -> type = preg_replace ( '/[^A-Z0-9_\.-]/i' , '' , $ plugin -> type ) ; $ plugin -> name = preg_replace ( '/[^A-Z0-9_\.-]/i' , '' , $ plugin -> name ) ; $ classNameL = 'plg' . $ plugin -> type . $ plugin -> name ; $ classNameN = 'Plugins\\' . ucfirst ( $ plugin -> type ) . '\\' . ucfirst ( $ plugin -> name ) ; if ( ! class_exists ( $ classNameL ) && ! class_exists ( $ classNameN ) ) { $ path = $ this -> path ( $ plugin -> type , $ plugin -> name ) . DS . $ plugin -> name . '.php' ; if ( file_exists ( $ path ) ) { require_once $ path ; if ( $ autocreate ) { foreach ( array ( $ classNameL , $ classNameN ) as $ className ) { if ( ! class_exists ( $ className ) ) { continue ; } if ( ! ( $ dispatcher instanceof DispatcherInterface ) ) { $ dispatcher = new Dispatcher ( ) ; } return new $ className ( $ dispatcher , ( array ) $ plugin ) ; } } } } return null ; }
|
Loads the plugin file .
|
46,339
|
public function all ( ) { if ( self :: $ plugins !== null ) { return self :: $ plugins ; } if ( ! App :: has ( 'cache.store' ) || ! ( $ cache = App :: get ( 'cache.store' ) ) ) { $ cache = new \ Hubzero \ Cache \ Storage \ None ( ) ; } $ levels = implode ( ',' , User :: getAuthorisedViewLevels ( ) ) ; if ( ! ( self :: $ plugins = $ cache -> get ( 'com_plugins.' . $ levels ) ) ) { $ db = App :: get ( 'db' ) ; $ query = $ db -> getQuery ( ) -> select ( 'folder' , 'type' ) -> select ( 'element' , 'name' ) -> select ( 'protected' ) -> select ( 'params' ) -> from ( '#__extensions' ) -> where ( 'enabled' , '>=' , 1 ) -> whereEquals ( 'type' , 'plugin' ) -> where ( 'state' , '>=' , 0 ) -> whereIn ( 'access' , User :: getAuthorisedViewLevels ( ) ) -> order ( 'ordering' , 'asc' ) ; self :: $ plugins = $ db -> setQuery ( $ query -> toString ( ) ) -> loadObjectList ( ) ; if ( $ error = $ db -> getErrorMsg ( ) ) { throw new Exception ( $ error , 500 ) ; } $ cache -> put ( 'com_plugins.' . $ levels , self :: $ plugins , App :: get ( 'config' ) -> get ( 'cachetime' , 15 ) ) ; } return self :: $ plugins ; }
|
Loads the published plugins .
|
46,340
|
public function language ( $ extension , $ basePath = PATH_CORE ) { return App :: get ( 'language' ) -> load ( strtolower ( $ extension ) , $ basePath ) ; }
|
Loads the language file for a plugin
|
46,341
|
public function takeAction ( $ type , $ uids = array ( ) , $ component = '' , $ element = null ) { if ( ! $ element || ! $ component || ! $ type ) { return false ; } if ( count ( $ uids ) > 0 ) { foreach ( $ uids as $ uid ) { $ action = Action :: blank ( ) ; $ mids = $ action -> getActionItems ( $ component , $ element , $ uid , $ type ) ; if ( count ( $ mids ) > 0 ) { $ recipient = Recipient :: blank ( ) ; if ( ! $ recipient -> setState ( 1 , $ mids ) ) { $ this -> setError ( Lang :: txt ( 'Unable to update recipient records %s for user %s' , implode ( ',' , $ mids ) , $ uid ) ) ; } } } } return true ; }
|
Marks action items as completed
|
46,342
|
public function sendMessage ( $ type , $ subject , $ message , $ from = array ( ) , $ to = array ( ) , $ component = '' , $ element = null , $ description = '' , $ group_id = 0 ) { if ( ! $ message ) { return false ; } if ( ! $ subject && $ message ) { $ subject = substr ( $ message , 0 , 70 ) ; if ( strlen ( $ subject ) >= 70 ) { $ subject .= '...' ; } } $ xmessage = Message :: blank ( ) ; $ xmessage -> set ( 'subject' , $ subject ) ; $ xmessage -> set ( 'message' , $ message ) ; $ xmessage -> set ( 'created' , Date :: toSql ( ) ) ; $ xmessage -> set ( 'created_by' , User :: get ( 'id' ) ) ; $ xmessage -> set ( 'component' , $ component ) ; $ xmessage -> set ( 'type' , $ type ) ; $ xmessage -> set ( 'group_id' , $ group_id ) ; if ( ! $ xmessage -> save ( ) ) { return $ xmessage -> getError ( ) ; } if ( count ( $ to ) > 0 ) { foreach ( $ to as $ uid ) { $ recipient = Recipient :: blank ( ) ; $ recipient -> set ( 'uid' , $ uid ) ; $ recipient -> set ( 'mid' , $ xmessage -> get ( 'id' ) ) ; $ recipient -> set ( 'created' , Date :: toSql ( ) ) ; $ recipient -> set ( 'expires' , Date :: of ( time ( ) + ( 168 * 24 * 60 * 60 ) ) -> toSql ( ) ) ; $ recipient -> set ( 'actionid' , 0 ) ; if ( ! $ recipient -> save ( ) ) { return $ recipient -> getError ( ) ; } $ notify = Notify :: blank ( ) ; $ methods = $ notify -> getRecords ( $ uid , $ type ) ; $ user = User :: getInstance ( $ uid ) ; if ( $ methods ) { foreach ( $ methods as $ method ) { $ action = strtolower ( $ method -> method ) ; if ( ! Event :: trigger ( 'xmessage.onMessage' , array ( $ from , $ xmessage , $ user , $ action ) ) ) { $ this -> setError ( Lang :: txt ( 'Unable to message user %s with method %s' , $ uid , $ action ) ) ; } } } } } return true ; }
|
Send a message to one or more users
|
46,343
|
public function initDbo ( ) { if ( defined ( 'JPATH_GROUPCOMPONENT' ) ) { $ r = new \ ReflectionClass ( $ this ) ; if ( substr ( $ r -> getFileName ( ) , 0 , strlen ( JPATH_GROUPCOMPONENT ) ) == JPATH_GROUPCOMPONENT ) { return \ Hubzero \ User \ Group \ Helper :: getDbo ( ) ; } } return \ App :: get ( 'db' ) ; }
|
Method to get the database connection .
|
46,344
|
public function setDbo ( & $ db ) { if ( ! ( $ db instanceof \ Hubzero \ Database \ Driver ) ) { return false ; } $ this -> _db = $ db ; $ this -> _tbl -> setDBO ( $ this -> _db ) ; return true ; }
|
Method to set the database connector object .
|
46,345
|
public function bind ( $ data = null ) { if ( is_object ( $ data ) ) { $ res = $ this -> _tbl -> bind ( $ data ) ; if ( $ res ) { $ properties = $ this -> _tbl -> getProperties ( ) ; foreach ( get_object_vars ( $ data ) as $ key => $ property ) { if ( ! array_key_exists ( $ key , $ properties ) ) { $ this -> _tbl -> set ( '__' . $ key , $ property ) ; } } } } else if ( is_array ( $ data ) ) { $ res = $ this -> _tbl -> bind ( $ data ) ; if ( $ res ) { $ properties = $ this -> _tbl -> getProperties ( ) ; foreach ( array_keys ( $ data ) as $ key ) { if ( ! array_key_exists ( $ key , $ properties ) ) { $ this -> _tbl -> set ( '__' . $ key , $ data [ $ key ] ) ; } } } } else { $ this -> _logError ( __CLASS__ . '::' . __FUNCTION__ . '(); ' . \ Lang :: txt ( 'Data must be of type object or array. Type given was %s' , gettype ( $ data ) ) ) ; throw new \ InvalidArgumentException ( \ Lang :: txt ( 'Data must be of type object or array. Type given was %s' , gettype ( $ data ) ) ) ; } return $ res ; }
|
Bind data to the model
|
46,346
|
protected function _log ( $ type = 'error' , $ message ) { if ( ! $ message ) { return ; } if ( \ App :: get ( 'config' ) -> get ( 'debug' ) ) { $ message = '[' . \ App :: get ( 'request' ) -> getVar ( 'REQUEST_URI' , '' , 'server' ) . '] [' . $ message . ']' ; } $ type = strtolower ( $ type ) ; if ( ! in_array ( $ type , array ( 'error' , 'debug' , 'critical' , 'warning' , 'notice' , 'alert' , 'emergency' , 'info' ) ) ) { return ; } $ logger = \ Log :: getRoot ( ) ; $ logger -> $ type ( $ message ) ; }
|
Log an error message
|
46,347
|
public function store ( $ check = true ) { if ( $ check ) { if ( ! $ this -> check ( ) ) { return false ; } if ( $ this -> _context ) { $ results = \ Event :: trigger ( 'content.onContentBeforeSave' , array ( $ this -> _context , & $ this , $ this -> exists ( ) ) ) ; foreach ( $ results as $ result ) { if ( $ result === false ) { $ this -> setError ( \ App :: get ( 'language' ) -> txt ( 'Content failed validation.' ) ) ; return false ; } } } } if ( ! $ this -> _tbl -> store ( ) ) { $ this -> setError ( $ this -> _tbl -> getError ( ) ) ; return false ; } return true ; }
|
Store changes to this database entry
|
46,348
|
public function toArray ( $ verbose = false ) { $ output = $ this -> _tbl -> getProperties ( ) ; if ( $ verbose ) { foreach ( $ this -> _tbl as $ key => $ value ) { if ( substr ( $ key , 0 , 2 ) == '__' ) { $ output [ substr ( $ key , 2 ) ] = $ value ; } } } return $ output ; }
|
Method to return model values in array format
|
46,349
|
public function scaffolding ( ) { $ groupsConfig = \ Component :: params ( 'com_groups' ) ; $ directory = trim ( $ groupsConfig -> get ( 'uploadpath' , '/site/groups' ) , DS ) ; $ directory .= DS . $ this -> group -> get ( 'gidNumber' ) ; $ createWhat = ( $ this -> arguments -> getOpt ( 3 ) ) ? $ this -> arguments -> getOpt ( 3 ) : 'component' ; $ this -> arguments -> setOpt ( 3 , $ createWhat ) ; $ this -> arguments -> setOpt ( 'install-dir' , $ directory ) ; \ App :: get ( 'client' ) -> call ( 'scaffolding' , 'create' , $ this -> arguments , $ this -> output ) ; }
|
Run super groups scaffolding
|
46,350
|
public function migrate ( ) { $ this -> arguments -> setOpt ( 'group' , $ this -> group -> get ( 'cn' ) ) ; \ App :: get ( 'client' ) -> call ( 'migration' , 'run' , $ this -> arguments , $ this -> output ) ; }
|
Run super groups migration
|
46,351
|
public function update ( ) { $ groupsConfig = \ Component :: params ( 'com_groups' ) ; $ directory = PATH_APP . DS . trim ( $ groupsConfig -> get ( 'uploadpath' , '/site/groups' ) , DS ) ; $ directory .= DS . $ this -> group -> get ( 'gidNumber' ) ; $ task = ( $ this -> arguments -> getOpt ( 3 ) ) ? $ this -> arguments -> getOpt ( 3 ) : 'update' ; $ this -> arguments -> setOpt ( 'r' , $ directory ) ; \ App :: get ( 'client' ) -> call ( 'repository' , $ task , $ this -> arguments , $ this -> output ) ; }
|
Update super group code
|
46,352
|
public function getTableColumns ( $ table , $ typeOnly = true ) { $ columns = array ( ) ; $ fieldCasing = $ this -> connection -> getAttribute ( \ PDO :: ATTR_CASE ) ; $ this -> connection -> setAttribute ( \ PDO :: ATTR_CASE , \ PDO :: CASE_UPPER ) ; $ table = strtoupper ( $ table ) ; $ this -> setQuery ( 'pragma table_info(' . $ table . ')' ) ; $ fields = $ this -> loadObjectList ( ) ; if ( $ typeOnly ) { foreach ( $ fields as $ field ) { $ columns [ $ field -> NAME ] = $ field -> TYPE ; } } else { foreach ( $ fields as $ field ) { $ columns [ $ field -> NAME ] = ( object ) array ( 'Field' => $ field -> NAME , 'Type' => $ field -> TYPE , 'Null' => ( $ field -> NOTNULL == '1' ? 'NO' : 'YES' ) , 'Default' => $ field -> DFLT_VALUE , 'Key' => ( $ field -> PK != '0' ? 'PRI' : '' ) ) ; } } $ this -> connection -> setAttribute ( \ PDO :: ATTR_CASE , $ fieldCasing ) ; return $ columns ; }
|
Retrieves field information about the given table
|
46,353
|
public function mergeIdentities ( $ identities ) { if ( $ identities instanceof Rule ) { $ identities = $ identities -> getData ( ) ; } if ( is_array ( $ identities ) ) { foreach ( $ identities as $ identity => $ allow ) { $ this -> mergeIdentity ( $ identity , $ allow ) ; } } }
|
Merges the identities
|
46,354
|
public function mergeIdentity ( $ identity , $ allow ) { $ identity = ( int ) $ identity ; $ allow = ( int ) ( ( boolean ) $ allow ) ; if ( isset ( $ this -> data [ $ identity ] ) ) { if ( $ this -> data [ $ identity ] !== 0 ) { $ this -> data [ $ identity ] = $ allow ; } } else { $ this -> data [ $ identity ] = $ allow ; } }
|
Merges the values for an identity .
|
46,355
|
public function allow ( $ identities ) { $ result = null ; if ( ! empty ( $ identities ) ) { if ( ! is_array ( $ identities ) ) { $ identities = array ( $ identities ) ; } foreach ( $ identities as $ identity ) { $ identity = ( int ) $ identity ; if ( isset ( $ this -> data [ $ identity ] ) ) { $ result = ( boolean ) $ this -> data [ $ identity ] ; if ( $ result === false ) { break ; } } } } return $ result ; }
|
Checks that this action can be performed by an identity .
|
46,356
|
public function setView ( $ name , $ layout = null ) { $ config = array ( 'name' => $ name ) ; if ( $ layout ) { $ config [ 'layout' ] = $ layout ; } $ this -> view = new View ( $ config ) ; $ this -> view -> option = $ this -> _option ; $ this -> view -> task = $ name ; $ this -> view -> controller = $ this -> _controller ; }
|
Reset the view object
|
46,357
|
public function redirect ( $ url = null , $ msg = null , $ type = null ) { if ( $ url ) { $ this -> setRedirect ( $ url , $ msg , $ type ) ; } if ( $ this -> _redirect != null ) { \ App :: redirect ( $ this -> _redirect , $ this -> _message , $ this -> _messageType ) ; } }
|
Method to redirect the application to a new URL and optionally include a message
|
46,358
|
protected function _authorize ( ) { if ( $ this -> juser -> isGuest ( ) ) { return false ; } if ( $ this -> juser -> authorise ( 'core.admin' , $ this -> _option ) ) { return true ; } return false ; }
|
Method to check admin access permission
|
46,359
|
public function clear ( ) { $ cacheDir = PATH_APP . DS . 'cache' . DS . '*' ; foreach ( glob ( $ cacheDir ) as $ cacheFileOrDir ) { $ readable = str_replace ( PATH_APP . DS , '' , $ cacheFileOrDir ) ; if ( is_dir ( $ cacheFileOrDir ) ) { if ( ! Filesystem :: deleteDirectory ( $ cacheFileOrDir ) ) { $ this -> output -> addLine ( 'Unable to delete cache directory: ' . $ readable , 'error' ) ; } else { $ this -> output -> addLine ( $ readable . ' deleted' , 'success' ) ; } } else { if ( $ cacheFileOrDir != PATH_APP . DS . 'cache' . DS . 'index.html' ) { if ( ! Filesystem :: delete ( $ cacheFileOrDir ) ) { $ this -> output -> addLine ( 'Unable to delete cache file: ' . $ readable , 'error' ) ; } else { $ this -> output -> addLine ( $ readable . ' deleted' , 'success' ) ; } } } } $ this -> output -> addLine ( 'Clear cache complete' , 'success' ) ; }
|
Clear all Cache
|
46,360
|
public static function oneByWord ( $ word ) { $ word = trim ( $ word ) ; $ word = strtolower ( $ word ) ; return self :: blank ( ) -> whereEquals ( 'word' , $ word ) -> row ( ) ; }
|
Load a record by word
|
46,361
|
public static function usernameInBlacklist ( $ word , $ username ) { $ word = self :: normalize ( $ word ) ; $ username = self :: normalize ( $ username ) ; $ words = array ( ) ; $ words [ ] = $ username ; $ words [ ] = strrev ( $ username ) ; foreach ( $ words as $ w ) { if ( $ w == $ word ) { return true ; } } return false ; }
|
Check if a username is in the blacklist
|
46,362
|
public static function nameInBlacklist ( $ word , $ givenName , $ middleName , $ surname ) { $ word = self :: normalize ( $ word ) ; $ givenName = self :: normalize ( $ givenName ) ; $ middleName = self :: normalize ( $ middleName ) ; $ surname = self :: normalize ( $ surname ) ; $ words = array ( ) ; $ words [ ] = $ givenName ; $ words [ ] = strrev ( $ givenName ) ; $ words [ ] = $ middleName ; $ words [ ] = strrev ( $ middleName ) ; $ words [ ] = $ surname ; $ words [ ] = strrev ( $ surname ) ; $ words [ ] = $ givenName . $ middleName . $ surname ; $ words [ ] = strrev ( $ givenName . $ middleName . $ surname ) ; $ words [ ] = $ givenName . $ surname ; $ words [ ] = strrev ( $ givenName . $ surname ) ; $ words [ ] = $ middleName . $ surname ; $ words [ ] = strrev ( $ middleName . $ surname ) ; $ words [ ] = $ surname . $ givenName ; $ words [ ] = strrev ( $ surname . $ givenName ) ; $ words [ ] = $ surname . $ middleName . $ givenName ; $ words [ ] = strrev ( $ surname . $ middleName . $ givenName ) ; foreach ( $ words as $ w ) { if ( $ w == $ word ) { return true ; } } return false ; }
|
Check if a name is in the blacklist
|
46,363
|
public static function basedOnBlacklist ( $ word ) { $ words [ ] = ( string ) $ word ; $ words [ ] = strtolower ( $ word ) ; $ words [ ] = strtolower ( strrev ( $ word ) ) ; $ len = strlen ( $ word ) ; $ word2 = '' ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { if ( preg_match ( '/[a-zA-Z]/' , $ word [ $ i ] ) ) { $ word2 .= $ word [ $ i ] ; } } $ words [ ] = strtolower ( $ word2 ) ; $ words [ ] = strtolower ( strrev ( $ word2 ) ) ; $ words [ ] = self :: toL33t ( $ word ) ; $ words [ ] = strrev ( self :: toL33t ( $ word ) ) ; $ words [ ] = self :: toSimpleL33t ( $ word ) ; $ words [ ] = strrev ( self :: toSimpleL33t ( $ word ) ) ; $ total = self :: all ( ) -> whereIn ( 'word' , $ words ) -> total ( ) ; return ( $ total > 1 ) ; }
|
Check if a word is based on a blacklisted word
|
46,364
|
protected static function toSimpleL33t ( $ word ) { $ subs = array ( '4' => 'A' , '@' => 'A' , '^' => 'A' , '8' => 'B' , '(' => 'C' , '{' => 'C' , '<' => 'C' , ')' => 'D' , '3' => 'E' , '6' => 'G' , '9' => 'G' , '&' => 'G' , '#' => 'H' , '1' => 'I' , '!' => 'I' , '|' => 'L' , '1' => 'L' , '~' => 'N' , '0' => 'O' , '*' => 'O' , '5' => 'S' , '$' => 'S' , '7' => 'T' , '+' => 'T' , '%' => 'Y' , '2' => 'Z' , ) ; $ word2 = str_replace ( array_keys ( $ subs ) , array_values ( $ subs ) , $ word ) ; return strtolower ( $ word2 ) ; }
|
Turn a word into simple l33t type
|
46,365
|
public static function analyze ( $ password ) { $ stats = array ( ) ; $ len = strlen ( $ password ) ; $ stats [ 'count' ] [ 0 ] = $ len ; $ stats [ 'uniqueCharacters' ] = 0 ; $ stats [ 'uniqueClasses' ] = 0 ; $ classes = array ( ) ; $ histogram = array ( ) ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ c = $ password [ $ i ] ; $ cl = CharacterClass :: match ( $ c ) ; foreach ( $ cl as $ class ) { if ( empty ( $ stats [ 'count' ] [ $ class -> name ] ) ) { $ stats [ 'count' ] [ $ class -> name ] = 1 ; if ( $ class -> flag ) { $ stats [ 'uniqueClasses' ] ++ ; } } else { $ stats [ 'count' ] [ $ class -> name ] ++ ; } } if ( empty ( $ histogram [ $ c ] ) ) { $ histogram [ $ c ] = 1 ; $ stats [ 'uniqueCharacters' ] ++ ; } else { $ histogram [ $ c ] ++ ; } } return $ stats ; }
|
Analyze a password
|
46,366
|
protected static function normalize ( $ word ) { $ nword = '' ; $ len = strlen ( $ word ) ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ o = ord ( $ word [ $ i ] ) ; if ( $ o < 97 ) { $ o += 32 ; } if ( $ o > 122 || $ o < 97 ) { continue ; } $ nword .= chr ( $ o ) ; } return $ nword ; }
|
Normalize a word
|
46,367
|
public static function isBasedOnName ( $ word , $ name ) { $ word = self :: normalize ( $ word ) ; if ( empty ( $ word ) ) { return false ; } $ names = explode ( " " , $ name ) ; $ count = count ( $ names ) ; $ words = array ( ) ; $ fullname = self :: normalize ( $ name ) ; $ words [ ] = $ fullname ; $ words [ ] = strrev ( $ fullname ) ; foreach ( $ names as $ e ) { $ e = self :: normalize ( $ e ) ; if ( strlen ( $ e ) > 3 ) { $ words [ ] = $ e ; $ words [ ] = strrev ( $ e ) ; } } if ( $ count > 1 ) { $ e = self :: normalize ( $ names [ 0 ] . $ names [ $ count - 1 ] ) ; $ words [ ] = $ e ; $ words [ ] = strrev ( $ e ) ; } foreach ( $ words as $ w ) { if ( empty ( $ w ) ) { continue ; } if ( strpos ( $ w , $ word ) !== false ) { return true ; } } return false ; }
|
Check if a word is based on a name
|
46,368
|
public static function isBasedOnUsername ( $ word , $ username ) { $ word = self :: normalize ( $ word ) ; $ username = self :: normalize ( $ username ) ; $ words = array ( ) ; $ words [ ] = $ username ; $ words [ ] = strrev ( $ username ) ; foreach ( $ words as $ w ) { if ( empty ( $ w ) ) { continue ; } if ( empty ( $ word ) ) { continue ; } if ( strpos ( $ w , $ word ) !== false ) { return true ; } } return false ; }
|
Check if a word is based on a username
|
46,369
|
public function push ( Relational $ model ) { if ( $ model -> getPkValue ( ) && ( ! is_array ( $ this -> rows ) || ! array_key_exists ( $ model -> getPkValue ( ) , $ this -> rows ) ) ) { $ this -> rows [ $ model -> getPkValue ( ) ] = $ model ; } else { $ this -> rows [ ] = $ model ; } }
|
Pushes a new model on to the stack
|
46,370
|
public function pickRandom ( $ n ) { $ rows = $ this -> rows ; shuffle ( $ rows ) ; $ randomRows = array_slice ( $ rows , 0 , $ n ) ; $ rowsObject = new self ( $ randomRows ) ; return $ rowsObject ; }
|
Selects a number of randomly selected rows
|
46,371
|
public function to ( $ type = 'array' ) { $ rows = [ ] ; if ( $ this -> rows && $ this -> count ( ) ) { foreach ( $ this -> rows as $ row ) { $ method = 'to' . ucfirst ( $ type ) ; $ rows [ ] = $ row -> $ method ( ) ; } } return $ rows ; }
|
Outputs rows as given type
|
46,372
|
public function fieldsByKey ( $ key ) { $ keys = array ( ) ; if ( $ this -> rows && $ this -> count ( ) ) { foreach ( $ this -> rows as $ row ) { $ keys [ ] = $ row -> $ key ; } } return $ keys ; }
|
Returns the result keys for the current dataset
|
46,373
|
public function isFirst ( $ key ) { if ( $ this -> rows && $ this -> count ( ) ) { return $ key == array_slice ( $ this -> rows , 0 , 1 ) [ 0 ] -> getPkValue ( ) ; } return false ; }
|
Checks to see if the current item is the first in the list
|
46,374
|
public function isLast ( $ key ) { if ( $ this -> rows && $ this -> count ( ) ) { return $ key == array_slice ( $ this -> rows , - 1 , 1 ) [ 0 ] -> getPkValue ( ) ; } return false ; }
|
Checks to see if the current item is the last in the list
|
46,375
|
public function valid ( ) { $ valid = false ; if ( $ this -> rows && $ this -> count ( ) ) { $ key = key ( $ this -> rows ) ; $ valid = ( $ key !== null && $ key !== false ) ; } return $ valid ; }
|
Validates current key
|
46,376
|
public function seek ( $ key ) { return isset ( $ this -> rows [ $ key ] ) ? $ this -> rows [ $ key ] : false ; }
|
Seeks to the given key
|
46,377
|
public function sort ( $ field , $ asc = true ) { usort ( $ this -> rows , function ( $ a , $ b ) use ( $ field , $ asc ) { $ result = strcmp ( $ a -> $ field , $ b -> $ field ) ; return ( $ asc ) ? $ result : $ result * - 1 ; } ) ; return $ this ; }
|
Sorts the rows by a given field
|
46,378
|
public function save ( ) { if ( $ this -> count ( ) ) { foreach ( $ this -> rows as $ model ) { if ( ! $ model -> save ( ) ) { $ this -> setErrors ( $ model -> getErrors ( ) ) ; return false ; } } } return true ; }
|
Saves a collection of models
|
46,379
|
public function destroyAll ( ) { if ( $ this -> count ( ) ) { foreach ( $ this -> rows as $ model ) { if ( ! $ model -> destroy ( ) ) { $ this -> setErrors ( $ model -> getErrors ( ) ) ; return false ; } } } return true ; }
|
Deletes all models in this collection
|
46,380
|
public static function framework ( $ extras = false , $ debug = null ) { $ type = $ extras ? 'ui' : 'core' ; if ( ! empty ( self :: $ loaded [ __METHOD__ ] [ $ type ] ) ) { return ; } if ( $ debug === null ) { $ debug = App :: get ( 'config' ) -> get ( 'debug' ) ; } if ( $ type != 'core' && empty ( self :: $ loaded [ __METHOD__ ] [ 'core' ] ) ) { self :: framework ( false , $ debug ) ; } $ path = '/core/assets/js/jquery' . ( $ type == 'core' ? '' : '.ui' ) . '.js' ; if ( file_exists ( PATH_ROOT . $ path ) ) { $ path .= '?v=' . filemtime ( PATH_ROOT . $ path ) ; } $ path = rtrim ( App :: get ( 'request' ) -> root ( true ) , '/' ) . $ path ; if ( $ type == 'core' ) { self :: _pushScriptTo ( 0 , $ path ) ; if ( App :: isAdmin ( ) ) { Asset :: script ( 'assets/core.js' , false , true ) ; } } else { self :: _pushScriptTo ( 1 , $ path ) ; } self :: $ loaded [ __METHOD__ ] [ $ type ] = true ; return ; }
|
Method to load the MooTools framework into the document head
|
46,381
|
private static function _pushScriptTo ( $ index , $ url , $ type = 'text/javascript' , $ defer = false , $ async = false ) { if ( ! App :: has ( 'document' ) ) { return ; } $ document = App :: get ( 'document' ) -> instance ( ) ; if ( $ document instanceof \ Hubzero \ Document \ Type \ Html ) { $ pushed = false ; $ data = $ document -> getHeadData ( ) ; $ scripts = $ data [ 'scripts' ] ; $ data [ 'scripts' ] = array ( ) ; $ i = 0 ; foreach ( $ scripts as $ key => $ foo ) { if ( $ i == $ index ) { $ data [ 'scripts' ] [ $ url ] = array ( 'mime' => $ type , 'defer' => $ defer , 'async' => $ async ) ; $ pushed = true ; } $ data [ 'scripts' ] [ $ key ] = $ foo ; $ i ++ ; } if ( ! $ pushed ) { $ data [ 'scripts' ] [ $ url ] = array ( 'mime' => $ type , 'defer' => $ defer , 'async' => $ async ) ; } $ document -> setHeadData ( $ data ) ; } }
|
Push a script to a specific sport int he scripts list
|
46,382
|
public static function core ( ) { if ( isset ( self :: $ loaded [ __METHOD__ ] ) ) { return ; } Asset :: script ( 'assets/hubzero.js' , true , true ) ; self :: $ loaded [ __METHOD__ ] = true ; }
|
Add HUBzero core js resources
|
46,383
|
public static function math ( ) { if ( isset ( self :: $ loaded [ __METHOD__ ] ) ) { return ; } $ path = Asset :: script ( 'assets/MathJax/MathJax.js' , true , true , true ) ; Document :: addScriptDeclaration ( ' (function() { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "' . $ path . '"; var config = ` MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX", "output/HTML-CSS"], "HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"], linebreaks: { automatic:true }, EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50) }, tex2jax:{ inlineMath: [ ["$$", "$$"], ["\\\\(","\\\\)"] ], displayMath: [ ["$$$","$$$"], ["\\[", "\\]"] ], processEscapes: true, ignoreClass: "tex2jax_ignore|dno" }, TeX: { extensions: ["autoload-all.js", "mediawiki-texvc.js"], noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } }, Macros: { href: "{}" } }, messageStyle: "none", styles: { ".MathJax_Display, .MathJax_Preview, .MathJax_Preview > *": { "background": "inherit" } } });`; if (window.opera) { script.innerHTML = config; } else { script.text = config; } document.getElementsByTagName("head")[0].appendChild(script); })(); ' ) ; self :: $ loaded [ __METHOD__ ] = true ; }
|
Add MathJax resources
|
46,384
|
public static function caption ( $ selector = 'img.caption' ) { if ( isset ( self :: $ loaded [ __METHOD__ ] [ $ selector ] ) ) { return ; } self :: framework ( true ) ; App :: get ( 'document' ) -> addScriptDeclaration ( "jQuery(document).ready(function($){ $('" . $ selector . "').tooltip({ position: { my: 'center bottom', at: 'center top' }, create: function(event, ui) { var tip = $(this), tipText = tip.attr('title'); if (tipText.indexOf('::') != -1) { var parts = tipText.split('::'); tip.attr('title', parts[1]); } }, tooltipClass: 'tooltip' }); });" ) ; self :: $ loaded [ __METHOD__ ] [ $ selector ] = true ; }
|
Add unobtrusive javascript support for image captions .
|
46,385
|
public static function formvalidation ( ) { if ( isset ( self :: $ loaded [ __METHOD__ ] ) ) { return ; } self :: framework ( ) ; Asset :: script ( 'assets/validate.js' , true , true ) ; self :: $ loaded [ __METHOD__ ] = true ; }
|
Add unobtrusive javascript support for form validation .
|
46,386
|
public static function chart ( $ type = 'core' ) { if ( isset ( self :: $ loaded [ __METHOD__ ] [ $ type ] ) ) { return ; } if ( $ type != 'core' ) { self :: chart ( ) ; } if ( $ type == 'core' ) { Asset :: script ( 'assets/flot/jquery.flot.min.js' , true , true ) ; Asset :: script ( 'assets/flot/jquery.flot.canvas.min.js' , true , true ) ; Asset :: script ( 'assets/flot/jquery.flot.time.min.js' , true , true ) ; Asset :: script ( 'assets/flot/jquery.flot.tooltip.min.js' , true , true ) ; } else { Asset :: script ( 'assets/flot/jquery.flot.' . $ type . '.min.js' , true , true ) ; } self :: $ loaded [ __METHOD__ ] [ $ type ] = true ; return ; }
|
Add unobtrusive javascript support for charts
|
46,387
|
public static function switcher ( $ toggler = 'tabs' ) { if ( isset ( self :: $ loaded [ __METHOD__ ] ) ) { return ; } self :: framework ( true ) ; Asset :: script ( 'assets/switcher.js' , false , true ) ; App :: get ( 'document' ) -> addScriptDeclaration ( "jQuery(document).ready(function($){ $('#" . $ toggler . "').switcher(); });" ) ; self :: $ loaded [ __METHOD__ ] = true ; }
|
Add unobtrusive javascript support for submenu switcher support in Global Configuration and System Information .
|
46,388
|
public static function tooltip ( $ selector = '.hasTip' , $ params = array ( ) ) { $ sig = md5 ( serialize ( array ( $ selector , $ params ) ) ) ; if ( isset ( self :: $ loaded [ __METHOD__ ] [ $ sig ] ) ) { return ; } self :: framework ( true ) ; App :: get ( 'document' ) -> addScriptDeclaration ( "jQuery(document).ready(function($){ $('" . $ selector . "').tooltip({ track: true, show: false, content: function() { return $(this).attr('title'); }, create: function(event, ui) { var tip = $(this), tipText = tip.attr('title'); if (tipText && tipText.indexOf('::') != -1) { var parts = tipText.split('::'); tip.attr('title', '<div class=\"tip-title\">' + parts[0] + '</div><div class=\"tip-text\">' + parts[1] + '</div>'); } else { tip.attr('title', '<div class=\"tip-text\">' + tipText + '</div>'); } }, tooltipClass: 'tool-tip' }); });" ) ; self :: $ loaded [ __METHOD__ ] [ $ sig ] = true ; return ; }
|
Add unobtrusive javascript support for a hover tooltips .
|
46,389
|
public static function multiselect ( $ id = 'adminForm' ) { if ( isset ( self :: $ loaded [ __METHOD__ ] [ $ id ] ) ) { return ; } self :: framework ( ) ; Asset :: script ( 'assets/multiselect.js' , true , true ) ; App :: get ( 'document' ) -> addScriptDeclaration ( "jQuery(document).ready(function($){ new Hubzero.MultiSelect('" . $ id . "'); });" ) ; self :: $ loaded [ __METHOD__ ] [ $ id ] = true ; return ; }
|
JavaScript behavior to allow shift select in grids
|
46,390
|
public static function calendar ( ) { if ( isset ( self :: $ loaded [ __METHOD__ ] ) ) { return ; } Asset :: stylesheet ( 'assets/jquery.datepicker.css' , array ( 'media' => 'all' ) , true ) ; Asset :: stylesheet ( 'assets/jquery.timepicker.css' , array ( 'media' => 'all' ) , true ) ; self :: framework ( true ) ; Asset :: script ( 'assets/jquery.timepicker.js' , false , true ) ; self :: $ loaded [ __METHOD__ ] = true ; }
|
Add unobtrusive javascript support for a calendar control .
|
46,391
|
public static function colorpicker ( ) { if ( isset ( self :: $ loaded [ __METHOD__ ] ) ) { return ; } self :: framework ( true ) ; Asset :: stylesheet ( 'assets/jquery.colpick.css' , array ( 'media' => 'all' ) , true ) ; Asset :: script ( 'assets/jquery.colpick.js' , false , true ) ; App :: get ( 'document' ) -> addScriptDeclaration ( "jQuery(document).ready(function($){ $('.input-colorpicker').colpick({ layout:'hex', colorScheme:'dark', onChange:function(hsb, hex, rgb, el, bySetColor) { //$(el).css('border-color','#' + hex); // Fill the text box just if the color was set using the picker, and not the colpickSetColor function. if (!bySetColor) $(el).val('#' + hex); } }).keyup(function(){ $(this).colpickSetColor(this.value); }); }); " ) ; self :: $ loaded [ __METHOD__ ] = true ; }
|
Add unobtrusive javascript support for a color picker .
|
46,392
|
public static function keepalive ( ) { if ( isset ( self :: $ loaded [ __METHOD__ ] ) ) { return ; } self :: framework ( ) ; $ lifetime = ( App :: get ( 'config' ) -> get ( 'lifetime' ) * 60000 ) ; $ refreshTime = ( $ lifetime <= 60000 ) ? 30000 : $ lifetime - 60000 ; if ( $ refreshTime > 3600000 || $ refreshTime <= 0 ) { $ refreshTime = 3600000 ; } App :: get ( 'document' ) -> addScriptDeclaration ( ' jQuery(document).ready(function($){ (function keepAlive() { $.ajax({ url: "index.php", complete: function() { setTimeout(keepAlive, ' . $ refreshTime . '); } }); })(); });' ) ; self :: $ loaded [ __METHOD__ ] = true ; return ; }
|
Keep session alive for example while editing or creating an article .
|
46,393
|
public static function highlighter ( array $ terms , $ start = 'highlighter-start' , $ end = 'highlighter-end' , $ className = 'highlight' , $ tag = 'span' ) { $ sig = md5 ( serialize ( array ( $ terms , $ start , $ end ) ) ) ; if ( isset ( self :: $ loaded [ __METHOD__ ] [ $ sig ] ) ) { return ; } $ script = 'assets/jquery.highlight.js' ; if ( App :: get ( 'config' ) -> get ( 'debug' ) ) { $ script = 'assets/jquery.highlight.min.js' ; } Asset :: script ( $ script , true , true ) ; $ terms = str_replace ( '"' , '\"' , $ terms ) ; $ options = "{ className: '" . $ className . "', element: '" . $ tag . "' }" ; App :: get ( 'document' ) -> addScriptDeclaration ( " jQuery(document).ready(function($){ $('body').highlight([\"" . implode ( '","' , $ terms ) . "\"], " . $ options . "); }); " ) ; self :: $ loaded [ __METHOD__ ] [ $ sig ] = true ; return ; }
|
Highlight some words via Javascript .
|
46,394
|
public static function noframes ( $ location = 'top.location.href' ) { if ( isset ( self :: $ loaded [ __METHOD__ ] ) ) { return ; } self :: framework ( ) ; $ js = "jQuery(document).ready(function($){ if (top == self) { document.documentElement.style.display = 'block'; } else { top.location = self.location; } });" ; $ document = App :: get ( 'document' ) ; $ document -> addStyleDeclaration ( 'html { display:none }' ) ; $ document -> addScriptDeclaration ( $ js ) ; App :: get ( 'response' ) -> headers -> set ( 'X-Frame-Options' , 'SAMEORIGIN' ) ; self :: $ loaded [ __METHOD__ ] = true ; }
|
Break us out of any containing iframes
|
46,395
|
public function rateLimit ( $ applicationId , $ userId ) { if ( ! $ data = $ this -> storage -> getRateLimitData ( $ applicationId , $ userId ) ) { $ data = $ this -> createRateLimitData ( $ applicationId , $ userId ) ; } if ( time ( ) > with ( new Date ( $ data -> expires_short ) ) -> toUnix ( ) ) { $ newShortDate = $ this -> getNewExpiresDateString ( 'short' ) ; $ this -> storage -> resetShort ( $ data -> id , 0 , $ newShortDate ) ; } if ( time ( ) > with ( new Date ( $ data -> expires_long ) ) -> toUnix ( ) ) { $ newLongDate = $ this -> getNewExpiresDateString ( 'long' ) ; $ this -> storage -> resetLong ( $ data -> id , 0 , $ newLongDate ) ; } $ this -> storage -> incrementRateLimitData ( $ data -> id ) ; $ data = $ this -> storage -> getRateLimitData ( $ applicationId , $ userId ) ; $ data -> exceeded_short = false ; $ data -> exceeded_long = false ; if ( $ data -> count_short >= $ data -> limit_short ) { $ data -> exceeded_short = true ; } if ( $ data -> count_long >= $ data -> limit_long ) { $ data -> exceeded_long = true ; } return $ data ; }
|
Rate limit for application & user
|
46,396
|
private function createRateLimitData ( $ applicationId , $ userId ) { $ ipAddress = \ Request :: ip ( ) ; $ countShort = 0 ; $ countLong = 0 ; $ limitShort = $ this -> config [ 'short' ] [ 'limit' ] ; $ limitLong = $ this -> config [ 'long' ] [ 'limit' ] ; $ created = with ( new Date ( 'now' ) ) -> toSql ( ) ; $ expiresShort = $ this -> getNewExpiresDateString ( 'short' ) ; $ expiresLong = $ this -> getNewExpiresDateString ( 'long' ) ; return $ this -> storage -> createRateLimitData ( $ applicationId , $ userId , $ ipAddress , $ limitShort , $ limitLong , $ countShort , $ countLong , $ expiresShort , $ expiresLong , $ created ) ; }
|
Create initial limit data
|
46,397
|
private function getNewExpiresDateString ( $ type = 'short' ) { $ modifier = $ this -> config [ $ type ] [ 'period' ] ; return with ( new Date ( 'now' ) ) -> modify ( '+' . $ modifier . ' MINUTES' ) -> toSql ( ) ; }
|
Get new expires date string
|
46,398
|
public function boot ( ) { $ translator = $ this -> app [ 'language' ] ; $ language = null ; if ( ! $ language && $ this -> app -> has ( 'request' ) && $ this -> app -> isSite ( ) ) { $ lang = $ this -> app [ 'request' ] -> getString ( 'language' , null ) ; if ( $ lang && $ translator -> exists ( $ lang ) ) { $ language = $ lang ; } } if ( ! $ language && $ this -> app -> has ( 'user' ) ) { $ lang = \ User :: getParam ( $ this -> app [ 'client' ] -> alias . '_language' ) ; if ( $ lang && $ translator -> exists ( $ lang ) ) { $ language = $ lang ; } } if ( ! $ language && $ this -> app -> has ( 'browser' ) && $ this -> app -> isSite ( ) ) { $ lang = $ translator -> detectLanguage ( ) ; if ( $ lang && $ translator -> exists ( $ lang ) ) { $ language = $ lang ; } } if ( ! $ language && $ this -> app -> has ( 'component' ) ) { $ params = $ this -> app [ 'component' ] -> params ( 'com_languages' ) ; $ language = $ params -> get ( $ this -> app [ 'client' ] -> name , $ this -> app [ 'config' ] -> get ( 'language' , 'en-GB' ) ) ; } if ( ! $ language || ! $ translator -> exists ( $ language ) ) { $ lang = $ this -> app [ 'config' ] -> get ( 'language' , 'en-GB' ) ; if ( $ translator -> exists ( $ lang ) ) { $ language = $ lang ; } } if ( $ language ) { $ translator -> setLanguage ( $ language ) ; } $ boot = DS . 'bootstrap' . DS . ucfirst ( $ this -> app [ 'client' ] -> name ) ; $ translator -> load ( 'lib_joomla' , PATH_APP . $ boot , null , false , true ) || $ translator -> load ( 'lib_joomla' , PATH_CORE . $ boot , null , false , true ) ; }
|
Add the plugin loader to the event dispatcher .
|
46,399
|
public function cancelTask ( ) { \ App :: redirect ( \ Route :: url ( 'index.php?option=' . $ this -> _option . ( $ this -> _controller ? '&controller=' . $ this -> _controller : '' ) , false ) ) ; }
|
Cancels a task and redirects to default view
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.