idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
3,000 | protected function get_src_path ( $ path = '' ) { return rtrim ( $ this -> get_path ( $ this -> options -> src_dir ) , '/' ) . ( strlen ( $ path ) ? '/' . $ path : '' ) ; } | Get full src path to the path . |
3,001 | protected function load_textdomain ( ) { $ domain = $ this -> options -> domain ; if ( empty ( $ domain ) ) { return ; } $ path = $ this -> options -> lang_path ; if ( empty ( $ path ) ) { $ path = $ this -> get_path ( $ this -> options -> lang_dir ) ; } $ path = sprintf ( '%s/%s-%s.mo' , rtrim ( $ path , '/' ) , $ dom... | Load textdomain . |
3,002 | public static function make ( $ base_path ) { $ name = plugin_basename ( $ base_path ) ; if ( ! isset ( self :: $ instances [ $ name ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Identifier `%s` is not defined' , $ name ) ) ; } return self :: $ instances [ $ name ] ; } | Get the instance from base path . |
3,003 | protected function register_autoload ( ) { $ src_dir = $ this -> get_src_path ( ) ; if ( file_exists ( $ src_dir ) ) { register_wp_autoload ( $ this -> options -> namespace , $ src_dir ) ; } } | Register autoload . |
3,004 | protected function set_base_path ( $ base_path ) { if ( ! is_string ( $ base_path ) ) { throw new InvalidArgumentException ( 'Invalid argument. `$base_path` must be string.' ) ; } if ( strpos ( $ base_path , '.php' ) !== false ) { $ base_path = preg_replace ( '/[^\/]*$/' , '' , $ base_path ) ; } $ this -> base_path = r... | Set base path . Remove file name if it exists . |
3,005 | protected function set_namespace ( ) { if ( empty ( $ this -> options -> instance ) || ! empty ( $ this -> options -> namespace ) ) { return ; } $ namespace = $ this -> options -> namespace ; $ namespace = explode ( '\\' , $ namespace ) ; array_pop ( $ namespace ) ; $ this -> options -> namespace = implode ( '\\' , $ n... | Set namespace if instance exists and namespace is empty . |
3,006 | public function editAction ( ) { $ this -> view -> disable ( ) ; $ id = $ this -> request -> getPost ( "hidden_id" ) ; $ banner = Banner :: findFirst ( $ id ) ; $ msg = "" ; if ( $ this -> request -> hasFiles ( ) !== false ) { if ( ! empty ( $ _FILE [ 'file' ] [ 'tmp_name' ] ) ) { if ( ! empty ( $ banner -> file ) ) { ... | Edits a banner |
3,007 | public function createAction ( ) { $ this -> view -> disable ( ) ; $ msg = "" ; if ( ! is_dir ( "upload/banner/" ) ) { if ( ! mkdir ( $ this -> path , 0777 , true ) ) { die ( 'Failed to create folders...' ) ; } } if ( $ this -> request -> hasFiles ( ) !== false ) { $ uploader = new \ Uploader \ Uploader ( [ 'directory'... | Creates a new banner |
3,008 | public function deleteAction ( $ id ) { $ this -> view -> disable ( ) ; $ banner = Banner :: findFirstByid ( $ id ) ; if ( ! $ banner ) { $ alert = "error" ; $ msg = "banner not Found" ; } if ( ! empty ( $ banner -> file ) ) { if ( file_exists ( $ this -> path . $ banner -> file ) ) { unlink ( $ this -> path . $ banner... | Deletes a banner |
3,009 | public static function exists ( string $ link = '' ) : bool { $ link = static :: normalizePath ( $ link ) ; return static :: verifyPath ( $ link ) && \ file_exists ( $ link ) && \ is_link ( $ link ) ; } | Checks whether link exists . |
3,010 | public static function create ( string $ link = '' , string $ target = '' ) : bool { $ ret = true ; $ link = static :: normalizePath ( $ link ) ; $ target = static :: normalizePath ( $ target ) ; if ( static :: verifyPath ( $ link ) && static :: verifyPath ( $ target ) && Directory :: create ( \ dirname ( $ link ) ) &&... | Creates a symbolic link . |
3,011 | public static function read ( string $ link = '' ) : string { $ link = static :: normalizePath ( $ link ) ; if ( static :: exists ( $ link ) ) { return @ \ readlink ( $ link ) ; } return '' ; } | Returns a target of specified symbolic link |
3,012 | public static function remove ( string $ link = '' ) : bool { $ link = static :: normalizePath ( $ link ) ; if ( static :: exists ( $ link ) ) { return @ \ unlink ( $ link ) ; } return false ; } | Removes a symbolic link |
3,013 | public static function getInstance ( \ FreeFW \ Application \ Config $ p_config , \ Psr \ Log \ LoggerInterface $ p_logger ) { if ( self :: $ instance === null ) { self :: $ instance = new static ( $ p_config , $ p_logger ) ; } return self :: $ instance ; } | Get Application instance |
3,014 | protected function send ( \ Psr \ Http \ Message \ ResponseInterface $ p_response ) { $ http_line = sprintf ( 'HTTP/%s %s %s' , $ p_response -> getProtocolVersion ( ) , $ p_response -> getStatusCode ( ) , $ p_response -> getReasonPhrase ( ) ) ; header ( $ http_line , true , $ p_response -> getStatusCode ( ) ) ; foreach... | Send an HTTP response |
3,015 | public static function translateByArray ( $ string ) { return preg_replace ( array_keys ( self :: $ ascii ) , array_values ( self :: $ ascii ) , $ string ) ; } | Replace special characters with english chars |
3,016 | public function getAvailableValues ( $ query = '' ) { $ dataRequest = new DataRequest ( 0 , 0 , $ this -> fieldName , 'ASC' ) ; if ( $ query != '' ) { $ dataRequest -> addFilter ( new Filter ( $ this -> fieldName , '*' . $ query . '*' , 'LIKE' ) ) ; } $ values = $ this -> dataSourceManager -> find ( $ dataRequest ) ; r... | Returns the available values |
3,017 | protected function getObjectOr404 ( $ createOnNoId = false ) { $ objectId = static :: getObjectId ( ) ; $ object = null ; if ( $ objectId !== null ) { $ object = $ this -> getQuery ( ) -> findOneByPrimaryKey ( $ objectId ) ; } elseif ( $ createOnNoId === true ) { $ object = $ this -> getQuery ( ) -> createObject ( ) ; ... | Finds an object with the given id in this ObjectManager s query . |
3,018 | public function refresh ( $ refresh = true ) { $ this -> unitOfWorkHints [ Query :: HINT_REFRESH ] = ( boolean ) $ refresh ; return $ this ; } | Set whether to refresh hydrated documents that are already in the identity map . |
3,019 | public function header ( array $ headers ) { $ formattedHeaders = [ ] ; $ combinedHeaders = array_change_key_case ( array_merge ( $ this -> header , $ headers ) ) ; foreach ( $ combinedHeaders as $ key => $ val ) $ formattedHeaders [ ] = trim ( strtolower ( $ key ) ) . ':' . $ val ; $ this -> header = $ formattedHeader... | Setting header head |
3,020 | public function cookieFile ( string $ cookieFile ) { curl_setopt ( self :: $ handle , CURLOPT_COOKIEJAR , $ cookieFile ) ; curl_setopt ( self :: $ handle , CURLOPT_COOKIEFILE , $ cookieFile ) ; return $ this ; } | Set cookie file storage path |
3,021 | public function create ( SiteInterface $ site ) { return $ this -> formFactory -> create ( 'silvestra_site' , $ site , array ( 'action' => $ this -> router -> getContext ( ) -> getPathInfo ( ) ) ) ; } | Create site form . |
3,022 | private function cache ( $ offset , $ limit ) { $ items = $ this -> adapter -> getItems ( $ offset , $ limit ) ; $ i = $ offset ; foreach ( $ items as $ item ) { $ this -> cached [ $ i ++ ] = $ item ; } if ( count ( $ items ) < $ limit ) { $ this -> lastItemPos = $ i - 1 ; } } | Fetches the given range of items from the adapter and stores them in the cache array . |
3,023 | private function fromCache ( $ offset , $ limit ) { $ items = array ( ) ; for ( $ i = $ offset ; $ i < ( $ offset + $ limit ) ; $ i ++ ) { if ( ! array_key_exists ( $ i , $ this -> cached ) ) { break ; } $ items [ ] = $ this -> cached [ $ i ] ; } return $ items ; } | Returns the range from previously cached items . |
3,024 | protected static function mcryptOptions ( $ options ) { $ options_default = array ( 'cipher' => MCRYPT_RIJNDAEL_128 , 'mode' => MCRYPT_MODE_CBC , 'return_base64' => true , 'rand_src' => MCRYPT_RAND , 'padding' => 'PKCS5' , 'iv' => null , 'iv_return' => true , ) ; $ options = array_merge ( $ options_default , $ options ... | get mcrypt options |
3,025 | protected static function mcryptKey ( $ key , $ options ) { $ debug = \ bdk \ Debug :: getInstance ( ) ; if ( Str :: isBase64Encoded ( $ key ) && ( strlen ( $ key ) >= $ options [ 'key_size' ] * 1.333 && strlen ( $ key ) <= $ options [ 'key_size' ] * 1.5 ) ) { $ debug -> log ( 'base64 decoding key' ) ; $ key = base64_d... | base64 decodes key hashes ascii key keeps key size < = key_size |
3,026 | public static function rmd5 ( $ action , $ key , $ str ) { $ ret = '' ; $ ctr = 0 ; if ( $ action == 'encrypt' ) { srand ( ( double ) microtime ( ) * 1000000 ) ; $ salt = md5 ( rand ( 0 , 32000 ) ) ; for ( $ i = 0 ; $ i < strlen ( $ str ) ; $ i ++ ) { if ( $ ctr == strlen ( $ salt ) ) { $ ctr = 0 ; } $ ret .= substr ( ... | R - MD5 This algorithm is basically a two - level XOR . |
3,027 | public function createToken ( Request $ request , $ providerKey ) { if ( ! $ this -> secret ) { return null ; } $ authorizationHeader = $ request -> headers -> get ( 'Authorization' ) ; if ( $ authorizationHeader === null ) { return null ; } if ( 0 !== stripos ( $ authorizationHeader , 'Bearer ' ) ) { return null ; } $... | Create the token . |
3,028 | public function authenticateToken ( TokenInterface $ token , UserProviderInterface $ userProvider , $ providerKey ) { if ( ! $ this -> secret ) { throw new \ LogicException ( 'Config does not contain a secret.' ) ; } if ( ( null === ( $ credentials = $ token -> getCredentials ( ) ) ) || ! is_object ( $ credentials ) ) ... | Authenticate the passed token . |
3,029 | public function onAuthenticationFailure ( Request $ request , AuthenticationException $ exception ) { return new Response ( 'Authentication Failed: ' . $ exception -> getMessage ( ) , Response :: HTTP_UNAUTHORIZED ) ; } | Generate a proper unauthorized response . |
3,030 | private function decodeToken ( $ jwt ) { $ decodedToken = \ JWT :: decode ( $ jwt , $ this -> secret , [ 'HS256' ] ) ; $ aud = property_exists ( $ decodedToken , 'aud' ) ? $ decodedToken -> aud : null ; if ( $ aud !== $ this -> localId ) { throw new \ UnexpectedValueException ( 'This token is not intended for us.' ) ; ... | Decode a token . |
3,031 | private function encode ( $ lifetime , $ customPayload = null ) { $ time = time ( ) ; $ payload = [ 'iat' => $ time ] ; if ( null !== $ customPayload ) { $ payload = array_merge ( $ customPayload , $ payload ) ; } $ jti = md5 ( json_encode ( $ payload ) ) ; $ payload [ 'jti' ] = $ jti ; if ( null !== $ this -> localId ... | Encode a token . |
3,032 | public function checkAccess ( array $ permissions = [ ] , bool $ force = false ) : bool { if ( $ this -> isGuest ( ) ) { return false ; } if ( empty ( $ permissions ) ) { return true ; } if ( $ this -> isAdmin ( ) ) { return true ; } if ( count ( array_intersect ( $ permissions , $ this -> perissions ) ) > 0 ) { return... | Checks user access by permissions |
3,033 | public function getClassAnnotations ( ) { $ reflector = new ReflectionClass ( $ this -> className ) ; $ doc = $ reflector -> getDocComment ( ) ; if ( ! $ doc ) { return ; } $ annotations = [ ] ; foreach ( $ this -> filteringList as $ filter ) { preg_match_all ( '#@' . $ filter . '(.*?)\n#s' , $ doc , $ annotation ) ; i... | Collect the class specific annotations from the class documentation . |
3,034 | public function getAllMethodAnnotations ( ) { $ data = [ ] ; $ methods = self :: listMethodsFromClass ( $ this -> className ) ; $ this -> annotationObject -> mergeMethodList ( $ methods ) ; foreach ( $ methods as $ method ) { $ annotations = self :: getMethodAnnotations ( $ method -> name ) ; if ( ! empty ( $ annotatio... | A loop for get annotations from a Class to all of it s child methods . |
3,035 | public function getMethodAnnotations ( $ method ) { $ reflector = new ReflectionClass ( $ this -> className ) ; $ doc = $ reflector -> getMethod ( $ method ) -> getDocComment ( ) ; $ annotations = [ ] ; foreach ( $ this -> filteringList as $ filter ) { preg_match_all ( '#@' . $ filter . '(.*?)\n#s' , $ doc , $ annotati... | Get the annotations from a given method . |
3,036 | public static function listMethodsFromClass ( $ class ) { $ filteredMethods = array ( ) ; $ reflection = new ReflectionClass ( $ class ) ; $ methods = $ reflection -> getMethods ( ) ; foreach ( $ methods as $ method ) { if ( $ class === $ method -> class ) { $ filteredMethods [ ] = $ method ; } } return $ filteredMetho... | Get a list of the methods from a class . |
3,037 | public function find_all_files ( $ dir ) { $ root = scandir ( $ dir ) ; if ( count ( $ root ) == 0 ) return ; foreach ( $ root as $ value ) { if ( $ value === '.' || $ value === '..' ) { continue ; } if ( is_file ( "$dir/$value" ) ) { $ result [ ] = "$dir/$value" ; $ this -> pages [ ] = $ this -> read ( "$dir/$value" ,... | Find All file on asset dir and create array of Model \ Page |
3,038 | public function setBody ( $ file , $ body ) { if ( array_pop ( explode ( '.' , $ file ) ) == 'markdown' ) return Markdown :: defaultTransform ( $ body ) ; else return $ body ; } | Set body of Page . If body is markdown text formatted then it must be transform first to HTML |
3,039 | public function request ( $ url , $ payload = array ( ) , $ curlOptions = array ( ) , $ method = Curl :: Get ) { $ _response = null ; if ( $ this -> _hostPort ) { Curl :: setHostPort ( $ this -> _hostPort ) ; } if ( $ this -> _userName ) { Curl :: setUserName ( $ this -> _userName ) ; if ( $ this -> _password ) { Curl ... | Makes a service request |
3,040 | final public function run ( ) { if ( isset ( $ this -> response ) ) { Yii :: info ( "Response configured as '" . gettype ( $ this -> response ) . "': " . VarDumper :: dumpAsString ( $ this -> response ) , __METHOD__ ) ; return $ this -> response ; } if ( $ response = $ this -> runInternal ( ) ) { $ this -> response = $... | Basic Run action method implementation |
3,041 | protected function ensureModel ( ) { Yii :: trace ( 'Model ensuring' , __METHOD__ ) ; if ( $ this -> multiple ) { if ( empty ( $ this -> model ) || ! is_array ( $ this -> model ) ) { $ this -> model = [ $ this -> model ] ; } foreach ( $ this -> model as $ model ) { $ this -> ensureModelInternal ( $ model ) ; } return ;... | Ensure model stage |
3,042 | protected function setupFlushCache ( ) { do_action ( "before_theme_setup_flush_cache" ) ; add_action ( 'admin_bar_menu' , function ( $ wp_admin_bar ) { $ args = array ( 'id' => 'cache_flush_link' , 'title' => 'Flush cache' , 'href' => get_admin_url ( ) . '?flushCache' , 'meta' => array ( 'class' => 'cache-flush-link' )... | Registers link & action for it on admin bar to flush cache |
3,043 | protected function flushOldCache ( ) { do_action ( "before_theme_flush_old_cache" ) ; $ files = glob ( $ this -> cachePath . "*" ) ; $ files = ( is_array ( $ files ) && $ files ? $ files : array ( ) ) ; $ cache_config = $ this -> getConfig ( "cache" ) ; foreach ( $ files as $ file ) : if ( file_exists ( $ file ) && ( t... | Clears all cached files that is older than specified cache lifetime because sometimes bots are requesting urls that is visited only once and after a while there will be thousands of files without any reason . |
3,044 | public function getCacheFile ( $ cacheKey ) { do_action ( "before_theme_get_cache_file" , $ cacheKey ) ; $ filename = md5 ( $ _SERVER [ "HTTP_HOST" ] . $ _SERVER [ "REQUEST_URI" ] . "-" . $ cacheKey ) ; do_action ( "after_theme_get_cache_file" , $ filename ) ; return $ this -> cachePath . $ filename ; } | Get absolute path of cache file |
3,045 | public function doCache ( $ sectionKey , & $ section ) { do_action ( "before_theme_do_cache" , $ sectionKey ) ; $ cacheKey = $ this -> getCacheKey ( $ sectionKey , $ section ) ; $ file = $ this -> getCacheFile ( $ cacheKey ) ; ob_start ( ) ; $ section -> init ( ) ; $ section -> render ( ) ; $ cacheConfig = $ this -> ge... | Create the cache |
3,046 | public function getCache ( $ sectionKey , & $ section ) { do_action ( "before_theme_get_cache" , $ sectionKey ) ; $ cacheKey = $ this -> getCacheKey ( $ sectionKey , $ section ) ; $ file = $ this -> getCacheFile ( $ cacheKey ) ; $ cache = false ; $ cacheConfig = $ this -> getConfig ( "cache" ) ; if ( $ cacheConfig [ "t... | Get cached html |
3,047 | protected function ensureGroupsLoaded ( $ action ) { if ( $ action !== $ this -> action ) { $ this -> action = $ action ; $ this -> groups = \ array_flip ( $ this -> processorBag -> getActionGroups ( $ action ) ) ; } } | Makes sure groups are loaded |
3,048 | private static function _traverse ( self $ instance , array $ array , string $ key ) { $ keys = explode ( '.' , $ key ) ; $ firstKey = $ keys [ 0 ] ; if ( count ( $ keys ) === 1 ) { if ( $ firstKey === '*' ) { return $ array ; } else if ( array_key_exists ( $ firstKey , $ array ) === true ) { return $ array [ $ firstKe... | Traverse an array using a key and return the value . |
3,049 | public function getRawValue ( $ key ) { if ( ! array_key_exists ( $ key , $ this -> data ( ) ) ) { throw new \ InvalidArgumentException ( sprintf ( 'key [%s] is not present in response array.' , $ key ) ) ; } return $ this -> data ( ) [ $ key ] ; } | Return value in response array of the response . |
3,050 | public function vote ( $ candidates , Request $ request ) { $ this -> candidates = $ candidates ; $ this -> request = $ request ; $ this -> prioritseCandidates ( ) ; for ( $ i = $ this -> priority ; $ i >= 0 ; $ i -- ) { if ( isset ( $ this -> prioritised [ $ i ] ) && ! empty ( $ this -> prioritised [ $ i ] ) ) { retur... | Votes on candidates and returns Route that matches the path closest |
3,051 | public function addFunction ( $ function ) { $ arguments = func_get_args ( ) ; array_shift ( $ arguments ) ; $ content = new HtmlFromFunction ( ) ; $ content -> functionPointer = $ function ; $ content -> parameters = $ arguments ; $ this -> children [ ] = $ content ; return $ this ; } | Adds some content to the block by calling the function passed in parameter . |
3,052 | public function addText ( $ text ) { $ content = new HtmlString ( ) ; $ content -> htmlString = $ text ; $ this -> children [ ] = $ content ; return $ this ; } | Adds some content to the block by displaying the text passed in parameter . |
3,053 | public function singleFragment ( $ name , $ configuration , ProviderInterface $ provider ) { foreach ( $ this -> types as $ type => $ class ) { if ( ! empty ( $ configuration [ $ type ] ) ) { return $ this -> instance ( $ class , $ name , $ configuration , $ provider ) ; } } return $ this -> instance ( $ this -> defaul... | Creates a single feature instance from a configuration fragment |
3,054 | protected function instance ( $ class , $ name , array $ configuration , ProviderInterface $ provider ) { $ feature = new $ class ( $ name , $ configuration [ 'enabled' ] , $ provider ) ; $ feature -> configure ( $ configuration ) ; return $ feature ; } | Creates a feature instance from a fragment of normalized configuration |
3,055 | public function verifyFile ( ) { if ( ! $ this -> file ) return array ( 'error' => Yii :: t ( 'ciims.misc' , 'No files were uploaded.' ) ) ; $ size = $ this -> file -> size ; if ( $ size == 0 ) return array ( 'error' => Yii :: t ( 'ciims.misc' , 'File is empty' ) ) ; if ( $ size > $ this -> sizeLimit ) return array ( '... | Verifies that a file is valid |
3,056 | private function checkServerSettings ( ) { $ postSize = $ this -> toBytes ( ini_get ( 'post_max_size' ) ) ; $ uploadSize = $ this -> toBytes ( ini_get ( 'upload_max_filesize' ) ) ; if ( $ postSize < $ this -> sizeLimit || $ uploadSize < $ this -> sizeLimit ) { $ size = max ( 1 , $ this -> sizeLimit / 1024 / 1024 ) . 'M... | Checks that the server size settings are implemented appropriatly |
3,057 | static public function declination ( $ number , $ suffix ) { $ keys = array ( 2 , 0 , 1 , 1 , 1 , 2 ) ; $ mod = $ number % 100 ; $ suffix_key = ( $ mod > 7 && $ mod < 20 ) ? 2 : $ keys [ min ( $ mod % 10 , 5 ) ] ; return $ suffix [ $ suffix_key ] ; } | Declination of words . |
3,058 | public function render ( ) { $ codeFormat = '$.toast(%s, %s);' ; $ items = array ( ) ; $ js = '' ; foreach ( $ this -> container as $ toast ) { $ items [ ] = sprintf ( $ codeFormat , Json :: encode ( $ toast -> getMessage ( ) ) , Json :: encode ( $ toast -> getOptions ( ) ) ) ; } if ( ! empty ( $ items ) ) { $ js = '<s... | Render the javascript code |
3,059 | protected function setLogic ( string $ logic ) : void { file_put_contents ( GPIO :: ROOT_FILESYSTEM . GPIO :: GPIO . $ this -> linuxNumber . '/' . GPIO :: ACTIVE_LOW , GPIO :: ACTIVE_LOW === $ logic ? 1 : 0 ) ; } | Set logic for HIGH level |
3,060 | protected function export ( ) : void { $ this -> unexport ( ) ; file_put_contents ( static :: ROOT_FILESYSTEM . static :: EXPORT , "{$this->linuxNumber}" ) ; if ( ! file_exists ( static :: ROOT_FILESYSTEM . static :: GPIO . $ this -> linuxNumber ) ) { throw new ExportException ( "Problem with export. GPIO {$this->linux... | Export GPIO to make it accessible in program userspace |
3,061 | public function updateSearchForm ( Form $ form ) { if ( $ this -> isVersioned ( ) ) { $ fields = $ form -> Fields ( ) ; $ filter = DropdownField :: create ( 'q[FilterClass]' , $ this -> owner -> getStatusFieldTitle ( ) , $ this -> getFilterClassOptions ( ) , $ this -> getFilterClass ( ) ) -> setForm ( $ form ) ; if ( $... | Updates the given search form object . |
3,062 | public function updateList ( DataList & $ list ) { if ( $ this -> isVersioned ( ) ) { if ( $ filter = $ this -> getFilter ( $ list ) ) { $ list = $ filter -> apply ( ) ; } } } | Updates the given data list object . |
3,063 | protected function getFilter ( DataList $ list ) { if ( $ class = $ this -> getFilterClass ( ) ) { return Injector :: inst ( ) -> create ( $ class , $ list , $ this -> getParams ( ) ) ; } return DefaultFilter :: create ( $ list , $ this -> getParams ( ) ) ; } | Answers the filter object selected by the user or the default filter object . |
3,064 | protected function getFilterClassOptions ( ) { $ options = [ ] ; $ filters = ClassInfo :: subclassesFor ( Filter :: class ) ; array_shift ( $ filters ) ; foreach ( $ filters as $ filter ) { $ options [ $ filter ] = $ filter :: singleton ( ) -> getTitle ( ) ; } uasort ( $ options , function ( $ a , $ b ) { return ( $ a ... | Answers an array of options for the filter class field . |
3,065 | public function get ( ) { $ this -> provider -> enumKey ( $ this -> root , $ this -> path , $ keys = new Variant ( ) ) ; $ formatted = [ ] ; $ i = 0 ; foreach ( $ keys as $ key ) { $ formatted [ $ i ] = $ key ; $ i ++ ; } return $ formatted ; } | Returns the list of keys available from the registry . |
3,066 | public function getValue ( $ key ) { $ status = $ this -> provider -> getStringValue ( $ this -> root , $ this -> path , $ key , $ value = new Variant ( ) ) ; if ( $ status === 0 ) { return ( string ) $ value ; } return null ; } | Returns the value of a specific key in the current root and path of the registry . |
3,067 | public function assemble ( ) { $ query = "DELETE FROM {$this->getManager()->protect($this->getTable())}" ; $ query .= $ this -> assembleWhere ( ) ; $ order = $ this -> parseOrder ( ) ; if ( ! empty ( $ order ) ) { $ query .= " order by {$order}" ; } $ query .= $ this -> assembleLimit ( ) ; return $ query ; } | Joins together DELETE FROM WHERE ORDER and LIMIT parts of SQL query |
3,068 | public function hasContentAccessPriviledges ( $ gid , $ uoid ) { if ( ! UOID :: isValid ( $ uoid ) && $ uoid ) throw new AccessControlManagerException ( 'Illegal argument UOID: ' . $ uoid ) ; try { $ rules = $ this -> loadAccessControlRulesForUOID ( $ gid , $ uoid ) ; return $ this -> executeAccessControlRules ( $ gid ... | determines if a globalID has access priviledges for a specific resource |
3,069 | public function hasInterfaceAccessPriviledges ( $ owner , $ gid , $ interface , $ accessMethod = '*' ) { if ( $ interface == '' ) $ interface = '*' ; try { $ rules = $ this -> loadAccessControlRulesForInterface ( $ owner , $ gid , $ interface ) ; if ( $ accessMethod == AccessControlRuleObject :: ACCESS_TYPE_WRITE ) { f... | determines if a globalID has access priviledges for a specific interface |
3,070 | public function jscan ( $ count = 50 , array $ queues = [ ] , array $ states = [ ] , $ format = JScanIterator :: FORMAT_ID ) { $ iterator = new JScanIterator ( $ this -> stream , $ this -> log ) ; $ iterator -> setCount ( $ count ) ; $ iterator -> setQueues ( $ queues ) ; $ iterator -> setStates ( $ states ) ; $ iterat... | Retrieve an Iterator over available jobs on the connected Disque node . |
3,071 | public function createNew ( string $ slug , string $ attribute ) : array { return $ this -> sendPost ( sprintf ( '/profiles/%s/flags' , $ this -> userName ) , [ ] , [ 'slug' => $ slug , 'attribute' => $ attribute ] ) ; } | Creates a new flag for the given user . |
3,072 | public function add ( $ content , $ level = '' , $ timeout = 0 , $ priority = 0 , $ dismissable = true , $ area = '' ) { $ area = $ area ? : is_array ( $ content ) && isset ( $ content [ 'area' ] ) ? $ content [ 'area' ] : $ this -> workingArea ? : $ this -> defaultArea ; $ level = $ level ? : $ this -> defaultLevel ; ... | Add a message to the notifier |
3,073 | public function remove ( $ content = null , $ level = '' , $ area = '' ) { $ area = $ area ? : $ this -> workingArea ? : $ this -> defaultArea ; $ level = $ level ? : $ this -> defaultLevel ; $ this -> clear ( is_array ( $ content ) ? $ content : [ 'content' => $ content , 'level' => $ level , 'area' => $ area , ] ) ; ... | Remove a message from the notifier |
3,074 | public function clear ( $ params = [ ] ) { if ( isset ( $ params [ 'level' ] ) || isset ( $ params [ 'content' ] ) ) { $ level = isset ( $ params [ 'level' ] ) ? $ params [ 'level' ] : '' ; $ content = isset ( $ params [ 'content' ] ) ? $ params [ 'content' ] : '' ; $ area = isset ( $ params [ 'area' ] ) ? $ params [ '... | Clear a message that matches a set of params |
3,075 | public function get ( $ area = '' ) { $ area = $ area ? : $ this -> workingArea ? : $ this -> defaultArea ; $ messages = ( array ) Session :: get ( $ this -> id . '.' . $ area ) ; Session :: clear ( $ this -> id . '.' . $ area ) ; $ this -> clearWorking ( ) ; if ( $ this -> unique ) { $ content = [ ] ; $ messages = arr... | Get messages for an area |
3,076 | public function before ( $ link , $ area = '' ) { $ area = $ area ? : $ this -> workingArea ? : '' ; if ( isset ( $ this -> before [ $ link ] ) ) { $ this -> before [ $ link ] = array_merge ( $ this -> before [ $ link ] , explode ( ',' , $ area ) ) ; } else { $ this -> before [ $ link ] = explode ( ',' , $ area ) ; } $... | Add a link to execute before messages are added |
3,077 | public function style ( $ area ) { if ( in_array ( $ area , $ this -> jsIncluded ) || singleton ( 'env' ) -> get ( 'messages.exclude_js' ) || singleton ( 'env' ) -> get ( 'messages.exclude_' . $ area . '_js' ) ) { return ; } $ params = [ 'Before' => '' , 'Link' => singleton ( 'Milkyway\SS\FlashMessage\Controller' ) -> ... | Include JS and CSS for flash messages |
3,078 | protected function canView ( $ area ) { $ notifierController = singleton ( 'Milkyway\\SS\\FlashMessage\\Controller' ) ; if ( Control :: curr ( ) instanceof $ notifierController ) { return true ; } $ mapping = ( array ) singleton ( 'env' ) -> get ( 'messages.mapping' ) ; if ( isset ( $ mapping [ $ area ] ) ) { $ allowed... | Check whether the area is limited by controller type |
3,079 | private function getAuthenticatedVisitorsRatio ( $ visitors ) { $ ratio = [ 'authenticated' => 0 , 'guest' => 0 , ] ; foreach ( $ visitors as $ visitor ) { $ visitor -> hasUser ( ) ? $ ratio [ 'authenticated' ] += 1 : $ ratio [ 'guest' ] += 1 ; } return collect ( $ ratio ) -> transform ( function ( $ count , $ key ) { ... | Get the authenticated visitors ratio . |
3,080 | public function setLocalIpAddress ( $ address ) { if ( ! filter_var ( $ address , FILTER_VALIDATE_IP ) ) { throw new \ InvalidArgumentException ( 'Invalid ip address' ) ; } $ this -> networkIpVersion = ( strpos ( $ address , ':' ) === false ) ? NetworkNodeInterface :: IP_V4 : NetworkNodeInterface :: IP_V6 ; $ this -> n... | Sets listening address . |
3,081 | public function setLocalPort ( $ port ) { if ( $ port < 0 || $ port > 65535 || ! is_integer ( $ port ) ) { throw new \ InvalidArgumentException ( 'Invalid port' ) ; } $ this -> networkLocalPort = $ port ; } | Sets listening port . |
3,082 | function giveClient ( \ Predis \ Client $ client ) { if ( $ this -> client ) throw new exImmutable ; $ this -> client = $ client ; return $ this ; } | Set Redis Client Instance |
3,083 | function capture ( $ templateFullPathname , array $ __vars = array ( ) ) { if ( $ this -> _curr__captureVars === null ) $ this -> _curr__captureVars = $ __vars ; else ( ! empty ( $ __vars ) ) ? : $ __vars = $ this -> _curr__captureVars ; if ( ! file_exists ( $ templateFullPathname ) ) { $ backTrace = debug_backtrace ( ... | Capture Included File Into This Object |
3,084 | public function process ( ContainerBuilder $ container ) { $ parameterBag = $ container -> getParameterBag ( ) ; foreach ( $ container -> getDefinitions ( ) as $ id => $ definition ) { try { $ definition -> setClass ( $ parameterBag -> resolveValue ( $ definition -> getClass ( ) ) ) ; $ definition -> setFile ( $ parame... | Processes the ContainerBuilder to resolve parameter placeholders . |
3,085 | public function gcj_encrypt ( $ wgsLat , $ wgsLon ) { if ( ! $ this -> isInChina ( $ wgsLat , $ wgsLon ) ) return array ( 'lat' => $ wgsLat , 'lon' => $ wgsLon ) ; $ d = $ this -> delta ( $ wgsLat , $ wgsLon ) ; return array ( 'lat' => $ wgsLat + $ d [ 'lat' ] , 'lon' => $ wgsLon + $ d [ 'lon' ] ) ; } | WGS - 84 to GCJ - 02 |
3,086 | public function gcj_decrypt ( $ gcjLat , $ gcjLon ) { if ( ! $ this -> isInChina ( $ gcjLat , $ gcjLon ) ) return array ( 'lat' => $ gcjLat , 'lon' => $ gcjLon ) ; $ d = $ this -> delta ( $ gcjLat , $ gcjLon ) ; return array ( 'lat' => $ gcjLat - $ d [ 'lat' ] , 'lon' => $ gcjLon - $ d [ 'lon' ] ) ; } | GCJ - 02 to WGS - 84 |
3,087 | public function gcj_decrypt_exact ( $ gcjLat , $ gcjLon ) { $ initDelta = 0.01 ; $ threshold = 0.000000001 ; $ dLat = $ initDelta ; $ dLon = $ initDelta ; $ mLat = $ gcjLat - $ dLat ; $ mLon = $ gcjLon - $ dLon ; $ pLat = $ gcjLat + $ dLat ; $ pLon = $ gcjLon + $ dLon ; $ wgsLat = 0 ; $ wgsLon = 0 ; $ i = 0 ; while ( T... | GCJ - 02 to WGS - 84 exactly |
3,088 | public function bd_encrypt ( $ gcjLat , $ gcjLon ) { $ x = $ gcjLon ; $ y = $ gcjLat ; $ z = sqrt ( $ x * $ x + $ y * $ y ) + 0.00002 * sin ( $ y * $ this -> x_pi ) ; $ theta = atan2 ( $ y , $ x ) + 0.000003 * cos ( $ x * $ this -> x_pi ) ; $ bdLon = $ z * cos ( $ theta ) + 0.0065 ; $ bdLat = $ z * sin ( $ theta ) + 0.... | GCJ - 02 to BD - 09 |
3,089 | public function distance ( $ latA , $ lonA , $ latB , $ lonB ) { $ earthR = 6371000. ; $ x = cos ( $ latA * $ this -> PI / 180. ) * cos ( $ latB * $ this -> PI / 180. ) * cos ( ( $ lonA - $ lonB ) * $ this -> PI / 180 ) ; $ y = sin ( $ latA * $ this -> PI / 180. ) * sin ( $ latB * $ this -> PI / 180. ) ; $ s = $ x + $ ... | two point s distance |
3,090 | public function sendResponse ( ResponseInterface $ response ) { $ e = $ this -> getEvent ( ) ; $ e -> setResponse ( $ response ) ; $ e -> getApplication ( ) -> getEventManager ( ) -> trigger ( MvcEvent :: EVENT_FINISH , $ e ) ; exit ( ) ; } | Sends the response and terminates . |
3,091 | protected static function track ( ) { $ result = '' ; if ( config ( 'lumos.tracking' ) ) { $ result .= ' * @author ' . config ( 'app.owner' ) . "\n" ; $ result .= ' * creation time : ' . DateTime :: now ( ) . ' (' . time ( ) . ')' . "\n" ; } return $ result ; } | Add Tracking doc bloc . |
3,092 | protected function buildMessage ( $ body , EmailInterface $ email ) { $ message = "To: " . $ email -> getTo ( ) . "\r\n" ; $ message .= "Subject: " . $ email -> getSubject ( ) . "\r\n" ; $ message .= $ this -> buildHeaders ( $ email ) . "\r\n" ; $ message .= $ body ; return $ message ; } | Constructs a single string from the email body and headers . |
3,093 | public function logException ( FlattenException $ exception , Request $ request ) { $ ex = new Exception5xx ( ) ; $ ex -> setStatusCode ( $ this -> getStatusCode ( $ exception ) ) ; $ ex -> setFile ( $ exception -> getFile ( ) ) ; $ ex -> setLine ( $ exception -> getLine ( ) ) ; $ ex -> setTrace ( $ this -> getTrace ( ... | Log the actual exception |
3,094 | public static function check ( ) { if ( Session :: has ( self :: ENVIRONMENT_NAME ) ) { return true ; } Session :: forget ( self :: ENVIRONMENT_NAME ) ; return false ; } | Check if the session exists |
3,095 | public function registerEvents ( ) { Event :: listen ( 'auth.login' , function ( $ user ) { Session :: put ( 'kinvey' , $ user -> _kmd [ 'authtoken' ] ) ; } ) ; Event :: listen ( 'auth.logout' , function ( $ user ) { Session :: forget ( 'kinvey' ) ; } ) ; } | Register events for this service provider . |
3,096 | protected function magicGetName ( ) { if ( property_exists ( $ this , 'magicName' ) && ( ! empty ( $ this -> magicName ) ) ) { return $ this -> magicName ; } return get_class ( $ this ) ; } | Returns the name of the container |
3,097 | public function readDemPackage ( $ pathToDemFile , $ pathToDemNode ) { $ json = file_get_contents ( $ pathToDemFile ) ; $ data = json_decode ( $ json , true ) ; $ paths = explode ( self :: PS , $ pathToDemNode ) ; foreach ( $ paths as $ path ) { if ( strlen ( trim ( $ path ) ) > 0 ) { if ( isset ( $ data [ $ path ] ) )... | Read JSON file with DEM extract and return DEM node as an associative array . |
3,098 | protected function loadComposerData ( $ composerFile ) { if ( ! is_readable ( $ composerFile ) ) { throw new ExceptionPackageInfo ( 'Could not read composer data.' ) ; } $ this -> composerJson = json_decode ( file_get_contents ( $ composerFile ) , true ) ; } | Reads the composer data . |
3,099 | protected function guessBaseDir ( $ hintLocation , $ composerFileName ) { do { $ f = $ hintLocation . '/' . $ composerFileName ; if ( is_file ( $ f ) ) { return $ hintLocation ; } $ prevLocation = $ hintLocation ; $ hintLocation = $ this -> sanitisePaths ( dirname ( $ hintLocation ) ) ; $ ranOut = ( $ prevLocation === ... | Try to figure out root directory . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.