idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
8,800 | private function getHeaders ( ) { $ headers = array ( 'Accept-Language: ' . $ this -> locale ) ; if ( $ this -> user_authorization ) { $ headers [ ] = 'Authorization: Bearer ' . $ this -> token ; } else { $ headers [ ] = 'Authorization: Token ' . $ this -> token ; } return $ headers ; } | Return an array of HTTP headers |
8,801 | public function products ( $ latitude , $ longitude ) { $ path = '/v1/products' ; $ parameters = array ( 'latitude' => $ latitude , 'longitude' => $ longitude ) ; $ result = $ this -> adapter -> get ( $ path , $ parameters , $ this -> getHeaders ( ) ) ; return $ this -> format ( $ result ) ; } | Returns information about the Uber products offered at a given location . |
8,802 | public function estimatesPrice ( $ start_latitude , $ start_longitude , $ end_latitude , $ end_longitude ) { $ path = '/v1/estimates/price' ; $ parameters = array ( 'start_latitude' => $ start_latitude , 'start_longitude' => $ start_longitude , 'end_latitude' => $ end_latitude , 'end_longitude' => $ end_longitude , ) ;... | Returns an estimated price range for each product offered at a given location . |
8,803 | public function userProfile ( ) { $ path = '/v1/me' ; $ result = $ this -> adapter -> get ( $ path , array ( ) , $ this -> getHeaders ( ) ) ; return $ this -> format ( $ result ) ; } | Returns information about the Uber user that has authorized with the application . |
8,804 | public function handleList ( Args $ args , IO $ io ) { $ raw = ! $ args -> isOptionSet ( 'parsed' ) ; $ userValues = $ this -> manager -> getConfigKeys ( false , false , $ raw ) ; $ effectiveValues = $ this -> manager -> getConfigKeys ( true , true , $ raw ) ; $ table = new Table ( PuliTableStyle :: borderless ( ) ) ; ... | Handles the config command . |
8,805 | protected function bindUserProvider ( ) { $ userProvider = $ this -> app [ 'config' ] -> get ( 'revisionable.userprovider' ) ; switch ( $ userProvider ) { case 'sentry' : $ this -> bindSentryProvider ( ) ; break ; case 'sentinel' : $ this -> bindSentinelProvider ( ) ; break ; case 'jwt-auth' : $ this -> bindJwtAuthProv... | Bind user provider implementation to the IoC . |
8,806 | protected function bindSentryProvider ( ) { $ this -> app -> singleton ( 'revisionable.userprovider' , function ( $ app ) { $ field = $ app [ 'config' ] -> get ( 'revisionable.userfield' ) ; return new Adapters \ Sentry ( $ app [ 'sentry' ] , $ field ) ; } ) ; } | Bind adapter for Sentry to the IoC . |
8,807 | protected function bindSessionProvider ( ) { $ this -> app -> singleton ( 'revisionable.userprovider' , function ( $ app ) { $ field = $ app [ 'config' ] -> get ( 'revisionable.userfield' ) ; return new Adapters \ Session ( session ( ) , $ field ) ; } ) ; } | Bind adapter for Session to the IoC . |
8,808 | protected function bootModel ( ) { $ table = $ this -> app [ 'config' ] -> get ( 'revisionable.table' , 'revisions' ) ; $ user = $ this -> app [ 'config' ] -> get ( 'revisionable.usermodel' , 'App\User' ) ; forward_static_call_array ( [ Revision :: class , 'setCustomTable' ] , [ $ table ] ) ; forward_static_call_array ... | Boot the Revision model . |
8,809 | public static function factory ( $ type , $ subtype = '' ) { $ class = self :: verify_class_name ( __CLASS__ . '_' . $ type , 'Unexisting breadcrumb locator type: "' . $ type . '".' ) ; $ locator = new $ class ( $ type , $ subtype ) ; return $ locator ; } | Build a new breadcrumb item locator of the selected type . |
8,810 | public function generate_items_for_subtypes ( $ subtypes ) { $ all_items = array ( ) ; foreach ( $ subtypes as $ subtype ) { $ locator = Carbon_Breadcrumb_Locator :: factory ( $ this -> get_type ( ) , $ subtype ) ; if ( $ locator -> is_included ( ) ) { $ items = $ locator -> get_items ( ) ; $ all_items = array_merge ( ... | Generate a set of breadcrumb items that found by the current type and the provided subtypes . |
8,811 | public function makeNestedAndUniquePath ( $ filename , $ disk = null ) { if ( empty ( $ disk ) ) $ disk = $ this -> manager -> getFilesystem ( 'disk' ) ; $ filename = preg_replace ( '#[^\w-_\.]#i' , '_' , $ filename ) ; $ dir = '' ; for ( $ i = 0 ; $ i < $ this -> depth ; $ i ++ ) { $ dir .= str_pad ( mt_rand ( 0 , $ t... | Create a unique directory and filename |
8,812 | public function delete ( $ url ) { $ path = $ this -> helpers -> path ( $ url ) ; if ( $ this -> manager -> has ( 'disk://' . $ path ) ) $ this -> manager -> delete ( 'disk://' . $ path ) ; } | Delete an upload |
8,813 | public function handle ( Args $ args ) { $ target = $ args -> getArgument ( 'target' ) ; if ( ! in_array ( $ target , self :: $ targets ) ) { throw new RuntimeException ( sprintf ( 'Invalid build target "%s". Expected one of: "%s"' , $ target , implode ( '", "' , self :: $ targets ) ) ) ; } if ( 'all' === $ target || '... | Handles the build command . |
8,814 | public function resolve ( $ path ) { if ( $ this -> service instanceof \ Aws \ Common \ Client \ AbstractClient ) { return $ this -> service -> getObjectUrl ( $ this -> bucket , $ this -> computePath ( $ path ) , $ this -> expiresAt ) ; } $ command = $ this -> service -> getCommand ( 'GetObject' , [ 'Bucket' => $ this ... | Resolves given object path into presigned request URI . |
8,815 | public function handle ( Args $ args , IO $ io ) { $ path = Path :: makeAbsolute ( $ args -> getArgument ( 'path' ) , $ this -> currentPath ) ; $ resource = $ this -> repo -> get ( $ path ) ; $ total = 0 ; $ io -> writeLine ( '<c1>' . $ resource -> getPath ( ) . '</c1>' ) ; $ this -> printTree ( $ io , $ resource , $ t... | Handles the tree command . |
8,816 | private function printTree ( IO $ io , PuliResource $ resource , & $ total , $ prefix = '' ) { $ children = $ resource -> listChildren ( ) ; $ lastIndex = count ( $ children ) - 1 ; $ index = 0 ; foreach ( $ children as $ child ) { $ isLastChild = $ index === $ lastIndex ; $ childPrefix = $ isLastChild ? self :: LAST_C... | Recursively prints the tree for the given resource . |
8,817 | public static function factory ( $ type , $ id , $ title , $ section = '' , $ args = array ( ) ) { $ class = self :: verify_class_name ( __CLASS__ . '_' . $ type , 'Unknown settings field type "' . $ type . '".' ) ; $ field = new $ class ( $ id , $ title , $ section , $ args ) ; return $ field ; } | Register a new administration breadcrumb settings field of a certain type . |
8,818 | public function get_value ( ) { $ original_name = str_replace ( 'carbon_breadcrumbs_' , '' , $ this -> get_id ( ) ) ; $ field_data = Carbon_Breadcrumb_Admin_Settings :: get_field_data ( ) ; $ default = ! empty ( $ field_data [ $ original_name ] [ 'default' ] ) ? $ field_data [ $ original_name ] [ 'default' ] : '' ; $ v... | Retrieve the field value . If there is no value use the default one . |
8,819 | public function render_help ( ) { $ field_data = Carbon_Breadcrumb_Admin_Settings :: get_field_data ( ) ; $ original_name = str_replace ( 'carbon_breadcrumbs_' , '' , $ this -> get_id ( ) ) ; $ help = ! empty ( $ field_data [ $ original_name ] [ 'help' ] ) ? $ field_data [ $ original_name ] [ 'help' ] : '' ; if ( ! $ h... | Render the help description of this field . |
8,820 | public function add ( $ value ) { if ( is_array ( $ value ) ) { return $ this -> handleArray ( 'add' , $ value ) ; } if ( is_null ( $ value ) || strlen ( $ value ) == 0 ) { return false ; } if ( false !== array_search ( $ value , $ this -> values ) ) { return false ; } $ this -> offsetSet ( null , $ value ) ; return tr... | Add a value as an instance of this attribute |
8,821 | public function set ( $ values ) { if ( ! is_array ( $ values ) ) { $ values = array ( $ values ) ; } $ this -> values = $ values ; $ this -> snapshot ( ) ; $ this -> tracker -> markOverridden ( ) ; return true ; } | Sets a set of value replacing any existing values registered |
8,822 | protected function handleArray ( $ method , array $ values ) { $ result = false ; foreach ( $ values as $ value ) { $ flag = call_user_func ( array ( $ this , $ method ) , $ value ) ; $ result = $ result || $ flag ; } return $ result ; } | Handle action for an array of values to the attribute |
8,823 | public function remove ( $ value ) { if ( is_array ( $ value ) ) { return $ this -> handleArray ( 'remove' , $ value ) ; } $ key = array_search ( $ value , $ this -> values ) ; if ( false === $ key ) { return false ; } $ this -> offsetUnset ( $ key ) ; return true ; } | Removes a value from the attribute stack |
8,824 | public function hash ( \ Throwable $ exception ) : string { $ hash = '' ; $ trace = $ exception -> getTrace ( ) ; $ trace [ ] = [ 'file' => $ exception -> getFile ( ) , 'line' => $ exception -> getLine ( ) ] ; foreach ( $ trace as $ place ) { if ( isset ( $ place [ 'file' ] , $ place [ 'line' ] ) && $ place [ 'file' ] ... | This function returns a unique identifier for the exception . This id can be used as a hash key for find duplicate exceptions |
8,825 | public function set ( $ key , $ value ) { array_set ( $ this -> config , $ key , $ value ) ; $ this -> persist ( ) ; return $ this ; } | Store config value by key . |
8,826 | public function add_item ( $ item ) { if ( is_array ( $ item ) ) { foreach ( $ item as $ single_item ) { $ this -> add_item ( $ single_item ) ; } } else { $ priority = $ item -> get_priority ( ) ; $ this -> items [ $ priority ] [ ] = $ item ; } } | Add a single Carbon_Breadcrumb_Item or an array of them to the trail . |
8,827 | public function add_custom_item ( $ title , $ link = '' , $ priority = 1000 ) { $ custom_item = Carbon_Breadcrumb_Item :: factory ( 'custom' , $ priority ) ; $ custom_item -> set_title ( $ title ) ; $ custom_item -> set_link ( $ link ) ; $ custom_item -> setup ( ) ; $ this -> add_item ( $ custom_item ) ; } | Add a custom breadcrumb item to the trail . |
8,828 | public function remove_item ( $ title = '' , $ link = '' ) { $ all_items = $ this -> get_items ( ) ; foreach ( $ all_items as $ items_priority => $ items ) { foreach ( $ items as $ item_key => $ item ) { if ( 0 === strcasecmp ( $ item -> get_title ( ) , $ title ) && 0 === strcasecmp ( $ item -> get_link ( ) , $ link ) ... | Remove an item from the breadcrumb trail by both title and link . |
8,829 | public function remove_item_by_method ( $ method , $ data ) { $ all_items = $ this -> get_items ( ) ; foreach ( $ all_items as $ priority => $ items ) { foreach ( $ items as $ item_key => $ item ) { $ method_result = call_user_func ( array ( $ item , $ method ) , $ data ) ; if ( 0 === strcasecmp ( $ method_result , $ d... | Remove an item from the breadcrumb trail by a specified method . |
8,830 | public function remove_item_by_priority ( $ priority = 0 ) { $ all_items = $ this -> get_items ( ) ; if ( array_key_exists ( $ priority , $ all_items ) ) { unset ( $ all_items [ $ priority ] ) ; } $ this -> set_items ( $ all_items ) ; } | Remove an item from the breadcrumb trail by its priority . |
8,831 | public function get_flat_items ( ) { $ flat_items = array ( ) ; foreach ( $ this -> items as $ priority => $ items ) { $ flat_items = array_merge ( $ flat_items , $ items ) ; } return $ flat_items ; } | Retrieve the breadcrumb items in a flat list . |
8,832 | public function render ( $ return = false ) { $ output = $ this -> get_renderer ( ) -> render ( $ this , true ) ; if ( $ return ) { return $ output ; } echo wp_kses ( $ output , wp_kses_allowed_html ( 'post' ) ) ; } | Render the breadcrumb trail . |
8,833 | function writeBits ( $ value ) { $ this -> r = ( $ this -> r & 0xFE ) + ( $ value >> 2 & 1 ) ; $ this -> g = ( $ this -> g & 0xFE ) + ( $ value >> 1 & 1 ) ; $ this -> b = ( $ this -> b & 0xFE ) + ( $ value >> 0 & 1 ) ; } | Write a 3 - bits - length integer in color |
8,834 | function readBits ( ) { $ value = ( $ this -> r & 1 ) << 2 ; $ value += ( $ this -> g & 1 ) << 1 ; $ value += ( $ this -> b & 1 ) << 0 ; return $ value ; } | Read 3 - bits - length integer from color |
8,835 | public function detect ( $ method = 'isMobile' , $ args = null ) { if ( ! class_exists ( 'Mobile_Detect' ) ) { $ loaded = App :: import ( 'Vendor' , 'MobileDetect.MobileDetect' , array ( 'file' => 'MobileDetect' . DS . 'Mobile_Detect.php' ) ) ; if ( ! $ loaded ) { throw new CakeException ( 'Mobile_Detect is missing or ... | Loads the Mobile_Detect class runs the given Mobile_Detect method . Uses isMobile if no method given . |
8,836 | private function getBindingTypeStates ( Args $ args ) { $ states = array ( ) ; if ( $ args -> isOptionSet ( 'enabled' ) ) { $ states [ ] = BindingTypeState :: ENABLED ; } if ( $ args -> isOptionSet ( 'duplicate' ) ) { $ states [ ] = BindingTypeState :: DUPLICATE ; } return $ states ? : BindingTypeState :: all ( ) ; } | Returns the binding type states selected in the console arguments . |
8,837 | private function printTypeTable ( IO $ io , array $ descriptors , $ styleTag = null , $ indentation = 0 ) { $ table = new Table ( PuliTableStyle :: borderless ( ) ) ; $ table -> setHeaderRow ( array ( 'Type' , 'Description' , 'Parameters' ) ) ; $ paramTag = $ styleTag ? : 'c1' ; $ typeTag = $ styleTag ? : 'u' ; foreach... | Prints the binding types in a table . |
8,838 | private function printBindingTypeState ( IO $ io , $ typeState ) { switch ( $ typeState ) { case BindingTypeState :: ENABLED : $ io -> writeLine ( 'The following binding types are currently enabled:' ) ; $ io -> writeLine ( '' ) ; return ; case BindingTypeState :: DUPLICATE : $ io -> writeLine ( 'The following types ha... | Prints the heading for a binding type state . |
8,839 | public function handle ( Args $ args , IO $ io ) { $ updateStrategy = new PuliStrategy ( ) ; $ updateStrategy -> setStability ( $ this -> getStability ( $ args ) ) ; $ updater = new Updater ( null , false ) ; $ updater -> setStrategyObject ( $ updateStrategy ) ; if ( $ updater -> update ( ) ) { $ io -> writeLine ( spri... | Handles the self - update command . |
8,840 | public function get_archive_item_details ( ) { return array ( 'year' => array ( 'condition' => is_year ( ) || is_month ( ) || is_day ( ) , 'title_format' => 'Y' , 'link' => get_year_link ( get_query_var ( 'year' ) ) , ) , 'month' => array ( 'condition' => is_month ( ) || is_day ( ) , 'title_format' => 'F' , 'link' => g... | Prepare the date archive conditions with the corresponding title format and link . |
8,841 | protected function transform ( DOMDocument $ element ) { foreach ( $ this -> transformers as $ transformer ) { $ transformer ( $ element ) ; } return $ element ; } | Transform an element |
8,842 | protected function load ( $ name ) { foreach ( $ this -> sources as $ source ) { if ( $ source -> has ( $ name ) ) { return $ this -> transform ( $ source -> get ( $ name ) ) ; } } throw new NotFoundException ( sprintf ( 'The svg "%s" is not found' , $ name ) ) ; } | Load a svg from the sources . |
8,843 | public function get ( $ name ) { if ( ! isset ( $ this -> svg [ $ name ] ) ) { $ this -> svg [ $ name ] = new Svg ( $ this -> load ( $ name ) ) ; } if ( $ this -> svg [ $ name ] !== false ) { return $ this -> svg [ $ name ] ; } } | Returns a clone of a svg . |
8,844 | public function add ( $ word , $ row , $ column ) { $ this -> words [ ] = new Word ( $ word , $ row , $ column ) ; } | Add a word . |
8,845 | public function getAttributes ( ) { $ data = @ ldap_get_attributes ( $ this -> connection , $ this -> entry ) ; $ result = array ( ) ; for ( $ i = 0 ; $ i < $ data [ 'count' ] ; $ i ++ ) { $ key = $ data [ $ i ] ; $ result [ $ key ] = array ( ) ; for ( $ j = 0 ; $ j < $ data [ $ key ] [ 'count' ] ; $ j ++ ) { $ result ... | Retrieves entry attributes |
8,846 | public function connect ( $ hostname , $ port = 389 , $ withSSL = false , $ withTLS = false ) { if ( $ withSSL && $ withTLS ) { throw new ConnectionException ( 'Cannot support both TLS & SSL for a given Ldap Connection' ) ; } if ( ! extension_loaded ( 'ldap' ) && ! @ dl ( 'ldap.' . PHP_SHLIB_SUFFIX ) ) { throw new Conn... | Connects to a Ldap directory without binding |
8,847 | private function getSelectedStates ( Args $ args ) { $ states = array ( ) ; if ( $ args -> isOptionSet ( 'enabled' ) ) { $ states [ ] = ModuleState :: ENABLED ; } if ( $ args -> isOptionSet ( 'not-found' ) ) { $ states [ ] = ModuleState :: NOT_FOUND ; } if ( $ args -> isOptionSet ( 'not-loadable' ) ) { $ states [ ] = M... | Returns the module states that should be displayed for the given console arguments . |
8,848 | private function getSelectedModules ( Args $ args ) { $ states = $ this -> getSelectedStates ( $ args ) ; $ expr = Expr :: true ( ) ; $ envs = array ( ) ; if ( $ states !== ModuleState :: all ( ) ) { $ expr = $ expr -> andMethod ( 'getState' , Expr :: in ( $ states ) ) ; } if ( $ args -> isOptionSet ( 'installer' ) ) {... | Returns the modules that should be displayed for the given console arguments . |
8,849 | private function printModulesByState ( IO $ io , ModuleList $ modules , array $ states ) { $ printStates = count ( $ states ) > 1 ; foreach ( $ states as $ state ) { $ filteredModules = array_filter ( $ modules -> toArray ( ) , function ( Module $ module ) use ( $ state ) { return $ state === $ module -> getState ( ) ;... | Prints modules with intermediate headers for the module states . |
8,850 | private function printModulesWithFormat ( IO $ io , ModuleList $ modules , $ format ) { foreach ( $ modules as $ module ) { $ installInfo = $ module -> getInstallInfo ( ) ; $ io -> writeLine ( strtr ( $ format , array ( '%name%' => $ module -> getName ( ) , '%installer%' => $ installInfo ? $ installInfo -> getInstaller... | Prints modules using the given format . |
8,851 | private function printModuleState ( IO $ io , $ ModuleState ) { switch ( $ ModuleState ) { case ModuleState :: ENABLED : $ io -> writeLine ( 'The following modules are currently enabled:' ) ; $ io -> writeLine ( '' ) ; return ; case ModuleState :: NOT_FOUND : $ io -> writeLine ( 'The following modules could not be foun... | Prints the heading for a given module state . |
8,852 | private function printModuleTable ( IO $ io , array $ modules , $ styleTag = null , $ indent = false ) { $ table = new Table ( PuliTableStyle :: borderless ( ) ) ; $ table -> setHeaderRow ( array ( 'Module Name' , 'Installer' , 'Env' , 'Install Path' ) ) ; $ installerTag = $ styleTag ? : 'c1' ; $ envTag = $ styleTag ? ... | Prints a list of modules in a table . |
8,853 | private function printNotLoadableModules ( IO $ io , array $ modules , $ indent = false ) { $ rootDir = $ this -> moduleManager -> getContext ( ) -> getRootDirectory ( ) ; $ table = new Table ( PuliTableStyle :: borderless ( ) ) ; $ table -> setHeaderRow ( array ( 'Module Name' , 'Error' ) ) ; ksort ( $ modules ) ; for... | Prints not - loadable modules in a table . |
8,854 | public function apply_settings ( $ settings = array ( ) ) { $ settings_fields = Carbon_Breadcrumb_Admin_Settings :: get_field_data ( ) ; foreach ( $ settings_fields as $ field_id => $ field ) { $ settings [ $ field_id ] = get_option ( 'carbon_breadcrumbs_' . $ field_id ) ; if ( 'checkbox' == $ field [ 'type' ] ) { $ se... | Apply the settings to the breadcrumb trail renderer |
8,855 | public function is_enabled ( ) { $ enabled = false ; $ plugin_path = untrailingslashit ( ABSPATH ) . DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' ; $ current_dir = $ this -> current_dir ( ) ; if ( false !== strpos ( $ current_dir , $ plugin_path ) ) { $ enabled = true ; } if ( defined ( 'CARBON_... | Whether the administration interface should be enabled . |
8,856 | public function set ( int $ timeoutMinutes ) : bool { if ( $ this -> isLocked ( ) ) { return false ; } $ this -> setLock ( $ timeoutMinutes ) ; return true ; } | Returns true if exclusive lock obtained |
8,857 | public function populate_date_archive_items ( ) { if ( ! is_date ( ) ) { return ; } $ locator = Carbon_Breadcrumb_Locator :: factory ( 'date' ) ; $ items = $ locator -> get_items ( 700 ) ; $ this -> get_trail ( ) -> add_item ( $ items ) ; } | Populate date archives . |
8,858 | public function populate_post_type_archive_items ( ) { if ( is_post_type_archive ( ) ) { $ post_type = get_post_type_object ( get_query_var ( 'post_type' ) ) ; } elseif ( is_singular ( ) ) { $ post_type = get_post_type_object ( get_post_type ( ) ) ; if ( ! $ post_type -> has_archive ) { return ; } } else { return ; } $... | Populate post type archives . |
8,859 | public function populate_search_items ( ) { if ( ! is_search ( ) ) { return ; } $ search_title = sprintf ( __ ( 'Search results for: "%1$s"' , 'carbon_breadcrumbs' ) , get_search_query ( ) ) ; $ this -> get_trail ( ) -> add_custom_item ( $ search_title , '' , 700 ) ; } | Populate search items . |
8,860 | public function populate_category_items ( ) { if ( ! ( is_single ( ) && 'post' == get_post_type ( ) ) ) { return ; } $ taxonomy = 'category' ; $ categories = wp_get_object_terms ( get_the_ID ( ) , $ taxonomy , array ( 'orderby' => 'term_id' ) ) ; $ last_category = array_pop ( $ categories ) ; $ locator = Carbon_Breadcr... | Populate category hierarchy when on a single post . |
8,861 | public function populate_page_for_posts_items ( ) { $ page_for_posts = get_option ( 'page_for_posts' ) ; if ( ! $ page_for_posts ) { return ; } if ( $ this -> is_post_context ( ) ) { $ locator = Carbon_Breadcrumb_Locator :: factory ( 'post' , 'page' ) ; $ items = $ locator -> get_items ( 500 , $ page_for_posts ) ; $ th... | Populate page for posts item where necessary . |
8,862 | public function populate_home_items ( ) { $ trail = $ this -> get_trail ( ) ; $ renderer = $ trail -> get_renderer ( ) ; if ( ! $ renderer -> get_display_home_item ( ) ) { return ; } $ home_title = $ renderer -> get_home_item_title ( ) ; $ home_link = home_url ( '/' ) ; $ trail -> add_custom_item ( $ home_title , $ hom... | Populate home item . |
8,863 | protected function generate_locator_items ( $ locator_name ) { $ locator = Carbon_Breadcrumb_Locator :: factory ( $ locator_name ) ; $ items = $ locator -> generate_items ( ) ; if ( $ items ) { return $ items ; } return array ( ) ; } | Generate the items of a certain locator . |
8,864 | public function handle ( Args $ args , IO $ io ) { foreach ( $ args -> getArgument ( 'path' ) as $ path ) { if ( ! Glob :: isDynamic ( $ path ) ) { $ this -> printUrl ( $ path , $ io ) ; continue ; } foreach ( $ this -> repo -> find ( $ path ) as $ resource ) { $ this -> printUrl ( $ resource -> getPath ( ) , $ io ) ; ... | Handles the url command . |
8,865 | private function printUrl ( $ path , IO $ io ) { $ path = Path :: makeAbsolute ( $ path , $ this -> currentPath ) ; $ io -> writeLine ( $ this -> urlGenerator -> generateUrl ( $ path ) ) ; } | Prints the URL of a Puli path . |
8,866 | public function logAddition ( $ value ) { if ( $ this -> isOverridden ( ) ) { return ; } if ( isset ( $ this -> deleted [ $ value ] ) ) { unset ( $ this -> deleted [ $ value ] ) ; $ this -> replaced [ $ value ] = $ value ; return ; } if ( ! isset ( $ this -> replaced [ $ value ] ) ) { $ this -> added [ $ value ] = $ va... | Logs an addition in the diff tracker |
8,867 | public function logDeletion ( $ value ) { if ( $ this -> isOverridden ( ) ) { return ; } if ( isset ( $ this -> added [ $ value ] ) ) { unset ( $ this -> added [ $ value ] ) ; $ this -> ignored [ $ value ] = $ value ; return ; } if ( isset ( $ this -> replaced [ $ value ] ) ) { unset ( $ this -> replaced [ $ value ] ) ... | Logs a deletion in the diff tracker |
8,868 | public function logReplacement ( $ value ) { if ( $ this -> isOverridden ( ) ) { return ; } if ( isset ( $ this -> added [ $ value ] ) ) { unset ( $ this -> added [ $ value ] ) ; } if ( isset ( $ this -> deleted [ $ value ] ) ) { unset ( $ this -> deleted [ $ value ] ) ; } $ this -> replaced [ $ value ] = $ value ; } | Logs a replacement in the diff tracker |
8,869 | public function setSearch ( SearchInterface $ search ) { if ( null !== $ this -> search ) { $ this -> search -> free ( ) ; } $ this -> search = $ search ; $ this -> rewind ( ) ; } | Setter for search |
8,870 | public function getOption ( $ option ) { $ value = null ; if ( ! ( @ ldap_get_option ( $ this -> connection , $ option , $ value ) ) ) { $ code = @ ldap_errno ( $ this -> connection ) ; throw new OptionException ( sprintf ( 'Could not retrieve option %s value: Ldap Error Code=%s - %s' , $ code , ldap_err2str ( $ code )... | Gets current value set for an option |
8,871 | public function bind ( $ rdn = null , $ password = null ) { $ isAnonymous = false ; if ( ( null === $ rdn ) || ( null === $ password ) ) { if ( ( null !== $ rdn ) || ( null !== $ password ) ) { throw new BindException ( 'For an anonymous binding, both rdn & passwords have to be null' ) ; } $ isAnonymous = true ; } if (... | Binds to the LDAP directory with specified RDN and password |
8,872 | public function addEntry ( $ dn , $ data ) { $ data = $ this -> normalizeData ( $ data ) ; if ( ! ( @ ldap_add ( $ this -> connection , $ dn , $ data ) ) ) { $ code = @ ldap_errno ( $ this -> connection ) ; throw new PersistenceException ( sprintf ( 'Could not add entry %s: Ldap Error Code=%s - %s' , $ dn , $ code , ld... | Adds a Ldap entry |
8,873 | public function deleteEntry ( $ dn ) { if ( ! ( @ ldap_delete ( $ this -> connection , $ dn ) ) ) { $ code = @ ldap_errno ( $ this -> connection ) ; throw new PersistenceException ( sprintf ( 'Could not delete entry %s: Ldap Error Code=%s - %s' , $ dn , $ code , ldap_err2str ( $ code ) ) ) ; } } | Deletes an existing Ldap entry |
8,874 | public function search ( $ scope , $ baseDn , $ filter , $ attributes = null ) { switch ( $ scope ) { case SearchInterface :: SCOPE_BASE : $ function = 'ldap_read' ; break ; case SearchInterface :: SCOPE_ONE : $ function = 'ldap_list' ; break ; case SearchInterface :: SCOPE_ALL : $ function = 'ldap_search' ; break ; de... | Searches for entries in the directory |
8,875 | protected function normalizeData ( $ data ) { foreach ( $ data as $ attribute => $ info ) { if ( is_array ( $ info ) ) { if ( count ( $ info ) == 1 ) { $ data [ $ attribute ] = $ info [ 0 ] ; continue ; } } } return $ data ; } | Normalizes data for Ldap storage |
8,876 | public function connect ( ) { $ this -> isBound = false ; $ this -> connection = $ this -> driver -> connect ( $ this -> configuration [ 'hostname' ] , $ this -> configuration [ 'port' ] , $ this -> configuration [ 'withSSL' ] , $ this -> configuration [ 'withTLS' ] ) ; foreach ( $ this -> configuration [ 'options' ] a... | Connects to the Ldap store |
8,877 | public function bind ( $ name = null , $ password = null ) { if ( strlen ( trim ( $ name ) ) > 0 ) { $ password = ( null === $ password ) ? '' : $ password ; $ this -> connection -> bind ( $ name , $ password ) ; $ this -> isBound = true ; return ; } if ( $ this -> configuration [ 'bind_anonymous' ] ) { $ this -> conne... | Binds to the Ldap connection |
8,878 | protected function configure ( array $ params ) { $ required = array ( 'hostname' , 'base_dn' ) ; $ missing = array ( ) ; foreach ( $ required as $ key ) { if ( ! array_key_exists ( $ key , $ params ) ) { $ missing [ ] = $ key ; } } if ( count ( $ missing ) > 0 ) { throw new \ InvalidArgumentException ( 'Required param... | Complete and validates given parameters with default settings |
8,879 | public function getNode ( $ dn , $ attributes = null , $ filter = null ) { $ this -> validateBinding ( ) ; $ attributes = ( is_array ( $ attributes ) ) ? $ attributes : null ; $ filter = ( null === $ filter ) ? '(objectclass=*)' : $ filter ; try { $ search = $ this -> connection -> search ( SearchInterface :: SCOPE_BAS... | Retrieve a node knowing its dn |
8,880 | public function search ( $ baseDn = null , $ filter = null , $ inDepth = true , $ attributes = null ) { $ this -> validateBinding ( ) ; $ result = new SearchResult ( ) ; $ baseDn = ( null === $ baseDn ) ? $ this -> configuration [ 'base_dn' ] : $ baseDn ; $ filter = ( null === $ filter ) ? '(objectclass=*)' : $ filter ... | Execites a search on the ldap |
8,881 | public function save ( Node $ node ) { $ this -> validateBinding ( ) ; if ( strlen ( trim ( $ node -> getDn ( ) ) ) == 0 ) { throw new PersistenceException ( 'Cannot save: dn missing for the entry' ) ; } if ( ! $ node -> isHydrated ( ) ) { try { $ origin = $ this -> getNode ( $ node -> getDn ( ) ) ; $ node -> rebaseDif... | Saves a node to the Ldap store |
8,882 | public function getChildrenNodes ( Node $ node ) { $ result = $ this -> search ( $ node -> getDn ( ) , null , false ) ; $ nodes = array ( ) ; foreach ( $ result as $ node ) { $ nodes [ ] = $ node ; } return $ nodes ; } | Retrieves immediate children for the given node |
8,883 | public function delete ( Node $ node , $ isRecursive = false ) { if ( ! $ node -> isHydrated ( ) ) { $ node = $ this -> getNode ( $ node -> getDn ( ) ) ; } $ children = $ this -> getChildrenNodes ( $ node ) ; if ( count ( $ children ) > 0 ) { if ( ! $ isRecursive ) { throw new DeleteException ( sprintf ( '%s cannot be ... | Deletes a node from the Ldap store |
8,884 | private function getTransport ( ) { if ( $ this -> transport ) { return $ this -> transport ; } $ transportClassName = '\\Sokil\\Upload\\Transport\\' . $ this -> options [ 'transport' ] . 'Transport' ; $ this -> transport = new $ transportClassName ( $ this -> options [ 'fieldName' ] , $ this -> options [ 'supportedFor... | Get uploaded file instance |
8,885 | public function moveLocal ( $ targetDir = null , $ targetFilename = null ) { $ sourceFile = $ this -> getTransport ( ) -> getFile ( ) ; $ targetBasename = $ this -> buildTargetBasename ( $ sourceFile , $ targetFilename ) ; if ( ! $ targetDir ) { $ targetDir = $ this -> getDefaultLocalUploadDirectory ( ) ; } $ targetPat... | Move file to local filesystem |
8,886 | public function move ( Filesystem $ filesystem = null , $ targetFilename = null , $ overwrite = true ) { $ sourceFile = $ this -> getTransport ( ) -> getFile ( ) ; $ targetBasename = $ this -> buildTargetBasename ( $ sourceFile , $ targetFilename ) ; $ content = stream_get_contents ( $ sourceFile -> getStream ( ) ) ; $... | Move file to external filesystem |
8,887 | public function handleAdd ( Args $ args ) { $ flags = $ args -> isOptionSet ( 'force' ) ? RepositoryManager :: OVERRIDE | RepositoryManager :: IGNORE_FILE_NOT_FOUND : 0 ; $ repositoryPath = Path :: makeAbsolute ( $ args -> getArgument ( 'path' ) , $ this -> currentPath ) ; $ pathReferences = $ args -> getArgument ( 'fi... | Handles the puli map command . |
8,888 | private function printMappingTable ( IO $ io , array $ mappings , $ indentation = 0 , $ enabled = true ) { $ table = new Table ( PuliTableStyle :: borderless ( ) ) ; $ table -> setHeaderRow ( array ( 'Puli Path' , 'Real Path(s)' ) ) ; $ pathTag = $ enabled ? 'c1' : 'bad' ; foreach ( $ mappings as $ mapping ) { if ( $ e... | Prints a list of path mappings . |
8,889 | private function printConflictTable ( IO $ io , array $ mappings , $ indentation = 0 ) { $ conflicts = array ( ) ; $ shortPrefix = str_repeat ( ' ' , $ indentation ) ; $ prefix = str_repeat ( ' ' , $ indentation + 4 ) ; $ printNewline = false ; foreach ( $ mappings as $ mapping ) { foreach ( $ mapping -> getConflicts (... | Prints a list of conflicting path mappings . |
8,890 | private function getPathMappingStates ( Args $ args ) { $ states = array ( PathMappingState :: ENABLED => 'enabled' , PathMappingState :: NOT_FOUND => 'not-found' , PathMappingState :: CONFLICT => 'conflict' , ) ; $ states = array_filter ( $ states , function ( $ option ) use ( $ args ) { return $ args -> isOptionSet (... | Returns the path mapping states selected in the console arguments . |
8,891 | private function printPathMappingStateHeader ( IO $ io , $ pathMappingState ) { switch ( $ pathMappingState ) { case PathMappingState :: ENABLED : $ io -> writeLine ( 'The following path mappings are currently enabled:' ) ; $ io -> writeLine ( '' ) ; return ; case PathMappingState :: NOT_FOUND : $ io -> writeLine ( 'Th... | Prints the header for a path mapping state . |
8,892 | private function formatName ( PuliResource $ resource ) { $ name = $ resource -> getName ( ) ; if ( $ resource -> hasChildren ( ) ) { return '<c1>' . $ name . '</c1>' ; } return $ name ; } | Formats the name of the resource . |
8,893 | private function formatSize ( $ size ) { $ suffixes = array ( '' , 'K' , 'M' , 'G' , 'T' , 'P' ) ; reset ( $ suffixes ) ; $ suffix = current ( $ suffixes ) ; while ( $ size > 1023 ) { next ( $ suffixes ) ; if ( null === key ( $ suffixes ) ) { break ; } $ size /= 1024 ; $ suffix = current ( $ suffixes ) ; } if ( $ size ... | Formats the given size . |
8,894 | public static function get_field_data ( ) { return array ( 'glue' => array ( 'type' => 'text' , 'title' => __ ( 'Glue' , 'carbon_breadcrumbs' ) , 'default' => ' > ' , 'help' => __ ( 'This is displayed between the breadcrumb items.' , 'carbon_breadcrumbs' ) , ) , 'link_before' => array ( 'type' => 'text' , 'title' => __... | Get field data . Defines and describes the fields that will be registered . |
8,895 | public function admin_menu ( ) { add_options_page ( self :: get_page_title ( ) , self :: get_page_title ( ) , 'manage_options' , self :: get_page_name ( ) , array ( $ this , 'settings_page' ) ) ; add_settings_section ( self :: get_page_name ( ) , __ ( 'General Settings' , 'carbon_breadcrumbs' ) , '' , self :: get_page_... | Register the settings page & default section . |
8,896 | public function register_settings ( ) { $ field_data = self :: get_field_data ( ) ; foreach ( $ field_data as $ field_id => $ field ) { $ this -> fields [ ] = Carbon_Breadcrumb_Admin_Settings_Field :: factory ( $ field [ 'type' ] , 'carbon_breadcrumbs_' . $ field_id , $ field [ 'title' ] , self :: get_page_name ( ) ) ;... | Register the settings sections and fields . |
8,897 | public function settings_page ( ) { ?> <div class="wrap"> <h2> <?php echo esc_html ( self :: get_page_title ( ) ) ; ?> </h2> </div> <form method="POST" action="options.php"> <?php settings_fields ( self :: get_page_name ( ) ) ; do_settings_sections ( self :: get_page_name ( ) ) ; submit_button ( ) ; ?> </form> ... | Content of the settings page . |
8,898 | public function getModelByPrimaryKey ( $ id ) { foreach ( $ this -> models as $ model ) { $ primaryKey = $ model -> getKeyName ( ) ; if ( $ model -> $ primaryKey == $ id ) return $ model ; } } | Return a model of formset by id |
8,899 | public function onSaving ( $ event , $ payload ) { list ( $ model ) = $ payload ; if ( ! $ this -> supportsUploads ( $ model ) || ! ( $ attributes = $ model -> getUploadAttributes ( ) ) ) return ; event ( new Events \ HandlingSaving ( $ model ) ) ; foreach ( $ attributes as $ attribute ) { if ( ( $ file = $ model -> ge... | A model is saving check for files being uploaded |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.