idx
int64 0
60.3k
| question
stringlengths 64
4.24k
| target
stringlengths 5
618
|
|---|---|---|
4,100
|
public function filterByClientAddress ( $ clientAddress = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ clientAddress ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ clientAddress ) ) { $ clientAddress = str_replace ( '*' , '%' , $ clientAddress ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( LoginLogTableMap :: COL_CLIENT_ADDRESS , $ clientAddress , $ comparison ) ; }
|
Filter the query on the client_address column
|
4,101
|
public function filterByClientIp ( $ clientIp = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ clientIp ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ clientIp ) ) { $ clientIp = str_replace ( '*' , '%' , $ clientIp ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( LoginLogTableMap :: COL_CLIENT_IP , $ clientIp , $ comparison ) ; }
|
Filter the query on the client_ip column
|
4,102
|
function with ( $ meta , $ operator = null , $ value = null ) { list ( $ value , $ operator ) = $ this -> prepareValueAndOperator ( $ value , $ operator , func_num_args ( ) == 2 ) ; static $ count ; if ( empty ( $ count ) ) { $ count = 0 ; } if ( ! is_array ( $ meta ) ) { $ meta = [ $ meta => $ value ] ; } foreach ( $ meta as $ key => $ value ) { $ alias = '_with_condition_' . ( ++ $ count ) ; $ this -> query -> join ( "postmeta as {$alias}" , "{$alias}.post_id" , '=' , 'ID' ) ; $ this -> query -> where ( "{$alias}.meta_key" , '_' . $ key ) ; $ this -> query -> where ( "{$alias}.meta_value" , $ operator , $ value ) ; } return $ this ; }
|
Add one or more meta data conditions to the query .
|
4,103
|
public function do_magic_tag ( $ content ) { preg_match_all ( "/\{(.+?)\}/" , ( string ) $ content , $ magics ) ; if ( ! empty ( $ magics [ 1 ] ) ) { foreach ( $ magics [ 1 ] as $ magic_key => $ magic_tag ) { $ params = explode ( ':' , $ magic_tag , 2 ) ; if ( empty ( $ params [ 1 ] ) ) { continue ; } $ filter_value = apply_filters ( 'caldera_magic_tag' , apply_filters ( "caldera_magic_tag-{$params[0]}" , $ params [ 1 ] ) , $ magics [ 0 ] [ $ magic_key ] ) ; if ( $ filter_value !== $ params [ 1 ] ) { $ content = str_replace ( $ magics [ 0 ] [ $ magic_key ] , $ filter_value , $ content ) ; } } } return $ content ; }
|
Renders a magic tag
|
4,104
|
private function get_post_value ( $ field , $ in_params , $ post ) { if ( ! is_object ( $ post ) ) { return $ in_params ; } if ( 'permalink' == $ field || 'post_permalink' == $ field ) { return esc_url ( get_permalink ( $ post -> ID ) ) ; } if ( 'post_excerpt' == $ field && '' == $ post -> post_excerpt ) { if ( 0 < strpos ( $ post -> post_content , '<!--more ) ) { $ excerpt = substr ( $ post -> post_content , 0 , strpos ( $ post -> post_content , '<!--more ) ) ; } else { $ excerpt_length = apply_filters ( 'excerpt_length' , 55 ) ; $ excerpt = wp_trim_words ( $ post -> post_content , $ excerpt_length , '' ) ; } return $ excerpt ; } $ maybe_thumbnail = $ this -> maybe_do_post_thumbnail ( $ field , $ post ) ; if ( filter_var ( $ maybe_thumbnail , FILTER_VALIDATE_URL ) ) { return $ maybe_thumbnail ; } if ( isset ( $ post -> { $ field } ) ) { return implode ( ', ' , ( array ) $ post -> { $ field } ) ; } return $ in_params ; }
|
Gets a posts meta value
|
4,105
|
function buildConfig ( Plugin $ plugin ) { if ( ! empty ( $ this -> fields ) ) { $ this -> config [ 'fields' ] = [ ] ; foreach ( $ this -> fields as $ field ) { $ this -> config [ 'fields' ] [ ] = $ field -> buildConfig ( $ plugin ) ; } } if ( ! is_null ( $ this -> id ) ) { $ this -> config [ 'id' ] = $ this -> id ; } return $ this -> config ; }
|
Build field group config
|
4,106
|
protected static function handleGET ( $ parameters , $ modelClass , $ primaryDataParameters = [ ] , $ relationshipParameters = [ ] ) { $ page = $ modelClass :: parsePage ( $ parameters ) ; $ filter = $ modelClass :: parseFilter ( $ parameters ) ; $ sort = $ modelClass :: parseSort ( $ parameters ) ; $ fields = $ modelClass :: parseFields ( $ parameters ) ; $ requestInclude = static :: getRequestInclude ( $ parameters , $ modelClass ) ; $ data = $ modelClass :: get ( $ page , $ filter , $ sort , $ fields , ... $ primaryDataParameters ) ; $ includedData = $ modelClass :: getIncludedData ( $ data , $ requestInclude , $ fields , $ relationshipParameters ) ; $ meta = ( object ) [ 'page' => ( $ page === null ? $ modelClass :: getDefaultPage ( ) : $ page ) ] ; return static :: viewData ( $ data , ( object ) [ 'self' => $ modelClass :: getSelfLink ( ) ] , $ meta , ( empty ( $ requestInclude ) ? null : $ includedData ) ) ; }
|
handles GET requests
|
4,107
|
public function setColumnFormat ( $ attr , $ format = null ) { $ formats = is_array ( $ attr ) ? $ attr : [ $ attr => $ format ] ; foreach ( $ formats as $ a => $ f ) $ this -> _setSingleColumnFormat ( $ a , $ f ) ; return $ this ; }
|
Sets the Column cell format rules .
|
4,108
|
public function authCredentials ( string $ username , string $ password ) : self { $ this -> username = $ username ; $ this -> password = $ password ; return $ this ; }
|
Set auth . credentials for AUTH LOGIN
|
4,109
|
private function connect ( ) { if ( ! $ this -> stream ) { $ errorNum = 0 ; $ errorMsg = "" ; $ context = @ stream_context_create ( $ this -> streamOptions ) ; $ this -> stream = @ stream_socket_client ( sprintf ( '%1$s:%2$d' , $ this -> host , $ this -> port ) , $ errorNum , $ errorMsg , $ this -> timeOut , STREAM_CLIENT_CONNECT , $ context ) ; if ( ! $ this -> stream ) { throw SMTPException :: connectionError ( $ errorNum , $ errorMsg ) ; } $ this -> read ( ) ; if ( $ this -> lastResponseCode ( ) !== 220 ) { throw SMTPException :: unexpectedResponse ( "CONNECT" , 220 , $ this -> lastResponseCode ( ) ) ; } $ this -> smtpServerOptions ( $ this -> command ( "EHLO" , $ this -> serverName ) ) ; if ( $ this -> secure === true ) { if ( $ this -> options [ "startTLS" ] !== true ) { throw SMTPException :: tlsNotAvailable ( ) ; } $ this -> command ( "STARTTLS" , null , 220 ) ; $ tls = @ stream_socket_enable_crypto ( $ this -> stream , true , STREAM_CRYPTO_METHOD_TLS_CLIENT ) ; if ( ! $ tls ) { throw SMTPException :: tlsNegotiateFailed ( ) ; } $ this -> command ( "EHLO" , $ this -> serverName ) ; } if ( $ this -> options [ "authLogin" ] === true ) { try { $ this -> command ( "AUTH LOGIN" , null , 334 ) ; $ this -> command ( base64_encode ( $ this -> username ?? " " ) , null , 334 ) ; $ this -> command ( base64_encode ( $ this -> password ?? " " ) , null , 235 ) ; } catch ( SMTPException $ e ) { throw SMTPException :: authFailed ( $ this -> lastResponse ) ; } } elseif ( $ this -> options [ "authPlain" ] === true ) { throw SMTPException :: authUnavailable ( ) ; } else { throw SMTPException :: authUnavailable ( ) ; } } else { try { if ( ! stream_get_meta_data ( $ this -> stream ) [ "timed_out" ] ) { throw new SMTPException ( __METHOD__ , "Timed out" ) ; } $ this -> command ( "NOOP" , null , 250 ) ; } catch ( SMTPException $ e ) { $ this -> stream = null ; $ this -> connect ( ) ; return ; } } }
|
Establish connection to SMTP server or revive existing one
|
4,110
|
public function command ( string $ command , string $ args = null , int $ expect = 0 ) : string { $ sendCommand = $ args ? sprintf ( '%1$s %2$s' , $ command , $ args ) : $ command ; $ this -> write ( $ sendCommand ) ; $ response = $ this -> read ( ) ; $ responseCode = $ this -> lastResponseCode ( ) ; if ( $ expect > 0 ) { if ( $ responseCode !== $ expect ) { throw SMTPException :: unexpectedResponse ( $ command , $ expect , $ responseCode ) ; } } return $ response ; }
|
Send command to server read response and make sure response code matches expected code
|
4,111
|
private function read ( ) : string { $ this -> lastResponse = fread ( $ this -> stream , 1024 ) ; $ this -> lastResponseCode = intval ( explode ( " " , $ this -> lastResponse ) [ 0 ] ) ; $ this -> lastResponseCode = $ this -> lastResponseCode > 0 ? $ this -> lastResponseCode : - 1 ; return $ this -> lastResponse ; }
|
Read response from SMTP server
|
4,112
|
private function executePreInterceptor ( $ preInterceptor , Request $ request , Response $ response ) { if ( is_callable ( $ preInterceptor ) ) { return $ preInterceptor ( $ request , $ response ) ; } if ( $ preInterceptor instanceof PreInterceptor ) { return $ preInterceptor -> preProcess ( $ request , $ response ) ; } $ instance = $ this -> injector -> getInstance ( $ preInterceptor ) ; if ( ! ( $ instance instanceof PreInterceptor ) ) { $ response -> write ( $ response -> internalServerError ( 'Configured pre interceptor ' . $ preInterceptor . ' is not an instance of ' . PreInterceptor :: class ) ) ; return false ; } return $ instance -> preProcess ( $ request , $ response ) ; }
|
executes pre interceptor
|
4,113
|
private function executePostInterceptor ( $ postInterceptor , Request $ request , Response $ response ) { if ( is_callable ( $ postInterceptor ) ) { return $ postInterceptor ( $ request , $ response ) ; } if ( $ postInterceptor instanceof PostInterceptor ) { return $ postInterceptor -> postProcess ( $ request , $ response ) ; } $ instance = $ this -> injector -> getInstance ( $ postInterceptor ) ; if ( ! ( $ instance instanceof PostInterceptor ) ) { $ response -> write ( $ response -> internalServerError ( 'Configured post interceptor ' . $ postInterceptor . ' is not an instance of ' . PostInterceptor :: class ) ) ; return false ; } return $ instance -> postProcess ( $ request , $ response ) ; }
|
executes post interceptor
|
4,114
|
private function text ( $ text , $ size , $ x , $ y , $ color = 'black' , $ font = 'swiss_normal' , $ angle = 0 ) { imagettftext ( $ this -> image , $ size , $ angle , $ x , $ y , $ this -> colors [ $ color ] , $ this -> fonts [ $ font ] , $ text ) ; }
|
Writes the given text .
|
4,115
|
private function getImageData ( ) { ob_start ( ) ; imagegif ( $ this -> image ) ; $ output = ob_get_contents ( ) ; ob_end_clean ( ) ; imagedestroy ( $ this -> image ) ; return $ output ; }
|
Returns the image raw data .
|
4,116
|
public function getBarcodeDatamatrix ( $ data ) { $ barcode = new Barcode ( ) ; $ bobj = $ barcode -> getBarcodeObj ( 'DATAMATRIX' , $ data , 256 , 256 , 'black' , array ( 0 , 0 , 0 , 0 ) ) -> setBackgroundColor ( 'white' ) ; return $ bobj -> getPngData ( ) ; }
|
Returns the datamatrix from the given data .
|
4,117
|
public function getBarcode128 ( $ data ) { $ barcode = new Barcode ( ) ; $ bobj = $ barcode -> getBarcodeObj ( 'C128' , $ data , 380 , 135 , 'black' , array ( 0 , 0 , 0 , 0 ) ) -> setBackgroundColor ( 'white' ) ; return $ bobj -> getPngData ( ) ; }
|
Returns the barcode from the given data .
|
4,118
|
private function getNamedArguments ( MethodInvocation $ invocation ) { $ submit = [ ] ; $ params = $ invocation -> getMethod ( ) -> getParameters ( ) ; $ args = $ invocation -> getArguments ( ) -> getArrayCopy ( ) ; foreach ( $ params as $ param ) { $ arg = array_shift ( $ args ) ; $ submit [ $ param -> getName ( ) ] = $ arg ; } if ( isset ( $ _POST [ AntiCsrf :: TOKEN_KEY ] ) ) { $ submit [ AntiCsrf :: TOKEN_KEY ] = $ _POST [ AntiCsrf :: TOKEN_KEY ] ; } return $ submit ; }
|
Return arguments as named arguments .
|
4,119
|
private function getFormProperty ( AbstractValidation $ formValidation , $ object ) { if ( ! property_exists ( $ object , $ formValidation -> form ) ) { throw new InvalidFormPropertyException ( $ formValidation -> form ) ; } $ prop = ( new \ ReflectionClass ( $ object ) ) -> getProperty ( $ formValidation -> form ) ; $ prop -> setAccessible ( true ) ; $ form = $ prop -> getValue ( $ object ) ; if ( ! $ form instanceof AbstractForm ) { throw new InvalidFormPropertyException ( $ formValidation -> form ) ; } return $ form ; }
|
Return form property
|
4,120
|
public function hasUserId ( ) { if ( Yii :: $ app -> user -> isGuest ) { return $ this -> user_id !== 0 ; } return $ this -> user_id == Yii :: $ app -> user -> identity -> getId ( ) ; }
|
Detect is visitor connected with User
|
4,121
|
final private static function bcRoundHalfUp ( $ number , $ precision ) { return self :: truncate ( bcadd ( $ number , self :: getHalfUpValue ( $ number , $ precision ) , $ precision + 1 ) , $ precision ) ; }
|
Round decimals from 5 up less than 5 down
|
4,122
|
private function registerSpamBlocker ( ) { $ this -> singleton ( Contracts \ SpamBlocker :: class , function ( $ app ) { $ config = $ app [ 'config' ] ; return new SpamBlocker ( $ config -> get ( 'spam-blocker' ) ) ; } ) ; }
|
Register the spam blocker
|
4,123
|
public static function createFromArgument ( ArgumentInterface $ argument ) { $ tag = new self ( ) ; $ tag -> setName ( self :: TAG_PARAM ) -> setType ( $ argument -> getType ( ) ) -> setVariable ( $ argument -> getName ( ) ) -> setDescription ( $ argument -> getDescription ( ) ) -> setReferenced ( $ argument ) ; return $ tag ; }
|
Creating a Tag from an Argument Object .
|
4,124
|
public static function createFromProperty ( PropertyInterface $ property ) { $ tag = new self ( ) ; $ tag -> setName ( self :: TAG_VAR ) ; $ tag -> setType ( $ property -> getType ( ) ) ; return $ tag ; }
|
Create var tag from property .
|
4,125
|
public function build ( $ index , $ default = null , $ params = [ ] ) { $ class = $ this -> get ( $ index , $ default ) ; if ( ! class_exists ( $ class ) ) { throw new \ Exception ( 'Class doesn\'t exist for the index : ' . $ index ) ; } $ class = new \ ReflectionClass ( $ class ) ; return $ class -> newInstanceArgs ( $ params ) ; }
|
Return an instantiated object
|
4,126
|
protected function parseBuilder ( $ builder ) { if ( $ builder instanceof EloquentBuilder ) { return $ this -> createHandler ( $ builder -> getQuery ( ) , $ builder ) ; } if ( is_subclass_of ( $ builder , Model :: class ) ) { return $ this -> createHandler ( $ builder -> getQuery ( ) , $ builder -> newQuery ( ) ) ; } if ( $ builder instanceof QueryBuilder ) { return $ this -> createHandler ( $ builder , $ builder ) ; } }
|
Parse the builder .
|
4,127
|
protected function createHandler ( $ query , $ builder = null ) { $ handler = new Handler ( $ this -> request , $ this -> config ) ; $ handler -> setQuery ( $ query ) ; if ( ! is_null ( $ builder ) ) { $ handler -> setBuilder ( $ builder ) ; } return $ handler ; }
|
Create the handler .
|
4,128
|
public function process ( $ identifier , \ SS_HTTPRequest $ request ) { if ( $ this -> hasProcessor ( $ identifier ) ) { return $ this -> processors [ $ identifier ] -> process ( $ request ) ; } else { return false ; } }
|
Process an input processor by identifier if it exists
|
4,129
|
private function getTableStructure ( ) { return array ( 'columns' => array ( new BigInteger ( 'id' , false , null , array ( 'auto_increment' => true , 'unsigned' => true ) ) , new Varchar ( $ this -> getIdentifierColumn ( ) , 64 ) , new Blob ( $ this -> getDataColumn ( ) , 0 ) ) , 'constraints' => array ( new PrimaryKey ( 'id' ) , new UniqueKey ( array ( $ this -> getIdentifierColumn ( ) ) , $ this -> getIdentifierColumn ( ) ) ) , ) ; }
|
Returns the table structure in Zend \ Db \ Column objects
|
4,130
|
public function createTable ( ) { $ sql = $ this -> getSql ( ) ; $ createTable = new CreateTable ( $ this -> getTableName ( ) ) ; $ tableStructure = $ this -> getTableStructure ( ) ; foreach ( $ tableStructure [ 'columns' ] as $ column ) { $ createTable -> addColumn ( $ column ) ; } foreach ( $ tableStructure [ 'constraints' ] as $ constraint ) { $ createTable -> addConstraint ( $ constraint ) ; } $ sql -> getAdapter ( ) -> query ( $ sql -> getSqlStringForSqlObject ( $ createTable ) , Adapter :: QUERY_MODE_EXECUTE ) ; return $ this ; }
|
Creates the table structure for you
|
4,131
|
public function dropTable ( ) { $ sql = $ this -> getSql ( ) ; $ dropTable = new DropTable ( $ this -> getTableName ( ) ) ; $ sql -> getAdapter ( ) -> query ( $ sql -> getSqlStringForSqlObject ( $ dropTable ) , Adapter :: QUERY_MODE_EXECUTE ) ; return $ this ; }
|
Drops the table structure for you
|
4,132
|
public function parseWidget ( $ widget ) { if ( is_a ( $ widget , 'Contao\FormTextArea' ) || is_a ( $ widget , 'Contao\FormTextField' ) ) { if ( $ this -> field -> getEval ( 'allowHtml' ) ) { $ value = strip_tags ( \ String :: decodeEntities ( $ widget -> value ) , \ Config :: get ( 'allowedTags' ) ) ; } else { $ value = strip_tags ( \ String :: decodeEntities ( $ widget -> value ) ) ; } if ( $ this -> field -> getEval ( 'decodeEntities' ) ) { return $ value ; } else { return specialchars ( $ value ) ; } } return $ widget -> value ; }
|
This function is for the manipulation of the attribute value Must return the value in the format what is needed for MetaModels
|
4,133
|
public function setValue ( $ value ) { $ this -> item -> set ( $ this -> field -> getColName ( ) , $ this -> field -> mmAttribute -> widgetToValue ( $ value , null ) ) ; }
|
Set the value of the Attribute from given MetaModels Item
|
4,134
|
public static function createInstallationClient ( $ url , CertificateStorage $ certificateStorage ) { $ handlerStack = HandlerStack :: create ( ) ; $ handlerStack -> push ( Middleware :: mapRequest ( new RequestIdMiddleware ( ) ) ) ; $ handlerStack -> push ( Middleware :: mapRequest ( new RequestSignatureMiddleware ( $ certificateStorage -> load ( CertificateType :: PRIVATE_KEY ( ) ) ) ) ) ; return self :: createBaseClient ( ( string ) $ url , $ handlerStack ) ; }
|
Creates an installation client
|
4,135
|
public static function create ( $ url , TokenService $ tokenService , CertificateStorage $ certificateStorage , InstallationService $ installationService , TokenStorage $ tokenStorage ) { $ sessionToken = $ tokenService -> sessionToken ( ) ; $ publicServerKey = $ certificateStorage -> load ( CertificateType :: BUNQ_SERVER_KEY ( ) ) ; $ handlerStack = HandlerStack :: create ( ) ; $ handlerStack -> push ( Middleware :: mapRequest ( new RequestIdMiddleware ( ) ) ) ; $ handlerStack -> push ( Middleware :: mapRequest ( new RequestAuthenticationMiddleware ( $ sessionToken ) ) ) ; $ handlerStack -> push ( Middleware :: mapRequest ( new RequestSignatureMiddleware ( $ certificateStorage -> load ( CertificateType :: PRIVATE_KEY ( ) ) ) ) ) ; $ handlerStack -> push ( Middleware :: mapResponse ( new ResponseSignatureMiddleware ( $ publicServerKey ) ) ) ; $ handlerStack -> push ( Middleware :: mapResponse ( new RefreshSessionMiddleware ( $ installationService , $ tokenStorage ) ) ) ; $ httpClient = self :: createBaseClient ( $ url , $ handlerStack ) ; return $ httpClient ; }
|
Creates the HttpClient with all handlers
|
4,136
|
private static function createBaseClient ( $ url , HandlerStack $ handlerStack = null ) { $ httpClient = new \ GuzzleHttp \ Client ( [ 'base_uri' => $ url , 'handler' => $ handlerStack , 'headers' => [ 'Content-Type' => 'application/json' , 'User-Agent' => 'bunq-api-client:user' , ] , ] ) ; return $ httpClient ; }
|
Returns the standard used headers .
|
4,137
|
protected function findModel ( $ id ) { $ model = $ this -> module -> manager -> findGalleryById ( $ id ) ; if ( $ model === null ) { throw new NotFoundHttpException ( 'The requested page does not exist' ) ; } return $ model ; }
|
Finds the Gallery model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown .
|
4,138
|
public function actionImages ( $ id ) { $ gallery = $ this -> findModel ( $ id ) ; $ searchModel = $ this -> module -> manager -> createGalleryImageSearch ( ) ; $ dataProvider = $ searchModel -> search ( $ _GET , $ id ) ; return $ this -> render ( 'image/index' , [ 'gallery' => $ gallery , 'dataProvider' => $ dataProvider , 'searchModel' => $ searchModel , ] ) ; }
|
Lists all Gallery images models .
|
4,139
|
public function actionCreateImage ( $ id ) { $ gallery = $ this -> findModel ( $ id ) ; $ model = $ this -> module -> manager -> createGalleryImage ( [ 'scenario' => 'create' ] ) ; $ model -> loadDefaultValues ( ) ; if ( $ model -> load ( \ Yii :: $ app -> request -> post ( ) ) ) { $ model -> gallery_id = $ gallery -> id ; if ( $ model -> create ( ) ) { \ Yii :: $ app -> getSession ( ) -> setFlash ( 'gallery.success' , \ Yii :: t ( 'gallery' , 'Image has been created' ) ) ; return $ this -> redirect ( [ 'images' , 'id' => $ id ] ) ; } } return $ this -> render ( 'image/create' , [ 'gallery' => $ gallery , 'model' => $ model ] ) ; }
|
Create gallery image
|
4,140
|
public function actionUpdateImage ( $ id ) { $ model = $ this -> module -> manager -> findGalleryImageById ( $ id ) ; if ( $ model === null ) { throw new NotFoundHttpException ( 'The requested image does not exist' ) ; } $ model -> scenario = 'update' ; $ gallery = $ this -> findModel ( $ model -> gallery_id ) ; if ( $ model -> load ( \ Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { if ( \ Yii :: $ app -> request -> get ( 'returnUrl' ) ) { $ back = urldecode ( \ Yii :: $ app -> request -> get ( 'returnUrl' ) ) ; return $ this -> redirect ( $ back ) ; } \ Yii :: $ app -> getSession ( ) -> setFlash ( 'gallery.success' , \ Yii :: t ( 'gallery' , 'Image has been updated' ) ) ; return $ this -> refresh ( ) ; } return $ this -> render ( 'image/update' , [ 'model' => $ model , 'gallery' => $ gallery ] ) ; }
|
Updates an existing GalleryImage model . If update is successful the browser will be redirected to the images page .
|
4,141
|
public function actionDeleteImage ( $ id ) { $ model = $ this -> module -> manager -> findGalleryImageById ( $ id ) ; if ( $ model === null ) { throw new NotFoundHttpException ( 'The requested page does not exist' ) ; } $ model -> delete ( ) ; \ Yii :: $ app -> getSession ( ) -> setFlash ( 'gallery.success' , \ Yii :: t ( 'gallery' , 'Image has been deleted' ) ) ; return $ this -> redirect ( [ 'images' , 'id' => $ model -> gallery_id ] ) ; }
|
Deletes an existing GalleryImage model . If deletion is successful the browser will be redirected to the images page .
|
4,142
|
protected function copyShippingAddress ( ParameterBag $ parameters ) { $ billingAddress = $ parameters -> get ( 'billingAddress' ) ; $ shippingAddress = [ 'shippingAddress.copyBillingAddress' => true , ] ; foreach ( $ billingAddress as $ key => $ value ) { list ( , $ fieldName ) = explode ( '.' , $ key ) ; $ shippingAddress [ 'shippingAddress.' . $ fieldName ] = $ value ; } $ parameters -> set ( 'shippingAddress' , $ shippingAddress ) ; }
|
Copies billing address to shipping address
|
4,143
|
public function prepare ( ExampleNode $ example , Specification $ context , MatcherManager $ matchers , CollaboratorManager $ collaborators ) { if ( $ example -> getSpecification ( ) -> getClassReflection ( ) -> hasMethod ( 'let' ) ) { $ this -> parameterValidator -> validate ( $ example -> getSpecification ( ) -> getClassReflection ( ) -> getMethod ( 'let' ) ) ; } $ this -> parameterValidator -> validate ( $ example -> getFunctionReflection ( ) ) ; return $ this ; }
|
Generates DI related stuff via parameter validator
|
4,144
|
public function teardown ( ExampleNode $ example , Specification $ context , MatcherManager $ matchers , CollaboratorManager $ collaborators ) { return $ this ; }
|
It does nothing on teardown ...
|
4,145
|
public function normalizeCmsAccents ( $ string ) { $ string = htmlentities ( $ string , ENT_COMPAT | ( defined ( 'ENT_HTML401' ) ? ENT_HTML401 : 0 ) , 'ISO-8859-1' ) ; $ string = preg_replace ( '#&([a-zA-Z])(uml|acute|grave|circ|tilde|slash|cedil|ring|caron);#' , '$1' , $ string ) ; $ string = preg_replace ( '#&(ae|AE)lig;#' , '$1' , $ string ) ; $ string = preg_replace ( '#&(oe|OE)lig;#' , '$1' , $ string ) ; $ string = preg_replace ( '#ß#' , 'ss' , $ string ) ; $ string = preg_replace ( '#&(eth|thorn);#' , 'th' , $ string ) ; $ string = preg_replace ( '#&(ETH|THORN);#' , 'Th' , $ string ) ; return html_entity_decode ( $ string ) ; }
|
Normalize accents just like the CMS does
|
4,146
|
private function writeTracks ( \ XMLWriter $ xmlWriter , Workout $ workout ) { foreach ( $ workout -> tracks ( ) as $ track ) { $ xmlWriter -> startElement ( 'trk' ) ; $ xmlWriter -> writeElement ( 'type' , $ track -> sport ( ) ) ; $ xmlWriter -> startElement ( 'trkseg' ) ; $ this -> writeTrackPoints ( $ xmlWriter , $ track -> trackPoints ( ) ) ; $ xmlWriter -> endElement ( ) ; $ xmlWriter -> endElement ( ) ; } }
|
Write the tracks to the GPX .
|
4,147
|
private function writeTrackPoints ( \ XMLWriter $ xmlWriter , array $ trackPoints ) { foreach ( $ trackPoints as $ trackPoint ) { $ xmlWriter -> startElement ( 'trkpt' ) ; $ xmlWriter -> writeAttribute ( 'lat' , ( string ) $ trackPoint -> latitude ( ) ) ; $ xmlWriter -> writeAttribute ( 'lon' , ( string ) $ trackPoint -> longitude ( ) ) ; $ xmlWriter -> writeElement ( 'ele' , ( string ) $ trackPoint -> elevation ( ) ) ; $ dateTime = clone $ trackPoint -> dateTime ( ) ; $ dateTime -> setTimezone ( new \ DateTimeZone ( 'UTC' ) ) ; $ xmlWriter -> writeElement ( 'time' , $ dateTime -> format ( \ DateTime :: W3C ) ) ; $ this -> writeExtensions ( $ xmlWriter , $ trackPoint -> extensions ( ) ) ; $ xmlWriter -> endElement ( ) ; } }
|
Write the track points to the GPX .
|
4,148
|
protected function writeExtensions ( \ XMLWriter $ xmlWriter , array $ extensions ) { $ xmlWriter -> startElement ( 'extensions' ) ; foreach ( $ extensions as $ extension ) { switch ( $ extension :: ID ( ) ) { case HR :: ID ( ) : $ xmlWriter -> startElementNs ( 'gpxtpx' , 'TrackPointExtension' , null ) ; $ xmlWriter -> writeElementNs ( 'gpxtpx' , 'hr' , null , ( string ) $ extension -> value ( ) ) ; $ xmlWriter -> endElement ( ) ; break ; } } $ xmlWriter -> endElement ( ) ; }
|
Write the extensions into the GPX .
|
4,149
|
protected function writeMetaData ( \ XMLWriter $ xmlWriter , Workout $ workout ) { $ xmlWriter -> startElement ( 'metadata' ) ; if ( $ workout -> author ( ) !== null ) { $ xmlWriter -> startElement ( 'author' ) ; $ xmlWriter -> writeElement ( 'name' , $ workout -> author ( ) -> name ( ) ) ; $ xmlWriter -> endElement ( ) ; } $ xmlWriter -> endElement ( ) ; }
|
Write the metadata in the GPX .
|
4,150
|
public function setIdentifier ( $ identifier ) { if ( is_string ( $ identifier ) ) { $ this -> identifier = $ identifier ; } else { throw new \ InvalidArgumentException ( "Invalid type '" . gettype ( $ identifier ) . "' for argument 'identifier' given." ) ; } }
|
Sets the keyframes identifier .
|
4,151
|
public function addRule ( RuleAbstract $ rule ) { if ( $ rule instanceof KeyframesRuleSet ) { $ this -> rules [ ] = $ rule ; } else { throw new \ InvalidArgumentException ( "Invalid rule instance. Instance of 'KeyframesRuleSet' expected." ) ; } return $ this ; }
|
Adds a keyframes rule set .
|
4,152
|
protected function parseRuleString ( $ ruleString ) { if ( is_string ( $ ruleString ) ) { if ( preg_match ( '/^[ \r\n\t\f]*@(' . self :: getVendorPrefixRegExp ( "/" ) . ')?keyframes[ \r\n\t\f]+([^ \r\n\t\f]+)[ \r\n\t\f]*/i' , $ ruleString , $ matches ) ) { $ vendorPrefix = $ matches [ 1 ] ; $ identifier = $ matches [ 2 ] ; $ this -> setIdentifier ( $ identifier , $ this -> getStyleSheet ( ) ) ; if ( $ vendorPrefix !== "" ) { $ this -> setVendorPrefix ( $ vendorPrefix ) ; } } else { throw new \ InvalidArgumentException ( "Invalid format for @keyframes rule." ) ; } } else { throw new \ InvalidArgumentException ( "Invalid type '" . gettype ( $ ruleString ) . "' for argument 'ruleString' given." ) ; } }
|
Parses the keyframes rule .
|
4,153
|
public static function render ( Query \ Union $ query ) { return Compiler :: withDb ( $ query -> getDb ( ) , function ( ) use ( $ query ) { return Compiler :: expression ( array ( Arr :: join ( ' UNION ' , Arr :: map ( function ( Query \ Select $ select ) { return Compiler :: braced ( Select :: render ( $ select ) ) ; } , $ query -> getSelects ( ) ) ) , Compiler :: word ( 'ORDER BY' , Direction :: combine ( $ query -> getOrder ( ) ) ) , Compiler :: word ( 'LIMIT' , $ query -> getLimit ( ) ) , ) ) ; } ) ; }
|
Render a Union object
|
4,154
|
public function get ( $ status ) { $ preprocessor = $ this -> has ( $ status ) ? $ this -> preprocessors [ $ status ] : $ this -> preprocessors [ self :: DEFAULT_STATUS ] ; return ( $ preprocessor instanceof HttpStatusPreprocessorInterface ) ? $ preprocessor : new $ preprocessor ; }
|
Get an instance of the preprocessor for the current status
|
4,155
|
public function pbjUrl ( Message $ pbj , string $ template ) : ? string { return UriTemplateService :: expand ( "{$pbj::schema()->getQName()}.{$template}" , $ pbj -> getUriTemplateVars ( ) ) ; }
|
Returns a named URL to a pbj instance .
|
4,156
|
static function renderRemoteEmptyModal ( $ remoteId = null ) { $ modal = modal ( ) ; if ( ! is_null ( $ remoteId ) ) { $ modal -> setRemoteId ( $ remoteId ) ; } return $ modal -> getRenderer ( ) -> render ( 'modal_remote' , $ modal ) ; }
|
Render an emptyl
|
4,157
|
private function loadImage ( string $ resource ) { try { return $ this -> resourceLoader -> load ( $ resource , function ( $ fileName ) { return ImageSource :: load ( $ fileName ) ; } ) ; } catch ( \ Throwable $ t ) { trigger_error ( 'Can not load image "' . $ resource . '": ' . $ t -> getMessage ( ) , E_USER_ERROR ) ; return null ; } }
|
loads image from resource pathes
|
4,158
|
public function addLink ( string $ rel , $ uri ) : Link { return $ this -> links -> add ( $ rel , $ uri ) ; }
|
adds a link for this resource
|
4,159
|
public function jsonSerialize ( ) : array { return [ 'name' => $ this -> name , 'methods' => $ this -> requestMethods , 'description' => $ this -> annotations -> description ( ) , 'produces' => $ this -> mimeTypes , 'responses' => $ this -> annotations -> statusCodes ( ) , 'headers' => $ this -> annotations -> headers ( ) , 'parameters' => $ this -> annotations -> parameters ( ) , 'auth' => $ this -> authConstraint , '_links' => $ this -> links ] ; }
|
returns proper representation which can be serialized to JSON
|
4,160
|
public static function compareVersion ( $ version1 , $ version2 ) { if ( $ version1 == $ version2 ) { return 0 ; } $ v1 = Parser :: parse ( $ version1 ) ; $ v2 = Parser :: parse ( $ version2 ) ; return self :: compare ( $ v1 , $ v2 ) ; }
|
Compare two version as string .
|
4,161
|
public static function compareVersionRange ( $ version , $ range ) { if ( $ range == '' || $ version == '' ) { return true ; } if ( is_string ( $ version ) ) { $ v1 = Parser :: parse ( $ version ) ; } else { $ v1 = $ version ; } if ( $ v1 -> toString ( true , false ) == $ range ) { return true ; } $ expression = self :: compileRange ( $ range ) ; return $ expression -> compare ( $ v1 ) ; }
|
Compare a version with a given range .
|
4,162
|
public function addRule ( $ index , $ method = null , ... $ params ) { $ this -> rules [ $ index ] = [ $ method , $ params ] ; return $ this ; }
|
Add a single rule to the rules container
|
4,163
|
public function formatError ( $ index , $ params ) { $ pattern = $ this -> hasMessage ( $ index ) ? $ this -> getMessage ( $ index ) : static :: MESSAGE_DEFAULT_PATTERN ; return vsprintf ( $ pattern , $ params ) ; }
|
Format an error
|
4,164
|
public function valid ( $ value ) { foreach ( $ this -> getRules ( ) as $ index => $ rule ) { if ( in_array ( $ value , [ '' , null ] ) && ! $ this -> hasRule ( 'required' ) ) { continue ; } list ( $ method , $ params ) = $ rule ; $ method = is_null ( $ method ) ? $ index : $ method ; array_unshift ( $ params , $ value ) ; if ( ! is_string ( $ method ) && is_callable ( $ method ) ) { if ( ! call_user_func_array ( $ method , $ params ) ) { $ this -> addError ( $ index , $ this -> formatError ( $ index , $ params ) ) ; } } else { if ( ! method_exists ( $ this , $ method ) ) { throw new \ Exception ( 'Method "' . $ method . '" not found for validator : ' . $ index ) ; } if ( ! call_user_func_array ( [ $ this , $ method ] , $ params ) ) { $ this -> addError ( $ index , $ this -> formatError ( $ index , $ params ) ) ; } } } return $ this ; }
|
Valid the element
|
4,165
|
public function required ( $ value ) { if ( ! $ this -> hasMessage ( 'required' ) ) { $ this -> addMessage ( 'required' , 'This value is required' ) ; } if ( is_null ( $ value ) || $ value == '' ) { return false ; } return true ; }
|
Return FALSE if value is null or empty string
|
4,166
|
public function laravel ( $ value , $ validationString , $ messages = [ ] ) { $ validator = \ Validator :: make ( [ 'laravel' => $ value ] , [ 'laravel' => $ validationString ] ) ; $ validator -> setCustomMessages ( $ this -> getMessages ( ) ) ; if ( $ validator -> fails ( ) && ! $ this -> hasMessage ( 'laravel' ) ) { $ message = '' ; foreach ( $ validator -> errors ( ) -> get ( 'laravel' ) as $ m ) { $ message .= $ m . ' ' ; } $ this -> addMessage ( 'laravel' , $ message ) ; } return $ validator -> valid ( ) ; }
|
Return true if the value is correct with a laravel validator string
|
4,167
|
public function dump ( Request $ request , Response $ response , Route $ route ) { if ( $ this -> bypass === true ) { return false ; } $ cache = strtoupper ( $ route -> getParameter ( 'cache' ) ) ; $ ttl = $ route -> getParameter ( 'ttl' ) ; $ name = self :: getCacheName ( $ request ) ; $ method = ( string ) $ request -> getMethod ( ) ; $ status = $ response -> getStatus ( ) -> get ( ) ; if ( ( $ cache == 'SERVER' || $ cache == 'BOTH' ) && in_array ( $ method , self :: $ cachable_methods ) && in_array ( $ status , self :: $ cachable_statuses ) ) { $ this -> getCache ( ) -> setNamespace ( self :: $ cache_namespace ) -> set ( $ name , $ response -> export ( ) , $ ttl === null ? self :: DEFAULTTTL : intval ( $ ttl ) ) ; return true ; } return false ; }
|
Dump the full request object in the cache
|
4,168
|
private static function getCacheName ( Request $ request ) { return md5 ( ( string ) $ request -> getMethod ( ) . ( string ) $ request -> getUri ( ) ) ; }
|
Extract and compute the cache object name
|
4,169
|
protected function getDocBlockReplace ( ) { if ( ! $ this -> isDocBlockRequired ( ) ) return '' ; $ rows = $ this -> collectDocBlockPropertyRows ( ) ; if ( ! count ( $ rows ) ) return '' ; $ replace = "/**\n" . $ this -> getDocBlockIntro ( ) ; foreach ( $ rows as $ row ) { $ replace .= ' * ' . "@{$row['tag']} " . "{$row['type']} " . "{$row['name']}\n" ; } $ replace .= " */\n" ; return $ replace ; }
|
Returns the replacement for the docblock placeholder
|
4,170
|
public function dataAvailable ( ) { return ( $ this -> position >= $ this -> collection -> getStartIndex ( ) and $ this -> position <= $ this -> collection -> getEndIndex ( ) ) ; }
|
True if data for the current position has been loaded from the server and is locally available .
|
4,171
|
public function nextDataAvailable ( ) { return ( $ this -> position + 1 >= $ this -> collection -> getStartIndex ( ) and $ this -> position + 1 <= $ this -> collection -> getEndIndex ( ) ) ; }
|
True if data for the next position has been loaded from the server and is locally available . This is useful in foreach loops to determine whether the next iteration will issue a HTTP request .
|
4,172
|
public function hasValue ( string $ key ) : bool { if ( ! $ this -> isValid ( ) ) { return false ; } return $ this -> storage -> hasValue ( $ key ) ; }
|
checks whether a value associated with key exists
|
4,173
|
public function setConditions ( $ conditions ) { $ this -> conditions = [ ] ; if ( ! is_array ( $ conditions ) ) { $ conditions = [ $ conditions ] ; } foreach ( $ conditions as $ condition ) { $ this -> addCondition ( $ condition ) ; } return $ this ; }
|
Sets the conditions .
|
4,174
|
public static function get ( DataSift_User $ user , $ id ) { $ params = array ( 'id' => $ id ) ; return new self ( $ user , $ user -> post ( 'source/get' , $ params ) ) ; }
|
Gets a single DataSift_Source object by ID
|
4,175
|
public function save ( $ validate = true ) { if ( $ this -> getValidate ( ) != $ validate ) { $ this -> setValidate ( $ validate ) ; } $ endpoint = ( $ this -> getId ( ) ? 'source/update' : 'source/create' ) ; $ this -> fromArray ( $ this -> getUser ( ) -> post ( $ endpoint , $ this -> toArray ( ) ) ) ; return $ this ; }
|
Save this Source
|
4,176
|
public function delete ( ) { $ this -> getUser ( ) -> post ( 'source/delete' , array ( 'id' => $ this -> getId ( ) ) ) ; $ this -> setStatus ( self :: STATUS_DELETED ) ; return $ this ; }
|
Delete this Source .
|
4,177
|
public function getLogs ( $ page = 1 , $ perPage = 20 ) { return $ this -> getUser ( ) -> post ( 'source/log' , array ( 'id' => $ this -> getId ( ) , 'page' => $ page , 'per_page' => $ perPage ) ) ; }
|
Returns the logs for this source
|
4,178
|
public function fromArray ( array $ data ) { $ map = array ( 'id' => 'setId' , 'name' => 'setName' , 'source_type' => 'setSourceType' , 'status' => 'setStatus' , 'parameters' => 'setParameters' , 'auth' => 'setAuth' , 'resources' => 'setResources' , 'created_at' => 'setCreatedAt' , 'validate' => 'setValidate' ) ; foreach ( $ map as $ key => $ setter ) { if ( isset ( $ data [ $ key ] ) ) { $ this -> $ setter ( $ data [ $ key ] ) ; } } return $ this ; }
|
Hydrates this Source from an array of API responses
|
4,179
|
protected function setupEngine ( ) { $ this -> engine = new HandlebarsEngine ; $ loader = new HandlebarsLoader ( $ this -> viewManager ) ; $ partialLoader = new HandlebarsLoader ( $ this -> viewManager ) ; $ partialLoader -> setPrefix ( '_' ) ; $ this -> engine -> setLoader ( $ loader ) ; $ this -> engine -> setPartialsLoader ( $ partialLoader ) ; }
|
Sets HandlebarsEngine up
|
4,180
|
public function filter ( $ template ) { $ this -> _prepare_filter ( ) ; return $ this -> _should_load_template ( ) ? $ this -> _get_template ( $ template ) : $ template ; }
|
Filters a template file path and replaces it with a template provided by the plugin .
|
4,181
|
public static function make ( $ filePath ) { $ variableProcessor = new VariableProcessor ( ) ; $ fileSaver = new FileSaver ( $ variableProcessor ) ; $ fileLoader = new FileLoader ( $ variableProcessor ) ; return new Repository ( $ fileLoader , $ fileSaver , $ filePath ) ; }
|
Create repository instance
|
4,182
|
protected function _getFrontend ( ) { $ frontend = parent :: _getFrontend ( ) ; if ( $ frontend === null ) { $ frontend = $ this -> frontendPool -> get ( self :: CACHE_TYPE ) ; } return $ frontend ; }
|
Returns a frontend on a first call to frontend interface methods
|
4,183
|
public function setCustomActions ( $ name , $ data = null ) { $ actions = is_array ( $ name ) ? $ name : [ $ name => $ data ] ; foreach ( $ actions as $ key => $ value ) { $ this -> customActions [ $ key ] = $ value ; } return $ this ; }
|
Sets the Custom actions .
|
4,184
|
public function setStrainerSelect ( $ options = [ ] , $ callable = null , $ attr = [ ] ) { if ( is_string ( $ callable ) || $ callable instanceof Expression ) { $ field = $ callable ; $ callable = null ; } $ strainer = new Select ( $ this , $ options , $ callable , $ attr ) ; if ( isset ( $ field ) ) { $ strainer -> setField ( $ field ) ; } return $ this -> setStrainer ( $ strainer ) ; }
|
Set Strainer as a select form element
|
4,185
|
public function setStrainerBoolean ( $ callable = null , $ attr = [ ] ) { if ( is_string ( $ callable ) || $ callable instanceof Expression ) { $ field = $ callable ; $ callable = null ; } $ strainer = new Boolean ( $ this , $ callable , $ attr ) ; if ( isset ( $ field ) ) { $ strainer -> setField ( $ field ) ; } return $ this -> setStrainer ( $ strainer ) ; }
|
Set strainer as a Boolean
|
4,186
|
public function setStrainerDateRange ( $ callable = null , $ attr = [ ] ) { if ( is_string ( $ callable ) || $ callable instanceof Expression ) { $ field = $ callable ; $ callable = null ; } $ strainer = new DateRange ( $ this , $ callable , $ attr ) ; if ( isset ( $ field ) ) { $ strainer -> setField ( $ field ) ; } return $ this -> setStrainer ( $ strainer ) ; }
|
Set a strainer as date from to
|
4,187
|
private function setEmoji ( $ emoji ) { $ emoji = trim ( $ emoji ) ; $ emojiValidationRegex = '_^:[\w-+]+:$_iuS' ; if ( ! preg_match ( $ emojiValidationRegex , $ emoji ) ) { throw new InvalidEmojiException ( sprintf ( 'The emoji: "%s" is not a valid emoji. An emoji should always be a string starting and ending with ":".' , $ emoji ) , 400 ) ; } $ this -> emoji = $ emoji ; return $ this ; }
|
This will set the emoji if it is valid .
|
4,188
|
public function build ( $ selector , $ function , ... $ params ) { $ attributes = [ ] ; foreach ( $ params as $ p ) { $ attributes [ ] = $ this -> encode ( $ p ) ; } $ attributes = implode ( ',' , $ attributes ) ; $ attributes = preg_replace ( '#\"(function\([^\{]+{.*\})\",#' , '$1,' , $ attributes ) ; return sprintf ( '$("%s").%s(%s);' , $ selector , $ function , $ attributes ) ; }
|
Build a jquery call javascript code
|
4,189
|
public function warning ( $ body = '' , $ title = '' ) { $ body = empty ( $ body ) ? configurator ( ) -> get ( 'toastr.warning.default' ) : $ body ; $ this -> append ( [ static :: TYPE_INLINE , sprintf ( 'toastr.warning("%s", "%s");' , $ body , $ title ) ] ) ; return $ this ; }
|
Add toastr warning message
|
4,190
|
public function accessibleAttributesToArray ( ) { $ filtered = [ ] ; $ attributes = $ this -> attributesToArray ( ) ; foreach ( $ attributes as $ key => $ attribute ) { $ accessible = $ this -> access_authorizer -> canAccess ( $ key ) ; if ( $ accessible ) { $ filtered [ $ key ] = $ attribute ; } } return array_merge ( $ filtered , $ this -> accessibleRelationsToArray ( ) ) ; }
|
Filter attributes which can and can t be accessed by the user
|
4,191
|
public function accessibleRelationsToArray ( ) { $ filtered = [ ] ; $ relations = $ this -> getArrayableRelations ( ) ; foreach ( $ relations as $ key => $ related_collection ) { if ( ! $ this -> access_authorizer -> canAccess ( $ key ) ) { continue ; } if ( $ related_collection instanceof Pivot ) { $ filtered [ $ key ] = $ related_collection ; continue ; } if ( $ related_collection instanceof Collection ) { foreach ( $ related_collection as $ index => $ related ) { $ filtered [ $ key ] [ $ index ] = $ related -> accessibleAttributesToArray ( ) ; } } elseif ( $ related_collection instanceof LaravelModel ) { $ filtered [ $ key ] = $ related_collection -> accessibleAttributesToArray ( ) ; } } return $ filtered ; }
|
Filter relations which can and can t be accessed by the user
|
4,192
|
public function addAppends ( $ appends ) { if ( is_string ( $ appends ) ) { $ appends = func_get_args ( ) ; } $ this -> appends = array_merge ( $ this -> appends , $ appends ) ; return $ this ; }
|
Add additional appended properties to the model via a public interface .
|
4,193
|
public function removeAppends ( $ appends ) { if ( is_string ( $ appends ) ) { $ appends = func_get_args ( ) ; } $ this -> appends = array_diff ( $ this -> appends , $ appends ) ; return $ this ; }
|
Remove appended properties to the model via a public interface .
|
4,194
|
public function removeHidden ( $ hidden ) { if ( is_string ( $ hidden ) ) { $ hidden = func_get_args ( ) ; } $ this -> hidden = array_diff ( $ this -> hidden , $ hidden ) ; return $ this ; }
|
Unhide hidden properties from the model via a public interface .
|
4,195
|
final protected function mutateDateTimeAttribute ( $ date , $ attribute ) { if ( is_numeric ( $ date ) ) { return $ this -> attributes [ $ attribute ] = Carbon :: createFromTimestamp ( $ date ) ; } return $ this -> attributes [ $ attribute ] = Carbon :: parse ( $ date ) -> toDateTimeString ( ) ; }
|
Mutator for datetime attributes .
|
4,196
|
public function setTrans ( $ attr , $ trans = null ) { $ transList = is_array ( $ attr ) ? $ attr : [ $ attr => $ trans ] ; foreach ( $ transList as $ key => $ value ) $ this -> trans [ $ key ] = $ value ; return $ this ; }
|
Sets the Model trans .
|
4,197
|
public function fetch ( $ limit = null ) { $ data = Base :: query ( 'bf2cc serverchatbuffer' ) ; $ spl = explode ( "\r\r" , $ data ) ; $ result = array ( ) ; $ i = 0 ; foreach ( $ spl as $ chat ) { $ ex = explode ( "\t" , $ chat ) ; if ( count ( $ ex ) < 2 ) continue ; list ( $ index , $ origin , $ team , $ type , $ time , $ message ) = $ ex ; if ( ! $ limit or $ limit > count ( $ spl ) - $ i ) { $ result [ ] = ( object ) array ( 'origin' => $ origin , 'type' => $ type , 'team' => $ team , 'time' => substr ( $ time , 1 , - 1 ) , 'message' => $ message , 'index' => $ index ) ; } ++ $ i ; } return $ result ; }
|
Fetches current Chat - Buffer
|
4,198
|
public function match ( CalledUri $ calledUri ) : MatchingRoutes { $ allowedMethods = [ ] ; $ matching = [ ] ; foreach ( $ this -> routes as $ route ) { if ( $ route -> matches ( $ calledUri ) ) { return new MatchingRoutes ( [ 'exact' => $ route ] , $ route -> allowedRequestMethods ( ) ) ; } elseif ( $ route -> matchesPath ( $ calledUri ) ) { $ matching [ ] = $ route ; $ allowedMethods = array_merge ( $ allowedMethods , $ route -> allowedRequestMethods ( ) ) ; } } return new MatchingRoutes ( $ matching , array_unique ( $ allowedMethods ) ) ; }
|
finds route based on called uri
|
4,199
|
public function getIterator ( ) : \ Traversable { $ routes = $ this -> routes ; usort ( $ routes , function ( Route $ a , Route $ b ) { return strnatcmp ( $ a -> configuredPath ( ) , $ b -> configuredPath ( ) ) ; } ) ; return new \ ArrayIterator ( $ routes ) ; }
|
allows iteration over all configured routes
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.