idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
59,800 | public function searchGroups ( $ search , $ by , $ limit = 1 , $ num = 1000 , $ page = 1 ) { $ groups = $ this -> indexGroups ( $ num , $ page ) [ 'data' ] ; $ filtered = array_filter ( $ groups , function ( $ group ) use ( $ search , $ by ) { if ( array_key_exists ( $ by , $ group ) ) { if ( strpos ( $ group [ $ by ] ... | Search if a defined number of Groups exists . |
59,801 | protected function setupExporter ( ) { if ( $ scope = Input :: get ( Exporter :: $ queryName ) ) { $ this -> model ( ) -> usePaginate ( false ) ; call_user_func ( $ this -> builder , $ this ) ; ( new Exporter ( $ this ) ) -> resolve ( $ this -> exporter ) -> withScope ( $ scope ) -> export ( ) ; } } | Setup grid exporter . |
59,802 | public function column ( $ name , $ label = '' ) { $ relationName = $ relationColumn = '' ; if ( false !== strpos ( $ name , '.' ) ) { list ( $ relationName , $ relationColumn ) = explode ( '.' , $ name ) ; $ relation = $ this -> model ( ) -> eloquent ( ) -> $ relationName ( ) ; $ label = empty ( $ label ) ? ucfirst ( ... | Add column to Grid . |
59,803 | protected function setDbColumns ( ) { $ connection = $ this -> model ( ) -> eloquent ( ) -> getConnectionName ( ) ; $ this -> dbColumns = collect ( Schema :: connection ( $ connection ) -> getColumnListing ( $ this -> model ( ) -> getTable ( ) ) ) ; } | Get the table columns for grid . |
59,804 | protected function handleTableColumn ( $ method , $ label ) { if ( empty ( $ this -> dbColumns ) ) { $ this -> setDbColumns ( ) ; } if ( $ this -> dbColumns -> has ( $ method ) ) { return $ this -> addColumn ( $ method , $ label ) ; } return false ; } | Handle table column for grid . |
59,805 | protected function prepareValue ( $ key , $ record ) { $ field = $ this -> fields -> first ( function ( Field $ field ) use ( $ key ) { return in_array ( $ key , ( array ) $ field -> column ( ) , true ) ; } ) ; if ( method_exists ( $ field , 'prepare' ) ) { return $ field -> prepare ( $ record ) ; } return $ record ; } | Do prepare work for each field . |
59,806 | protected function buildNestedArray ( array $ nodes = [ ] , $ parentId = 0 ) { $ branch = [ ] ; if ( empty ( $ nodes ) ) { $ nodes = $ this -> allNodes ( ) ; } foreach ( $ nodes as $ node ) { if ( $ node [ $ this -> parentColumn ] === $ parentId ) { $ children = $ this -> buildNestedArray ( $ nodes , $ node [ $ this ->... | Build Nested array . |
59,807 | public function render ( ) { $ variables = [ 'items' => $ this -> items , 'title' => $ this -> title , 'attributes' => $ this -> formatAttributes ( ) , ] ; return view ( $ this -> view , $ variables ) -> render ( ) ; } | Render Carousel . |
59,808 | public function render ( ) { $ this -> setupDefaultOptions ( ) ; if ( ! empty ( $ this -> value ) ) { $ this -> attribute ( 'data-initial-preview' , $ this -> preview ( ) ) ; $ this -> attribute ( 'data-initial-caption' , $ this -> initialCaption ( $ this -> value ) ) ; $ this -> setupPreviewOptions ( ) ; } $ this -> o... | Render file upload field . |
59,809 | public static function formatExportQuery ( $ scope = '' , $ args = null ) { $ query = '' ; if ( $ scope === static :: SCOPE_ALL ) { $ query = 'all' ; } if ( $ scope === static :: SCOPE_CURRENT_PAGE ) { $ query = "page:$args" ; } if ( $ scope === static :: SCOPE_SELECTED_ROWS ) { $ query = "selected:$args" ; } return [ ... | Format query for export url . |
59,810 | public function withError ( $ title = '' , $ message = '' ) { $ error = new MessageBag ( compact ( 'title' , 'message' ) ) ; session ( ) -> flash ( 'error' , $ error ) ; return $ this ; } | Set error message for content . |
59,811 | protected function getExpression ( $ equation ) { if ( $ this -> fixedVerifyCode !== null ) { return $ this -> fixedVerifyCode ; } return $ equation [ 'first' ] . "~" . $ equation [ 'operator' ] . "~" . $ equation [ 'second' ] . "~=" ; } | Get expresion formula . |
59,812 | protected function getValue ( $ equation ) { if ( $ this -> fixedVerifyCode !== null ) { return $ this -> fixedVerifyCode ; } return eval ( 'return ' . $ equation [ 'first' ] . $ equation [ 'operator' ] . $ equation [ 'second' ] . ';' ) ; } | Get value of formula |
59,813 | protected function useDefinedColumn ( ) { $ this -> displayCallbacks = [ ] ; $ class = static :: $ defined [ $ this -> name ] ; if ( $ class instanceof Closure ) { $ this -> display ( $ class ) ; return ; } if ( ! class_exists ( $ class ) || ! is_subclass_of ( $ class , AbstractDisplayer :: class ) ) { throw new \ Exce... | Use a defined column . |
59,814 | protected function callBuiltinDisplayer ( $ abstract , $ arguments ) { if ( $ abstract instanceof Closure ) { return $ this -> display ( function ( $ value ) use ( $ abstract , $ arguments ) { return $ abstract -> call ( $ this , ... array_merge ( [ $ value ] , $ arguments ) ) ; } ) ; } if ( class_exists ( $ abstract )... | Call Builtin displayer . |
59,815 | public function previous ( $ step = 1 ) { return $ this -> siblings ( array_search ( $ this , $ this -> parent -> filters ( ) , true ) - $ step ) ; } | Get previous filter . |
59,816 | public function next ( $ step = 1 ) { return $ this -> siblings ( array_search ( $ this , $ this -> parent -> filters ( ) , true ) + $ step ) ; } | Get next filter . |
59,817 | public function condition ( $ inputs ) { $ value = array_get ( $ inputs , $ this -> column ) ; if ( ! isset ( $ value ) ) { return ; } $ this -> value = $ value ; return $ this -> buildCondition ( $ this -> column , $ this -> value ) ; } | Get query condition from filter . |
59,818 | protected function initAdminDirectory ( ) { $ this -> directory = config ( 'admin.directory' ) ; if ( is_dir ( $ this -> directory ) ) { $ this -> line ( "<error>{$this->directory} directory already exists !</error> " ) ; return ; } $ this -> makeDir ( '/' ) ; $ this -> line ( '<info>Admin directory was created:</info>... | Initialize the admin directory . |
59,819 | public function createAdministratorController ( ) { $ controller = $ this -> directory . '/Controllers/AdministratorController.php' ; $ contents = $ this -> getStub ( 'AdministratorController' ) ; $ this -> laravel [ 'files' ] -> put ( $ controller , str_replace ( 'DummyNamespace' , Admin :: controllerNamespace ( ) , $... | Create AdministratorController . |
59,820 | protected function createMenuFile ( ) { $ file = $ this -> directory . '/menu.php' ; $ contents = $ this -> getStub ( 'menu' ) ; $ this -> laravel [ 'files' ] -> put ( $ file , $ contents ) ; $ this -> line ( '<info>Menu file was created:</info> ' . str_replace ( base_path ( ) , '' , $ file ) ) ; } | Create menu file . |
59,821 | protected function normalizeResponse ( $ obj ) { $ result = [ 'path' => ltrim ( $ this -> removePathPrefix ( $ obj -> getPathDisplay ( ) ) , '/' ) ] ; $ objClass = get_class ( $ obj ) ; switch ( $ objClass ) { case 'Kunnu\Dropbox\Models\FolderMetadata' : $ result [ 'type' ] = 'dir' ; break ; case 'Kunnu\Dropbox\Models\... | Normalize a Dropbox File Response . |
59,822 | protected function upload ( $ path , $ contents , $ opts = [ ] ) { $ location = $ this -> applyPathPrefix ( $ path ) ; try { $ tmpfile = tmpfile ( ) ; fwrite ( $ tmpfile , $ contents ) ; $ localFile = $ this -> getStreamUri ( $ tmpfile ) ; $ obj = $ this -> client -> simpleUpload ( $ localFile , $ location , $ opts ) ;... | This function uploads the file to the API using simple upload |
59,823 | protected function uploadChunked ( $ path , $ resource , $ chunkSize = 8000000 , $ opts = [ ] ) { $ location = $ this -> applyPathPrefix ( $ path ) ; try { $ fileSize = Util :: getStreamSize ( $ resource ) ; $ localFile = $ this -> getStreamUri ( $ resource ) ; $ file = $ this -> client -> uploadChunked ( $ localFile ,... | This function uploads the file in chunks instead of whole file |
59,824 | public function handle ( Request $ request , Closure $ next ) { if ( ! $ this -> auth -> check ( ) ) { Flash :: error ( trans ( 'dashboard::dashboard.flash.access_denied' ) ) ; return redirect ( ) -> route ( 'auth.login' ) ; } return $ next ( $ request ) ; } | Check if a user is logged in . |
59,825 | public function _admin_enqueue_scripts ( ) { $ relative_path = '/vendor/inc2734/wp-customizer-framework/src/assets/js/wp-customizer-framework.js' ; $ src = get_template_directory_uri ( ) . $ relative_path ; $ path = get_template_directory ( ) . $ relative_path ; wp_enqueue_script ( 'inc2734-wp-customizer-framework' , $... | Enqueue assets for admin page |
59,826 | public function _print_gutenberg_styles ( ) { $ screen = get_current_screen ( ) ; if ( ! $ screen || 'post' !== $ screen -> base ) { return ; } $ post = get_post ( ) ; $ use_gutenberg_plugin = function_exists ( '\is_gutenberg_page' ) && \ is_gutenberg_page ( ) ; $ use_block_editor = function_exists ( '\use_block_editor... | Print styles from registerd styles |
59,827 | protected function deleteFilesAndImages ( $ id ) { $ data = $ this -> model -> with ( $ this -> getRelations ( ) ) -> findOrFail ( $ id ) -> toArray ( ) ; $ this -> builder -> fields ( ) -> filter ( function ( $ field ) { return $ field instanceof Field \ File ; } ) -> each ( function ( File $ file ) use ( $ data ) { $... | Remove files or images in record . |
59,828 | public function store ( ) { $ data = Input :: all ( ) ; if ( $ validationMessages = $ this -> validationMessages ( $ data ) ) { return back ( ) -> withInput ( ) -> withErrors ( $ validationMessages ) ; } if ( ( $ response = $ this -> prepare ( $ data ) ) instanceof Response ) { return $ response ; } DB :: transaction (... | Store a new record . |
59,829 | protected function getRelationInputs ( $ inputs = [ ] ) { $ relations = [ ] ; foreach ( $ inputs as $ column => $ value ) { if ( method_exists ( $ this -> model , $ column ) ) { $ relation = call_user_func ( [ $ this -> model , $ column ] ) ; if ( $ relation instanceof Relation ) { $ relations [ $ column ] = $ value ; ... | Get inputs for relations . |
59,830 | protected function handleOrderable ( $ id , array $ input = [ ] ) { if ( array_key_exists ( '_orderable' , $ input ) ) { $ model = $ this -> model -> find ( $ id ) ; if ( $ model instanceof Sortable ) { 1 === $ input [ '_orderable' ] ? $ model -> moveOrderUp ( ) : $ model -> moveOrderDown ( ) ; return true ; } } return... | Handle orderable update . |
59,831 | protected function getFieldByColumn ( $ column ) { return $ this -> builder -> fields ( ) -> first ( function ( Field $ field ) use ( $ column ) { if ( is_array ( $ field -> column ( ) ) ) { return in_array ( $ column , $ field -> column ( ) , true ) ; } return $ field -> column ( ) === $ column ; } ) ; } | Find field object by column . |
59,832 | protected function setFieldValue ( $ id ) { $ relations = $ this -> getRelations ( ) ; $ this -> model = $ this -> model -> with ( $ relations ) -> findOrFail ( $ id ) ; $ data = $ this -> model -> toArray ( ) ; $ this -> builder -> fields ( ) -> each ( function ( Field $ field ) use ( $ data ) { $ field -> fill ( $ da... | Set all fields value in form . |
59,833 | public static function collectFieldAssets ( ) { if ( ! empty ( static :: $ collectedAssets ) ) { return static :: $ collectedAssets ; } $ css = collect ( ) ; $ js = collect ( ) ; foreach ( static :: $ availableFields as $ field ) { if ( ! method_exists ( $ field , 'getAssets' ) ) { continue ; } $ assets = call_user_fun... | Collect assets required by registered field . |
59,834 | public static function extend ( $ placeholder , array $ selectors ) { if ( ! isset ( static :: $ placeholders [ $ placeholder ] ) ) { static :: $ placeholders [ $ placeholder ] = [ ] ; } static :: $ placeholders [ $ placeholder ] = array_merge ( static :: $ placeholders [ $ placeholder ] , $ selectors ) ; } | Set selectors . Styles of these selectors output like extend of Sass . |
59,835 | public function saveOrder ( $ serialize ) { $ tree = json_decode ( $ serialize , true ) ; if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new \ InvalidArgumentException ( json_last_error_msg ( ) ) ; } $ this -> model -> saveOrder ( $ tree ) ; return true ; } | Save tree order from a input . |
59,836 | public function catchAll ( ) { $ isCatchallDomain = null ; if ( $ this -> options [ 'catchAllEnabled' ] ) { try { $ isCatchallDomain = $ this -> transport -> getSmtp ( ) -> acceptsAnyRecipient ( $ this -> dom ) ; } catch ( \ Exception $ e ) { $ this -> statusManager -> setStatus ( $ this -> users , $ this -> dom , $ th... | Do a catch - all test for the domain . This increases checking time for a domain slightly but doesn t confuse users . |
59,837 | protected function setupMiddleware ( ) { $ this -> app [ 'router' ] -> middleware ( 'user' , UserMiddleware :: class ) ; $ this -> app [ 'router' ] -> middleware ( 'roles' , RoleMiddleware :: class ) ; $ this -> app [ 'router' ] -> middleware ( 'permissions' , PermissionMiddleware :: class ) ; } | Register the middleware to the application |
59,838 | protected function setupProviders ( ) { $ this -> app -> register ( SentinelServiceProvider :: class ) ; $ this -> app -> register ( EkkoServiceProvider :: class ) ; $ this -> app -> register ( FlashServiceProvider :: class ) ; $ this -> app -> register ( FormServiceProvider :: class ) ; $ this -> app -> register ( Boo... | Register the providers to the application . |
59,839 | protected function setupInterfaces ( ) { $ this -> app -> bind ( 'Laraflock\Dashboard\Repositories\Auth\AuthRepositoryInterface' , config ( 'laraflock.dashboard.authRepositoryClass' ) ) ; $ this -> app -> bind ( 'Laraflock\Dashboard\Repositories\Permission\PermissionRepositoryInterface' , config ( 'laraflock.dashboard.... | Register Interface Bindings |
59,840 | protected function setupConsoleCommands ( ) { $ this -> app [ 'dashboard::install' ] = $ this -> app -> share ( function ( ) { return new InstallerCommand ( ) ; } ) ; $ this -> app [ 'dashboard::setup' ] = $ this -> app -> share ( function ( ) { return new SetupCommand ( ) ; } ) ; $ this -> app [ 'dashboard::fresh' ] =... | Register the console commands to the application . |
59,841 | protected function setupFacades ( ) { $ loader = AliasLoader :: getInstance ( ) ; $ loader -> alias ( 'Activation' , Activation :: class ) ; $ loader -> alias ( 'Reminder' , Reminder :: class ) ; $ loader -> alias ( 'Sentinel' , Sentinel :: class ) ; $ loader -> alias ( 'Flash' , Flash :: class ) ; $ loader -> alias ( ... | Register the Facades to the application . |
59,842 | public function update ( Request $ request , $ id ) { if ( $ request -> input ( 'action' ) == 'update_account' ) { try { $ this -> userRepositoryInterface -> update ( $ request -> all ( ) , $ id ) ; } catch ( FormValidationException $ e ) { Flash :: error ( $ e -> getMessage ( ) ) ; return redirect ( ) -> route ( 'acco... | Update account information . |
59,843 | public function sanitize_callback ( ) { return function ( $ value ) { if ( ! is_array ( $ value ) ) { $ value = explode ( ',' , $ value ) ; } $ sanitized_values = [ ] ; foreach ( $ value as $ v ) { if ( ! array_key_exists ( $ v , $ this -> args [ 'choices' ] ) ) { continue ; } $ sanitized_values [ ] = $ v ; } $ sanitiz... | Sanitize callback function |
59,844 | protected function formatName ( $ column ) { if ( is_string ( $ column ) ) { $ name = explode ( '.' , $ column ) ; if ( 1 === count ( $ name ) ) { return $ name [ 0 ] ; } $ html = array_shift ( $ name ) ; foreach ( $ name as $ piece ) { $ html .= "[$piece]" ; } return $ html ; } if ( is_array ( $ this -> column ) ) { $... | Format the name of the field . |
59,845 | public function submitButton ( ) { if ( self :: MODE_VIEW === $ this -> mode ) { return '' ; } if ( ! $ this -> options [ 'enableSubmit' ] ) { return '' ; } if ( self :: MODE_EDIT === $ this -> mode ) { $ text = trans ( 'admin.save' ) ; } else { $ text = trans ( 'admin.submit' ) ; } return <<<EOT<div class="btn-group ... | Submit button of form .. |
59,846 | protected function removeReservedFields ( ) { if ( ! $ this -> isMode ( static :: MODE_CREATE ) ) { return ; } $ reservedColumns = [ $ this -> form -> model ( ) -> getKeyName ( ) , $ this -> form -> model ( ) -> getCreatedAtColumn ( ) , $ this -> form -> model ( ) -> getUpdatedAtColumn ( ) , ] ; $ this -> fields = $ th... | Remove reserved fields like id created_at updated_at in form fields . |
59,847 | public function authentication ( Request $ request ) { try { $ this -> authRepositoryInterface -> authenticate ( $ request -> all ( ) ) ; } catch ( FormValidationException $ e ) { Flash :: error ( $ e -> getMessage ( ) ) ; return redirect ( ) -> route ( 'auth.login' ) -> withErrors ( $ e -> getErrors ( ) ) ; } catch ( ... | Authenticate and Validate login input . |
59,848 | public function registration ( Request $ request ) { if ( ! config ( 'laraflock.dashboard.registration' ) ) { Flash :: error ( trans ( 'dashboard::dashboard.flash.registration.not_active' ) ) ; return redirect ( ) -> route ( 'auth.login' ) ; } try { $ this -> authRepositoryInterface -> register ( $ request -> all ( ) )... | Register the user . |
59,849 | public function activate ( Request $ request ) { if ( ! $ email = $ request -> get ( 'email' ) ) { $ email = null ; } if ( ! $ code = $ request -> get ( 'code' ) ) { $ code = null ; } if ( ! config ( 'laraflock.dashboard.activations' ) ) { Flash :: error ( trans ( 'dashboard::dashboard.flash.activation.not_active' ) ) ... | Display activate screen . |
59,850 | public function activation ( Request $ request ) { if ( ! config ( 'laraflock.dashboard.activations' ) ) { Flash :: error ( trans ( 'dashboard::dashboard.flash.activation.not_active' ) ) ; return redirect ( ) -> route ( 'auth.login' ) ; } try { $ this -> authRepositoryInterface -> activate ( $ request -> all ( ) ) ; } ... | Activate a user . |
59,851 | public function partial ( $ args = null ) { if ( is_null ( $ args ) ) { return $ this -> partial ; } elseif ( is_array ( $ args ) ) { $ this -> partial = new Partial ( $ this -> get_id ( ) , $ args ) ; } } | Control joined to Partial |
59,852 | public function _set_default_value ( $ value ) { if ( is_null ( $ value ) || false === $ value ) { if ( isset ( $ this -> args [ 'default' ] ) ) { return $ this -> args [ 'default' ] ; } } return $ value ; } | Set default theme_mod |
59,853 | protected function inExceptArray ( $ request ) { foreach ( config ( 'admin.operation_log.except' ) as $ except ) { if ( '/' !== $ except ) { $ except = trim ( $ except , '/' ) ; } $ methods = [ ] ; if ( Str :: contains ( $ except , ':' ) ) { list ( $ methods , $ except ) = explode ( ':' , $ except ) ; $ methods = explo... | Determine if the request has a URI that should pass through CSRF verification . |
59,854 | public static function rgba ( $ hex , $ percent ) { $ hex = static :: _hex_normalization ( $ hex ) ; $ rgba = [ ] ; for ( $ i = 0 ; $ i < 3 ; $ i ++ ) { $ dec = hexdec ( substr ( $ hex , $ i * 2 , 2 ) ) ; $ rgba [ ] = $ dec ; } $ rgba = implode ( ',' , $ rgba ) ; $ rgba = "rgba({$rgba}, $percent)" ; return $ rgba ; } | hex to rgba |
59,855 | private static function _get_hue_based_max_rgb ( $ red , $ green , $ blue ) { $ max_rgb = max ( $ red , $ green , $ blue ) ; $ min_rgb = min ( $ red , $ green , $ blue ) ; $ diff_max_min_rgb = $ max_rgb - $ min_rgb ; if ( $ red === $ max_rgb ) { $ hue = 60 * ( $ diff_max_min_rgb ? ( $ green - $ blue ) / $ diff_max_min_... | Return hue from max rgb |
59,856 | private static function _get_saturation ( $ hex ) { $ red = hexdec ( substr ( $ hex , 0 , 2 ) ) ; $ green = hexdec ( substr ( $ hex , 2 , 2 ) ) ; $ blue = hexdec ( substr ( $ hex , 4 , 2 ) ) ; $ max_rgb = max ( $ red , $ green , $ blue ) ; $ min_rgb = min ( $ red , $ green , $ blue ) ; $ cnt = round ( ( $ max_rgb + $ m... | Return saturation from hex |
59,857 | private static function _get_luminance ( $ hex ) { $ red = hexdec ( substr ( $ hex , 0 , 2 ) ) ; $ green = hexdec ( substr ( $ hex , 2 , 2 ) ) ; $ blue = hexdec ( substr ( $ hex , 4 , 2 ) ) ; $ max_rgb = max ( $ red , $ green , $ blue ) ; $ min_rgb = min ( $ red , $ green , $ blue ) ; return ( $ max_rgb + $ min_rgb ) /... | Return luminance from hex |
59,858 | public static function addBreadcrumbList ( ) { $ view = Yii :: $ app -> getView ( ) ; $ breadcrumbList = [ ] ; if ( isset ( $ view -> params [ 'breadcrumbs' ] ) ) { $ position = 1 ; foreach ( $ view -> params [ 'breadcrumbs' ] as $ breadcrumb ) { if ( is_array ( $ breadcrumb ) ) { $ breadcrumbList [ ] = ( object ) [ "@... | Adds BreadcrumbList schema . org markup based on the application view breadcrumbs parameter |
59,859 | public function getInstalledPackages ( ) { $ packages = [ ] ; $ content = $ this -> getFileContents ( 'composer.lock' ) ; foreach ( [ 'packages' , 'packages-dev' ] as $ key ) { if ( ! isset ( $ content [ $ key ] ) ) { continue ; } foreach ( $ content [ $ key ] as $ package ) { $ name = $ package [ 'name' ] ; $ packages... | Get installed package versions . |
59,860 | public function getRequiredPackages ( ) { $ packages = [ ] ; $ content = $ this -> getFileContents ( 'composer.json' ) ; foreach ( [ 'require' , 'require-dev' ] as $ key ) { if ( ! isset ( $ content [ $ key ] ) ) { continue ; } foreach ( $ content [ $ key ] as $ name => $ version ) { if ( ! strstr ( $ name , '/' ) ) { ... | Get required package versions . |
59,861 | protected function getVariables ( ) { foreach ( $ this -> fields as $ field ) { $ field -> fill ( $ this -> data ) ; } return [ 'fields' => $ this -> fields , 'attributes' => $ this -> formatAttribute ( ) , 'method' => $ this -> attributes [ 'method' ] , ] ; } | Get variables for render form . |
59,862 | public function versionDiff ( $ current , $ latest ) { $ needle = 0 ; while ( $ needle < strlen ( $ current ) && $ needle < strlen ( $ latest ) ) { if ( $ current [ $ needle ] !== $ latest [ $ needle ] ) { break ; } $ needle ++ ; } return substr ( $ latest , 0 , $ needle ) . '<green>' . substr ( $ latest , $ needle ) .... | Get the diff between the current and latest version . |
59,863 | protected function getComposerPathFromInput ( InputInterface $ input ) { if ( $ input -> getOption ( 'directory' ) ) { return $ input -> getOption ( 'directory' ) ; } if ( $ input -> getOption ( 'global' ) ) { return getenv ( 'HOME' ) . '/.composer' ; } } | Get composer path based on user input . |
59,864 | public function getNewRegistrationIds ( ) { if ( $ this -> getNewRegistrationIdsCount ( ) == 0 ) { return array ( ) ; } $ filteredResults = array_filter ( $ this -> results , function ( $ result ) { return isset ( $ result [ 'registration_id' ] ) ; } ) ; $ data = array_map ( function ( $ result ) { return $ result [ 'r... | Return an array of expired registration ids linked to new id All old registration ids must be updated to new ones in DB |
59,865 | protected function setRelationSort ( $ column ) { list ( $ relationName , $ relationColumn ) = explode ( '.' , $ column ) ; if ( $ this -> queries -> contains ( function ( $ query ) use ( $ relationName ) { return 'with' === $ query [ 'method' ] && in_array ( $ relationName , $ query [ 'arguments' ] , true ) ; } ) ) { ... | Set relation sort . |
59,866 | public function _amp_post_template_css ( ) { ob_start ( ) ; $ this -> _print_front_styles ( ) ; $ css = ob_get_clean ( ) ; $ css = str_replace ( '!important' , '' , $ css ) ; echo $ css ; } | Styles for AMP |
59,867 | public function _tiny_mce_before_init ( $ mce_init ) { $ styles = WP_Customizer_Framework \ Style :: get_registerd_styles ( ) ; if ( ! isset ( $ mce_init [ 'content_style' ] ) ) { $ mce_init [ 'content_style' ] = '' ; } foreach ( $ styles as $ style ) { foreach ( $ style [ 'selectors' ] as $ i => $ selector ) { $ selec... | Styles for TinyMCE |
59,868 | public function _print_gutenberg_styles ( ) { $ styles = WP_Customizer_Framework \ Style :: get_registerd_styles ( ) ; $ new_styles = [ ] ; foreach ( $ styles as $ styles_index => $ style ) { foreach ( $ style [ 'selectors' ] as $ selectors_index => $ selector ) { $ selector = trim ( $ selector ) ; $ style [ 'selectors... | Print styles for Gutenberg |
59,869 | protected function _print_styles ( $ styles ) { foreach ( $ styles as $ style ) { $ selectors = implode ( ',' , $ style [ 'selectors' ] ) ; $ properties = implode ( ';' , $ style [ 'properties' ] ) ; if ( ! $ style [ 'media_query' ] ) { printf ( '%1$s { %2$s }' , strip_tags ( $ selectors ) , str_replace ( '"' , '"... | Print styles in head |
59,870 | public function edit ( $ channelId , $ typeId , $ type , $ allow = null , $ deny = null ) { $ current = $ this -> show ( $ channelId , $ typeId , $ type ) ; if ( is_null ( $ current ) ) { return $ this -> create ( $ channelId , $ typeId , $ type , $ allow , $ deny ) ; } if ( is_null ( $ allow ) ) { $ allow = $ current ... | Edit channel permissions . |
59,871 | private function _convert_hsl_to_hex ( $ hue , $ saturation , $ luminance ) { if ( 49 >= $ luminance ) { $ max_hsl = 2.55 * ( $ luminance + $ luminance * ( $ saturation / 100 ) ) ; $ min_hsl = 2.55 * ( $ luminance - $ luminance * ( $ saturation / 100 ) ) ; } else { $ max_hsl = 2.55 * ( $ luminance + ( 100 - $ luminance... | Convert hsl to hex |
59,872 | public function bulkSet ( $ registrationIds = array ( ) , $ data = null , $ collapseKey = null ) { $ this -> setRegistrationIds ( $ registrationIds ) ; $ this -> setData ( $ data ) ; $ this -> setCollapseKey ( $ collapseKey ) ; } | Set multiple fields at once . |
59,873 | public function getOutdatedPackages ( array $ excluded = [ ] ) { $ installed = $ this -> composer -> getInstalledPackages ( ) ; $ required = $ this -> composer -> getRequiredPackages ( ) ; $ outdated = [ ] ; $ packages = array_intersect_key ( $ installed , $ required ) ; foreach ( $ packages as $ package ) { $ name = $... | Get outdated packages with their current and latest version . |
59,874 | protected function buildNestedForm ( $ column , \ Closure $ builder , $ key = null ) { $ form = new Form \ NestedForm ( $ column , $ key ) ; $ form -> setForm ( $ this -> form ) ; call_user_func ( $ builder , $ form ) ; $ form -> hidden ( $ this -> getKeyName ( ) ) ; $ form -> hidden ( NestedForm :: REMOVE_FLAG_NAME ) ... | Build a Nested form . |
59,875 | public function render ( ) { $ this -> view = $ this -> views [ $ this -> viewMode ] ; list ( $ template , $ script ) = $ this -> buildNestedForm ( $ this -> column , $ this -> builder ) -> getTemplateHtmlAndScript ( ) ; $ this -> setupScript ( $ script ) ; return parent :: render ( ) -> with ( [ 'forms' => $ this -> b... | Render the HasMany field . |
59,876 | protected function validate ( array $ data ) { $ validator = Validator :: make ( $ data , $ this -> rules ) ; if ( $ validator -> fails ( ) ) { throw new FormValidationException ( trans ( 'dashboard::dashboard.errors.form.validation' ) , $ validator ) ; } } | Validate the form submission . |
59,877 | public function render ( string $ view , array $ data = [ ] , $ layout = null ) : string { $ output = $ this -> fetch ( $ view , $ data ) ; if ( $ layout === false ) { return $ output ; } return $ this -> renderContent ( $ output , $ data , $ layout ) ; } | Render a view if layout file is setting will use it . throws RuntimeException if view file does not exist |
59,878 | public function value ( $ value = null ) { if ( is_null ( $ value ) ) { return empty ( $ this -> value ) ? ( $ this -> getDefault ( ) ?? [ ] ) : $ this -> value ; } $ this -> value = $ value ; return $ this ; } | Get or set value for this field . |
59,879 | public function sendMessage ( ) { $ message = new \ CodeMonkeysRu \ GCM \ Message ( ) ; call_user_func_array ( array ( $ message , 'bulkSet' ) , func_get_args ( ) ) ; return $ this -> send ( $ message ) ; } | Send message to GCM without explicitly created message |
59,880 | public function send ( Message $ message ) { if ( ! $ this -> serverApiKey ) { throw new Exception ( "Server API Key not set" , Exception :: ILLEGAL_API_KEY ) ; } if ( count ( $ message -> getRegistrationIds ( ) ) > 1000 ) { throw new Exception ( "Malformed request: Registration Ids exceed the GCM imposed limit of 1000... | Send message to GCM |
59,881 | private function formMessageData ( Message $ message ) { $ data = array ( 'registration_ids' => $ message -> getRegistrationIds ( ) , ) ; $ dataFields = array ( 'registration_ids' => 'getRegistrationIds' , 'collapse_key' => 'getCollapseKey' , 'data' => 'getData' , 'notification' => 'getNotification' , 'delay_while_idle... | Form raw message data for sending to GCM |
59,882 | private function validatePayloadSize ( array $ rawData , $ fieldName , $ maxSize ) { if ( ! isset ( $ rawData [ $ fieldName ] ) ) { return ; } if ( strlen ( json_encode ( $ rawData [ $ fieldName ] ) ) > $ maxSize ) { throw new Exception ( ucfirst ( $ fieldName ) . " payload is to big (max {$maxSize} bytes)" , Exception... | Validate size of json representation of passed payload |
59,883 | public function add ( array $ emails ) { if ( ! empty ( $ emails ) ) { foreach ( $ emails as $ key => $ values ) { $ this -> set ( $ key , $ values ) ; } } } | Adds new container the current container set . |
59,884 | public function get ( $ key , $ default = null , $ first = true ) { if ( ! is_string ( $ key ) && ! is_int ( $ key ) ) { throw new \ InvalidArgumentException ( '$key expected to be string or integer, got: ' . gettype ( $ key ) ) ; } if ( ! array_key_exists ( $ key , $ this -> container ) ) { if ( null === $ default ) {... | Returns a email value by name . |
59,885 | public function set ( $ key , $ values , $ replace = true ) { if ( ! is_string ( $ key ) && ! is_int ( $ key ) ) { throw new \ InvalidArgumentException ( '$key expected to be string, got:' . gettype ( $ key ) ) ; } if ( ! is_string ( $ values ) && ! is_array ( $ values ) ) { throw new \ InvalidArgumentException ( '$key... | Sets a email values . |
59,886 | public function getEntries ( $ domain ) { $ hosts = array ( ) ; $ weight = array ( ) ; getmxrr ( $ domain , $ hosts , $ weight ) ; foreach ( $ hosts as $ k => $ host ) { $ this -> mxs [ $ host ] = $ weight [ $ k ] ; } asort ( $ this -> mxs ) ; $ this -> mxs [ $ domain ] = 0 ; return $ this -> mxs ; } | Queries the DNS server for domain MX entries |
59,887 | public function edit ( $ channelId , $ name = null , $ position = null , $ topic = null ) { $ channel = $ this -> show ( $ channelId ) ; $ json [ 'name' ] = is_null ( $ name ) ? $ channel [ 'name' ] : $ name ; $ json [ 'position' ] = is_null ( $ position ) ? $ channel [ 'position' ] : $ position ; $ json [ 'topic' ] = ... | Edit a channel . |
59,888 | public function handle ( Request $ request , Closure $ next , $ roles ) { $ accessDenied = true ; if ( ! $ user = $ this -> auth -> getActiveUser ( ) ) { Flash :: error ( trans ( 'dashboard::dashboard.flash.access_denied' ) ) ; return redirect ( ) -> route ( 'auth.login' ) ; } if ( ! is_array ( $ roles ) ) { $ roles = ... | Check if user belongs to the specified role . |
59,889 | protected function databaseSetup ( ) { $ this -> output -> writeln ( <<<STEP<fg=yellow>*-----------------------------------------------*| || Configure Database || This package uses MySQL Only || ... | Setup the database credentials . |
59,890 | protected function databaseSetupPassword ( ) { $ pass = $ this -> secret ( 'Please enter the database password' ) ; $ passConfirm = $ this -> secret ( 'Please confirm the database password' ) ; if ( $ pass != $ passConfirm ) { $ this -> error ( '[ERROR] Database passwords do not match. Please retry.' ) ; $ this -> data... | Setup the database credentials password . |
59,891 | protected function userSetup ( ) { $ this -> output -> writeln ( <<<STEP<fg=yellow>*-----------------------------------------------*| || Configure Default User || |*----------------------------------------... | Setup the user credentials . |
59,892 | protected function userSetupPassword ( ) { $ pass = $ this -> secret ( 'Please enter the user password' ) ; $ passConfirm = $ this -> secret ( 'Please confirm the user password' ) ; if ( $ pass != $ passConfirm ) { $ this -> error ( '[ERROR] Passwords do not match.' ) ; $ this -> userSetupPassword ( ) ; } return $ pass... | Setup the user credentials password . |
59,893 | protected function setupEnvFile ( ) { $ env = __DIR__ . '/stubs/env.stub' ; $ config = $ this -> database ; $ contents = str_replace ( array_map ( function ( $ key ) { return '{{' . $ key . '}}' ; } , array_keys ( $ config ) ) , array_values ( $ config ) , $ this -> laravel [ 'files' ] -> get ( $ env ) ) ; $ contents =... | Setup ENV file with database credentials . |
59,894 | protected function createDefaultUser ( ) { $ config = $ this -> user ; $ this -> permissionRepository -> create ( [ 'name' => 'Administrator (Full Access)' , 'slug' => 'admin' , ] , false ) ; $ this -> roleRepository -> create ( [ 'name' => 'Registered' , 'slug' => 'registered' , ] , false ) ; $ role = $ this -> roleRe... | Create default Group and User |
59,895 | protected function setupSeedStubs ( ) { $ config = $ this -> user ; $ user = __DIR__ . '/stubs/UserTableSeeder.stub' ; $ role = __DIR__ . '/stubs/RoleTableSeeder.stub' ; $ permission = __DIR__ . '/stubs/PermissionTableSeeder.stub' ; $ userContents = str_replace ( array_map ( function ( $ key ) { return '{{' . $ key . '... | Setup stub files for seeders . |
59,896 | public static function fromHeader ( string $ string ) { $ parts = \ array_map ( "trim" , \ explode ( ";" , $ string ) ) ; $ nameValue = \ explode ( "=" , \ array_shift ( $ parts ) , 2 ) ; if ( \ count ( $ nameValue ) !== 2 ) { return null ; } list ( $ name , $ value ) = $ nameValue ; $ name = \ trim ( $ name ) ; $ valu... | Parses a cookie from a set - cookie header . |
59,897 | public function all ( ) { $ params = [ ] ; foreach ( $ this -> methodRequirements as $ key => $ config ) { $ params [ $ key ] = $ this -> get ( $ key ) ; } return $ params ; } | Fetches all required parameters from the current Request body . |
59,898 | public function get ( $ name ) { if ( ! $ paramConfig = $ this -> methodRequirements [ $ name ] ) { return ; } $ config = new Credential ( $ name , $ paramConfig ) ; if ( true === $ config -> required && ! ( $ this -> getRequest ( ) -> request -> has ( $ name ) ) ) { throw new BadRequestUserException ( $ this -> format... | Fetches a given parameter from the current Request body . |
59,899 | private function validateParam ( Credential $ config , $ param ) { $ name = $ config -> name ; if ( null === $ requirements = $ config -> requirements ) { return ; } foreach ( $ requirements as $ constraint ) { if ( is_scalar ( $ constraint ) ) { $ constraint = new Regex ( [ 'pattern' => '#^' . $ constraint . '$#xsu' ,... | Handle requirements validation . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.