idx
int64 0
60.3k
| question
stringlengths 64
4.24k
| target
stringlengths 5
618
|
|---|---|---|
15,500
|
protected function smtp_send ( $ data , $ expecting , $ return_number = false ) { ! is_array ( $ expecting ) and $ expecting !== false and $ expecting = array ( $ expecting ) ; stream_set_timeout ( $ this -> smtp_connection , $ this -> config [ 'smtp' ] [ 'timeout' ] ) ; if ( ! fputs ( $ this -> smtp_connection , $ data . $ this -> config [ 'newline' ] ) ) { if ( $ expecting === false ) { return false ; } throw new \ SmtpCommandFailureException ( 'Failed executing command: ' . $ data ) ; } $ info = stream_get_meta_data ( $ this -> smtp_connection ) ; if ( $ info [ 'timed_out' ] ) { throw new \ SmtpTimeoutException ( 'SMTP connection timed out.' ) ; } $ response = $ this -> smtp_get_response ( ) ; $ number = ( int ) substr ( trim ( $ response ) , 0 , 3 ) ; if ( $ expecting !== false and ! in_array ( $ number , $ expecting ) ) { throw new \ SmtpCommandFailureException ( 'Got an unexpected response from host on command: [' . $ data . '] expecting: ' . join ( ' or ' , $ expecting ) . ' received: ' . $ response ) ; } if ( $ return_number ) { return $ number ; } return $ response ; }
|
Sends data to the SMTP host
|
15,501
|
protected function smtp_get_response ( ) { $ data = '' ; stream_set_timeout ( $ this -> smtp_connection , $ this -> config [ 'smtp' ] [ 'timeout' ] ) ; while ( $ str = fgets ( $ this -> smtp_connection , 512 ) ) { $ info = stream_get_meta_data ( $ this -> smtp_connection ) ; if ( $ info [ 'timed_out' ] ) { throw new \ SmtpTimeoutException ( 'SMTP connection timed out.' ) ; } $ data .= $ str ; if ( substr ( $ str , 3 , 1 ) === ' ' ) { break ; } } return $ data ; }
|
Get SMTP response
|
15,502
|
public function getOauthCallback ( $ service ) { $ user = \ Socialite :: driver ( $ service ) -> user ( ) ; $ email = $ user -> getEmail ( ) ; $ dbUser = \ User :: where ( 'email' , $ email ) -> first ( ) ; if ( ! $ dbUser ) { $ userInfo = [ 'name' => $ user -> getName ( ) , config ( 'taki.field.email' ) => $ user -> getEmail ( ) , 'avatar' => $ user -> getAvatar ( ) , 'provider' => $ service , ] ; if ( config ( 'taki.social.password_required' ) || config ( 'taki.social.username_required' ) ) { \ Taki :: saveOauthUser ( $ service , $ user -> getEmail ( ) ) ; return redirect ( $ this -> getOauthCompletePath ( ) ) -> with ( $ userInfo ) ; } else { $ userInfo [ 'password' ] = false ; $ userInfo [ 'token' ] = false ; $ userInfo [ config ( 'taki.field.username' ) ] = $ this -> generateUsername ( $ service , $ user ) ; $ dbUser = $ this -> create ( $ userInfo ) ; } } Auth :: login ( $ dbUser , true ) ; return redirect ( ) -> intended ( ) ; }
|
Create user or log the user in after success authentication
|
15,503
|
public function readKeys ( $ offset , $ direction , $ hints = Parser :: HINT_NONE ) { $ shiftedOffset = $ direction == self :: DIRECTION_BACKWARD ? $ offset - $ this -> getReadLength ( ) : $ offset ; if ( $ shiftedOffset < 0 ) { $ shiftedOffset = 0 ; } \ fseek ( $ this -> index -> getFile ( ) -> getFilePointer ( ) , $ shiftedOffset ) ; $ data = \ fread ( $ this -> index -> getFile ( ) -> getFilePointer ( ) , $ this -> getReadLength ( ) ) ; if ( $ data === false ) { if ( \ feof ( $ this -> index -> getFile ( ) -> getFilePointer ( ) ) ) { return array ( ) ; } else { throw new IOIndexException ( "Could not read file" ) ; } } $ keys = $ this -> index -> getParser ( ) -> parseKeys ( $ data , $ shiftedOffset , $ hints ) ; if ( empty ( $ keys ) ) { if ( $ direction == self :: DIRECTION_BACKWARD && $ shiftedOffset == 0 ) { return array ( ) ; } elseif ( $ direction == self :: DIRECTION_FORWARD && $ shiftedOffset + $ this -> getReadLength ( ) >= $ this -> index -> getFile ( ) -> getFileSize ( ) ) { return array ( ) ; } $ this -> increaseReadLength ( ) ; return $ this -> readKeys ( $ offset , $ direction ) ; } return $ keys ; }
|
Returns keys from a offset
|
15,504
|
public function without ( $ element ) { if ( $ element instanceof \ ArrayAccess ) { $ filtered_element = clone $ element ; } else { $ filtered_element = $ element ; } $ args = func_get_args ( ) ; unset ( $ args [ 0 ] ) ; foreach ( $ args as $ arg ) { if ( isset ( $ filtered_element [ $ arg ] ) ) { unset ( $ filtered_element [ $ arg ] ) ; } } return $ filtered_element ; }
|
This is a carbon copy of the drupal Twig without filter .
|
15,505
|
protected function createSchemas ( array $ configuration ) { $ processor = new Processor ( ) ; $ processedConfiguration = $ processor -> processConfiguration ( new SchemaConfiguration ( ) , $ configuration ) ; $ schemas = array ( ) ; foreach ( $ processedConfiguration as $ schemaName => $ schemaConfig ) { $ schema = new Schema ( $ schemaName , $ schemaConfig [ 'title' ] ) ; foreach ( $ schemaConfig [ 'groups' ] as $ groupName => $ groupConfig ) { $ group = new Group ( $ groupName , $ groupConfig [ 'title' ] ) ; foreach ( $ groupConfig [ 'characteristics' ] as $ characteristicName => $ characteristicConfig ) { $ fullName = implode ( ':' , array ( $ schemaName , $ groupName , $ characteristicName ) ) ; $ this -> validateDefinitionConfig ( $ fullName , $ characteristicConfig ) ; $ definition = new Definition ( ) ; $ definition -> setName ( $ characteristicName ) -> setFullName ( $ fullName ) -> setType ( $ characteristicConfig [ 'type' ] ) -> setTitle ( $ characteristicConfig [ 'title' ] ) -> setShared ( $ characteristicConfig [ 'shared' ] ) -> setVirtual ( $ characteristicConfig [ 'virtual' ] ) -> setPropertyPaths ( $ characteristicConfig [ 'property_paths' ] ) -> setFormat ( $ characteristicConfig [ 'format' ] ) -> setDisplayGroups ( $ characteristicConfig [ 'display_groups' ] ) ; $ group -> addDefinition ( $ definition ) ; } $ schema -> addGroup ( $ group ) ; } $ schemas [ ] = $ schema ; } return $ schemas ; }
|
Creates and returns a Schema from the given configuration array .
|
15,506
|
private function validateDefinitionConfig ( $ name , array & $ config ) { if ( true === $ config [ 'virtual' ] && 0 === count ( $ config [ 'property_paths' ] ) ) { throw new \ InvalidArgumentException ( sprintf ( '"property_paths" must be set for "virtual" characteristic "%s".' , $ name ) ) ; } if ( $ config [ 'type' ] === 'datetime' ) { if ( $ config [ 'format' ] === '%s' ) { $ config [ 'format' ] = 'd/m/Y' ; } } elseif ( false === strpos ( $ config [ 'format' ] , '%s' ) ) { throw new \ InvalidArgumentException ( sprintf ( '"format" must contain "%%s" for characteristic "%s".' , $ name ) ) ; } }
|
Validates the definition configuration .
|
15,507
|
public function getIterator ( ) { $ iterator = new AppendIterator ; if ( $ this -> wrapped_object instanceof IteratorAggregate ) { $ iterator -> append ( $ element -> getIterator ( ) ) ; } else { $ iterator -> append ( new ArrayIterator ( $ this -> wrapped_object ) ) ; } $ iterator -> append ( parent :: getIterator ( ) ) ; return $ iterator ; }
|
Returns an AppendIterator that iterates over both the wrapped object and this object
|
15,508
|
public static function make ( array $ server = null ) { if ( empty ( $ server ) ) { $ server = $ _SERVER ; } $ headers = [ ] ; $ content = [ 'CONTENT_TYPE' => 'Content-Type' , 'CONTENT_LENGTH' => 'Content-Length' , 'CONTENT_MD5' => 'Content-Md5' , ] ; foreach ( $ server as $ key => $ value ) { if ( substr ( $ key , 0 , 5 ) === 'HTTP_' ) { $ key = substr ( $ key , 5 ) ; if ( ! isset ( $ content [ $ key ] ) || ! isset ( $ server [ $ key ] ) ) { $ key = str_replace ( '_' , ' ' , $ key ) ; $ key = ucwords ( strtolower ( $ key ) ) ; $ key = str_replace ( ' ' , '-' , $ key ) ; $ headers [ $ key ] = $ value ; } } elseif ( isset ( $ content [ $ key ] ) ) { $ headers [ $ content [ $ key ] ] = $ value ; } } return $ headers ; }
|
Makes an array of headers .
|
15,509
|
public static function getDomainFromURL ( $ url ) { $ url = str_replace ( self :: getProtocolFromURL ( $ url ) . '://' , '' , $ url ) ; return explode ( '/' , $ url ) [ 0 ] ; }
|
Extracts the domain from a URL
|
15,510
|
public static function getPathFromURL ( $ url ) { $ path = str_replace ( self :: getProtocolFromURL ( $ url ) . '://' , '' , $ url ) ; $ path = str_replace ( self :: getDomainFromURL ( $ url ) , '' , $ path ) ; if ( $ path == '' ) return '/' ; return $ path ; }
|
Extracts the path from a URL
|
15,511
|
public function validateValue ( $ value ) { $ valid = is_string ( $ value ) && strlen ( $ value ) <= 254 && ( preg_match ( $ this -> pattern , $ value ) || $ this -> allowName && preg_match ( $ this -> fullPattern , $ value ) ) ; return $ valid ; }
|
Validates a static value to see if it is a valid email .
|
15,512
|
public function validateClass ( $ attribute , $ params ) { $ className = @ \ Yii :: import ( $ this -> $ attribute , true ) ; if ( ! is_string ( $ className ) || ! $ this -> classExists ( $ className ) ) { $ this -> addError ( $ attribute , "Class '$className' does not exist or has syntax error." ) ; } elseif ( isset ( $ params [ 'extends' ] ) && ltrim ( $ className , '\\' ) !== ltrim ( $ params [ 'extends' ] , '\\' ) && ! is_subclass_of ( $ className , $ params [ 'extends' ] ) ) { $ this -> addError ( 'baseClass' , "Class '$className' must extend from {$params['extends']}." ) ; } }
|
Validates the base class to make sure that it exists and that it extends from the core class .
|
15,513
|
public function validateReservedKeyword ( $ attribute , $ params ) { if ( $ this -> isReservedKeyword ( $ this -> $ attribute ) ) { $ this -> addError ( $ attribute , $ this -> getAttributeLabel ( $ attribute ) . ' cannot be a reserved PHP keyword.' ) ; } }
|
Validates an attribute to make sure it is not a reserved PHP keyword .
|
15,514
|
public function getApiModel ( string $ p_model ) : \ FreeFW \ Core \ Model { $ class = str_replace ( '_' , '::Model::' , $ p_model ) ; return \ FreeFW \ DI \ DI :: get ( $ class ) ; }
|
Get new model
|
15,515
|
protected function store ( $ updateNulls = false ) { $ row = TableRow :: create ( ) ; foreach ( $ this -> getFields ( ) as $ fieldName => $ fieldInfos ) { $ fieldValue = $ this -> row -> get ( $ fieldName ) ; switch ( $ fieldInfos -> Type ) { case 'bigint' : case 'mediumint' : case 'smallint' : case 'tinyint' : $ fieldValue = ( int ) $ fieldValue ; break ; case 'datetime' : case 'timestamp' : if ( ! $ fieldValue ) { $ fieldValue = $ this -> db -> getNullDate ( true ) ; } break ; case 'date' : if ( ! $ fieldValue ) { $ fieldValue = $ this -> db -> getNullDate ( false ) ; } break ; case 'time' : if ( ! $ fieldValue ) { $ fieldValue = '00:00:00' ; } break ; } $ row -> set ( $ fieldName , $ fieldValue ) ; } if ( $ row -> get ( $ this -> tbl_key ) ) { $ ret = $ this -> db -> updateObject ( $ this -> tbl , $ row , $ this -> tbl_key , $ updateNulls ) ; } else { $ ret = $ this -> db -> insertObject ( $ this -> tbl , $ row , $ this -> tbl_key ) ; $ this -> row -> set ( $ this -> tbl_key , ( int ) $ row -> get ( $ this -> tbl_key ) ) ; } if ( $ ret ) { if ( $ this -> orderingAble ( ) ) { $ this -> reorder ( $ this -> getReorderConditions ( ) ) ; } return true ; } return false ; }
|
Store the record
|
15,516
|
protected function hasBeenModified ( TableRow $ oldRow ) { $ diff = $ this -> row -> diff ( $ oldRow ) ; $ this -> hasBeenModified = ( count ( $ diff ) > 0 ) ; return $ this -> hasBeenModified ; }
|
Chec if the record has been modified .
|
15,517
|
protected function getFields ( ) { $ fields = $ this -> db -> getTableColumns ( $ this -> tbl ) ; if ( empty ( $ fields ) ) { throw new TableException ( 'Table columns not found' ) ; } return $ fields ; }
|
Get the object fields from database table columns
|
15,518
|
protected function setFieldsTypeByName ( ) { foreach ( $ this -> getFields ( ) as $ fieldName => $ fieldInfos ) { $ v = $ this -> row -> get ( $ fieldName ) ; switch ( $ fieldInfos -> Type ) { case 'bigint' : case 'mediumint' : case 'smallint' : case 'tinyint' : case 'int' : $ this -> row -> set ( $ fieldName , ( int ) $ v ) ; break ; case 'datetime' : case 'timestamp' : if ( $ v === $ this -> db -> getNullDate ( true ) ) { $ this -> row -> set ( $ fieldName , '' ) ; } break ; case 'date' : if ( $ v === $ this -> db -> getNullDate ( false ) ) { $ this -> row -> set ( $ fieldName , '' ) ; } break ; case 'time' : if ( $ v === '00:00:00' ) { $ this -> row -> set ( $ fieldName , '' ) ; } break ; } if ( $ fieldName === 'published' ) { $ this -> row -> set ( $ fieldName , ( bool ) $ v ) ; } } }
|
Set data type for known fields
|
15,519
|
protected function realPkSelection ( & $ pk ) { if ( null === $ pk ) { $ pk = $ this -> row -> get ( $ this -> tbl_key ) ; } if ( null === $ pk ) { $ this -> setError ( DatabaseHelper :: getTranslation ( 'NO_ITEM_SELECTED' ) ) ; return false ; } return true ; }
|
Set the real pk request value
|
15,520
|
public function callbackAction ( $ callbackUri ) { try { $ this -> authenticationManager -> authenticate ( ) ; } catch ( \ TYPO3 \ Flow \ Security \ Exception \ AuthenticationRequiredException $ exception ) { $ authenticationException = $ exception ; } if ( $ this -> authenticationManager -> isAuthenticated ( ) ) { $ storedRequest = $ this -> securityContext -> getInterceptedRequest ( ) ; if ( $ storedRequest !== NULL ) { $ this -> securityContext -> setInterceptedRequest ( NULL ) ; $ this -> redirectToRequest ( $ storedRequest ) ; } else { $ this -> redirectToUri ( $ callbackUri ) ; } } else { throw new \ Flowpack \ SingleSignOn \ Client \ Exception ( 'Could not authenticate in callbackAction triggered by the SSO server.' , 1366613161 , ( isset ( $ authenticationException ) ? $ authenticationException : NULL ) ) ; } }
|
Receive an SSO authentication callback and trigger authentication through the SingleSignOnProvider .
|
15,521
|
public static function guessMimeType ( $ filename , $ default = 'application/octed-stream' ) { $ guesser = new FileExtMimeTypeGuesser ( ) ; $ mime = $ guesser -> guess ( $ filename ) ; if ( null === $ mime ) { try { $ mime = MimeTypeGuesser :: getInstance ( ) -> guess ( $ filename ) ; } catch ( FileNotFoundException $ ex ) { } } return null === $ mime ? $ default : $ mime ; }
|
Guesses the mimetype by the files extension ... or default
|
15,522
|
public static function containsDotfile ( $ path ) { $ path = Path :: canonicalize ( Path :: makeAbsolute ( $ path , '/' ) ) ; return preg_match ( '#/\.#' , $ path ) == 1 ; }
|
Returns true if the path conatains any dotfile access
|
15,523
|
public function getClassPath ( $ class ) { $ segments = explode ( '_' , $ class ) ; $ namespaceTopLevel = $ this -> getNamespace ( ) ; $ namespace = '' ; if ( ! empty ( $ namespaceTopLevel ) ) { $ namespace = array ( ) ; $ topLevelSegments = count ( explode ( '_' , $ namespaceTopLevel ) ) ; for ( $ i = 0 ; $ i < $ topLevelSegments ; $ i ++ ) { $ namespace [ ] = array_shift ( $ segments ) ; } $ namespace = implode ( '_' , $ namespace ) ; if ( $ namespace != $ namespaceTopLevel ) { return false ; } } if ( count ( $ segments ) < 2 ) { return false ; } $ final = array_pop ( $ segments ) ; $ component = $ namespace ; $ lastMatch = false ; do { $ segment = array_shift ( $ segments ) ; $ component .= empty ( $ component ) ? $ segment : '_' . $ segment ; if ( isset ( $ this -> _components [ $ component ] ) ) { $ lastMatch = $ component ; } } while ( count ( $ segments ) ) ; if ( ! $ lastMatch ) { return false ; } $ final = substr ( $ class , strlen ( $ lastMatch ) + 1 ) ; $ path = $ this -> _components [ $ lastMatch ] ; $ classPath = $ path . '/' . str_replace ( '_' , '/' , $ final ) . '.php' ; if ( Zend_Loader :: isReadable ( $ classPath ) ) { return $ classPath ; } return false ; }
|
Helper method to calculate the correct class path
|
15,524
|
public function setOptions ( array $ options ) { if ( isset ( $ options [ 'namespace' ] ) ) { $ this -> setNamespace ( $ options [ 'namespace' ] ) ; unset ( $ options [ 'namespace' ] ) ; } $ methods = get_class_methods ( $ this ) ; foreach ( $ options as $ key => $ value ) { $ method = 'set' . ucfirst ( $ key ) ; if ( in_array ( $ method , $ methods ) ) { $ this -> $ method ( $ value ) ; } } return $ this ; }
|
Set class state from options
|
15,525
|
public function addResourceType ( $ type , $ path , $ namespace = null ) { $ type = strtolower ( $ type ) ; if ( ! isset ( $ this -> _resourceTypes [ $ type ] ) ) { if ( null === $ namespace ) { throw new Zend_Loader_Exception ( 'Initial definition of a resource type must include a namespace' ) ; } $ namespaceTopLevel = $ this -> getNamespace ( ) ; $ namespace = ucfirst ( trim ( $ namespace , '_' ) ) ; $ this -> _resourceTypes [ $ type ] = array ( 'namespace' => empty ( $ namespaceTopLevel ) ? $ namespace : $ namespaceTopLevel . '_' . $ namespace , ) ; } if ( ! is_string ( $ path ) ) { throw new Zend_Loader_Exception ( 'Invalid path specification provided; must be string' ) ; } $ this -> _resourceTypes [ $ type ] [ 'path' ] = $ this -> getBasePath ( ) . '/' . rtrim ( $ path , '\/' ) ; $ component = $ this -> _resourceTypes [ $ type ] [ 'namespace' ] ; $ this -> _components [ $ component ] = $ this -> _resourceTypes [ $ type ] [ 'path' ] ; return $ this ; }
|
Add resource type
|
15,526
|
public function addResourceTypes ( array $ types ) { foreach ( $ types as $ type => $ spec ) { if ( ! is_array ( $ spec ) ) { throw new Zend_Loader_Exception ( 'addResourceTypes() expects an array of arrays' ) ; } if ( ! isset ( $ spec [ 'path' ] ) ) { throw new Zend_Loader_Exception ( 'addResourceTypes() expects each array to include a paths element' ) ; } $ paths = $ spec [ 'path' ] ; $ namespace = null ; if ( isset ( $ spec [ 'namespace' ] ) ) { $ namespace = $ spec [ 'namespace' ] ; } $ this -> addResourceType ( $ type , $ paths , $ namespace ) ; } return $ this ; }
|
Add multiple resources at once
|
15,527
|
public function removeResourceType ( $ type ) { if ( $ this -> hasResourceType ( $ type ) ) { $ namespace = $ this -> _resourceTypes [ $ type ] [ 'namespace' ] ; unset ( $ this -> _components [ $ namespace ] ) ; unset ( $ this -> _resourceTypes [ $ type ] ) ; } return $ this ; }
|
Remove the requested resource type
|
15,528
|
public function load ( $ resource , $ type = null ) { if ( null === $ type ) { $ type = $ this -> getDefaultResourceType ( ) ; if ( empty ( $ type ) ) { throw new Zend_Loader_Exception ( 'No resource type specified' ) ; } } if ( ! $ this -> hasResourceType ( $ type ) ) { throw new Zend_Loader_Exception ( 'Invalid resource type specified' ) ; } $ namespace = $ this -> _resourceTypes [ $ type ] [ 'namespace' ] ; $ class = $ namespace . '_' . ucfirst ( $ resource ) ; if ( ! isset ( $ this -> _resources [ $ class ] ) ) { $ this -> _resources [ $ class ] = new $ class ; } return $ this -> _resources [ $ class ] ; }
|
Object registry and factory
|
15,529
|
protected function setDebugMode ( $ debug ) { error_reporting ( 0 ) ; if ( $ debug ) { error_reporting ( E_ALL ) ; ini_set ( 'display_errors' , true ) ; ini_set ( 'display_startup_errors' , true ) ; } }
|
Set old debug mode
|
15,530
|
protected function buildErrors ( ) { if ( $ this -> hasErrors ( ) ) { echo implode ( PHP_EOL , $ this -> getErrors ( ) ) ; echo PHP_EOL , $ this -> opts -> getUsageMessage ( ) ; } return $ this ; }
|
Method build and show error message
|
15,531
|
public function log ( $ message , $ priority , $ extras = null ) { if ( null !== $ this -> getLogger ( ) ) { $ this -> getLogger ( ) -> log ( $ message , $ priority , $ extras ) ; } return $ this ; }
|
Alias for log on logger
|
15,532
|
public static function generatePluginsManifest ( array $ packages , string $ outputPath , string $ vendorDir = null ) { $ plugins = [ ] ; foreach ( $ packages as $ package ) { if ( empty ( $ package [ 'extra' ] [ 'jinitialize-plugin' ] ) ) continue ; if ( ! is_null ( $ vendorDir ) ) { $ path = $ vendorDir . '/' . $ package [ 'name' ] ; $ package [ 'extra' ] [ 'jinitialize-plugin' ] [ 'path' ] = $ path ; } $ pluginInfo = $ package [ 'extra' ] [ 'jinitialize-plugin' ] ; $ plugins [ ] = $ pluginInfo ; } $ content = '<?php return ' . var_export ( $ plugins , true ) . ';' ; file_put_contents ( $ outputPath , $ content ) ; }
|
Separate mehtod for testing puroposes
|
15,533
|
public function setValue ( $ value ) { switch ( true ) { case ( $ this instanceof Select ) : if ( ! is_array ( $ value ) ) { $ value = ( array ) $ value ; } $ this -> value = $ value ; break ; case ( $ this instanceof Textarea ) : $ this -> inner = $ value ; break ; default : $ this -> attribute [ 'value' ] = $ value ; break ; } return $ this ; }
|
Sets value attribute .
|
15,534
|
protected function getProfileIdByTrackingId ( & $ analytics , $ tracking_id ) { $ accounts = $ analytics -> management_accounts -> listManagementAccounts ( ) ; foreach ( $ accounts -> getItems ( ) as $ item ) { $ account_id = $ item -> getId ( ) ; if ( $ account_id != $ tracking_id ) continue ; $ properties = $ analytics -> management_webproperties -> listManagementWebproperties ( $ account_id ) ; if ( sizeof ( $ properties -> getItems ( ) ) > 0 ) { $ items = $ properties -> getItems ( ) ; $ first_property_id = $ items [ 0 ] -> getId ( ) ; $ profiles = $ analytics -> management_profiles -> listManagementProfiles ( $ account_id , $ first_property_id ) ; if ( sizeof ( $ profiles -> getItems ( ) ) > 0 ) { $ items = $ profiles -> getItems ( ) ; return $ items [ 0 ] -> getId ( ) ; } } } return null ; }
|
41534519 - > 73241329
|
15,535
|
protected function matchRoute ( $ pathinfo , $ name , BaseRoute $ route ) { $ compiledRoute = $ route -> compile ( ) ; if ( '' !== $ compiledRoute -> getStaticPrefix ( ) && 0 !== strpos ( $ pathinfo , $ compiledRoute -> getStaticPrefix ( ) ) ) { return null ; } if ( ! preg_match ( $ compiledRoute -> getRegex ( ) , $ pathinfo , $ matches ) ) { return null ; } $ hostMatches = array ( ) ; if ( $ compiledRoute -> getHostRegex ( ) && ! preg_match ( $ compiledRoute -> getHostRegex ( ) , $ this -> context -> getHost ( ) , $ hostMatches ) ) { return null ; } if ( $ req = $ route -> getRequirement ( '_method' ) ) { if ( 'HEAD' === $ method = $ this -> context -> getMethod ( ) ) { $ method = 'GET' ; } if ( ! in_array ( $ method , $ req = explode ( '|' , strtoupper ( $ req ) ) ) ) { $ this -> allow = array_merge ( $ this -> allow , $ req ) ; return null ; } } $ status = $ this -> handleRouteRequirements ( $ pathinfo , $ name , $ route ) ; if ( self :: ROUTE_MATCH === $ status [ 0 ] ) { return $ status [ 1 ] ; } if ( self :: REQUIREMENT_MISMATCH === $ status [ 0 ] ) { return null ; } $ attrs = $ this -> getAttributes ( $ route , $ name , array_replace ( $ matches , $ hostMatches ) ) ; if ( $ route instanceof Route ) { foreach ( $ route -> getMatchCallbacks ( ) as $ callback ) { $ ret = call_user_func ( $ callback , $ attrs ) ; if ( $ ret === false ) { return null ; } if ( is_array ( $ ret ) ) { $ attrs = $ ret ; } } } return $ attrs ; }
|
Tries to match a URL with an individual route .
|
15,536
|
protected function _transition ( StateAwareInterface $ subject , $ transition ) { $ stateMachine = $ this -> _getStateMachineForTransition ( $ subject , $ transition ) ; if ( $ stateMachine === null ) { throw $ this -> _throwTransitionerException ( $ this -> __ ( 'State machine is null' ) ) ; } $ nTransition = $ this -> _normalizeTransition ( $ subject , $ transition ) ; try { $ rStateMachine = $ stateMachine -> transition ( $ nTransition ) ; } catch ( SmCouldNotTransitionExceptionInterface $ smtException ) { throw $ this -> _throwCouldNotTransitionException ( $ this -> __ ( 'Failed to apply "%1$s" transition' , [ $ transition ] ) , null , $ smtException , $ subject , $ transition ) ; } catch ( StateMachineExceptionInterface $ smException ) { throw $ this -> _throwTransitionerException ( $ this -> __ ( 'An error occurred during transition' ) , null , $ smException ) ; } if ( ! ( $ rStateMachine instanceof ReadableStateMachineInterface ) ) { throw $ this -> _throwTransitionerException ( $ this -> __ ( 'Resulting state machine is not readable' ) ) ; } return $ this -> _getNewSubject ( $ subject , $ transition , $ rStateMachine ) ; }
|
Applies a transition to a subject via a state machine .
|
15,537
|
public function isFluid ( $ fluid = null ) { if ( isset ( $ fluid ) ) { $ this -> fluid = ( bool ) $ fluid ; return $ this ; } else { return $ this -> fluid ; } }
|
Sets or gets fluid container flag .
|
15,538
|
public function isCollapsible ( $ collapsible = null ) { if ( isset ( $ collapsible ) ) { $ this -> collapsible = ( bool ) $ collapsible ; return $ this ; } else { return $ this -> collapsible ; } }
|
Sets or gets collapsible flag .
|
15,539
|
private function buildMenuItems ( array $ items ) { $ html = '' ; foreach ( $ items as $ item ) { if ( $ this -> multilevel && $ item -> hasChilds ( ) ) { $ html .= ' <li class="navbar-parent"> <a href="' . $ item -> getUrl ( ) . '">' . $ item -> getText ( ) . '</a> <ul>' ; $ html .= $ this -> buildMenuItems ( $ item -> getChilds ( ) ) ; $ html .= ' </ul> </li>' ; } else { $ url = $ item -> getUrl ( ) ; if ( $ url ) { $ html .= '<li><a href="' . $ url . '">' . $ item -> getText ( ) . '</a></li>' ; } else { $ html .= '<li><a href="#" onClick="return false">' . $ item -> getText ( ) . '</a></li>' ; } } } return $ html ; }
|
Builds nav bar elements
|
15,540
|
public function addHeader ( $ header , $ type = - 1 ) { if ( $ header instanceof Header ) $ this -> other_headers [ ] = $ header ; else $ this -> addAndCreateHeader ( $ header , $ type ) ; }
|
Allows you to add a header to the we bpage
|
15,541
|
public function display ( ) { $ this -> eventM -> sendEvent ( 'Didplay_Prepare@OWeb\manage\Headers' ) ; echo "\n<!--OWEB displays all CSS includes ; foreach ( $ this -> css_headers as $ id => $ h ) { echo $ h -> getCode ( $ id ) ; } echo "\n<!--OWEB displays all JS includes and codes ; foreach ( $ this -> js_headers as $ id => $ h ) { echo $ h -> getCode ( $ id ) ; } echo "\n<!--OWEB displays personalized header codes ; foreach ( $ this -> other_headers as $ id => $ h ) { echo $ h -> getCode ( $ id ) ; } $ this -> eventM -> sendEvent ( 'Didplay_Done@OWeb\manage\Headers' ) ; }
|
Display the Headers that has been added .
|
15,542
|
public function toString ( ) { $ s = "\n<!--OWEB displays all CSS includes ; foreach ( $ this -> css_headers as $ id => $ h ) { $ s .= $ h -> getCode ( $ id ) ; } $ s .= "\n<!--OWEB displays all JS includes and codes ; foreach ( $ this -> js_headers as $ id => $ h ) { $ s .= $ h -> getCode ( $ id ) ; } $ s .= "\n<!--OWEB displays personalized header codes ; foreach ( $ this -> other_headers as $ id => $ h ) { $ s .= $ h -> getCode ( $ id ) ; } return $ s ; }
|
Returns the string that the display function would display .
|
15,543
|
public function listJsonAction ( ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ jsonList = $ this -> get ( 'json_list' ) ; $ jsonList -> setRepository ( $ em -> getRepository ( 'EcommerceBundle:Invoice' ) ) ; $ response = $ jsonList -> get ( ) ; return new JsonResponse ( $ response ) ; }
|
Returns a list of Invoice entities in JSON format .
|
15,544
|
public function showAction ( Request $ request , $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ invoice = $ em -> getRepository ( 'EcommerceBundle:Invoice' ) -> find ( $ id ) ; if ( ! $ invoice ) { throw $ this -> createNotFoundException ( 'Unable to find Invoice entity.' ) ; } if ( ! $ invoice || false === $ this -> container -> get ( 'checkout_manager' ) -> isCurrentUserOwner ( $ invoice -> getTransaction ( ) ) ) { throw new AccessDeniedException ( ) ; } $ checkoutManager = $ this -> container -> get ( 'checkout_manager' ) ; $ delivery = $ invoice -> getTransaction ( ) -> getDelivery ( ) ; $ totals = $ checkoutManager -> calculateTotals ( $ invoice -> getTransaction ( ) , $ delivery ) ; if ( 'true' === $ request -> get ( 'download' ) ) { $ html = $ this -> container -> get ( 'templating' ) -> render ( 'EcommerceBundle:Profile:Invoice/download.html.twig' , array ( 'delivery' => $ delivery , 'invoice' => $ invoice , 'totals' => $ totals , ) ) ; $ html2pdf = $ this -> get ( 'html2pdf_factory' ) -> create ( ) ; $ html2pdf -> WriteHTML ( $ html ) ; return new Response ( $ html2pdf -> Output ( 'invoice' . $ invoice -> getInvoiceNumber ( ) . '.pdf' ) , 200 , array ( 'Content-Type' => 'application/pdf' , 'Content-Disposition' => 'attachment; filename="invoice' . $ invoice -> getInvoiceNumber ( ) . '.pdf"' ) ) ; } return array ( 'entity' => $ invoice , 'totals' => $ totals , ) ; }
|
Finds and displays an Invoice entity .
|
15,545
|
public function getField ( ) { $ value = $ this -> name ; if ( null != $ this -> field ) { $ value = $ this -> field ; } return $ value ; }
|
Gets the field name
|
15,546
|
public function setAliases ( array $ aliases ) { foreach ( $ aliases as $ name => $ alias ) { if ( ! ( $ module = $ this -> getModule ( $ name ) ) ) { $ module = $ this -> addModule ( $ name ) ; } $ module -> setAlias ( $ alias ) ; } return $ this ; }
|
Sets aliases for modules
|
15,547
|
public function addModule ( $ module ) { if ( ! ( $ module instanceof ModuleInterface ) ) { $ module = new Module ( $ module ) ; } return ( $ this -> modules [ $ module -> getName ( ) ] = $ module ) ; }
|
Adds new module into configuration
|
15,548
|
public function setHeader ( ) { $ args = func_get_args ( ) ; if ( is_array ( $ args [ 0 ] ) ) { foreach ( $ args [ 0 ] as $ key => $ value ) $ this -> headers [ 'headers' ] [ $ key ] = $ value ; } else { $ this -> headers [ 'headers' ] [ $ args [ 0 ] ] = $ args [ 1 ] ; } return $ this ; }
|
Add an additional header to the request Can also use the cleaner syntax of
|
15,549
|
public function setMime ( $ mime ) { if ( ! empty ( $ mime ) ) { $ this -> setContentType ( Mime :: getFullMime ( $ mime ) ) ; } return $ this ; }
|
Helper function to set the Content - Type and Expected as same in one swoop
|
15,550
|
public function getHandle ( ) { $ ownerClass = get_class ( $ this -> owner ) ; $ ownerTable = $ ownerClass :: tableName ( ) ; if ( ! isset ( self :: $ _handle [ $ ownerTable ] ) ) { self :: $ _handle [ $ ownerTable ] = [ ] ; $ ownerClass = get_class ( $ this -> owner ) ; $ schema = $ ownerClass :: getTableSchema ( ) ; foreach ( $ schema -> columns as $ column ) { switch ( $ column -> dbType ) { case 'date' : self :: $ _handle [ $ ownerTable ] [ $ column -> name ] = 'date' ; break ; case 'time' ; self :: $ _handle [ $ ownerTable ] [ $ column -> name ] = 'time' ; break ; case 'datetime' : self :: $ _handle [ $ ownerTable ] [ $ column -> name ] = 'datetime' ; break ; } } } return self :: $ _handle [ $ ownerTable ] ; }
|
Get handle .
|
15,551
|
private function loadModelRules ( ) { foreach ( $ this -> rules [ 'modelRules' ] as $ modelClass => $ modelPolicy ) { $ resourceId = call_user_func_array ( $ this -> config [ 'modelResourceGenerator' ] , [ $ modelClass ] ) ; $ this -> acl -> addResource ( new Resource ( $ resourceId ) ) ; $ modelAccessPolicy = [ ] ; if ( isset ( $ modelPolicy [ 'access' ] ) ) { $ modelAccessPolicy = $ modelPolicy [ 'access' ] ; } foreach ( $ modelAccessPolicy as $ ruleSet => $ privileges ) { foreach ( $ privileges as $ privilege ) { $ this -> enforceRuleset ( $ ruleSet , [ 'privileges' => $ privilege , 'resources' => $ resourceId ] ) ; } } $ this -> loadModelFieldPolicy ( $ modelClass , $ modelPolicy ) ; } }
|
Load model rules
|
15,552
|
private function loadRouteRules ( ) { foreach ( $ this -> rules [ 'routeRules' ] as $ routeAlias => $ routeRuleSets ) { $ resourceId = call_user_func_array ( $ this -> config [ 'routeResourceGenerator' ] , [ $ routeAlias ] ) ; $ this -> acl -> addResource ( new Resource ( $ resourceId ) ) ; foreach ( $ routeRuleSets as $ ruleSet ) { $ this -> enforceRuleset ( $ ruleSet , [ 'resources' => $ resourceId , 'privileges' => $ this -> config [ 'routePrivilege' ] ] ) ; } } }
|
Load route rules
|
15,553
|
public static function singularise ( $ word ) { foreach ( static :: $ singularRules as $ rule => $ replacement ) { if ( preg_match ( $ rule , $ word ) ) { return preg_replace ( $ rule , $ replacement , $ word ) ; } } return $ word ; }
|
Converts the word to singular form .
|
15,554
|
public static function pluralise ( $ word ) { foreach ( static :: $ pluralRules as $ rule => $ replacement ) { if ( preg_match ( $ rule , $ word ) ) { return preg_replace ( $ rule , $ replacement , $ word ) ; } } return $ word ; }
|
Converts the word to plural form .
|
15,555
|
protected function _setStateAware ( $ stateAware ) { if ( $ stateAware !== null && ! ( $ stateAware instanceof StateAwareInterface ) ) { throw $ this -> _createInvalidArgumentException ( $ this -> __ ( 'Argument is not a state aware object' ) , null , null , $ stateAware ) ; } $ this -> stateAware = $ stateAware ; }
|
Sets the state - aware subject for with this instance .
|
15,556
|
protected function get ( $ key ) { if ( ! array_key_exists ( $ key , $ this -> source ) ) { if ( $ this -> errProp ) { throw new FieldNotExist ( $ key , $ this ) ; } return null ; } return $ this -> source [ $ key ] ; }
|
Returns an item from the source
|
15,557
|
protected function set ( $ key , $ value ) { if ( $ this -> readonly ) { throw new ContainerReadOnly ( $ this ) ; } if ( $ this -> fixed && ( ! array_key_exists ( $ key , $ this -> source ) ) ) { throw new FieldNotExist ( $ key , $ this ) ; } $ this -> source [ $ key ] = $ value ; }
|
Sets an item value
|
15,558
|
protected function remove ( $ key ) { if ( $ this -> readonly ) { throw new ContainerReadOnly ( $ this ) ; } if ( $ this -> errProp ) { if ( ! array_key_exists ( $ key , $ this -> source ) ) { throw new FieldNotExist ( $ key , $ this ) ; } } if ( $ this -> fixed ) { throw new FieldNotExist ( $ key , $ this ) ; } unset ( $ this -> source [ $ key ] ) ; }
|
Removes an item from the source array
|
15,559
|
protected function getEncapsulationType ( & $ variable , & $ priority , & $ static ) { $ static = NULL ; if ( preg_match ( '/^((?<type>public|protected|private)(?<access>\sstatic)*\:)/' , $ variable , $ match ) ) { $ priority = $ match [ 'type' ] ; $ static = $ match [ 'access' ] ?? $ static ; $ variable = str_ireplace ( $ match [ 1 ] , NULL , $ variable ) ; } else { $ priority = 'public' ; } }
|
Protected get encapsulation type
|
15,560
|
public function vlansMapped ( $ instanceID = false ) { $ vlansMapped = [ ] ; $ instances1k2k = $ this -> getSNMP ( ) -> walk1d ( self :: OID_STP_X_SMST_INSTANCE_TABLE_VLANS_MAPPED_1K2K ) ; $ instances3k4k = $ this -> getSNMP ( ) -> walk1d ( self :: OID_STP_X_SMST_INSTANCE_TABLE_VLANS_MAPPED_3K4K ) ; if ( $ instanceID ) { foreach ( $ instances1k2k as $ id => $ instances ) if ( $ id != $ instanceID ) unset ( $ instances1k2k [ $ id ] ) ; foreach ( $ instances3k4k as $ id => $ instances ) if ( $ id != $ instanceID ) unset ( $ instances3k4k [ $ id ] ) ; } foreach ( [ - 1 => $ instances1k2k , 2047 => $ instances3k4k ] as $ offset => $ instances ) { foreach ( $ instances as $ instanceId => $ mapped ) { $ mapped = $ this -> getSNMP ( ) -> ppHexStringFlags ( $ mapped ) ; foreach ( $ mapped as $ vlanid => $ flag ) { if ( $ vlanid + $ offset <= 0 || $ vlanid + $ offset > 4094 ) continue ; $ vlansMapped [ $ instanceId ] [ $ vlanid + $ offset ] = $ flag ; } } } if ( $ instanceID ) $ vlansMapped = $ vlansMapped [ $ instanceID ] ; return $ vlansMapped ; }
|
Return array of MST instances containing an array of mapped VLANs
|
15,561
|
public function vlansMappedAsRanges ( $ instanceID = false ) { $ vlansMapped = $ this -> vlansMapped ( $ instanceID ) ; if ( $ instanceID ) $ vlansMapped [ $ instanceID ] = $ vlansMapped ; $ ranges = [ ] ; foreach ( $ vlansMapped as $ id => $ mapped ) { $ start = false ; $ inc = false ; foreach ( $ mapped as $ vid => $ flag ) { if ( $ flag ) { if ( ! $ start ) { $ start = $ vid ; $ inc = $ vid ; continue ; } if ( $ vid - $ inc == 1 ) { $ inc ++ ; continue ; } if ( $ vid - $ inc != 1 ) { if ( $ start == $ inc ) $ ranges [ $ id ] [ ] = $ start ; else $ ranges [ $ id ] [ ] = "{$start}-{$inc}" ; $ start = false ; continue ; } } else { if ( ! $ start ) continue ; else { if ( $ start == $ inc ) $ ranges [ $ id ] [ ] = $ start ; else $ ranges [ $ id ] [ ] = "{$start}-{$inc}" ; $ start = false ; continue ; } } } if ( $ start ) { if ( $ start == $ inc ) $ ranges [ $ id ] [ ] = $ start ; else $ ranges [ $ id ] [ ] = "{$start}-{$inc}" ; } } if ( $ instanceID ) return $ ranges [ $ instanceID ] ; return $ ranges ; }
|
Return array of MST instances containing an array of mapped VLAN ranges
|
15,562
|
public function instances ( $ name = null ) { if ( $ name === null ) $ name = $ this -> getSNMP ( ) -> useCisco_MST ( ) -> regionName ( ) . '.' ; $ hops = $ this -> remainingHopCount ( ) ; $ instances = [ ] ; foreach ( $ hops as $ i => $ h ) if ( $ h != - 1 ) $ instances [ $ i ] = "{$name}{$i}" ; return $ instances ; }
|
Returns an array of running MST instances .
|
15,563
|
public static function throwServiceExceptionIfDetected ( $ e ) { $ response = $ e -> getResponse ( ) ; if ( ! $ response ) { require_once ( 'Zend/Gdata/App/IOException.php' ) ; throw new Zend_Gdata_App_IOException ( 'No HTTP response received (possible connection failure)' ) ; } try { require_once 'Zend/Gdata/Gapps/ServiceException.php' ; $ error = new Zend_Gdata_Gapps_ServiceException ( ) ; $ error -> importFromString ( $ response -> getBody ( ) ) ; throw $ error ; } catch ( Zend_Gdata_App_Exception $ e2 ) { throw $ e ; } }
|
Convert an exception to an ServiceException if an AppsForYourDomain XML document is contained within the original exception s HTTP response . If conversion fails throw the original error .
|
15,564
|
public function get ( $ uri , $ extraHeaders = array ( ) ) { try { return parent :: get ( $ uri , $ extraHeaders ) ; } catch ( Zend_Gdata_App_HttpException $ e ) { self :: throwServiceExceptionIfDetected ( $ e ) ; } }
|
GET a URI using client object . This method overrides the default behavior of Zend_Gdata_App providing support for Zend_Gdata_Gapps_ServiceException .
|
15,565
|
public function post ( $ data , $ uri = null , $ remainingRedirects = null , $ contentType = null , $ extraHeaders = null ) { try { return parent :: post ( $ data , $ uri , $ remainingRedirects , $ contentType , $ extraHeaders ) ; } catch ( Zend_Gdata_App_HttpException $ e ) { self :: throwServiceExceptionIfDetected ( $ e ) ; } }
|
POST data with client object . This method overrides the default behavior of Zend_Gdata_App providing support for Zend_Gdata_Gapps_ServiceException .
|
15,566
|
public function delete ( $ data , $ remainingRedirects = null ) { try { return parent :: delete ( $ data , $ remainingRedirects ) ; } catch ( Zend_Gdata_App_HttpException $ e ) { self :: throwServiceExceptionIfDetected ( $ e ) ; } }
|
DELETE entry with client object This method overrides the default behavior of Zend_Gdata_App providing support for Zend_Gdata_Gapps_ServiceException .
|
15,567
|
public function getUserFeed ( $ location = null ) { if ( $ location === null ) { $ uri = $ this -> getBaseUrl ( ) . self :: APPS_USER_PATH ; } else if ( $ location instanceof Zend_Gdata_Query ) { $ uri = $ location -> getQueryUrl ( ) ; } else { $ uri = $ location ; } return parent :: getFeed ( $ uri , 'Zend_Gdata_Gapps_UserFeed' ) ; }
|
Retrieve a UserFeed containing multiple UserEntry objects .
|
15,568
|
public function getNicknameFeed ( $ location = null ) { if ( $ location === null ) { $ uri = $ this -> getBaseUrl ( ) . self :: APPS_NICKNAME_PATH ; } else if ( $ location instanceof Zend_Gdata_Query ) { $ uri = $ location -> getQueryUrl ( ) ; } else { $ uri = $ location ; } return parent :: getFeed ( $ uri , 'Zend_Gdata_Gapps_NicknameFeed' ) ; }
|
Retreive NicknameFeed object containing multiple NicknameEntry objects .
|
15,569
|
public function getGroupFeed ( $ location = null ) { if ( $ location === null ) { $ uri = self :: APPS_BASE_FEED_URI . self :: APPS_GROUP_PATH . '/' ; $ uri .= $ this -> getDomain ( ) ; } else if ( $ location instanceof Zend_Gdata_Query ) { $ uri = $ location -> getQueryUrl ( ) ; } else { $ uri = $ location ; } return parent :: getFeed ( $ uri , 'Zend_Gdata_Gapps_GroupFeed' ) ; }
|
Retreive GroupFeed object containing multiple GroupEntry objects .
|
15,570
|
public function getMemberFeed ( $ location = null ) { if ( $ location === null ) { require_once 'Zend/Gdata/App/InvalidArgumentException.php' ; throw new Zend_Gdata_App_InvalidArgumentException ( 'Location must not be null' ) ; } else if ( $ location instanceof Zend_Gdata_Query ) { $ uri = $ location -> getQueryUrl ( ) ; } else { $ uri = $ location ; } return parent :: getFeed ( $ uri , 'Zend_Gdata_Gapps_MemberFeed' ) ; }
|
Retreive MemberFeed object containing multiple MemberEntry objects .
|
15,571
|
public function insertUser ( $ user , $ uri = null ) { if ( $ uri === null ) { $ uri = $ this -> getBaseUrl ( ) . self :: APPS_USER_PATH ; } $ newEntry = $ this -> insertEntry ( $ user , $ uri , 'Zend_Gdata_Gapps_UserEntry' ) ; return $ newEntry ; }
|
Create a new user from a UserEntry .
|
15,572
|
public function insertNickname ( $ nickname , $ uri = null ) { if ( $ uri === null ) { $ uri = $ this -> getBaseUrl ( ) . self :: APPS_NICKNAME_PATH ; } $ newEntry = $ this -> insertEntry ( $ nickname , $ uri , 'Zend_Gdata_Gapps_NicknameEntry' ) ; return $ newEntry ; }
|
Create a new nickname from a NicknameEntry .
|
15,573
|
public function insertGroup ( $ group , $ uri = null ) { if ( $ uri === null ) { $ uri = self :: APPS_BASE_FEED_URI . self :: APPS_GROUP_PATH . '/' ; $ uri .= $ this -> getDomain ( ) ; } $ newEntry = $ this -> insertEntry ( $ group , $ uri , 'Zend_Gdata_Gapps_GroupEntry' ) ; return $ newEntry ; }
|
Create a new group from a GroupEntry .
|
15,574
|
public function insertMember ( $ member , $ uri = null ) { if ( $ uri === null ) { require_once 'Zend/Gdata/App/InvalidArgumentException.php' ; throw new Zend_Gdata_App_InvalidArgumentException ( 'URI must not be null' ) ; } $ newEntry = $ this -> insertEntry ( $ member , $ uri , 'Zend_Gdata_Gapps_MemberEntry' ) ; return $ newEntry ; }
|
Create a new member from a MemberEntry .
|
15,575
|
public function insertOwner ( $ owner , $ uri = null ) { if ( $ uri === null ) { require_once 'Zend/Gdata/App/InvalidArgumentException.php' ; throw new Zend_Gdata_App_InvalidArgumentException ( 'URI must not be null' ) ; } $ newEntry = $ this -> insertEntry ( $ owner , $ uri , 'Zend_Gdata_Gapps_OwnerEntry' ) ; return $ newEntry ; }
|
Create a new group from a OwnerEntry .
|
15,576
|
public function insertEmailList ( $ emailList , $ uri = null ) { if ( $ uri === null ) { $ uri = $ this -> getBaseUrl ( ) . self :: APPS_EMAIL_LIST_PATH ; } $ newEntry = $ this -> insertEntry ( $ emailList , $ uri , 'Zend_Gdata_Gapps_EmailListEntry' ) ; return $ newEntry ; }
|
Create a new email list from an EmailListEntry .
|
15,577
|
public function insertEmailListRecipient ( $ recipient , $ uri = null ) { if ( $ uri === null ) { require_once 'Zend/Gdata/App/InvalidArgumentException.php' ; throw new Zend_Gdata_App_InvalidArgumentException ( 'URI must not be null' ) ; } elseif ( $ uri instanceof Zend_Gdata_Gapps_EmailListEntry ) { $ uri = $ uri -> getLink ( 'edit' ) -> href ; } $ newEntry = $ this -> insertEntry ( $ recipient , $ uri , 'Zend_Gdata_Gapps_EmailListRecipientEntry' ) ; return $ newEntry ; }
|
Create a new email list recipient from an EmailListRecipientEntry .
|
15,578
|
public function createUser ( $ username , $ givenName , $ familyName , $ password , $ passwordHashFunction = null , $ quotaLimitInMB = null ) { $ user = $ this -> newUserEntry ( ) ; $ user -> login = $ this -> newLogin ( ) ; $ user -> login -> username = $ username ; $ user -> login -> password = $ password ; $ user -> login -> hashFunctionName = $ passwordHashFunction ; $ user -> name = $ this -> newName ( ) ; $ user -> name -> givenName = $ givenName ; $ user -> name -> familyName = $ familyName ; if ( $ quotaLimitInMB !== null ) { $ user -> quota = $ this -> newQuota ( ) ; $ user -> quota -> limit = $ quotaLimitInMB ; } return $ this -> insertUser ( $ user ) ; }
|
Create a new user entry and send it to the Google Apps servers .
|
15,579
|
public function retrieveUser ( $ username ) { $ query = $ this -> newUserQuery ( $ username ) ; try { $ user = $ this -> getUserEntry ( $ query ) ; } catch ( Zend_Gdata_Gapps_ServiceException $ e ) { if ( $ e -> hasError ( Zend_Gdata_Gapps_Error :: ENTITY_DOES_NOT_EXIST ) ) { $ user = null ; } else { throw $ e ; } } return $ user ; }
|
Retrieve a user based on their username .
|
15,580
|
public function retrievePageOfUsers ( $ startUsername = null ) { $ query = $ this -> newUserQuery ( ) ; $ query -> setStartUsername ( $ startUsername ) ; return $ this -> getUserFeed ( $ query ) ; }
|
Retrieve a page of users in alphabetical order starting with the provided username .
|
15,581
|
public function updateUser ( $ username , $ userEntry ) { return $ this -> updateEntry ( $ userEntry , $ this -> getBaseUrl ( ) . self :: APPS_USER_PATH . '/' . $ username ) ; }
|
Overwrite a specified username with the provided UserEntry . The UserEntry does not need to contain an edit link .
|
15,582
|
public function suspendUser ( $ username ) { $ user = $ this -> retrieveUser ( $ username ) ; $ user -> login -> suspended = true ; return $ user -> save ( ) ; }
|
Mark a given user as suspended .
|
15,583
|
public function restoreUser ( $ username ) { $ user = $ this -> retrieveUser ( $ username ) ; $ user -> login -> suspended = false ; return $ user -> save ( ) ; }
|
Mark a given user as not suspended .
|
15,584
|
public function createNickname ( $ username , $ nickname ) { $ entry = $ this -> newNicknameEntry ( ) ; $ nickname = $ this -> newNickname ( $ nickname ) ; $ login = $ this -> newLogin ( $ username ) ; $ entry -> nickname = $ nickname ; $ entry -> login = $ login ; return $ this -> insertNickname ( $ entry ) ; }
|
Create a nickname for a given user .
|
15,585
|
public function retrieveNickname ( $ nickname ) { $ query = $ this -> newNicknameQuery ( ) ; $ query -> setNickname ( $ nickname ) ; try { $ nickname = $ this -> getNicknameEntry ( $ query ) ; } catch ( Zend_Gdata_Gapps_ServiceException $ e ) { if ( $ e -> hasError ( Zend_Gdata_Gapps_Error :: ENTITY_DOES_NOT_EXIST ) ) { $ nickname = null ; } else { throw $ e ; } } return $ nickname ; }
|
Retrieve the entry for a specified nickname .
|
15,586
|
public function retrieveNicknames ( $ username ) { $ query = $ this -> newNicknameQuery ( ) ; $ query -> setUsername ( $ username ) ; $ nicknameFeed = $ this -> retrieveAllEntriesForFeed ( $ this -> getNicknameFeed ( $ query ) ) ; return $ nicknameFeed ; }
|
Retrieve all nicknames associated with a specific username .
|
15,587
|
public function retrievePageOfNicknames ( $ startNickname = null ) { $ query = $ this -> newNicknameQuery ( ) ; $ query -> setStartNickname ( $ startNickname ) ; return $ this -> getNicknameFeed ( $ query ) ; }
|
Retrieve a page of nicknames in alphabetical order starting with the provided nickname .
|
15,588
|
public function retrieveGroup ( $ groupId ) { $ query = $ this -> newGroupQuery ( $ groupId ) ; try { $ group = $ this -> getGroupEntry ( $ query ) ; } catch ( Zend_Gdata_Gapps_ServiceException $ e ) { if ( $ e -> hasError ( Zend_Gdata_Gapps_Error :: ENTITY_DOES_NOT_EXIST ) ) { $ group = null ; } else { throw $ e ; } } return $ group ; }
|
Retrieves a group based on group id
|
15,589
|
public function isMember ( $ memberId , $ groupId ) { $ uri = self :: APPS_BASE_FEED_URI . self :: APPS_GROUP_PATH . '/' ; $ uri .= $ this -> getDomain ( ) . '/' . $ groupId . '/member/' . $ memberId ; try { $ results = $ this -> get ( $ uri ) ; } catch ( Exception $ e ) { $ results = false ; } if ( $ results ) { return TRUE ; } else { return FALSE ; } }
|
Check to see if a member id or group id is a member of group
|
15,590
|
public function addMemberToGroup ( $ recipientAddress , $ groupId ) { $ member = $ this -> newMemberEntry ( ) ; $ properties [ ] = $ this -> newProperty ( ) ; $ properties [ 0 ] -> name = 'memberId' ; $ properties [ 0 ] -> value = $ recipientAddress ; $ member -> property = $ properties ; $ uri = self :: APPS_BASE_FEED_URI . self :: APPS_GROUP_PATH . '/' ; $ uri .= $ this -> getDomain ( ) . '/' . $ groupId . '/member' ; return $ this -> insertMember ( $ member , $ uri ) ; }
|
Add an email address to a group as a member
|
15,591
|
public function removeMemberFromGroup ( $ memberId , $ groupId ) { $ uri = self :: APPS_BASE_FEED_URI . self :: APPS_GROUP_PATH . '/' ; $ uri .= $ this -> getDomain ( ) . '/' . $ groupId . '/member/' . $ memberId ; return $ this -> delete ( $ uri ) ; }
|
Remove a member id from a group
|
15,592
|
public function addOwnerToGroup ( $ email , $ groupId ) { $ owner = $ this -> newOwnerEntry ( ) ; $ properties [ ] = $ this -> newProperty ( ) ; $ properties [ 0 ] -> name = 'email' ; $ properties [ 0 ] -> value = $ email ; $ owner -> property = $ properties ; $ uri = self :: APPS_BASE_FEED_URI . self :: APPS_GROUP_PATH . '/' ; $ uri .= $ this -> getDomain ( ) . '/' . $ groupId . '/owner' ; return $ this -> insertOwner ( $ owner , $ uri ) ; }
|
Add an email as an owner of a group
|
15,593
|
public function retrieveGroupOwners ( $ groupId ) { $ uri = self :: APPS_BASE_FEED_URI . self :: APPS_GROUP_PATH . '/' ; $ uri .= $ this -> getDomain ( ) . '/' . $ groupId . '/owner' ; return $ this -> getOwnerFeed ( $ uri ) ; }
|
Retrieves all the owners of a group
|
15,594
|
public function isOwner ( $ email , $ groupId ) { $ uri = self :: APPS_BASE_FEED_URI . self :: APPS_GROUP_PATH . '/' ; $ uri .= $ this -> getDomain ( ) . '/' . $ groupId . '/owner/' . $ email ; try { $ results = $ this -> get ( $ uri ) ; } catch ( Exception $ e ) { $ results = false ; } if ( $ results ) { return TRUE ; } else { return FALSE ; } }
|
Checks to see if an email is an owner of a group
|
15,595
|
public function removeOwnerFromGroup ( $ email , $ groupId ) { $ uri = self :: APPS_BASE_FEED_URI . self :: APPS_GROUP_PATH . '/' ; $ uri .= $ this -> getDomain ( ) . '/' . $ groupId . '/owner/' . $ email ; return $ this -> delete ( $ uri ) ; }
|
Remove email as an owner of a group
|
15,596
|
public function updateGroup ( $ groupId , $ groupName = null , $ description = null , $ emailPermission = null ) { $ i = 0 ; $ group = $ this -> newGroupEntry ( ) ; $ properties [ $ i ] = $ this -> newProperty ( ) ; $ properties [ $ i ] -> name = 'groupId' ; $ properties [ $ i ] -> value = $ groupId ; $ i ++ ; if ( $ groupName != null ) { $ properties [ $ i ] = $ this -> newProperty ( ) ; $ properties [ $ i ] -> name = 'groupName' ; $ properties [ $ i ] -> value = $ groupName ; $ i ++ ; } if ( $ description != null ) { $ properties [ $ i ] = $ this -> newProperty ( ) ; $ properties [ $ i ] -> name = 'description' ; $ properties [ $ i ] -> value = $ description ; $ i ++ ; } if ( $ emailPermission != null ) { $ properties [ $ i ] = $ this -> newProperty ( ) ; $ properties [ $ i ] -> name = 'emailPermission' ; $ properties [ $ i ] -> value = $ emailPermission ; $ i ++ ; } $ group -> property = $ properties ; $ uri = self :: APPS_BASE_FEED_URI . self :: APPS_GROUP_PATH . '/' ; $ uri .= $ this -> getDomain ( ) . '/' . $ groupId ; return $ this -> updateEntry ( $ group , $ uri , 'Zend_Gdata_Gapps_GroupEntry' ) ; }
|
Update group properties with new values . any property not defined will not be updated
|
15,597
|
public function retrieveGroups ( $ memberId , $ directOnly = null ) { $ query = $ this -> newGroupQuery ( ) ; $ query -> setMember ( $ memberId ) ; if ( $ directOnly != null ) { $ query -> setDirectOnly ( $ directOnly ) ; } return $ this -> getGroupFeed ( $ query ) ; }
|
Retrieve all of the groups that a user is a member of
|
15,598
|
public function retrievePageOfGroups ( $ startGroup = null ) { $ query = $ this -> newGroupQuery ( ) ; $ query -> setStartGroupId ( $ startGroup ) ; return $ this -> getGroupFeed ( $ query ) ; }
|
Retrieve a page of groups in alphabetical order starting with the provided group .
|
15,599
|
public function retrievePageOfMembers ( $ groupId , $ startMember = null ) { $ query = $ this -> newMemberQuery ( $ groupId ) ; $ query -> setStartMemberId ( $ startMember ) ; return $ this -> getMemberFeed ( $ query ) ; }
|
Gets page of Members
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.