idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
12,400 | private function parseUrl ( $ url ) { $ parsed = parse_url ( $ url ) ; if ( ( count ( $ parsed ) === 1 ) && isset ( $ parsed [ 'path' ] ) && ( 0 === strpos ( $ parsed [ 'path' ] , '?' ) || false !== strpos ( $ parsed [ 'path' ] , '&' ) ) ) { $ parsed = array ( 'query' => $ parsed [ 'path' ] ) ; return $ parsed ; } retu... | Parse the URL and fix up if it only contains only one element to make it the query element . |
12,401 | function setWidth ( $ width ) { if ( ! preg_match ( '!^(\d+)(.*)$!' , $ width , $ _match ) ) return false ; $ _width = $ _match [ 1 ] ; $ _type = $ _match [ 2 ] ; if ( $ _type == '%' ) $ this -> width = $ _width . '%' ; else $ this -> width = $ _width . 'px' ; return true ; } | sets the width of the map |
12,402 | function setHeight ( $ height ) { if ( ! preg_match ( '!^(\d+)(.*)$!' , $ height , $ _match ) ) return false ; $ _height = $ _match [ 1 ] ; $ _type = $ _match [ 2 ] ; if ( $ _type == '%' ) $ this -> height = $ _height . '%' ; else $ this -> height = $ _height . 'px' ; return true ; } | sets the height of the map |
12,403 | function setClusterOptions ( $ zoom = "null" , $ gridsize = "null" , $ styles = "null" ) { $ this -> marker_clusterer_options [ "maxZoom" ] = $ zoom ; $ this -> marker_clusterer_options [ "gridSize" ] = $ gridsize ; $ this -> marker_clusterer_options [ "styles" ] = $ styles ; } | set clustering options |
12,404 | function addMarkerOpener ( $ marker_id , $ dom_id ) { if ( $ this -> info_window === false || ! isset ( $ this -> _markers [ $ marker_id ] ) ) return false ; if ( ! isset ( $ this -> _markers [ $ marker_id ] [ "openers" ] ) ) $ this -> _markers [ $ marker_id ] [ "openers" ] = array ( ) ; $ this -> _markers [ $ marker_i... | adds a DOM object ID to specified marker to open the marker s info window . Does nothing if the info windows is disabled . |
12,405 | function addPolyLineByAddress ( $ address1 , $ address2 , $ id = false , $ color = '' , $ weight = 0 , $ opacity = 0 ) { if ( ( $ _geocode1 = $ this -> getGeocode ( $ address1 ) ) === false ) return false ; if ( ( $ _geocode2 = $ this -> getGeocode ( $ address2 ) ) === false ) return false ; return $ this -> addPolyLin... | adds a map polyline by address if color weight and opacity are not defined use the google maps defaults |
12,406 | function addPolyLineByCoords ( $ lon1 , $ lat1 , $ lon2 , $ lat2 , $ id = false , $ color = '' , $ weight = 0 , $ opacity = 0 ) { if ( $ id !== false && isset ( $ this -> _polylines [ $ id ] ) && is_array ( $ this -> _polylines [ $ id ] ) ) { $ _polyline = $ this -> _polylines [ $ id ] ; } else { $ _polyline = array ( ... | adds a map polyline by map coordinates if color weight and opacity are not defined use the google maps defaults |
12,407 | function addPolylineElevation ( $ polyline_id , $ elevation_dom_id , $ samples = 256 , $ width = "" , $ height = "" , $ focus_color = "#00ff00" ) { if ( isset ( $ this -> _polylines [ $ polyline_id ] ) ) { $ this -> _elevation_polylines [ $ polyline_id ] = array ( "dom_id" => $ elevation_dom_id , "samples" => $ samples... | function to add an elevation profile for a polyline to the page |
12,408 | function addOverlay ( $ bds_lat1 , $ bds_lon1 , $ bds_lat2 , $ bds_lon2 , $ img_src , $ opacity = 100 ) { $ _overlay = array ( "bounds" => array ( "ne" => array ( "lat" => $ bds_lat1 , "long" => $ bds_lon1 ) , "sw" => array ( "lat" => $ bds_lat2 , "long" => $ bds_lon2 ) ) , "img" => $ img_src , "opacity" => $ opacity /... | function to add an overlay to the map . |
12,409 | function setMarkerIconKey ( $ iconImage , $ iconShadow = '' , $ iconAnchorX = 'x' , $ iconAnchorY = 'x' , $ infoWindowAnchorX = 'x' , $ infoWindowAnchorY = 'x' ) { $ _iconKey = $ this -> getIconKey ( $ iconImage , $ iconShadow ) ; if ( isset ( $ this -> _marker_icons [ $ _iconKey ] ) ) { return $ _iconKey ; } else { re... | function to check if icon is in class marker_iconset if it is returns the key if not creates a new array indice and returns the key |
12,410 | function addIcon ( $ iconImage , $ iconShadowImage = '' , $ iconAnchorX = 'x' , $ iconAnchorY = 'x' , $ infoWindowAnchorX = 'x' , $ infoWindowAnchorY = 'x' ) { $ _iconKey = $ this -> getIconKey ( $ iconImage , $ iconShadowImage ) ; $ this -> _marker_icons [ $ _iconKey ] = $ this -> createMarkerIcon ( $ iconImage , $ ic... | add an icon to iconset |
12,411 | function getAddMarkersJS ( $ map_id = "" , $ pano = false ) { if ( $ map_id == "" ) { $ map_id = $ this -> map_id ; } if ( $ pano == false ) { $ _prefix = "map" ; } else { $ _prefix = "panorama" . $ this -> street_view_dom_id ; } $ _output = '' ; foreach ( $ this -> _markers as $ _marker ) { $ iw_html = str_replace ( '... | overridable function for generating js to add markers |
12,412 | function getPolylineJS ( ) { $ _output = '' ; foreach ( $ this -> _polylines as $ polyline_id => $ _polyline ) { $ _coords_output = "" ; foreach ( $ _polyline [ "coords" ] as $ _coords ) { if ( $ _coords_output != "" ) { $ _coords_output .= "," ; } $ _coords_output .= " new google.maps.LatLng(" . $ _coords... | overridable function to generate polyline js - for now can only be used on a map not a streetview |
12,413 | function getAddDirectionsJS ( ) { $ _output = "" ; foreach ( $ this -> _directions as $ directions ) { $ dom_id = $ directions [ "dom_id" ] ; $ travelModeParams = array ( ) ; $ directionsParams = "" ; if ( $ this -> walking_directions == TRUE ) $ directionsParams .= ", \n travelMode:google.maps.DirectionsTravelMode.WAL... | function to render proper calls for directions - for now can only be used on a map not a streetview |
12,414 | function getAddOverlayJS ( ) { $ _output = "" ; foreach ( $ this -> _overlays as $ _key => $ _overlay ) { $ _output .= " var bounds = new google.maps.LatLngBounds(new google.maps.LatLng(" . $ _overlay [ "bounds" ] [ "ne" ] [ "lat" ] . ", " . $ _overlay [ "bounds" ] [ "ne" ] [ "long" ] . "), new google.maps.LatLng(... | function to get overlay creation JS . |
12,415 | function getCreateMarkerJS ( ) { $ _output = " function createMarker(map, point, title, html, icon, icon_shadow, sidebar_id, openers){ var marker_options = { position: point, map: map, title: title}; if(icon!=''){marker_options.icon = icon;} if(icon_shadow!=''){m... | overridable function to generate the js for the js function for creating a marker . |
12,416 | function geoGetDistance ( $ lat1 , $ lon1 , $ lat2 , $ lon2 , $ unit = 'M' ) { $ M = 69.09 * rad2deg ( acos ( sin ( deg2rad ( $ lat1 ) ) * sin ( deg2rad ( $ lat2 ) ) + cos ( deg2rad ( $ lat1 ) ) * cos ( deg2rad ( $ lat2 ) ) * cos ( deg2rad ( $ lon1 - $ lon2 ) ) ) ) ; switch ( strtoupper ( $ unit ) ) { case 'K' : return... | get distance between to geocoords using great circle distance formula |
12,417 | public function getHome ( $ track = true ) { $ home = PublishedNode :: whereHome ( 1 ) -> firstOrFail ( ) ; $ this -> track ( $ track , $ home ) ; return $ home ; } | Returns the home node |
12,418 | public function getNode ( $ name , $ track = true , $ published = true ) { if ( $ this -> withPublishedOnly ( $ published ) ) { $ node = PublishedNode :: withName ( $ name ) ; } else { $ node = Node :: withName ( $ name ) ; } $ node = $ node -> firstOrFail ( ) ; $ this -> track ( $ track , $ node ) ; return $ node ; } | Returns a node by name |
12,419 | protected function withPublishedOnly ( $ published ) { if ( $ published === false ) { return false ; } if ( $ this -> tokenManager -> requestHasToken ( 'preview_nodes' ) ) { return false ; } return true ; } | Checks if the request includes unpublished nodes as well |
12,420 | public function getNodeAndSetLocale ( $ name , $ track = true , $ published = true ) { $ node = $ this -> getNode ( $ name , $ track , $ published ) ; $ locale = $ node -> getLocaleForNodeName ( $ name ) ; set_app_locale ( $ locale ) ; return $ node ; } | Returns a node by name and sets the locale |
12,421 | public function getSearchNodeBuilder ( $ keywords , $ type = null , $ limit = null , $ locale = null ) { $ builder = PublishedNode :: withoutGlobalScopes ( ) -> published ( ) -> typeMailing ( ) -> translatedIn ( $ locale ) -> groupBy ( 'nodes.id' ) ; if ( $ type ) { $ builder -> withType ( $ type ) ; } if ( $ limit ) {... | Gets node searching builder |
12,422 | public function searchNodes ( $ keywords , $ type = null , $ limit = null , $ locale = null ) { return $ this -> getSearchNodeBuilder ( $ keywords , $ type , $ limit , $ locale ) -> get ( ) ; } | Searches for nodes |
12,423 | public function getSortedNodesBuilder ( $ key = null , $ direction = null , $ type = null , $ limit = null , $ locale = null ) { $ builder = PublishedNode :: translatedIn ( $ locale ) -> groupBy ( 'nodes.id' ) ; if ( $ type ) { $ builder -> withType ( $ type ) ; } if ( $ limit ) { $ builder -> limit ( $ limit ) ; } ret... | Gets node sortable builder |
12,424 | public function getSortedNodes ( $ key = null , $ direction = null , $ type = null , $ limit = null , $ locale = null ) { return $ this -> getSortedNodesBuilder ( $ key , $ direction , $ type , $ limit , $ locale ) -> paginate ( ) ; } | Gets sorted nodes |
12,425 | public function getNodeById ( $ id , $ published ) { return $ published ? PublishedNode :: find ( $ id ) : Node :: find ( $ id ) ; } | Returns a node by id |
12,426 | public function getNodesByIds ( $ ids , $ published = true ) { if ( empty ( $ ids ) ) { return null ; } if ( is_string ( $ ids ) ) { $ ids = json_decode ( $ ids , true ) ; } if ( is_array ( $ ids ) && ! empty ( $ ids ) ) { $ placeholders = implode ( ',' , array_fill ( 0 , count ( $ ids ) , '?' ) ) ; $ nodes = Node :: w... | Returns nodes by ids |
12,427 | public function initialize ( ) { if ( $ this -> isInitialized ( ) ) { $ this -> close ( ) ; } if ( ! ( $ this -> curl = curl_init ( ) ) ) { throw new CurlException ( 'Could not initialize a cURL resource' ) ; } return true ; } | Initialize a new cURL resource |
12,428 | public function setOption ( $ option , $ value ) { $ this -> autoInitialize ( ) ; return curl_setopt ( $ this -> curl , $ option , $ value ) ; } | Set cURL option |
12,429 | public function getRequestInfo ( $ key = null ) { if ( ! $ this -> isInitialized ( ) ) { return $ key ? '' : [ ] ; } return $ key ? curl_getinfo ( $ this -> curl , $ key ) : curl_getinfo ( $ this -> curl ) ; } | Get additional information about the last cURL request |
12,430 | public function reset ( ) { if ( ! $ this -> isInitialized ( ) || ! function_exists ( 'curl_reset' ) ) { $ this -> initialize ( ) ; } else { curl_reset ( $ this -> curl ) ; $ this -> response = null ; } } | Reset all cURL options |
12,431 | public function close ( ) { if ( $ this -> isInitialized ( ) ) { curl_close ( $ this -> curl ) ; $ this -> curl = null ; $ this -> response = null ; } } | Close the cURL resource |
12,432 | private function parseUrl ( $ string , $ decode ) { $ this -> autoInitialize ( ) ; $ function = $ decode ? 'curl_unescape' : 'curl_escape' ; if ( ! function_exists ( $ function ) ) { return $ decode ? rawurldecode ( $ string ) : rawurlencode ( $ string ) ; } return call_user_func ( $ function , $ this -> curl , $ strin... | Encode or decode a URL |
12,433 | public function user ( Model $ Model , $ result , $ key = null ) { if ( method_exists ( $ Model , 'user' ) ) { return $ Model -> user ( $ key , $ result ) ; } if ( class_exists ( 'AuthComponent' ) ) { return AuthComponent :: user ( $ key ) ; } if ( class_exists ( 'Authsome' ) ) { return Authsome :: get ( $ key ) ; } if... | Wrapper around retrieving user data |
12,434 | public function permit ( Model $ Model , $ settings = array ( ) ) { $ this -> modelDefaultsPersist [ $ Model -> alias ] = $ this -> modelDefaults [ $ Model -> alias ] ; $ this -> modelDefaults [ $ Model -> alias ] = array_merge ( $ this -> modelDefaults [ $ Model -> alias ] , $ settings ) ; } | Used to dynamically assign permit settings |
12,435 | public function get ( ) { $ this -> scripts ( ) ; return app ( 'antares.form' ) -> of ( "antares.widgets: notification-widget" ) -> extend ( function ( FormGrid $ form ) { $ form -> name ( 'Notification Tester' ) ; $ form -> simple ( handles ( 'antares::notifications/widgets/send' ) , [ 'id' => 'notification-widget-for... | Gets form instance |
12,436 | public function hasPermission ( $ permission ) { $ permission = ! is_string ( $ permission ) ? : Permission :: where ( [ 'slug' => $ permission ] ) -> first ( ) ; if ( $ permission ) { foreach ( $ this -> permissions as $ p ) { if ( $ p -> id == $ permission -> id ) { return true ; } } } return false ; } | Returns if the user has a permission . |
12,437 | public function create ( array $ params ) { if ( ! isset ( $ params [ 'email' ] ) ) { throw new MissingArgumentException ( 'email' ) ; } if ( ! isset ( $ params [ 'name' ] ) ) { throw new MissingArgumentException ( 'name' ) ; } if ( ! isset ( $ params [ 'domain' ] ) ) { throw new MissingArgumentException ( 'domain' ) ;... | Creates a new Engage application . |
12,438 | public function verifyDomain ( array $ params ) { if ( ! isset ( $ params [ 'provider' ] ) ) { throw new MissingArgumentException ( 'provider' ) ; } if ( ! isset ( $ params [ 'code' ] ) ) { throw new MissingArgumentException ( 'code' ) ; } if ( ! isset ( $ params [ 'filename' ] ) ) { throw new MissingArgumentException ... | Automates the server - side component of the provider - specific domain verification mechanism . |
12,439 | public function storeCookie ( $ comment = null ) { $ userData = array ( ) ; $ sessionID = session_id ( ) ; $ currentUser = eZUser :: currentUser ( ) ; if ( is_null ( $ comment ) ) { if ( $ currentUser -> isAnonymous ( ) ) { return '' ; } else { $ userData [ $ sessionID ] = array ( 'email' => $ currentUser -> attribute ... | store data into cookie if field is null set cookie based on user data other wise set cookie based on fields |
12,440 | public function getCustomers ( Get \ RequestData $ requestData = null ) { $ request = new Get \ Request ( $ requestData ) ; $ apiResponse = $ this -> sendRequest ( $ request , Get \ ApiResponse :: class ) ; $ response = $ apiResponse -> getResponse ( ) ; foreach ( $ response -> getCustomers ( ) as $ customer ) { if ( $... | Get the customers . |
12,441 | public function getCustomer ( $ customerId ) { $ requestData = new Get \ RequestData ( ) ; $ requestData -> setCustomerId ( $ customerId ) ; $ customers = $ this -> getCustomers ( $ requestData ) -> getResponse ( ) -> getCustomers ( ) ; return isset ( $ customers [ 0 ] ) ? $ customers [ 0 ] : null ; } | Get one customer by ID . |
12,442 | public function getCustomerByExternalUid ( $ customerExternalUid ) { $ requestData = new Get \ RequestData ( ) ; $ requestData -> setCustomerExternalUid ( $ customerExternalUid ) ; $ customers = $ this -> getCustomers ( $ requestData ) -> getResponse ( ) -> getCustomers ( ) ; return isset ( $ customers [ 0 ] ) ? $ cust... | Get once customer by the external ID . |
12,443 | public function deleteCustomer ( $ customerId ) { $ requestData = new Delete \ RequestData ( $ customerId ) ; $ request = new Delete \ Request ( $ requestData ) ; return $ this -> sendRequest ( $ request , Delete \ ApiResponse :: class ) ; } | Delete a customer . |
12,444 | public function addCredits ( $ customerId , $ amount ) { $ requestData = new AddCredits \ RequestData ( $ customerId , $ amount ) ; $ request = new AddCredits \ Request ( $ requestData ) ; return $ this -> sendRequest ( $ request , AddCredits \ ApiResponse :: class ) ; } | Add credits to a customer . |
12,445 | protected function parseLines ( array $ lines , $ lineParser ) { return array_filter ( array_map ( function ( $ line ) use ( $ lineParser ) { $ line = trim ( $ line ) ; if ( ! $ line || 0 === strpos ( $ line , '#' ) ) { return ; } return call_user_func ( $ lineParser , $ line ) ; } , $ lines ) , function ( $ pattern ) ... | Processes a file containing exclude rules of different formats per line |
12,446 | public function auth ( ) { $ spotify = app ( ) -> make ( 'SpotifyWrapper' , [ 'callback' => '/nova-vendor/nova-spotify-auth-tool/auth' , 'scope' => [ ] , 'show_dialog' => true , ] ) -> requestAccessToken ( ) ; $ spotify -> api -> setAccessToken ( $ spotify -> session -> getAccessToken ( ) ) ; Spotify :: updateOrCreate ... | Spotify authentication . |
12,447 | public function checkHealth ( ) { if ( ! $ this -> process -> isRunning ( ) ) { if ( $ this -> status == self :: STATUS_CLEANINGUP || $ this -> status == self :: STATUS_CLEANEDUP ) { $ this -> status = self :: STATUS_DEAD ; return true ; } elseif ( $ this -> status == ChildProcessContainer :: STATUS_SLEEPY ) { $ this -... | Checks the health of this child and returns true if healthy otherwise marks it for cleanup |
12,448 | public function cleanUp ( ) { $ this -> status = self :: STATUS_CLEANINGUP ; if ( $ this -> process -> isRunning ( ) ) { $ this -> sendTERMSignal ( ) ; } else { $ this -> status = self :: STATUS_CLEANEDUP ; } } | Cleans up a process |
12,449 | public function processOutput ( $ childName ) { $ output = $ this -> outputBuffer . $ this -> process -> getIncrementalOutput ( ) ; $ errorOutput = $ this -> errorOutputBuffer . $ this -> process -> getIncrementalErrorOutput ( ) ; $ outputLines = explode ( "\n" , $ output ) ; $ errorOutputLines = explode ( "\n" , $ err... | Looks into and processes the child s output |
12,450 | public function start ( ) { $ cmd = 'app/console ' . $ this -> workerCommand ; if ( $ this -> tube != '' ) { $ cmd .= ' --use-tube=' . escapeshellarg ( $ this -> tube ) ; } if ( $ this -> parent -> isVerbose ( ) ) { $ cmd .= ' -vvvv' ; } $ this -> startTime = time ( ) ; $ this -> parent -> verboseOutput ( '<info>Starti... | Starts the child process |
12,451 | private function sendTERMSignal ( ) { if ( ! $ this -> hasReceivedHUP ) { $ this -> hasReceivedHUP = true ; try { $ this -> process -> signal ( SIGTERM ) ; } catch ( \ Symfony \ Component \ Process \ Exception \ LogicException $ e ) { } } } | Sends a signal to the process this method prevents the signal from being sent twice |
12,452 | public function getReadyForBed ( ) { $ busyStatusses = array ( ChildProcessContainer :: STATUS_SLEEPY , ChildProcessContainer :: STATUS_BUSY_BUT_SLEEPY ) ; if ( in_array ( $ this -> status , $ busyStatusses ) ) { return ; } if ( $ this -> status == ChildProcessContainer :: STATUS_DEAD ) { } else if ( $ this -> status =... | Tells the child to not pick up any more work and go to bed |
12,453 | protected function _getTargetMap ( ) { if ( is_null ( $ this -> _targetMap ) ) { $ this -> _targetMap = array ( ) ; $ this -> _targetMap [ ] = array ( 'name' => "magelocal" , 'label' => "Magento Local module file" , 'uri' => "./app/code/local" ) ; $ this -> _targetMap [ ] = array ( 'name' => "magecommunity" , 'label' =... | Retrieve content from target . xml . |
12,454 | public function getTargets ( ) { if ( ! is_array ( $ this -> _targets ) ) { $ this -> _targets = array ( ) ; if ( $ this -> _getTargetMap ( ) ) { foreach ( $ this -> _getTargetMap ( ) as $ _target ) { $ this -> _targets [ $ _target [ 'name' ] ] = ( string ) $ _target [ 'uri' ] ; } } } return $ this -> _targets ; } | Retrieve targets as associative array from target . xml . |
12,455 | public function getLabelTargets ( ) { $ targets = array ( ) ; foreach ( $ this -> _getTargetMap ( ) as $ _target ) { $ targets [ $ _target [ 'name' ] ] = $ _target [ 'label' ] ; } return $ targets ; } | Retrieve tragets with label for select options . |
12,456 | public function getTargetUri ( $ name ) { foreach ( $ this -> getTargets ( ) as $ _name => $ _uri ) { if ( $ name == $ _name ) { return $ _uri ; } } return '' ; } | Get uri by target s name . |
12,457 | public static function change_case ( $ st , $ case = 'x' ) : string { $ st = self :: cast ( $ st ) ; $ case = substr ( strtolower ( ( string ) $ case ) , 0 , 1 ) ; switch ( $ case ) { case "l" : $ case = MB_CASE_LOWER ; break ; case "u" : $ case = MB_CASE_UPPER ; break ; default : $ case = MB_CASE_TITLE ; } if ( ! empt... | Converts the case of a string . |
12,458 | public static function encode_filename ( $ st , $ maxlength = 50 , $ extension = null , $ is_path = false ) : string { $ st = self :: remove_accents ( self :: cast ( $ st ) ) ; $ allowed = '~\-_.,\(\[\)\]' ; $ args = \ func_get_args ( ) ; foreach ( $ args as $ i => $ a ) { if ( $ i > 0 ) { if ( \ is_string ( $ a ) ) { ... | Returns a cross - platform filename for the file . |
12,459 | public static function encode_dbname ( $ st , $ maxlength = 50 ) : string { $ st = self :: remove_accents ( self :: cast ( $ st ) ) ; $ res = '' ; if ( ! \ is_int ( $ maxlength ) ) { $ maxlength = mb_strlen ( $ st ) ; } for ( $ i = 0 ; $ i < $ maxlength ; $ i ++ ) { if ( mb_ereg_match ( '[A-z0-9]' , mb_substr ( $ st , ... | Returns a corrected string for database naming . |
12,460 | public static function genpwd ( int $ int_max = 12 , int $ int_min = 6 ) : string { mt_srand ( ) ; $ len = ( $ int_min > 0 ) && ( $ int_min < $ int_max ) ? random_int ( $ int_min , $ int_max ) : $ int_max ; $ mdp = '' ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ type = $ i === 0 ? random_int ( 2 , 3 ) : random_int ( 1 ... | Returns a random password . |
12,461 | public static function is_json ( $ st ) { if ( \ is_string ( $ st ) && ! empty ( $ st ) && ( ( substr ( $ st , 0 , 1 ) === '{' ) || ( substr ( $ st , 0 , 1 ) === '[' ) ) ) { json_decode ( $ st ) ; return ( json_last_error ( ) == JSON_ERROR_NONE ) ; } return false ; } | Checks if the string is a json string . |
12,462 | public static function is_number ( ) : bool { $ args = \ func_get_args ( ) ; foreach ( $ args as $ a ) { if ( \ is_string ( $ a ) || ( abs ( $ a ) > PHP_INT_MAX ) ) { if ( ! preg_match ( '/^-?(?:\d+|\d*\.\d+)$/' , $ a ) ) { return false ; } } else if ( ! \ is_int ( $ a ) && ! \ is_float ( $ a ) ) { return false ; } } r... | Checks if the item is a number . Can take as many arguments and will return false if one of them is not a number . |
12,463 | public static function is_integer ( ) : bool { $ args = \ func_get_args ( ) ; foreach ( $ args as $ a ) { if ( \ is_string ( $ a ) || ( abs ( $ a ) > PHP_INT_MAX ) ) { if ( ! preg_match ( '/^-?(\d+)$/' , ( string ) $ a ) ) { return false ; } } else if ( ! \ is_int ( $ a ) ) { return false ; } } return true ; } | Checks if the item is a integer . Can take as many arguments and will return false if one of them is not an integer or the string of an integer . |
12,464 | public static function is_buid ( $ st ) : bool { if ( \ is_string ( $ st ) && ( \ strlen ( $ st ) === 16 ) && ! ctype_print ( $ st ) && ! ctype_space ( $ st ) ) { $ enc = mb_detect_encoding ( $ st , [ '8bit' , 'UTF-8' ] ) ; if ( ! $ enc || ( $ enc === '8bit' ) ) { return true ; } } return false ; } | Checks if the string is a valid binary UID string . |
12,465 | public static function is_email ( $ email ) : bool { if ( function_exists ( 'filter_var' ) ) { return filter_var ( $ email , FILTER_VALIDATE_EMAIL ) ? true : false ; } else { $ isValid = true ; $ atIndex = mb_strrpos ( $ email , "@" ) ; if ( \ is_bool ( $ atIndex ) && ! $ atIndex ) { $ isValid = false ; } else { $ doma... | Checks if the string is the correct type of e - mail address . |
12,466 | public static function correct_types ( $ st ) { if ( \ is_string ( $ st ) ) { if ( self :: is_buid ( $ st ) ) { $ st = bin2hex ( $ st ) ; } else { if ( self :: is_json ( $ st ) ) { if ( strpos ( $ st , '": ' ) && ( $ json = json_decode ( $ st ) ) ) { return json_encode ( $ json ) ; } return $ st ; } $ st = trim ( $ st ... | If it looks like an int or float type the string variable is converted into the correct type . |
12,467 | public static function parse_url ( $ url ) : array { $ url = self :: cast ( $ url ) ; $ r = x :: merge_arrays ( parse_url ( $ url ) , [ 'url' => $ url , 'query' => '' , 'params' => [ ] ] ) ; if ( strpos ( $ url , '?' ) > 0 ) { $ p = explode ( '?' , $ url ) ; $ r [ 'url' ] = $ p [ 0 ] ; $ r [ 'query' ] = $ p [ 1 ] ; $ p... | Returns an array containing any of the various components of the URL that are present . |
12,468 | public static function check_name ( ) : bool { $ args = \ func_get_args ( ) ; foreach ( $ args as $ a ) { $ a = self :: cast ( $ a ) ; $ t = preg_match ( '#[A-z0-9_]+#' , $ a , $ m ) ; if ( $ t !== 1 || $ m [ 0 ] !== $ a ) { return false ; } } return true ; } | Checks if a string complies with SQL naming convention . |
12,469 | public static function check_filename ( ) : bool { $ args = \ func_get_args ( ) ; foreach ( $ args as $ a ) { if ( ! \ is_string ( $ a ) || ( strpos ( $ a , '/' ) !== false ) || ( strpos ( $ a , '\\' ) !== false ) ) { return false ; } } return true ; } | Checks if a string doesn t contain a filesystem path . |
12,470 | public static function has_slash ( ) : bool { $ args = \ func_get_args ( ) ; foreach ( $ args as $ a ) { if ( ( strpos ( $ a , '/' ) !== false ) || ( strpos ( $ a , '\\' ) !== false ) ) { return true ; } } return false ; } | Checks if a string complies with SQL naming convention . Returns true if slash or backslash are present . |
12,471 | public static function say_size ( $ bytes , $ unit = 'B' , $ stop = false ) : string { $ i = 0 ; $ units = [ '' , 'K' , 'M' , 'G' , 'T' ] ; while ( $ stop || ( $ bytes > 2000 ) ) { $ i ++ ; $ bytes /= 1024 ; if ( $ stop === $ units [ $ i ] ) { break ; } } return sprintf ( "%5.2f %s" . $ unit , $ bytes , $ units [ $ i ]... | Converts the bytes to another unit form . |
12,472 | public function getPrintableMessage ( ) { $ ret = $ this -> message ; if ( $ this -> _parser != null ) { $ string = rtrim ( $ this -> _parser -> getString ( ) ) ; $ offset = $ this -> _parser -> getOffset ( ) ; $ rightStr = substr ( $ string , $ offset ) ; $ offset0 = $ offset + strlen ( $ rightStr ) - strlen ( ltrim (... | Gets a printable message . |
12,473 | public function make ( $ responseBody , array $ responseInfo ) { $ info = $ this -> makeResponseInfo ( $ responseInfo ) ; $ response = $ this -> makeResponse ( $ responseBody , $ info ) ; return $ response ; } | Make a response |
12,474 | public function file_error_message ( $ key ) { if ( $ this -> file_info ( $ key ) ) { return '' ; } elseif ( ! isset ( $ _FILES [ $ key ] ) ) { return $ this -> __ ( 'File is not specified.' ) ; } else { switch ( $ _FILES [ $ key ] [ 'error' ] ) { case UPLOAD_ERR_FORM_SIZE : case UPLOAD_ERR_INI_SIZE : return $ this -> ... | Get file upload error message |
12,475 | protected function _runShell ( ) { echo wordwrap ( '-- discovery-shell to help discover a class or library --' . PHP_EOL . PHP_EOL . 'Use TAB for autocompletion and your arrow-keys to navigate through your method-history.' . PHP_EOL . 'Beware! This is not a full-featured php-shell. The input gets parsed with PHP-Parser... | Runs the shell |
12,476 | public function createTemporaryTable ( $ tableNamePattern , $ tableDefinition ) { $ tableNamePattern = $ this -> getPrefixedTableNames ( $ tableNamePattern ) ; if ( strpos ( $ tableNamePattern , '%' ) === false ) { $ tableName = $ tableNamePattern ; } else { $ maxTries = 10 ; do { $ num = rand ( 10000000 , 99999999 ) ;... | Creates a new temporary table and returns the name . |
12,477 | public function dropTemporaryTable ( $ tableName ) { $ tableName = $ this -> getPrefixedTableNames ( $ tableName ) ; $ this -> db -> exec ( "TRUNCATE TABLE $tableName" ) ; $ this -> db -> exec ( "DROP TABLE $tableName" ) ; } | Drop specified temporary table in a portable way . |
12,478 | public function getBaseUri ( ) { return sprintf ( '%s%s' , $ this -> params [ 'endpoint' ] , ! empty ( $ this -> id ) ? '/' . $ this -> id : null ) ; } | Return entity endpoint base uri |
12,479 | public function Register ( $ data ) { if ( isset ( $ data [ "Password" ] ) && is_array ( $ data [ "Password" ] ) && isset ( $ data [ "Password" ] [ "_Password" ] ) ) { $ data [ "Password" ] = $ data [ "Password" ] [ "_Password" ] ; } $ this -> owner -> update ( $ data ) ; $ this -> owner -> VerificationCode = sha1 ( mt... | Register a new user account using the provided data and then return the current member |
12,480 | public function sendVerificationEmail ( ) { if ( $ this -> owner -> exists ( ) ) { $ controller = Injector :: inst ( ) -> get ( "Users_Register_Controller" ) ; $ subject = _t ( "Users.PleaseVerify" , "Please verify your account" ) ; if ( Users :: config ( ) -> send_email_from ) { $ from = Users :: config ( ) -> send_em... | Send a verification email to this user account |
12,481 | public function exec ( $ sql ) { $ this -> writeToLog ( "Exec: " . $ sql ) ; $ result = parent :: exec ( $ sql ) ; return $ result ; } | Used to issue statements which return no results but rather the number of rows affected |
12,482 | public function prepare ( $ sql , $ options = null ) { $ md5 = md5 ( $ sql ) ; if ( isset ( $ this -> prepared_sql [ $ md5 ] ) ) { return $ this -> prepared_sql [ $ md5 ] ; } $ stmt = parent :: prepare ( $ sql ) ; $ this -> prepared_sql [ $ md5 ] = $ stmt ; return $ stmt ; } | Used to prepare sql statements for value binding |
12,483 | public function writeToLog ( $ message ) { if ( is_null ( $ this -> logger ) ) { $ this -> setLogger ( ) ; } if ( empty ( $ this -> sbf_id ) || $ this -> sbf_id == \ sb \ Gateway :: $ cookie [ 'SBF_ID' ] ) { $ message = preg_replace ( "~\t~" , " " , $ message ) ; return $ this -> logger -> { $ this -> log_str } ( $ mes... | Logs all sql statements to a file if the log file is specified |
12,484 | public function getMetaData ( ModelInterface $ model , DiInterface $ di ) { $ reflection = $ di -> getAnnotations ( ) -> get ( $ model ) ; $ properties = $ reflection -> getPropertiesAnnotations ( ) ; if ( ! $ properties ) { throw new \ Exception ( 'There are no properties defined on the class' ) ; } $ tableProperties ... | Initializes the model s meta - data |
12,485 | public function getColumnMaps ( ModelInterface $ model , DiInterface $ di ) { $ reflection = $ di [ 'annotations' ] -> get ( $ model ) ; $ columnMap = array ( ) ; $ reverseColumnMap = array ( ) ; $ renamed = false ; foreach ( $ reflection -> getPropertiesAnnotations ( ) as $ name => $ collection ) { if ( $ collection -... | Initializes the model s column map |
12,486 | public function getOutputAsArray ( ) { $ output = trim ( $ this -> getOutput ( ) ) ; if ( empty ( $ output ) === false ) { return preg_split ( '{\r?\n}' , $ output ) ; } return array ( ) ; } | Returns the output separated by newline as array . |
12,487 | public function setAccessToken ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Application \ API \ OAuth \ Client \ AccessToken $ accessToken = null ) { $ this -> access_token = $ accessToken ; return $ this ; } | Set accessToken . |
12,488 | public function setProvider ( \ Gpupo \ CommonSchema \ ORM \ Entity \ Application \ API \ OAuth \ Provider $ provider = null ) { $ this -> provider = $ provider ; return $ this ; } | Set provider . |
12,489 | private function set_tags ( ) { if ( $ this -> mode ) { if ( $ this -> mode === 'vue' ) { $ tags = \ bbn \ x :: merge_arrays ( $ this -> all_tags [ 'js' ] , $ this -> all_tags [ 'vue' ] ) ; } else { $ tags = $ this -> all_tags [ $ this -> mode ] ; } $ this -> tags = \ bbn \ x :: merge_arrays ( $ this -> all_tags [ 'com... | Sets the tags list relative to the selected mode |
12,490 | private function get_tags ( string $ block ) { preg_match_all ( $ this -> pattern [ 'tag' ] , $ block , $ tags , PREG_OFFSET_CAPTURE ) ; if ( ! empty ( $ tags [ 0 ] ) ) { return $ tags [ 0 ] ; } return [ ] ; } | Gets te tags list of a docblock |
12,491 | private function group_tags ( array $ tags ) { $ res = [ ] ; if ( ! empty ( $ tags ) ) { foreach ( $ tags as $ i => $ tag ) { if ( $ tag [ 'tag' ] === 'memberof' ) { continue ; } $ t = $ tag [ 'tag' ] ; unset ( $ tag [ 'tag' ] ) ; $ res [ $ t ] [ ] = $ tag [ 'text' ] ?? $ tag ; } } return array_map ( function ( $ r ) {... | Groups tags by name |
12,492 | private function tag_has_type ( string $ tag ) { return in_array ( 'type' , array_values ( \ is_array ( $ this -> tags [ $ tag ] ) ? $ this -> tags [ $ tag ] : $ this -> tags [ $ this -> tags [ $ tag ] ] ) ) ; } | Cheks if a tag has type |
12,493 | private function tag_has_default ( string $ tag ) { return in_array ( 'default' , array_values ( \ is_array ( $ this -> tags [ $ tag ] ) ? $ this -> tags [ $ tag ] : $ this -> tags [ $ this -> tags [ $ tag ] ] ) ) ; } | Cheks if a tag has default |
12,494 | private function tag_has_name ( string $ tag ) { return in_array ( 'name' , array_values ( \ is_array ( $ this -> tags [ $ tag ] ) ? $ this -> tags [ $ tag ] : $ this -> tags [ $ this -> tags [ $ tag ] ] ) ) ; } | Cheks if a tag has name |
12,495 | private function tag_has_desc ( string $ tag ) { return in_array ( 'description' , array_values ( \ is_array ( $ this -> tags [ $ tag ] ) ? $ this -> tags [ $ tag ] : $ this -> tags [ $ this -> tags [ $ tag ] ] ) ) ; } | Cheks if a tag has description |
12,496 | private function tag_has_text ( string $ tag ) { return in_array ( 'text' , array_values ( \ is_array ( $ this -> tags [ $ tag ] ) ? $ this -> tags [ $ tag ] : $ this -> tags [ $ this -> tags [ $ tag ] ] ) ) ; } | Cheks if a tag has text |
12,497 | private function tag_get_type ( string $ text ) { if ( ( $ this -> mode === 'js' ) || ( $ this -> mode === 'vue' ) ) { preg_match ( '/(?:\{)(.+)(?:\})/' , $ text , $ type , PREG_OFFSET_CAPTURE ) ; } else if ( $ this -> mode === 'php' ) { preg_match ( '/(?:\@[a-z]+\s{1})(.+)(?:\s{1}\$)/' , $ text , $ type , PREG_OFFSET_... | Gets tag type |
12,498 | private function tag_get_default ( string $ text ) { if ( ( $ this -> mode === 'js' ) || ( $ this -> mode === 'vue' ) ) { preg_match ( '/(?:\[)(.+)(?:\])/' , $ text , $ def , PREG_OFFSET_CAPTURE ) ; } return $ def ; } | Gets tag default |
12,499 | private function tag_get_name ( string $ text ) { if ( ( $ this -> mode === 'js' ) || ( $ this -> mode === 'vue' ) ) { preg_match ( '/[[:graph:]]+/' , $ text , $ name , PREG_OFFSET_CAPTURE ) ; } else if ( $ this -> mode === 'php' ) { preg_match ( '/\$[a-z]+/' , $ text , $ name , PREG_OFFSET_CAPTURE ) ; } return $ name ... | Gets tag name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.