idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
230,200
public function getUserRoles ( $ user_id ) { $ roles = array ( ) ; foreach ( ( array ) get_sites ( ) as $ site ) { if ( $ site -> blog_id != 1 ) { $ userSettings = get_user_meta ( $ user_id , $ this -> db -> prefix . $ site -> blog_id . '_capabilities' , true ) ; } else { $ userSettings = get_user_meta ( $ user_id , $ ...
Get roles that are defined at each site
230,201
public function isValidJson ( string $ data ) : bool { json_decode ( $ data ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { return false ; } return true ; }
Check if json is valid
230,202
private function createJson ( ) { $ content = $ this -> getContent ( ) -> get ( ) ; $ json = json_encode ( $ content , JSON_PRESERVE_ZERO_FRACTION | JSON_BIGINT_AS_STRING | JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ; if ( ! $ this -> isValidJson ( $ json ) ) { throw new \ Nuki \ Exceptions \ Bas...
Create json object
230,203
public function doCreate ( callable $ callbackAskNameAndService ) { assert ( $ this -> _dispatcher ) ; assert ( $ this -> _container ) ; $ this -> _clearStatProperties ( ) ; $ this -> _dispatcher -> dispatch ( self :: EVENT_INIT_SERVICE , OnInitService :: create ( ) ) ; try { $ this -> notify ( self :: STATE_FIRED ) ; ...
Create INI file template for new migration .
230,204
public function doStatus ( ) { assert ( $ this -> _dispatcher ) ; assert ( $ this -> _container ) ; $ this -> _clearStatProperties ( ) ; $ this -> _dispatcher -> dispatch ( self :: EVENT_INIT_SERVICE , OnInitService :: create ( ) ) ; try { $ this -> notify ( self :: STATE_FIRED ) ; $ modulesAndFiles = $ this -> _findMo...
Execute status command .
230,205
public function notify ( $ state = null ) { assert ( $ state === null || is_int ( $ state ) ) ; $ this -> _state = intval ( $ state ) ? : $ this -> _state ; foreach ( $ this -> _observers as $ observer ) { $ observer -> update ( $ this ) ; } }
Notify any observers about state change .
230,206
protected function _clearStatProperties ( ) { $ this -> _statErrors = 0 ; $ this -> _statMigrationsTotal = 0 ; $ this -> _statMigrationForCommit = 0 ; $ this -> _statMigrationForRollback = 0 ; $ this -> _statMigrationRejected = 0 ; $ this -> _statMigrationApplied = 0 ; }
Reset properties with statistic information .
230,207
public function doAction ( $ action , $ params ) { if ( method_exists ( $ this , $ action ) ) { $ this -> $ action ( $ params ) ; } else { $ this -> ActionNotFound ( $ action , $ params ) ; } }
Execute the action if it exists else calling ActionNotFound method
230,208
public function fragmentize ( ) { $ re = implode ( '|' , array ( self :: RE_SHORT_TOKEN_START , self :: RE_SHORT_TOKEN_END , self :: RE_LONG_TOKEN_START , self :: RE_LONG_TOKEN_END , self :: RE_TEXT ) ) ; preg_match_all ( '/' . $ re . '/' , $ this -> text , $ matches ) ; $ this -> fragments = $ matches [ 0 ] ; $ this -...
Splits texts into fragments where some fragments are tokens others are text
230,209
public static function escape ( $ value ) { if ( $ value instanceof Htmlable ) return $ value -> toHtml ( ) ; return htmlentities ( $ value , ENT_QUOTES , 'UTF-8' , false ) ; }
Escape HTML entities in a string .
230,210
public static function dms ( $ d , $ m = 0 , $ s = 0 , $ f = 0 ) { $ asec = static :: dmsf2asec ( $ d , $ m , $ s , $ f ) ; return static :: mas ( $ asec * 1000 ) ; }
Creates a new angle from degree arcminute and arcsecond components .
230,211
public static function time ( Time $ time , Time $ interval = null ) { $ secInDay = Time :: days ( 1 ) -> sec ; $ interval = $ interval ? $ interval -> sec : $ secInDay ; return static :: deg ( $ time -> sec / $ interval * 360 ) ; }
Creates a new angle equal to the number of revolutions of a duration of time within a specified time interval .
230,212
public static function atan2 ( $ y , $ x ) { $ y = $ y instanceof Angle ? $ y -> rad : $ y ; $ x = $ x instanceof Angle ? $ x -> rad : $ x ; return static :: rad ( atan2 ( $ y , $ x ) ) ; }
Creates a new angle from the arc tangent of two Angle instances or float values expressed in radians .
230,213
public function toTime ( Time $ interval = null ) { $ secInDay = Time :: days ( 1 ) -> sec ; $ interval = $ interval ? $ interval -> sec : $ secInDay ; return Time :: sec ( ( $ this -> deg / 360 ) * $ interval ) ; }
Converts this instance to a proportion of time passed within a specified time interval where 360 degrees is equal to the interval .
230,214
public static function make ( string $ path , string $ manifestDirectory ) : string { static $ manifest ; if ( $ manifestDirectory && strpos ( $ manifestDirectory , DIRECTORY_SEPARATOR ) !== 0 ) { $ manifestDirectory = DIRECTORY_SEPARATOR . "{$manifestDirectory}" ; } if ( ! $ manifest ) { if ( ! file_exists ( $ manifes...
Get mix file
230,215
public function field ( string $ key , $ value = null , $ description = null ) { if ( ! $ field = $ this -> fields -> where ( 'key' , $ key ) -> first ( ) ) { $ this -> fields -> push ( $ field = $ this -> fields ( ) -> firstOrNew ( compact ( 'key' ) ) ) ; } $ field -> setDefaultValue ( $ value ) ; $ field -> setDefaul...
Get or create a field .
230,216
protected function extractPrimaryKeyValue ( $ record , $ returnAs ) { $ record = ( object ) $ record ; $ values = [ ] ; foreach ( ( array ) $ this -> ORMParameters [ 'primaryKey' ] as $ field ) { $ values [ $ field ] = $ record -> $ field ; } switch ( $ returnAs ) { case 's' : return implode ( '|' , $ values ) ; break ...
Builds primary key value for a record
230,217
protected function purgePrimaryKeyValue ( & $ record ) { foreach ( ( array ) $ this -> ORMParameters [ 'primaryKey' ] as $ field ) { if ( is_array ( $ record ) && ( isset ( $ record [ $ field ] ) || $ record [ $ field ] === null ) ) { unset ( $ record [ $ field ] ) ; } elseif ( is_object ( $ record ) && isset ( $ recor...
Purges primary key value for a record
230,218
protected function execList ( ) { if ( ! empty ( $ this -> ancestors ) ) { end ( $ this -> ancestors ) ; $ parentPrimaryKey = current ( $ this -> ancestors ) ; } else { $ parentPrimaryKey = [ ] ; } $ this -> templateParameters [ 'records' ] = $ this -> get ( $ parentPrimaryKey ) ; $ this -> loadTranslations ( 'list' , ...
Displays list table
230,219
protected function execInsertForm ( ) { $ this -> loadTranslations ( 'form' , sprintf ( 'private/global/locales/%s/form.ini' , LANGUAGE ) ) ; $ this -> renderTemplate ( sprintf ( '%s/%s/save-form' , AREA , $ this -> name ) ) ; }
Displays insert form
230,220
protected function execUpdateForm ( ) { $ this -> loadTranslations ( 'form' , sprintf ( 'private/global/locales/%s/form.ini' , LANGUAGE ) ) ; $ this -> templateParameters [ 'record' ] = $ this -> getByPrimaryKey ( $ this -> primaryKeyValue ) ; $ this -> renderTemplate ( sprintf ( '%s/%s/save-form' , AREA , $ this -> na...
Displays update form
230,221
public function execInsert ( $ redirectAction = false ) { $ this -> loadTranslations ( 'database' , sprintf ( 'private/global/locales/%s/database.ini' , LANGUAGE ) ) ; $ input = $ this -> processSaveInput ( filter_input_array ( INPUT_POST , $ this -> configuration [ 'subjects' ] [ $ this -> name ] [ 'CRUD' ] [ 'inputFi...
Insert record action
230,222
public function execUpdate ( $ redirectAction = false ) { $ this -> loadTranslations ( 'database' , sprintf ( 'private/global/locales/%s/database.ini' , LANGUAGE ) ) ; $ input = $ this -> processSaveInput ( filter_input_array ( INPUT_POST , $ this -> configuration [ 'subjects' ] [ $ this -> name ] [ 'CRUD' ] [ 'inputFi...
Update record action
230,223
public function execDelete ( $ redirectAction = false ) { $ this -> loadTranslations ( 'database' , sprintf ( 'private/global/locales/%s/database.ini' , LANGUAGE ) ) ; $ input = $ this -> processSaveInput ( filter_input_array ( INPUT_POST , $ this -> configuration [ 'subjects' ] [ $ this -> name ] [ 'CRUD' ] [ 'inputFi...
Delete record action
230,224
protected function execDeleteBulk ( ) { $ primaryKeyValues = $ _POST [ 'primaryKeyValues' ] ; $ this -> loadTranslations ( 'database' , sprintf ( 'private/global/locales/%s/database.ini' , LANGUAGE ) ) ; $ deletedNumber = 0 ; foreach ( $ primaryKeyValues as $ recordPrimaryKeyValues ) { try { $ this -> delete ( $ record...
deletes multiple record
230,225
private function createElasticClient ( $ clientName , ContainerBuilder $ container ) { $ smfName = sprintf ( '%s.metadata' , $ clientName ) ; $ definition = new Definition ( Utility :: getLibraryClass ( 'Search\Elastic\StorageMetadataFactory' ) ) ; $ definition -> setPublic ( false ) ; $ container -> setDefinition ( $ ...
Creates the Elastic search client service definition . Will also load support services .
230,226
protected function compiled ( $ template ) { $ template = ltrim ( $ template , '/' ) ; if ( strrchr ( $ template , '.' ) == $ this -> extension ) $ template = substr ( $ template , 0 , - strlen ( $ this -> extension ) ) ; $ file = $ this -> dir . DIRECTORY_SEPARATOR . $ template . $ this -> extension ; if ( ! is_file (...
Fetch Compiled Template
230,227
protected static function initWidgetParameters ( $ widget , array $ parameters ) { $ param = var_export ( $ parameters , true ) ; $ param = preg_replace ( "/'\\$(.*)',/isU" , "\$\\1," , $ param ) ; $ param = str_replace ( '\\\'' , '\'' , $ param ) ; return "<?php \$this->widget->setParameters($param);?>\n" ; }
Set Widget Parameters
230,228
protected static function writeFile ( $ target , $ content , $ tmp ) { $ dir = dirname ( $ target ) ; if ( ! is_dir ( $ dir ) ) mkdir ( $ dir , 644 , true ) ; $ file = tempnam ( $ tmp , 'hum' ) ; if ( ! ( $ fd = fopen ( $ file , 'w' ) ) ) throw new \ RuntimeException ( "create template tmp file failed:$file!" ) ; fwrit...
Write Compiled File
230,229
public function execute ( ) : void { $ path = '' ; try { $ path = $ this -> getPath ( ) ; if ( $ this -> config -> cache ) { try { $ this -> setCache ( ) ; } catch ( StorageNotSupportedException $ e ) { $ this -> cache = null ; } catch ( StorageConnectException $ e ) { $ this -> cache = null ; } } if ( null !== $ this ...
Application main workflow .
230,230
public function actionSave ( $ id = null , $ languageId = null ) { if ( empty ( $ languageId ) ) { $ languageId = Language :: getCurrent ( ) -> id ; } if ( ! empty ( $ id ) ) { $ model = PaymentMethod :: findOne ( $ id ) ; if ( empty ( $ model ) ) throw new NotFoundHttpException ( ) ; $ modelTranslation = PaymentMethod...
Creates a new PaymentMethod model . If creation is successful the browser will be redirected to the view page .
230,231
public function actionDelete ( $ id ) { if ( ( $ model = PaymentMethod :: findOne ( $ id ) ) !== null ) { $ model -> delete ( ) ; return $ this -> redirect ( [ 'index' ] ) ; } else { throw new NotFoundHttpException ( 'The requested page does not exist.' ) ; } }
Deletes an existing PaymentMethod model . If deletion is successful the browser will be redirected to the index page .
230,232
public function actionDeleteImage ( $ id ) { if ( ! empty ( $ id ) ) { $ paymentMethod = PaymentMethod :: findOne ( $ id ) ; $ isDeleted = \ Yii :: $ app -> shop_imagable -> delete ( 'payment' , $ paymentMethod -> image ) ; if ( $ isDeleted ) { $ paymentMethod -> image = NULL ; $ paymentMethod -> save ( ) ; return $ th...
Deletes image from Payment method model .
230,233
public static function get ( $ obj , $ propName , $ default = null ) { if ( ! is_object ( $ obj ) ) { return $ default ; } try { return $ obj -> $ propName ; } catch ( \ Exception $ e ) { } return $ default ; }
Get object property value or default if it does not exist .
230,234
public static function getRfl ( $ obj , $ propName , $ default = null ) { if ( ! is_object ( $ obj ) ) { return $ default ; } try { $ prop = new \ ReflectionProperty ( $ obj , $ propName ) ; } catch ( \ Exception $ e ) { return $ default ; } if ( $ prop -> isPublic ( ) ) { return $ obj -> $ propName ; } else { $ prop -...
Get object property value using reflection .
230,235
public function getDefaultDb ( $ justPickOne = true ) { if ( null !== $ this -> defaultDb ) { return $ this -> defaultDb ; } if ( $ justPickOne ) { return reset ( $ this -> dbs ) ; } return null ; }
Get the default db connection
230,236
public function getDb ( $ db = null ) { if ( $ db === null ) { return $ this -> getDefaultDb ( ) ; } if ( isset ( $ this -> dbs [ $ db ] ) ) { return $ this -> dbs [ $ db ] ; } throw new Exception \ InvalidArgumentException ( 'A DB adapter was tried to retrieve, but was not configured' ) ; }
Retrieve the specified database connection
230,237
public function updateAttr ( $ key , $ value ) { if ( isset ( $ _SESSION [ $ key ] ) ) { $ _SESSION [ $ key ] = $ value ; return true ; } else { return false ; } }
Modifie un attribut de la session
230,238
public static function create ( FormField $ field , $ submittedData ) { switch ( $ field -> getType ( ) ) { case 'email' : $ object = new SpecialEmailValidator ( $ field , $ submittedData ) ; break ; default : throw FormFieldException :: noSuchType ( $ field -> getType ( ) ) ; break ; } return $ object ; }
Factory method to create an appropriate type
230,239
public function mapInboundPostVarsToEmail_messagesFields ( ) { $ data = [ ] ; $ data [ 'user_id' ] = $ this -> getUserIdByMappedEmailAddress ( ) ; $ data [ 'from_email_address' ] = trim ( $ this -> request -> input ( 'sender' ) ) ; $ data [ 'from_name' ] = $ this -> genericWashText ( $ this -> request -> input ( 'from'...
Map the non - attachment vars from the inbound email webhook to the email_messages fields
230,240
public function setBodyField ( ) { if ( $ this -> request -> input ( 'stripped-html' ) ) { return $ this -> request -> input ( 'stripped-html' ) ; } return $ this -> request -> input ( 'body-plain' ) ; }
Set the email s body field
230,241
public function cast ( $ request ) { if ( is_array ( $ request ) || is_object ( $ request ) ) { foreach ( $ request as $ key => $ value ) { if ( is_array ( $ value ) ) { $ this -> cast ( $ value ) ; } else { $ this -> $ key = $ value ; } } } }
Casts the request array into new Request object .
230,242
public function setRequest ( $ request = [ ] ) { if ( ! empty ( $ request ) ) { if ( is_array ( $ request ) ) { foreach ( ( array ) $ request as $ item ) { foreach ( $ item as $ key => $ value ) { if ( empty ( $ value ) ) { $ request [ 'empty' ] = 'true' ; } else { $ request [ 'empty' ] = 'false' ; } } break ; } $ this...
Sets the request .
230,243
public function sameValueAs ( ValueObjectInterface $ date_time ) { if ( false === Util :: classEquals ( $ this , $ date_time ) ) { return false ; } return $ this -> getDate ( ) -> sameValueAs ( $ date_time -> getDate ( ) ) && $ this -> getTime ( ) -> sameValueAs ( $ date_time -> getTime ( ) ) ; }
Tells whether two DateTime are equal by comparing their values
230,244
public function toNativeDateTime ( ) { $ year = $ this -> getDate ( ) -> getYear ( ) -> toNative ( ) ; $ month = $ this -> getDate ( ) -> getMonth ( ) -> getNumericValue ( ) ; $ day = $ this -> getDate ( ) -> getDay ( ) -> toNative ( ) ; $ hour = $ this -> getTime ( ) -> getHour ( ) -> toNative ( ) ; $ minute = $ this ...
Returns a native PHP \ DateTime version of the current DateTime .
230,245
public function setEnvironments ( $ env ) { $ envs = ( explode ( '+' , $ env ) ) ; while ( ! empty ( $ envs ) ) { $ _env = array_shift ( $ envs ) ; if ( ! $ this -> setEnvironment ( $ _env ) ) { $ msg = dt ( "Unable to locate an environment definition for '@env'." , [ '@env' => $ _env ] ) ; if ( empty ( $ envs ) ) { dr...
Load the desired environments .
230,246
private function setEnvironment ( $ env ) { if ( isset ( $ this -> environments [ $ env ] ) ) { $ this -> loadEnvironment ( $ env ) ; return TRUE ; } else { return FALSE ; } }
Load an individual environment definition .
230,247
public function exec ( $ groups = '' ) { $ _groups = ! empty ( $ groups ) ? explode ( ',' , $ groups ) : array ( ) ; $ names = implode ( '+' , array_keys ( $ this -> loadedEnvs ) ) ; drush_print ( ) ; drush_print ( $ this -> formatHeading ( dt ( "--- CONFIGURING @name ENVIRONMENT ---" , array ( '@name' => strtoupper ( ...
Apply the settings .
230,248
public function printSummary ( ) { drush_print ( ) ; drush_print ( $ this -> formatHeading ( 'Environment Definitions Found' ) ) ; foreach ( $ this -> loadedEnvs as $ filename ) { drush_print ( "{$filename}" , 1 ) ; } drush_print ( ) ; drush_print ( $ this -> formatHeading ( dt ( "CONFIGURATION SUMMARY" ) ) ) ; foreach...
Print a summary of the environment definitions .
230,249
private function printModuleSummary ( $ options , $ heading = '' ) { if ( ! empty ( $ options ) ) { drush_print ( "{$heading}" ) ; $ values = [ ] ; foreach ( $ options as $ status => $ modules ) { $ key = dt ( "!action" , [ '!action' => ucwords ( $ status ) ] ) ; $ value = implode ( ', ' , $ modules ) ; $ values [ $ ke...
Print a summary of the module section .
230,250
private function printPermissionSummary ( $ options , $ heading = '' ) { if ( ! empty ( $ options ) ) { drush_print ( "{$heading}" ) ; foreach ( $ options as $ role => $ perms ) { foreach ( $ options [ $ role ] as & $ grant ) { $ grant = ( $ grant == 0 ) ? dt ( 'revoke' ) : dt ( 'grant' ) ; } drush_print ( $ role , 1 )...
Print a summary of the permission section .
230,251
private function printCommandSummary ( $ options , $ heading = '' ) { if ( ! empty ( $ options ) ) { drush_print ( "{$heading}" ) ; foreach ( $ options as $ command => $ info ) { drush_print ( $ this -> formatCommand ( $ info ) , 1 ) ; } drush_print ( ) ; } }
Print a summary of the command section .
230,252
private function execVariables ( array $ options ) { foreach ( $ options as $ variable => $ value ) { if ( $ value === '[DELETE]' ) { variable_del ( $ variable ) ; drush_print ( dt ( "'@var' was deleted." , [ '@var' => $ variable ] ) ) ; } else { variable_set ( $ variable , $ value ) ; if ( is_scalar ( $ value ) ) { dr...
Set system variables .
230,253
public function formatHeading ( $ text , $ line_ending = ":" ) { $ green = "\033[1;32;40m\033[1m%s{$line_ending}\033[0m" ; $ heading = sprintf ( $ green , ucwords ( $ text ) ) ; return $ heading ; }
Format a nice readable heading for the user .
230,254
public function formatCommand ( $ info ) { $ parts = [ "drush" ] ; $ parts [ ] = $ info [ 'alias' ] ; if ( isset ( $ info [ 'options' ] [ 'yes' ] ) ) { $ parts [ ] = '-y' ; unset ( $ info [ 'options' ] [ 'yes' ] ) ; } $ parts [ ] = $ info [ 'name' ] ; if ( ! empty ( $ info [ 'args' ] ) ) { $ parts [ ] = implode ( ' ' ,...
Format a command as a single line .
230,255
private function loadEnvironment ( $ env ) { $ this -> exec = array_merge_recursive_distinct ( $ this -> exec , $ this -> environments [ $ env ] ) ; $ this -> loadedEnvs [ $ env ] = $ this -> exec [ 'filename' ] ; unset ( $ this -> exec [ 'filename' ] ) ; }
Load in an environment definition .
230,256
private function loadConfig ( ) { drush_log ( dt ( 'Loading config paths.' ) , 'debug' ) ; $ config_paths = [ $ this -> getSiteDir ( ) ] ; foreach ( $ this -> contexts as $ context ) { if ( $ files = _drush_config_file ( $ context , 'env' ) ) { if ( is_array ( $ files ) ) { foreach ( $ files as $ file ) { $ config_path...
Find the config paths to search for env definitions .
230,257
public function getSiteDir ( ) { if ( ! drush_has_boostrapped ( DRUSH_BOOTSTRAP_DRUPAL_SITE ) ) { return FALSE ; } $ site_name = drush_sitealias_bootstrapped_site_name ( ) ; $ alias = drush_sitealias_get_record ( "@{$site_name}" ) ; if ( floatval ( DRUSH_VERSION ) > 6.2 ) { $ site_path = drush_sitealias_local_site_path...
Get this site s appropriate drush directory for env vars .
230,258
private function findEnvironments ( ) { drush_log ( dt ( 'Loading environment files.' ) , 'debug' ) ; foreach ( $ this -> configPaths as $ path ) { drush_log ( dt ( "Scanning !path." , [ '!path' => $ path ] ) , 'debug' ) ; foreach ( drush_scan_directory ( $ path , '/env\.drushrc\.y(a)?ml/' ) as $ file ) { $ this -> loa...
Find and load environment definitions .
230,259
protected function loadEnvFile ( $ file ) { list ( $ name , , ) = explode ( '.' , $ file -> name ) ; $ this -> environments [ $ name ] = $ this -> extractEnv ( $ file -> filename ) ; $ this -> environments [ $ name ] [ 'filename' ] = $ this -> parseFilename ( $ file -> filename ) ; }
Extract the contents of an environment definition file .
230,260
private function parseFilename ( $ filename ) { if ( defined ( 'DRUPAL_ROOT' ) && stripos ( $ filename , DRUPAL_ROOT ) === 0 ) { return substr ( $ filename , strpos ( $ filename , DRUPAL_ROOT ) + strlen ( DRUPAL_ROOT ) + 1 ) ; } else { return $ filename ; } }
Resolve the proper filename for an environment file .
230,261
public function update ( $ name , $ email , $ mention_name , $ timezone = 'UTC' , $ is_group_admin = false , $ title = '' , $ password = null ) { $ queryParams = array ( 'name' => $ name , 'title' => $ title , 'mention_name' => $ mention_name , 'is_group_admin' => $ is_group_admin , 'timezone' => $ timezone , 'email' =...
Update user All values are required except password one which is optional!
230,262
protected function buildMap ( array $ metadata ) { $ className = $ this -> getMapClassName ( ) ; $ map = new $ className ( $ metadata [ 'class' ] ) ; foreach ( $ metadata [ 'definitions' ] as $ metadataDefinition ) { $ definition = $ this -> buildDefinition ( $ metadataDefinition ) ; $ map -> addDefinition ( $ definiti...
Build a Map
230,263
protected function buildDefinition ( array $ metadata ) { if ( ! isset ( $ metadata [ 'attribute' ] ) && ! isset ( $ metadata [ 'key' ] ) ) { throw new \ RuntimeException ( 'Invalid metadata should provide an attribute or a key' ) ; } if ( ! isset ( $ metadata [ 'key' ] ) ) { $ metadata [ 'key' ] = $ this -> formatter ...
Build a Definition
230,264
protected function clearExpired ( ) { if ( empty ( $ this -> cache ) ) { $ file = $ this -> directory . 'Cache.dat' ; if ( file_exists ( $ file ) ) { $ content = file_get_contents ( $ file ) ; if ( ! empty ( $ content ) ) { $ this -> cache = unserialize ( $ content ) ; } else { $ this -> cache = array ( ) ; } } } forea...
Clean Cache have expired .
230,265
public function get ( $ key ) { if ( ! $ this -> has ( $ key ) ) { return null ; } $ file = $ this -> directory . substr ( md5 ( $ this -> prefix ( ) . $ key ) , 0 , 10 ) . '.dat' ; return unserialize ( file_get_contents ( $ file ) ) ; }
Gets a value in the Cache for the specified key .
230,266
public function set ( $ key , $ value , $ lifeTime = 900 ) { if ( ! $ this -> isEnabled ( ) ) { return false ; } $ this -> clearExpired ( ) ; $ pKey = $ this -> prefix ( ) . $ key ; $ file = $ this -> directory . substr ( md5 ( $ pKey ) , 0 , 10 ) . '.dat' ; if ( ( bool ) file_put_contents ( $ file , serialize ( $ valu...
Sets a value in the Cache for the specified key .
230,267
public static function success ( $ code = '' , $ message = '' , $ errors = [ ] , $ extras = [ ] ) { return self :: loadResult ( self :: SUCCESS , $ code , $ message , $ errors , $ extras ) ; }
initiate a success result
230,268
public static function fail ( $ code = '' , $ message = '' , $ errors = [ ] , $ extras = [ ] ) { return self :: loadResult ( self :: FAIL , $ code , $ message , $ errors , $ extras ) ; }
initiate a fail result
230,269
protected static function loadResult ( $ status , $ code , $ message , $ errors , $ extras ) { $ Result = new static ( $ status ) ; if ( ! empty ( $ code ) ) { $ Result -> setCode ( $ code ) ; } if ( ! empty ( $ message ) ) { $ Result -> setMessage ( $ message ) ; } if ( ! empty ( $ errors ) ) { $ Result -> setErrors (...
load up the result object
230,270
public function addError ( $ error ) { if ( is_array ( $ error ) ) { $ this -> errors += $ error ; } else { $ this -> errors [ ] = $ error ; } return $ this ; }
add an error message to the list
230,271
public function getExtra ( $ key ) { if ( array_key_exists ( $ key , $ this -> extras ) ) { return $ this -> extras [ $ key ] ; } return false ; }
get individual extra items
230,272
public function label ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; return Html :: label ( $ model -> getLabel ( $ property ) , $ element [ 'id' ] , $ options ) ; }
Render label tag
230,273
protected function getField ( IFormModel $ model , $ property ) { $ cl = get_class ( $ model ) ; $ smallName = substr ( $ cl , strrpos ( $ cl , '\\' ) + 1 ) ; return [ 'id' => $ smallName . '_' . $ property , 'name' => $ smallName . '[' . $ property . ']' , 'value' => property_exists ( $ model , $ property ) ? $ model ...
Get model field data
230,274
public function hiddenField ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; return Html :: hiddenField ( $ element [ 'name' ] , $ element [ 'value' ] , $ options ) ; }
Render hidden field tag
230,275
protected function getBlock ( $ name , array & $ options ) { $ block = [ ] ; if ( array_key_exists ( $ name , $ options ) ) { $ block = $ options [ $ name ] ; unset ( $ options [ $ name ] ) ; } return $ block ; }
Get block from options
230,276
public function fileFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ property ...
Render file field row
230,277
public function imageFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ property...
Render image field row
230,278
public function imageField ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; $ image = ! empty ( $ options [ 'image' ] ) ? $ options [ 'image' ] : [ ] ; return Html :: imageField ( $ element [ 'name' ] , $ el...
Render image field tag
230,279
public function passwordFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ prope...
Render password field row
230,280
public function textAreaFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ prope...
Render textArea field row
230,281
public function textAreaField ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: textArea ( $ element [ 'name' ] , $ element [ 'value' ] , $ options ) ; }
Render textarea tag
230,282
public function checkboxFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ prope...
Render checkbox field row
230,283
public function listBoxFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ proper...
Render listBox field row
230,284
public function listBoxField ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; $ options [ 'selected' ] = $ element [ 'value' ] ; if ( empty ( $ options [ 'size' ] ) ) { $ options [ 'size' ] = 3 ; } return Ht...
Render list box tag
230,285
public function dropDownListField ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; if ( ! empty ( $ element [ 'value' ] ) ) { $ options [ 'selected' ] = $ element [ 'value' ] ; } return Html :: dropDownList ...
Render drop down list tag
230,286
public function checkBoxListField ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ checkboxes = ! empty ( $ options [ 'checkboxes' ] ) ? $ options [ 'checkboxes' ] : [ ] ; $ format = ! empty ( $ options [ 'format' ] ) ? $ options [ 'format' ] : '<...
Render check box list tag
230,287
public function radioButtonListField ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ radios = ! empty ( $ options [ 'radios' ] ) ? $ options [ 'radios' ] : [ ] ; $ format = ! empty ( $ options [ 'format' ] ) ? $ options [ 'format' ] : '<p>%radio%...
Render radio button list tag
230,288
public function colorFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ property...
Render color field row
230,289
public function dateTimeFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ prope...
Render datetime field row
230,290
public function dateTimeField ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: datetimeField ( $ element [ 'name' ] , $ element [ 'value' ] , $ options ) ; }
Render datetime field tag
230,291
public function dateTimeLocalFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ ...
Render datetime - local field row
230,292
public function dateTimeLocalField ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: datetimeLocalField ( $ element [ 'name' ] , $ element [ 'value' ] , $ options ) ; }
Render datetime - local field tag
230,293
public function emailFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ property...
Render email field row
230,294
public function rangeFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ property...
Render range field row
230,295
public function searchFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ propert...
Render search field row
230,296
public function telFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ property )...
Render telephone field row
230,297
public function telField ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: telField ( $ element [ 'name' ] , $ element [ 'value' ] , $ options ) ; }
Render telephone tag
230,298
public function timeFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ property ...
Render time field row
230,299
public function urlFieldRow ( IFormModel $ model , $ property , array $ options = [ ] ) { $ element = $ this -> getField ( $ model , $ property ) ; $ options [ 'id' ] = $ element [ 'id' ] ; return Html :: openTag ( 'div' , $ this -> getBlock ( 'block' , $ options ) ) . Html :: label ( $ model -> getLabel ( $ property )...
Render url field row