idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
49,300 | 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 . |
49,301 | 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 . |
49,302 | 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 . |
49,303 | 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 . |
49,304 | 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 . |
49,305 | 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 |
49,306 | 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 |
49,307 | public function updateAttr ( $ key , $ value ) { if ( isset ( $ _SESSION [ $ key ] ) ) { $ _SESSION [ $ key ] = $ value ; return true ; } else { return false ; } } | Modifie un attribut de la session |
49,308 | 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 |
49,309 | 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 |
49,310 | 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 |
49,311 | 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 . |
49,312 | 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 . |
49,313 | 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 |
49,314 | 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 . |
49,315 | 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 . |
49,316 | private function setEnvironment ( $ env ) { if ( isset ( $ this -> environments [ $ env ] ) ) { $ this -> loadEnvironment ( $ env ) ; return TRUE ; } else { return FALSE ; } } | Load an individual environment definition . |
49,317 | 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 . |
49,318 | 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 . |
49,319 | 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 . |
49,320 | 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 . |
49,321 | 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 . |
49,322 | 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 . |
49,323 | 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 . |
49,324 | 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 . |
49,325 | 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 . |
49,326 | 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 . |
49,327 | 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 . |
49,328 | 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 . |
49,329 | 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 . |
49,330 | 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 . |
49,331 | 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! |
49,332 | 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 |
49,333 | 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 |
49,334 | 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 . |
49,335 | 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 . |
49,336 | 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 . |
49,337 | public static function success ( $ code = '' , $ message = '' , $ errors = [ ] , $ extras = [ ] ) { return self :: loadResult ( self :: SUCCESS , $ code , $ message , $ errors , $ extras ) ; } | initiate a success result |
49,338 | public static function fail ( $ code = '' , $ message = '' , $ errors = [ ] , $ extras = [ ] ) { return self :: loadResult ( self :: FAIL , $ code , $ message , $ errors , $ extras ) ; } | initiate a fail result |
49,339 | 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 |
49,340 | public function addError ( $ error ) { if ( is_array ( $ error ) ) { $ this -> errors += $ error ; } else { $ this -> errors [ ] = $ error ; } return $ this ; } | add an error message to the list |
49,341 | public function getExtra ( $ key ) { if ( array_key_exists ( $ key , $ this -> extras ) ) { return $ this -> extras [ $ key ] ; } return false ; } | get individual extra items |
49,342 | 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 |
49,343 | 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 |
49,344 | 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 |
49,345 | 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 |
49,346 | 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 |
49,347 | 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 |
49,348 | 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 |
49,349 | 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 |
49,350 | 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 |
49,351 | 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 |
49,352 | 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 |
49,353 | 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 |
49,354 | 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 |
49,355 | 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 |
49,356 | 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 |
49,357 | 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 |
49,358 | 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 |
49,359 | 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 |
49,360 | 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 |
49,361 | 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 |
49,362 | 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 |
49,363 | 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 |
49,364 | 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 |
49,365 | 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 |
49,366 | 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 |
49,367 | 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 |
49,368 | 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 |
49,369 | 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 |
49,370 | public function monthFieldRow ( 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 month field row |
49,371 | public function weekFieldRow ( 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 week field row |
49,372 | public static function makeFile ( $ file , $ chmod = 0777 , $ touchTime = null ) { if ( ! file_exists ( $ file ) ) { if ( ! is_dir ( dirname ( $ file ) ) ) { mkdir ( dirname ( $ file ) , 0777 , true ) ; } $ h = fopen ( $ file , 'w' ) ; if ( $ h ) { fclose ( $ h ) ; } unset ( $ h ) ; if ( null !== $ touchTime ) { touch ... | Recursively generate directories if not existent and place a empty file inside it . |
49,373 | public static function normalizeUrl ( $ url ) { if ( ! class_exists ( 'URLNormalizer' ) ) { require_once ( realpath ( __DIR__ . '/../../classes' ) . '/URLNormalizer.php' ) ; } $ un = new \ URLNormalizer ( ) ; $ un -> setUrl ( $ url ) ; return $ un -> normalize ( ) ; } | Use Glen Scotts UrlNormalizer to normalize the passed url . |
49,374 | public static function encrypt ( $ string , $ key ) { $ result = '' ; for ( $ i = 0 ; $ i < strlen ( $ string ) ; $ i ++ ) { $ char = substr ( $ string , $ i , 1 ) ; $ keychar = substr ( $ key , ( $ i % strlen ( $ key ) ) - 1 , 1 ) ; $ char = chr ( ord ( $ char ) + ord ( $ keychar ) ) ; $ result .= $ char ; } return ba... | Basic encryption method . |
49,375 | public static function decrypt ( $ string , $ key ) { $ result = '' ; $ string = base64_decode ( $ string ) ; for ( $ i = 0 ; $ i < strlen ( $ string ) ; $ i ++ ) { $ char = substr ( $ string , $ i , 1 ) ; $ keychar = substr ( $ key , ( $ i % strlen ( $ key ) ) - 1 , 1 ) ; $ char = chr ( ord ( $ char ) - ord ( $ keycha... | Basic decryption method . |
49,376 | public static function getPathsBase ( & $ a , & $ b , $ modify = false , $ DS = DIRECTORY_SEPARATOR ) { if ( $ modify ) { $ str1 = & $ a ; $ str2 = & $ b ; } else { $ str1 = $ a ; $ str2 = $ b ; } $ str1 = explode ( $ DS , self :: unify_slashes ( $ str1 , $ DS ) ) ; $ str2 = explode ( $ DS , self :: unify_slashes ( $ s... | Return the folder on with the both given paths split . |
49,377 | public static function buildDir ( $ path , $ chmod = 0775 ) { deprecated ( 'mkdir($dir, null, true);' ) ; if ( is_dir ( $ path ) ) { return true ; } $ dir = DIRECTORY_SEPARATOR ; foreach ( explode ( DIRECTORY_SEPARATOR , self :: unify_slashes ( $ path , DIRECTORY_SEPARATOR , true ) ) as $ f ) { if ( empty ( $ f ) ) { c... | Checks if the given Path is existent and generates missing folders . |
49,378 | public static function arrayWrap ( $ input , $ wrap ) { $ w1 = '' ; $ w2 = '' ; if ( is_array ( $ wrap ) ) { $ w1 = $ wrap [ 0 ] ; if ( isset ( $ wrap [ 1 ] ) ) { $ w2 = $ wrap [ 1 ] ; } } elseif ( ! is_string ( $ wrap ) ) { throw new \ Exception ( sprintf ( 'Invalid Type %s for $wrap' , gettype ( $ wrap ) ) , 1 ) ; re... | Wrap each entry of an array |
49,379 | public static function post ( $ url , $ params ) { if ( ! is_array ( $ params ) ) { $ params = self :: ar ( $ params ) ; } $ query = http_build_query ( $ params ) ; $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_POST , count ( $ params ) ) ; curl_setopt ( $ ch , CURLOPT... | Performs a post request to given url passing given parameters . |
49,380 | public static function ar ( $ a , $ b = null , $ deep = false ) { $ r = array ( ) ; if ( is_array ( $ a ) || is_object ( $ a ) ) { foreach ( $ a as $ k => $ v ) { if ( $ deep == true && ( is_array ( $ v ) || is_object ( $ v ) ) ) { $ v = self :: ar ( $ v , null , true ) ; } $ r [ $ k ] = $ v ; } } elseif ( is_string ( ... | Converts arrays objects integers or strings into arrays . |
49,381 | public static function pq ( $ html , $ contentType = null ) { self :: initPhpQuery ( ) ; return \ phpQuery :: newDocument ( $ html , $ contentType ) ; } | Sets a new DOM for PHPQuery . |
49,382 | public static function switchVars ( array $ vars ) { $ i = 0 ; foreach ( $ vars as $ k => $ v ) { if ( $ i == 0 ) { $ pk = $ k ; $ pv = $ v ; } else { return array ( $ pk => $ v , $ k => $ pv ) ; } $ i ++ ; } } | Switches the first two variables of an array while leaving its keys . |
49,383 | public static function get_randomString ( $ length = 12 , $ type = 'pAan' , $ additional = '' ) { $ sources = array ( 'p' => '!#$%&()=?*+-_:.;,<>' , 'a' => 'abcdefghijklmnopqrstuvwxyz' , 'A' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' , 'n' => '1234567890' ) ; $ source = '' ; foreach ( $ sources as $ k => $ s ) { if ( strstr ( $ t... | Generates a passwordish random string |
49,384 | public static function get_browserObj ( ) { if ( ! class_exists ( '\Ikimea\Browser\Browser' ) ) { throw new THETOOLSException ( "Browser Class could not be loaded" ) ; } if ( self :: $ s_BrowserObj === null ) { self :: $ s_BrowserObj = new \ Ikimea \ Browser \ Browser ; self :: $ s_browserVersion = self :: $ s_BrowserO... | Generates and caches the Browser - Object |
49,385 | public static function minify ( $ string , $ noSpace = false ) { $ string = preg_replace ( "/\s+/" , ' ' , $ string ) ; return $ noSpace ? str_replace ( ' ' , '' , $ string ) : $ string ; } | deletes linebreaks and tabs from string |
49,386 | public static function replace_subdomain ( $ url , $ newSubdomain ) { $ url = parse_url ( $ url ) ; if ( substr_count ( $ url [ 'host' ] , '.' ) >= 2 ) { $ url [ 'host' ] = ( str_replace ( substr ( $ url [ 'host' ] , 0 , strpos ( $ url [ 'host' ] , '.' ) ) , $ newSubdomain , $ url [ 'host' ] ) ) ; } else { $ url [ 'hos... | Replaces the subdomain of given url or adds it . |
49,387 | public static function unparse_url ( $ parsedUrl ) { $ scheme = isset ( $ parsedUrl [ 'scheme' ] ) ? $ parsedUrl [ 'scheme' ] . '://' : '' ; $ host = isset ( $ parsedUrl [ 'host' ] ) ? $ parsedUrl [ 'host' ] : '' ; $ port = isset ( $ parsedUrl [ 'port' ] ) ? ':' . $ parsedUrl [ 'port' ] : '' ; $ user = isset ( $ parsed... | reverses the result array of parse_url into an url string . |
49,388 | public static function get_currentUrl ( $ filter = array ( ) , $ queryFilter = array ( ) , $ queryFilterMethod = 'remove' ) { if ( ! is_array ( $ filter ) && ! empty ( $ filter ) ) { $ filter = array ( $ filter ) ; } if ( ! empty ( self :: $ fakeCurrentUrl ) ) { $ pageURL = self :: $ fakeCurrentUrl ; } else { $ pageURL... | curPageURL returns the current url |
49,389 | public static function recursive_get ( $ obj , $ path ) { foreach ( explode ( '|' , $ path ) as $ key ) { if ( is_object ( $ obj ) ) { if ( isset ( $ obj -> $ key ) ) { $ obj = $ obj -> $ key ; } else { return null ; } } elseif ( isset ( $ obj [ $ key ] ) ) { $ obj = $ obj [ $ key ] ; } else { return null ; } } return ... | Handy function to dive into an array or object without knowing what it is nested keys can be separated by a pipe so it s possible to get a deeper key with only one call |
49,390 | public static function recursive_unset ( & $ obj , $ path ) { $ i = 1 ; foreach ( ( $ l = explode ( '|' , $ path ) ) as $ key ) { if ( is_object ( $ obj ) ) { if ( isset ( $ obj -> $ key ) ) { if ( count ( $ l ) === $ i ) { unset ( $ obj -> $ key ) ; return true ; } $ obj = & $ obj -> $ key ; } else { return false ; } ... | Handy function to unset a deep value of a class or an array . |
49,391 | public static function unSlash ( $ str , $ unify = false ) { return self :: _slash ( $ str , '/' , false , false , $ unify ) ; } | remove potential slash from the end of the string . |
49,392 | public static function unDS ( $ str , $ unify = false ) { return self :: _slash ( $ str , DIRECTORY_SEPARATOR , false , false , $ unify ) ; } | remove potential DIRECTORY_SEPARATOR from the end of the string . |
49,393 | public static function unBackSlash ( $ str , $ unify = false ) { return self :: _slash ( $ str , '\\' , false , false , $ unify ) ; } | remove potential backslash from the end of the string . |
49,394 | public static function slash ( $ str , $ unify = false ) { return self :: _slash ( $ str , '/' , false , true , $ unify ) ; } | add slash to the end of the string . |
49,395 | public static function DS ( $ str , $ unify = false ) { return self :: _slash ( $ str , DIRECTORY_SEPARATOR , false , true , $ unify ) ; } | add DIRECTORY_SEPARATOR to the end of the string . |
49,396 | public static function backSlash ( $ str , $ unify = false ) { return self :: _slash ( $ str , '\\' , false , true , $ unify ) ; } | add backslash to the end of the string . |
49,397 | public static function unPreSlash ( $ str , $ unify = false ) { return self :: _slash ( $ str , '/' , true , false , $ unify ) ; } | remove potential slash from the front of the string . |
49,398 | public static function unPreDS ( $ str , $ unify = false ) { return self :: _slash ( $ str , DIRECTORY_SEPARATOR , true , false , $ unify ) ; } | remove potential DIRECTORY_SEPARATOR from the front of the string . |
49,399 | public static function unPreBackSlash ( $ str , $ unify = false ) { return self :: _slash ( $ str , '\\' , true , false , $ unify ) ; } | remove potential backslash from the front of the string . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.