idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
13,700 | public function addResource ( $ format , $ resource , $ locale , $ domain = null ) { if ( null !== $ domain ) { $ this -> domains [ ] = $ domain ; } parent :: addResource ( $ format , $ resource , $ locale , $ domain ) ; } | Adds a resource . |
13,701 | public function hasTrans ( $ id , $ domain = null , $ locale = null ) { if ( null === $ domain ) { $ domain = 'messages' ; } return $ this -> getCatalogue ( $ locale ) -> has ( $ id , $ domain ) ; } | Checks if a message has a translation . |
13,702 | protected function isValidTranslation ( $ val ) { if ( empty ( $ val ) && ! is_numeric ( $ val ) ) { return false ; } if ( is_string ( $ val ) ) { return ! empty ( trim ( $ val ) ) ; } if ( $ val instanceof Translation ) { return true ; } if ( is_array ( $ val ) ) { return ! ! array_filter ( $ val , function ( $ v , $ ... | Determine if the value is translatable . |
13,703 | public function resolvePaths ( Vertex $ start_vertex ) { $ this -> paths = [ ] ; foreach ( $ start_vertex -> incoming_edges as $ edge ) { $ this -> current_path = [ $ start_vertex -> get_data ( ) ] ; $ this -> getPathsRecursion ( $ edge -> get_source ( ) , $ edge ) ; } return $ this -> paths ; } | Resolve all paths that can be resolved from the start point . |
13,704 | protected function getPathsRecursion ( Vertex $ start , DirectedEdge $ edge ) { if ( in_array ( $ start -> get_data ( ) , $ this -> current_path ) ) { $ this -> paths [ ] = array_reverse ( $ this -> current_path ) ; return ; } $ this -> current_path [ ] = $ start -> get_data ( ) ; if ( $ start -> incoming_edges -> coun... | Recurse on all paths from the start point |
13,705 | public function collectRoutes ( ) { $ routes = [ ] ; foreach ( $ this -> getCollectors ( ) as $ collector ) { $ routes = array_merge ( $ routes , $ collector -> collectRoutes ( ) ) ; } return $ routes ; } | Aggregate routes and return an array of Route DTOs |
13,706 | public final function render ( OutputBuffer $ out , ViewModelInterface $ model , array $ params = [ ] ) { $ this -> context -> bind ( $ model ) ; $ this -> context -> set ( '@view' , $ this ) ; foreach ( $ params as $ k => $ v ) { $ this -> context -> set ( $ k , $ v ) ; } try { if ( $ this -> getParent ( ) === NULL ) ... | Bind to the given view model and render contents of the compiled view . |
13,707 | protected function renderMain ( OutputBuffer $ out ) { if ( $ this -> getParent ( ) === NULL ) { throw new \ RuntimeException ( 'Failed to render main part' ) ; } $ this -> parent -> renderMain ( $ out ) ; } | Render main content of the view . |
13,708 | public function renderBlock ( OutputBuffer $ out , $ name ) { $ method = 'block_' . $ name ; if ( method_exists ( $ this , $ method ) ) { $ this -> $ method ( $ out ) ; } elseif ( $ this -> getParent ( ) !== NULL ) { $ this -> parent -> renderBlock ( $ out , $ name ) ; } else { throw new \ RuntimeException ( sprintf ( ... | Render contents of a named block . |
13,709 | public function renderParentBlock ( OutputBuffer $ out , $ name ) { if ( $ this -> getParent ( ) === NULL ) { throw new \ RuntimeException ( 'Cannot render parent block because no template is inherited' ) ; } $ this -> parent -> renderBlock ( $ out , $ name ) ; } | Render a named block from the parent view . |
13,710 | public final function inherit ( ExpressContext $ context , ExpressionContextInterface $ exp ) { $ this -> context = $ context ; $ this -> exp = $ exp ; } | Inherit the given express context and bound expression context . |
13,711 | protected final function getParent ( ) { if ( $ this -> parent === false ) { if ( NULL === ( $ file = $ this -> getExtended ( ) ) ) { $ this -> parent = NULL ; } else { $ typeName = $ this -> factory -> createView ( $ this -> renderer , $ this -> resolveResource ( $ file ) ) ; $ this -> parent = new $ typeName ( $ this... | Get the parent view of this view or NULL if no parent view exists . |
13,712 | protected final function resolveResource ( $ file ) { if ( 0 === strpos ( $ file , './' ) || 0 === strpos ( $ file , '../' ) ) { $ file = rtrim ( dirname ( $ this -> getResource ( ) ) , '/\\' ) . '/' . $ file ; } elseif ( ! preg_match ( "'^/|(?:[^:]+://)|(?:[a-z]:[\\\\/])'i" , $ file ) ) { $ dir = rtrim ( dirname ( $ t... | Resolve a path considering the location of the view if a relative path is given . |
13,713 | public function cmdTruncateDatabase ( ) { $ all = $ this -> getParam ( 'all' ) ; $ tables = $ this -> getArguments ( ) ; if ( empty ( $ tables ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ confirm = null ; if ( ! empty ( $ tables ) ) { $ confirm = $ this -> choose ( $ th... | Callback for database - truncate command |
13,714 | public function cmdAddDatabase ( ) { $ table = $ this -> getParam ( 0 ) ; $ data = $ this -> getOptions ( ) ; if ( empty ( $ table ) || empty ( $ data ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ this -> line ( $ this -> db -> insert ( $ table , $ data ) ) ; $ this -> output ( ) ; } | Callback for database - add command |
13,715 | public function cmdDeleteDatabase ( ) { $ table = $ this -> getParam ( 0 ) ; $ conditions = $ this -> getOptions ( ) ; if ( empty ( $ table ) || empty ( $ conditions ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! $ this -> db -> delete ( $ table , $ conditions ) ) { $ this -> errorAndE... | Callback for database - delete command |
13,716 | public function cmdSqlDatabase ( ) { $ sql = $ this -> getParam ( 0 ) ; if ( empty ( $ sql ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = $ this -> db -> query ( $ sql ) ; if ( $ this -> getParam ( 'fetch' ) ) { $ result = $ result -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; $ this -> o... | Callback for database - sql command |
13,717 | protected function setDataSource ( $ dataSource ) { if ( is_array ( $ dataSource ) || $ dataSource instanceof \ Traversable ) { foreach ( $ dataSource as $ value ) { $ this -> internalDataListData [ ] = $ value ; } return ; } if ( is_callable ( $ dataSource ) ) { $ this -> internalDataListData = $ dataSource ; return ;... | Sets a new data source for the list . |
13,718 | public function get ( int $ index ) { $ this -> internalDataListUpdate ( ) ; if ( isset ( $ this -> internalDataListData [ $ index ] ) ) { return $ this -> internalDataListUpdateValueIfNeeded ( $ this -> internalDataListData , $ index ) ; } return null ; } | Returns the object at the index specified or null if not found . |
13,719 | public function getFirst ( ) { $ this -> internalDataListUpdate ( ) ; if ( isset ( $ this -> internalDataListData [ 0 ] ) ) { return $ this -> internalDataListUpdateValueIfNeeded ( $ this -> internalDataListData , 0 ) ; } return null ; } | Returns the first object or null if not found . |
13,720 | public function getLast ( ) { $ this -> internalDataListUpdate ( ) ; $ count = sizeof ( $ this -> internalDataListData ) ; if ( isset ( $ this -> internalDataListData [ $ count - 1 ] ) ) { return $ this -> internalDataListUpdateValueIfNeeded ( $ this -> internalDataListData , $ count - 1 ) ; } return null ; } | Returns the last object or null if not found . |
13,721 | public function getRandom ( ) { $ this -> internalDataListUpdate ( ) ; $ count = sizeof ( $ this -> internalDataListData ) ; if ( $ count > 0 ) { $ index = rand ( 0 , $ count - 1 ) ; if ( isset ( $ this -> internalDataListData [ $ index ] ) ) { return $ this -> internalDataListUpdateValueIfNeeded ( $ this -> internalDa... | Returns a random object from the list or null if the list is empty . |
13,722 | public function filterBy ( string $ property , $ value , string $ operator = 'equal' ) : self { if ( array_search ( $ operator , [ 'equal' , 'notEqual' , 'regExp' , 'notRegExp' , 'startWith' , 'notStartWith' , 'endWith' , 'notEndWith' , 'inArray' , 'notInArray' ] ) === false ) { throw new \ InvalidArgumentException ( '... | Filters the elements of the list by specific property value . |
13,723 | public function sortBy ( string $ property , string $ order = 'asc' ) : self { if ( $ order !== 'asc' && $ order !== 'desc' ) { throw new \ InvalidArgumentException ( 'The order argument \'asc\' or \'desc\'' ) ; } $ this -> internalDataListActions [ ] = [ 'sortBy' , $ property , $ order ] ; return $ this ; } | Sorts the elements of the list by specific property . |
13,724 | public function unshift ( $ object ) : self { $ this -> internalDataListUpdate ( ) ; array_unshift ( $ this -> internalDataListData , $ object ) ; return $ this ; } | Prepends an object to the beginning of the list . |
13,725 | public function shift ( ) { $ this -> internalDataListUpdate ( ) ; if ( isset ( $ this -> internalDataListData [ 0 ] ) ) { $ this -> internalDataListUpdateValueIfNeeded ( $ this -> internalDataListData , 0 ) ; return array_shift ( $ this -> internalDataListData ) ; } return null ; } | Shift an object off the beginning of the list . |
13,726 | public function push ( $ object ) : self { $ this -> internalDataListUpdate ( ) ; array_push ( $ this -> internalDataListData , $ object ) ; return $ this ; } | Pushes an object onto the end of the list . |
13,727 | public function pop ( ) { $ this -> internalDataListUpdate ( ) ; if ( isset ( $ this -> internalDataListData [ 0 ] ) ) { $ this -> internalDataListUpdateValueIfNeeded ( $ this -> internalDataListData , sizeof ( $ this -> internalDataListData ) - 1 ) ; return array_pop ( $ this -> internalDataListData ) ; } return null ... | Pops an object off the end of the list . |
13,728 | public function concat ( $ list ) : self { $ this -> internalDataListUpdate ( ) ; foreach ( $ list as $ object ) { array_push ( $ this -> internalDataListData , $ object ) ; } return $ this ; } | Appends the items of the list provided to the current list . |
13,729 | public function slice ( int $ offset , int $ length = null ) { $ actions = $ this -> internalDataListActions ; $ actions [ ] = [ 'slice' , $ offset , $ length ] ; $ data = $ this -> internalDataListUpdateData ( $ this -> internalDataListData , $ actions ) ; $ slice = array_slice ( $ data , $ offset , $ length ) ; $ cla... | Extract a slice of the list . |
13,730 | public function sliceProperties ( array $ properties ) { $ actions = $ this -> internalDataListActions ; $ actions [ ] = [ 'sliceProperties' , $ properties ] ; $ data = $ this -> internalDataListUpdateData ( $ this -> internalDataListData , $ actions ) ; $ className = get_class ( $ this ) ; $ list = new $ className ( )... | Returns a new list of object that contain only the specified properties of the objects in the current list . |
13,731 | private function internalDataListUpdateValueIfNeeded ( & $ data , $ index ) { $ value = $ data [ $ index ] ; if ( is_callable ( $ value ) ) { $ value = call_user_func ( $ value ) ; $ data [ $ index ] = $ value ; } if ( is_object ( $ value ) ) { return $ value ; } $ value = ( object ) $ value ; $ data [ $ index ] = $ va... | Converts the value into object if needed . |
13,732 | private function internalDataListUpdateAllValuesIfNeeded ( & $ data ) { foreach ( $ data as $ index => $ value ) { $ this -> internalDataListUpdateValueIfNeeded ( $ data , $ index ) ; } } | Converts all values into objects if needed . |
13,733 | private function internalDataListUpdate ( ) { $ this -> internalDataListData = $ this -> internalDataListUpdateData ( $ this -> internalDataListData , $ this -> internalDataListActions ) ; $ this -> internalDataListActions = [ ] ; } | Applies the pending actions to the data list . |
13,734 | public function encode ( ) { return $ this -> header -> encode ( ) . $ this -> getContent ( ) . \ str_repeat ( "\0" , $ this -> header -> getPaddingLength ( ) ) ; } | Compiles record into struct to send . |
13,735 | public static function throwMultiError ( $ code ) { $ buffer = function_exists ( 'curl_multi_strerror' ) ? curl_multi_strerror ( $ code ) : self :: ERROR_STR ; throw new AdapterException ( sprintf ( 'cURL error %s: %s' , $ code , $ buffer ) ) ; } | Throw an exception for a cURL multi response |
13,736 | private function checkoutMultiHandle ( ) { $ key = array_search ( false , $ this -> multiOwned , true ) ; if ( false !== $ key ) { $ this -> multiOwned [ $ key ] = true ; return $ this -> multiHandles [ $ key ] ; } $ handle = curl_multi_init ( ) ; $ id = ( int ) $ handle ; $ this -> multiHandles [ $ id ] = $ handle ; $... | Returns a curl_multi handle from the cache or creates a new one |
13,737 | private function releaseMultiHandle ( $ handle , $ maxHandles ) { $ id = ( int ) $ handle ; if ( count ( $ this -> multiHandles ) <= $ maxHandles ) { $ this -> multiOwned [ $ id ] = false ; } elseif ( isset ( $ this -> multiHandles [ $ id ] , $ this -> multiOwned [ $ id ] ) ) { curl_multi_close ( $ this -> multiHandles... | Releases a curl_multi handle back into the cache and removes excess cache |
13,738 | public function read ( $ param ) { if ( $ param instanceof File ) return $ this -> readFile ( $ param -> getFullPath ( ) ) ; if ( is_resource ( $ param ) ) return $ this -> readFileHandle ( $ param ) ; if ( ! is_string ( $ param ) ) throw new \ InvalidArgumentException ( "Cannot read argument: " . WF :: str ( $ param )... | Read provided data . The method auto - detects if it is a file a resource or a string that contains the formatted data . |
13,739 | public function readFile ( string $ file_name ) { $ contents = @ file_get_contents ( $ file_name ) ; if ( $ contents === false ) throw new IOException ( "Failed to read file contents" ) ; $ contents = Encoding :: removeBOM ( $ contents ) ; return $ this -> readString ( file_get_contents ( $ file_name ) ) ; } | Read data from a file |
13,740 | public function readFileHandle ( $ file_handle ) { if ( ! is_resource ( $ file_handle ) ) throw new \ InvalidArgumentException ( "No file handle was provided" ) ; $ contents = stream_get_contents ( $ file_handle ) ; $ contents = Encoding :: removeBOM ( $ contents ) ; return $ this -> readString ( $ contents ) ; } | Read from a file handle to an open file or resource |
13,741 | public function hasColumn ( $ columnKey ) : bool { $ this -> validateColumnKey ( __METHOD__ , $ columnKey ) ; $ this -> loadColumns ( ) ; $ columnHash = ValueHasher :: hash ( $ columnKey ) ; return isset ( $ this -> columns [ $ columnHash ] ) ; } | Returns whether the table data contains a column with the supplied key . |
13,742 | public function getColumn ( $ columnKey ) : TableDataColumn { $ this -> validateColumnKey ( __METHOD__ , $ columnKey ) ; $ this -> loadColumns ( ) ; $ columnHash = ValueHasher :: hash ( $ columnKey ) ; if ( ! isset ( $ this -> columns [ $ columnHash ] ) ) { throw InvalidArgumentException :: format ( 'Invalid column key... | Gets the table column with the supplied key . |
13,743 | public function hasRow ( $ rowKey ) : bool { $ this -> validateRowKey ( __METHOD__ , $ rowKey ) ; $ this -> loadRows ( ) ; $ rowHash = ValueHasher :: hash ( $ rowKey ) ; return isset ( $ this -> rows [ $ rowHash ] ) ; } | Returns whether the table data contains a row with the supplied key . |
13,744 | public function getRow ( $ rowKey ) : TableDataRow { $ this -> validateRowKey ( __METHOD__ , $ rowKey ) ; $ this -> loadRows ( ) ; $ rowHash = ValueHasher :: hash ( $ rowKey ) ; if ( ! isset ( $ this -> rows [ $ rowHash ] ) ) { throw InvalidArgumentException :: format ( 'Invalid row key supplied to %s: expecting one of... | Gets the table row with the supplied key . |
13,745 | public function hasCell ( $ columnKey , $ rowKey ) : bool { $ this -> validateColumnKey ( __METHOD__ , $ columnKey ) ; $ this -> validateRowKey ( __METHOD__ , $ rowKey ) ; $ this -> loadColumns ( ) ; $ this -> loadRows ( ) ; $ columnHash = ValueHasher :: hash ( $ columnKey ) ; if ( ! isset ( $ this -> columns [ $ colum... | Returns whether their is a cell value at the supplied row and column . |
13,746 | public function getCell ( $ columnKey , $ rowKey ) { $ column = $ this -> getColumn ( $ columnKey ) ; $ row = $ this -> getRow ( $ rowKey ) ; return $ row [ $ column ] ; } | Gets the value of the cell or NULL if the cell does not exist . |
13,747 | protected function _getAllMatchesRegex ( $ pattern , $ subject ) { $ matches = [ ] ; $ pattern = $ this -> _normalizeString ( $ pattern ) ; $ subject = $ this -> _normalizeString ( $ subject ) ; try { $ result = @ preg_match_all ( $ pattern , $ subject , $ matches ) ; } catch ( RootException $ e ) { throw $ this -> _cr... | Retrieves all matches that correspond to a RegEx pattern from a string . |
13,748 | public function searchEvents ( Production $ production , \ DateTime $ from , \ DateTime $ to , bool $ active = true ) { $ qb = $ this -> createQueryBuilder ( 'e' ) ; return $ qb -> join ( 'e.groups' , 'g' ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'g' , ':group' ) ) -> andWhere ( $ qb -> expr ( ) -> between ( 'e.start' ,... | Search for events within a production . |
13,749 | public function searchEventsByUser ( UserInterface $ user , \ DateTime $ from , \ DateTime $ to , bool $ active = true ) { $ qb = $ this -> createQueryBuilder ( 'e' ) ; return $ qb -> join ( 'e.invitations' , 'i' ) -> andWhere ( $ qb -> expr ( ) -> between ( 'e.start' , ':from' , ':to' ) ) -> andWhere ( $ qb -> expr ( ... | Search for events for a user . |
13,750 | public function findArchivedEventsQuery ( Production $ production ) { $ qb = $ this -> createQueryBuilder ( 'e' ) ; return $ qb -> join ( 'e.groups' , 'g' ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'g' , ':production' ) ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'e.active' , ':active' ) ) -> andWhere ( $ qb -> expr ( ) -> ... | Helper function to search for events that are not active . |
13,751 | public function getValueType ( ) { if ( $ this -> Cardinality == XmlTypeCardinality :: ZeroOrMore || $ this -> Cardinality == XmlTypeCardinality :: OneOrMore ) return "\lyquidity\XPath2\XPath2NodeIterator" ; if ( $ this -> IsNode ) return "\lyquidity\xml\xpath\XPathNavigator" ; if ( $ this -> Cardinality == XmlTypeCard... | Get the type of the value |
13,752 | public function getAtomizedValueType ( ) { if ( $ this -> IsNode ) { switch ( $ this -> TypeCode ) { case XmlTypeCode :: Text : case XmlTypeCode :: ProcessingInstruction : case XmlTypeCode :: Comment : case XmlTypeCode :: UntypedAtomic : return Types :: $ UntypedAtomicType ; default : if ( ! is_null ( $ this -> SchemaT... | Get the type of the atomized value |
13,753 | public function getIsNumeric ( ) { switch ( $ this -> TypeCode ) { case XmlTypeCode :: Decimal : case XmlTypeCode :: Float : case XmlTypeCode :: Double : case XmlTypeCode :: Integer : case XmlTypeCode :: NonPositiveInteger : case XmlTypeCode :: NegativeInteger : case XmlTypeCode :: Long : case XmlTypeCode :: Int : case... | Returns true if the value is numeric |
13,754 | public function deleting ( $ model ) { foreach ( $ this -> relations as $ relation ) { if ( $ model -> { $ relation } ( ) -> count ( ) > 0 ) { return false ; } } } | Post delete check if a user has any relevant relations if so we cancel the deletion and ask the user to manually remove all relations for now . |
13,755 | public function execute ( ) { $ registered = false ; if ( self :: $ interceptor_stack === null ) { $ registered = true ; self :: registerErrorHandler ( ) ; } array_push ( self :: $ interceptor_stack , $ this ) ; $ response = null ; try { $ response = call_user_func_array ( $ this -> func , func_get_args ( ) ) ; } final... | Execute the configured callback |
13,756 | protected function intercept ( $ errno , $ errstr , $ errfile , $ errline , $ errcontext ) { foreach ( $ this -> expected as $ warning ) { if ( $ errno & $ warning [ 0 ] && strpos ( $ errstr , $ warning [ 1 ] ) !== false ) { $ this -> intercepted [ ] = new \ ErrorException ( $ errstr , 0 , $ errno , $ errfile , $ errli... | Check if the produced error should be intercepted by the interceptor based on the defined expected errors . |
13,757 | public static function errorHandler ( $ errno , $ errstr , $ errfile , $ errline , $ errcontext ) { if ( count ( self :: $ interceptor_stack ) > 0 ) { $ interceptor = end ( self :: $ interceptor_stack ) ; if ( $ interceptor -> intercept ( $ errno , $ errstr , $ errfile , $ errline , $ errcontext ) ) { return ; } } thro... | Catch all PHP errors notices and throw them as an exception instead . If an interceptor was registered the message is passed to the interceptor instead . |
13,758 | public function assign ( $ userId , $ name ) { if ( $ this -> searchRoleRecursive ( $ this -> roles , $ name ) ) { $ exists = $ this -> db -> exists ( 'rbac_user' , [ 'user' => $ userId , 'role' => $ name ] ) ; if ( ! $ exists ) { return $ this -> db -> insert ( 'rbac_user' , [ 'role' => $ name , 'user' => $ userId ] )... | Assign RBAC element into user |
13,759 | public function getParameter ( $ key ) { if ( array_key_exists ( $ key , $ this -> parameters ) ) return $ this -> parameters [ $ key ] ; else return null ; } | Get the parameter matching the passed key or null if non existent |
13,760 | public function getConfigFileText ( ) { $ configFileText = "" ; foreach ( $ this -> parameters as $ key => $ value ) { $ configFileText .= $ key . "=" . $ value . "\n" ; } return $ configFileText ; } | Return the actual text which would be written out by the save method . This is particularly useful in situations like the PropertiesResource where the output needs to be injected into a resource . |
13,761 | public function save ( $ filePath = null ) { $ filePath = ( $ filePath == null ) ? $ this -> configFilePath : $ filePath ; file_put_contents ( $ filePath , $ this -> getConfigFileText ( ) ) ; } | Save the config file back out . If null supplied for filepath the constructed configFilePath is used |
13,762 | private function parseFile ( $ configFilePath ) { $ configFileText = file_get_contents ( $ configFilePath ) ; $ lines = explode ( "\n" , $ configFileText ) ; foreach ( $ lines as $ line ) { $ splitComment = explode ( "#" , $ line ) ; $ propertyLine = trim ( $ splitComment [ 0 ] ) ; if ( strlen ( $ propertyLine ) > 0 ) ... | Parse function . Splits the config file into lines and then looks for key value pairs of the form key = value |
13,763 | public function doTwoFactorAuthLogin ( $ userId ) { $ codeToInput = $ this -> getCodeToInput ( ) ; $ this -> updateUserRecordWithTwoFactorAuthCode ( $ codeToInput , $ userId ) ; $ message = config ( 'lasallecmsfrontend.site_name' ) ; $ message .= ". Your two factor authorization login code is " ; $ message .= $ codeToI... | Two Factor Authorization for the front - end LOGIN |
13,764 | public function doTwoFactorAuthRegistration ( $ data ) { $ codeToInput = $ this -> getCodeToInput ( ) ; $ this -> request -> session ( ) -> put ( 'codeToInput' , $ codeToInput ) ; $ message = config ( 'lasallecmsfrontend.site_name' ) ; $ message .= ". Your two factor authorization login code is " ; $ message .= $ codeT... | Two Factor Authorization for the front - end REGISTRATION |
13,765 | public function isTwoFactorAuthFormTimeout ( $ userId = null , $ startTime = null ) { if ( isset ( $ userId ) ) { $ startTime = strtotime ( $ this -> getUserSmsTokenCreatedAt ( $ userId ) ) ; } else { $ startTime = strtotime ( $ startTime ) ; } $ now = strtotime ( Carbon :: now ( ) ) ; $ timeDiff = ( $ now - $ startTim... | Has too much time passed between issuing the 2FA code and this code being entered into the verification form? |
13,766 | public function isInputtedTwoFactorAuthCodeCorrect ( $ userId = null ) { $ inputted2faCode = $ this -> request -> input ( '2facode' ) ; if ( isset ( $ userId ) ) { $ sent2faCode = $ this -> getUserSmsToken ( $ userId ) ; } else { $ sent2faCode = $ this -> request -> session ( ) -> get ( 'codeToInput' ) ; } if ( $ input... | Did the user input the correct 2FA code? |
13,767 | public function isUserTwoFactorAuthEnabled ( $ userId ) { $ result = DB :: table ( 'users' ) -> where ( 'id' , '=' , $ userId ) -> value ( 'two_factor_auth_enabled' ) ; if ( $ result ) { return true ; } return false ; } | Is user enabled for Two Factor Authorization |
13,768 | public function existstUserCountryCodeAndPhoneNumber ( $ userId ) { $ countryCode = DB :: table ( 'users' ) -> where ( 'id' , '=' , $ userId ) -> value ( 'phone_country_code' ) ; $ phoneNumber = DB :: table ( 'users' ) -> where ( 'id' , '=' , $ userId ) -> value ( 'phone_number' ) ; if ( ( ! $ countryCode ) || ( ! $ ph... | Does the user have a country code and phone number for 2FA? |
13,769 | public function updateUserRecordWithTwoFactorAuthCode ( $ codeToInput , $ userId ) { $ now = Carbon :: now ( ) ; DB :: table ( 'users' ) -> where ( 'id' , $ userId ) -> update ( [ 'sms_token' => $ codeToInput , 'sms_token_created_at' => $ now ] ) ; } | UPDATE the user record for fields sms_token and sms_token_created_at |
13,770 | public function updateUserRecordWithLastlogin ( $ userId ) { $ now = Carbon :: now ( ) ; $ ip = $ this -> request -> getClientIp ( ) ; DB :: table ( 'users' ) -> where ( 'id' , $ userId ) -> update ( [ 'last_login' => $ now , 'last_login_ip' => $ ip ] ) ; } | UPDATE the user record for fields last_login and last_login_ip |
13,771 | public function redirectPathUponSuccessfulFrontendLogin ( ) { if ( property_exists ( $ this , 'redirectPath' ) ) { return $ this -> redirectPath ; } if ( property_exists ( $ this , 'redirectPath' ) ) { return $ this -> redirectTo ; } if ( config ( 'lasasllecmsfrontend.frontend_redirect_to_this_view_when_user_successful... | Upon successful front - end login redirect to this path |
13,772 | public function apply ( $ value , $ type = self :: TYPE_STRING , array $ filters = array ( ) , $ title = null , $ required = true ) { $ result = $ this -> validate ( $ value , $ type , $ filters , $ title , $ required ) ; if ( $ result -> hasError ( ) ) { throw new ValidationException ( $ result -> getFirstError ( ) , ... | Applies filter on the given value and returns the value on success or throws an exception if an error occured |
13,773 | public function clear ( $ key = null ) { if ( $ key === null ) $ this -> counts -> clear ( ) ; else $ this -> counts -> remove ( $ key ) ; } | Clears the given key or the entire counter if the key is not given . |
13,774 | public function add ( $ key , $ amount ) { if ( ! $ this -> allowed ( $ key ) ) throw new OutOfBoundsException ( sprintf ( '"%s" is not an allowed key in strict mode' , $ key ) ) ; else if ( ! $ this -> has ( $ key ) ) $ this -> counts -> put ( $ key , 0 ) ; $ this -> counts -> put ( $ key , $ this -> counts -> get ( $... | Adds the given amount to a key . If the key does not exist and the counter is not running in strict mode it will be initialized to zero . |
13,775 | public function uris ( ) { $ uri = ( string ) $ this -> uri ; $ exists = isset ( $ this -> data [ 'permalink' ] ) ; $ exists && $ uri = $ this -> data [ 'permalink' ] ; $ items = explode ( '/' , ( string ) $ uri ) ; $ items = array_filter ( ( array ) $ items ) ; return ( array ) array_values ( $ items ) ; } | Returns an array of URI segments . |
13,776 | public function layout ( ) { $ exists = ( boolean ) isset ( $ this -> data [ 'layout' ] ) ; return $ exists ? $ this -> data [ 'layout' ] : null ; } | Returns the layout of the page . |
13,777 | public function getPaginator ( $ params = array ( ) ) { $ page = isset ( $ params [ 'page' ] ) ? ( int ) $ params [ 'page' ] : 1 ; $ email = isset ( $ params [ 'email' ] ) ? $ params [ 'email' ] : null ; $ limit = isset ( $ params [ 'limit' ] ) ? ( int ) $ params [ 'limit' ] : 10 ; $ offset = isset ( $ params [ 'offset... | Return the paginator |
13,778 | public function authenticate ( $ request = [ ] ) { if ( $ request ) { $ this -> email = clean ( $ request [ 'email' ] ) ; $ this -> password = $ this -> getPasswordHelper ( ) -> hash ( clean ( $ request [ 'password' ] ) ) ; } else { $ this -> password = $ this -> getPasswordHelper ( ) -> hash ( clean ( $ this -> passwo... | Authenticate user from request |
13,779 | public function run ( $ parameters = array ( ) ) { $ this -> pid = \ pcntl_fork ( ) ; if ( ! $ this -> pid ) { $ this -> process ( $ parameters ) ; posix_kill ( getmypid ( ) , 9 ) ; } return $ this -> pid ; } | Main run method called to start the thread . |
13,780 | public function wait ( ) { if ( $ this -> pid ) { \ pcntl_waitpid ( $ this -> pid , $ status , WUNTRACED ) ; return $ status ; } else { return false ; } } | Blocking method called by another thread which waits until this thread has completed . |
13,781 | public function getStatus ( ) { if ( $ this -> pid ) { $ waitPID = \ pcntl_waitpid ( $ this -> pid , $ status , WNOHANG ) ; if ( $ waitPID == $ this -> pid ) { return Thread :: THREAD_EXITED ; } else { return Thread :: THREAD_RUNNING ; } } } | Get the current status for this thread . |
13,782 | public function load ( $ path = self :: DEFAULT_FILENAME ) { $ file = new File ( $ path ) ; if ( ( $ data = json_decode ( $ file -> read ( ) , true ) ) === null ) { throw new \ UnexpectedValueException ( 'Invalid JSON.' ) ; } $ this -> data = ( array ) $ data ; return $ this ; } | Load the settings file from the given location . |
13,783 | public function save ( $ path = self :: DEFAULT_FILENAME ) { $ file = new File ( $ path ) ; $ file -> write ( json_encode ( $ this -> data ) ) ; return $ this ; } | Save the settings file at the given location . |
13,784 | private function get_blog_routes ( ) { $ data = [ ] ; $ blog_url = false ; $ home_url = home_url ( ) ; $ page_on_front = get_option ( 'page_on_front' ) ; $ blog_page = get_option ( 'page_for_posts' ) ; if ( ! $ page_on_front ) { $ blog_url = '/' ; } elseif ( $ blog_page ) { $ blog_url = rtrim ( str_replace ( $ home_url... | Create routes for the blog page and single posts if active .. |
13,785 | protected function GroupsFormUrl ( User $ user ) { $ args = array ( 'user' => $ user -> GetID ( ) ) ; return BackendRouter :: ModuleUrl ( new UsergroupAssignmentForm ( ) , $ args ) ; } | The url to the form for the user groups |
13,786 | protected function RemovalObject ( ) { $ id = Request :: PostData ( 'delete' ) ; return $ id ? User :: Schema ( ) -> ByID ( $ id ) : null ; } | Gets the site for removal if delete id is posted |
13,787 | protected function CanEdit ( User $ user ) { return self :: Guard ( ) -> Allow ( BackendAction :: Edit ( ) , $ user ) && self :: Guard ( ) -> Allow ( BackendAction :: UseIt ( ) , new UserForm ( ) ) ; } | True if user can be edited |
13,788 | private function transformToText ( $ data , $ hypertextRoutes = [ ] , $ depth = 0 ) { if ( ! is_array ( $ data ) ) { return "{$data}\n{$this->getHypertextString($hypertextRoutes)}" ; } $ str = '' ; foreach ( $ data as $ k => $ v ) { for ( $ i = 0 ; $ i < $ depth ; $ i ++ ) { $ str .= "\t" ; } if ( is_array ( $ v ) ) { ... | Recursively converts the response into a text string . |
13,789 | private function getHypertextString ( $ routes = [ ] ) { if ( ! $ routes ) { return '' ; } $ str = "links: \n" ; foreach ( $ routes as $ name => $ route ) { $ str .= "\trel: {$name}. href: {$route}.\n" ; } return $ str ; } | Transforms the hypertext routes into a string . |
13,790 | public function processQueue ( callable $ callback = null ) { $ queued = $ this -> loadQueueItems ( ) ; if ( ! is_callable ( $ callback ) ) { $ callback = $ this -> processedCallback ; } $ success = [ ] ; $ failures = [ ] ; $ skipped = [ ] ; foreach ( $ queued as $ q ) { try { $ res = $ q -> process ( $ this -> itemCal... | Process the items of the queue . |
13,791 | public function loadQueueItems ( ) { $ loader = new CollectionLoader ( [ 'logger' => $ this -> logger , 'factory' => $ this -> queueItemFactory ( ) , ] ) ; $ loader -> setModel ( $ this -> queueItemProto ( ) ) ; $ loader -> addFilter ( [ 'property' => 'processed' , 'value' => 0 , ] ) ; $ loader -> addFilter ( [ 'proper... | Retrieve the items of the current queue . |
13,792 | public function setEmail ( $ email ) { if ( ! is_string ( $ email ) ) { $ email = strval ( $ email ) ; } $ this -> email = $ email ; } | Sets the email address . |
13,793 | public function setTelno ( $ telno ) { if ( ! is_string ( $ telno ) ) { $ telno = strval ( $ telno ) ; } $ this -> telno = $ telno ; } | Sets the phone number . |
13,794 | public function setCellno ( $ cellno ) { if ( ! is_string ( $ cellno ) ) { $ cellno = strval ( $ cellno ) ; } $ this -> cellno = $ cellno ; } | Sets the cellphone number . |
13,795 | public function setFirstName ( $ fname ) { if ( ! is_string ( $ fname ) ) { $ fname = strval ( $ fname ) ; } $ this -> fname = $ fname ; } | Sets the first name . |
13,796 | public function setLastName ( $ lname ) { if ( ! is_string ( $ lname ) ) { $ lname = strval ( $ lname ) ; } $ this -> lname = $ lname ; } | Sets the last name . |
13,797 | public function setStreet ( $ street ) { if ( ! is_string ( $ street ) ) { $ street = strval ( $ street ) ; } $ this -> street = $ street ; } | Sets the street address . |
13,798 | public function setZipCode ( $ zip ) { if ( ! is_string ( $ zip ) ) { $ zip = strval ( $ zip ) ; } $ zip = str_replace ( ' ' , '' , $ zip ) ; $ this -> zip = $ zip ; } | Sets the zip code . |
13,799 | public function setCity ( $ city ) { if ( ! is_string ( $ city ) ) { $ city = strval ( $ city ) ; } $ this -> city = $ city ; } | Sets the city . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.