idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
236,400 | public static function findRoute ( $ route , $ properties = [ ] ) { if ( ! empty ( $ properties ) ) { foreach ( self :: $ routes as $ r ) { if ( $ r [ 'props' ] [ 'as' ] == $ route ) { $ parts = explode ( '/' , $ r [ 'url' ] ) ; $ url = "" ; $ count = 1 ; foreach ( $ parts as $ part ) { if ( substr ( $ part , 0 , 1 ) =... | Finds a route by the given route name . Also takes properties to put into the route url . |
236,401 | private static function callController ( $ route , $ properties = [ ] ) { $ props = $ route [ 'props' ] ; $ uses = $ props [ 'uses' ] ; if ( ! empty ( $ props [ 'middleware' ] ) ) { if ( ! ctype_upper ( substr ( $ props [ 'middleware' ] , 0 , 1 ) ) ) { $ middleware = substr_replace ( $ props [ 'middleware' ] , strtoupp... | Call controller by route . |
236,402 | public static function execute ( $ currentRoute ) { $ currentRouteParts = explode ( '/' , $ currentRoute ) ; foreach ( self :: $ routes as $ route ) { if ( $ route [ 'url' ] == $ currentRoute ) { return self :: callController ( $ route ) ; } $ routeParts = explode ( '/' , $ route [ 'url' ] ) ; if ( count ( $ currentRou... | Execute routing . |
236,403 | protected function transformDataProvider ( DataProviderInterface $ dataProvider ) { if ( Craft :: $ app -> getRequest ( ) -> getIsHead ( ) ) { return null ; } else { if ( ! $ transformer = $ this -> dataTransformer ( ) ) { return $ dataProvider ; } $ models = Factory :: collection ( $ this -> resolveTransformer ( $ tra... | Serializes a data provider . |
236,404 | public function sortCategories ( array $ items ) { $ repository = $ this -> getRepository ( ) ; $ em = $ this -> getDoctrineHelper ( ) -> getEntityManager ( ) ; foreach ( $ items as $ item ) { $ parent = $ repository -> find ( $ item [ 'parent' ] ) ; $ child = $ repository -> find ( $ item [ 'id' ] ) ; if ( null !== $ ... | Sorts categories passed in request |
236,405 | protected function translateCategory ( Locale $ locale , CategoryInterface $ category , $ name ) { $ translation = $ category -> translate ( $ locale -> getCode ( ) ) ; $ slug = $ this -> getLocaleSlug ( $ locale , $ name ) ; $ translation -> setName ( $ name ) ; $ translation -> setSlug ( $ slug ) ; $ category -> merg... | Translates the category |
236,406 | protected function getLocaleSlug ( Locale $ locale , $ categoryName ) { $ slug = Sluggable :: makeSlug ( $ categoryName ) ; $ currentLocale = $ this -> getRequestHelper ( ) -> getCurrentLocale ( ) ; if ( $ locale -> getCode ( ) != $ currentLocale ) { $ slug = Sluggable :: makeSlug ( sprintf ( '%s-%s' , $ categoryName ,... | Returns category slug |
236,407 | public function data ( $ key = null ) { $ data = $ this -> body [ 'data' ] ; if ( $ key !== null ) { foreach ( explode ( '.' , $ key ) as $ part ) { if ( isset ( $ data [ $ part ] ) ) { $ data = $ data [ $ part ] ; } else { $ data = null ; break ; } } } return $ data ; } | Return the response s data a key from the data or null if the data or key does not exist . |
236,408 | public function rateLimit ( $ key = null ) { return $ key ? ( isset ( $ this -> rate_limit [ $ key ] ) ? $ this -> rate_limit [ $ key ] : null ) : $ this -> rate_limit ; } | Return the response s rate limit info array a key from the array or null if the info or key does not exist . |
236,409 | public function getHeader ( string $ headerName ) { return $ this -> hasHeader ( $ headerName ) ? $ this -> headers [ $ headerName ] : null ; } | Get header from request |
236,410 | public function setHeader ( string $ headerName , $ headerValue ) : HttpRequestContract { $ this -> headers [ $ headerName ] = $ headerValue ; return $ this ; } | Set header in request |
236,411 | protected function loadSkinAssets ( $ aAssets , $ aCssInline , $ aJsInline , $ sUrl ) { $ oAsset = Factory :: service ( 'Asset' ) ; if ( ! empty ( $ aAssets ) && is_array ( $ aAssets ) ) { foreach ( $ aAssets as $ asset ) { if ( is_string ( $ asset ) ) { $ oAsset -> load ( $ asset ) ; } else { $ oAsset -> load ( $ asse... | Loads any assets required by the skin |
236,412 | public static function tick ( float $ ms , callable $ callback , $ params = null ) { $ tid = Timer :: tick ( $ ms , $ callback , $ params ) ; self :: $ timers [ $ tid ] = [ 'type' => 'tick' , 'ctime' => \ time ( ) , 'interval' => $ ms , ] ; return $ tid ; } | add a interval timer |
236,413 | public static function getType ( $ type ) { if ( ! isset ( static :: $ mappedTypeInstances [ $ type ] ) ) { if ( ! static :: hasType ( $ type ) ) { throw TypeException :: typeDoesNotExist ( $ type ) ; } static :: $ mappedTypeInstances [ $ type ] = new static :: $ mappedTypeClasses [ $ type ] ( ) ; } return static :: $ ... | Gets a type . |
236,414 | public static function overrideType ( $ type , $ class ) { if ( ! static :: hasType ( $ type ) ) { throw TypeException :: typeDoesNotExist ( $ type ) ; } if ( ! class_exists ( $ class ) ) { throw TypeException :: classNotFound ( $ class ) ; } if ( ! in_array ( 'Fridge\DBAL\Type\TypeInterface' , class_implements ( $ cla... | Overrides an existing type . |
236,415 | protected function getFieldOutputEnumSetReadOnly ( $ val , $ adnlThings ) { $ inputFeatures = [ 'name' => $ val [ 'COLUMN_NAME' ] . $ adnlThings [ 'suffix' ] , 'id' => $ val [ 'COLUMN_NAME' ] , 'readonly' => 'readonly' , 'class' => 'input_readonly' , 'size' => 50 , 'value' => $ this -> getFieldValue ( $ val ) , ] ; ret... | Creates an input for ENUM or SET if marked Read - Only |
236,416 | protected function getFieldOutputTT ( $ value , $ szN , $ iar = [ ] ) { $ inAdtnl = [ 'id' => $ value [ 'COLUMN_NAME' ] , 'maxlength' => $ szN , 'name' => $ value [ 'COLUMN_NAME' ] , 'size' => $ szN , 'type' => 'text' , 'value' => $ this -> getFieldValue ( $ value ) , ] ; if ( $ iar !== [ ] ) { $ inAdtnl = array_merge ... | Builds output as text input type |
236,417 | protected function getFieldValue ( $ details ) { $ this -> initializeSprGlbAndSession ( ) ; $ rqCN = $ this -> tCmnRequest -> request -> get ( $ details [ 'COLUMN_NAME' ] ) ; if ( ! is_null ( $ rqCN ) ) { if ( ( $ details [ 'IS_NULLABLE' ] == 'YES' ) && ( $ rqCN == '' ) ) { return 'NULL' ; } return $ rqCN ; } return $ ... | Returns given value for a field from REQUEST global variable |
236,418 | protected function setFieldLabel ( $ details , $ features , $ fieldLabel ) { $ aLabel = [ 'for' => $ details [ 'COLUMN_NAME' ] , 'id' => $ details [ 'COLUMN_NAME' ] . '_label' ] ; if ( isset ( $ features [ 'disabled' ] ) ) { if ( in_array ( $ details [ 'COLUMN_NAME' ] , $ features [ 'disabled' ] ) ) { $ aLabel = array_... | Prepares the label for inputs |
236,419 | protected function setFieldNumbers ( $ fieldDetails , $ outputFormated = false ) { $ sRtrn = $ this -> setFieldSpecific ( $ fieldDetails ) ; if ( $ outputFormated ) { foreach ( $ sRtrn as $ key => $ value ) { $ sRtrn [ $ key ] = $ this -> setNumberFormat ( $ value ) ; } } return $ sRtrn ; } | Returns maximum length for a given MySQL field |
236,420 | private function setFieldSpecific ( $ fieldDetails ) { if ( in_array ( $ fieldDetails [ 'DATA_TYPE' ] , [ 'char' , 'varchar' , 'tinytext' , 'text' , 'mediumtext' , 'longtext' ] ) ) { return [ 'M' => $ fieldDetails [ 'CHARACTER_MAXIMUM_LENGTH' ] ] ; } elseif ( in_array ( $ fieldDetails [ 'DATA_TYPE' ] , [ 'decimal' , 'n... | Establishes numbers of fields |
236,421 | protected function setFormButtons ( $ feat , $ hiddenInfo = [ ] ) { $ btn = [ ] ; $ btn [ ] = '<input type="submit" id="submit" style="margin-left:220px;" value="' . $ this -> lclMsgCmn ( 'i18n_Form_ButtonSave' ) . '" />' ; if ( isset ( $ feat [ 'insertAndUpdate' ] ) ) { $ btn [ ] = '<input type="hidden" id="insertAndU... | Form default buttons |
236,422 | public function init ( $ config = NULL ) { $ this -> mailer = new PHPMailer ( ) ; foreach ( $ config as $ key => $ value ) { switch ( $ key ) { case 'from_email' : $ this -> mailer -> From = $ value ; break ; case 'from_name' : $ this -> mailer -> FromName = $ value ; break ; case 'is_html' : $ this -> mailer -> isHTML... | Initialises the mailer . |
236,423 | public function addCC ( $ email ) { if ( is_array ( $ email ) ) { $ this -> mailer -> addCC ( $ email [ 'email' ] , $ email [ 'name' ] ) ; } else { $ this -> mailer -> addCC ( $ email ) ; } } | Adds a CC address to the email . |
236,424 | public function addBCC ( $ email ) { if ( is_array ( $ email ) ) { $ this -> mailer -> addBCC ( $ email [ 'email' ] , $ email [ 'name' ] ) ; } else { $ this -> mailer -> addBCC ( $ email ) ; } } | Adds a BCC address to the email . |
236,425 | public function getReferenceName ( ) { $ options = $ this -> getOptions ( ) ; if ( ! empty ( $ options [ 'tag' ] ) ) { return 'Tag: ' . $ options [ 'tag' ] ; } elseif ( ! empty ( $ options [ 'branch' ] ) ) { return 'Branch: ' . $ options [ 'branch' ] ; } elseif ( ! empty ( $ options [ 'sha1' ] ) ) { return 'Sha1: ' . $... | Since sha1 is always shipped with branch and tag configuration we consider it for referenceName only if neither tag nor branch was set . |
236,426 | public static function singleton ( $ class = null ) { if ( ! $ class ) { $ class = get_called_class ( ) ; } if ( ! isset ( self :: $ singletons [ $ class ] ) ) { self :: $ singletons [ $ class ] = self :: create ( $ class ) ; } return self :: $ singletons [ $ class ] ; } | Creates a class instance by the singleton design pattern . It will always return the same instance for this class . |
236,427 | protected function handleException ( Exception $ e ) { $ handler = 'errorHandler' ; $ params = [ $ e ] ; if ( $ this -> getContainer ( ) -> has ( $ handler ) ) { $ callable = $ this -> getContainer ( ) -> get ( $ handler ) ; return call_user_func_array ( $ callable , $ params ) ; } $ this -> displayError ( $ e -> getMe... | Call relevant handler from the Container if needed . If it doesn t exist then just print error |
236,428 | private function apiCall ( $ method , array $ query = array ( ) , callable $ onSuccess , $ emptyValue = null ) { try { return $ onSuccess ( $ this -> restApiClient -> $ method ( $ query ) ) ; } catch ( BadResponseException $ e ) { if ( ( $ response = $ e -> getResponse ( ) ) && $ response -> getStatusCode ( ) == 404 ) ... | Performs an Api call on given method . |
236,429 | public function hasKey ( string $ needle , array $ haystack ) : bool { foreach ( $ haystack as $ key => $ value ) { if ( $ key === $ needle ) { return true ; } if ( is_array ( $ value ) ) { if ( $ x = $ this -> hasKey ( $ needle , $ value ) ) { return $ x ; } } } return false ; } | Check if array has key recursivly |
236,430 | public function save ( ) { $ bucket = $ this -> _post ( 'servers/' . $ this -> server_id . '/software_bucket/' . $ this -> key , $ this -> dirty_values ) ; $ this -> mergeValues ( $ bucket ) ; } | Saves a bucket if the bucket does not exist a new bucket will be created |
236,431 | public function name ( ) { if ( null === $ this -> sessionName ) { $ characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ; $ this -> sessionName = '' ; for ( $ i = 0 ; $ i < 32 ; $ i ++ ) { $ this -> sessionName .= $ characters [ rand ( 0 , strlen ( $ characters ) - 1 ) ] ; } } return $ this -... | returns session name |
236,432 | public static function doInsert ( $ criteria , ConnectionInterface $ con = null ) { if ( null === $ con ) { $ con = Propel :: getServiceContainer ( ) -> getWriteConnection ( C2PTableMap :: DATABASE_NAME ) ; } if ( $ criteria instanceof Criteria ) { $ criteria = clone $ criteria ; } else { $ criteria = $ criteria -> bui... | Performs an INSERT on the database given a C2P or Criteria object . |
236,433 | public static function convertVariableTo ( \ PHY \ Variable \ AVar $ variable , $ convertTo = 'Obj' ) { $ method = 'to' . $ convertTo ; if ( ! is_callable ( [ $ variable , $ method ] ) ) { throw new \ PHY \ Variable \ Exception ( 'Could not convert "' . $ variable -> getType ( ) . '" to "' . $ convertTo . '"' ) ; } $ v... | Convert a variable to a different type . |
236,434 | protected function registerRoutes ( ) { $ http = Arr :: get ( $ this -> triggers , 'http' ) ; if ( is_null ( $ http ) ) { return ; } try { Validator :: validate ( $ http , [ 'route' => 'required' , 'methods' => 'required' , 'function' => 'required' ] ) ; } catch ( ExceptionAttrs $ e ) { throw new \ Exception ( $ e -> t... | Registrar rotas . |
236,435 | protected function _createRuntimeException ( $ message = null , $ code = null , $ previous = null ) { return new RuntimeException ( $ message , $ code , $ previous ) ; } | Creates a new Runtime exception . |
236,436 | public function init ( $ baseStorageDefaultPath , $ baseStorageSqlPath ) { $ storageDefaultPath = realpath ( $ baseStorageDefaultPath ) ; $ contentSqlPath = realpath ( $ baseStorageSqlPath ) ; $ this -> initConfigStorage ( $ storageDefaultPath ) ; $ this -> initContentDb ( $ contentSqlPath ) ; $ this -> save ( ) ; } | Initiates default storage |
236,437 | public function save ( ) { $ host = $ this ; array_map ( function ( $ value ) use ( $ host ) { $ host -> saveSubset ( $ value ) ; } , $ this -> fileBasedSubsets ) ; } | Persist all subsets |
236,438 | public function saveSubset ( $ subset ) { $ changes = $ subset . 'Changes' ; if ( $ this -> $ changes === true ) { if ( ! defined ( 'JSON_PRETTY_PRINT' ) ) { $ json = json_encode ( $ this -> $ subset ) ; } else { $ json = json_encode ( $ this -> $ subset , JSON_PRETTY_PRINT ) ; } $ subsetStoragePath = $ this -> storage... | Persist subset to disk |
236,439 | protected function loadSubset ( $ subset ) { $ subsetStoragePath = $ this -> storagePath . DIRECTORY_SEPARATOR . $ subset . '.json' ; $ json = file_get_contents ( $ subsetStoragePath ) ; $ json = json_decode ( $ json ) ; $ this -> $ subset = $ json ; return $ json ; } | Load subset from disk |
236,440 | public function addRoles ( Collection $ roles ) { foreach ( $ roles as $ role ) { $ this -> roles -> add ( $ role ) ; } } | Add a role to the user . |
236,441 | private function registerTwigExtensions ( ) { foreach ( $ this -> app -> getSetting ( 'twig_extensions' , [ ] ) as $ extension ) { $ this -> twig -> addExtension ( new $ extension ( $ this ) ) ; } } | Register custom twig extensions . |
236,442 | public function getUrl ( $ url ) { if ( ! $ url || starts_with ( $ url , [ '#' , '//' , 'mailto:' , 'tel:' , 'http' ] ) ) { return $ url ; } $ root = $ this -> app -> getSetting ( 'url' ) ; $ url = trim ( $ root , '/' ) . '/' . trim ( $ url , '/' ) ; if ( $ this -> app -> getSetting ( 'url_trailing_slash' , false ) && ... | Get the URL for the given page . |
236,443 | public function getAsset ( $ path ) { if ( $ path [ 0 ] === '/' ) { return $ this -> getUrl ( $ path ) ; } $ asset = $ this -> manifest -> get ( $ path ) ; return $ this -> getUrl ( '/assets/' . trim ( $ asset , '/' ) ) ; } | Check asset manifest for a file |
236,444 | public function build ( ) { $ this -> app -> writeln ( "\n<comment>Adding root pages</comment>" ) ; $ this -> addPages ( '\\Skosh\\Content\\Page' ) ; $ this -> app -> writeln ( "\n<comment>Adding posts</comment>" ) ; $ this -> addPages ( '\\Skosh\\Content\\Post' , 'path' , '_posts' ) ; $ this -> app -> writeln ( "\n<co... | Renders the site |
236,445 | public function savePage ( $ target , $ html ) { $ fs = new Filesystem ( ) ; $ fs -> dumpFile ( $ this -> target . DIRECTORY_SEPARATOR . $ target , $ html ) ; } | Save page to target file . |
236,446 | public function getParent ( $ parentId ) { if ( $ parentId && isset ( $ this -> site -> pages [ $ parentId ] ) ) { return $ this -> site -> pages [ $ parentId ] ; } return [ ] ; } | Get parent content . |
236,447 | public function getPosts ( Content $ content ) { if ( isset ( $ this -> site -> categories [ $ content -> id ] ) ) { return $ this -> site -> categories [ $ content -> id ] ; } else { if ( isset ( $ content -> category ) && isset ( $ this -> site -> categories [ $ content -> category ] ) ) { return $ this -> site -> ca... | Get posts for given content . |
236,448 | public function createServerConfig ( ) { $ config = new Config ( $ this -> app -> getEnvironment ( ) , '.env' ) ; $ config -> export ( $ this -> target . DIRECTORY_SEPARATOR . '.env.php' ) ; } | Create a server config file |
236,449 | public function copyStaticFiles ( ) { $ exclude = [ 'js' , 'javascripts' , 'stylesheets' , 'less' , 'sass' ] ; $ exclude = array_merge ( $ exclude , ( array ) $ this -> app -> getSetting ( 'exclude' , [ ] ) ) ; $ pattern = '/\\.(' . implode ( "|" , $ exclude ) . ')$/' ; $ to_copy = ( array ) $ this -> app -> getSetting... | Copy static files to target Ignoring JS CSS & LESS - Gulp handles that |
236,450 | public function cleanTarget ( ) { $ filesystem = new Filesystem ( ) ; $ files = array_diff ( scandir ( $ this -> target ) , [ '.' , '..' ] ) ; $ files = preg_grep ( '/[^.gitignore]/i' , $ files ) ; foreach ( $ files as $ file ) { $ filesystem -> remove ( "$this->target/$file" ) ; } Event :: fire ( 'target.cleaned' , [ ... | Clean target directory |
236,451 | private function addPages ( $ class , $ path = 'notPath' , $ filter = '_' ) { $ finder = new Finder ( ) ; $ finder -> files ( ) -> in ( $ this -> source ) -> $ path ( $ filter ) -> name ( '/\\.(md|textile|xml|twig)$/' ) ; foreach ( $ finder as $ file ) { $ page = new $ class ( $ file , $ this ) ; if ( $ this -> app -> ... | Add pages for rendering |
236,452 | public function cmdGetFile ( ) { $ result = $ this -> getListFile ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableFile ( $ result ) ; $ this -> output ( ) ; } | Callback for file - get command |
236,453 | public function cmdDeleteFile ( ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( empty ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ options = null ; if ( isset ( $ id ) ) { if ( $ this -> getParam ( 'type' ) ) { $ options = array ... | Callback for file - delete command |
236,454 | public function cmdUpdateFile ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this -> ... | Callback for file - update command |
236,455 | protected function addFile ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> file -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } } | Add a new file record |
236,456 | protected function updateFile ( $ file_id ) { if ( ! $ this -> isError ( ) && ! $ this -> file -> update ( $ file_id , $ this -> getSubmitted ( ) ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } } | Updates a file record |
236,457 | protected function submitAddFile ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'file' ) ; $ this -> addFile ( ) ; } | Add a new file record at once |
236,458 | protected function wizardAddFile ( ) { $ this -> validatePrompt ( 'path' , $ this -> text ( 'Path' ) , 'file' ) ; $ this -> validatePrompt ( 'entity' , $ this -> text ( 'Entity' ) , 'file' ) ; $ this -> validatePrompt ( 'entity_id' , $ this -> text ( 'Entity ID' ) , 'file' , 0 ) ; $ this -> validatePrompt ( 'title' , $... | Add a new file record step by step |
236,459 | private function SaveGroups ( ) { $ assignedIDs = $ this -> AssignedGroupIDs ( ) ; $ selectedIDs = Request :: PostArray ( 'Group' ) ; $ this -> ClearMembergroups ( $ selectedIDs ) ; foreach ( $ selectedIDs as $ selectedID ) { if ( ! in_array ( $ selectedID , $ assignedIDs ) ) { $ confirmGroup = new RegisterConfirmMembe... | Saves the groups |
236,460 | public function configParam ( $ parameter ) { $ value = $ this -> container -> getParameter ( $ parameter ) ; return is_array ( $ value ) ? json_encode ( $ value ) : $ value ; } | Returns the specified container s parameter |
236,461 | protected function _getException ( \ Throwable $ e , $ h1 ) { try { return $ this -> _getFormatterStrategy ( ) -> format ( $ e , $ h1 ) ; } catch ( \ Throwable $ e2 ) { return "Error '" . get_class ( $ e2 ) . "' during processing of exception '" . get_class ( $ e ) . "' with message '{$e2->getMessage()}'." ; } } | Get exception stack trace as a string |
236,462 | protected function _handleXMLHTTPCommandException ( \ Throwable $ e ) { header ( "Content-Type: application/json; charset=utf-8" ) ; header ( "Expires: Sat, 1 Jan 2005 00:00:00 GMT" ) ; header ( "Last-Modified: " . gmdate ( "D, d M Y H:i:s" ) . " GMT" ) ; header ( "Cache-Control: no-cache, must-revalidate" ) ; header (... | Handle an exception during an XMLHTTP request . |
236,463 | public function end ( ) { $ calc = $ this -> start ( ) + $ this -> max ; $ r = ( $ calc > $ this -> total ) ? $ this -> total : $ calc ; return $ r ; } | This calculates the end of our result set based on our current page |
236,464 | public function info ( $ html ) { $ tags = array ( '{total}' , '{start}' , '{end}' , '{page}' , '{pages}' ) ; $ code = array ( $ this -> total , $ this -> start ( ) + 1 , $ this -> end ( ) , $ this -> get , $ this -> pages ( ) ) ; return str_replace ( $ tags , $ code , $ html ) ; } | Based on which page you are this returns informations like start result end result total results current page total pages |
236,465 | public function first ( $ html , $ html2 = '' ) { $ r = ( $ this -> get != 1 ) ? str_replace ( '{nr}' , 1 , $ html ) : str_replace ( '{nr}' , 1 , $ html2 ) ; return $ r ; } | This shows the first link with custom html |
236,466 | public function previous ( $ html , $ html2 = '' ) { $ r = ( $ this -> get != 1 ) ? str_replace ( '{nr}' , $ this -> get - 1 , $ html ) : str_replace ( '{nr}' , $ this -> get - 1 , $ html2 ) ; return $ r ; } | This shows the previous link with custom html |
236,467 | public function next ( $ html , $ html2 = '' ) { $ r = ( $ this -> get < $ this -> pages ( ) ) ? str_replace ( '{nr}' , $ this -> get + 1 , $ html ) : str_replace ( '{nr}' , $ this -> get + 1 , $ html2 ) ; return $ r ; } | This shows the next link with custom html |
236,468 | public function last ( $ html , $ html2 = '' ) { $ r = ( $ this -> get < $ this -> pages ( ) ) ? str_replace ( '{nr}' , $ this -> pages ( ) , $ html ) : str_replace ( '{nr}' , $ this -> pages ( ) , $ html2 ) ; return $ r ; } | This shows the last link with custom html |
236,469 | public function numbers ( $ link , $ current , $ reversed = false ) { $ r = '' ; $ range = floor ( ( $ this -> max_items - 1 ) / 2 ) ; if ( ! $ this -> max_items ) { $ page_nums = range ( 1 , $ this -> pages ( ) ) ; } else { $ lower_limit = max ( $ this -> get - $ range , 1 ) ; $ upper_limit = min ( $ this -> pages ( )... | This shows an loop of numbers with their appropriate link in custom html |
236,470 | public function saveI18N ( ) { if ( empty ( $ this -> i18n_data ) ) return ; $ this -> i18n_relation ( ) -> getQuery ( ) -> whereIn ( $ this -> getI18NCodeField ( ) , array_keys ( $ this -> i18n_data ) ) -> delete ( ) ; foreach ( $ this -> i18n_data as $ locale => $ data ) { $ obj = new $ this -> i18n_class ( ) ; $ dat... | Store I18N to database |
236,471 | public function filterI18NColumn ( ) { $ overrideData = array_only ( $ this -> attributes , $ this -> i18n_fillable ) ; if ( ! empty ( $ overrideData ) ) { $ this -> i18n_data [ $ this -> i18n_default_locale ] = $ overrideData ; foreach ( $ this -> i18n_fillable as $ key ) { unset ( $ this -> $ key ) ; } } if ( isset (... | Filter & remove i18n column from attributes . Mean is not save to model self . |
236,472 | public function scopeI18N ( $ query , $ locale = null ) { $ i18nTranAlias = "i18n_translation" ; $ i18nAlias = "i18n" ; $ primary = $ this -> primaryKey ; $ i18nPrimary = $ this -> i18n_primary ; $ table = $ this -> table ; $ i18n_table = ( new $ this -> i18n_class ( ) ) -> getTable ( ) ; if ( $ locale ) { $ query -> l... | Join I18N data to this |
236,473 | public function seed ( array $ seeds ) { foreach ( $ seeds as $ seed ) { $ group = PermissionsGroup :: create ( $ seed [ 'group' ] ) ; $ permissions = array_map ( function ( $ permission ) { return new Permission ( $ permission ) ; } , $ seed [ 'permissions' ] ) ; $ group -> permissions ( ) -> saveMany ( $ permissions ... | Seed permissions . |
236,474 | public function get ( string $ settingsField = null , $ default = null ) { if ( is_null ( $ settingsField ) ) { return $ this -> settings ; } $ setting = $ this -> settings ; foreach ( explode ( '.' , $ settingsField ) as $ field ) { if ( is_array ( $ setting ) && array_key_exists ( $ field , $ setting ) ) { $ setting ... | Returns the given settings field if set or the default value |
236,475 | public function merge ( array $ settings , string $ field = null , bool $ mergeArrays = false ) { $ merged = self :: mergeSettings ( $ this -> get ( $ field ) , $ settings , $ mergeArrays ) ; if ( ! is_null ( $ field ) ) { $ this -> put ( $ field , $ merged ) ; } else { $ this -> set ( $ merged ) ; } } | Merges the given settings into the given field |
236,476 | private static function mergeSettings ( array $ a , array $ b , $ mergeArrays = false ) : array { foreach ( $ b as $ key => $ value ) { if ( array_key_exists ( $ key , $ a ) ) { if ( self :: isAssoc ( $ a [ $ key ] ) && self :: isAssoc ( $ b [ $ key ] ) ) { $ a [ $ key ] = self :: mergeSettings ( $ a [ $ key ] , $ b [ ... | Recursively merges the two given arrays giving priority to the second |
236,477 | public function load ( DOMDocument $ domDocument , $ cachePath , $ xmlSchemaFile = null ) { $ this -> domDocument = $ domDocument ; $ this -> cachePath = $ cachePath ; if ( isset ( $ xmlSchemaFile ) ) { $ this -> xmlSchemaFile = $ xmlSchemaFile ; } $ this -> loadConfiguration ( ) ; } | Loads the XML configuration . |
236,478 | public function reload ( ) { $ this -> configuration = null ; $ this -> load ( $ this -> domDocument , $ this -> cachePath , $ this -> xmlSchemaFile ) ; } | Reloads the configuration . |
236,479 | public function hasField ( $ objectName , $ fieldName ) { $ field = $ this -> getField ( $ objectName , $ fieldName ) ; return is_array ( $ field ) ; } | Returns true when the configuration of an object contains the specified field name . |
236,480 | public function getObjectNames ( ) { $ objectNames = array ( ) ; if ( is_array ( $ this -> configuration ) ) { $ objectNames = array_keys ( $ this -> configuration ) ; } return $ objectNames ; } | Returns all configured object names . |
236,481 | public function getModelConfiguration ( $ objectName ) { if ( isset ( $ this -> configuration [ $ objectName ] ) ) { $ modelConfiguration = $ this -> configuration [ $ objectName ] ; $ modelConfiguration [ '__object_name' ] = $ objectName ; if ( isset ( $ modelConfiguration [ 'fields' ] ) === false ) { $ modelConfigura... | Returns the model for the specified object . |
236,482 | public function getFormConfiguration ( $ objectName , $ formName ) { $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; if ( isset ( $ modelConfiguration [ 'forms' ] [ $ formName ] ) ) { $ formConfiguration = $ modelConfiguration [ 'forms' ] [ $ formName ] ; foreach ( $ formConfiguration [ 'field... | Returns field configuration of the specified form in the object . |
236,483 | public function getViewConfiguration ( $ objectName , $ viewName ) { $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; if ( isset ( $ modelConfiguration [ 'views' ] [ $ viewName ] ) ) { $ viewConfiguration = $ modelConfiguration [ 'views' ] [ $ viewName ] ; if ( isset ( $ viewConfiguration [ 'fi... | Returns field configuration of the specified view in the object . |
236,484 | public function getViewConfigurationsByViewgroupOfView ( $ objectName , $ viewName ) { $ viewConfigurations = array ( ) ; $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; $ viewConfiguration = $ this -> getViewConfiguration ( $ objectName , $ viewName ) ; if ( isset ( $ viewConfiguration [ 'vie... | Returns all the field configurations of views in the viewgroup of the specified view name . |
236,485 | public function getFieldNames ( $ objectName ) { $ fieldNames = array ( ) ; $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; if ( isset ( $ modelConfiguration [ '__field_index' ] ) ) { $ fieldNames = array_keys ( $ modelConfiguration [ '__field_index' ] ) ; } return $ fieldNames ; } | Returns the field names of the specified object . |
236,486 | public function getFieldNamesByView ( $ objectName , $ viewName ) { $ fieldNames = array ( ) ; $ fieldConfigurations = $ this -> getFieldsByView ( $ objectName , $ viewName ) ; foreach ( $ fieldConfigurations as $ fieldConfiguration ) { array_push ( $ fieldNames , $ fieldConfiguration [ 'name' ] ) ; } return $ fieldNam... | Returns the field names of the specified view in the object . |
236,487 | public function getFields ( $ objectName ) { $ fieldConfigurations = array ( ) ; $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; if ( is_array ( $ modelConfiguration ) ) { $ fieldConfigurations = $ modelConfiguration [ 'fields' ] ; } return $ fieldConfigurations ; } | Returns all fields for the object . |
236,488 | public function getFieldsByDatatype ( $ objectName , $ datatype ) { $ datatypeFieldConfigurations = array ( ) ; $ fieldConfigurations = $ this -> getFields ( $ objectName ) ; foreach ( $ fieldConfigurations as $ fieldConfiguration ) { if ( $ fieldConfiguration [ 'datatype' ] == $ datatype ) { $ datatypeFieldConfigurati... | Returns all fields with the specified datatype for an object . |
236,489 | public function getFieldsByView ( $ objectName , $ viewName ) { $ fieldConfigurations = array ( ) ; $ viewConfiguration = $ this -> getViewConfiguration ( $ objectName , $ viewName ) ; if ( is_array ( $ viewConfiguration ) ) { $ fieldConfigurations = $ viewConfiguration [ "fields" ] ; foreach ( $ fieldConfigurations as... | Returns the fields in the object view . |
236,490 | public function getField ( $ objectName , $ fieldName , $ excludeFormDefaults = true ) { $ modelConfiguration = $ this -> getModelConfiguration ( $ objectName ) ; if ( isset ( $ modelConfiguration [ '__field_index' ] [ $ fieldName ] ) ) { $ fieldConfiguration = array_replace_recursive ( $ this -> defaultFieldConfigurat... | Returns the configuration of a field in the specified object . |
236,491 | public function getReferencedField ( $ objectName , $ fieldName , array & $ excludedFieldNameParts = array ( ) , $ objectReferencesOnly = true ) { $ foundFieldName = null ; $ fieldNameParts = explode ( '_' , $ fieldName ) ; $ excludedFieldNameParts = array ( ) ; $ initial = false ; while ( count ( $ fieldNameParts ) > ... | Returns the field reference of the specified object . The returned excluded field name parts can be used to retrieve the field for the referenced object . |
236,492 | private function generateCacheFile ( ) { $ previousErrorSetting = libxml_use_internal_errors ( true ) ; libxml_clear_errors ( ) ; if ( @ $ this -> domDocument -> schemaValidate ( $ this -> xmlSchemaFile ) ) { $ this -> domDocument -> preserveWhiteSpace = false ; $ this -> domDocument -> loadXML ( $ this -> domDocument ... | Generates the cache file . |
236,493 | public function configurationObjectAfter ( GetConfigurationObjectDTO $ serviceDataTransferObject ) { $ this -> delay ( self :: PRIORITY_SAVE_OBJECT_IN_CACHE , function ( GetConfigurationObjectDTO $ serviceDataTransferObject ) { $ cacheHash = $ this -> getConfigurationObjectCacheHash ( $ serviceDataTransferObject ) ; if... | After a configuration object has been built it is stored in the cache . |
236,494 | public function add ( \ Caridea \ Validate \ Rule ... $ rules ) : self { $ this -> rules = array_merge ( $ this -> rules , $ rules ) ; return $ this ; } | Adds one or more Rule s into this Set . |
236,495 | public function addAll ( array $ rules ) : self { try { return $ this -> add ( ... $ rules ) ; } catch ( \ TypeError $ e ) { throw new \ InvalidArgumentException ( 'Only Rule objects are allowed' , 0 , $ e ) ; } } | Adds several Rule s into this Set . |
236,496 | public function merge ( Set $ rules ) : self { $ this -> rules = array_merge ( $ this -> rules , $ rules -> rules ) ; return $ this ; } | Adds the entries from another Set into this one . |
236,497 | protected function initializeDaemon ( ) { declare ( ticks = 100 ) ; pcntl_signal ( SIGHUP , [ $ this , 'handleSignal' ] ) ; pcntl_signal ( SIGINT , [ $ this , 'handleSignal' ] ) ; pcntl_signal ( SIGTERM , [ $ this , 'handleSignal' ] ) ; pcntl_signal ( SIGCHLD , [ $ this , 'handleSignal' ] ) ; pcntl_signal ( SIGUSR1 , [... | Post - daemonize initialization |
236,498 | protected function getPayloadInstance ( ) : AppInterface { if ( ! ( $ this -> instance instanceof AppInterface ) ) { $ appName = $ this -> get ( 'appname' , null ) ; $ appNamespace = $ this -> get ( 'appnamespace' , null ) ; $ appClassName = ucfirst ( $ appName ) ; if ( ! is_null ( $ appNamespace ) ) { $ appClassName =... | Get an instance of the app |
236,499 | protected function payloadExec ( $ method , $ args = [ ] ) { $ this -> getPayloadInstance ( ) ; if ( method_exists ( $ this -> instance , $ method ) ) { return $ this -> di -> call ( [ $ this -> instance , $ method ] , $ args ) ; } return null ; } | Execute callback on payload |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.