idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
15,000
public function views ( ) { Artisan :: call ( 'view:clear' ) ; $ this -> log -> info ( sprintf ( "%s %s" , trans ( 'cms::utilities.views.success' ) , trans ( 'cms::utilities.field.executed_by' , [ 'name' => $ this -> getCurrentUserName ( ) ] ) ) ) ; return $ this -> notifySuccess ( trans ( 'cms::utilities.views.success...
Clear views manually .
15,001
public function route ( $ task ) { if ( ! in_array ( $ task , [ 'cache' , 'clear' ] ) ) { $ this -> log -> info ( sprintf ( "%s %s" , trans ( 'cms::utilities.route.not_allowed' , [ 'task' => $ task ] ) , trans ( 'cms::utilities.field.executed_by' , [ 'name' => $ this -> getCurrentUserName ( ) ] ) ) ) ; return $ this ->...
Clear routes manually .
15,002
public function logs ( Request $ request , DataTables $ dataTables ) { if ( $ request -> input ( 'l' ) ) { LaravelLogViewer :: setFile ( base64_decode ( $ request -> input ( 'l' ) ) ) ; } if ( $ request -> input ( 'dl' ) ) { return response ( ) -> download ( LaravelLogViewer :: pathToLogFile ( base64_decode ( $ request...
Log viewer .
15,003
public function generate ( $ input , $ output , array $ options = array ( ) , $ overwrite = false ) { $ this -> log ( sprintf ( 'Generate from file (%s) to file (%s)' , $ input , $ output ) ) ; return $ this -> getGenerator ( ) -> generate ( $ input , $ output , $ options , $ overwrite ) ; }
Generates the output media file from the specified input HTML file
15,004
public function generateFromHtml ( $ html , $ output , array $ options = array ( ) , $ overwrite = false ) { $ this -> log ( sprintf ( 'Generate output in file (%s) from html.' , $ output ) ) ; return $ this -> getGenerator ( ) -> generateFromHtml ( $ html , $ output , $ options , $ overwrite ) ; }
Generates the output media file from the given HTML
15,005
public function getOutput ( $ input , array $ options = array ( ) ) { $ this -> log ( sprintf ( 'Getting output from file (%s)' , $ input ) ) ; return $ this -> getGenerator ( ) -> getOutput ( $ input , $ options ) ; }
Returns the output of the media generated from the specified input HTML file
15,006
public function getOutputFromView ( $ view , array $ parameters = array ( ) , array $ options = array ( ) ) { $ this -> log ( sprintf ( 'Get converted output from view (%s).' , $ view ) ) ; $ html = $ this -> getTemplatingEngine ( ) -> render ( $ view , $ parameters ) ; return $ this -> getOutputFromHtml ( $ html , $ o...
Retrieve the output from a Symfony view . This uses the selected template engine and renders it trough that .
15,007
public function downloadFromView ( $ view , array $ parameters = array ( ) , array $ options = array ( ) ) { $ this -> log ( sprintf ( 'Download pdf from view (%s).' , $ view ) ) ; $ contentDisposition = 'attachment; filename="' . $ this -> getName ( ) . '"' ; return $ this -> generateResponse ( $ view , $ contentDispo...
From a given view and parameters create the proper response so we can easily download the file .
15,008
private function generateResponse ( $ view , $ contentDisposition , $ parameters , $ options ) { return new Response ( $ this -> getOutputFromView ( $ view , $ parameters , $ options ) , 200 , array ( 'Content-Type' => 'application/pdf' , 'Content-Disposition' => $ contentDisposition , ) ) ; }
Create a Response object for the inputted data .
15,009
protected function bootCustomBladeDirectives ( ) { $ blade = $ this -> app [ 'blade.compiler' ] ; $ blade -> directive ( 'tooltip' , function ( $ expression ) { return "<?php echo app('Yajra\\CMS\\View\\Directives\\TooltipDirective')->handle({$expression}); ?>" ; } ) ; $ blade -> directive ( 'pageHeader' , function ( $...
Boot custom blade directives .
15,010
protected function registerProviders ( ) { $ this -> app -> register ( ConfigurationServiceProvider :: class ) ; $ this -> app -> register ( RouteServiceProvider :: class ) ; $ this -> app -> register ( ViewComposerServiceProvider :: class ) ; $ this -> app -> register ( BaumServiceProvider :: class ) ; $ this -> app -...
Registered required administrator providers .
15,011
protected function registerBindings ( ) { $ this -> app -> singleton ( PageHeaderDirective :: class , PageHeaderDirective :: class ) ; $ this -> app -> singleton ( TooltipDirective :: class , TooltipDirective :: class ) ; $ this -> app -> singleton ( SearchEngine :: class , LocalSearch :: class ) ; }
Register IOC bindings .
15,012
public function create ( ) { $ role = new Role ; $ permissions = Permission :: all ( ) ; $ selectedPermissions = $ this -> request -> old ( 'permissions' , [ ] ) ; return view ( 'administrator.roles.create' , compact ( 'role' , 'permissions' , 'selectedPermissions' ) ) ; }
Show role form .
15,013
public function store ( ) { $ this -> validate ( $ this -> request , [ 'name' => 'required' , 'slug' => 'required|unique:roles,slug' , ] ) ; $ role = Role :: create ( $ this -> request -> all ( ) ) ; $ role -> syncPermissions ( $ this -> request -> get ( 'permissions' , [ ] ) ) ; flash ( ) -> success ( 'Role ' . $ role...
Store a newly created role .
15,014
public function update ( Role $ role ) { $ this -> validate ( $ this -> request , [ 'name' => 'required' , 'slug' => 'required|unique:roles,slug,' . $ role -> id , ] ) ; $ role -> name = $ this -> request -> get ( 'name' ) ; if ( ! $ role -> system ) { $ role -> slug = $ this -> request -> get ( 'slug' ) ; } $ role -> ...
Update role permission .
15,015
public function destroy ( Role $ role ) { if ( ! $ role -> system ) { try { $ role -> delete ( ) ; return $ this -> notifySuccess ( 'Role successfully deleted!' ) ; } catch ( QueryException $ e ) { return $ this -> notifyError ( $ e -> getMessage ( ) ) ; } } return $ this -> notifyError ( 'Role is protected and cannot ...
Remove selected role .
15,016
public function printPHPCSUsage ( ) { ob_start ( ) ; parent :: printPHPCSUsage ( ) ; $ help = ob_get_contents ( ) ; ob_end_clean ( ) ; echo $ this -> fixHelp ( $ help ) ; }
Prints out the usage information for PHPCS .
15,017
private function fixHelp ( $ help ) { $ help = $ this -> fixCLIName ( $ help ) ; $ help = $ this -> fixStandard ( $ help ) ; return $ help ; }
alter the PHP_CodeSniffer_CLI usage message to match FuelPHPCS
15,018
public function getThumbnailImage ( $ alias , $ options = [ ] ) { $ thumbnail = $ this -> getThumbnailModel ( ) ; if ( empty ( $ thumbnail ) ) { return '' ; } return $ thumbnail -> getThumbImage ( $ alias , $ options ) ; }
Html thumbnail image tag
15,019
private function getDeclaringClass ( \ Reflector $ reflector ) : ? \ ReflectionClass { if ( $ reflector instanceof \ ReflectionClass ) { return $ reflector ; } if ( $ reflector instanceof \ ReflectionProperty ) { return $ reflector -> getDeclaringClass ( ) ; } if ( $ reflector instanceof \ ReflectionMethod ) { return $...
Returns the ReflectionClass of the given Reflector .
15,020
public function getUrl ( $ id , $ options = [ ] ) { $ cloudinary = $ this -> cloudinary ; return $ cloudinary :: cloudinary_url ( $ id , $ options ) ; }
Get the cloudinary URL .
15,021
public static function getAssertionIdentifier ( $ identifier = null ) { $ methodName = static :: $ suite -> getName ( ) ; static :: $ assertionsInTest [ $ methodName ] = isset ( static :: $ assertionsInTest [ $ methodName ] ) ? static :: $ assertionsInTest [ $ methodName ] : - 1 ; $ name = $ methodName . '-' . ++ stati...
Get an unique identifier for this particular assertion .
15,022
protected function generateMenu ( $ menuBuilder , $ menu ) { $ subMenu = $ this -> registerMenu ( $ menuBuilder , $ menu ) ; $ menu -> children -> each ( function ( Menu $ subItem ) use ( $ subMenu ) { $ subMenuChild = $ this -> registerMenu ( $ subMenu , $ subItem ) ; if ( count ( $ subItem -> children ) ) { $ this ->...
Generate the menu .
15,023
public function convertToString ( $ html ) { $ externalJavaScript = $ this -> extractExternalJavaScript ( $ html ) ; return $ this -> replaceJavaScriptTags ( $ html , $ externalJavaScript ) ; }
Extract all the linked JS files and put them in the proper place on the given HTML string .
15,024
public function extractExternalJavaScript ( $ html ) { $ matches = array ( ) ; preg_match_all ( '!' . $ this -> getExternalJavaScriptRegex ( ) . '!isU' , $ html , $ matches ) ; $ links = $ this -> createJavaScriptPaths ( $ matches [ 'links' ] ) ; return array ( 'tags' => $ matches [ 0 ] , 'links' => $ links ) ; }
Given a HTML string find all the JS files that should be loaded .
15,025
private function createJavaScriptPaths ( array $ javascripts ) { $ files = array ( ) ; foreach ( $ javascripts as $ file ) { if ( ! $ this -> isExternalJavaScriptFile ( $ file ) ) { if ( false !== strpos ( $ file , '?' ) ) { $ file = strstr ( $ file , '?' , true ) ; } $ file = $ this -> getBasePath ( ) . $ file ; } $ f...
Check if a JavaScript file is a local or externalJavaScript file or . If it is a local file prepend our basepath to the link so we can properly fetch the data to insert .
15,026
private function getJavaScriptContent ( $ path ) { if ( $ this -> isExternalJavaScriptFile ( $ path ) ) { $ fileData = $ this -> getRequestHandler ( ) -> getContent ( $ path ) ; } else { $ fileData = '' ; if ( file_exists ( $ path ) ) { $ fileData = file_get_contents ( $ path ) ; } } return "<script type=\"text/javascr...
Fetch the content of a JavaScript file from a given path .
15,027
private function replaceJavaScriptTags ( $ html , array $ javaScriptFiles ) { foreach ( $ javaScriptFiles [ 'links' ] as $ key => $ file ) { if ( ! $ this -> isExternalJavaScriptFile ( $ file ) ) { $ html = str_replace ( $ javaScriptFiles [ 'tags' ] [ $ key ] , $ this -> getJavaScriptContent ( $ file ) , $ html ) ; } }...
Replace the JavaScript tags that do external requests with inline script blocks .
15,028
public static function key ( $ key ) { $ config = static :: where ( 'key' , $ key ) -> first ( ) ; return $ config -> value ?? config ( $ key , null ) ; }
Get value by key .
15,029
public function slugList ( ) { $ categories = explode ( '/' , $ this -> alias ( ) ) ; $ html = [ ] ; foreach ( $ categories as $ category ) { $ html [ ] = new HtmlString ( '<span class="label label-info">' . e ( Str :: title ( $ category ) ) . '</span>&nbsp;' ) ; } return new HtmlString ( implode ( '' , $ html ) ) ; }
Display nested categories of the article .
15,030
public function start ( ) { $ server = $ this -> createServerManager ( ) ; if ( $ server -> isRunning ( ) ) { $ serverOpts = $ server -> getServerSetting ( ) ; \ output ( ) -> writeln ( "<error>The server have been running!(PID: {$serverOpts['masterPid']})</error>" , true , true ) ; } else { $ serverOpts = $ server -> ...
Start the webSocket server
15,031
public function reload ( ) { $ server = $ this -> createServerManager ( ) ; if ( ! $ server -> isRunning ( ) ) { \ output ( ) -> writeln ( '<error>The server is not running! cannot reload</error>' , true , true ) ; } \ output ( ) -> writeln ( sprintf ( '<info>Server %s is reloading</info>' , input ( ) -> getScript ( ) ...
Reload worker processes for the running server
15,032
public function stop ( ) { $ server = $ this -> createServerManager ( ) ; if ( ! $ server -> isRunning ( ) ) { \ output ( ) -> writeln ( '<error>The server is not running! cannot stop</error>' , true , true ) ; } $ serverOpts = $ server -> getServerSetting ( ) ; $ pidFile = $ serverOpts [ 'pfile' ] ; \ output ( ) -> wr...
Stop the running server
15,033
public function restart ( ) { $ server = $ this -> createServerManager ( ) ; if ( $ server -> isRunning ( ) ) { $ this -> stop ( ) ; } $ server -> setDaemonize ( ) ; $ this -> start ( ) ; }
Restart the running server
15,034
public static function cutStr ( $ str , $ length = 100 , $ postfix = '...' ) { if ( strlen ( $ str ) < $ length ) return $ str ; $ temp = substr ( $ str , 0 , $ length ) ; return substr ( $ temp , 0 , strrpos ( $ temp , ' ' ) ) . $ postfix ; }
Truncates the string to a certain number of characters without breaking words .
15,035
public static function isJustInstalled ( ) { $ types = Type :: find ( ) -> all ( ) ; $ categories = Category :: find ( ) -> all ( ) ; return empty ( $ types ) || empty ( $ categories ) ? : false ; }
Check that blog just installed
15,036
public function getAvailableSetFiles ( ) { $ arrSets = array ( ) ; foreach ( $ GLOBALS [ 'TL_CONFIG' ] [ 'advancedClassesSets' ] as $ key => $ value ) { if ( ! strpos ( $ value , "system/" ) !== false ) { $ arrSets [ $ value ] = basename ( $ value ) . ' (custom)' ; continue ; } $ arrSets [ $ value ] = basename ( $ valu...
Return all available sets
15,037
protected function authorizeResource ( $ resource ) { if ( $ this -> isEditing ( $ resource ) ) { return $ this -> user ( ) -> can ( $ resource . '.update' ) ; } return $ this -> user ( ) -> can ( $ resource . '.create' ) ; }
Check if user is authorized to perform the action .
15,038
public function setParametersAttribute ( $ parameters ) { if ( is_array ( $ parameters ) ) { $ this -> attributes [ 'parameters' ] = json_encode ( $ parameters ) ; } else { $ this -> attributes [ 'parameters' ] = $ parameters ; } }
Parameters attribute setter .
15,039
public function index ( Request $ request ) { $ currentPath = $ request -> get ( 'path' ) ; $ dir = storage_path ( 'app/public/' . $ currentPath ) ; $ imageFiles = $ this -> getImageFiles ( $ dir ) ; foreach ( Finder :: create ( ) -> in ( $ dir ) -> sortByType ( ) -> directories ( ) as $ file ) { $ imageFiles -> name (...
Get files by directory path .
15,040
protected function getImageFiles ( $ path ) { $ finder = Finder :: create ( ) -> in ( $ path ) -> sortByType ( ) -> depth ( 0 ) ; foreach ( config ( 'media.images_ext' ) as $ file ) { $ finder -> name ( '*' . $ file ) ; } return $ finder ; }
Get image files by path .
15,041
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Yii :: $ app -> session -> setFlash ( 'postSaved' ) ; } if ( $ model -> type -> show_category ) { $ model -> setScenario ( 'required_category' ) ; } re...
Updates an existing Post model . If update is successful the browser will be redirected to the view page .
15,042
protected function renderProperties ( OutputInterface $ output , Response $ response ) { $ table = new Table ( $ output ) ; $ table -> setHeaders ( [ 'Property' , 'Value' ] ) ; foreach ( $ response as $ property => $ value ) { if ( is_scalar ( $ value ) ) { $ table -> addRow ( [ $ property , $ value ] ) ; } } $ table -...
Render the general properties .
15,043
protected function renderDerivedResources ( OutputInterface $ output , array $ derivedResources ) { $ table = new Table ( $ output ) ; $ table -> setHeaders ( [ [ new TableCell ( 'Derived resources' , [ 'colspan' => 5 ] ) ] , [ 'ID' , 'Format' , 'Size' , 'Transformation' , 'URL' ] , ] ) ; foreach ( $ derivedResources a...
Render the derived resources .
15,044
private function formatSize ( $ bytes ) { $ unit = 1024 ; if ( $ bytes <= $ unit ) { return $ bytes . ' b' ; } $ exp = ( int ) ( log ( $ bytes ) / log ( $ unit ) ) ; $ pre = 'kMGTPE' ; $ pre = $ pre [ $ exp - 1 ] ; return sprintf ( '%.1f %sB' , $ bytes / pow ( $ unit , $ exp ) , $ pre ) ; }
Format the size of a file .
15,045
public function authenticated ( Request $ request , $ user ) { if ( $ user -> is_blocked || ! $ user -> is_activated ) { if ( $ user -> is_blocked ) { $ message = 'Your account is currently banned from accessing the site!' ; } else { $ message = 'Your account is not yet activated!' ; } $ this -> guard ( ) -> logout ( )...
Handle event when the user was authenticated .
15,046
public function filter ( array $ information ) { $ information = $ this -> filterBots ( $ information ) ; $ information = $ this -> filterBrowserNames ( $ information ) ; $ information = $ this -> filterBrowserVersions ( $ information ) ; $ information = $ this -> filterBrowserEngines ( $ information ) ; $ information ...
Filters the results to increase accuracy .
15,047
protected function filterBrowserNames ( array $ userAgent ) { if ( empty ( $ userAgent [ 'browser_name' ] ) && $ userAgent [ 'browser_engine' ] === 'trident' && strpos ( $ userAgent [ 'string' ] , 'rv:' ) ) { $ userAgent [ 'browser_name' ] = 'msie' ; $ userAgent [ 'browser_version' ] = preg_replace ( '|.+rv:([0-9]+(?:\...
Filters browser names to increase accuracy .
15,048
protected function filterBrowserVersions ( array $ userAgent ) { if ( in_array ( $ userAgent [ 'browser_name' ] , [ 'safari' , 'opera' ] ) && stripos ( $ userAgent [ 'string' ] , ' version/' ) ) { $ userAgent [ 'browser_version' ] = preg_replace ( '|.+ version/([0-9]+(?:\.[0-9]+)?).*|i' , '$1' , $ userAgent [ 'string' ...
Filters browser versions to increase accuracy .
15,049
public function destroy ( $ module ) { $ module = $ this -> modules -> find ( $ module ) ; $ module -> delete ( ) ; return $ this -> notifySuccess ( trans ( 'cms::module.destroy' , [ 'module' => ( string ) $ module ] ) ) ; }
Remove selected module .
15,050
public function toggle ( $ module ) { $ module = $ this -> modules -> findByAlias ( $ module ) ; if ( $ module -> disabled ( ) ) { $ module -> enable ( ) ; } else { $ module -> disable ( ) ; } $ message = 'cms::module.toggle.' . ( $ module -> enabled ( ) ? 'enable' : 'disable' ) ; return $ this -> notifySuccess ( trans...
Toggle module active status .
15,051
public function updateBadges ( $ badges ) { if ( $ this -> owner -> SecurityAlerts ( ) -> exists ( ) ) { $ badges -> push ( ArrayData :: create ( [ 'Title' => _t ( __CLASS__ . '.BADGE_SECURITY' , 'RISK: Security' ) , 'Type' => 'warning security-alerts__toggler' , ] ) ) ; } }
updates the badges that render as part of the screen targeted summary for this Package
15,052
public function updateDataSchema ( & $ schema ) { $ keysToPass = [ 'Identifier' , 'ExternalLink' ] ; $ alerts = [ ] ; foreach ( $ this -> owner -> SecurityAlerts ( ) -> toNestedArray ( ) as $ alert ) { $ alerts [ ] = array_intersect_key ( $ alert , array_flip ( $ keysToPass ) ) ; } $ schema [ 'securityAlerts' ] = $ ale...
Adds security alert notifications into the schema
15,053
public function sendToAll ( string $ data , int $ sender = 0 , int $ pageSize = 50 ) : int { $ startFd = 0 ; $ count = 0 ; $ fromUser = $ sender < 1 ? 'SYSTEM' : $ sender ; $ this -> log ( "(broadcast)The #{$fromUser} send a message to all users. Data: {$data}" ) ; while ( true ) { $ fdList = $ this -> server -> connec...
send message to all connections
15,054
public function writeTo ( $ fd , string $ data ) : int { return $ this -> server -> send ( $ fd , $ data ) ? 0 : 1 ; }
response data to client by socket connection
15,055
public function getContent ( $ url ) { $ this -> getRequest ( ) -> setHost ( $ url ) ; $ this -> getClient ( ) -> send ( $ this -> getRequest ( ) , $ this -> getResponse ( ) ) ; return $ this -> getResponse ( ) -> getContent ( ) ; }
Retrieve the contents from a given url .
15,056
public function handshake ( Request $ request , Response $ response ) : array { try { $ path = $ request -> getUri ( ) -> getPath ( ) ; list ( $ className , ) = $ this -> getHandler ( $ path ) ; } catch ( \ Throwable $ e ) { if ( $ e instanceof WsRouteException ) { return [ HandlerInterface :: HANDSHAKE_FAIL , $ respon...
dispatch handshake request
15,057
public function message ( Server $ server , Frame $ frame ) { $ fd = $ frame -> fd ; try { if ( ! $ path = WebSocketContext :: getMeta ( 'path' , $ fd ) ) { throw new ContextLostException ( "The connection info has lost of the fd#$fd, on message" ) ; } $ className = $ this -> getHandler ( $ path ) [ 0 ] ; $ handler = \...
dispatch ws message
15,058
public function close ( Server $ server , int $ fd ) { try { if ( ! $ path = WebSocketContext :: getMeta ( 'path' , $ fd ) ) { throw new ContextLostException ( "The connection info has lost of the fd#$fd, on connection closed" ) ; } $ className = $ this -> getHandler ( $ path ) [ 0 ] ; $ handler = \ bean ( $ className ...
dispatch ws close
15,059
public function parse ( $ string , $ strict = true ) { $ information = $ this -> doParse ( $ string ) ; if ( $ strict ) { $ information = $ this -> definition -> filter ( $ information ) ; } return $ information ; }
Parses a user agent string .
15,060
public function parseFromGlobal ( $ strict = true ) { $ string = isset ( $ _SERVER [ 'HTTP_USER_AGENT' ] ) ? $ _SERVER [ 'HTTP_USER_AGENT' ] : null ; return $ this -> parse ( $ string , $ strict ) ; }
Parses the user agent string provided by the global .
15,061
protected function doParse ( $ string ) { $ userAgent = array ( 'string' => $ this -> cleanString ( $ string ) , 'browser_name' => null , 'browser_version' => null , 'browser_engine' => null , 'operating_system' => null , 'device' => 'Other' ) ; if ( empty ( $ userAgent [ 'string' ] ) ) { return $ userAgent ; } $ brows...
Extracts information from the user agent string .
15,062
protected function matchBrowser ( array $ regexes , $ string ) { $ pattern = '#(' . join ( '|' , $ regexes ) . ')[/ ]+([0-9]+(?:\.[0-9]+)?)#i' ; if ( preg_match ( $ pattern , $ string , $ matches ) ) { return $ matches ; } return false ; }
Matches the list of browser regexes against the given User Agent string .
15,063
private function removeByPrefix ( InputInterface $ input , OutputInterface $ output ) { $ prefix = $ input -> getOption ( 'prefix' ) ; $ output -> writeln ( sprintf ( '<comment>Removing all resources from <info>%s</info></comment>' , $ prefix ) ) ; $ api = $ this -> getCloudinaryApi ( ) ; $ response = $ api -> delete_r...
Remove resources by prefix .
15,064
private function removeResource ( InputInterface $ input , OutputInterface $ output ) { $ resource = $ input -> getOption ( 'resource' ) ; $ output -> writeln ( sprintf ( '<comment>Removing resource <info>%s</info></comment>' , $ resource ) ) ; $ api = $ this -> getCloudinaryApi ( ) ; $ response = $ api -> delete_resou...
Remove a resource .
15,065
private function outputApiResponse ( Response $ response , $ part , OutputInterface $ output ) { $ table = new Table ( $ output ) ; $ table -> setHeaders ( [ 'Resource' , 'Status' ] ) ; foreach ( $ response [ $ part ] as $ file => $ status ) { $ table -> addRow ( [ $ file , $ status ] ) ; } $ table -> render ( ) ; }
Output the API response .
15,066
public function publish ( Category $ category ) { $ category -> togglePublishedState ( ) ; $ category -> getDescendants ( ) -> each ( function ( Category $ cat ) use ( $ category ) { $ cat -> published = $ category -> published ; $ cat -> save ( ) ; } ) ; $ message = $ category -> published ? trans ( 'cms::categories.p...
Button Response from DataTable request to publish status .
15,067
public function isActiveGuard ( Request $ request , $ guard ) { $ name = Auth :: guard ( $ guard ) -> getName ( ) ; return ( $ this -> sessionHas ( $ request , $ name ) && $ this -> sessionGet ( $ request , $ name ) === $ this -> getAuthIdentifier ( $ guard ) ) ; }
Check if a particular guard is active .
15,068
public function open ( $ id , $ label = null ) { return $ this -> webService -> post ( "SELECT FROM 'PUSH'.'DOCUMENT'" , array_filter ( [ "id" => $ id , "label" => $ label ] ) ) ; }
Abre um documento criado
15,069
public function changeInterval ( $ id , $ interval ) { return $ this -> webService -> post ( "UPDATE 'PUSH'.'PUSHINTERVAL'" , [ self :: PARAMETER_PUSH_ID => $ id , self :: PARAMETER_PUSH_INTERVAL => $ interval ] ) ; }
Muda o intervalo do PUSH
15,070
public function url ( ) { $ repository = app ( 'extensions' ) ; $ extension = $ repository -> findOrFail ( $ this -> entity -> extension_id ) ; $ class = $ extension -> param ( 'class' ) ; if ( class_exists ( $ class ) ) { $ entity = app ( $ class ) -> findOrNew ( $ this -> entity -> param ( 'id' ) ) ; if ( $ entity in...
Generate menu url depending on type the menu .
15,071
public function linkTitle ( ) { return $ this -> entity -> param ( 'link_title' ) ? $ this -> entity -> param ( 'link_title' ) : $ this -> entity -> title ; }
Get menu link title .
15,072
public function store ( Request $ request ) { $ config = $ request -> input ( 'config' ) ; foreach ( array_dot ( $ request -> input ( 'data' ) ) as $ key => $ value ) { $ path = $ config . '.' . $ key ; $ this -> destroy ( $ path ) ; if ( is_array ( $ value ) ) { $ value = implode ( ',' , $ value ) ; } Configuration ::...
Store submitted configurations .
15,073
public function show ( $ key ) { $ config = config ( $ key ) ?? [ ] ; if ( ! isset ( $ this -> limits [ $ key ] ) ) { return $ this -> filter ( $ config ) ; } return response ( ) -> json ( $ this -> filter ( array_only ( $ config , $ this -> limits [ $ key ] ) ) ) ; }
Show configuration by key .
15,074
protected function filter ( array $ array ) { $ config = collect ( array_dot ( $ array ) ) -> map ( function ( $ value , $ key ) { if ( str_contains ( $ key , $ this -> hidden ) ) { return '' ; } if ( in_array ( $ key , $ this -> boolean ) ) { return ( bool ) $ value ; } return $ value ; } ) ; $ array = [ ] ; foreach (...
Filter array response .
15,075
public function removeAvatar ( ) { $ profile = auth ( ) -> user ( ) ; $ profile -> avatar = '' ; $ profile -> save ( ) ; event ( new ProfileWasUpdated ( $ profile ) ) ; return redirect ( ) -> route ( 'administrator.profile.edit' ) ; }
Remove current user s avatar .
15,076
public function configureFromUserAgentString ( $ string , UserAgentStringParser $ parser = null ) { $ parser = $ parser ? : new UserAgentStringParser ( ) ; $ result = $ string !== null ? $ parser -> parse ( $ string ) : $ parser -> parseFromGlobal ( ) ; $ this -> setUserAgentString ( $ string ) ; $ this -> fromArray ( ...
Configures the user agent information from a user agent string .
15,077
public function toArray ( ) { return array ( 'browser_name' => $ this -> getBrowserName ( ) , 'browser_version' => $ this -> getBrowserVersion ( ) , 'browser_engine' => $ this -> getBrowserEngine ( ) , 'operating_system' => $ this -> getOperatingSystem ( ) , 'device' => $ this -> getDevice ( ) ) ; }
Converts the user agent information to an array .
15,078
private function fromArray ( array $ data ) { $ this -> browserName = $ data [ 'browser_name' ] ; $ this -> browserVersion = $ data [ 'browser_version' ] ; $ this -> browserEngine = $ data [ 'browser_engine' ] ; $ this -> operatingSystem = $ data [ 'operating_system' ] ; $ this -> device = $ data [ 'device' ] ; }
Configures the user agent information from an array .
15,079
protected function registerBundleDependencies ( ContainerBuilder $ container ) { if ( true === $ this -> booted ) { return ; } $ this -> bundles = $ container -> getParameter ( 'kernel.bundles' ) ; if ( $ this -> createBundles ( $ this -> getBundleDependencies ( ) ) ) { $ container -> setParameter ( 'kernel.bundles' , ...
Register the bundle dependencies .
15,080
protected function createBundles ( array $ dependencies ) { foreach ( $ dependencies as $ bundleClass ) { $ name = substr ( $ bundleClass , strrpos ( $ bundleClass , '\\' ) + 1 ) ; if ( false === isset ( $ this -> bundles [ $ name ] ) ) { $ bundle = new $ bundleClass ( ) ; $ this -> bundles [ $ name ] = $ bundleClass ;...
Creating the instances of bundle dependencies .
15,081
public function extractFromFile ( $ filePath ) { if ( ! is_file ( $ filePath ) ) { throw new FileNotFoundException ( $ filePath ) ; } $ extension = pathinfo ( $ filePath , PATHINFO_EXTENSION ) ; $ this -> checkDirectory ( ) ; $ extractorAdapterNamespace = $ this -> getAdapterNamespaceGivenExtension ( $ extension ) ; $ ...
Extract files from compressed file
15,082
protected function checkDirectory ( ) { $ directoryPath = $ this -> directory -> getDirectoryPath ( ) ; if ( ! is_dir ( $ directoryPath ) ) { mkdir ( $ directoryPath ) ; } return $ this ; }
Check directory existence and integrity
15,083
protected function getAdapterNamespaceGivenExtension ( $ fileExtension ) { $ adapterNamespace = '\Mmoreram\Extractor\Adapter\\' ; switch ( $ fileExtension ) { case 'zip' : $ adapterNamespace .= 'ZipExtractorAdapter' ; break ; case 'rar' : $ adapterNamespace .= 'RarExtractorAdapter' ; break ; case 'phar' : $ adapterName...
Return a extractor adapter namespace given an extension
15,084
public static function widget ( $ name ) { $ builder = static :: query ( ) ; return $ builder -> where ( 'type' , 'widget' ) -> whereRaw ( 'LOWER(name) = ?' , [ Str :: lower ( $ name ) ] ) -> first ( ) ; }
Get a widget by name .
15,085
public function prettify ( $ json , $ flags = null , $ indent = "\t" , $ is_json = null ) { if ( ! isset ( $ is_json ) ) { $ is_json = $ this -> isJson ( $ json ) ; } if ( ! $ is_json ) { return $ this -> process ( json_encode ( $ json , $ flags ) , $ indent ) ; } return $ this -> process ( $ json , $ indent ) ; }
Checks if input is string if so straight runs process else it encodes the input as json then runs prettify .
15,086
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'title' => 'required|max:255' , 'type' => 'required|max:255|alpha|unique:navigation,type' , ] ) ; $ navigation = new Navigation ; $ navigation -> fill ( $ request -> all ( ) ) ; $ navigation -> published = $ request -> get ( 'published' , ...
Store a newly created navigation .
15,087
public function html ( array $ options = [ ] , array $ namespaces = [ ] ) { $ this -> addNamespace ( 'og' , 'http://ogp.me/ns#' ) ; $ this -> addNamespace ( 'fb' , 'http://ogp.me/ns/fb#' ) ; if ( $ namespaces ) { foreach ( $ namespaces as $ ns => $ url ) { $ this -> addNamespace ( $ ns , $ url ) ; } } $ this -> setType...
Generate HTML tag .
15,088
public function cedente ( $ nome , $ documento , Endereco $ endereco ) { $ this -> cedente = new Cedente ( $ nome , $ documento , $ endereco ) ; return $ this ; }
Define o cedente .
15,089
public function banco ( $ agencia , $ conta ) { $ reflection = new ReflectionClass ( $ this -> namespace . '\\' . $ this -> type ) ; $ this -> banco = $ reflection -> newInstanceArgs ( array ( $ agencia , $ conta ) ) ; return $ this ; }
Define o banco .
15,090
public function carteira ( $ carteira ) { $ reflection = new ReflectionClass ( $ this -> namespace . '\\Carteira\\Carteira' . $ carteira ) ; $ this -> carteira = $ reflection -> newInstanceArgs ( ) ; return $ this ; }
Define a carteira .
15,091
public function getPublished ( ) { return $ this -> getModel ( ) -> with ( [ 'menus' => function ( $ query ) { $ query -> limitDepth ( 1 ) -> orderBy ( 'order' , 'asc' ) ; } , 'menus.permissions' , 'menus.children' , ] ) -> published ( ) -> get ( ) ; }
Get all published navigation .
15,092
public static function isUnderscoreName ( $ string ) { if ( strpos ( $ string , ' ' ) !== false ) { return false ; } if ( $ string !== strtolower ( $ string ) ) { return false ; } $ validName = true ; $ nameBits = explode ( '_' , $ string ) ; foreach ( $ nameBits as $ bit ) { if ( $ bit === '' ) { continue ; } if ( $ b...
Returns true if the specified string is in the underscore caps format .
15,093
public function getByteCodeCache ( ) { if ( count ( $ this -> data ) === 0 ) { return $ this -> byteCodeCache ; } $ mapper = new ArrayMapper ( ) ; return $ mapper -> fromArray ( $ this -> data ) ; }
Provides information about the byte code cache .
15,094
protected function mapWebRoutes ( Router $ router ) { $ this -> mapArticleRoutes ( $ router ) ; $ this -> mapCategoryRoutes ( $ router ) ; $ this -> mapTagsRoutes ( $ router ) ; $ this -> mapAdministratorAuthenticationRoutes ( $ router ) ; $ this -> mapAdministratorRoutes ( $ router ) ; $ this -> mapFrontendRoutes ( $ ...
Define the web routes for the application . These routes all receive session state CSRF protection etc .
15,095
protected function mapAdministratorAuthenticationRoutes ( Router $ router ) { $ router -> group ( [ 'prefix' => admin_prefix ( ) , 'middleware' => 'web' ] , function ( ) use ( $ router ) { $ router -> get ( 'login' , AuthController :: class . '@showLoginForm' ) -> name ( 'administrator.login' ) ; $ router -> get ( 'log...
Map administrator authentication routes .
15,096
public function getClassMethods ( \ ReflectionClass $ class ) : array { $ classes = $ this -> getClassHierarchy ( $ class ) ; $ methods = [ ] ; foreach ( $ classes as $ hClass ) { $ hClassName = $ hClass -> getName ( ) ; foreach ( $ hClass -> getMethods ( ) as $ method ) { if ( $ method -> isStatic ( ) ) { continue ; }...
Returns reflections of all the non - static methods that make up one object .
15,097
public function getClassProperties ( \ ReflectionClass $ class ) : array { $ classes = $ this -> getClassHierarchy ( $ class ) ; $ properties = [ ] ; foreach ( $ classes as $ hClass ) { $ hClassName = $ hClass -> getName ( ) ; foreach ( $ hClass -> getProperties ( ) as $ property ) { if ( $ property -> isStatic ( ) ) {...
Returns reflections of all the non - static properties that make up one object .
15,098
private function filterReflectors ( array $ reflectors ) : array { $ filteredReflectors = [ ] ; foreach ( $ reflectors as $ index => $ reflector ) { if ( $ reflector -> isPrivate ( ) ) { $ filteredReflectors [ ] = $ reflector ; continue ; } foreach ( $ reflectors as $ index2 => $ reflector2 ) { if ( $ index2 <= $ index...
Filters a list of ReflectionProperty or ReflectionMethod objects .
15,099
public function getFunctionParameterTypes ( \ ReflectionFunctionAbstract $ function ) : array { return $ this -> cache ( __FUNCTION__ , $ function , static function ( ) use ( $ function ) { $ docComment = $ function -> getDocComment ( ) ; if ( $ docComment === false ) { return [ ] ; } preg_match_all ( '/@param\s+(\S+)\...
Returns an associative array of the types documented on a function .