idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
11,100 | protected function resolveViewedUIComponent ( AbstractTemplate $ component , $ keyname = 'ui-components.viewed' ) { $ viewed = $ component -> views ( ) ; if ( empty ( $ viewed ) ) { return false ; } $ classname = get_class ( $ component ) ; view ( ) -> composer ( $ viewed , function ( ) use ( $ keyname , $ classname ) ... | Resolves viewed ui components |
11,101 | public function resolveUIComponentNamespace ( $ src , $ i = 0 ) { $ tokens = token_get_all ( $ src ) ; $ count = count ( $ tokens ) ; $ namespace = '' ; $ namespace_ok = false ; while ( $ i < $ count ) { $ token = $ tokens [ $ i ] ; if ( is_array ( $ token ) && $ token [ 0 ] === T_NAMESPACE ) { while ( ++ $ i < $ count... | Trying to get file namespace from file content |
11,102 | public function show ( $ id ) { $ component = $ this -> component ( $ id ) -> templateLayout ( ) ; $ html = $ component -> __toString ( ) ; if ( ! strlen ( $ html ) ) { return $ component -> render ( ) ; } return $ html ; } | Functionality of preview widget |
11,103 | protected function component ( $ id ) { $ model = $ this -> repository -> findOneById ( $ id ) ; if ( is_null ( $ model ) ) { return new JsonResponse ( [ 'message' => '' ] , 200 ) ; } $ classname = $ model -> data [ 'classname' ] ; $ instance = new $ classname ; if ( $ instance -> getAttribute ( 'ajaxable' ) === false ... | Renders ui component content |
11,104 | public function positions ( array $ data = null ) { if ( ! $ this -> savePosition ( $ data ) ) { return new JsonResponse ( [ 'message' => 'Unable to save ui component positions' , 500 ] ) ; } $ id = array_get ( $ data , 'current' ) ; $ component = $ this -> component ( $ id ) ; return ( $ component instanceof JsonRespo... | Saves current widget positions |
11,105 | protected function savePosition ( array $ data ) { DB :: transaction ( function ( ) use ( $ data ) { $ widgets = $ data [ 'widgets' ] ; foreach ( $ widgets as $ item ) { $ id = $ item [ 'widgetId' ] ; $ model = ComponentParams :: where ( 'id' , $ id ) -> first ( ) ; if ( is_null ( $ model ) ) { continue ; } $ position ... | Saves ui component position change |
11,106 | public function view ( $ id ) { $ component = null ; DB :: transaction ( function ( ) use ( $ id , & $ component ) { $ resource = Input :: get ( 'from' ) ; $ model = $ this -> repository -> findOneById ( $ id ) ; if ( is_null ( $ model ) ) { throw new ComponentNotFoundException ( 'Component not found' ) ; } $ data = $ ... | Creates instance of ui component |
11,107 | public function getInvisibleWidget ( $ formId , $ buttonLabel = 'Submit' , $ buttonClass = '' ) { $ hash = md5 ( uniqid ( $ formId , true ) ) ; return sprintf ( '<script> function onSubmit%s(token) { document.getElementById("%s").submit(); }</script><button class="g-recaptcha %s" data-sitekey="%s" d... | Render a button for the invisible captcha |
11,108 | public function verify ( $ response , $ remoteip = null ) { $ params = array ( 'secret' => $ this -> secret , 'response' => $ response , 'remoteip' => $ remoteip , ) ; $ response = $ this -> fetchResponse ( $ params ) ; if ( $ response [ 'success' ] ) { $ this -> errors = array ( ) ; return true ; } else { $ this -> er... | Verify a response string |
11,109 | public function verifyGlobals ( ) { $ response = isset ( $ _POST [ "g-recaptcha-response" ] ) ? $ _POST [ "g-recaptcha-response" ] : '' ; $ remoteip = isset ( $ _SERVER [ "REMOTE_ADDR" ] ) ? $ _SERVER [ "REMOTE_ADDR" ] : null ; return $ this -> verify ( $ response , $ remoteip ) ; } | Verify the response using the GLOBAL vars |
11,110 | public function verifyRequest ( Request $ request = null ) { $ request = $ request ? : $ this -> request ; $ response = $ request -> request -> get ( 'g-recaptcha-response' ) ; $ remoteip = $ request -> getClientIp ( ) ; return $ this -> verify ( $ response , $ remoteip ) ; } | Verify the response using a Symfony Request object |
11,111 | public function getErrorMessage ( ) { $ messages = array ( ) ; foreach ( $ this -> errors as $ error ) { if ( isset ( $ this -> errorMessages [ $ error ] ) ) { $ messages [ ] = $ this -> errorMessages [ $ error ] ; } else { $ messages [ ] = $ error ; } } return implode ( ' ' , $ messages ) ; } | Get the error messages as human readable message |
11,112 | protected function fetchResponse ( $ params ) { $ qs = http_build_query ( $ params ) ; $ response = file_get_contents ( $ this -> verifyUrl . '?' . $ qs ) ; return json_decode ( $ response , true ) ; } | Get a response from the API |
11,113 | protected function createAntaresDriver ( ) { $ theme = new Theme ( $ this -> app , $ this -> app -> make ( 'events' ) , $ this -> app -> make ( 'files' ) ) ; return $ theme -> initiate ( ) ; } | Create an instance of the antares theme driver . |
11,114 | public function request ( $ method , $ path , $ paramData ) { if ( $ method == 'get' && count ( $ paramData ) > 0 ) { $ path = $ path . '?' . http_build_query ( $ paramData ) ; $ paramData = array ( ) ; } $ this -> setSignature ( $ path , $ paramData ) ; $ req = $ this -> client -> createRequest ( $ method , $ path , a... | Dispatch API request |
11,115 | public function forever ( $ name , $ value , $ expire = 0 ) { if ( 0 === $ expire ) { $ expire = 31536000 * 5 ; } return $ this -> set ( $ name , $ value , $ expire ) ; } | Store a cookie for a long long time . |
11,116 | public function findExtensions ( ) : Extensions { $ extensions = new Extensions ( ) ; foreach ( $ this -> configRepository -> getPaths ( ) as $ path ) { $ composerPattern = $ this -> configRepository -> getRootPath ( ) . '/' . $ path . '/composer.json' ; $ composerFiles = $ this -> filesystem -> glob ( $ composerPatter... | Returns the collection with all available extensions in the file system . |
11,117 | public function resolveNamespace ( string $ path , bool $ asPackage = false ) : string { $ file = new File ( $ path ) ; $ pathInfo = array_filter ( explode ( DIRECTORY_SEPARATOR , trim ( str_replace ( [ $ this -> configRepository -> getRootPath ( ) , 'src' ] , '' , $ file -> getRealPath ( ) ) , DIRECTORY_SEPARATOR ) ) ... | Resolves a component or a module namespace by the given file path . |
11,118 | public function resolveExtensionPath ( $ path ) : string { $ app = rtrim ( base_path ( 'app' ) , '/' ) ; $ base = rtrim ( base_path ( ) , '/' ) ; return str_replace ( [ 'app::' , 'vendor::antares' , 'base::' ] , [ "{$app}/" , "{$base}/src" , "{$base}/" ] , $ path ) ; } | Resolve extension path . |
11,119 | static function encodeValue ( $ doc , $ name , $ value ) { switch ( gettype ( $ value ) ) { case "string" : { $ node = $ doc -> createElement ( $ name , $ value ) ; $ node -> setAttribute ( ggSOAPRequest :: XSI_PREFIX . ':type' , ggSOAPRequest :: XSD_PREFIX . ':string' ) ; return $ node ; } break ; case "boolean" : { $... | Encodes a PHP variable into a SOAP datatype . |
11,120 | protected function argumentsToString ( $ args ) { $ count = 0 ; $ isAssoc = $ args !== array_values ( $ args ) ; foreach ( $ args as $ key => $ value ) { $ count ++ ; if ( $ count >= 5 ) { if ( $ count > 5 ) { unset ( $ args [ $ key ] ) ; } else { $ args [ $ key ] = '...' ; } continue ; } if ( is_object ( $ value ) ) {... | arguments to String decorator |
11,121 | public function addClientValidation ( & $ grid ) { $ rules = $ grid -> rules ; $ form = $ grid -> attributes ; if ( ! array_key_exists ( 'id' , $ form ) ) { $ id = $ this -> generateID ( ) ; $ grid -> attributes ( array_merge ( $ form , [ 'id' => $ id ] ) ) ; $ form [ 'id' ] = $ id ; } if ( ! empty ( $ rules ) ) { $ fo... | create client side form validator |
11,122 | protected function attachRules ( & $ grid , array $ rules = null ) { $ fieldsets = $ grid -> fieldsets ( ) ; if ( ! empty ( Input :: get ( 'ajax' ) ) && Request :: ajax ( ) && ! is_null ( $ key = Input :: get ( 'key' ) ) ) { $ name = Crypt :: decrypt ( $ key ) ; $ fieldsets = $ this -> fieldPermissionAdapter -> resolve... | attach rules to form controls |
11,123 | protected function resolveRule ( $ rule ) { $ validation = [ ] ; if ( is_array ( $ rule ) ) { return $ validation ; } switch ( $ rule ) { case 'required' : $ validation [ 'required' ] = 'required' ; break ; default : if ( str_contains ( $ rule , ':' ) && ! str_contains ( $ rule , 'unique' ) ) { list ( $ name , $ value ... | resolve single form rule |
11,124 | protected function attachScripts ( ) { $ scripts = $ this -> container -> make ( 'config' ) -> get ( 'antares/html::form.scripts.client-side' ) ; $ container = $ this -> container -> make ( 'antares.asset' ) -> container ( $ scripts [ 'position' ] ) ; foreach ( $ scripts [ 'resources' ] as $ name => $ path ) { $ contai... | attach validator client side scripts |
11,125 | protected function getItemsFromCache ( ) { return 'cli' === PHP_SAPI ? $ this -> getItemsFromDatabase ( ) : $ this -> cache -> rememberForever ( $ this -> cacheKey , function ( ) { return $ this -> getItemsFromDatabase ( ) ; } ) ; } | Get items from cache . |
11,126 | public function forceForgetCache ( ) { return ! is_null ( $ this -> cache ) ? $ this -> cache -> forget ( $ this -> cacheKey ) : true ; } | forcing delete cache |
11,127 | protected function evaluateAssetWithDependencies ( $ asset , $ original , & $ sorted , & $ assets ) { foreach ( $ assets [ $ asset ] [ 'dependencies' ] as $ key => $ dependency ) { if ( ! $ this -> dependencyIsValid ( $ asset , $ dependency , $ original , $ assets ) ) { unset ( $ assets [ $ asset ] [ 'dependencies' ] [... | Evaluate an asset with dependencies . |
11,128 | protected function replaceAssetDependencies ( & $ assets ) { foreach ( $ assets as $ asset => $ value ) { if ( empty ( $ replaces = $ value [ 'replaces' ] ) ) { continue ; } foreach ( $ replaces as $ replace ) { unset ( $ assets [ $ replace ] ) ; } $ this -> resolveDependenciesForAsset ( $ assets , $ asset , $ replaces... | Replace asset dependencies . |
11,129 | protected function resolveDependenciesForAsset ( & $ assets , $ asset , $ replaces ) { foreach ( $ assets as $ name => $ value ) { $ changed = false ; foreach ( $ value [ 'dependencies' ] as $ key => $ dependency ) { if ( in_array ( $ dependency , $ replaces ) ) { $ changed = true ; unset ( $ value [ 'dependencies' ] [... | Resolve asset dependencies after replacement . |
11,130 | public function getDeleteSidebarItem ( $ column , $ config , $ value = null ) { if ( ! isset ( $ config [ 'classname' ] ) or ! class_exists ( $ config [ 'classname' ] ) or ! isset ( $ config [ 'values' ] ) ) { return false ; } $ instance = $ this -> app -> make ( $ config [ 'classname' ] ) ; $ values = ! is_null ( $ va... | creates removable sidebar filter items |
11,131 | protected function loadMiddleware ( ) { $ config = $ this -> app -> make ( 'config' ) ; $ this -> router -> middlewarePriority = $ this -> middlewarePriority ; $ this -> middleware = $ config -> get ( 'http.middleware' , [ ] ) ; $ middlewareGroups = $ config -> get ( 'http.middleware_groups' , [ ] ) ; foreach ( $ middl... | Load all configured middleware . |
11,132 | protected function handleRequest ( $ request , $ respondent ) { try { $ this -> app -> instance ( 'respondent' , $ respondent ) ; $ request -> enableHttpMethodParameterOverride ( ) ; $ response = $ this -> sendRequestThroughRouter ( $ request ) ; } catch ( Exception $ e ) { $ this -> reportException ( $ e ) ; $ respons... | Process the request and get response . |
11,133 | protected function createHttpRequest ( $ request ) { return new Request ( $ request -> get ?? [ ] , $ request -> post ?? [ ] , [ ] , $ request -> cookie ?? [ ] , $ request -> files ?? [ ] , $ this -> parseRequestServer ( $ request ) , $ request -> rawContent ( ) ) ; } | Create a Http request from the Swoole request . |
11,134 | protected function reportException ( Exception $ e ) { $ handler = $ this -> app -> make ( ExceptionHandler :: class ) ; $ handler -> report ( $ e ) ; } | Report the exception to a response . |
11,135 | public function handle ( Grid $ grid ) { $ name = $ grid -> name ; $ extension = app ( 'antares.extension' ) -> getActualExtension ( ) ; if ( is_null ( $ name ) or is_null ( $ extension ) ) { return false ; } $ namespace = $ extension . '.' . $ name ; if ( is_null ( app ( 'antares.memory' ) -> make ( 'registry' ) -> ge... | fire event to attach customfields rules to form grid |
11,136 | protected function getRulesForCustomFields ( $ namespace ) { $ rules = [ ] ; $ brand = antares ( 'memory' ) -> get ( 'brand.default' ) ; $ collection = app ( 'antares.customfields.model.view' ) -> query ( ) -> where ( 'namespace' , $ namespace ) -> where ( 'brand_id' , $ brand ) -> get ( ) ; if ( $ collection -> isEmpt... | get rules for customfields |
11,137 | public function domain ( $ forceBase = false ) { $ pattern = $ this -> domain ; if ( $ pattern === null && $ forceBase === true ) { $ pattern = $ this -> baseUrl ; } elseif ( Str :: contains ( $ pattern , '{{domain}}' ) ) { $ pattern = str_replace ( '{{domain}}' , $ this -> baseUrl , $ pattern ) ; } return $ pattern ; ... | Get route domain . |
11,138 | public function prefix ( $ forceBase = false ) { if ( ! is_string ( $ this -> prefix ) ) { return '/' ; } $ pattern = trim ( $ this -> prefix , '/' ) ; if ( $ this -> domain === null && $ forceBase === true ) { $ pattern = trim ( $ this -> basePrefix , '/' ) . "/{$pattern}" ; $ pattern = trim ( $ pattern , '/' ) ; } em... | Get route prefix . |
11,139 | public function root ( ) { $ http = ( $ this -> request -> secure ( ) ? 'https' : 'http' ) ; $ domain = trim ( $ this -> domain ( true ) , '/' ) ; $ prefix = $ this -> prefix ( true ) ; return trim ( "{$http}://{$domain}/{$prefix}" , '/' ) ; } | Get route root . |
11,140 | public function setBaseUrl ( $ root ) { $ baseUrl = str_replace ( [ 'https://' , 'http://' ] , '' , $ root ) ; $ base = explode ( '/' , $ baseUrl , 2 ) ; if ( count ( $ base ) > 1 ) { $ this -> basePrefix = array_pop ( $ base ) ; } $ this -> baseUrl = array_shift ( $ base ) ; return $ this ; } | Set base URL . |
11,141 | public function to ( $ to ) { $ root = $ this -> root ( ) ; $ to = trim ( $ to , '/' ) ; $ pattern = trim ( "{$root}/{$to}" , '/' ) ; return $ pattern !== '/' ? $ pattern : '' ; } | Get route to . |
11,142 | public function setField ( Closure $ value ) { $ this -> onValidate ( ) ; $ this -> attributes [ 'field' ] = $ value ; @ list ( $ name , $ type ) = explode ( ':' , $ this -> attributes [ 'type' ] ) ; $ whereType = [ 'name' => $ name , ] ; if ( ! is_null ( $ type ) ) { array_set ( $ whereType , 'type' , $ type ) ; } $ t... | Field attribute setter |
11,143 | private function queryAttributes ( Model $ model ) { $ data = [ 'user_id' => user ( ) -> id , 'namespace' => get_class ( $ model ) , 'foreign_id' => $ model -> id ] ; ( is_null ( $ this -> field ) ) ? array_set ( $ data , 'field_class' , get_called_class ( ) ) : array_set ( $ data , 'field_id' , $ this -> field -> id )... | Gets value query attributes |
11,144 | public function getValue ( ) { $ data = $ this -> queryAttributes ( $ this -> model ) ; $ fieldData = FieldData :: query ( ) -> where ( $ data ) -> first ( [ 'data' ] ) ; return ! is_null ( $ fieldData ) ? $ fieldData -> data : null ; } | Gets customfield value |
11,145 | public function getHeaders ( ) : array { $ headers = [ ] ; foreach ( $ this -> headers as $ name => $ values ) { $ name = implode ( '-' , array_map ( 'ucfirst' , explode ( '-' , strtolower ( $ name ) ) ) ) ; $ headers [ $ name ] = $ values ; } return $ headers ; } | Gets all message headers . |
11,146 | public function getFirstHeader ( string $ name ) : ? string { $ name = strtolower ( $ name ) ; return isset ( $ this -> headers [ $ name ] ) ? reset ( $ this -> headers [ $ name ] ) : null ; } | Returns the value of the first header by the given case - insensitive name or null if no such header is present . |
11,147 | public function getLastHeader ( string $ name ) : ? string { $ name = strtolower ( $ name ) ; return isset ( $ this -> headers [ $ name ] ) ? end ( $ this -> headers [ $ name ] ) : null ; } | Returns the value of the last header by the given case - insensitive name or null if no such header is present . |
11,148 | public function setHeader ( string $ name , $ value ) : Message { $ name = strtolower ( $ name ) ; $ this -> headers [ $ name ] = is_array ( $ value ) ? array_values ( $ value ) : [ $ value ] ; return $ this ; } | Sets a header replacing any existing values of any headers with the same case - insensitive name . |
11,149 | public function addHeader ( string $ name , $ value ) : Message { $ name = strtolower ( $ name ) ; if ( is_array ( $ value ) ) { $ value = array_values ( $ value ) ; $ this -> headers [ $ name ] = isset ( $ this -> headers [ $ name ] ) ? array_merge ( $ this -> headers [ $ name ] , $ value ) : $ value ; } else { $ this... | Appends a header value to any existing values associated with the given header name . |
11,150 | public function addHeaders ( array $ headers ) : Message { foreach ( $ headers as $ name => $ value ) { $ this -> addHeader ( $ name , $ value ) ; } return $ this ; } | Merges in an associative array of headers . |
11,151 | public function removeHeader ( string $ name ) : Message { $ name = strtolower ( $ name ) ; unset ( $ this -> headers [ $ name ] ) ; return $ this ; } | Removes a specific header by case - insensitive name . |
11,152 | public function isContentType ( string $ contentType ) : bool { $ thisContentType = $ this -> getHeader ( 'Content-Type' ) ; $ pos = strpos ( $ thisContentType , ';' ) ; if ( $ pos !== false ) { $ thisContentType = substr ( $ thisContentType , 0 , $ pos ) ; } return strtolower ( $ contentType ) === strtolower ( $ thisC... | Returns whether this message has the given Content - Type . |
11,153 | protected function loadSchedule ( $ schedule ) { if ( ( $ schedules = $ this -> app [ 'config' ] [ 'console.schedules' ] ) == null ) { return ; } foreach ( $ schedules as $ definition ) { $ type = $ definition [ 'type' ] ?? 'command' ; if ( ! method_exists ( $ this , $ method = 'define' . ucfirst ( $ type ) . 'Schedule... | Load the schedule tasks . |
11,154 | protected function defineCommandSchedule ( Schedule $ schedule , array $ definition ) { $ arguments = $ definition [ 'arguments' ] ?? [ ] ; $ event = $ schedule -> command ( $ definition [ 'command' ] , $ arguments ) ; $ this -> configureEvent ( $ event , $ definition ) ; } | Define schedule command . |
11,155 | protected function defineCallbackSchedule ( Schedule $ schedule , array $ definition ) { $ arguments = $ definition [ 'arguments' ] ?? [ ] ; $ event = $ schedule -> call ( $ definition [ 'callback' ] , $ arguments ) ; $ this -> configureEvent ( $ event , $ definition ) ; } | Define schedule callback . |
11,156 | protected function defineScriptSchedule ( Schedule $ schedule , array $ definition ) { $ arguments = $ definition [ 'arguments' ] ?? [ ] ; $ event = $ schedule -> exec ( $ definition [ 'script' ] , $ arguments ) ; $ this -> configureEvent ( $ event , $ definition ) ; } | Define schedule script . |
11,157 | protected function defineJobSchedule ( Schedule $ schedule , array $ definition ) { $ queue = $ definition [ 'queue' ] ?? [ ] ; $ event = $ schedule -> job ( $ definition [ 'job' ] , $ queue ) ; $ this -> configureEvent ( $ event , $ definition ) ; } | Define schedule job . |
11,158 | protected function configureEvent ( $ event , array $ definition ) { if ( isset ( $ definition [ 'cron' ] ) ) { $ event -> cron ( $ definition [ 'cron' ] ) ; } if ( isset ( $ definition [ 'singleton' ] ) && $ definition [ 'singleton' ] ) { $ event -> onOneServer ( ) ; } if ( isset ( $ definition [ 'mutex' ] ) && $ defi... | Configure the schedule event . |
11,159 | protected function compileColumnQuery ( $ query , $ method , $ parameters , $ column , $ keyword ) { if ( method_exists ( $ query , $ method ) && count ( $ parameters ) <= with ( new \ ReflectionMethod ( $ query , $ method ) ) -> getNumberOfParameters ( ) ) { if ( Str :: contains ( Str :: lower ( $ method ) , 'raw' ) |... | Perform filter column on selected field . |
11,160 | protected function parameterize ( ) { $ args = func_get_args ( ) ; $ keyword = count ( $ args ) > 2 ? $ args [ 2 ] : $ args [ 1 ] ; $ parameters = Helper :: buildParameters ( $ args ) ; $ parameters = Helper :: replacePatternWithKeyword ( $ parameters , $ keyword , '$1' ) ; return $ parameters ; } | Build Query Builder Parameters . |
11,161 | protected function compileRelationSearch ( $ query , $ relation , $ column , $ keyword ) { $ myQuery = clone $ this -> query ; $ myQuery -> orWhereHas ( $ relation , function ( $ q ) use ( $ column , $ keyword , $ query ) { $ sql = $ q -> select ( $ this -> connection -> raw ( 'count(1)' ) ) -> where ( $ column , 'like... | Add relation query on global search . |
11,162 | protected function compileGlobalSearch ( $ query , $ column , $ keyword ) { if ( $ this -> isSmartSearch ( ) ) { $ column = $ this -> castColumn ( $ column ) ; $ sql = $ column . ' LIKE ?' ; if ( $ this -> isCaseInsensitive ( ) ) { $ sql = 'LOWER(' . $ column . ') LIKE ?' ; $ keyword = Str :: lower ( $ keyword ) ; } $ ... | Add a query on global search . |
11,163 | public function castColumn ( $ column ) { $ column = $ this -> connection -> getQueryGrammar ( ) -> wrap ( $ column ) ; if ( $ this -> database === 'pgsql' ) { $ column = 'CAST(' . $ column . ' as TEXT)' ; } elseif ( $ this -> database === 'firebird' ) { $ column = 'CAST(' . $ column . ' as VARCHAR(255))' ; } return $ ... | Wrap a column and cast in pgsql . |
11,164 | public function sort ( $ str_field , $ str_direction = self :: DESC ) { $ this -> arr_sorts [ ] = [ $ str_field , $ str_direction ] ; return $ this ; } | Sort results by a field in ASCending order |
11,165 | public function finish ( ) { if ( isset ( $ this -> components ) ) { foreach ( $ this -> components as $ name => $ options ) { $ this -> dispatcher -> finish ( $ name , $ options ) ; } } $ this -> components = new Collection ( ) ; return $ this ; } | Shutdown all extensions . |
11,166 | protected function findErrors ( ) { $ session = session ( ) ; if ( ! $ session -> has ( 'errors' ) || ! $ session -> get ( 'errors' ) -> hasBag ( 'default' ) ) { return ; } $ messageBag = session ( ) -> get ( 'errors' ) -> getBag ( 'default' ) ; if ( isset ( $ messageBag -> messages ( ) [ $ this -> name ] ) ) { foreach... | lookup for validation errors for this control |
11,167 | protected function render ( ) { $ this -> findErrors ( ) ; if ( ! $ this -> label instanceof AbstractLabel ) { $ this -> setLabel ( new Label ( ucfirst ( str_replace ( '_' , ' ' , $ this -> name ) ) ) ) ; } if ( ! $ this -> decorator instanceof AbstractDecorator ) { $ this -> setDecorator ( ( new HorizontalDecorator ( ... | Render control to html |
11,168 | protected function checkReceivedDataMagic ( $ data ) { if ( ! Str :: startsWith ( $ data , self :: MAGIC_HEADER ) ) { throw new TransportException ( 'Receive data with error bytes.' , TransportException :: REMOTE ) ; } } | Check the data just received . |
11,169 | public function findOne ( $ attributes , $ uri ) { $ where = [ 'resource' => $ uri , 'name' => snake_case ( array_get ( $ attributes , 'name' ) ) ] ; $ components = $ this -> components -> filter ( function ( $ item ) use ( $ where ) { return $ item -> resource == array_get ( $ where , 'resource' ) && $ item -> name ==... | Finds ui component details |
11,170 | protected function recursiveCreateDir ( $ path ) { if ( $ this -> isDirectory ( $ path ) ) { return ; } $ directories = explode ( $ this -> pathSeparator , $ path ) ; if ( count ( $ directories ) > 1 ) { $ parentDirectories = array_splice ( $ directories , 0 , count ( $ directories ) - 1 ) ; $ this -> recursiveCreateDi... | Recursively create directories . |
11,171 | public function has ( $ path ) { $ location = $ this -> applyPathPrefix ( $ path ) ; try { $ this -> share -> stat ( $ location ) ; } catch ( NotFoundException $ e ) { return false ; } return true ; } | Determine if a file or directory exists . |
11,172 | public function getMetadata ( $ path ) { $ location = $ this -> applyPathPrefix ( $ path ) ; try { $ file = $ this -> share -> stat ( $ location ) ; } catch ( NotFoundException $ e ) { return false ; } return $ this -> normalizeFileInfo ( $ file ) ; } | Get all of the metadata for a file or directory . |
11,173 | public function getMimetype ( $ path ) { $ metadata = $ this -> read ( $ path ) ; if ( $ metadata === false ) { return false ; } $ metadata [ 'mimetype' ] = Util :: guessMimeType ( $ path , $ metadata [ 'contents' ] ) ; return $ metadata ; } | Get the MIME type of a file . |
11,174 | protected function deleteContents ( $ path ) { $ contents = $ this -> listContents ( $ path , true ) ; foreach ( array_reverse ( $ contents ) as $ object ) { $ location = $ this -> applyPathPrefix ( $ object [ 'path' ] ) ; if ( $ object [ 'type' ] === 'dir' ) { $ this -> share -> rmdir ( $ location ) ; } else { $ this ... | Delete the contents of a directory . |
11,175 | protected function isDirectory ( $ path ) { $ location = $ this -> applyPathPrefix ( $ path ) ; if ( empty ( $ location ) ) { return true ; } try { $ file = $ this -> share -> stat ( $ location ) ; } catch ( NotFoundException $ e ) { return false ; } return $ file -> isDirectory ( ) ; } | Determine if the specified path is a directory . |
11,176 | public function render ( ) { $ params = isset ( $ this -> params [ 'attributes' ] ) ? $ this -> params [ 'attributes' ] : $ this -> params ; $ id = ! isset ( $ params [ 'id' ] ) ? $ params [ 'name' ] . '-' . str_random ( 4 ) : $ params [ 'id' ] ; $ script = $ this -> script ( $ id , $ params ) ; $ attributes = app ( 'h... | renders infinity select control |
11,177 | protected function script ( $ id , $ params ) { $ handler = $ this -> handler = 'handler' . str_random ( 4 ) ; $ options = array_replace_recursive ( $ this -> defaults ( ) [ 'pluginOptions' ] , $ params [ 'pluginOptions' ] ) ; $ decorated = JavaScriptDecorator :: decorate ( $ options ) ; return $ this -> init ( $ id ) ... | creates javascript select scripts |
11,178 | protected function defaults ( ) { return [ 'options' => [ 'placeholder' => 'Search for a repo ...' ] , 'pluginOptions' => [ 'allowClear' => true , 'minimumInputLength' => 0 , 'minimumResultsForSearch' => 'Infinity' , 'ajax' => [ 'dataType' => 'json' , 'delay' => 250 , 'data' => new JavaScriptExpression ( $ this -> ajax... | default plugin properties |
11,179 | protected function getButtonLink ( ExtensionContract $ extension , string $ action , string $ icon ) : string { $ actionUrl = URL :: route ( area ( ) . '.modules.' . $ action , [ 'vendor' => $ extension -> getVendorName ( ) , 'name' => $ extension -> getPackageName ( ) , 'csrf' => true , ] ) ; $ notWritablePaths = $ th... | Returns buttons for each row . |
11,180 | protected function getStatusColumn ( ) : Closure { return function ( ExtensionContract $ extension ) { switch ( $ extension -> getStatus ( ) ) { case ExtensionContract :: STATUS_ACTIVATED : return '<span class="label-basic label-basic--success">' . trans ( 'antares/foundation::label.extensions.statuses.active' ) . '</s... | Returns status column . |
11,181 | protected function getNameColumn ( ) : Closure { return function ( ExtensionContract $ package ) { $ name = $ package -> getFriendlyName ( ) ; $ url = $ package -> getPackage ( ) -> getHomepage ( ) ; if ( $ url ) { return ( string ) HTML :: link ( $ url , $ name , [ 'target' => '_blank' , ] ) ; } return $ name ; } ; } | Returns name column . |
11,182 | protected function getAuthorsColumn ( ) : Closure { return function ( ExtensionContract $ extension ) { $ authors = array_map ( function ( array $ author ) { if ( array_key_exists ( 'email' , $ author ) ) { return ( string ) HTML :: mailto ( $ author [ 'email' ] , $ author [ 'name' ] ) ; } return $ author [ 'name' ] ; ... | Returns authors column . |
11,183 | public function push ( $ data , $ finish = true , $ binary = false ) { return $ this -> server -> push ( $ this -> id , $ data , $ binary ? WEBSOCKET_OPCODE_BINARY : WEBSOCKET_OPCODE_TEXT , $ finish ) ; } | Push data to the client . |
11,184 | public function close ( $ code = 1000 , $ reason = '' ) { return $ this -> server -> disconnect ( $ this -> id , $ code , $ reason ) ; } | Close to the connection . |
11,185 | public function createFromConfig ( string $ path ) : SettingsContract { $ configData = ( array ) $ this -> filesystem -> getRequire ( $ path ) ; return $ this -> createFromData ( $ configData ) ; } | Returns the settings by the given configuration file . |
11,186 | public function createFromData ( array $ configData ) : SettingsContract { $ data = ( array ) Arr :: get ( $ configData , 'data' , [ ] ) ; $ rules = ( array ) Arr :: get ( $ configData , 'rules' , [ ] ) ; $ phrases = ( array ) Arr :: get ( $ configData , 'phrases' , [ ] ) ; $ customUrl = ( string ) Arr :: get ( $ confi... | Returns the settings by the given configuration array . |
11,187 | public function render ( $ name , $ data = null ) { if ( ! isset ( $ this -> macros [ $ name ] ) ) { throw new BadMethodCallException ( "Method [$name] does not exist." ) ; } return call_user_func ( $ this -> macros [ $ name ] , $ data ) ; } | Render the macro . |
11,188 | public function insert ( $ data ) { DB :: transaction ( function ( ) use ( $ data ) { $ data [ 'code' ] = strtolower ( $ data [ 'code' ] ) ; $ model = new Languages ( $ data ) ; $ model -> save ( ) ; $ inserts = $ this -> prepareMultiInsert ( $ data [ 'code' ] ) ; DB :: table ( 'tbl_translations' ) -> insert ( $ insert... | store new language in database |
11,189 | protected function prepareMultiInsert ( $ code ) { $ default = Languages :: where ( 'is_default' , 1 ) -> first ( ) -> code ; $ translations = Translation :: where ( 'locale' , $ default ) -> get ( ) -> toArray ( ) ; $ translation = new Translation ( ) ; $ guarded = $ translation -> getGuarded ( ) ; $ langId = Language... | prepare data before multiinsert translations from default |
11,190 | public function findByLocale ( array $ params = [ ] ) { return ( empty ( $ params ) ) ? $ this -> fetchAll ( ) : $ this -> makeModel ( ) -> whereIn ( 'code' , array_values ( $ params ) ) -> get ( ) ; } | Finds languages by specified locale |
11,191 | public function save ( ExtensionContract $ extension , array $ attributes = [ ] ) : ExtensionModel { $ identity = [ 'vendor' => $ extension -> getVendorName ( ) , 'name' => $ extension -> getPackageName ( ) , ] ; $ model = ExtensionModel :: query ( ) -> updateOrCreate ( $ identity , $ attributes ) ; return $ model ; } | Create or update the package . |
11,192 | protected function getKeyId ( $ name ) { return isset ( $ this -> keyMap [ $ name ] ) ? $ this -> keyMap [ $ name ] [ 'id' ] : null ; } | Is given key a new content . |
11,193 | protected function resolver ( ) { $ model = Arr :: get ( $ this -> config , 'model' , $ this -> name ) ; return $ this -> repository -> make ( $ model ) -> newInstance ( ) ; } | get handler model instance |
11,194 | protected function login ( Request $ request , User $ user ) { impersonate ( ) -> login ( $ user ) ; if ( $ request -> has ( 'redirect_to' ) ) { return redirect ( $ request -> get ( 'redirect_to' ) ) ; } return back ( ) ; } | Impersonate the given user |
11,195 | protected function logout ( Request $ request ) { impersonate ( ) -> logout ( ) ; if ( $ request -> has ( 'redirect_to' ) ) { return redirect ( $ request -> get ( 'redirect_to' ) ) ; } return back ( ) ; } | Logout as the impersonated user Log back in as the original user |
11,196 | private function setLocale ( $ locale , $ request ) { $ allowedLangs = array_keys ( Localizer :: allowedLanguages ( ) ) ; if ( config ( 'localizer.block_unallowed_langs' ) && ! in_array ( $ locale , $ allowedLangs ) ) { abort ( 404 , 'Unallowed language' ) ; } if ( Auth :: check ( ) ) { $ user = Auth :: User ( ) ; $ us... | Set locale if it s allowed . |
11,197 | public function setHome ( $ locale , Request $ request ) { $ this -> setLocale ( $ locale , $ request ) ; return redirect ( url ( '/' ) ) ; } | Set locale and return home url . |
11,198 | public function set ( $ locale , Request $ request ) { $ this -> setLocale ( $ locale , $ request ) ; return redirect ( ) -> back ( ) ; } | Set locale and return back . |
11,199 | public function compose ( $ name = null , $ options = array ( ) ) { if ( $ name instanceof View ) { $ name = null ; } if ( is_null ( $ this -> widget ) ) { return false ; } $ this -> widget -> make ( ( is_null ( $ name ) ? 'pane.left' : $ name ) ) -> add ( isset ( $ options [ 'name' ] ) ? $ options [ 'name' ] : $ this ... | Handle pane for left conatiner . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.