idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
18,500 | public static function __callstatic ( $ method , array $ params ) { if ( static :: $ container ) { if ( ! isset ( $ params [ 0 ] ) ) { $ method .= '@' . $ params [ 0 ] ; } return static :: $ container -> get ( $ method ) ; } throw new NotFoundException ( Message :: get ( Message :: DI_CONTAINER_NOTFOUND ) , Message :: DI_CONTAINER_NOTFOUND ) ; } | Locate a service from the container |
18,501 | public static function initialize ( $ projectId , $ apiKey ) { if ( ! isset ( self :: $ client ) ) { self :: $ client = new Client ( $ projectId , $ apiKey ) ; } return self :: $ client ; } | Initializes the Connect client singleton instance |
18,502 | public function Add ( $ Recipient = '' ) { $ this -> Form -> SetModel ( $ this -> ConversationModel ) ; if ( $ this -> Form -> AuthenticatedPostBack ( ) ) { $ RecipientUserIDs = array ( ) ; $ To = explode ( ',' , $ this -> Form -> GetFormValue ( 'To' , '' ) ) ; $ UserModel = new UserModel ( ) ; foreach ( $ To as $ Name ) { if ( trim ( $ Name ) != '' ) { $ User = $ UserModel -> GetByUsername ( trim ( $ Name ) ) ; if ( is_object ( $ User ) ) $ RecipientUserIDs [ ] = $ User -> UserID ; } } $ this -> EventArguments [ 'Recipients' ] = $ RecipientUserIDs ; $ this -> FireEvent ( 'BeforeAddConversation' ) ; $ this -> Form -> SetFormValue ( 'RecipientUserID' , $ RecipientUserIDs ) ; $ ConversationID = $ this -> Form -> Save ( $ this -> ConversationMessageModel ) ; if ( $ ConversationID !== FALSE ) { $ Target = $ this -> Form -> GetFormValue ( 'Target' , 'messages/' . $ ConversationID ) ; $ this -> RedirectUrl = Url ( $ Target ) ; } } else { if ( $ Recipient != '' ) $ this -> Form -> SetValue ( 'To' , $ Recipient ) ; } if ( $ Target = Gdn :: Request ( ) -> Get ( 'Target' ) ) $ this -> Form -> AddHidden ( 'Target' , $ Target ) ; Gdn_Theme :: Section ( 'PostConversation' ) ; $ this -> Title ( T ( 'New Conversation' ) ) ; $ this -> SetData ( 'Breadcrumbs' , array ( array ( 'Name' => T ( 'Inbox' ) , 'Url' => '/messages/inbox' ) , array ( 'Name' => $ this -> Data ( 'Title' ) , 'Url' => 'messages/add' ) ) ) ; $ this -> Render ( ) ; } | Start a new conversation . |
18,503 | public function AddMessage ( $ ConversationID = '' ) { $ this -> Form -> SetModel ( $ this -> ConversationMessageModel ) ; if ( is_numeric ( $ ConversationID ) && $ ConversationID > 0 ) $ this -> Form -> AddHidden ( 'ConversationID' , $ ConversationID ) ; if ( $ this -> Form -> AuthenticatedPostBack ( ) ) { $ ConversationID = $ this -> Form -> GetFormValue ( 'ConversationID' , '' ) ; $ Conversation = $ this -> ConversationModel -> GetID ( $ ConversationID , Gdn :: Session ( ) -> UserID ) ; $ this -> EventArguments [ 'Conversation' ] = $ Conversation ; $ this -> EventArguments [ 'ConversationID' ] = $ ConversationID ; $ this -> FireEvent ( 'BeforeAddMessage' ) ; $ NewMessageID = $ this -> Form -> Save ( ) ; if ( $ NewMessageID ) { if ( $ this -> DeliveryType ( ) == DELIVERY_TYPE_ALL ) Redirect ( 'messages/' . $ ConversationID . '/#' . $ NewMessageID , 302 ) ; $ this -> SetJson ( 'MessageID' , $ NewMessageID ) ; $ LastMessageID = $ this -> Form -> GetFormValue ( 'LastMessageID' ) ; if ( ! is_numeric ( $ LastMessageID ) ) $ LastMessageID = $ NewMessageID - 1 ; $ Session = Gdn :: Session ( ) ; $ MessageData = $ this -> ConversationMessageModel -> GetNew ( $ ConversationID , $ LastMessageID ) ; $ this -> Conversation = $ Conversation ; $ this -> MessageData = $ MessageData ; $ this -> View = 'messages' ; } else { if ( $ this -> DeliveryType ( ) != DELIVERY_TYPE_ALL ) $ this -> ErrorMessage ( $ this -> Form -> Errors ( ) ) ; } } $ this -> Render ( ) ; } | Add a message to a conversation . |
18,504 | public function All ( $ Page = '' ) { $ Session = Gdn :: Session ( ) ; $ this -> Title ( T ( 'Inbox' ) ) ; Gdn_Theme :: Section ( 'ConversationList' ) ; list ( $ Offset , $ Limit ) = OffsetLimit ( $ Page , C ( 'Conversations.Conversations.PerPage' , 50 ) ) ; $ this -> Offset = $ Offset ; $ UserID = $ this -> Request -> Get ( 'userid' , Gdn :: Session ( ) -> UserID ) ; if ( $ UserID != Gdn :: Session ( ) -> UserID ) { if ( ! C ( 'Conversations.Moderation.Allow' , FALSE ) ) { throw PermissionException ( ) ; } $ this -> Permission ( 'Conversations.Moderation.Manage' ) ; } $ Conversations = $ this -> ConversationModel -> Get2 ( $ UserID , $ Offset , $ Limit ) ; $ this -> SetData ( 'Conversations' , $ Conversations -> ResultArray ( ) ) ; if ( ! $ this -> Data ( '_PagerUrl' ) ) $ this -> SetData ( '_PagerUrl' , 'messages/all/{Page}' ) ; $ this -> SetData ( '_Page' , $ Page ) ; $ this -> SetData ( '_Limit' , $ Limit ) ; $ this -> SetData ( '_CurrentRecords' , count ( $ Conversations -> ResultArray ( ) ) ) ; if ( $ this -> _DeliveryType != DELIVERY_TYPE_ALL && $ this -> _DeliveryMethod == DELIVERY_METHOD_XHTML ) { $ this -> SetJson ( 'LessRow' , $ this -> Pager -> ToString ( 'less' ) ) ; $ this -> SetJson ( 'MoreRow' , $ this -> Pager -> ToString ( 'more' ) ) ; $ this -> View = 'conversations' ; } $ this -> Render ( ) ; } | Show all conversations for the currently authenticated user . |
18,505 | public function Clear ( $ ConversationID = FALSE , $ TransientKey = '' ) { $ Session = Gdn :: Session ( ) ; $ this -> _DeliveryType = DELIVERY_TYPE_BOOL ; $ ValidID = ( is_numeric ( $ ConversationID ) && $ ConversationID > 0 ) ; $ ValidSession = ( $ Session -> UserID > 0 && $ Session -> ValidateTransientKey ( $ TransientKey ) ) ; if ( $ ValidID && $ ValidSession ) { $ this -> ConversationModel -> Clear ( $ ConversationID , $ Session -> UserID ) ; $ this -> InformMessage ( T ( 'The conversation has been cleared.' ) ) ; $ this -> RedirectUrl = Url ( '/messages/all' ) ; } $ this -> Render ( ) ; } | Clear the message history for a specific conversation & user . |
18,506 | public function Bookmark ( $ ConversationID = '' , $ TransientKey = '' ) { $ Session = Gdn :: Session ( ) ; $ Success = FALSE ; $ Star = FALSE ; if ( is_numeric ( $ ConversationID ) && $ ConversationID > 0 && $ Session -> UserID > 0 && $ Session -> ValidateTransientKey ( $ TransientKey ) ) { $ Bookmark = $ this -> ConversationModel -> Bookmark ( $ ConversationID , $ Session -> UserID ) ; } if ( $ Bookmark === FALSE ) $ this -> Form -> AddError ( 'ErrorBool' ) ; else $ this -> SetJson ( 'Bookmark' , $ Bookmark ) ; if ( $ this -> _DeliveryType == DELIVERY_TYPE_ALL ) Redirect ( $ _SERVER [ 'HTTP_REFERER' ] ) ; else $ this -> Render ( ) ; } | Allows users to bookmark conversations . |
18,507 | protected function extractTypeHintFromComment ( $ comment ) { if ( empty ( $ comment ) ) { return [ null , null ] ; } if ( ! preg_match ( '(\(DC2Type:(\w+)\))' , $ comment , $ match ) ) { return [ null , $ comment ] ; } $ type = $ match [ 1 ] ; $ comment = trim ( str_replace ( '(DC2Type:' . $ type . ')' , '' , $ comment ) ) ; if ( $ comment == '' ) { $ comment = null ; } return [ $ type , $ comment ] ; } | Split a type - hint for Database Access Layer from comment . |
18,508 | protected function compileColumnDefinition ( array $ options ) { $ options = array_merge ( [ 'type' => null , 'size' => null , 'scale' => null , 'nullable' => false , 'default' => null , 'collation' => null , 'comment' => null , ] , $ options ) ; $ type = strtolower ( $ options [ 'type' ] ) ; if ( $ type == 'identity' ) { $ sql = 'INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT' ; } else if ( $ type == 'bigidentity' ) { $ sql = 'BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT' ; } else { $ size = $ options [ 'size' ] ; $ scale = $ options [ 'scale' ] ; $ sql = $ this -> compileFieldType ( $ type , $ size , $ scale ) ; if ( ! $ options [ 'nullable' ] ) { $ sql .= ' NOT NULL' ; } if ( $ options [ 'default' ] !== null ) { $ default = $ options [ 'default' ] ; if ( is_string ( $ default ) && $ default != 'CURRENT_TIMESTAMP' ) { $ default = $ this -> db -> quote ( $ options [ 'default' ] ) ; } else if ( is_bool ( $ default ) ) { $ default = $ default ? '1' : '0' ; } $ sql .= ' DEFAULT ' . $ default ; } if ( ! empty ( $ options [ 'collation' ] ) ) { $ sql .= ' COLLATE ' . $ options [ 'collation' ] ; } } $ comment = $ options [ 'comment' ] ; if ( $ this -> needATypeHint ( $ type ) ) { $ comment = ( $ comment !== null ? $ comment . ' ' : '' ) . '(DC2Type:' . $ type . ')' ; } if ( ! is_null ( $ comment ) ) { $ sql .= ' COMMENT ' . $ this -> db -> quote ( $ comment ) ; } return $ sql ; } | Compile the column definitions . |
18,509 | protected function compileFieldType ( $ type , $ size , $ scale ) { switch ( strtolower ( $ type ) ) { case 'smallint' : return 'SMALLINT' ; case 'integer' : return 'INT' ; case 'unsigned' : return 'INT UNSIGNED' ; case 'bigint' : return 'BIGINT' ; case 'numeric' : return 'NUMERIC(' . ( $ size ? : 10 ) . ', ' . ( $ scale ? : 0 ) . ')' ; case 'float' : return 'DOUBLE' ; case 'string' : return 'VARCHAR(' . ( $ size ? : 255 ) . ')' ; case 'text' : case 'array' : case 'json' : case 'object' : return 'TEXT' ; case 'guid' : return 'UUID' ; case 'binary' : return 'VARBINARY(' . ( $ size ? : 2 ) . ')' ; case 'blob' : return 'BLOB' ; case 'boolean' : return 'BOOLEAN' ; case 'date' : return 'DATE' ; case 'datetime' : return 'DATETIME' ; case 'timestamp' : return 'TIMESTAMP' ; case 'time' : return 'TIME' ; default : throw new InvalidArgumentException ( "Type '{$type}' not supported by Database Access Layer." ) ; } } | Compile the column type . |
18,510 | public function forceSwitch ( $ dbHost , $ dbName , $ dbUser , $ dbPassword , array $ dbOptions = array ( ) ) { if ( $ this -> getSession ( ) -> has ( self :: SESSION_CONNECTION_KEY ) ) { $ current = $ this -> getSession ( ) -> get ( self :: SESSION_CONNECTION_KEY ) ; if ( $ current [ self :: PARAM_HOST ] === $ dbHost && $ current [ self :: PARAM_DATABASE ] === $ dbName ) { return false ; } } $ this -> getSession ( ) -> set ( self :: SESSION_CONNECTION_KEY , array ( self :: PARAM_DRIVER_OPTIONS => $ dbOptions , self :: PARAM_HOST => $ dbHost , self :: PARAM_DATABASE => $ dbName , self :: PARAM_USER => $ dbUser , self :: PARAM_PASSWORD => $ dbPassword , ) ) ; if ( $ this -> isConnected ( ) ) { $ this -> close ( ) ; } return true ; } | Force a switch of database connection . |
18,511 | protected function getParamsKey ( ) { return array ( self :: PARAM_DRIVER_OPTIONS , self :: PARAM_HOST , self :: PARAM_DATABASE , self :: PARAM_USER , self :: PARAM_PASSWORD , ) ; } | Get a list of parameter keys |
18,512 | protected function hasNewConnectionParams ( array $ params ) { if ( ! $ this -> getSession ( ) -> has ( self :: SESSION_CONNECTION_KEY ) ) { return true ; } $ currentParams = $ this -> getSession ( ) -> get ( self :: SESSION_CONNECTION_KEY ) ; foreach ( $ this -> getParamsKey ( ) as $ key ) { if ( isset ( $ currentParams [ $ key ] ) && $ params [ $ key ] !== $ currentParams [ $ key ] ) { return true ; } } return false ; } | Checks if has new connection parameters |
18,513 | public function remove ( $ key ) { $ value = $ this -> elements [ $ this -> hash ( $ key ) ] ; unset ( $ this -> elements [ $ this -> hash ( $ key ) ] ) ; $ this -> fire ( new MapRemoveEvent ( $ key , $ value ) ) ; return $ value ; } | Removes element with given key . |
18,514 | protected function & getIntlNumberFormatter ( $ langAndLocale = NULL , $ style = NULL , $ pattern = NULL , $ attributes = [ ] , $ textAttributes = [ ] ) { $ key = implode ( '_' , [ 'number' , serialize ( func_get_args ( ) ) ] ) ; if ( ! isset ( $ this -> intlFormatters [ $ key ] ) ) { $ formatter = \ numfmt_create ( $ this -> langAndLocale , $ style , $ pattern ) ; foreach ( $ attributes as $ key => $ value ) \ numfmt_set_attribute ( $ formatter , $ key , $ value ) ; foreach ( $ textAttributes as $ key => $ value ) \ numfmt_set_text_attribute ( $ formatter , $ key , $ value ) ; $ this -> intlFormatters [ $ key ] = & $ formatter ; } return $ this -> intlFormatters [ $ key ] ; } | Get stored \ NumberFormatter instance or create new one . |
18,515 | protected function setUpLocaleConventions ( ) { $ this -> localeConventions = NULL ; if ( $ this -> systemEncoding !== NULL ) { $ this -> localeConventions = ( object ) localeconv ( ) ; } if ( ! $ this -> localeConventions || $ this -> localeConventions -> frac_digits == 127 ) $ this -> localeConventions = ( object ) $ this -> defaultLocaleConventions ; if ( ! $ this -> localeConventions -> n_sign_posn ) $ this -> localeConventions -> n_sign_posn = 3 ; } | Try to set up local conventions by system locale settings only if there was any success with setting up system locale . If system locale is not set up properly - use default formatting conventions . |
18,516 | public function save ( $ object ) { if ( is_array ( $ object ) ) { $ objectData = $ object ; if ( $ object [ 'id' ] > 0 ) { $ object = $ this -> find ( $ object [ 'id' ] ) ; } else { $ object = new Navigation ( ) ; $ site = $ this -> siteManager -> find ( $ objectData [ 'site' ] ) ; $ object -> setSite ( $ site ) ; } if ( isset ( $ objectData [ 'site' ] ) ) { unset ( $ objectData [ 'site' ] ) ; } $ this -> assignArrayToObject ( $ object , $ objectData ) ; } else if ( ! ( $ object instanceof Navigation ) ) { $ this -> addErrorMessage ( self :: ERROR_WRONG_OBJECT ) ; } if ( ! $ this -> hasError ( ) ) { $ check = $ this -> navigationManager -> save ( $ object ) ; if ( $ check ) { $ this -> addSuccessMessage ( self :: SUCCESS_SAVED ) ; return $ object ; } } return null ; } | save a Navigation you can pass the Navigation object or an array with the fields if you pass an array the keys must be with underscore and not with CamelCase |
18,517 | public static function get ( $ name , $ var = [ ] , $ absolute = false ) { $ routes = self :: resolveStatic ( RESOLVE_ROUTE , $ name ) ; if ( isset ( $ routes [ 0 ] [ '' . $ routes [ 1 ] . '' ] ) ) { $ route = $ routes [ 0 ] [ '' . $ routes [ 1 ] . '' ] ; $ url = preg_replace ( '#\((.*)\)#isU' , '<($1)>' , $ route [ 'url' ] ) ; $ urls = explode ( '<' , $ url ) ; $ result = '' ; $ i = 0 ; foreach ( $ urls as $ url ) { if ( preg_match ( '#\)>#' , $ url ) ) { if ( count ( $ var ) > 0 ) { if ( isset ( $ var [ $ i ] ) ) { $ result .= preg_replace ( '#\((.*)\)>#U' , $ var [ $ i ] , $ url ) ; } else { $ result .= preg_replace ( '#\((.*)\)>#U' , '' , $ url ) ; } $ i ++ ; } } else { $ result .= $ url ; } } $ result = preg_replace ( '#\\\.#U' , '.' , $ result ) ; if ( Config :: config ( ) [ 'user' ] [ 'framework' ] [ 'folder' ] != '' ) { $ folder = Config :: config ( ) [ 'user' ] [ 'framework' ] [ 'folder' ] ; if ( $ absolute == false ) { return '/' . substr ( $ folder , 0 , strlen ( $ folder ) - 1 ) . $ result ; } else { if ( Config :: config ( ) [ 'user' ] [ 'output' ] [ 'https' ] ) return 'https://' . $ _SERVER [ 'HTTP_HOST' ] . $ folder . $ result ; else return 'http://' . $ _SERVER [ 'HTTP_HOST' ] . $ folder . $ result ; } } else { if ( $ absolute == false ) { if ( $ result == '' ) { return '/' ; } else { return $ result ; } } else { if ( Config :: config ( ) [ 'user' ] [ 'output' ] [ 'https' ] ) return 'https://' . $ _SERVER [ 'HTTP_HOST' ] . $ result ; else return 'http://' . $ _SERVER [ 'HTTP_HOST' ] . $ result ; } } } return null ; } | get an url |
18,518 | public function countBanLogEntries ( ) : int { $ this -> db -> qb ( [ 'table' => 'core_bans' , 'fields' => 'COUNT(ip)' , 'filter' => 'ip=:ip AND logstamp+:ttl > :expires AND code>0' , 'params' => [ ':ip' => $ this -> ip , ':ttl' => $ this -> ttl_banlog_entry , ':expires' => time ( ) ] ] ) ; return $ this -> db -> value ( ) ; } | Returns the number of ban entires in the log for an IP address within the set duration . |
18,519 | public function getBanActiveTimestamp ( ) : int { $ this -> db -> qb ( [ 'table' => 'core_bans' , 'fields' => 'logstamp' , 'filter' => 'ip=:ip AND code=0' , 'params' => [ ':ip' => $ this -> ip ] , 'order' => 'logstamp DESC' , 'limit' => 1 ] ) ; $ data = $ this -> db -> value ( ) ; return $ data ? $ data : 0 ; } | Returns the timestamp from log when ban got active for this ip |
18,520 | public function render ( array $ data , ContextInterface $ context ) { $ data += [ 'value' => 1 , 'val' => null , 'disabled' => false , 'onLabel' => 'on' , 'offLabel' => 'off' , 'class' => '' ] ; if ( $ this -> _isChecked ( $ data ) ) { $ data [ 'checked' ] = true ; } unset ( $ data [ 'val' ] ) ; $ attrs = $ this -> _templates -> formatAttributes ( $ data , [ 'name' , 'value' , 'onLabel' , 'offLabel' , 'type' , 'class' ] ) ; $ checkbox = $ this -> _templates -> format ( 'checkbox' , [ 'name' => $ data [ 'name' ] , 'value' => $ data [ 'value' ] , 'templateVars' => $ data [ 'templateVars' ] , 'attrs' => $ attrs ] ) ; $ toggleSwitch = $ this -> _templates -> format ( 'toggleSwitch' , [ 'checkbox' => $ checkbox , 'onLabel' => $ data [ 'onLabel' ] , 'offLabel' => $ data [ 'offLabel' ] , 'attrs' => $ this -> _templates -> formatAttributes ( $ data , [ 'name' , 'type' , 'value' , 'class' ] ) ] ) ; $ data [ 'class' ] = empty ( $ data [ 'class' ] ) ? 'toggle-switch' : 'toggle-switch ' . $ data [ 'class' ] ; return $ this -> _templates -> format ( 'nestingLabel' , [ 'hidden' => '' , 'input' => $ toggleSwitch , 'attrs' => $ this -> _templates -> formatAttributes ( $ data , [ 'name' , 'type' , 'value' , 'onLabel' , 'offLabel' , 'id' ] ) ] ) ; } | Render a switchToggle element . |
18,521 | public static function create ( $ actual , $ expected , $ code = 0 , \ Exception $ prev = null ) { $ message = sprintf ( 'The value must be a type of %s, %s given.' , is_object ( $ expected ) ? get_class ( $ expected ) : ( is_scalar ( $ expected ) ? $ expected : gettype ( $ expected ) ) , is_object ( $ actual ) ? get_class ( $ actual ) : ( is_scalar ( $ actual ) ? $ actual : gettype ( $ actual ) ) ) ; return new static ( $ message , $ code , $ prev ) ; } | Create a new exception |
18,522 | public function select ( $ tableName , $ tableAlias = null ) { return $ this -> dbFactory -> facade ( 'Select' , $ this -> pdo , $ tableName , $ tableAlias ) ; } | Get an prepare instance of a select facade for an easy access to the database . |
18,523 | public function mapErrorsToForm ( ConstraintViolationListInterface $ errors , FormInterface $ form ) { $ messages = $ this -> extractMessages ( $ errors ) ; $ this -> mapMessagesToElementCollection ( $ messages , $ form -> getChildren ( ) ) ; } | Maps errors messages to all form elements |
18,524 | protected function mapMessagesToElementCollection ( array $ messages , ElementCollection $ children ) { $ children -> forAll ( function ( ElementInterface $ element ) use ( $ messages ) { $ this -> mapMessagesToElement ( $ messages , $ element ) ; } ) ; } | Maps errors to elements children |
18,525 | protected function mapMessagesToElement ( array $ messages , ElementInterface $ element ) { if ( $ element -> hasPropertyPath ( ) ) { $ propertyPathParts = explode ( '.' , $ element -> getPropertyPath ( false ) ) ; $ propertyPath = $ this -> buildPath ( $ propertyPathParts ) ; if ( $ this -> propertyAccessor -> isReadable ( $ messages , $ propertyPath ) ) { $ errors = $ this -> propertyAccessor -> getValue ( $ messages , $ propertyPath ) ; $ element -> setError ( $ errors ) ; } } $ children = $ element -> getChildren ( ) ; if ( $ children -> count ( ) ) { $ this -> mapMessagesToElementCollection ( $ messages , $ children ) ; } } | Sets errors on element |
18,526 | public function getDocumentListFeed ( $ location = null ) { if ( $ location === null ) { $ uri = self :: DOCUMENTS_LIST_FEED_URI ; } else if ( $ location instanceof Zend_Gdata_Query ) { $ uri = $ location -> getQueryUrl ( ) ; } else { $ uri = $ location ; } return parent :: getFeed ( $ uri , 'Zend_Gdata_Docs_DocumentListFeed' ) ; } | Retreive feed object containing entries for the user s documents . |
18,527 | public function getDocumentListEntry ( $ 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 :: getEntry ( $ uri , 'Zend_Gdata_Docs_DocumentListEntry' ) ; } | Retreive entry object representing a single document . |
18,528 | public function uploadFile ( $ fileLocation , $ title = null , $ mimeType = null , $ uri = null ) { if ( $ uri === null ) { $ uri = $ this -> _defaultPostUri ; } $ fs = $ this -> newMediaFileSource ( $ fileLocation ) ; if ( $ title !== null ) { $ slugHeader = $ title ; } else { $ slugHeader = $ fileLocation ; } $ fs -> setSlug ( $ slugHeader ) ; if ( $ mimeType === null ) { $ filenameParts = explode ( '.' , $ fileLocation ) ; $ fileExtension = end ( $ filenameParts ) ; $ mimeType = self :: lookupMimeType ( $ fileExtension ) ; } $ fs -> setContentType ( $ mimeType ) ; return $ this -> insertDocument ( $ fs , $ uri ) ; } | Upload a local file to create a new Google Document entry . |
18,529 | public function createFolder ( $ folderName , $ folderResourceId = null ) { $ category = new Zend_Gdata_App_Extension_Category ( self :: DOCUMENTS_CATEGORY_TERM , self :: DOCUMENTS_CATEGORY_SCHEMA ) ; $ title = new Zend_Gdata_App_Extension_Title ( $ folderName ) ; $ entry = new Zend_Gdata_Entry ( ) ; $ entry -> setCategory ( array ( $ category ) ) ; $ entry -> setTitle ( $ title ) ; $ uri = self :: DOCUMENTS_LIST_FEED_URI ; if ( $ folderResourceId != null ) { $ uri = self :: DOCUMENTS_FOLDER_FEED_URI . '/' . $ folderResourceId ; } return $ this -> insertEntry ( $ entry , $ uri ) ; } | Creates a new folder in Google Docs |
18,530 | public function encodeUrl ( ) { $ ignore = [ '%21' => '!' , '%23' => '#' , '%24' => '$' , '%26' => '&' , '%27' => '\'' , '%28' => '(' , '%29' => ')' , '%2A' => '*' , '%2B' => '+' , '%2C' => ',' , '%2D' => '-' , '%2E' => '.' , '%2F' => '/' , '%3A' => ':' , '%3B' => ';' , '%3D' => '=' , '%3F' => '?' , '%40' => '@' , '%5F' => '_' , '%7E' => '~' , ] ; $ this -> text = strtr ( rawurlencode ( rawurldecode ( $ this -> text ) ) , $ ignore ) ; return $ this ; } | Escape special characters for use in an URL . |
18,531 | public function handle ( $ pattern , $ resultHandler , $ partHandler ) { $ nodes = [ ] ; $ text = preg_replace_callback ( $ pattern , function ( $ matches ) use ( & $ nodes ) { $ nodes [ ] = $ matches ; return "\0" ; } , $ this -> text ) ; $ parts = explode ( "\0" , $ text ) ; $ match = 0 ; foreach ( $ nodes as $ node ) { if ( $ parts [ $ match ] !== '' ) $ partHandler ( new static ( $ parts [ $ match ] ) ) ; $ args = array_map ( function ( $ item ) { return new static ( $ item ) ; } , $ node ) ; call_user_func_array ( $ resultHandler , $ args ) ; $ match ++ ; } if ( $ parts [ $ match ] !== '' ) $ partHandler ( new static ( $ parts [ $ match ] ) ) ; return $ this ; } | Find the given regular expression and execute callbacks on it and its surroundings . |
18,532 | public function addArrayAsChildren ( array $ array , SimpleXMLElement $ xmlElement , $ ignoreEmptyElements = true ) { $ children = [ ] ; foreach ( $ array as $ key => $ value ) { if ( $ this -> isEmpty ( $ value ) && $ ignoreEmptyElements ) { continue ; } if ( $ key === '@attributes' ) { if ( ! is_array ( $ value ) ) { throw new Exception ( '@attributes must be an array' ) ; } foreach ( $ value as $ attributeName => $ attributeValue ) { $ xmlElement -> addAttribute ( $ attributeName , htmlspecialchars ( $ attributeValue ) ) ; } continue ; } if ( $ key === '@value' ) { if ( ! is_scalar ( $ value ) ) { throw new Exception ( '@value must be a scalar' ) ; } $ xmlElement [ 0 ] = htmlspecialchars ( $ value ) ; continue ; } if ( is_array ( $ value ) ) { $ useSubArray = key ( $ value ) === 0 ; $ subValues = $ useSubArray ? $ value : [ $ value ] ; $ subChildren = [ ] ; foreach ( $ subValues as $ subValue ) { if ( is_array ( $ subValue ) ) { $ subChild = $ xmlElement -> addChild ( $ key ) ; $ this -> addArrayAsChildren ( $ subValue , $ subChild , $ ignoreEmptyElements ) ; } else { $ subChild = $ xmlElement -> addChild ( $ key , $ subValue ) ; } $ subChildren [ ] = $ subChild ; } $ children [ $ key ] = $ useSubArray ? $ subChildren : $ subChildren [ 0 ] ; continue ; } $ value = htmlspecialchars ( $ value ) ; $ children [ $ key ] = $ xmlElement -> addChild ( $ key , $ value ) ; } return $ children ; } | Convert an array into XML and adds the whole structure as a child of the existing SimpleXMLElement given . An array of inserted children is returned so you can add further children to them if necessary . |
18,533 | private function getBox ( array $ coordinates ) { $ height = abs ( $ coordinates [ 'y1' ] - $ coordinates [ 'y2' ] ) ; $ width = abs ( $ coordinates [ 'x1' ] - $ coordinates [ 'x2' ] ) ; return new Box ( $ width , $ height ) ; } | Get box . |
18,534 | public function listAction ( ) { $ user = $ this -> getUser ( ) ; $ repository = $ this -> get ( 'ekyna_user.address.repository' ) ; $ addresses = $ repository -> findByUser ( $ user ) ; return $ this -> render ( 'EkynaUserBundle:Address:list.html.twig' , [ 'addresses' => $ addresses ] ) ; } | List address action . |
18,535 | public function newAction ( Request $ request ) { $ user = $ this -> getUser ( ) ; $ repository = $ this -> get ( 'ekyna_user.address.repository' ) ; $ address = $ repository -> createNew ( ) ; $ address -> setUser ( $ user ) ; $ cancelPath = $ this -> generateUrl ( 'ekyna_user_address_list' ) ; $ form = $ this -> createForm ( 'ekyna_user_address' , $ address , [ '_redirect_enabled' => true , ] ) -> add ( 'actions' , 'form_actions' , [ 'buttons' => [ 'save' => [ 'type' => 'submit' , 'options' => [ 'button_class' => 'primary' , 'label' => 'ekyna_core.button.save' , 'attr' => [ 'icon' => 'ok' , ] , ] , ] , 'cancel' => [ 'type' => 'button' , 'options' => [ 'label' => 'ekyna_core.button.cancel' , 'button_class' => 'default' , 'as_link' => true , 'attr' => [ 'class' => 'form-cancel-btn' , 'icon' => 'remove' , 'href' => $ cancelPath , ] , ] , ] , ] , ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ event = $ this -> get ( 'ekyna_user.address.operator' ) -> create ( $ address ) ; if ( ! $ event -> isPropagationStopped ( ) ) { $ this -> addFlash ( 'ekyna_user.address.message.create.success' , 'success' ) ; if ( null !== $ redirectPath = $ form -> get ( '_redirect' ) -> getData ( ) ) { return $ this -> redirect ( $ redirectPath ) ; } return $ this -> redirect ( $ cancelPath ) ; } $ this -> addFlash ( 'ekyna_user.address.message.create.failure' , 'danger' ) ; } return $ this -> render ( 'EkynaUserBundle:Address:new.html.twig' , [ 'form' => $ form -> createView ( ) ] ) ; } | New address action . |
18,536 | public function editAction ( Request $ request ) { $ user = $ this -> getUser ( ) ; $ repository = $ this -> get ( 'ekyna_user.address.repository' ) ; if ( null === $ address = $ repository -> find ( $ request -> attributes -> get ( 'addressId' ) ) ) { throw new NotFoundHttpException ( 'Address not found.' ) ; } if ( $ address -> getUser ( ) -> getId ( ) !== $ user -> getId ( ) ) { throw new AccessDeniedHttpException ( 'Access denied' ) ; } $ cancelPath = $ this -> generateUrl ( 'ekyna_user_address_list' ) ; $ form = $ this -> createForm ( 'ekyna_user_address' , $ address , [ '_redirect_enabled' => true , ] ) -> add ( 'actions' , 'form_actions' , [ 'buttons' => [ 'save' => [ 'type' => 'submit' , 'options' => [ 'button_class' => 'primary' , 'label' => 'ekyna_core.button.save' , 'attr' => [ 'icon' => 'ok' , ] , ] , ] , 'cancel' => [ 'type' => 'button' , 'options' => [ 'label' => 'ekyna_core.button.cancel' , 'button_class' => 'default' , 'as_link' => true , 'attr' => [ 'class' => 'form-cancel-btn' , 'icon' => 'remove' , 'href' => $ cancelPath , ] , ] , ] , ] , ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ event = $ this -> get ( 'ekyna_user.address.operator' ) -> update ( $ address ) ; if ( ! $ event -> isPropagationStopped ( ) ) { $ this -> addFlash ( 'ekyna_user.address.message.edit.success' , 'success' ) ; if ( null !== $ redirectPath = $ form -> get ( '_redirect' ) -> getData ( ) ) { return $ this -> redirect ( $ redirectPath ) ; } return $ this -> redirect ( $ cancelPath ) ; } $ this -> addFlash ( 'ekyna_user.address.message.edit.failure' , 'danger' ) ; } return $ this -> render ( 'EkynaUserBundle:Address:edit.html.twig' , [ 'address' => $ address , 'form' => $ form -> createView ( ) ] ) ; } | Edit address action . |
18,537 | public static function validate ( ) { $ instance = static :: get_instance ( ) ; $ error = new \ WP_Error ( ) ; foreach ( get_class_methods ( $ instance ) as $ method ) { $ repl = new \ ReflectionMethod ( get_called_class ( ) , $ method ) ; if ( ! $ repl -> isPublic ( ) ) { continue ; } if ( 0 !== strpos ( $ method , 'test_' ) ) { continue ; } $ result = call_user_func ( [ $ instance , $ method ] ) ; if ( is_wp_error ( $ result ) ) { $ error -> add ( $ result -> get_error_code ( ) , $ result -> get_error_message ( ) ) ; } } return $ error -> get_error_messages ( ) ? $ error : true ; } | Validate all method |
18,538 | public function & vars ( ) { if ( empty ( $ _SESSION [ $ this -> getContext ( ) ] ) ) { $ _SESSION [ $ this -> getContext ( ) ] = [ ] ; } return $ _SESSION [ $ this -> getContext ( ) ] ; } | Returns the reference to the array of the session variables . |
18,539 | protected function addDataGridServiceDefinition ( $ code , array $ dataGridConfiguration , ContainerBuilder $ container ) { $ dataGridConfiguration = $ this -> finalizeConfiguration ( $ code , $ dataGridConfiguration , $ container ) ; $ definition = new Definition ( new Parameter ( 'sidus_eav_data_grid.model.datagrid.class' ) , [ $ code , $ dataGridConfiguration , new Reference ( 'translator' ) , ] ) ; $ definition -> addTag ( 'sidus.datagrid' ) ; $ definition -> setPublic ( false ) ; $ container -> setDefinition ( 'sidus_eav_data_grid.datagrid.' . $ code , $ definition ) ; } | Add a new Filter service based on the configuration passed inside the datagrid |
18,540 | protected function addFilterConfiguration ( $ code , array $ dataGridConfiguration , ContainerBuilder $ container ) { $ dataGridConfiguration [ 'filter_config' ] [ 'family' ] = $ dataGridConfiguration [ 'family' ] ; $ filterConfig = $ this -> finalizeFilterConfiguration ( $ code , $ dataGridConfiguration [ 'filter_config' ] ) ; $ definition = new Definition ( new Parameter ( 'sidus_eav_filter.configuration.class' ) , [ $ code , new Reference ( 'doctrine' ) , new Reference ( 'sidus_filter.filter.factory' ) , $ filterConfig , new Reference ( 'sidus_eav_model.family.registry' ) , ] ) ; $ definition -> setPublic ( false ) ; $ serviceId = 'sidus_eav_filter.datagrid.configuration.' . $ code ; $ container -> setDefinition ( $ serviceId , $ definition ) ; return new Reference ( $ serviceId ) ; } | Handle direct configuration of filters uses the same logic than the FilterBundle to generate a service |
18,541 | public function generateFullKey ( string $ key = '' ) : string { if ( ! $ this -> context || ! $ this -> identifier ) { throw new \ InvalidArgumentException ( 'You have to run setContext and setIdentifier methods first' ) ; } return implode ( '_' , [ static :: class , $ this -> context , $ this -> identifier , $ key , ] ) ; } | all examples below are in context of storage keys |
18,542 | public function all ( $ object = true ) { $ properties = get_object_vars ( $ this ) ; if ( $ object ) { return ( object ) $ properties ; } return $ properties ; } | Returns an associative array of the object properties |
18,543 | private function validateWhereClause ( $ table , $ where ) { foreach ( $ where as $ column => $ value ) { if ( ! $ this -> isInputValid ( $ table , $ column , $ value ) ) { return false ; } } return true ; } | Validate WHERE binding for SQL statement |
18,544 | public function isValidInput ( $ table , $ column , $ value ) { $ table_object = $ this -> ContentContract -> tables [ $ table ] ; $ column_type_validator = $ table_object :: SCHEMA [ $ column ] ; return $ this -> ContentContract -> validators [ $ column_type_validator ] ( $ value ) ; } | Check value against given filter |
18,545 | public function isValidColumn ( $ table , $ column ) { $ table_object = ( $ this -> ContentContract -> tables [ $ table ] ) ; $ schema = $ table_object :: SCHEMA ; return isset ( $ schema [ $ column ] ) ; } | Checks a column exists in a given table |
18,546 | private function validateTableAndCol ( $ table , $ columns ) { if ( ! $ this -> isValidTable ( $ table ) ) { return false ; } foreach ( $ columns as $ column ) { if ( ! $ this -> isValidColumn ( $ table , $ column ) ) { return false ; } } return true ; } | Wrapper function to validate a table and columns |
18,547 | private function validateBind ( $ table , $ data ) { foreach ( $ data as $ column => $ value ) { if ( ! $ this -> isValidInput ( $ table , $ column , $ value ) ) { return false ; } } return true ; } | Validate a set of columns and values |
18,548 | public static function create ( $ key , $ code = 0 , \ Exception $ prev = null ) { $ message = sprintf ( 'Not found server with key "%s".' , $ key ) ; return new static ( $ message , $ code , $ prev ) ; } | Create new exception instance with key |
18,549 | public function source ( Size $ size ) : string { return $ this -> maker ( ) -> make ( $ this -> name , $ this -> options ( $ size ) ) ; } | Return the URL for the image resized to the given width . |
18,550 | public function sourceSet ( SizeRange $ range ) : string { return $ range -> toVector ( ) -> map ( function ( $ size ) { return $ this -> source ( $ size ) . " {$size}w" ; } ) -> join ( ', ' ) ; } | Return the contents of a srcset attribute for the given range of widths . |
18,551 | public function tag ( SizeRange $ range , Size $ defaultSize , array $ attributes = [ ] ) : string { $ attributes = new Map ( $ attributes ) ; $ attributes [ 'alt' ] = $ attributes [ 'alt' ] ?? '' ; $ attributes [ 'sizes' ] = $ attributes [ 'sizes' ] ?? '100vw' ; $ attributes [ 'src' ] = $ this -> source ( $ defaultSize ) ; $ attributes [ 'srcset' ] = $ this -> sourceSet ( $ range ) ; $ attributeString = $ attributes -> ksorted ( ) -> map ( function ( $ key , $ value ) { return "$key='$value'" ; } ) -> values ( ) -> join ( ' ' ) ; return "<img $attributeString>" ; } | Return a responsive HTML img tag for the image . |
18,552 | public static function fromShape ( Shape $ shape , Name $ name , array $ options = [ ] , Maker $ maker = null ) : self { switch ( $ shape ) { case 'square' : return new Square ( $ name , $ options , $ maker ) ; case 'tall' : return new Tall ( $ name , $ options , $ maker ) ; case 'wide' : return new Wide ( $ name , $ options , $ maker ) ; default : return new self ( $ name , $ options , $ maker ) ; } } | Return an Image object of the appropriate class based on a Shape value . |
18,553 | public function createDefaultOrganization ( ) { $ organization = new Organization ( ) ; $ organization -> setName ( $ this -> getUsername ( ) ) ; $ this -> organizations [ ] = $ organization ; } | Create default Organization |
18,554 | public function dates ( string $ strStartDate = null , $ mEndDate = null ) { return new SkeDateIterator ( static :: $ oModel , $ strStartDate , $ mEndDate ) ; } | Get dates iterator . |
18,555 | public static function skeDoosh ( array $ aOptions ) { echo <<<EOD<script> if (typeof jQuery == 'undefined') { skedLoadTag( 'http://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js', loadSkedJs ); } else { loadSkedJs(); } function skedLoadTag(strSrc, fnOnload) { var eHead = document.getElementsByTagName('head')[0]; var e$ = document.createElement('script'); e$.src = strSrc; if (fnOnload) e$.onload = fnOnload; eHead.appendChild(e$); } function loadSkedJs() { skedLoadTag('https://raw.githubusercontent.com/CampusUnion/Sked-JS/master/sked.js'); }</script>EOD ; $ sked = new self ( $ aOptions ) ; $ skeVent = null ; $ bSuccess = false ; if ( $ _REQUEST [ 'sked_form' ] ?? null === '1' ) { $ skeVent = new \ CampusUnion \ Sked \ SkeVent ( $ _REQUEST ) ; $ bSuccess = $ sked -> save ( $ skeVent ) ; } echo $ sked -> form ( [ 'method' => 'get' ] , $ bSuccess ? : $ skeVent ) ; } | Do it all in one easy method call . |
18,556 | public function delete ( ) { $ return = false ; if ( isset ( $ this -> tokenId ) ) { $ return = $ this -> apiCall -> delete ( $ this -> endpoint . '/delete' , array ( 'tokenId' => $ this -> tokenId ) ) ; } return $ return ; } | Deletes a token . |
18,557 | private function addMetas ( $ type , array $ values ) { foreach ( $ values as $ key => $ value ) { $ this -> seoPage -> addMeta ( $ type , $ key , $ value ) ; } } | Add metas . |
18,558 | public function handleLoginRequest ( LoginRequest $ request ) { $ socialLogin = $ this -> socialLoginMapper -> findByProviderUserId ( $ request -> getProvider ( ) , $ request -> getProviderUserId ( ) ) ; if ( $ socialLogin ) { $ user = $ this -> userService -> findById ( $ socialLogin -> getUserId ( ) ) ; $ this -> updateSocialLoginToken ( $ socialLogin , $ request ) ; return $ this -> handleLogin ( $ user , $ request ) ; } $ userFound = false ; foreach ( $ request -> getEmails ( ) as $ email ) { $ user = $ this -> userService -> findByEmail ( $ email ) ; if ( $ user ) { $ userFound = true ; if ( $ this -> userHasSocialLoginWithProvider ( $ request -> getProvider ( ) , $ user ) ) { return $ this -> handleLogin ( $ user , $ request ) ; } } } if ( $ userFound ) { throw new NoLinkedAccountException ; } $ result = $ this -> registerFromSocialLogin ( $ request ) ; return $ this -> handleLogin ( $ result [ 'user' ] ) ; } | Handle a request to log in via a social login provider |
18,559 | public function handleLinkRequest ( LoginRequest $ request , $ userId ) { $ socialLogin = $ this -> socialLoginMapper -> findByProviderUserId ( $ request -> getProvider ( ) , $ request -> getProviderUserId ( ) ) ; if ( $ socialLogin ) { throw new LinkedAccountExistsException ; } $ user = $ this -> userService -> findById ( $ userId ) ; if ( ! $ user ) { throw new OutOfBoundsException ( 'Account not found' , self :: EXCEPTION_ACCOUNT_NOT_FOUND ) ; } $ socialLoginEntity = new SocialLoginEntity ; $ socialLoginEntity -> setUserId ( $ user -> getId ( ) ) -> setProvider ( $ request -> getProvider ( ) ) -> setProviderUserId ( $ request -> getProviderUserId ( ) ) -> setAccessToken ( $ request -> getAccessToken ( ) ) -> setAccessTokenExpires ( $ request -> getAccessTokenExpires ( ) ) -> setRefreshToken ( $ request -> getRefreshToken ( ) ) ; $ socialLogin = $ this -> socialLoginMapper -> persist ( $ socialLoginEntity ) ; return $ this -> handleLogin ( $ user , $ request ) ; } | Handle a request to link a social account to a non - social account |
18,560 | public function registerFromSocialLogin ( LoginRequest $ request ) { $ email = $ request -> getEmails ( ) [ 0 ] ; $ user = $ this -> userService -> registerWithoutPassword ( array ( 'email' => $ email ) ) ; $ socialLoginEntity = new SocialLoginEntity ; $ socialLoginEntity -> setUserId ( $ user -> getId ( ) ) -> setProvider ( $ request -> getProvider ( ) ) -> setProviderUserId ( $ request -> getProviderUserId ( ) ) -> setAccessToken ( $ request -> getAccessToken ( ) ) -> setAccessTokenExpires ( $ request -> getAccessTokenExpires ( ) ) -> setRefreshToken ( $ request -> getRefreshToken ( ) ) ; $ entity = $ this -> socialLoginMapper -> persist ( $ socialLoginEntity ) ; return array ( 'user' => $ user , 'social_login' => $ entity ) ; } | Register a new user account from a social login provider |
18,561 | public function userHasSocialLoginWithProvider ( $ provider , $ user ) { return ( bool ) $ this -> socialLoginMapper -> findBy ( [ 'provider' => $ provider , 'user_id' => $ user -> getId ( ) ] ) ; } | Determine if a given user has a social login linked with a given provider |
18,562 | public function handleLogin ( UserEntity $ user ) { $ accessToken = new AccessToken ( $ this -> tokenStorage , $ this -> tokenStorage ) ; $ token = $ accessToken -> createAccessToken ( '' , $ user -> getId ( ) , null , true ) ; return $ token ; } | Create an access token given a user entity |
18,563 | protected function updateSocialLoginToken ( SocialLoginEntity $ socialLogin , LoginRequest $ request ) { $ socialLogin -> setAccessToken ( $ request -> getAccessToken ( ) ) -> setAccessTokenExpires ( $ request -> getAccessTokenExpires ( ) ) -> setRefreshToken ( $ request -> getRefreshToken ( ) ) ; $ this -> socialLoginMapper -> persist ( $ socialLogin ) ; } | Update a users OAuth token token expiration and refresh token information when they log in |
18,564 | public function getAncestor ( $ id ) { if ( ! is_null ( $ this -> parent ) ) { if ( $ this -> parent -> id ( ) == $ id ) { return $ this -> parent ; } return $ this -> parent -> getAncestor ( $ id ) ; } return null ; } | Attempts to get an ancestor node by the given id . |
18,565 | public function nextSibling ( ) { if ( is_null ( $ this -> parent ) ) { throw new ParentNotFoundException ( 'Parent is not set for this node.' ) ; } return $ this -> parent -> nextChild ( $ this -> id ) ; } | Attempts to get the next sibling . |
18,566 | public function previousSibling ( ) { if ( is_null ( $ this -> parent ) ) { throw new ParentNotFoundException ( 'Parent is not set for this node.' ) ; } return $ this -> parent -> previousChild ( $ this -> id ) ; } | Attempts to get the previous sibling |
18,567 | public function ancestorByTag ( $ tag ) { $ node = $ this ; while ( ! is_null ( $ node ) ) { if ( $ node -> tag -> name ( ) == $ tag ) { return $ node ; } $ node = $ node -> getParent ( ) ; } throw new ParentNotFoundException ( 'Could not find an ancestor with "' . $ tag . '" tag' ) ; } | Function to locate a specific ancestor tag in the path to the root . |
18,568 | public function getByName ( string $ role ) : ? IRole { if ( null === $ this -> roles ) { $ this -> getAll ( ) ; } if ( ! isset ( $ this -> names [ $ role ] ) ) { return null ; } return $ this -> roles [ $ this -> names [ $ role ] ] ; } | Get a role by its name |
18,569 | public function getMultipleByName ( array $ roles ) : iterable { if ( null === $ this -> roles ) { $ this -> getAll ( ) ; } $ results = [ ] ; foreach ( $ roles as $ role ) { if ( isset ( $ this -> names [ $ role ] ) ) { $ results [ ] = $ this -> roles [ $ this -> names [ $ role ] ] ; } } return $ results ; } | Get roles by their names |
18,570 | public function addVisitor ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisitor $ visitor ) { $ this -> visitor [ ] = $ visitor ; return $ this ; } | Add visitor . |
18,571 | public function removeVisitor ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisitor $ visitor ) { return $ this -> visitor -> removeElement ( $ visitor ) ; } | Remove visitor . |
18,572 | public function addVisitorType ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisitorType $ visitorType ) { $ this -> visitorType [ ] = $ visitorType ; return $ this ; } | Add visitorType . |
18,573 | public function removeVisitorType ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisitorType $ visitorType ) { return $ this -> visitorType -> removeElement ( $ visitorType ) ; } | Remove visitorType . |
18,574 | public function addReferrerType ( \ BlackForest \ PiwikBundle \ Entity \ PiwikReferrerType $ referrerType ) { $ this -> referrerType [ ] = $ referrerType ; return $ this ; } | Add referrerType . |
18,575 | public function removeReferrerType ( \ BlackForest \ PiwikBundle \ Entity \ PiwikReferrerType $ referrerType ) { return $ this -> referrerType -> removeElement ( $ referrerType ) ; } | Remove referrerType . |
18,576 | public function addSearchEngine ( \ BlackForest \ PiwikBundle \ Entity \ PiwikSearchEngine $ searchEngine ) { $ this -> searchEngine [ ] = $ searchEngine ; return $ this ; } | Add searchEngine . |
18,577 | public function removeSearchEngine ( \ BlackForest \ PiwikBundle \ Entity \ PiwikSearchEngine $ searchEngine ) { return $ this -> searchEngine -> removeElement ( $ searchEngine ) ; } | Remove searchEngine . |
18,578 | public function addLanguage ( \ BlackForest \ PiwikBundle \ Entity \ PiwikLanguage $ language ) { $ this -> language [ ] = $ language ; return $ this ; } | Add language . |
18,579 | public function removeLanguage ( \ BlackForest \ PiwikBundle \ Entity \ PiwikLanguage $ language ) { return $ this -> language -> removeElement ( $ language ) ; } | Remove language . |
18,580 | public function addDevice ( \ BlackForest \ PiwikBundle \ Entity \ PiwikDevice $ device ) { $ this -> device [ ] = $ device ; return $ this ; } | Add device . |
18,581 | public function removeDevice ( \ BlackForest \ PiwikBundle \ Entity \ PiwikDevice $ device ) { return $ this -> device -> removeElement ( $ device ) ; } | Remove device . |
18,582 | public function addOperatingSystem ( \ BlackForest \ PiwikBundle \ Entity \ PiwikOperatingSystem $ operatingSystem ) { $ this -> operatingSystem [ ] = $ operatingSystem ; return $ this ; } | Add operatingSystem . |
18,583 | public function removeOperatingSystem ( \ BlackForest \ PiwikBundle \ Entity \ PiwikOperatingSystem $ operatingSystem ) { return $ this -> operatingSystem -> removeElement ( $ operatingSystem ) ; } | Remove operatingSystem . |
18,584 | public function addBrowser ( \ BlackForest \ PiwikBundle \ Entity \ PiwikBrowser $ browser ) { $ this -> browser [ ] = $ browser ; return $ this ; } | Add browser . |
18,585 | public function removeBrowser ( \ BlackForest \ PiwikBundle \ Entity \ PiwikBrowser $ browser ) { return $ this -> browser -> removeElement ( $ browser ) ; } | Remove browser . |
18,586 | public function addCountry ( \ BlackForest \ PiwikBundle \ Entity \ PiwikCountry $ country ) { $ this -> country [ ] = $ country ; return $ this ; } | Add country . |
18,587 | public function removeCountry ( \ BlackForest \ PiwikBundle \ Entity \ PiwikCountry $ country ) { return $ this -> country -> removeElement ( $ country ) ; } | Remove country . |
18,588 | public function addResolution ( \ BlackForest \ PiwikBundle \ Entity \ PiwikResolution $ resolution ) { $ this -> resolution [ ] = $ resolution ; return $ this ; } | Add resolution . |
18,589 | public function removeResolution ( \ BlackForest \ PiwikBundle \ Entity \ PiwikResolution $ resolution ) { return $ this -> resolution -> removeElement ( $ resolution ) ; } | Remove resolution . |
18,590 | public function addEcomerceStatus ( \ BlackForest \ PiwikBundle \ Entity \ PiwikEcomerceStatus $ ecomerceStatus ) { $ this -> ecomerceStatus [ ] = $ ecomerceStatus ; return $ this ; } | Add ecomerceStatus . |
18,591 | public function removeEcomerceStatus ( \ BlackForest \ PiwikBundle \ Entity \ PiwikEcomerceStatus $ ecomerceStatus ) { return $ this -> ecomerceStatus -> removeElement ( $ ecomerceStatus ) ; } | Remove ecomerceStatus . |
18,592 | public function addVisitPlugin ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisitPlugin $ visitPlugin ) { $ this -> visitPlugin [ ] = $ visitPlugin ; return $ this ; } | Add visitPlugin . |
18,593 | public function removeVisitPlugin ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisitPlugin $ visitPlugin ) { return $ this -> visitPlugin -> removeElement ( $ visitPlugin ) ; } | Remove visitPlugin . |
18,594 | public function addCurrency ( \ BlackForest \ PiwikBundle \ Entity \ PiwikCurrency $ currency ) { $ this -> currencies [ ] = $ currency ; return $ this ; } | Add currency . |
18,595 | public function removeCurrency ( \ BlackForest \ PiwikBundle \ Entity \ PiwikCurrency $ currency ) { return $ this -> currencies -> removeElement ( $ currency ) ; } | Remove currency . |
18,596 | public function removeAction ( \ BlackForest \ PiwikBundle \ Entity \ PiwikAction $ action ) { return $ this -> action -> removeElement ( $ action ) ; } | Remove action . |
18,597 | public function addActionType ( \ BlackForest \ PiwikBundle \ Entity \ PiwikActionType $ actionType ) { $ this -> actionType [ ] = $ actionType ; return $ this ; } | Add actionType . |
18,598 | public function removeActionType ( \ BlackForest \ PiwikBundle \ Entity \ PiwikActionType $ actionType ) { return $ this -> actionType -> removeElement ( $ actionType ) ; } | Remove actionType . |
18,599 | public function addPlugin ( \ BlackForest \ PiwikBundle \ Entity \ PiwikPlugin $ plugin ) { $ this -> plugin [ ] = $ plugin ; return $ this ; } | Add plugin . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.