idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
4,200
public function showThreadMessages ( $ user_id , $ thread_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::showThreadMessages user_id field should be positive integer" ) ; } if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( ...
List all message one thread
4,201
public function showUsers ( $ limit = null , $ offset = null , $ filters = null , $ order = null ) { if ( $ limit != null && $ limit < 1 ) { throw new InvalidArgumentException ( "Api::who() limit must be a min 1 " ) ; } if ( $ offset != null && $ offset < 0 ) { throw new InvalidArgumentException ( "Api::who offset must...
Get all the users
4,202
public function showUser ( $ user_id ) { $ command = $ this -> client -> getCommand ( 'ShowUser' , array ( 'id' => $ user_id ) ) ; return $ this -> executeCommand ( $ command ) ; }
Show user by ID
4,203
public function getVisitorsOfUser ( $ user_id , $ limit = null ) { $ command = $ this -> client -> getCommand ( 'VisitorsOfUser' , array ( 'id' => $ user_id , 'limit' => $ limit ) ) ; return $ this -> executeCommand ( $ command ) ; }
Get visitor of a user by ID
4,204
public function updateUserCity ( $ user_id , $ country_id , $ city_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "addUserProfile user_id field should be positive integer" , 404 ) ; } $ command = $ this -> client -> getCommand ( 'UpdateUserCity' , array ( 'id' => $ use...
Update user city
4,205
public function showUserProfile ( $ user_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "ShowUserProfile user_id field should be positive integer" , 404 ) ; } $ command = $ this -> client -> getCommand ( 'ShowUserProfile' , array ( 'id' => $ user_id ) ) ; return $ this...
Show profile by user ID
4,206
public function addUserReports ( $ user_reported_id , $ reason ) { if ( ! is_numeric ( $ user_reported_id ) || 0 >= $ user_reported_id ) { throw new InvalidArgumentException ( "Api::addUserReports user_reported_id field should be positive integer" , 404 ) ; } if ( ! is_string ( $ reason ) || 0 >= strlen ( $ reason ) ) ...
Report a user
4,207
public function setUserNick ( $ user_id , $ nick ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::setUserNick user_id field should be positive integer" , 404 ) ; } if ( ! is_string ( $ nick ) || 0 >= strlen ( $ nick ) ) { throw new InvalidArgumentException ( "APi::set...
Set a nick to a user
4,208
public function delUserBlocked ( $ user_id , $ user_blocked_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "DeleteUserBlocked user_id field should be positive integer" , 404 ) ; } if ( ! is_numeric ( $ user_blocked_id ) || 0 >= $ user_blocked_id ) { throw new InvalidAr...
UnBlocked one user
4,209
public function showUserVisitors ( $ user_id , $ limit = 1 , $ offset = 0 ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::showUserVisitors user_id field should be positive integer" , 404 ) ; } if ( $ limit < 1 ) { throw new InvalidArgumentException ( "Api::showUserVi...
Show count visits on one profile and who visits of one profile
4,210
public function getCity ( $ city_id ) { $ command = $ this -> client -> getCommand ( 'getCity' , array ( 'id' => $ city_id ) ) ; return $ this -> executeCommand ( $ command ) ; }
Get city . Show data city by id
4,211
public function getCountry ( $ country_code ) { $ command = $ this -> client -> getCommand ( 'GetCountry' , array ( 'countryCode' => $ country_code ) ) ; return $ this -> executeCommand ( $ command ) ; }
Get country . Show data country by country_code
4,212
public function changeAvatar ( $ nick , $ id_avatar ) { if ( ! is_numeric ( $ id_avatar ) || 0 >= $ id_avatar ) { throw new InvalidArgumentException ( "RealtimeChangeAvatar id_avatar field should be positive integer" , 404 ) ; } if ( empty ( $ nick ) ) { throw new InvalidArgumentException ( "RealtimeChangeAvatar nick f...
Change the avatar of a nick
4,213
public static function getClientIp ( ) { if ( function_exists ( 'apache_request_headers' ) ) { $ headers = apache_request_headers ( ) ; } else { $ headers = $ _SERVER ; } if ( array_key_exists ( 'X-Forwarded-For' , $ headers ) && filter_var ( $ headers [ 'X-Forwarded-For' ] , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ) ) {...
^Get client IP
4,214
protected function write ( $ message , $ level = false ) { $ now = \ DateTime :: createFromFormat ( 'U.u' , number_format ( microtime ( true ) , 6 , '.' , '' ) ) ; $ line = array ( 'pid' => self :: $ pid , 'time' => $ now -> format ( "d/m/Y H:i:s.u" ) ) ; if ( $ level !== false ) { $ line [ '$level' ] = $ level ; } els...
Ecriture du message
4,215
protected function commit ( ) { $ rr = false ; if ( is_file ( $ this -> file ) ) { $ size = filesize ( $ this -> file ) ; if ( $ size > self :: MAXLOGSIZE ) { if ( is_file ( $ this -> file . '.1' ) ) { unlink ( $ this -> file . '.1' ) ; } rename ( $ this -> file , $ this -> file . '.1' ) ; } } else { $ rr = true ; } if...
Enregistrement du cache
4,216
protected static function getLevelAsInt ( $ p_level ) { switch ( $ p_level ) { case \ Psr \ Log \ LogLevel :: DEBUG : return 9 ; case \ Psr \ Log \ LogLevel :: INFO : return 8 ; case \ Psr \ Log \ LogLevel :: ALERT : return 7 ; case \ Psr \ Log \ LogLevel :: NOTICE : return 6 ; case \ Psr \ Log \ LogLevel :: WARNING : ...
Return logLevel as int
4,217
private function addValue ( $ field , $ value , $ arrayKey ) { $ name = ':' . $ arrayKey . $ field ; $ this -> names [ $ arrayKey ] [ $ field ] = $ name ; $ this -> parameters [ $ arrayKey ] [ $ field ] = $ value ; }
Add a value to the update statement . It is added as a placeholder to the values and the real value is added to the binding list
4,218
public function set ( UserInterface $ fromUser , UserInterface $ toUser ) { $ event = new ApplySuccessorEvent ( $ fromUser , $ toUser ) ; $ this -> dispatcher -> dispatch ( UserEvents :: APPLY_SUCCESSOR , $ event ) ; $ message = UsersMessage :: create ( sprintf ( 'Set "%s" as successor for "%s".' , $ toUser -> getUsern...
Set successor .
4,219
protected function hasMethodDocBlock ( File $ sniffedFile , $ indexOfFunctionToken ) { $ positionOfClosingDocBlock = $ sniffedFile -> findPrevious ( [ T_DOC_COMMENT_CLOSE_TAG ] , $ indexOfFunctionToken ) ; if ( $ positionOfClosingDocBlock === false ) { return false ; } $ positionAfterClosingDocBlock = $ positionOfClosi...
Checks for the existence of a method docblock .
4,220
public function setDefaultValue ( ? string $ defaultValue ) : Descriptor { $ this -> _defaultValue = ( null === $ defaultValue ) ? $ defaultValue : \ trim ( $ defaultValue ) ; return $ this ; }
Sets the default value of the described attribute .
4,221
public function validateValue ( $ value ) : bool { if ( false === $ this -> hasValidator ( ) ) { return true ; } return ( bool ) ( $ this -> _validator ) ( $ value ) ; }
Checks if the value is a valid value of this DSN argument .
4,222
public function loadInternal ( array $ configs , ContainerBuilder $ container ) : void { $ file = $ this -> getServiceName ( ) ; if ( ! file_exists ( $ file ) ) { throw new BadMethodCallException ( '"' . $ file . '" doesn\'t exist!' ) ; } $ parts = pathinfo ( $ file ) ; switch ( $ parts [ 'extension' ] ) { case 'xml' :...
Load services from yaml or xml file and store parameters .
4,223
protected function setConfigParameters ( array $ configs , ContainerBuilder $ container ) : void { foreach ( $ this -> getConfigParameters ( ) as $ parameter ) { $ keys = explode ( '.' , $ parameter ) ; $ value = $ configs ; foreach ( $ keys as $ key ) { $ value = $ value [ $ key ] ; } $ container -> setParameter ( $ t...
Store parameters into container .
4,224
public function isValid ( Request $ request ) { $ parsed = $ this -> parseRouteRequest ( $ request ) ; return $ this -> getBaseUri ( $ request ) !== null && preg_match ( '#^' . preg_quote ( rtrim ( $ this -> getBaseUri ( $ request ) , '/' ) , '#' ) . '#' , rtrim ( $ request -> getUri ( false ) , '/' ) ) && $ this -> ge...
Returns true if request matches route false if it doesn t
4,225
protected function update ( RecordInterface & $ user ) { $ this -> user = $ user ; $ this -> authorized = true ; $ _SESSION [ $ this -> identifier ( ) ] = serialize ( $ this -> user ) ; foreach ( self :: $ ancestors as & $ ancestor ) { $ ancestor -> user = & $ this -> user ; $ ancestor -> active = & $ this ; $ ancestor...
Update authorization status of all social services .
4,226
public function init ( array $ params = array ( ) ) { self :: $ ancestors [ $ this -> id ] = & $ this ; if ( ! $ this -> authorized ) { $ pointer = & $ _SESSION [ $ this -> identifier ( ) ] ; if ( isset ( $ pointer ) ) { $ this -> user = unserialize ( $ pointer ) ; $ this -> update ( $ this -> user ) ; } } if ( is_call...
Module initialization .
4,227
public function generatePassword ( $ length = 8 ) { $ password = '' ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ password .= rand ( 0 , 9 ) ; } return $ password ; }
Generic random password generator .
4,228
public function authorize ( RecordInterface & $ user ) { $ this -> user = & $ user ; $ this -> authorized = true ; $ _SESSION [ $ this -> identifier ( ) ] = serialize ( $ this -> user ) ; $ this -> active = & $ this ; $ this -> update ( $ this -> user ) ; return $ this -> authorized ; }
Finish authorization process and return asynchronous response .
4,229
public function deauthorize ( ) { foreach ( self :: $ ancestors as & $ ancestor ) { $ ancestor -> authorized = false ; unset ( $ ancestor -> user ) ; unset ( $ _SESSION [ $ ancestor -> identifier ( ) ] ) ; setcookie ( '_cookie_accessToken' ) ; } }
Initiate de - authorization process
4,230
public function config ( array $ config = [ ] ) : AbstractHandler { $ config = $ config + [ 'output' => '/tmp' , 'fileName' => 'log' ] ; $ this -> output = rtrim ( $ config [ 'output' ] , '/' ) . '/' . $ config [ 'fileName' ] . static :: LOG_EXT ; $ this -> validateOutput ( ) ; return $ this ; }
Configura el handler
4,231
protected function validateOutput ( ) : bool { $ dir = dirname ( $ this -> output ) ; if ( ! is_dir ( $ dir ) || ! is_writable ( $ dir ) ) { throw new DirOutputNotWritableException ( ) ; } if ( is_file ( $ this -> output ) && ! is_writable ( $ this -> output ) ) { throw new FileNotWritableException ( ) ; } return true ...
Valida el directorio de salida
4,232
public function updateFailedMessage ( $ number , $ message = null ) { if ( Lang :: has ( 'resource-controller.updatefailed' ) ) { return trans ( 'resource-controller.updatefailed' , [ 'number' => $ number , 'message' => $ message ] ) ; } return 'Operation failed while updating the record ' . $ number . ' with message: ...
Format the update failed message .
4,233
public function destroyFailedMessage ( $ number , $ message = null ) { if ( Lang :: has ( 'resource-controller.destroyfailed' ) ) { return trans ( 'resource-controller.destroyfailed' , [ 'number' => $ number , 'message' => $ message ] ) ; } return 'Operation failed while destroying the record ' . $ number . ' with mess...
Format the destroy failed message .
4,234
protected function initConfig ( ) { if ( ! ( $ this -> config instanceof Repository ) ) { $ filePath = $ this -> configPath ( ) ; if ( ! is_file ( $ filePath ) ) { throw new Exception ( "Application config file can not found({$filePath})." ) ; } $ this -> setConfig ( new Repository ( require $ filePath ) ) ; date_defau...
init config Repository
4,235
public function loadEnvironment ( ) { if ( is_file ( $ this -> getFullEnvFilePath ( ) ) ) { $ env = new DotEnv ( $ this -> basePath , $ this -> getEnvFile ( ) ) ; $ env -> load ( ) ; } }
load env from file do not override
4,236
public function overloadEnvironment ( ) { if ( is_file ( $ this -> getFullEnvFilePath ( ) ) ) { $ env = new DotEnv ( $ this -> basePath , $ this -> getEnvFile ( ) ) ; $ env -> overLoad ( ) ; } }
load env from file override
4,237
public function bootStrap ( ) { $ this -> initEnvironment ( ) ; $ this -> initConfig ( ) ; if ( 'testing' == env ( 'APP_ENV' ) ) { error_reporting ( - 1 ) ; ini_set ( 'display_errors' , 'On' ) ; } else { error_reporting ( E_ALL ) ; ini_set ( 'display_errors' , 'Off' ) ; } set_error_handler ( [ $ this , 'handleError' ] ...
boot strap application
4,238
protected function chopIndex ( $ uri ) { $ subStr = strtolower ( substr ( $ uri , 0 , 10 ) ) ; if ( "/index.php" == $ subStr ) { return ( strlen ( $ uri ) > 10 ? substr ( $ uri , 10 ) : '' ) ; } return $ uri ; }
chop index . php from uri
4,239
public function setConfigPath ( $ configPath ) { $ configPath = realpath ( $ configPath ) ; if ( is_file ( $ configPath ) ) { $ this -> configPath = $ configPath ; } }
set the config path
4,240
public static function getNbJours ( $ startDate = null , $ endDate = null , $ joursOuvres = true ) { $ nbJours = false ; if ( is_numeric ( $ startDate ) && is_numeric ( $ endDate ) ) { $ start = new Datetime ( $ startDate ) ; $ start -> set_jours_ouvres ( $ joursOuvres ) ; $ end = new Datetime ( $ endDate ) ; $ end -> ...
Calcule le nombre de jours entre 2 dates
4,241
public static function sql2date ( $ date , $ format = '%d/%m/%Y' ) { if ( empty ( $ date ) ) { return null ; } $ dt = new self ( ) ; $ dt -> set_date ( $ date ) ; return $ dt -> format ( $ format ) ; }
Converti une date au format str
4,242
public static function valid_date ( $ date = null , $ format = 'DD/MM/YYYY' ) { if ( $ date == null ) { return false ; } $ lendate = strlen ( $ date ) ; if ( $ lendate > 10 ) { $ date = substr ( $ date , 0 , 10 ) ; $ lendate = strlen ( $ date ) ; } if ( $ lendate >= 8 && $ lendate <= 10 ) { $ regexp = $ format ; $ rege...
Retourne si une date au format chaine est valide
4,243
public function set_date ( $ date = null ) { if ( is_null ( $ date ) ) { return $ this -> set_timestamp ( time ( ) ) ; } elseif ( is_numeric ( $ date ) ) { return $ this -> set_timestamp ( $ date ) ; } elseif ( is_a ( $ date , self :: class ) ) { return $ this -> set_date ( $ date -> format ( ) ) ; } elseif ( preg_matc...
Initialise l objet avec une date au format string
4,244
public function diff ( $ objcDateTime = null ) { if ( $ this -> time == null || $ objcDateTime == null || $ objcDateTime -> time == null ) { return false ; } $ d = clone $ this ; $ objcDateTime_clone = clone $ objcDateTime ; $ flag_jours_ouvres = ( $ d -> flag_jours_ouvres | $ objcDateTime_clone -> flag_jours_ouvres ) ...
Retourne le delai entre 2 date en jours
4,245
public function equals ( $ objcDateTime = null ) { if ( $ objcDateTime == null ) { return false ; } $ diff_year = $ this -> adate [ 'year' ] - $ objcDateTime -> adate [ 'year' ] ; $ diff_mon = $ this -> adate [ 'mon' ] - $ objcDateTime -> adate [ 'mon' ] ; $ diff_day = $ this -> adate [ 'mday' ] - $ objcDateTime -> ada...
Test si 2 cDateTime sont identiques
4,246
public function add_days ( $ days ) { if ( $ days < 0 ) { return $ this -> sub_days ( $ days * - 1 ) ; } if ( $ this -> flag_jours_ouvres == true ) { for ( $ d = 0 ; $ d < $ days ; ) { $ this -> time += self :: $ TIME2SEC [ 'd' ] ; $ this -> set_timestamp ( $ this -> time ) ; if ( $ this -> est_jours_ouvres ( ) ) { $ d...
Ajoute nb jours
4,247
public function add_hours ( $ hours ) { $ this -> time += $ hours * self :: $ TIME2SEC [ 'h' ] ; $ this -> set_timestamp ( $ this -> time ) ; return $ this ; }
Ajoute nb heures
4,248
public function add_min ( $ min ) { $ this -> time += $ min * self :: $ TIME2SEC [ 'm' ] ; $ this -> set_timestamp ( $ this -> time ) ; return $ this ; }
Ajoute nb minutes
4,249
public function add_month ( $ months ) { $ this -> time = strtotime ( "+$months months" , $ this -> time ) ; $ this -> set_timestamp ( $ this -> time ) ; return $ this ; }
Ajoute nb mois
4,250
public function sub_month ( $ months ) { $ this -> time = strtotime ( "-$months months" , $ this -> time ) ; $ this -> set_timestamp ( $ this -> time ) ; return $ this ; }
Retranche nb mois
4,251
public function rtl_layouts ( ) { if ( ! is_rtl ( ) ) { return ; } $ rtl_layouts = ( array ) apply_filters ( 'rock_layouts_rtl' , array ( 'two-column-default' => esc_html__ ( 'Two Columns: Sidebar | Content' , 'rock' ) , 'two-column-reversed' => esc_html__ ( 'Two Columns: Content | Sidebar' , 'rock' ) , 'three-column-d...
Alter some registered layouts when in RTL mode .
4,252
public function post_type_support ( ) { $ post_types = ( array ) apply_filters ( 'rock_layouts_post_types' , get_post_types ( array ( 'public' => true ) ) ) ; foreach ( $ post_types as $ post_type ) { add_post_type_support ( $ post_type , 'rock-layouts' ) ; } }
Add post type support .
4,253
public function admin_enqueue_scripts ( $ hook ) { if ( ! in_array ( $ hook , array ( 'post.php' , 'post-new.php' ) ) ) { return ; } $ rtl = is_rtl ( ) ? '-rtl' : '' ; $ suffix = SCRIPT_DEBUG ? '' : '.min' ; wp_enqueue_script ( 'rock-layouts' , get_template_directory_uri ( ) . "/assets/js/admin/layouts{$suffix}.js" , a...
Enqueue scripts and styles for post meta box .
4,254
public function add_meta_box ( $ post_type , WP_Post $ post ) { if ( ! post_type_supports ( $ post_type , 'rock-layouts' ) || ! current_user_can ( 'edit_post_meta' , $ post -> ID ) || ! current_user_can ( 'add_post_meta' , $ post -> ID ) || ! current_user_can ( 'delete_post_meta' , $ post -> ID ) ) { return ; } add_met...
Add post meta box for custom layouts .
4,255
public function render_meta_box ( WP_Post $ post , $ box ) { $ cur_layout = $ this -> get_post_layout ( $ post -> ID ) ; $ has_custom = ! empty ( $ cur_layout ) ; wp_nonce_field ( basename ( __FILE__ ) , 'rock-layout-nonce' ) ; ?> <div class="rock-layout"> <p> <label for="rock-layout-use-default"> <input type=...
Display the custom layouts post meta box .
4,256
public function print_layout_choices ( $ layouts , $ post_id = null , $ cur_layout = null , $ has_custom = true ) { global $ wp_customize ; $ global_layout = $ this -> get_global_layout ( ) ; if ( ! $ cur_layout ) { $ cur_layout = $ global_layout ; } $ name = isset ( $ wp_customize ) ? '_customize-radio' : 'rock' ; ?> ...
Print all layouts choices to meta - box or customizer
4,257
public function save_post ( $ post_id ) { if ( empty ( $ _POST [ 'rock-layout-nonce' ] ) || ! wp_verify_nonce ( $ _POST [ 'rock-layout-nonce' ] , basename ( __FILE__ ) ) ) { return ; } $ override = ! empty ( $ _POST [ 'rock-layout-override' ] ) ; $ current = $ this -> get_post_layout ( $ post_id ) ; if ( ! $ override &...
Save layout post meta .
4,258
public function customize_register ( WP_Customize_Manager $ wp_customize ) { $ wp_customize -> add_section ( 'layout' , array ( 'title' => esc_html__ ( 'Layout' , 'rock' ) , 'priority' => 30 , 'capability' => 'edit_theme_options' , ) ) ; if ( ! $ this -> page_widths ) { return ; } reset ( $ this -> page_widths ) ; $ wp...
Register custom layout settings .
4,259
public function body_class ( array $ classes ) { $ classes [ ] = sanitize_html_class ( sprintf ( 'layout-%s' , $ this -> get_current_layout ( ) ) ) ; $ classes [ ] = rock_is_fluid_width ( ) ? 'no-max-width' : null ; return array_filter ( $ classes ) ; }
Add layout class to body element on the front - end .
4,260
protected function get_post_id ( $ post = null ) { return is_a ( 'WP_Post' , $ post ) ? $ post -> ID : ( is_numeric ( $ post ) ? absint ( $ post ) : get_queried_object_id ( ) ) ; }
Return a post ID .
4,261
public function get_current_layout ( $ post = null ) { $ override = $ this -> get_post_layout ( $ post ) ; $ layout = ( $ override ) ? $ override : $ this -> get_global_layout ( ) ; $ layout = ( string ) apply_filters ( 'rock_current_layout' , $ layout , $ post ) ; return $ this -> layout_exists ( $ layout ) ? $ layout...
Return the current layout .
4,262
public function getData ( $ uri , $ options = [ ] ) { return json_decode ( $ this -> request ( 'GET' , $ uri , $ options ) -> getBody ( ) -> getContents ( ) ) ; }
Quickly Grab Data .
4,263
public function generate ( ) { $ alphabet = '' ; if ( strpos ( $ this -> available_sets , 'l' ) !== false ) { $ alphabet .= $ this -> lowercase ; } if ( strpos ( $ this -> available_sets , 'u' ) !== false ) { $ alphabet .= $ this -> uppercase ; } if ( strpos ( $ this -> available_sets , 'd' ) !== false ) { $ alphabet ....
Generates random password and returns it
4,264
public function make ( array $ configArr ) : ContainerInterface { $ this -> container = $ this -> initObjectWithCheck ( $ configArr [ 'serviceContainer' ] , ContainerInterface :: class , $ this -> makeConstructParams ( $ configArr [ 'serviceContainer' ] ) ) ; $ this -> registerServices ( $ configArr [ 'services' ] ) ; ...
Instantiates the container and registers the services .
4,265
private function makeConstructParams ( $ class ) { $ params = [ ] ; $ reflectionClass = new \ ReflectionClass ( $ class ) ; if ( $ reflectionClass -> getConstructor ( ) ) { foreach ( $ reflectionClass -> getConstructor ( ) -> getParameters ( ) as $ param ) { $ type = $ param -> getClass ( ) -> name ; $ params [ ] = new...
Returns instantiated constructor params for a class .
4,266
public function registerServices ( array $ serviceClosureArr ) : void { foreach ( $ serviceClosureArr as $ closure ) { $ reflection = new \ ReflectionFunction ( $ closure ) ; $ arguments = $ reflection -> getParameters ( ) ; if ( ! $ closure instanceof \ Closure || count ( $ arguments ) !== 1 ) { throw new \ Exception ...
Runs the container through the configurator .
4,267
private function setConfigToConfiguratorService ( array $ configArr ) : void { $ config = $ this -> container -> get ( ConfigInterface :: class ) ; $ config -> setConfig ( $ configArr ) ; }
Takes the configuration array and sets it to the configurator service .
4,268
private function initObjectWithCheck ( string $ class , string $ expected , array $ params = [ ] ) { $ reflectionClass = new \ ReflectionClass ( $ class ) ; $ instance = $ reflectionClass -> newInstanceArgs ( $ params ) ; if ( ! $ instance instanceof $ expected ) { throw new \ InvalidArgumentException ( "Provided servi...
Safely instantiates a class object with a type check and optional constructor parameters .
4,269
public function userExit ( ) { if ( isset ( $ _SESSION [ 'auth' ] ) ) { $ load_session = R :: findOne ( 'authorization' , 'token = ?' , array ( $ _SESSION [ 'auth' ] [ 'token' ] ) ) ; if ( $ load_session ) { R :: trash ( $ load_session ) ; } } unset ( $ _SESSION [ 'auth' ] ) ; if ( isset ( $ _COOKIE [ 'auth' ] ) ) { se...
If user LogOut or delete all data auth from table auth
4,270
public function signUp ( ) { if ( isset ( $ _POST [ 'signUp' ] ) ) { if ( $ _POST [ 'name' ] == '' || $ _POST [ 'email' ] == '' || $ _POST [ 'password' ] == '' || $ _POST [ 'confirmPassword' ] == '' ) { $ this -> errors [ ] = 'Fill in all the fields' ; } if ( R :: count ( 'users' , 'name = ?' , array ( $ _POST [ 'name'...
Register new User
4,271
public function requestReset ( ) { if ( isset ( $ _POST [ 'requestReset' ] ) ) { if ( $ _POST [ 'email' ] == '' ) { $ this -> errors [ ] = 'Input Email!' ; } if ( ! R :: count ( 'users' , 'email = ?' , array ( $ _POST [ 'email' ] ) ) ) { $ this -> errors [ ] = 'This account not found!' ; } if ( empty ( $ this -> errors...
Reset password verify email
4,272
public function setAllowedMimeTypes ( $ types = '*' ) { if ( is_string ( $ types ) ) { if ( '*' !== $ types ) { $ types = ( array ) $ types ; } else { $ this -> allowedTypes = $ types ; return $ this ; } } if ( is_array ( $ types ) ) { $ this -> allowedTypes = $ types ; return $ this ; } else { return false ; } }
Kabul edilen dosya tipleri tutulur
4,273
public function check ( $ file = '' ) { $ types = $ this -> getAllowedMimeTypes ( ) ; if ( $ types === '*' ) { return true ; } $ fileMimeType = $ this -> getFileMimeType ( ) ; foreach ( $ types as $ type ) { if ( $ type === $ fileMimeType ) { return true ; } else { continue ; } } return false ; }
Dosya tipini kontrol eder
4,274
public function getArray ( $ prop ) { $ val = $ this -> get ( $ prop ) ; if ( is_array ( $ val ) ) { return $ val ; } else { return null ; } }
Get array value from the Store
4,275
public function getString ( $ prop ) { $ val = $ this -> get ( $ prop ) ; if ( is_string ( $ val ) ) { return strval ( $ val ) ; } else { return null ; } }
Get string value from the Store
4,276
public function getInt ( $ prop ) { $ val = $ this -> get ( $ prop ) ; if ( is_numeric ( $ val ) ) { return intval ( $ val ) ; } else { return null ; } }
Get int value from the Store
4,277
public function getFloat ( $ prop ) { $ val = $ this -> get ( $ prop ) ; if ( is_numeric ( $ val ) ) { return floatval ( $ val ) ; } else { return null ; } }
Get float value from the Store
4,278
public function getBool ( $ prop ) { $ val = $ this -> get ( $ prop ) ; if ( $ val === 'false' ) { $ val = false ; } elseif ( $ val === 'true' ) { $ val = true ; } elseif ( $ val === 1 || $ val === '1' ) { $ val = true ; } elseif ( $ val === 0 || $ val === '0' ) { $ val = false ; } if ( is_bool ( $ val ) ) { return $ v...
Get boolean value from the Store
4,279
public function build ( ) { $ files = $ this -> filesystem -> listFiles ( $ this -> directory , $ this -> recursive ) ; $ this -> cache -> clear ( ) ; foreach ( $ files as $ file ) { $ entity = $ this -> parseFile ( $ file ) ; if ( $ entity != null ) $ this -> cache -> put ( $ entity -> getIdentifier ( ) , $ entity ) ;...
Build the cache
4,280
public static function RoutesMiddleware ( $ name ) { if ( ! self :: existsRoutesMiddleware ( $ name ) ) { throw new MiddlewareNotFoundException ( $ name ) ; } $ middleware = self :: allRoutesMiddleware ( ) ; return array_get ( $ middleware , $ name ) ; }
Get routes middleware .
4,281
public function moveFile ( $ source , $ destination ) { $ result = copy ( $ source , $ destination ) ; if ( TRUE === $ result ) { $ this -> deleteFile ( $ source ) ; } return $ result ; }
Moves a file from source to destination .
4,282
public function copyDirectory ( $ source , $ destination , $ recursive = TRUE ) { $ result = FALSE ; if ( ! file_exists ( $ destination ) ) { $ this -> createDirectory ( $ destination ) ; } try { foreach ( scandir ( $ source ) as $ file ) { if ( '.' === $ file || '..' === $ file ) { continue ; } if ( is_dir ( $ source ...
Copies a directory from source to destination .
4,283
public function moveDirectory ( $ source , $ destination ) { $ path = explode ( DS , $ source ) ; $ destination = $ destination . DS . $ path [ count ( $ path ) - 1 ] ; $ result = $ this -> copyDirectory ( $ source , $ destination , TRUE ) ; if ( TRUE === $ result ) { $ result = $ this -> deleteDirectory ( $ source ) ;...
Moves a directory from source to destination .
4,284
public function deleteDirectory ( $ path , $ strict = FALSE ) { if ( ! file_exists ( $ path ) ) { if ( $ strict ) { $ result = FALSE ; } $ result = TRUE ; } else { try { foreach ( scandir ( $ path ) as $ file ) { if ( '.' === $ file || '..' === $ file ) { continue ; } if ( is_dir ( $ path . DS . $ file ) ) { $ this -> ...
Deletes a directory and all its contents .
4,285
public function parseDirectory ( $ path = NULL , $ levels = NULL ) { if ( NULL !== $ levels ) { $ this -> levels = $ levels ; } $ this -> _runParse ( $ path ) ; $ this -> _setResults ( ) ; return $ this -> results ; }
Parses the directory and returns lists of directories files and links .
4,286
private function _runParse ( $ path = NULL ) { $ startLevels = $ this -> _getRealLevel ( $ this -> _rootPath ) ; $ endLevels = $ startLevels + $ this -> levels ; $ currentLevel = 0 ; if ( NULL !== $ path ) { $ this -> _dirs [ ] = $ path ; } do { $ dir = array_shift ( $ this -> _dirs ) ; $ currentLevel = $ this -> _getR...
Runs the directory parsing process .
4,287
private function _parse ( $ dir ) { foreach ( scandir ( $ dir ) as $ file ) { if ( '.' === $ file || '..' === $ file ) { continue ; } if ( is_dir ( $ dir . DS . $ file ) ) { $ this -> _dirs [ ] = $ dir . DS . $ file ; $ this -> dirHandles [ ] = $ dir . DS . $ file ; } elseif ( 'file' === filetype ( $ dir . DS . $ file ...
Recursively parses the directory and adds directories files and links to their corresponding handles .
4,288
private function _setResults ( $ extended = TRUE ) { $ this -> results = [ ] ; $ this -> results [ 'file_count' ] = count ( $ this -> fileHandles ) ; $ this -> results [ 'dir_count' ] = count ( $ this -> dirHandles ) ; $ this -> results [ 'link_count' ] = count ( $ this -> linkHandles ) ; if ( $ extended ) { $ this -> ...
Sets the parse results ready for returning .
4,289
function display ( $ tpl = null ) { $ input = JFactory :: getApplication ( ) -> input ; $ htmlResponse = $ input -> getRaw ( "response" ) ; $ emitter = new \ Zend \ Diactoros \ Response \ SapiEmitter ( ) ; $ emitter -> emit ( $ htmlResponse ) ; if ( ! is_null ( $ input -> get ( "mouflaJson" ) ) && $ input -> get ( "mou...
Overwriting JView display method
4,290
public function post ( Request $ request ) { $ id = $ request -> attributes -> get ( 'id' ) ; $ token = Arr :: get ( $ this -> getContentAsArray ( $ request ) , 'token' ) ; if ( ! $ token ) { return $ this -> createSimpleResponse ( 422 , 'Token not specified.' ) ; } $ conditions = [ 'user_id' => $ id , 'token' => $ tok...
Verify user registration with token and user id
4,291
protected function registerMediaConversionsFromTheme ( ) { $ namespace = ( new ReflectionClass ( $ this ) ) -> getNamespaceName ( ) ; $ className = strtolower ( explode ( '\\' , $ namespace ) [ 1 ] ) ; $ themeOptions = app ( 'setting.themeOptions' ) -> getOption ( "{$className}.medialibrary" ) ; if ( ! $ themeOptions )...
register MediaConversions defined in the themes . json file .
4,292
public function defaultMediaConversions ( ) { $ this -> addMediaConversion ( 'thumbnail-square' ) -> setManipulations ( [ 'w' => 256 , 'h' => 256 , 'fit' => 'crop' ] ) -> performOnCollections ( 'images' ) ; $ this -> addMediaConversion ( 'thumbnail-small' ) -> setManipulations ( [ 'w' => 250 , 'h' => 250 , 'fit' => 'ma...
Default MediaConversions for all Entity .
4,293
public static function setNamespace ( JinitializeCommand $ command ) { $ name = $ command -> getName ( ) ; $ plugin = $ command -> getPluginName ( ) ; $ command -> setName ( self :: commandSignatureFor ( $ plugin , $ name ) ) ; return $ command ; }
Make sure that the namespace before command matches that of the plugin of the command .
4,294
public function getDefaultOwnerAttributeValue ( ) { if ( Yii :: $ app -> has ( 'user' ) ) { $ userId = Yii :: $ app -> get ( 'user' ) -> id ; if ( $ userId === null ) { throw new InvalidValueException ( 'Empty owner ID' ) ; } return $ userId ; } }
Get owner attribute value . Logined user id by default .
4,295
public function toUriString ( Authority $ authority = null ) { $ path_string = parent :: toUriString ( ) ; if ( ! empty ( $ this -> data ) ) { $ path_string = $ this -> normalizePathWithAuthority ( $ authority ) ; } return $ path_string ; }
Returns a string representation of the path formatted so that it can be compiled into a complete URI string per the Uri object s string specification .
4,296
public static function validatePathAgainstAuthority ( $ path_string , Authority $ authority = null ) { self :: checkPathIsString ( $ path_string ) ; if ( ! empty ( ( string ) $ path_string ) && ! empty ( ( string ) $ authority ) ) { return self :: startsWithSlash ( $ path_string ) ; } return true ; }
Validates whether a given path string conforms to the URI specification for a path provided an optional authority . If a non - empty path is provide along with a non - empty authority the path must begin with a slash .
4,297
private static function startsWithSlash ( $ path ) { self :: checkPathIsString ( $ path ) ; $ path = new StringHelper ( $ path ) ; return $ path -> startsWith ( "/" ) ; }
Checks whether a given path string starts with a slash .
4,298
private function normalizePathWithAuthority ( Authority $ authority = null ) { $ path_string = $ this -> collapseStartingSlashes ( $ this -> data , $ authority ) ; $ path_string = new StringHelper ( $ path_string ) ; if ( ! empty ( ( string ) $ authority ) ) { if ( ! $ path_string -> startsWith ( "/" ) ) { $ path_strin...
Determines whether a given authority should begin with a slash provided an Authority .
4,299
private function collapseStartingSlashes ( $ path_string , Authority $ authority = null ) { $ path_string = new StringHelper ( $ path_string ) ; if ( empty ( ( string ) $ authority ) ) { $ path_string = $ path_string -> collapseStartingRepetition ( "/" ) ; } return ( string ) $ path_string ; }
Collapses starting slashes within a path if necessary given rules associated with an optional Authority .