idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
49,900
public static function siteBaseUrl ( ) { $ base_url = self :: requestInstance ( ) -> getDeterminedScheme ( ) . '://' . self :: requestInstance ( ) -> getServerName ( ) . ':' . self :: requestInstance ( ) -> getServerPort ( ) . self :: getBase ( ) ; return $ base_url ; }
Return site base URL .
49,901
public static function getFirstSegment ( $ segments ) { if ( is_array ( $ segments ) ) { $ vars = $ segments ; } else { $ vars = self :: segmentUrl ( $ segments ) ; } return current ( $ vars ) ; }
Get first item segment .
49,902
public static function setLastSegment ( $ segments ) { if ( is_array ( $ segments ) ) { $ vars = $ segments ; } else { $ vars = self :: segmentUrl ( $ segments ) ; } return end ( $ vars ) ; }
Get last item segment .
49,903
public static function salts ( $ length ) { $ chars = array_merge ( range ( 0 , 9 ) , range ( 'a' , 'z' ) , range ( 'A' , 'Z' ) ) ; $ stringlength = count ( $ chars ) ; $ randomString = '' ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ randomString .= $ chars [ rand ( 0 , $ stringlength - 1 ) ] ; } return $ randomStri...
generate salts for files .
49,904
public function getAll ( ) { $ db = new DB ( ) ; $ result = $ db -> db ( ) -> select ( [ 'db_name' => __config ( ) -> auth -> db_name , 'table' => __config ( ) -> auth -> db_table ] ) ; $ db -> db ( ) -> close ( ) ; return $ result ; }
Get all the users .
49,905
public function getByWhere ( $ where , $ value ) { $ db = new DB ( ) ; $ result = $ db -> db ( ) -> select ( [ 'db_name' => __config ( ) -> auth -> db_name , 'table' => __config ( ) -> auth -> db_table , 'wheres' => [ "{$where} =" . "'{$value}'" ] ] ) ; $ db -> db ( ) -> close ( ) ; return $ result ; }
Get users using specific field .
49,906
public function delete ( $ id ) { $ db = new DB ( ) ; $ result = $ db -> db ( ) -> delete ( [ 'db_name' => __config ( ) -> auth -> db_name , 'table' => __config ( ) -> auth -> db_table , 'wheres' => [ 'id =' . "'{$id}'" ] ] ) ; $ db -> db ( ) -> close ( ) ; return $ result ; }
Delete user by id .
49,907
public static function verify ( $ original , $ hash , $ verify = false ) { self :: self ( $ verify ) ; return self :: $ driver -> verify ( $ original , $ hash ) ; }
Verify the hash .
49,908
public function int ( $ value ) { if ( $ this -> notBeEmpty ( $ value ) ) { if ( is_int ( $ value ) ) { return true ; } else { return false ; } } else { return false ; } }
Evaulate int .
49,909
public function float ( $ value ) { if ( $ this -> notBeEmpty ( $ value ) ) { if ( is_float ( $ value ) ) { return true ; } else { return false ; } } else { return false ; } }
Evaulate float .
49,910
public function string ( $ value ) { if ( $ this -> notBeEmpty ( $ value ) ) { if ( is_string ( $ value ) && preg_match ( '/[A-Za-z]+/i' , $ value ) ) { return true ; } else { return false ; } } else { return false ; } }
Evaulate string .
49,911
public function email ( $ value ) { if ( $ this -> notBeEmpty ( $ value ) ) { if ( filter_var ( $ value , FILTER_VALIDATE_EMAIL ) !== false ) { return true ; } else { return false ; } } else { return false ; } }
Evaulate email .
49,912
public function open ( $ file , $ mode ) { if ( ! empty ( trim ( $ file ) ) && ! empty ( trim ( $ mode ) ) ) { $ this -> resource = fopen ( $ file , $ this -> modes [ $ mode ] ) ; $ this -> file = $ file ; return $ this ; } return false ; }
Open the file .
49,913
public static function input ( $ key ) { $ request = new Request ( ) ; if ( $ request -> isGet ( ) || $ request -> isHead ( ) ) { $ string = $ request -> getQuery ( $ key ) ; } elseif ( $ request -> isPost ( ) ) { $ string = $ request -> getPost ( $ key ) ; } elseif ( $ request -> isPatch ( ) ) { $ string = $ request -...
Accpet input Support get . post put patch delete others .
49,914
public static function clean ( $ input , $ type ) { if ( ! empty ( $ input ) ) { if ( ! empty ( $ type ) ) { if ( $ type === 'secured' ) { return stripslashes ( trim ( htmlentities ( $ input , ENT_QUOTES | ENT_HTML5 , 'UTF-8' ) ) ) ; } elseif ( $ type === 'root' ) { return stripslashes ( trim ( htmlentities ( htmlspeci...
Clean input .
49,915
public static function restoreLineBreaks ( $ str ) { if ( isset ( $ str ) and strlen ( $ str ) !== 0 ) { $ result = str_replace ( PHP_EOL , "\n\r<br />\n\r" , $ str ) ; return $ result ; } else { return false ; } }
Restore new lines .
49,916
public function exception ( $ e ) { $ this -> setParams ( $ e -> getCode ( ) , $ e -> getMessage ( ) , $ e -> getFile ( ) , $ e -> getLine ( ) , $ e -> getTraceAsString ( ) ) ; return $ this -> render ( ) ; }
expection handler .
49,917
public function appendEditor ( $ key , $ uri ) : self { $ arr = [ $ key => $ uri ] ; $ merge = array_merge ( $ arr , $ this -> editors ) ; $ this -> editors = $ merge ; return $ this ; }
Appen the editor .
49,918
protected function setParams ( $ code , $ msg , $ file , $ line , $ trace ) { return $ this -> stack = [ 'message' => $ msg , 'file' => $ file , 'line' => $ line , 'code' => ( $ code === 0 ) ? 404 : $ code , 'trace' => $ trace , 'previewCode' => '' , 'editor' => $ this -> setEditor , 'editorUri' => $ this -> getEditor ...
Set the error item to stack .
49,919
protected function getPreviewCode ( ) { $ file = file ( $ this -> stack [ 'file' ] ) ; $ line = $ this -> stack [ 'line' ] ; $ _line = $ line - 1 ; if ( $ _line - 5 >= 0 ) { $ start = $ _line - 5 ; $ end = $ _line + 5 ; } else { $ start = $ _line ; $ end = $ line ; } for ( $ i = $ start ; $ i <= $ end ; $ i ++ ) { if (...
Get the code from file .
49,920
public function render ( ) { $ this -> getPreviewCode ( ) ; $ stack = $ this -> stack ; if ( __config ( ) -> config -> show_errors === true ) { $ file = 'views/view.php' ; require $ file ; } else { $ logger = new Logger ( ) ; $ log = date ( 'Y-m-d' ) . '.log' ; $ message = 'Message: ' . $ stack [ 'message' ] ; $ messag...
Rander the error .
49,921
public static function arrayObject ( $ array ) { if ( is_array ( $ array ) ) { $ object = new \ stdClass ( ) ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ object -> $ key = static :: arrayObject ( $ value ) ; } else { $ object -> $ key = $ value ; } } return ( object ) $ object ; } return ...
Convert arrays to Object .
49,922
public static function objectArray ( $ object ) { if ( is_object ( $ object ) ) { $ reflectionClass = new \ ReflectionClass ( get_class ( $ object ) ) ; $ array = [ ] ; foreach ( $ reflectionClass -> getProperties ( ) as $ property ) { $ property -> setAccessible ( true ) ; $ array [ $ property -> getName ( ) ] = $ pro...
Convert Objects to arrays .
49,923
public static function xmlArray ( $ xml ) { $ dom = simplexml_load_file ( $ xml ) ; $ json_encode = json_encode ( $ dom ) ; $ json_decode = json_decode ( $ json_encode , true ) ; return $ json_decode ; }
Convert XML to arrays .
49,924
public function addServer ( $ host , $ port = 11211 , $ weight = 1 ) { $ this -> memcached -> addServer ( $ host , $ port , $ weight ) ; return $ this ; }
Add server to Memcached .
49,925
public function unique ( $ column , $ value , $ table ) { $ db = new DB ( ) ; $ result = $ db -> db ( ) -> count ( [ 'db_name' => __config ( ) -> database -> db_name , 'table' => $ table , 'wheres' => [ $ column . ' =' . "'{$value}'" ] ] ) ; $ db -> db ( ) -> close ( ) ; if ( $ result === 0 ) { return true ; } else { r...
Evaulate unique .
49,926
public function getLang ( ) { if ( is_cookie ( 'lang' ) ) { $ language = ( array_key_exists ( get_cookie ( 'lang' ) , $ this -> _languages ) ) ? get_cookie ( 'lang' ) : __config ( ) -> config -> language ; } else { $ language = __config ( ) -> config -> language ; } return $ language ; }
Get the current language .
49,927
public function getNameByKey ( $ key ) { return ( array_key_exists ( $ key , $ this -> _languages ) ) ? $ this -> _languages [ $ key ] : null ; }
Get the language name by key .
49,928
public function languageString ( ) { $ data = $ data1 = $ data2 = [ ] ; $ language = $ this -> getLang ( ) ; if ( file_exists ( route ( ) -> locale . "{$language}.php" ) ) { $ data1 += require route ( ) -> locale . "{$language}.php" ; } $ path = route ( ) -> com ; $ disk_scan = array_diff ( scandir ( $ path ) , [ '..' ...
Include lang string file .
49,929
public function prepareWhere ( $ wheres = null ) { if ( isset ( $ wheres ) ) { if ( ! empty ( $ wheres ) ) { $ wheres = ' WHERE ' . implode ( ' and ' , array_values ( $ wheres ) ) ; } else { $ wheres = '' ; } } else { $ wheres = '' ; } return $ wheres ; }
prepare the where statement .
49,930
public function createDb ( $ name ) { if ( isset ( $ name ) && ! empty ( trim ( $ name ) ) ) { $ sql = "CREATE DATABASE IF NOT EXISTS `{$name}`" ; return $ sql ; } else { return false ; } }
Creating database query if not exists .
49,931
public function deleteDb ( $ name ) { if ( isset ( $ name ) && ! empty ( trim ( $ name ) ) ) { $ sql = "DROP DATABASE `{$name}` " ; return $ sql ; } else { return false ; } }
Deleting database query if not exists .
49,932
public function deleteTbl ( $ table ) { if ( isset ( $ table ) && ! empty ( trim ( $ table ) ) ) { $ sql = "DROP TABLE `{$table}` " ; return $ sql ; } else { return false ; } }
Deleting table query if not exists .
49,933
public function getPut ( $ key = null ) { if ( $ key === null ) { return $ this -> put ; } else { return ( isset ( $ this -> put [ $ key ] ) ) ? $ this -> put [ $ key ] : null ; } }
Get a value from PUT query data or the whole array .
49,934
public function getPatch ( $ key = null ) { if ( $ key === null ) { return $ this -> patch ; } else { return ( isset ( $ this -> patch [ $ key ] ) ) ? $ this -> patch [ $ key ] : null ; } }
Get a value from PATCH query data or the whole array .
49,935
public function getDelete ( $ key = null ) { if ( $ key === null ) { return $ this -> delete ; } else { return ( isset ( $ this -> delete [ $ key ] ) ) ? $ this -> delete [ $ key ] : null ; } }
Get a value from DELETE query data or the whole array .
49,936
public function getParsedData ( $ key = null ) { $ result = null ; if ( $ this -> parsedData !== null && is_array ( $ this -> parsedData ) ) { if ( null === $ key ) { $ result = $ this -> parsedData ; } else { $ result = ( isset ( $ this -> parsedData [ $ key ] ) ) ? $ this -> parsedData [ $ key ] : null ; } } return $...
Get a value from parsed data or the whole array .
49,937
protected function parseData ( ) { if ( strtoupper ( $ this -> getRequestMethod ( ) ) == 'GET' ) { $ this -> rawData = ( $ this -> getQueryString ( ) ) ? rawurldecode ( $ this -> getQueryString ( ) ) : null ; } else { $ input = fopen ( 'php://input' , 'r' ) ; while ( $ data = fread ( $ input , 1024 ) ) { $ this -> rawD...
Parse any data that came with the request .
49,938
public function formatBytes ( $ size , $ pre = 2 ) { $ base = log ( $ size ) / log ( 1024 ) ; $ suffix = [ 'B' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' ] ; $ f_base = floor ( $ base ) ; return round ( pow ( 1024 , $ base - floor ( $ base ) ) , $ pre ) . $ suffix [ $ f_base ] ; }
Formats the bytes in human readable form .
49,939
public function formatTime ( $ time ) { $ time = preg_match ( '~\D~' , $ time ) ? strtotime ( $ time ) : $ time ; return time ( ) - $ time ; }
Formats the time .
49,940
public function ftpFiles ( $ dir ) { return ( $ this -> isConnected ( ) === true ) ? ftp_nlist ( $ this -> getConnection ( ) , $ dir ) : false ; }
get the list of files .
49,941
public function chdir ( $ dir ) { return ( $ this -> isConnected ( ) === true ) ? ftp_chdir ( $ this -> getConnection ( ) , $ dir ) : false ; }
Change directories .
49,942
public function mkdirs ( $ dirs ) { if ( substr ( $ dirs , 0 , 1 ) == '/' ) { $ dirs = substr ( $ dirs , 1 ) ; } if ( substr ( $ dirs , - 1 ) == '/' ) { $ dirs = substr ( $ dirs , 0 , - 1 ) ; } $ dirs = explode ( '/' , $ dirs ) ; $ curDir = $ this -> connectionString ; foreach ( $ dirs as $ dir ) { $ curDir .= '/' . $ ...
Make nested sub - directories .
49,943
public function dirExists ( $ dir ) { return ( $ this -> isConnected ( ) === true ) ? ftp_rmdir ( $ this -> connectionString . $ dir ) : false ; }
Check is the dir is exists .
49,944
public function get ( $ local , $ remote , $ mode = FTP_BINARY ) { return ( $ this -> isConnected ( ) === true ) ? ftp_get ( $ this -> getConnection ( ) , $ local , $ remote , $ mode ) : false ; }
Get the file .
49,945
public function chmod ( $ file , $ mode ) { return ( $ this -> isConnected ( ) === true ) ? ftp_chmod ( $ this -> getConnection ( ) , $ mode , $ file ) : false ; }
Change permission .
49,946
public function delete ( $ file ) { return ( $ this -> isConnected ( ) === true ) ? ftp_delete ( $ this -> getConnection ( ) , $ file ) : false ; }
Delete the files .
49,947
public function pasv ( $ flag = true ) { return ( $ this -> isConnected ( ) === true ) ? ftp_pasv ( $ this -> getConnection ( ) , $ flag ) : false ; }
Switch the passive mod .
49,948
public function put ( $ files , $ root = 'public_html' ) { if ( $ this -> isConnected ( ) === true ) { foreach ( $ files as $ key => $ value ) { ftp_put ( $ this -> getConnection ( ) , $ server_root . '/' . $ value , $ value , FTP_ASCII ) ; } } else { return false ; } }
Upload the files .
49,949
public function setColor ( $ color ) { if ( ! empty ( $ color ) ) { $ this -> color = $ this -> convertColor ( $ color ) ; } return $ this ; }
Set the image foreground color .
49,950
private function convertColor ( $ hex , $ alpha = false ) { $ hex = str_replace ( '#' , '' , $ hex ) ; $ length = strlen ( $ hex ) ; $ rgb [ '0' ] = hexdec ( $ length == 6 ? substr ( $ hex , 0 , 2 ) : ( $ length == 3 ? str_repeat ( substr ( $ hex , 0 , 1 ) , 2 ) : 0 ) ) ; $ rgb [ '1' ] = hexdec ( $ length == 6 ? substr...
Convert hexa color to rgb or rgba .
49,951
public function setHashString ( string $ string ) { if ( ! empty ( trim ( $ string ) ) ) { $ this -> string = $ string ; $ this -> hash = md5 ( $ string ) ; $ this -> convertHashToArrayOfBoolean ( ) ; return $ this ; } }
Set the string .
49,952
public function setSize ( $ size ) { if ( ! empty ( $ size ) ) { $ this -> size = $ size ; $ this -> pxRatio = round ( $ size / 5 ) ; return $ this ; } }
Set size of image .
49,953
public static function getMessageFromCode ( $ code ) { if ( ! array_key_exists ( $ code , self :: $ responseCodes ) ) { throw new \ Exception ( 'The header code ' . $ code . ' is not valid.' ) ; } return self :: $ responseCodes [ $ code ] ; }
Get response message from code .
49,954
public static function encodeBody ( $ body , $ encode = 'gzip' ) { switch ( $ encode ) { case 'gzip' : if ( ! function_exists ( 'gzencode' ) ) { throw new \ Exception ( 'Gzip compression is not available.' ) ; } $ encodedBody = gzencode ( $ body ) ; break ; case 'deflate' : if ( ! function_exists ( 'gzdeflate' ) ) { th...
Encode the body data .
49,955
public static function decodeBody ( $ body , $ decode = 'gzip' ) { switch ( $ decode ) { case 'gzip' : if ( ! function_exists ( 'gzinflate' ) ) { throw new \ Exception ( 'Gzip compression is not available.' ) ; } $ decodedBody = gzinflate ( substr ( $ body , 10 ) ) ; break ; case 'deflate' : if ( ! function_exists ( 'g...
Decode the body data .
49,956
public function getHeadersAsString ( $ status = true , $ eol = "\n" ) { $ headers = '' ; if ( $ status ) { $ headers = "HTTP/{$this->version} {$this->code} {$this->reasonPhrase}{$eol}" ; } foreach ( $ this -> headers as $ name => $ value ) { $ headers .= "{$name}: {$value}{$eol}" ; } return $ headers ; }
Get the response headers as a string .
49,957
public function sendAndExit ( $ code = null , array $ headers = null ) { $ this -> send ( $ code , $ headers ) ; exit ( ) ; }
Send response and exit .
49,958
public function systemDirs ( ) { $ this -> mkDir ( '../Storage' ) ; $ this -> mkDir ( '../Storage/Data' ) ; $ this -> mkDir ( '../Storage/Logs' ) ; $ this -> mkDir ( '../Storage/Session' ) ; $ this -> mkDir ( '../Storage/Backup' ) ; $ this -> mkDIr ( '../Storage/Cache' ) ; }
Create zest system dir .
49,959
public function recursiveCreateDir ( $ value = null ) { return ( $ value === null ) ? $ this -> recursiveDirectories : $ this -> recursiveDirectories = $ value ; }
Create recurisve dir .
49,960
public function mkDir ( $ name , $ recursive = null , $ chmod = null ) { $ recursive = ( $ recursive === null ) ? $ this -> recursiveDirectories : $ recursive ; $ chmod = ( $ chmod === null ) ? $ this -> defCHMOD : $ chmod ; if ( ! is_dir ( $ name ) ) { return ( mkdir ( $ name ) ) ? true : false ; } return false ; }
Make the dir .
49,961
public function permission ( $ source , $ pre ) { if ( ! is_dir ( $ source ) ) { return ( file_exists ( $ source ) ) ? chmod ( $ source , $ pre ) : false ; } return false ; }
Change the permission .
49,962
public function chown ( $ source , $ files , $ user ) { foreach ( $ files as $ file => $ value ) { if ( file_exists ( $ source . $ value ) ) { @ chown ( $ file , $ user ) ; } } }
Change the owner of an array of files .
49,963
public function moveFiles ( $ source , $ target , $ files ) { foreach ( $ files as $ file ) { $ this -> moveFile ( $ source , $ target , $ files ) ; } }
Move files .
49,964
public function copyDir ( $ source , $ target , $ dir ) { $ this -> mkDir ( $ target ) ; $ serverOs = ( new \ Zest \ Common \ OperatingSystem ( ) ) -> get ( ) ; $ command = ( $ serverOs === 'Windows' ) ? 'xcopy ' : 'cp -r ' ; if ( is_dir ( $ source . $ dir ) ) { shell_exec ( $ command . $ source . $ dir . ' ' . $ targe...
Copy dir .
49,965
public function copyDirs ( $ source , $ target , $ dirs ) { foreach ( $ dirs as $ dir ) { $ this -> copyDir ( $ source , $ target , $ dir ) ; } }
Copy dirs .
49,966
public function moveDirs ( $ source , $ target , $ dirs ) { foreach ( $ dirs as $ dir ) { $ this -> moveDir ( $ source , $ target , $ dir ) ; } }
Move dirs .
49,967
public function filesUpload ( $ files , $ target , $ fileType , $ count , $ maxSize = 7992000000 ) { $ status = [ ] ; for ( $ i = 0 ; $ i <= $ count ; $ i ++ ) { $ exactName = basename ( $ files [ 'name' ] [ $ i ] ) ; $ fileTmp = $ files [ 'tmp_name' ] [ $ i ] ; $ fileSize = $ files [ 'size' ] [ $ i ] ; $ error = $ fil...
Upload files .
49,968
public function add ( $ route , $ params = '' , $ methods = 'GET|HEAD' , $ middleware = '' ) { $ route = preg_replace ( '/\//' , '\\/' , $ route ) ; $ route = preg_replace ( '/\{([a-z]+)\}/' , '(?P<\1>[a-z-]+)' , $ route ) ; $ route = preg_replace ( '/\{([a-z]+):([^\}]+)\}/' , '(?P<\1>\2)' , $ route ) ; $ route = '/^' ...
Add a route to the routing table .
49,969
public function addMiddleware ( $ name ) { $ parts = explode ( '@' , $ name ) ; if ( strcasecmp ( $ parts [ 0 ] , $ name ) === 0 ) { $ namespace = "App\Middleware\\" ; $ middleware = $ namespace . $ name ; } else { $ namespace = $ parts [ 0 ] ; $ middleware = $ namespace . $ parts [ 1 ] ; } $ middleware_object = new $ ...
Add the middleware .
49,970
public function methodMatch ( $ methods , $ requestMethod , Request $ request ) { $ match = false ; if ( $ requestMethod === null ) { $ requestMethod = ( $ request -> getRequestMethod ( ) ) ? $ request -> getRequestMethod ( ) : 'GET' ; } $ methods = explode ( '|' , $ methods ) ; foreach ( $ methods as $ method ) { if (...
Match the request methods .
49,971
public function cacheRouters ( ) { if ( __config ( ) -> config -> router_cache === true ) { $ cache = new Cache ( ) ; if ( ! $ cache -> setAdapter ( 'file' ) -> has ( 'router' ) ) { $ routers = $ this -> getRoutes ( ) ; $ cache -> setAdapter ( 'file' ) -> set ( 'router' , $ routers , __config ( ) -> config -> router_ca...
Cache the roouter .
49,972
public function write ( $ data ) : void { if ( null !== $ this -> file ) { $ this -> file -> write ( $ data ) ; } }
Write on sitemap file .
49,973
public static function add ( $ array , $ key , $ value , $ opr = null ) { if ( ! self :: has ( $ array , $ key , $ opr ) ) { self :: set ( $ array , $ key , $ value , $ opr ) ; } return $ array ; }
Add an element to an array using dot notation if it doesn t exist .
49,974
public static function set ( & $ array , $ key = null , $ value = null , $ opr = null ) { if ( null === $ value ) { return $ array ; } if ( null === $ key ) { return $ array = $ value ; } if ( null === $ opr ) { return $ array [ $ key ] = $ value ; } $ keys = explode ( $ opr , $ key ) ; foreach ( $ keys as $ key ) { if...
Set an array item to a given value using operator notation .
49,975
public static function get ( $ array , $ key = null , $ default = null , $ opr = null ) { if ( ! self :: isReallyArray ( $ array ) ) { return $ default ; } if ( null === $ key ) { return $ array ; } if ( array_key_exists ( $ key , $ array ) ) { return $ array [ $ key ] ; } if ( null !== $ opr ) { if ( strpos ( $ key , ...
Get an item from an array using operator notation .
49,976
public static function has ( $ array , $ keys = null , $ opr = null ) { $ keys = ( array ) $ keys ; if ( count ( $ keys ) === 0 ) { return false ; } foreach ( $ keys as $ key ) { $ get = self :: get ( $ array , $ key , null , $ opr ) ; if ( self :: isReallyArray ( $ get ) || $ get === null ) { return false ; } } return...
Determine if an item or items exist in an array using Operator notation .
49,977
public static function multiToAssoc ( array $ arrays ) { $ results = [ ] ; foreach ( $ arrays as $ key => $ value ) { if ( self :: isReallyArray ( $ value ) === true ) { $ results = array_merge ( $ results , self :: multiToAssoc ( $ value ) ) ; } else { $ results [ $ key ] = $ value ; } } return $ results ; }
Convert a multi - dimensional array to assoc .
49,978
public static function multiToAssocWithSpecificOpr ( array $ arrays , $ opr = null ) { $ results = [ ] ; foreach ( $ arrays as $ key => $ value ) { if ( self :: isReallyArray ( $ value ) === true ) { $ results = array_merge ( $ results , self :: multiToAssocWithSpecificOpr ( $ value , $ key . $ opr ) ) ; } else { $ key...
Converted a multi - dimensional associative array with operator .
49,979
public static function unique ( $ array ) { $ results = [ ] ; if ( self :: isMulti ( $ array ) ) { $ array = self :: multiToAssoc ( $ array ) ; foreach ( $ array as $ key => $ value ) { $ results [ ] = $ value ; } return array_unique ( $ array ) ; } return array_unique ( $ array ) ; }
Get the unique elements from array .
49,980
public static function arrayChangeCaseKey ( $ array , $ case = CASE_LOWER ) { return array_map ( function ( $ item ) use ( $ case ) { if ( is_array ( $ item ) ) { $ item = self :: arrayChangeCaseKey ( $ item , $ case ) ; } return $ item ; } , array_change_key_case ( $ array , $ case ) ) ; }
Changes the case of all keys in an array .
49,981
public static function arrayChangeCaseValue ( $ array , $ case = CASE_LOWER ) { $ return = [ ] ; foreach ( $ array as $ key => $ value ) { if ( self :: isReallyArray ( $ value ) ) { $ results = array_merge ( $ results , self :: arrayChangeCaseValue ( $ value , $ case ) ) ; } else { $ array [ $ key ] = ( $ case == CASE_...
Changes the case of all values in an array .
49,982
public function deleteItem ( $ key ) { $ cacheFile = __cache_path ( ) . md5 ( $ key ) ; if ( file_exists ( $ cacheFile ) ) { unlink ( $ cacheFile ) ; } return $ this ; }
Delete the cache .
49,983
public function parseData ( ) { $ data = [ ] ; $ file1 = __DIR__ . '/Config/App.php' ; $ file2 = __DIR__ . '/../Config/App.php' ; if ( file_exists ( $ file1 ) ) { $ data += require $ file1 ; } elseif ( file_exists ( $ file2 ) ) { $ data += require $ file2 ; } else { throw new \ Exception ( "Error, while loading Config ...
Prase the config file .
49,984
public function arrayChangeCaseKey ( $ array ) { return array_map ( function ( $ item ) { if ( is_array ( $ item ) ) { $ item = $ this -> arrayChangeCaseKey ( $ item ) ; } return $ item ; } , array_change_key_case ( $ array ) ) ; }
Change the key of array to lower case .
49,985
public function run ( ) { $ router = new Router ( ) ; $ cache = new Cache ( ) ; if ( file_exists ( '../Routes/Routes.php' ) ) { $ routeFile = '../Routes/Routes.php' ; } elseif ( file_exists ( 'Routes/Routes.php' ) ) { $ routeFile = 'Routes/Routes.php' ; } else { throw new \ Exception ( 'Error while loading Route.php fi...
Run the Zest Framework .
49,986
public function getMultiple ( $ keys ) { $ value = [ ] ; foreach ( $ keys as $ key ) { $ value [ $ key ] = self :: get ( $ key , $ default ) ; } return $ value ; }
Get multiple values in session .
49,987
public function setBlock ( $ block ) { if ( ! empty ( $ block ) && $ block <= 4 && $ block !== 0 && ! ( $ block < 0 ) ) { $ this -> block = $ block ; } }
Set the blocks .
49,988
public function generatePassword ( ) { $ salts = Site :: salts ( 12 ) ; $ special_char1 = '~<>?|:.(),' ; $ special_char2 = '!@#$%^&*_+-*+' ; $ pass = $ special_char2 . $ salts . $ special_char1 ; return str_shuffle ( $ pass ) ; }
Generate the password .
49,989
public function isValid ( $ password ) { return ( $ this -> isU ( $ password ) && $ this -> isL ( $ password ) && $ this -> isN ( $ password ) && $ this -> isS ( $ password ) && $ this -> len ( $ password ) >= $ this -> getLength ( ) ) ? true : false ; }
Validate the password .
49,990
private function appendItem ( $ url , $ lastMod , $ priority , $ changeFreq ) : void { $ this -> create ( 'append' , $ url , $ lastMod , $ priority , $ changeFreq ) ; }
Append item to sitemap .
49,991
public function setProperAdapter ( $ adapter ) { switch ( $ adapter ) { case 'apc' : $ adapter = '\Zest\Cache\Adapter\APC' ; break ; case 'apcu' : $ adapter = '\Zest\Cache\Adapter\APCU' ; break ; case 'file' : $ adapter = '\Zest\Cache\Adapter\FileCache' ; break ; case 'memcache' : $ adapter = '\Zest\Cache\Adapter\Memca...
Set the valid adapter .
49,992
public function get ( $ key , $ default = null ) { $ cache = $ this -> adapter -> getItem ( $ key ) ; return ( isset ( $ cache ) && $ cache !== null ) ? $ cache : $ default ; }
Get the value from cache .
49,993
public function getMultiple ( $ keys , $ default = null ) { $ cache = [ ] ; foreach ( $ keys as $ key ) { $ cache [ $ key ] = $ this -> get ( $ key , $ default ) ; } return $ cache ; }
Get the multiple values from cache .
49,994
public function set ( $ key , $ value , $ ttl = null ) { $ this -> adapter -> saveItem ( $ key , $ value , $ ttl ) ; return $ this ; }
Save item to cache .
49,995
public function setMultiple ( $ cache ) { foreach ( $ cache as $ value ) { $ this -> set ( $ value [ 'key' ] , $ value [ 'value' ] , $ value [ 'ttl' ] ) ; } return $ this ; }
Save multiple items to cache .
49,996
public function createDb ( $ name ) { $ sql = $ this -> query -> createDb ( $ name ) ; $ this -> db -> exec ( $ sql ) ; return true ; }
Creating database if not exists .
49,997
public function getImgResource ( $ string , $ size = 128 , $ color = '' , $ bg = '' ) { return $ this -> _instance -> getImgResource ( $ string , $ size , $ color , $ bg ) ; }
Get Image resource .
49,998
public function getImgDataBase64 ( $ string , $ size = 128 , $ color = '' , $ bg = '' ) { return sprintf ( 'data:%s;base64,%s' , $ this -> _instance -> mineType , base64_encode ( $ this -> getImgData ( $ string , $ size , $ color , $ bg ) ) ) ; }
Get Image data in base64 .
49,999
public function save ( $ string , $ size , $ color , $ bg , $ target ) { return ( ! file_exists ( $ target ) ) ? file_put_contents ( "$target" , $ this -> getImgData ( $ string , $ size , $ color , $ bg ) ) : false ; }
Save the image .