idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
54,700 | public function tabUp ( $ blnLine = TRUE ) { $ this -> tabCount ++ ; $ this -> setTabString ( ) ; if ( $ blnLine && $ this -> autoSpaces ) { $ this -> addLine ( ) ; } } | Increment the tab count |
54,701 | public function tabDown ( $ blnLine = TRUE ) { if ( $ blnLine && $ this -> autoSpaces ) { $ this -> addLine ( ) ; } $ this -> tabCount -- ; $ this -> setTabString ( ) ; } | Decrement the tab count |
54,702 | public function tabVals ( $ strA , $ strB , $ intTabs = FALSE , $ strSeparator = '= ' ) { if ( ! $ intTabs ) { $ intTabs = $ this -> classGap ; } $ intGapLength = $ intTabs * 4 ; $ intGapAdditional = $ intGapLength - strlen ( $ strA ) ; $ intGapTabs = ceil ( $ intGapAdditional / 4 ) ; if ( $ intGapTabs < 1 ) { $ intGap... | Return A and B with tabs between them |
54,703 | public function remember ( $ minutes = 0 ) { if ( isset ( $ this -> menusRegistered [ $ this -> lastUpdated ] ) ) { $ this -> menusRegistered [ $ this -> lastUpdated ] [ 'remember' ] = $ minutes ; } return $ this ; } | Set time to cache the menu HTML |
54,704 | private function updateMenu ( $ name , array $ args ) { if ( isset ( $ this -> menusRegistered [ $ name ] ) ) { $ this -> menusRegistered [ $ name ] = array_merge ( $ this -> menusRegistered [ $ name ] , $ args ) ; $ this -> lastUpdated = $ name ; } } | Add or update attributes to menu |
54,705 | public function parse ( ) { return $ this -> setDescription ( ) -> setArray ( 'VALUE_IS_ARRAY' ) -> setValue ( ) -> setEmptyMode ( ) -> setShortcut ( ) -> calculateMode ( InputOption :: class ) -> setName ( ) ; } | Parse the set input string . |
54,706 | protected function setValue ( ) { if ( strpos ( $ this -> input , '=' ) !== false ) { if ( substr ( $ this -> input , - 1 ) === '=' ) { $ this -> input = str_replace ( '=' , '' , $ this -> input ) ; $ this -> modeArray [ ] = 'VALUE_REQUIRED' ; } else { list ( $ this -> input , $ this -> default ) = explode ( '=' , $ th... | Parse option value and value default . |
54,707 | protected function setShortcut ( ) { if ( strpos ( $ this -> input , '|' ) !== false ) { list ( $ this -> shortcut , $ this -> input ) = explode ( '|' , $ this -> input ) ; } return $ this ; } | Set option shortcut . |
54,708 | public function getAttributes ( ) { return [ 'name' => $ this -> name , 'shortcut' => $ this -> shortcut , 'mode' => $ this -> mode , 'description' => $ this -> description , 'default' => $ this -> default , ] ; } | Get the option attributes . |
54,709 | public function connecting ( $ url , $ params , $ method ) { if ( $ this -> config === null ) { return null ; } try { $ result = $ this -> client -> request ( $ method , $ url , [ 'auth' => [ $ this -> username , $ this -> password , ] , 'form_params' => $ params , ] ) ; $ bodyText = json_decode ( $ result -> getBody (... | Connect to site factory . |
54,710 | public function ping ( ) { if ( $ this -> getURL ( ) === null ) { return 'Cannot find site URL from configuration.' ; } $ url = $ this -> getURL ( ) . '/api/v1/ping' ; $ params = [ ] ; $ response = $ this -> connecting ( $ url , $ params , 'GET' ) ; if ( isset ( $ response -> message ) ) { return $ response -> message ... | Ping site factory . |
54,711 | public function getSiteLanguage ( ) { if ( is_null ( $ this -> language ) && ( $ request = $ this -> requestStack -> getMasterRequest ( ) ) ) { $ this -> language = $ request -> get ( 'language' , $ request -> getLocale ( ) ) ; } return $ this -> language ; } | Get the current language of the current site |
54,712 | public function layout ( $ compare = null ) { if ( $ compare === null ) { return $ this -> layoutName ; } return $ compare === $ this -> layoutName ; } | Get the layout name or check if it s equal to the supplied param . |
54,713 | public function resolve ( $ query ) { $ queryClassName = self :: findBaseName ( $ query ) ; if ( $ query instanceof ICommand ) { if ( isset ( $ this -> commandHandlers [ $ queryClassName ] ) ) { return $ this -> commandHandlers [ $ queryClassName ] ; } throw new HandlerNotFoundException ( $ queryClassName ) ; } if ( is... | Find the command handler . If the command handler has not been found an exception is thrown |
54,714 | public function addCommandHandler ( ICommandHandler $ commandHandler ) { $ commandClassName = preg_replace ( '/(.*)Handler$/i' , '$1' , self :: findBaseName ( $ commandHandler ) ) ; $ this -> commandHandlers [ $ commandClassName ] = $ commandHandler ; } | Add a command handler to the resolver |
54,715 | public function addQueryHandler ( IQueryHandler $ queryHandler ) { $ queryClassName = preg_replace ( '/(.*)Handler$/i' , '$1' , self :: findBaseName ( $ queryHandler ) ) ; $ this -> queryHandlers [ $ queryClassName ] = $ queryHandler ; } | Add a query handler to the resolver |
54,716 | private function getJsonResponseBody ( $ method , $ uri ) { $ body = [ ] ; $ response = $ this -> httpClient -> request ( $ method , $ uri ) ; if ( $ response -> getStatusCode ( ) == 200 ) { $ body = json_decode ( $ response -> getBody ( ) ) ; } return $ body ; } | Returns the json decoded response body . |
54,717 | public function getHighestVersion ( array $ versions = [ ] ) : string { $ highest_version = 0 ; foreach ( $ versions as $ version_number ) { if ( $ version_number === 'dev-master' ) { continue ; } if ( str_replace ( '.' , '' , $ version_number ) + 0 > $ highest_version ) { $ highest_version = $ version_number ; } } if ... | Returns the highest version of an array of versions . |
54,718 | public function getIdentityGroupClass ( $ groupName ) { if ( isset ( $ this -> groups [ $ groupName ] ) ) return $ this -> groups [ $ groupName ] ; return $ this -> identityClass ; } | mengambil class identity group . |
54,719 | public function getEntry ( $ index , $ default = null ) { return isset ( $ this -> _collection [ $ index ] ) ? $ this -> _collection [ $ index ] : $ default ; } | Gets a collection entry value by its index |
54,720 | public function setEntry ( $ index = null , $ value ) { if ( is_null ( $ index ) ) { return $ this -> push ( $ value ) ; } $ this -> _collection [ $ index ] = $ value ; return $ this ; } | Sets a collection entry value by its index |
54,721 | public function bootstrap ( ) { date_default_timezone_set ( $ this -> app -> config -> getApp ( 'timezone' ) ) ; ini_set ( "error_log" , $ this -> app -> logFilePath ( ) ) ; ini_set ( 'session.name' , 'planet_session' ) ; session_save_path ( realpath ( $ this -> app -> sessionDirectoryPath ( ) ) ) ; } | Bootstrap application configuration |
54,722 | public function getHeadImageUrl ( $ size = 46 ) { $ headimgurl = $ this -> headimgurl ; if ( $ headimgurl && in_array ( $ size , [ 46 , 64 , 96 , 132 ] ) ) { $ headimgurl = preg_replace ( '/\/0$/' , '/' . $ size , $ headimgurl ) ; } return $ headimgurl ; } | Return head image url of size |
54,723 | public function getPrivilegeList ( ) { if ( $ this -> _privilege === null ) { $ this -> _privilege = Json :: decode ( $ this -> privilege ) ; if ( $ this -> _privilege === null ) { $ this -> _privilege = [ ] ; } } return $ this -> _privilege ; } | Return privilege array |
54,724 | public function setPrivilegeList ( $ value ) { $ this -> privilege = Json :: encode ( $ value ) ; $ this -> _privilege = $ value ; } | Set privilege json |
54,725 | public function worker ( $ worker , $ params = array ( ) , $ method_name = "" , $ data = array ( ) ) { if ( ! is_array ( $ worker ) ) { $ worker = array ( $ worker ) ; } $ helper = "" ; foreach ( $ worker as $ helper ) { $ helper = ucfirst ( $ helper ) ; $ file = configItem ( 'site' ) [ 'workerdir' ] . $ helper . '/' .... | Responsible for loading workers |
54,726 | public function view ( $ viewname , $ data = '' ) { if ( in_array ( $ viewname , $ this -> viewset ) === false ) { $ this -> viewset [ ] = array ( $ viewname , $ data ) ; $ view = new View ( Base :: getInstance ( ) ) ; $ this -> loaderHooks ( $ view , 'pre_view' , $ class = '' , $ method_name = '' , $ data = array ( ) ... | Adds the view in viewset . This viewset is later used for rendering |
54,727 | public function template ( $ template , $ data = array ( ) , $ options = '' ) { $ this -> template = array ( $ template , $ data , $ options ) ; $ template = new Template ( Base :: getInstance ( ) ) ; $ this -> loaderHooks ( $ template , 'pre_template' , $ class = '' , $ method_name = '' , $ data = array ( ) ) ; return... | Stores template information . This is later used while rendering templates |
54,728 | public function controller ( $ controller , $ params = array ( ) , $ method_name = "" , $ data = array ( ) ) { $ file = configItem ( 'site' ) [ 'cust_controller_dir' ] . $ controller . '.php' ; $ class = basename ( $ file , '.php' ) ; $ ns = $ this -> get_ns ( $ file , $ this -> app_folder ) ; if ( ! isset ( $ this -> ... | Creates an instance of the Constructor . Can be initialized along with - constructor parameters - method - method parameters |
54,729 | public function model ( $ model , $ params = array ( ) , $ method_name = "" , $ data = array ( ) ) { if ( ! isset ( $ this -> _loaded_models [ $ model ] ) ) { $ file = configItem ( 'site' ) [ 'modeldir' ] . implode ( '/' , explode ( '-' , $ model ) ) . '.php' ; $ class = basename ( $ file , '.php' ) ; if ( ! file_exist... | Creates an instance of the Model . Can be initialized along with - constructor parameters - method - method parameters |
54,730 | private function _createInstance ( $ namespace , $ class , $ params , $ method_name , $ data ) { $ ns_class = $ namespace . $ class ; $ ref_class = new \ ReflectionClass ( $ ns_class ) ; if ( is_array ( $ params ) && sizeof ( $ params ) > 0 ) { $ instance = $ ref_class -> newInstanceArgs ( $ params ) ; } else { $ insta... | Creates an instance of the component which is being loaded . |
54,731 | protected function loaderHooks ( $ instance , $ hook_name , $ class = '' , $ method_name = '' , $ data = array ( ) ) { $ hooks = configItem ( 'hooks' ) ; if ( isset ( $ hooks [ $ hook_name ] ) && $ hooks [ $ hook_name ] [ 'active' ] ) { $ ns = "\\application\\" . $ hooks [ $ hook_name ] [ 'namespace' ] ; $ hook_class =... | Triggers a hook |
54,732 | protected function getArg ( $ name ) { if ( isset ( $ this -> request [ 'json' ] -> $ name ) ) { return $ this -> getJSONArg ( $ name ) ; } else { return parent :: getArg ( $ name ) ; } } | Return an argument from JSON request |
54,733 | protected function getJSONArg ( $ name ) { return isset ( $ this -> request [ 'json' ] -> $ name ) ? $ this -> request [ 'json' ] -> $ name : FALSE ; } | Return a JSON argument or FALSE if not set |
54,734 | protected function success ( $ response = array ( ) , $ httpCode = 200 ) { if ( ! is_array ( $ response ) ) { $ response = array ( $ response ) ; } $ this -> view -> response = $ response ; $ this -> view -> response [ 'success' ] = 1 ; $ this -> view -> response [ 'time' ] = time ( ) ; if ( $ httpCode ) { $ this -> ht... | Set success response |
54,735 | protected function error ( $ message = 'invalid request' , $ code = 0 , $ httpCode = 0 ) { if ( is_numeric ( $ message ) ) { $ error = new Error ( $ message ) ; $ code = $ error -> getCode ( ) ; $ message = $ error -> getMessage ( ) ; } else if ( $ message instanceof Error ) { $ code = $ message -> getCode ( ) ; $ mess... | Set error response |
54,736 | function canRecognizeIdentity ( ) { $ r = HttpDigest \ hasAuthorizationHeader ( $ this -> request ( ) , $ this -> isProxyAuth ( ) ) ; return ( $ r !== false ) ; } | Can Recognize Identity? |
54,737 | public function addOrUpdate ( ) { $ this -> request -> allowMethod ( [ 'post' ] ) ; if ( ! $ this -> request -> is ( 'ajax' ) ) { throw new \ RuntimeException ( 'Wrong type of request!' ) ; } $ params = is_array ( $ this -> request -> getData ( ) ) ? $ this -> request -> getData ( ) : [ ] ; $ translation = $ this -> Tr... | Add or update method |
54,738 | public function resetQuery ( ) { $ this -> _field_list = array ( self :: DEFAULT_FIELD ) ; $ this -> _param_list = array ( ) ; $ this -> _limit = array ( self :: DEFAULT_LIMIT ) ; $ this -> _where_list = array ( ) ; return $ this ; } | reset the parameters |
54,739 | public function setFieldList ( $ field_list = array ( ) ) { if ( empty ( $ field_list ) ) $ this -> _field_list = array ( '*' ) ; $ this -> _field_list = ( array ) $ field_list ; return $ this ; } | set the field list |
54,740 | public function setWhereList ( $ field_list = array ( ) ) { if ( empty ( $ field_list ) ) $ this -> _where_list = array ( ) ; $ this -> _where_list = ( array ) $ field_list ; return $ this ; } | set the where list |
54,741 | public function getAll ( ) { $ sql = "SELECT * FROM `$this->_table`" ; $ this -> __init_database ( ) ; if ( $ stmt = $ this -> db -> prepare ( $ sql ) ) return $ this ; $ this -> result = $ stmt -> fetchAll ( MySQL :: FETCH_OBJ ) ; return $ this ; } | get all from the table |
54,742 | public function get ( ) { $ sql = "SELECT * FROM `$this->_table` " ; $ this -> _param_list = array ( ) ; if ( ! empty ( $ this -> _where_list ) ) { $ sql .= "WHERE " ; $ first = true ; foreach ( $ this -> _where_list as $ field_name => $ field_settings ) { $ type = isset ( $ field_settings [ 'type' ] ) ? $ field_settin... | get the result based on the built query |
54,743 | public function query ( $ sql , $ param = null ) { $ this -> __init_database ( ) ; $ stmt = $ this -> db -> prepare ( $ sql ) ; for ( $ i = 0 , $ c = count ( $ param ) ; $ i < $ c ; $ i ++ ) { $ stmt -> bindParam ( $ param [ $ i ] [ 0 ] , $ param [ $ i ] [ 1 ] ) ; } $ this -> last_sql = $ sql ; if ( ! $ stmt -> execute... | fetch a direct query |
54,744 | public function getCacheDir ( ) : string { if ( $ this -> _cache_dir === null ) $ this -> _cache_dir = realpath ( __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'cache' ) ; return $ this -> _cache_dir ; } | Get cache dir |
54,745 | public function view ( $ _view , ? array $ _data = [ ] , bool $ _return = false ) { if ( \ count ( $ this -> viewData ) > 0 ) { extract ( $ this -> viewData , EXTR_SKIP ) ; } if ( $ _view === null ) { $ this -> output .= $ _data [ 0 ] ; return true ; } $ fileName = $ this -> configs [ 'libs' ] . '/Views/' . $ _view . '... | Load a View into the System |
54,746 | public function data ( array $ modules , bool $ reset = false ) : void { if ( $ reset ) { $ this -> viewData = [ ] ; } $ this -> viewData = array_merge ( $ this -> viewData , $ modules ) ; } | Adds data to be used in views |
54,747 | public function create ( Description $ description ) { return new LocationEntity ( $ description -> getOptionalProperty ( 'address' ) , $ this -> getCoordinates ( $ description ) , $ description -> getOptionalProperty ( 'postalCode' ) , $ description -> getOptionalProperty ( 'city' ) , $ description -> getOptionalPrope... | Create a location from a description . |
54,748 | private function getCoordinates ( Description $ description ) { $ latitude = $ description -> getOptionalProperty ( 'lat' ) ; $ longitude = $ description -> getOptionalProperty ( 'lng' ) ; if ( $ latitude === null || $ longitude === null ) { return null ; } return new Coordinates ( $ latitude , $ longitude ) ; } | Get the locaton coordinates . |
54,749 | public function generate_javascript_markup ( ) { $ svg = $ this -> assemble_grunticon_asset_path ( $ this -> svg_filename ) ; $ png = $ this -> assemble_grunticon_asset_path ( $ this -> png_filename ) ; $ fallback = $ this -> assemble_grunticon_asset_path ( $ this -> fallback_filename ) ; return 'grunticon(["' . $ svg ... | Generates JavaScript to load Grunticon assets . |
54,750 | private function assemble_grunticon_asset_path ( $ filename ) { $ asset_path = trailingslashit ( $ this -> path ) . $ filename ; if ( empty ( $ this -> version ) ) { return $ asset_path ; } return $ asset_path . '?ver=' . $ this -> version ; } | Generates the path to a Grunticon asset which optional cache busting of resources . |
54,751 | public static function make ( $ results , $ total , $ perPage ) { $ page = static :: page ( $ total , $ perPage ) ; $ last = ceil ( $ total / $ perPage ) ; return new static ( $ results , $ page , $ total , $ perPage , $ last ) ; } | Create a new Paginator instance . |
54,752 | public static function page ( $ total , $ perPage ) { $ page = ( null === request ( ) -> getCrudNumPage ( ) ) ? 1 : request ( ) -> getCrudNumPage ( ) ; if ( is_numeric ( $ page ) && $ page > $ last = ceil ( $ total / $ perPage ) ) { return ( $ last > 0 ) ? $ last : 1 ; } return ( static :: valid ( $ page ) ) ? $ page :... | Get the current page from the request query string . |
54,753 | public function links ( $ adjacent = 3 ) { if ( $ this -> last <= 1 ) { return '' ; } if ( $ this -> last < 7 + ( $ adjacent * 2 ) ) { $ links = $ this -> range ( 1 , $ this -> last ) ; } else { $ links = $ this -> slider ( $ adjacent ) ; } $ content = '<ul class="pagination">' . $ this -> previous ( '←' ) . $ lin... | Create the HTML pagination links . |
54,754 | public function slider ( $ adjacent = 3 ) { $ window = $ adjacent * 2 ; if ( $ this -> page <= $ window ) { return $ this -> range ( 1 , $ window + 2 ) . ' ' . $ this -> ending ( ) ; } elseif ( $ this -> page >= $ this -> last - $ window ) { return $ this -> beginning ( ) . ' ' . $ this -> range ( $ this -> last - $ wi... | Build sliding list of HTML numeric page links . |
54,755 | public function previous ( $ text = null ) { $ disabled = function ( $ page ) { return $ page <= 1 ; } ; return $ this -> element ( __FUNCTION__ , $ this -> page - 1 , $ text , $ disabled ) ; } | Generate the previous HTML link . |
54,756 | public function next ( $ text = null ) { $ disabled = function ( $ page , $ last ) { return $ page >= $ last ; } ; return $ this -> element ( __FUNCTION__ , $ this -> page + 1 , $ text , $ disabled ) ; } | Generate the next HTML link . |
54,757 | protected function element ( $ element , $ page , $ text , $ disabled ) { $ class = "{$element}_page" ; if ( is_null ( $ text ) ) { $ text = Lang :: line ( "pagination.{$element}" ) -> get ( $ this -> language ) ; } if ( $ disabled ( $ this -> page , $ this -> last ) ) { return '<li' . Html :: attributes ( array ( 'cla... | Create a chronological pagination element such as a previous or next link . |
54,758 | protected function range ( $ start , $ end ) { $ pages = array ( ) ; for ( $ page = $ start ; $ page <= $ end ; $ page ++ ) { if ( $ this -> page == $ page ) { $ pages [ ] = '<li class="active"><a href="#">' . $ page . '</a></li>' ; } else { $ pages [ ] = $ this -> link ( $ page , $ page , null ) ; } } return implode (... | Build a range of numeric pagination links . |
54,759 | protected function link ( $ page , $ text , $ class ) { $ query = '?page=' . $ page . $ this -> appendage ( $ this -> appends ) ; return '<li' . Html :: attributes ( array ( 'class' => $ class ) ) . '><a href="#" onclick="paginationGoPage(' . $ page . '); return false;">' . Inflector :: utf8 ( $ text ) . '</a></li>' ; ... | Create a HTML page link . |
54,760 | protected function appendage ( $ appends ) { if ( ! is_null ( $ this -> appendage ) ) { return $ this -> appendage ; } if ( count ( $ appends ) <= 0 ) { return $ this -> appendage = '' ; } return $ this -> appendage = '&' . http_build_query ( $ appends ) ; } | Create the appendage to be attached to every pagination link . |
54,761 | public function getSavedRedirect ( $ route , $ message = 'flash_bag.success.default' , $ routeParameters = [ ] , $ routeFragment = null , $ translationDomain = null ) { $ this -> addSessionFlashBagMessage ( $ message , Bootstrap4 :: STATE_SUCCESS , $ translationDomain ) ; return $ this -> getRedirectToRoute ( $ route ,... | Get redirect with saved message |
54,762 | public function getFailedRedirect ( $ route , $ message = 'flash_bag.error.default' , $ routeParameters = [ ] , $ routeFragment = null , $ translationDomain = null ) { $ this -> addSessionFlashBagMessage ( $ message , Bootstrap4 :: STATE_DANGER , $ translationDomain ) ; return $ this -> getRedirectToRoute ( $ route , $... | Get redirect with fail message |
54,763 | public function getSavedResponse ( $ body = '' , $ message = 'flash_bag.success.default' ) { $ this -> addSessionFlashBagMessage ( $ message , Bootstrap4 :: STATE_SUCCESS ) ; return new Response ( $ body ) ; } | Get response with saved message |
54,764 | public function getRedirectToRoute ( $ route , $ parameters = [ ] , $ referenceType = UrlGeneratorInterface :: ABSOLUTE_PATH , $ status = Response :: HTTP_FOUND , $ routeFragment = null ) { $ url = $ this -> getRouter ( ) -> generate ( $ route , $ parameters , $ referenceType ) ; if ( null !== $ routeFragment ) { $ url... | Get RedirectResponse by route |
54,765 | private function addSessionFlashBagMessage ( $ message , $ type = Bootstrap4 :: STATE_SUCCESS , $ translationDomain = null ) { if ( false !== $ translationDomain ) { $ message = $ this -> getTranslator ( ) -> trans ( $ message , [ ] , $ translationDomain ) ; } $ this -> getSession ( ) -> getFlashBag ( ) -> add ( $ type... | Add Session Flash Bag Message |
54,766 | public static function getSlice ( $ string , $ offset , $ length = null ) { if ( self :: checkMB ( ) ) { return mb_substr ( $ string , $ offset , $ length , '8bit' ) ; } if ( $ length === null ) { $ length = strlen ( $ string ) ; } return substr ( $ string , $ offset , $ length ) ; } | Returns a slice of a string |
54,767 | public static function getByteFromString ( $ string , $ index , $ signed = false ) { $ char = self :: getSlice ( $ string , $ index , 1 ) ; return self :: getByteFromChar ( $ char , $ signed ) ; } | Returns a byte from a string |
54,768 | public static function unpackBytes ( $ string , $ signed = false ) { $ bytes = [ ] ; $ len = self :: getLength ( $ string ) ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { $ bytes [ ] = self :: getByteFromString ( $ string , $ i , $ signed ) ; } return $ bytes ; } | Convert a binary string to an array of bytes |
54,769 | public function partial ( $ file , array $ variables = array ( ) ) { extract ( $ variables ) ; if ( substr ( $ file , - 4 ) !== '.php' ) { $ file .= '.php' ; } $ view = '' ; if ( $ tmpl = locate_template ( $ file ) ) { ob_start ( ) ; include ( $ tmpl ) ; $ view = ob_get_contents ( ) ; ob_end_clean ( ) ; } return $ view... | Render a view partial . |
54,770 | public function archiveTitle ( array $ config = array ( ) ) { $ defaults = array ( 'default' => 'Archive' , 'prefix' => '' , 'suffix' => '' , 'year_format' => 'Y' , 'month_format' => 'F Y' , 'day_format' => 'jS F Y' ) ; $ config = array_merge ( $ defaults , $ config ) ; $ title = $ config [ 'default' ] ; if ( is_catego... | Get a nice title for an archive page . |
54,771 | public function queuePush ( Job $ job ) { if ( $ this -> isSingle ( ) ) { $ queue_config = $ this -> getQueueConfig ( ) ; if ( isset ( $ queue_config [ 'driver' ] ) ) { $ driver = $ queue_config [ 'driver' ] ; $ driver :: component ( ) -> push ( $ job ) ; } } } | Push message to queue |
54,772 | public function queueDelay ( Job $ job , $ execute_at ) { if ( $ this -> isSingle ( ) ) { $ queue_config = $ this -> getQueueConfig ( ) ; if ( isset ( $ queue_config [ 'driver' ] ) ) { $ driver = $ queue_config [ 'driver' ] ; $ driver :: component ( ) -> delay ( $ job , $ execute_at ) ; } } } | Push message to delay queue |
54,773 | public function queuePull ( ) { if ( $ this -> isSingle ( ) ) { $ queue_config = $ this -> getQueueConfig ( ) ; if ( isset ( $ queue_config [ 'driver' ] ) ) { $ driver = $ queue_config [ 'driver' ] ; return $ driver :: component ( ) -> pull ( ) ; } } return null ; } | Pull message from queue |
54,774 | public function doGet ( $ url , $ port = 80 , $ headers = NULL ) { $ retarr = array ( ) ; $ curl_opts = array ( CURLOPT_URL => $ url , CURLOPT_PORT => $ port , CURLOPT_POST => false , CURLOPT_SSL_VERIFYHOST => false , CURLOPT_SSL_VERIFYPEER => false , CURLOPT_RETURNTRANSFER => true ) ; if ( $ headers ) { $ curl_opts [ ... | Performs a GET request |
54,775 | public function doCurl ( $ curl_opts ) { $ retarr = array ( ) ; if ( ! $ curl_opts ) { return $ retarr ; } $ ch = curl_init ( ) ; if ( ! $ ch ) { return $ retarr ; } curl_setopt_array ( $ ch , $ curl_opts ) ; curl_setopt ( $ ch , CURLOPT_HEADER , true ) ; ob_start ( ) ; $ response = curl_exec ( $ ch ) ; $ curl_spew = o... | Curl helper method . Performs a Curl request |
54,776 | protected function printTable ( InputInterface $ input , OutputInterface $ output , $ environment ) { $ table = new Table ( $ output ) ; $ headers = array ( 'Level' , 'Message' ) ; $ table -> setHeaders ( $ headers ) ; foreach ( $ environment -> getConfig ( ) -> ruleSet ( ) as $ ruleSet ) { foreach ( $ ruleSet -> getEr... | Print information as table . |
54,777 | public function getParameter ( string $ parameterName ) { if ( ! $ this -> hasParameter ( $ parameterName ) ) { return null ; } return $ this -> storage -> offsetGet ( $ parameterName ) ; } | Get a parameter . |
54,778 | final protected function ii ( $ k = null ) { return dfak ( $ this -> _i ? : df_checkout_session ( ) -> getLastRealOrder ( ) -> getPayment ( ) , $ k ) ; } | 2016 - 05 - 21 2017 - 08 - 24 The result is a |
54,779 | private function trimArray ( & $ array ) { foreach ( $ array as $ key => $ value ) { if ( is_string ( $ value ) ) { $ array [ $ key ] = trim ( $ value ) ; } else if ( is_array ( $ value ) ) { $ array [ $ key ] = $ this -> trimArray ( $ value ) ; } } return $ array ; } | Recursively trims all string values in an array . |
54,780 | public function toYaml ( $ input , $ inline = 2 , $ indent = 4 , $ exceptionOnInvalidType = false , $ objectSupport = false ) { return normalize_line_endings ( Yaml :: dump ( $ input , $ inline , $ indent , $ exceptionOnInvalidType , $ objectSupport ) ) ; } | Converts a PHP value to YAML . |
54,781 | protected function setLayout ( $ sLayoutName ) { if ( is_null ( $ this -> view ) ) { throw new Exception ( "It's unable to set Layout without View." ) ; } $ this -> layout = ViewFactory :: createLayout ( $ sLayoutName , $ this -> view ) ; } | It assigns the controller with layout . |
54,782 | private static function unescapeUnicode ( $ sData ) { return preg_replace_callback ( '/\\\\u([0-9a-f]{4})/i' , function ( array & $ aMatches ) { $ sSym = mb_convert_encoding ( pack ( 'H*' , $ aMatches [ 1 ] ) , 'UTF-8' , 'UTF-16' ) ; return $ sSym ; } , $ sData ) ; } | The method converts escaped Unicode chars to unescaped . |
54,783 | protected function redirect ( $ sUrl , $ fIsPermanent = false ) { $ nCode = $ fIsPermanent ? 301 : 302 ; Headers :: getInstance ( ) -> addByHttpCode ( $ nCode ) -> add ( 'Location: ' . $ sUrl ) -> run ( ) ; exit ; } | The method redirects to the URL which passed as param . The HTTP - code is 302 as default . The method unconditional completes the script execution the code after it will not be executed . |
54,784 | public function injectResponse ( ViewEvent $ e ) { $ result = $ e -> getResult ( ) ; $ response = $ e -> getResponse ( ) ; $ response -> setContent ( $ result ) ; } | Populate the response object from the View |
54,785 | public function action ( $ text , $ controller_action , $ parameters = [ ] ) { return $ this -> addElement ( 'a' ) -> text ( $ text ) -> href ( action ( $ controller_action , $ parameters ) ) ; } | Add an action link . |
54,786 | public function addAttributes ( $ attributes ) { foreach ( $ attributes as $ name => $ value ) { if ( ! is_array ( $ value ) ) { $ value = [ $ value ] ; } parent :: attr ( $ name , ... $ value ) ; } return $ this ; } | Add an array of attributes . |
54,787 | public function addClass ( $ value ) { $ paramaters = func_get_args ( ) ; if ( count ( $ paramaters ) > 1 ) { $ value = $ paramaters ; } if ( ! is_array ( $ value ) ) { $ value = explode ( ' ' , $ value ) ; } if ( ! isset ( $ this -> attributeList [ 'class' ] ) || is_null ( $ this -> attributeList [ 'class' ] ) ) { $ t... | Add a class to classList . |
54,788 | public static function addForm ( $ settings = [ ] ) { $ form = self :: createElement ( 'form' ) ; if ( array_get ( $ settings , 'file_upload' ) ) { $ form -> addElement ( 'input' ) -> type ( 'hidden' ) -> name ( 'MAX_FILE_SIZE' ) -> value ( self :: getFileUploadMaxSize ( ) ) ; } return $ form ; } | Create a form object . |
54,789 | public static function getFileUploadMaxSize ( $ convert_to_bytes = true ) { $ max_size = - 1 ; $ max_size_string = '0B' ; if ( $ max_size < 0 ) { $ max_size_string = ini_get ( 'post_max_size' ) ; $ max_size = self :: parseSize ( $ max_size_string ) ; $ upload_max = self :: parseSize ( ini_get ( 'upload_max_filesize' ) ... | Returns a file size limit in bytes based on the PHP upload_max_filesize and post_max_size . |
54,790 | private static function parseSize ( $ size ) { $ unit = preg_replace ( '/[^bkmgtpezy]/i' , '' , $ size ) ; $ size = preg_replace ( '/[^0-9\.]/' , '' , $ size ) ; if ( $ unit ) { return round ( $ size * pow ( 1024 , stripos ( 'bkmgtpezy' , $ unit [ 0 ] ) ) ) ; } return round ( $ size ) ; } | Converts a text based size into bytes . |
54,791 | public function addicon ( $ icon , $ tag = 'i' ) { $ icon = static :: icon ( $ icon , $ tag ) ; return $ this -> addElement ( $ icon ) ; } | Shortcut to creating a FontAwesome item . |
54,792 | public function label ( $ text ) { $ label = self :: createElement ( 'label' ) ; if ( isset ( $ this -> attributeList [ 'id' ] ) ) { $ label -> refer ( $ this -> attributeList [ 'id' ] ) ; } return $ label -> text ( $ this ) -> text ( $ text ) ; } | Shortcut for creating a label . |
54,793 | public static function prepareOptions ( $ options , $ blank_first_option = false , $ name_first_option = '' , $ value_first_option = '' ) { $ options = array_map ( function ( $ key , $ value ) { return [ $ key , $ value ] ; } , array_keys ( $ options ) , array_values ( $ options ) ) ; if ( $ blank_first_option ) { arra... | Prepare key = > value options array for select - options . |
54,794 | public function routeHref ( $ route , $ parameters = [ ] , $ target = '' ) { $ href = route ( $ route , $ parameters ) ; $ href .= ! empty ( $ target ) ? '#' . $ target : '' ; return $ this -> href ( $ href ) ; } | Add an route href . |
54,795 | public function text ( $ value , ... $ args ) { if ( sizeof ( $ args ) ) { $ value = sprintf ( $ value , ... $ args ) ; } if ( $ this -> tag === 'textarea' ) { $ value = htmlspecialchars ( $ value ) ; } parent :: text ( $ value ) ; return $ this ; } | Define text content . |
54,796 | public function textIf ( $ test , $ value , ... $ args ) { return $ test ? $ this -> text ( $ value , ... $ args ) : $ this ; } | Define text content if test is true . |
54,797 | public function configDefaults ( $ tag ) { if ( count ( config ( 'html.default.' . $ tag , [ ] ) ) ) { foreach ( config ( 'html.default.' . $ tag ) as $ name => $ value ) { $ this -> attr ( $ name , $ value ) ; } } } | Apply any defaults from configuration . |
54,798 | public function buildRanking ( ) { $ i = 0 ; return $ this -> map ( function ( ComponentInterface $ component ) use ( & $ i ) { return $ component -> setRanking ( ++ $ i ) ; } ) ; } | Build ranking index for this collection of components . |
54,799 | final public function execute ( ... $ args ) { $ className = get_class ( $ this ) ; if ( ! method_exists ( $ this , 'process' ) ) { throw new RuntimeException ( sprintf ( 'Context "%s" should have process method' , $ className ) ) ; } $ process = new ReflectionMethod ( $ className , 'process' ) ; if ( ! $ process -> is... | Execute context . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.