idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
17,800 | public static function deactive ( \ Closure $ deactive ) { $ mocaBonita = self :: getInstance ( ) ; register_deactivation_hook ( MbPath :: pBaseN ( ) , function ( ) use ( $ deactive , $ mocaBonita ) { try { MbMigration :: enablePdoConnection ( ) ; call_user_func_array ( $ deactive , [ $ mocaBonita ] ) ; } catch ( \ Exception $ e ) { MbException :: registerError ( $ e ) ; wp_die ( $ e -> getMessage ( ) ) ; } } ) ; } | Set the callback that will be called when the plugin is deactivated |
17,801 | private function runPlugin ( ) { MbEvent :: callEvents ( $ this , MbEvent :: START_WORDPRESS , $ this ) ; if ( ! $ this -> getMbResponse ( ) -> isRedirection ( ) ) { $ this -> getMbAssets ( true ) -> runAssets ( '*' ) ; $ paramsQuery = $ this -> mbRequest -> query ( ) ; if ( isset ( $ paramsQuery [ MbDatabaseQueryBuilder :: getPagination ( ) ] ) ) { $ pagination = $ paramsQuery [ MbDatabaseQueryBuilder :: getPagination ( ) ] ; unset ( $ paramsQuery [ MbDatabaseQueryBuilder :: getPagination ( ) ] ) ; } else { $ pagination = 1 ; } $ urlWihtouPagination = $ this -> mbRequest -> urlQuery ( $ paramsQuery ) ; Paginator :: currentPathResolver ( function ( ) use ( $ urlWihtouPagination ) { return $ urlWihtouPagination ; } ) ; Paginator :: currentPageResolver ( function ( ) use ( $ pagination ) { return is_numeric ( $ pagination ) ? ( int ) $ pagination : 1 ; } ) ; foreach ( $ this -> mbShortCodes as $ shortcode ) { $ shortcode -> runShortcode ( $ this -> getMbAssets ( ) , $ this -> mbRequest , $ this -> mbResponse ) ; } if ( $ this -> getMbRequest ( ) -> isBlogAdmin ( ) ) { MbWPActionHook :: addAction ( 'admin_menu' , $ this , 'addAdminMenuToWordpress' ) ; } if ( $ this -> isMocabonitaPage ( ) ) { $ mbPage = $ this -> getMbPage ( $ this -> page ) ; $ this -> getMbRequest ( ) -> setMbPage ( $ mbPage ) ; try { MbEvent :: callEvents ( $ this , MbEvent :: BEFORE_PAGE , $ mbPage ) ; $ this -> getMbAssets ( ) -> runAssets ( 'plugin' ) ; $ mbPage -> getMbAsset ( ) -> runAssets ( $ this -> page ) ; $ this -> runCurrentPage ( $ mbPage ) ; MbEvent :: callEvents ( $ this , MbEvent :: AFTER_PAGE , $ mbPage ) ; } catch ( \ Exception $ e ) { MbEvent :: callEvents ( $ this , MbEvent :: EXCEPTION_PAGE , $ e ) ; throw $ e ; } finally { MbEvent :: callEvents ( $ this , MbEvent :: FINISH_PAGE , $ mbPage ) ; } } } MbEvent :: callEvents ( $ this , MbEvent :: FINISH_WORDPRESS , $ this ) ; } | Initialize the processing of the plugin and its resources . |
17,802 | private function runHookCurrentAction ( ) { if ( ! $ this -> getMbRequest ( ) -> isMocaBonitaPage ( ) || $ this -> getMbRequest ( ) -> isBlogAdmin ( ) ) { return false ; } if ( $ this -> mbRequest -> isLogged ( ) ) { if ( $ this -> mbRequest -> isAjax ( ) ) { $ actionHook = "wp_ajax_{$this->getAction()}" ; } else { $ actionHook = "admin_post_{$this->getAction()}" ; } } else { if ( $ this -> mbRequest -> isAjax ( ) ) { $ actionHook = "wp_ajax_nopriv_{$this->getAction()}" ; } else { $ actionHook = "admin_post_nopriv_{$this->getAction()}" ; } } MbWPActionHook :: addAction ( $ actionHook , $ this , 'sendContent' ) ; return true ; } | Add Wordpress Hook for current action if needed |
17,803 | protected function isMocabonitaPage ( ) { if ( is_null ( $ this -> page ) ) { $ this -> getMbRequest ( ) -> setMocaBonitaPage ( false ) ; return false ; } if ( is_null ( $ this -> getMbRequest ( ) -> isMocaBonitaPage ( ) ) ) { $ this -> getMbRequest ( ) -> setMocaBonitaPage ( $ this -> mbPages -> has ( $ this -> page ) ) ; } return $ this -> getMbRequest ( ) -> isMocaBonitaPage ( ) ; } | Check if the current page is a Mocabonita page |
17,804 | public function getMbPage ( $ slugPage ) { if ( ! $ this -> mbPages -> has ( $ slugPage ) ) { throw new MbException ( "The page {$slugPage} has not been added to MocaBonita's list of pages!" ) ; } return $ this -> mbPages -> get ( $ slugPage ) ; } | Get MbPage of slug |
17,805 | public function getMbShortcode ( $ shortcodeName ) { if ( ! $ this -> mbShortCodes -> has ( $ shortcodeName ) ) { throw new MbException ( "The shortcode {$shortcodeName} has not been added to the MocaBonita shortcode list!" ) ; } return $ this -> mbShortCodes -> get ( $ shortcodeName ) ; } | Get MbShortcode of name |
17,806 | public function addMbPageStructure ( $ pageName , MbPageStructure $ mbPageStructure ) { $ mbPageStructure -> setMbPage ( MbPage :: create ( $ pageName ) ) ; $ mbPageStructure -> enablePage ( ) ; $ mbPageStructure -> execute ( $ this -> getMbRequest ( ) , $ this -> getMbResponse ( ) , $ this ) ; } | Add page structure |
17,807 | public function addMbPage ( MbPage $ mbPage ) { $ mbPage -> setSubMenu ( false ) ; $ mbPage -> setMainMenu ( true ) ; $ this -> mbPages -> put ( $ mbPage -> getSlug ( ) , $ mbPage ) ; foreach ( $ mbPage -> getSubPages ( ) as $ subPage ) { $ this -> addSubMbPage ( $ subPage ) ; $ subPage -> setParentPage ( $ mbPage ) ; } return $ this ; } | Add a MbPage to MocaBonita as main menu |
17,808 | public function addSubMbPage ( MbPage $ mbPage ) { $ mbPage -> setMainMenu ( false ) ; $ mbPage -> setSubMenu ( true ) ; $ this -> mbPages -> put ( $ mbPage -> getSlug ( ) , $ mbPage ) ; return $ this ; } | Add a MbPage to MocaBonita as submenu |
17,809 | public static function buildUniquePath ( $ path , $ languageCode ) { $ count = self :: query ( ) -> where ( 'language_code' , $ languageCode ) -> whereRaw ( "path ~ '^$path($|-[0-9]+$)'" ) -> count ( ) ; return ( $ count ) ? $ path . '-' . $ count : $ path ; } | Function returns an unique path address from given path in specific language |
17,810 | protected function startEventsPlugin ( $ app ) { $ this -> onRegister ( 'events' , function ( $ app ) { $ events = $ this -> app -> make ( Dispatcher :: class ) ; foreach ( $ this -> events ( ) as $ event => $ listeners ) { foreach ( $ listeners as $ listener ) { $ events -> listen ( $ event , $ listener ) ; } } foreach ( $ this -> listens ( ) as $ event => $ listeners ) { foreach ( $ listeners as $ listener ) { $ events -> listen ( $ event , $ listener ) ; } } foreach ( $ this -> subscribe as $ subscriber ) { $ events -> subscribe ( $ subscriber ) ; } } ) ; } | startEventsPlugin method . |
17,811 | protected function on ( $ events , $ handler ) { $ dispatcher = $ this -> app -> make ( 'events' ) ; $ dispatcher -> listen ( $ events , $ handler ) ; } | on method . |
17,812 | public static function getConstNameByValue ( $ class , $ value ) { $ constants = static :: getReflection ( $ class ) -> getConstants ( ) ; $ result = array_search ( $ value , $ constants ) ; return $ result ; } | Returns class const name by its value . |
17,813 | protected static function getReflection ( $ class ) { if ( ! isset ( self :: $ reflections [ $ class ] ) ) { self :: $ reflections [ $ class ] = new ReflectionClass ( $ class ) ; } $ result = self :: $ reflections [ $ class ] ; return $ result ; } | Returns reflection by class name . |
17,814 | protected function execute ( $ command ) { $ status = null ; $ result = array ( ) ; exec ( $ command , $ result , $ status ) ; return ! $ status ? $ result : null ; } | Executes a shell command . |
17,815 | public function buildQueryBuilder ( ) { $ builder = new QueryBuilder ( ) ; foreach ( $ this -> parsers as $ parser ) { if ( $ parser -> wasApplied ( ) ) { $ parser -> apply ( $ builder ) ; } } foreach ( $ this -> sorts as $ sort ) { $ builder -> orderBy ( $ sort [ 0 ] , $ sort [ 1 ] ) ; } if ( ! empty ( $ this -> perPage ) ) { $ builder -> setPageSize ( $ this -> perPage ) ; } if ( ! empty ( $ this -> page ) ) { $ builder -> setPage ( $ this -> page ) ; } if ( ! empty ( $ this -> searchQuery ) ) { $ builder -> setSearchQuery ( $ this -> searchQuery ) ; } return $ builder ; } | Builds QueryBuilder instance based on parsed filters & sorts |
17,816 | public function reset ( ) { $ this -> page = 1 ; $ this -> perPage = null ; $ this -> parsers = [ ] ; $ this -> sorts = [ ] ; $ this -> searchQuery = null ; $ this -> rules = [ 'page' => 'numeric' , 'per_page' => 'numeric' , 'sort' => 'string' , 'q' => 'string' , ] ; } | Resets processor params to default values |
17,817 | public function resolve ( TemplateInterface $ template , InputDescriptor $ input , MediaType $ mediaType ) { foreach ( $ this -> workers as $ worker ) { if ( $ worker -> accept ( $ template , $ input , $ mediaType ) ) { return $ worker ; } } return null ; } | Determine and return worker . |
17,818 | public function setTableName ( $ tableName ) { if ( trim ( $ tableName ) == '' ) { $ tableName = null ; } $ this -> tableName = $ tableName ; return $ this ; } | Set table name . |
17,819 | public function setSchemaName ( $ schemaName ) { if ( trim ( $ schemaName ) == '' ) { $ schemaName = null ; } $ this -> schemaName = $ schemaName ; return $ this ; } | Set schema name . |
17,820 | protected function doneProcess ( $ routeName , $ routePattern , $ regex ) { $ this -> regex [ $ routeName ] = $ regex ; $ this -> modified = true ; $ this -> debug ( Message :: get ( Message :: RTE_PARSER_PATTERN , $ routePattern , $ regex ) ) ; } | Update regex pool etc . |
17,821 | public function registerInstance ( $ object ) { if ( ! is_object ( $ object ) ) { throw new \ InvalidArgumentException ( 'registerInstance(): Cannot pass primitive types, can only register an object instance; use registerVariable() instead' ) ; } $ reflectionObject = new \ ReflectionObject ( $ object ) ; $ className = $ reflectionObject -> getName ( ) ; $ this -> instances [ $ className ] = $ object ; $ determineParent = function ( \ ReflectionClass $ class ) use ( $ className , & $ determineParent ) { $ parentClass = $ class -> getParentClass ( ) ; if ( ! empty ( $ parentClass ) ) { $ this -> weakLinks [ $ parentClass -> getName ( ) ] = $ className ; $ determineParent ( $ parentClass ) ; } } ; $ determineParent ( $ reflectionObject ) ; } | Registers an object instance to the context . If an instance with the same type is already registered this will override it . |
17,822 | public function registerVariable ( $ name , $ value ) { if ( is_object ( $ value ) ) { throw new \ InvalidArgumentException ( 'registerVariable(): Cannot pass objects, can only register primitive types; use registerInstance() instead' ) ; } $ this -> variablesByName [ $ name ] = $ value ; } | Registers a primitive variable type by its name to the context . If a variable with the same name is already registered this will override it . |
17,823 | private function getReflectionParameters ( callable $ callable ) { $ reflectionParams = [ ] ; if ( is_array ( $ callable ) ) { $ reflector = new \ ReflectionMethod ( $ callable [ 0 ] , $ callable [ 1 ] ) ; $ reflectionParams = $ reflector -> getParameters ( ) ; } else if ( is_string ( $ callable ) ) { $ reflector = new \ ReflectionFunction ( $ callable ) ; $ reflectionParams = $ reflector -> getParameters ( ) ; } else if ( is_a ( $ callable , 'Closure' ) || is_callable ( $ callable , '__invoke' ) ) { $ reflector = new \ ReflectionObject ( $ callable ) ; $ reflectionParams = $ reflector -> getMethod ( '__invoke' ) -> getParameters ( ) ; } return $ reflectionParams ; } | Given a callable function attempts to determine the reflection parameters . |
17,824 | public function determineParamValues ( callable $ callable ) { $ reflectionParams = $ this -> getReflectionParameters ( $ callable ) ; $ paramList = [ ] ; foreach ( $ reflectionParams as $ reflectionParam ) { $ paramList [ ] = $ this -> determineParamValue ( $ reflectionParam ) ; } return $ paramList ; } | Given a callable function and the current context attempt to determine the appropriate list of parameters to pass to the function when it is called . |
17,825 | public function determineParamValuesForConstructor ( $ className ) { $ reflection = new \ ReflectionClass ( $ className ) ; $ instance = $ reflection -> newInstanceWithoutConstructor ( ) ; $ callable = [ $ instance , '__construct' ] ; if ( ! is_callable ( $ callable ) ) { return [ ] ; } return $ this -> determineParamValues ( $ callable ) ; } | Given a class and the current context attempt to determine the appropriate list of parameters to pass to the constructor when it is called . |
17,826 | private function determineParamValue ( \ ReflectionParameter $ parameter ) { $ class = $ parameter -> getClass ( ) ; if ( ! empty ( $ class ) ) { $ className = $ class -> getName ( ) ; if ( isset ( $ this -> instances [ $ className ] ) ) { return $ this -> instances [ $ className ] ; } if ( isset ( $ this -> weakLinks [ $ className ] ) ) { $ lowerClassName = $ this -> weakLinks [ $ className ] ; return $ this -> instances [ $ lowerClassName ] ; } } else { $ varName = $ parameter -> getName ( ) ; if ( isset ( $ this -> variablesByName [ $ varName ] ) ) { return $ this -> variablesByName [ $ varName ] ; } } if ( $ parameter -> isDefaultValueAvailable ( ) ) { return $ parameter -> getDefaultValue ( ) ; } return null ; } | Based on the current context attempts to determine an appropriate value for a given parameter . |
17,827 | public function imageAction ( Request $ request ) { $ params = $ request -> request -> all ( ) ; unset ( $ params [ 'module' ] ) ; unset ( $ params [ 'controller' ] ) ; unset ( $ params [ 'action' ] ) ; if ( empty ( $ params [ 'width' ] ) ) { $ params [ 'width' ] = 100 ; } if ( empty ( $ params [ 'height' ] ) ) { $ params [ 'height' ] = 100 ; } if ( empty ( $ params [ 'xmethod' ] ) ) { $ params [ 'xmethod' ] = 'fit' ; } $ previewer = $ this -> get ( 'phlexible_media_template.previewer.image' ) ; $ locator = $ this -> get ( 'file_locator' ) ; $ previewImage = 'test_1000_600.jpg' ; if ( isset ( $ params [ 'preview_image' ] ) ) { $ previewImage = $ params [ 'preview_image' ] ; unset ( $ params [ 'preview_image' ] ) ; if ( $ previewImage === '800_600' ) { $ previewImage = "test_$previewImage.png" ; } else { $ previewImage = "test_$previewImage.jpg" ; } } $ filePath = $ locator -> locate ( "@PhlexibleMediaTemplateBundle/Resources/public/images/$previewImage" , null , true ) ; $ data = $ previewer -> create ( $ filePath , $ params ) ; return new ResultResponse ( true , 'Preview created' , $ data ) ; } | List Image Mediatemplates . |
17,828 | public function massAction ( $ name ) { $ dataGrid = $ this -> getDataGrid ( $ name ) ; $ action = $ this -> getRequest ( ) -> get ( 'action' ) ; if ( ! $ action ) { throw new \ InvalidArgumentException ( 'Parameter "action" in not valid' ) ; } $ handler = $ this -> container -> get ( 'neutron_data_grid.handler.datagrid' ) ; $ handler -> setDataGrid ( $ dataGrid ) -> resolveOptions ( $ this -> getRequestParameters ( ) ) -> buildQuery ( ) ; $ ids = $ this -> getRequest ( ) -> get ( 'ids' , array ( ) ) ; $ selectAll = ( $ this -> getRequest ( ) -> get ( 'selectAll' ) === 'true' ) ; $ event = new MassActionEvent ( $ name , $ action , $ ids , $ selectAll , $ handler -> getQuery ( ) ) ; $ this -> container -> get ( 'event_dispatcher' ) -> dispatch ( DataGridEvents :: onMassAction , $ event ) ; return new JsonResponse ( $ event -> getExtraData ( ) ) ; } | This action handles mass actions |
17,829 | public function rowAction ( $ name ) { $ oper = $ this -> getRequest ( ) -> get ( 'oper' , false ) ; if ( ! in_array ( $ oper , array ( 'add' , 'edit' , 'del' ) ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Event type: %s is not valid' , $ oper ) ) ; } $ eventType = 'neutron_datagrid.onRow' . ucfirst ( $ oper ) ; $ event = new RowEvent ( $ name , $ this -> getRequest ( ) -> get ( 'id' ) ) ; $ this -> container -> get ( 'event_dispatcher' ) -> dispatch ( $ eventType , $ event ) ; return new JsonResponse ( array ( 'errors' => $ event -> getErrors ( ) , 'success' => $ event -> getSuccess ( ) , 'id' => $ event -> getId ( ) , 'data' => $ event -> getData ( ) ) ) ; } | This action handles manipulating of record |
17,830 | public function getDataGrid ( $ name ) { if ( ! $ this -> getRequest ( ) -> isXmlHttpRequest ( ) ) { throw new \ RuntimeException ( 'Request must be XmlHttpRequest' ) ; } $ provider = $ this -> container -> get ( 'neutron_data_grid.provider' ) ; if ( ! $ provider -> has ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The datagrid %s is not defined' , $ name ) ) ; } return $ provider -> get ( $ name ) ; } | This method retrieves datagrid by name |
17,831 | private function getConfigDB ( ConfigInterface $ config ) : ConfigInterface { $ connection = $ this -> getConnection ( ) ; $ config_db = $ config -> get ( $ connection ) ; try { if ( null === $ config_db ) { throw new Exception ( "Connection \"$connection\" is not found in database config" ) ; } } catch ( Exception $ e ) { } return $ config_db ; } | Extract configuration of current database |
17,832 | private function classToShake ( ) : string { $ className = \ get_class ( $ this ) ; $ classArray = explode ( '\\' , $ className ) ; $ class = end ( $ classArray ) ; try { $ class = Stringy :: create ( $ class ) -> underscored ( ) ; } catch ( \ InvalidArgumentException $ e ) { new Exception ( 'Invalid argument provided' ) ; } return $ class ; } | Convert class name for snake case |
17,833 | public function actionIndex ( ) { $ searchModel = new \ yongtiger \ admin \ models \ searchs \ Log ( ) ; $ dataProvider = $ searchModel -> search ( Yii :: $ app -> request -> queryParams ) ; return $ this -> render ( 'index' , [ 'searchModel' => $ searchModel , 'dataProvider' => $ dataProvider , ] ) ; } | Lists all Log models . |
17,834 | public function actionCreate ( ) { $ model = new \ yongtiger \ admin \ models \ Log ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Yii :: $ app -> session -> setFlash ( 'success' , Module :: t ( 'message' , 'Successfully created.' ) ) ; return $ this -> redirect ( [ 'view' , 'id' => $ model -> id ] ) ; } else { return $ this -> render ( 'create' , [ 'model' => $ model , ] ) ; } } | Creates a new Log model . If creation is successful the browser will be redirected to the view page . |
17,835 | public function actionDelete ( $ id ) { $ ret = $ this -> findModel ( $ id ) -> delete ( ) ; if ( $ ret === false ) { Yii :: $ app -> session -> setFlash ( 'error' , Module :: t ( 'message' , 'Failed to delete!' ) . ' (ID = ' . $ id . ')' ) ; } else { Yii :: $ app -> session -> setFlash ( 'success' , Module :: t ( 'message' , 'Successfully deleted.' ) . ' (ID = ' . $ id . ')' ) ; } return $ this -> redirect ( [ 'index' ] ) ; } | Deletes an existing Log model . If deletion is successful the browser will be redirected to the index page . |
17,836 | public function actionDeleteIn ( ) { $ selected = Yii :: $ app -> request -> post ( 'selected' , [ ] ) ; $ ret = \ yongtiger \ admin \ models \ Log :: deleteAll ( [ 'id' => explode ( ',' , $ selected ) ] ) ; $ str = $ ret > 0 ? ' (IDs [' . $ selected . '])' : '' ; Yii :: $ app -> session -> setFlash ( 'info' , Module :: t ( 'message' , 'Deleted {0} logs.' , $ ret ) . $ str ) ; return $ this -> redirect ( [ 'index' ] ) ; } | Deletes selected in post . If deletion is successful the browser will be redirected to the index page . |
17,837 | protected function findModel ( $ id ) { if ( ( $ model = \ yongtiger \ admin \ models \ Log :: findOne ( $ id ) ) !== null ) { return $ model ; } else { throw new NotFoundHttpException ( 'The requested page does not exist.' ) ; } } | Finds the Log model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . |
17,838 | private function displaySuccess ( Request $ request , Response $ response ) { $ data = $ response -> getContent ( ) ; if ( $ data == null ) { $ data = array ( ) ; } $ controllerName = str_replace ( '\\' , '/' , $ request -> getConfig ( ) -> getValue ( 'class' ) ) ; $ methodName = $ request -> getConfig ( ) -> getValue ( 'method' ) ; echo $ this -> twig -> render ( $ controllerName . '/' . $ methodName . '.twig' , $ data ) ; } | Support status code 2XX . |
17,839 | private function displayError ( Request $ request , Response $ response ) { $ exception = $ response -> getContent ( ) ; $ data = array ( 'statusCode' => $ response -> getStatusCode ( ) , 'message' => $ exception -> getMessage ( ) , 'exception' => get_class ( $ exception ) , 'file' => $ exception -> getFile ( ) , 'line' => $ exception -> getLine ( ) ) ; if ( $ this -> environment -> isDebug ( ) ) { echo $ this -> twig -> render ( 'error.twig' , $ data ) ; } else { echo $ this -> twig -> render ( $ response -> getStatusCode ( ) . '.twig' ) ; } } | Support status code 4XX - 5XX . |
17,840 | public function applyConclusiveMatch ( $ userAgent ) { $ deviceId = WURFL_Constants :: GENERIC ; if ( WURFL_Handlers_Utils :: checkIfStartsWith ( $ userAgent , 'Mozilla' ) ) { $ deviceId = $ this -> applyMozillaConclusiveMatch ( $ userAgent ) ; } else { $ tolerance = WURFL_Handlers_Utils :: firstSlash ( $ userAgent ) ; $ deviceId = $ this -> getDeviceIDFromRIS ( $ userAgent , $ tolerance ) ; } return $ deviceId ; } | If UA starts with Mozilla apply LD with tollerance 5 . If UA does not start with Mozilla apply RIS on FS |
17,841 | public function user_templateLayout ( array & $ config ) { $ pageId = 0 ; $ currentColPos = $ config [ 'flexParentDatabaseRow' ] [ 'colPos' ] ; $ pageId = $ this -> getPageId ( $ config [ 'flexParentDatabaseRow' ] [ 'pid' ] ) ; if ( $ pageId > 0 ) { $ templateLayouts = $ this -> templateLayoutsUtility -> getAvailableTemplateLayouts ( $ pageId ) ; $ templateLayouts = $ this -> reduceTemplateLayouts ( $ templateLayouts , $ currentColPos ) ; foreach ( $ templateLayouts as $ layout ) { $ additionalLayout = [ htmlspecialchars ( $ this -> getLanguageService ( ) -> sL ( $ layout [ 0 ] ) ) , $ layout [ 1 ] ] ; array_push ( $ config [ 'items' ] , $ additionalLayout ) ; } } } | Itemsproc function to extend the selection of templateLayouts in the plugin |
17,842 | protected function reduceTemplateLayouts ( $ templateLayouts , $ currentColPos ) { $ currentColPos = ( int ) $ currentColPos ; $ restrictions = [ ] ; $ allLayouts = [ ] ; foreach ( $ templateLayouts as $ key => $ layout ) { if ( is_array ( $ layout [ 0 ] ) ) { if ( isset ( $ layout [ 0 ] [ 'allowedColPos' ] ) && StringUtility :: endsWith ( $ layout [ 1 ] , '.' ) ) { $ layoutKey = substr ( $ layout [ 1 ] , 0 , - 1 ) ; $ restrictions [ $ layoutKey ] = GeneralUtility :: intExplode ( ',' , $ layout [ 0 ] [ 'allowedColPos' ] , true ) ; } } else { $ allLayouts [ $ key ] = $ layout ; } } if ( ! empty ( $ restrictions ) ) { foreach ( $ restrictions as $ restrictedIdentifier => $ restrictedColPosList ) { if ( ! in_array ( $ currentColPos , $ restrictedColPosList , true ) ) { unset ( $ allLayouts [ $ restrictedIdentifier ] ) ; } } } return $ allLayouts ; } | Reduce the template layouts by the ones that are not allowed in given colPos |
17,843 | protected function getPageId ( $ pid ) { $ pid = ( int ) $ pid ; if ( $ pid > 0 ) { return $ pid ; } $ row = BackendUtilityCore :: getRecord ( 'tt_content' , abs ( $ pid ) , 'uid,pid' ) ; return $ row [ 'pid' ] ; } | Get page id if negative then it is a after record |
17,844 | public function resolution ( $ width = null , $ height = null ) { return [ 'width' => $ width ? : $ this -> widths [ array_rand ( $ this -> widths ) ] , 'height' => $ height ? : $ this -> heights [ array_rand ( $ this -> heights ) ] ] ; } | Resolve resolution . |
17,845 | public function output ( ) : void { header ( 'HTTP/1.1 ' . $ this -> getStatusCode ( ) ) ; foreach ( $ this -> getHeaders ( ) as $ headerName => $ headerValue ) { header ( $ headerName . ': ' . $ headerValue ) ; } foreach ( $ this -> getCookies ( ) as $ cookieName => $ cookie ) { setcookie ( $ cookieName , $ cookie -> getValue ( ) , $ cookie -> getExpiry ( ) !== null ? $ cookie -> getExpiry ( ) -> getTimestamp ( ) : 0 , $ cookie -> getPath ( ) !== null ? $ cookie -> getPath ( ) -> __toString ( ) : '' , $ cookie -> getDomain ( ) !== null ? $ cookie -> getDomain ( ) -> __toString ( ) : '' , $ cookie -> isSecure ( ) , $ cookie -> isHttpOnly ( ) ) ; } echo $ this -> getContent ( ) ; } | Outputs the content . |
17,846 | public function getPreProcessedCode ( ) : string { $ code = $ this -> getCode ( ) ; $ filePath = $ this -> getFilePath ( ) ; $ code = str_replace ( '__FILE__' , "'" . $ filePath . "'" , $ code ) ; $ code = str_replace ( '__DIR__' , "'" . dirname ( $ filePath ) . "'" , $ code ) ; $ code = preg_replace ( '/([^\w:])(__CLASS__)\(/' , '$1' . $ this -> getClassName ( ) . '(' , $ code ) ; $ code = str_replace ( '__CLASS__' , "'" . $ this -> getClassName ( ) . "'" , $ code ) ; $ code = preg_replace ( '/^(assert)\(/' , 'test_flight_assert(' , $ code ) ; $ code = preg_replace ( '/([^\w:])(assert)\(/' , '$1test_flight_assert(' , $ code ) ; return $ code ; } | Returns the pre - processed code |
17,847 | static function checkRequiredParametersAreSet ( array $ given , array $ required ) { foreach ( $ required as $ key ) { if ( empty ( $ given [ $ key ] ) ) { throw new MissingRequiredParameterException ( "Missing required parameter '$key'" ) ; } } } | Validates if all required parameters are set . |
17,848 | static function checkAnyRequiredParameter ( array $ given , array $ required ) { try { foreach ( $ required as $ key ) { if ( ! empty ( $ given [ $ key ] ) ) { throw new RequiredParameterFound ( ) ; } } $ parameters = implode ( ', ' , $ required ) ; throw new MissingRequiredParameterException ( "At least one parameter required: $parameters" ) ; } catch ( RequiredParameterFound $ ex ) { } } | Validates if any required parameters are set and not empty . |
17,849 | static function checkRequiredParameters ( array $ given , array $ required ) { foreach ( $ required as $ key ) { if ( ! array_key_exists ( $ key , $ given ) ) { throw new MissingRequiredParameterException ( "Missing required parameter '$key'" ) ; } } } | Validates if all required parameters are present . |
17,850 | function get ( $ route , callable $ controller ) { if ( $ this -> request -> requestMethod ( ) == 'get' ) { $ this -> any ( $ route , $ controller ) ; } } | HTTP 1 . 1 GET method |
17,851 | function post ( $ route , callable $ controller ) { if ( $ this -> request -> requestMethod ( ) == 'post' ) { $ this -> any ( $ route , $ controller ) ; } } | HTTP 1 . 1 POST method |
17,852 | public function save ( array $ data ) { if ( ! $ this -> getModel ( ) -> isSingle ( ) ) { $ id = $ data [ 'id' ] ?? $ this -> id ; $ this -> id = $ id ; } $ columns = $ this -> data ; foreach ( $ columns as $ key => $ column ) { if ( array_key_exists ( $ key , $ data ) ) { $ column -> setValue ( $ data [ $ key ] ) ; } else { $ column -> setValue ( null ) ; } } $ yaml = Yaml :: dump ( $ this -> getData ( ) , 5 , 4 , YAML :: DUMP_MULTI_LINE_LITERAL_BLOCK | YAML :: DUMP_OBJECT_AS_MAP ) ; $ fs = new Filesystem ( ) ; $ fs -> dumpFile ( $ this -> getContentFilePath ( ) , $ yaml ) ; } | Validates and saves record to disk . |
17,853 | public function getValue ( string $ column ) { if ( $ column === 'id' ) return $ this -> id ; return $ this -> data [ $ column ] -> getValue ( ) ; } | Returns the value of a column . |
17,854 | protected function complete ( $ return , MvcEvent $ event ) { if ( ! is_object ( $ return ) ) { if ( ArrayUtils :: hasStringKeys ( $ return ) ) { $ return = new ArrayObject ( $ return , ArrayObject :: ARRAY_AS_PROPS ) ; } } $ event -> setResult ( $ return ) ; return $ return ; } | Complete the dispatch |
17,855 | public function translate ( string $ key , array $ data = [ ] ) : string { if ( ! array_key_exists ( $ key , $ this -> texts ) ) { return '{{' . $ key . '}}' ; } if ( empty ( $ data ) ) { return $ this -> texts [ $ key ] ; } return call_user_func_array ( 'sprintf' , array_merge ( [ $ this -> texts [ $ key ] ] , $ data ) ) ; } | Gets the translation by key if any or a placeholder otherwise |
17,856 | public function save ( ) { $ dir = dirname ( $ this -> path ) ; if ( ! is_dir ( $ dir ) ) { $ mask = @ umask ( 0 ) ; $ result = @ mkdir ( $ dir , $ this -> dirMode , true ) ; @ umask ( $ mask ) ; if ( ! $ result ) { throw new Exception ( "Unable to create the directory '$dir'." ) ; } } if ( @ file_put_contents ( $ this -> path , $ this -> content ) === false ) { throw new Exception ( "Unable to write the file '{$this->path}'." ) ; } $ mask = @ umask ( 0 ) ; @ chmod ( $ this -> path , $ this -> mode ) ; @ umask ( $ mask ) ; return true ; } | Saves this file . |
17,857 | public function resolveExtension ( ) { if ( ( $ pos = strrpos ( $ this -> path , '.' ) ) !== false ) { return substr ( $ this -> path , $ pos + 1 ) ; } return '' ; } | Returns the extension for this file . |
17,858 | public function setStartTimezone ( $ timezone = 'UTC' ) { $ this -> start -> setTimezone ( is_string ( $ timezone ) ? new \ DateTimeZone ( $ timezone ) : $ timezone ) ; return $ this ; } | Sets the start date timezone |
17,859 | public function setEndTimezone ( $ timezone = 'UTC' ) { $ this -> end -> setTimezone ( is_string ( $ timezone ) ? new \ DateTimeZone ( $ timezone ) : $ timezone ) ; return $ this ; } | Sets the end date timezone |
17,860 | protected function loadItems ( ) { $ items = $ this -> eventAccessObjectBackend -> loadObject ( ) ; if ( ! is_array ( $ items ) ) { $ items = array ( ) ; } $ this -> items = $ items ; } | Loads the items from the object backend |
17,861 | public function addItem ( $ eventName , $ accessLevel ) { if ( ! isset ( $ this -> items [ $ eventName ] ) ) { $ this -> items [ $ eventName ] = array ( ) ; } if ( in_array ( $ accessLevel , $ this -> items [ $ eventName ] ) ) { return ; } $ this -> items [ $ eventName ] [ ] = $ accessLevel ; $ this -> saveItems ( ) ; } | Adds the access levels for the event name |
17,862 | public function removeItems ( $ eventName ) { if ( ! isset ( $ this -> items [ $ eventName ] ) ) { return false ; } unset ( $ this -> items [ $ eventName ] ) ; $ this -> saveItems ( ) ; } | Removes all access levels for the given event name . |
17,863 | public function getAccessLevelsForEvent ( $ eventName ) { if ( ! isset ( $ this -> items [ $ eventName ] ) ) { return false ; } return $ this -> items [ $ eventName ] ; } | Returns the access levels for the given event name or false if the event name is not set . |
17,864 | public function getByName ( $ name , $ throwException = true ) { foreach ( $ this as $ element ) { if ( ! $ element instanceof Element \ NamedElement ) { throw new Exception \ CollectionException ( ) ; } if ( $ element -> getName ( ) === $ name ) { return $ element ; } } if ( $ throwException ) { throw new Exception \ NotFoundException ( ) ; } return null ; } | Get element by name |
17,865 | public static function Apio13 ( $ utc1 , $ utc2 , $ dut1 , $ elong , $ phi , $ hm , $ xp , $ yp , $ phpa , $ tc , $ rh , $ wl , iauASTROM & $ astrom ) { $ j ; $ tai1 ; $ tai2 ; $ tt1 ; $ tt2 ; $ ut11 ; $ ut12 ; $ sp ; $ theta ; $ refa ; $ refb ; $ j = IAU :: Utctai ( $ utc1 , $ utc2 , $ tai1 , $ tai2 ) ; if ( $ j < 0 ) return - 1 ; $ j = IAU :: Taitt ( $ tai1 , $ tai2 , $ tt1 , $ tt2 ) ; $ j = IAU :: Utcut1 ( $ utc1 , $ utc2 , $ dut1 , $ ut11 , $ ut12 ) ; if ( $ j < 0 ) return - 1 ; $ sp = IAU :: Sp00 ( $ tt1 , $ tt2 ) ; $ theta = IAU :: Era00 ( $ ut11 , $ ut12 ) ; IAU :: Refco ( $ phpa , $ tc , $ rh , $ wl , $ refa , $ refb ) ; IAU :: Apio ( $ sp , $ theta , $ elong , $ phi , $ hm , $ xp , $ yp , $ refa , $ refb , $ astrom ) ; return $ j ; } | - - - - - - - - - - i a u A p i o 1 3 - - - - - - - - - - |
17,866 | public function before_update ( Orm \ Model $ obj ) { $ relation_changed = false ; foreach ( $ this -> _relations as $ relation ) { if ( $ this -> relation_changed ( $ obj , $ relation ) ) { $ relation_changed = true ; break ; } } if ( ( $ obj -> is_changed ( ) or $ relation_changed ) and $ user_id = \ Auth :: get_user_id ( ) ) { $ obj -> { $ this -> _property } = $ user_id [ 1 ] ; } } | Sets the UpdatedBy property to the current user id |
17,867 | public function view ( $ view = null , $ layout = null ) { $ layoutOptions = $ this -> getLayoutOptions ( $ layout ) ; viewResolver ( ) -> setUp ( $ layoutOptions , $ view ) ; $ this -> setupLayout ( ) ; } | Find the view for the called method . |
17,868 | protected function getLayoutOptions ( $ layout ) { if ( ! is_null ( $ layout ) ) { return [ 'default' => $ layout , 'ajax' => $ layout , ] ; } if ( isset ( $ this -> layoutOptions ) ) { return $ this -> layoutOptions ; } return null ; } | Get an array of layout options if available . |
17,869 | public function getProviders ( ) { $ providers = Arr :: get ( $ this -> getGeneral ( ) , 'providers' , [ ] ) ; $ routeId = array_search ( RouteProvider :: class , $ providers ) ; unset ( $ providers [ $ routeId ] ) ; return array_merge ( $ this -> constructors , $ providers ) ; } | Return the providers without routing |
17,870 | public static function formatSpan ( $ timespan , $ format = '%Y years %M Months %D days %I Minutes %S seconds %H hours %n milliseconds' ) { $ dv = Time :: getDateInterval ( $ timespan ) ; return $ dv -> format ( $ format ) ; } | Formatiert eine Zeitspanne in Sekunden in einen String |
17,871 | public function loadClassMetadata ( LoadClassMetadataEventArgs $ eventArgs ) { $ metadata = $ eventArgs -> getClassMetadata ( ) ; if ( $ metadata -> getName ( ) === self :: ROOT_CHARACTERISTICS_CLASS ) { $ metadata -> setDiscriminatorMap ( $ this -> characteristicsClassesMap ) ; } } | Sets the discriminator maps on AbstractCharacteristics entity mappings . |
17,872 | public function getLinkType ( ) { $ types = $ this -> config ( ) -> get ( 'types' ) ; return isset ( $ types [ $ this -> Type ] ) ? _t ( 'Links.TYPE' . strtoupper ( $ this -> Type ) , $ types [ $ this -> Type ] ) : null ; } | Gets the description label of this links type |
17,873 | public function get ( $ cle , $ errorIfNotExists = false ) { if ( is_null ( $ this -> values ) ) { return null ; } else if ( array_key_exists ( $ cle , $ this -> values ) ) { return $ this -> values [ $ cle ] ; } else { if ( $ errorIfNotExists ) { throw new \ Exception ( 'La clé '. $ c le. ' n\'existe pas dans le fichier '. $ t his- >p ath) ;
} else { return null ; } } } | Lit une valeur |
17,874 | public function setNamespace ( string $ namespace ) : void { $ storage = $ this -> getStorage ( ) ; if ( $ storage instanceof UserStorage ) { $ storage -> setNamespace ( $ namespace ) ; } $ this -> initIdentity ( ) ; } | Nastavi namespace pro autentizaci |
17,875 | public function isMobile ( bool $ tablet = true ) : bool { $ session = $ this -> session -> getSection ( 'user' ) ; if ( $ tablet ) { return $ session -> isMobile ; } else { return $ session -> isMobile && ! $ session -> isTablet ; } } | Je klientsky prohlizec mobilni verze? |
17,876 | public function getUid ( ) : string { $ uid = $ this -> request -> getCookie ( self :: TRACKING_COOKIE ) ; if ( empty ( $ uid ) ) { $ charList = 'a-f0-9' ; $ uid = Random :: generate ( 8 , $ charList ) ; $ uid .= "-" . Random :: generate ( 4 , $ charList ) ; $ uid .= "-5" . Random :: generate ( 3 , $ charList ) ; $ uid .= "-" . Random :: generate ( 4 , $ charList ) ; $ uid .= "-" . Random :: generate ( 12 , $ charList ) ; $ this -> response -> setCookie ( self :: TRACKING_COOKIE , $ uid , self :: TRACKING_EXPIRE ) ; } return $ uid ; } | Vrati uzivatelske uid |
17,877 | public function addMedia ( Media $ media ) { $ this -> media [ ] = $ media ; $ media -> addGallery ( $ this ) ; return $ this ; } | Add media to gallery |
17,878 | public function match ( Expression $ expr ) { return $ expr -> evaluate ( array ( self :: NAME => $ this -> name , self :: CLASS_NAME => $ this -> className , self :: DESCRIPTION => $ this -> description , ) ) ; } | Returns whether the installer matches the given expression . |
17,879 | protected function createPdo ( array $ config ) { $ dsn = $ this -> getHostDsn ( $ config ) ; $ userName = ( isset ( $ config [ 'username' ] ) ? $ config [ 'username' ] : null ) ; $ password = ( isset ( $ config [ 'password' ] ) ? $ config [ 'password' ] : null ) ; $ options = $ this -> getPdoOptions ( $ config ) ; return new PDO ( $ dsn , $ userName , $ password , $ options ) ; } | create a pdo instance |
17,880 | protected function initOptions ( PDO $ pdo ) { if ( isset ( $ this -> config [ 'timezone' ] ) ) { $ pdo -> prepare ( 'set time_zone="' . $ this -> config [ 'timezone' ] . '"' ) -> execute ( ) ; } if ( isset ( $ this -> config [ 'charset' ] ) ) { $ pdo -> prepare ( 'set names "' . $ this -> config [ 'charset' ] . '"' ) -> execute ( ) ; } if ( isset ( $ this -> config [ 'strict' ] ) && $ this -> config [ 'strict' ] ) { $ pdo -> prepare ( "set session sql_mode='STRICT_ALL_TABLES'" ) -> execute ( ) ; } return $ pdo ; } | init pdo connection options after instance |
17,881 | public function getPdo ( $ name ) { if ( ! isset ( $ this -> connections [ $ name ] ) ) { $ name = $ this -> defaultPdoName ; } if ( isset ( $ this -> pdoArray [ $ name ] ) ) { return $ this -> pdoArray [ $ name ] ; } $ pdo = $ this -> createPdo ( $ this -> connections [ $ name ] ) ; $ this -> pdoArray [ $ name ] = $ this -> initOptions ( $ pdo ) ; return $ this -> pdoArray [ $ name ] ; } | get pdo connection by name |
17,882 | public function usePdo ( $ name ) { if ( ! isset ( $ this -> connections [ $ name ] ) ) { $ name = $ this -> defaultPdoName ; } $ pdo = $ this -> getPdo ( $ name ) ; $ this -> setActivePdo ( $ pdo ) ; } | use pdo connection by name |
17,883 | public function disconnect ( $ name ) { if ( isset ( $ this -> pdoArray [ $ name ] ) ) { $ pdo = $ this -> pdoArray [ $ name ] ; if ( $ this -> activePdo == $ pdo ) { $ this -> activePdo = null ; } unset ( $ this -> pdoArray [ $ name ] ) ; } } | disconnect pdo by name |
17,884 | public function reconnect ( $ name ) { if ( isset ( $ this -> connections [ $ name ] ) ) { $ this -> disconnect ( $ name ) ; $ this -> usePdo ( $ name ) ; } } | reconnect pdo by name |
17,885 | public function handleEvent ( Event $ event , Queue $ queue ) { $ iterator = $ this -> getIterator ( $ event -> getConnection ( ) ) ; if ( ! $ iterator -> valid ( ) ) { $ queue -> ircQuit ( 'All specified alternate nicks are in use' ) ; return ; } if ( $ this -> recovery && $ this -> primaryNick === null ) { $ params = $ event -> getParams ( ) ; $ primaryNick = $ params [ 1 ] ; $ this -> logger -> debug ( "[AltNick] Saving '$primaryNick' as primary nick" ) ; $ this -> primaryNick = $ primaryNick ; } $ nick = $ iterator -> current ( ) ; $ iterator -> next ( ) ; $ this -> logger -> debug ( "[AltNick] Switching nick to '$nick'" ) ; $ queue -> ircNick ( $ nick ) ; } | Nick is in use pick another . |
17,886 | public function handleQuit ( UserEvent $ event , Queue $ queue ) { $ nick = $ event -> getNick ( ) ; if ( $ this -> primaryNick !== null && $ nick == $ this -> primaryNick ) { $ this -> logger -> debug ( "[AltNick] '$nick' disconnected, switching to primary nick" ) ; $ queue -> ircNick ( $ this -> primaryNick ) ; $ this -> primaryNick = null ; } } | Handle primary nick recovery . |
17,887 | public function set ( $ page = 'page' , $ limit = 10 , $ url = null ) { if ( is_null ( $ url ) ) { $ url = $ this -> page -> url ( ) ; } $ params = $ this -> page -> url ( 'params' , $ url ) ; $ this -> get = $ page ; $ this -> url = $ url ; $ this -> offset = 0 ; $ this -> limit = $ limit ; $ this -> total = 1 ; $ this -> current = 1 ; if ( isset ( $ params [ $ page ] ) ) { $ page = array_map ( 'intval' , explode ( 'of' , $ params [ $ page ] ) ) ; if ( ( $ current = array_shift ( $ page ) ) && $ current > 1 ) { $ this -> current = $ current ; $ this -> offset = ( $ current - 1 ) * $ this -> limit ; if ( ( $ total = array_shift ( $ page ) ) && $ current < $ total ) { $ this -> total = $ total ; return true ; } } } return false ; } | Check if we need a total count . There s no sense in querying the database if you don t have to . Plus you have to call this anyways to set things up . |
17,888 | public function html ( $ type = 'bootstrap' , array $ options = array ( ) ) { if ( $ type == 'links' && ! empty ( $ this -> links ) ) { $ this -> links = array_merge ( $ this -> links , $ options ) ; } elseif ( $ type == 'pager' && ! empty ( $ this -> pager ) ) { $ this -> pager = array_merge ( $ this -> pager , $ options ) ; } else { $ this -> links = array ( 'wrapper' => '<ul class="pagination">{{ value }}</ul>' , 'link' => '<li><a href="{{ url }}">{{ value }}</a></li>' , 'active' => '<li class="active"><span>{{ value }}</span></li>' , 'disabled' => '<li class="disabled"><span>{{ value }}</span></li>' , 'previous' => '«' , 'next' => '»' , 'dots' => '…' , ) ; $ this -> pager = array ( 'wrapper' => '<ul class="pager">{{ value }}</ul>' , 'previous' => '<li class="previous"><a href="{{ url }}">« {{ value }}</a></li>' , 'next' => '<li class="next"><a href="{{ url }}">{{ value }} »</a></li>' , ) ; switch ( $ type ) { case 'zurb_foundation' : $ this -> html ( 'links' , array ( 'active' => '<li class="current"><a href="">{{ value }}</a></li>' , 'disabled' => '<li class="unavailable"><a href="">{{ value }}</a></li>' , ) ) ; break ; case 'semantic_ui' : $ this -> html ( 'links' , array ( 'wrapper' => '<div class="ui pagination menu">{{ value }}</div>' , 'link' => '<a class="item" href="{{ url }}">{{ value }}</a>' , 'active' => '<div class="active item">{{ value }}</div>' , 'disabled' => '<div class="disabled item">{{ value }}</div>' , 'previous' => '<i class="left arrow icon"></i>' , 'next' => '<i class="right arrow icon"></i>' , ) ) ; break ; case 'materialize' : $ this -> html ( 'links' , array ( 'link' => '<li class="waves-effect"><a href="{{ url }}">{{ value }}</a></li>' , 'active' => '<li class="active"><a href="#!">{{ value }}</a></li>' , 'disabled' => '<li class="disabled"><a href="#!">{{ value }}</a></li>' , 'previous' => '<i class="material-icons">keyboard_arrow_left</i>' , 'next' => '<i class="material-icons">keyboard_arrow_right</i>' , ) ) ; break ; case 'uikit' : $ this -> html ( 'links' , array ( 'wrapper' => '<ul class="uk-pagination">{{ value }}</ul>' , 'active' => '<li class="uk-active"><span>{{ value }}</span></li>' , 'disabled' => '<li class="uk-disabled"><span>{{ value }}</span></li>' , 'previous' => '<i class="uk-icon-angle-double-left"></i>' , 'next' => '<i class="uk-icon-angle-double-right"></i>' , ) ) ; $ this -> html ( 'pager' , array ( 'wrapper' => '<ul class="uk-pagination">{{ value }}</ul>' , 'previous' => '<li class="uk-pagination-previous"><a href="{{ url }}"><i class="uk-icon-angle-double-left"></i> {{ value }}</a></li>' , 'next' => '<li class="uk-pagination-next"><a href="{{ url }}">{{ value }} <i class="uk-icon-angle-double-right"></i></a></li>' , ) ) ; break ; } } } | Customize the pagination and pager links . |
17,889 | public function setWithExpire ( $ key , $ value , $ expire ) { if ( setcookie ( $ key , $ value , time ( ) + $ expire , '/' , '' , false , true ) ) { return true ; } return false ; } | Set cookie item with expire |
17,890 | public function init ( ) { $ render = $ this -> asyncScript ( ) ; $ render .= $ this -> load ( $ this -> client -> getWriteKey ( ) ) ; return $ render ; } | Renders all the code necessary for initializing analytics . js . |
17,891 | public function page ( $ name = null , $ category = null , array $ properties = array ( ) ) { return $ this -> renderer -> renderPage ( $ name , $ category , $ properties ) ; } | Renders the page method . |
17,892 | private function addOption ( $ string , $ value ) { foreach ( $ this -> optionList as $ option ) { if ( $ option -> matches ( $ string ) ) { if ( $ option -> mode ( ) == Getopt :: IS_FLAG ) { if ( is_null ( $ value ) ) { $ value = isset ( $ this -> options [ $ string ] ) ? ! $ this -> options [ $ string ] -> getValue ( ) : ( $ option -> getArgument ( ) -> hasDefaultValue ( ) ? ! $ option -> getArgument ( ) -> getDefaultValue ( ) : true ) ; } } else { if ( $ option -> mode ( ) == Getopt :: REQUIRED_ARGUMENT && ! mb_strlen ( $ value ) ) { throw new \ UnexpectedValueException ( "Option '$string' must have a value" ) ; } if ( $ option -> getArgument ( ) -> hasValidation ( ) ) { if ( ( mb_strlen ( $ value ) > 0 ) && ! $ option -> getArgument ( ) -> validates ( $ value ) ) { throw new \ UnexpectedValueException ( "Option '$string' has an invalid value" ) ; } } if ( $ option -> mode ( ) == Getopt :: NO_ARGUMENT ) { $ oldValue = isset ( $ this -> options [ $ string ] ) ? $ this -> options [ $ string ] -> getValue ( ) : null ; $ value = is_null ( $ oldValue ) ? 1 : $ oldValue + 1 ; } $ value = ( mb_strlen ( $ value ) > 0 ) ? $ value : 1 ; } if ( $ option -> short ( ) ) { $ this -> options [ $ option -> short ( ) ] = new Value ( $ value ) ; } if ( $ option -> long ( ) ) { $ this -> options [ $ option -> long ( ) ] = new Value ( $ value ) ; } return ; } } throw new \ UnexpectedValueException ( "Option '$string' is unknown" ) ; } | Add an option to the list of known options . |
17,893 | private function addDefaultValues ( ) { foreach ( $ this -> optionList as $ option ) { if ( $ option -> getArgument ( ) -> hasDefaultValue ( ) && ! isset ( $ this -> options [ $ option -> short ( ) ] ) && ! isset ( $ this -> options [ $ option -> long ( ) ] ) ) { if ( $ option -> short ( ) ) { $ this -> options [ $ option -> short ( ) ] = new Value ( $ option -> getArgument ( ) -> getDefaultValue ( ) , true ) ; } if ( $ option -> long ( ) ) { $ this -> options [ $ option -> long ( ) ] = new Value ( $ option -> getArgument ( ) -> getDefaultValue ( ) , true ) ; } } } } | If there are options with default values that were not overridden by the parsed option string add them to the list of known options . |
17,894 | function authenticator ( $ authenticatorName = self :: AUTHENTICATOR_DEFAULT ) { if ( ! $ this -> authenticators -> has ( $ authenticatorName ) ) throw new \ Exception ( sprintf ( 'Authenticator (%s) Not Registered.' , $ authenticatorName ) ) ; $ authenticator = $ this -> authenticators -> get ( $ authenticatorName ) ; return $ authenticator ; } | Retrieve Registered Authenticator Service By Name |
17,895 | function guard ( $ authorizeOfGuardName ) { if ( ! $ this -> guards -> has ( $ authorizeOfGuardName ) ) throw new \ Exception ( sprintf ( 'Guard Authorization (%s) Not Registered.' , $ authorizeOfGuardName ) ) ; $ guard = $ this -> guards -> get ( $ authorizeOfGuardName ) ; return $ guard ; } | Retrieve Authorization Guard |
17,896 | protected function templatePath ( $ path , array $ path_vars = [ ] ) { if ( strpos ( $ path , '{' ) !== false ) { extract ( $ path_vars ) ; preg_match_all ( '@\{\$([A-Za-z0-9_]*)\}@i' , $ path , $ matches ) ; if ( ! empty ( $ matches [ 1 ] ) ) { foreach ( $ matches [ 1 ] as $ var ) { $ path = str_replace ( '{$' . $ var . '}' , $ $ var , $ path ) ; } } } return $ path ; } | Replace variables in a path |
17,897 | protected function discoverInstallers ( ) { $ repo_manager = $ this -> composer -> getRepositoryManager ( ) ; $ package = $ this -> composer -> getPackage ( ) ; return $ this -> discoverPackageInstallers ( $ package , $ repo_manager ) ; } | Helper function to scan for installer definitions in dependencies . |
17,898 | protected function discoverPackageInstallers ( PackageInterface $ package , RepositoryManager $ repo_manager ) { $ package_name = $ package -> getName ( ) ; if ( ! isset ( $ this -> packageInstallers [ $ package_name ] ) ) { $ this -> packageInstallers [ $ package_name ] = [ ] ; $ installer_paths = & $ this -> packageInstallers [ $ package_name ] ; $ package_extra = $ package -> getExtra ( ) ; if ( isset ( $ package_extra ) && isset ( $ package_extra [ 'installer-paths' ] ) ) { foreach ( $ package_extra [ 'installer-paths' ] as $ path => $ values ) { foreach ( $ values as $ value ) { $ type = explode ( ':' , $ value , 2 ) ; if ( count ( $ type ) >= 2 && $ type [ 0 ] === 'type' ) { $ installer_paths [ $ type [ 1 ] ] = $ path ; } } } } $ requires = $ package -> getRequires ( ) ; foreach ( $ requires as $ requirement ) { if ( static :: isSystemRequirement ( $ requirement ) ) { continue ; } $ required_package = $ repo_manager -> findPackage ( $ requirement -> getTarget ( ) , $ requirement -> getConstraint ( ) ) ; if ( $ required_package ) { $ installer_paths += $ this -> discoverPackageInstallers ( $ required_package , $ repo_manager ) ; } } } return $ this -> packageInstallers [ $ package_name ] ; } | Recursively discover available installer paths in installers . |
17,899 | public static function isSystemRequirement ( Link $ requirement ) { $ package_name = $ requirement -> getTarget ( ) ; if ( strpos ( $ package_name , '/' ) === FALSE ) { return TRUE ; } return FALSE ; } | Checks if the required package doesn t have a vendor . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.