idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
235,800 | protected function runMigrationByPaths ( $ migrationPaths , $ command ) { $ app = $ this -> mockApplication ( ) ; $ this -> validateMigrationPaths ( $ migrationPaths ) ; foreach ( $ migrationPaths as $ migrationPath ) { $ migrateController = $ this -> buildMigration ( $ app ) ; $ migrateController -> migrationPath = $ ... | Run migration by paths |
235,801 | protected function validateMigrationPaths ( $ migrationPaths ) { foreach ( $ migrationPaths as $ migrationPath ) { $ path = \ Yii :: getAlias ( $ migrationPath , false ) ; if ( $ path === false ) { throw new ExtensionException ( __CLASS__ , "Invalid path alias: $migrationPath" ) ; } if ( ! file_exists ( $ path ) ) { th... | Validate Migration Path |
235,802 | protected function runMigrationByNamespaces ( $ migrationNamespaces , $ command ) { $ app = $ this -> mockApplication ( ) ; $ migrateController = $ this -> buildMigration ( $ app ) ; $ migrateController -> migrationNamespaces = $ migrationNamespaces ; $ this -> runMigration ( $ migrateController , $ command ) ; $ this ... | Run migration by namespaces |
235,803 | protected function runMigrationByApplication ( $ command ) { $ app = $ this -> mockApplication ( ) ; list ( $ migrateController , $ route ) = $ app -> createController ( 'migrate' ) ; if ( $ migrateController === null ) { throw new ExtensionException ( __CLASS__ , "At least one of `migrationPath` or `migrationNamespace... | Run migration from app config |
235,804 | protected function mockApplication ( ) { $ entryUrl = $ this -> config [ 'entryUrl' ] ; $ entryFile = $ this -> config [ 'entryScript' ] ? : basename ( $ entryUrl ) ; $ entryScript = $ this -> config [ 'entryScript' ] ? : parse_url ( $ entryUrl , PHP_URL_PATH ) ; $ this -> client = new Yii2Connector ( ) ; $ this -> cli... | Mocks up the application instance . |
235,805 | private function AddEMailField ( ) { $ name = 'EMail' ; $ this -> AddField ( Input :: Text ( $ name , $ this -> member -> GetEMail ( ) ) ) ; $ this -> SetRequired ( $ name ) ; $ this -> AddValidator ( $ name , PhpFilter :: EMail ( ) ) ; $ this -> AddValidator ( $ name , DatabaseCount :: UniqueField ( $ this -> member ,... | Adds the email field to the form |
235,806 | private function AddPasswordField ( ) { $ name = 'Password' ; $ this -> AddField ( Input :: Password ( $ name ) ) ; if ( ! $ this -> member -> Exists ( ) ) { $ this -> SetRequired ( $ name ) ; } $ this -> AddValidator ( $ name , StringLength :: MinLength ( 6 ) ) ; $ this -> SetTransAttribute ( $ name , 'placeholder' ) ... | Adds the password field to the form |
235,807 | protected function OnSuccess ( ) { $ action = $ this -> member -> Exists ( ) ? Action :: Update ( ) : Action :: Create ( ) ; $ this -> member -> SetName ( $ this -> Value ( 'Name' ) ) ; $ this -> member -> SetEMail ( $ this -> Value ( 'EMail' ) ) ; $ this -> SetPassword ( ) ; $ this -> member -> Save ( ) ; $ logger = n... | Saves the user |
235,808 | private function DeleteOldGroups ( array $ selGroupIDs ) { $ tblMmg = MemberMembergroup :: Schema ( ) -> Table ( ) ; $ sql = Access :: SqlBuilder ( ) ; $ where = $ sql -> Equals ( $ tblMmg -> Field ( 'Member' ) , $ sql -> Value ( $ this -> member -> GetID ( ) ) ) ; if ( count ( $ selGroupIDs ) > 0 ) { $ selectedList = ... | Deletes the unselected group ids |
235,809 | private function SaveNewGroups ( array $ exGroupIDs , array $ selGroupIDs ) { foreach ( $ selGroupIDs as $ selGroupID ) { if ( ! in_array ( $ selGroupID , $ exGroupIDs ) ) { $ mmg = new MemberMembergroup ( ) ; $ mmg -> SetMember ( $ this -> member ) ; $ mmg -> SetMemberGroup ( new Membergroup ( $ selGroupID ) ) ; $ mmg... | Saves the new groups |
235,810 | public function setDefaultValue ( $ value = null ) { if ( ! $ this -> value ) { if ( $ value = $ value ? : config ( "fields.values.{$this->key}" ) ) { foreach ( ( array ) $ value as $ locale => $ translation ) { $ locale = is_string ( $ locale ) ? $ locale : $ this -> getDefaultLocale ( ) ; $ this -> setTranslation ( '... | Check if value is not set and set it . |
235,811 | public function setDefaultDescription ( $ description = null ) { if ( ! $ this -> description ) { $ description = $ description ? : config ( "fields.descriptions.{$this->key}" , ucfirst ( $ this -> key ) ) ; foreach ( ( array ) $ description as $ locale => $ translation ) { $ locale = is_string ( $ locale ) ? $ locale ... | Check if description is not set and set it . |
235,812 | public function addTranslated ( string $ locale ) { if ( $ this -> isDefaultLocale ( $ locale ) ) { $ this -> translated = [ $ locale ] ; } else { $ translated = $ this -> getTranslated ( ) ; $ translated [ ] = $ locale ; $ this -> translated = array_unique ( $ translated ) ; } } | Set translated locale . |
235,813 | public static function normalizeHeaderName ( $ name ) { return preg_replace_callback ( "'-[a-z]'" , function ( $ m ) { return strtoupper ( $ m [ 0 ] ) ; } , ucfirst ( strtolower ( trim ( $ name ) ) ) ) ; } | Normalize an HTTP header name by capitalizing the first letter and all letters preceeded by a dash . |
235,814 | protected static function useStatic ( ) { if ( isset ( self :: $ _useStatic ) ) { return self :: $ _useStatic ; } self :: $ _useStatic = AssetsSettings :: assetsUseStatic ( ) ; return self :: $ _useStatic ; } | Get useStatic setting - use static resources |
235,815 | final public function setView ( View $ view ) { $ this -> view = $ view ; if ( ! $ this -> initializedView ) { $ this -> initializedView = true ; $ this -> init ( ) ; } return $ this ; } | Sets the view instance to use |
235,816 | final protected function resetUserIdentity ( AUser $ user = null , $ duration = null ) { engine ( 'resetUserIdentity' , $ user , $ duration ) ; return $ this ; } | Resets the user identity to guest |
235,817 | final protected function prepareInject ( ) { $ service = $ this -> getModule ( ) . '\Services\\' . $ this -> getClassName ( ) . 'Service' ; if ( class_exists ( $ service ) ) { return array_merge ( parent :: prepareInject ( ) , $ this -> getConfigInject ( 'controllers' ) , array ( 'service' => array ( 'class' => $ servi... | Prepares the injection |
235,818 | final public function getActions ( ) { $ return = array ( ) ; foreach ( get_class_methods ( $ this ) as $ method ) { if ( substr ( $ method , strlen ( $ method ) - 6 ) === 'Action' ) $ return [ ] = substr ( $ method , 0 , strlen ( $ method ) - 6 ) ; } return $ return ; } | Fetches all actions in the controller |
235,819 | final protected function redirect ( $ module , $ controller = null , $ action = null , array $ params = array ( ) , $ hash = null ) { header ( 'Location: ' . $ this -> view -> url ( $ module , $ controller , $ action , $ params , $ hash ) ) ; exit ; } | Redirects to another resource |
235,820 | public static function isEmpty ( $ resource ) { if ( ! self :: isValid ( $ resource ) && null !== $ resource ) { return false ; } return String :: isEmpty ( $ resource ) ; } | Check if resource is empty |
235,821 | public static function isNotEmpty ( $ resource ) { if ( ! self :: isValid ( $ resource ) && null !== $ resource ) { return false ; } return ( $ resource !== null && $ resource !== '' ) ; } | Check if resource is note empty |
235,822 | private function getPagesSeeds ( ) { return [ [ 'name' => 'Pages - List all pages' , 'description' => 'Allow to list all pages.' , 'slug' => PagesPolicy :: PERMISSION_LIST , ] , [ 'name' => 'Pages - View a page' , 'description' => 'Allow to display a page.' , 'slug' => PagesPolicy :: PERMISSION_SHOW , ] , [ 'name' => '... | Get the Pages permissions . |
235,823 | private function getFootersSeeds ( ) { return [ [ 'name' => 'Footers - List all footers' , 'description' => 'Allow to list all footers.' , 'slug' => FootersPolicy :: PERMISSION_LIST , ] , [ 'name' => 'Footers - View a footer' , 'description' => 'Allow to display a footer.' , 'slug' => FootersPolicy :: PERMISSION_SHOW ,... | Get the Footers permissions . |
235,824 | private function getRedirectsSeeds ( ) { return [ [ 'name' => 'Redirects - List all redirections' , 'description' => 'Allow to list all redirections.' , 'slug' => RedirectsPolicy :: PERMISSION_LIST , ] , [ 'name' => 'Redirects - View a redirection' , 'description' => 'Allow to display a redirection.' , 'slug' => Redire... | Get the Redirects permissions . |
235,825 | public function render ( $ tpl , $ params = [ ] ) { $ this -> setTemplate ( $ tpl ) ; $ this -> params = ( object ) $ params ; return $ this -> retrieve ( ) ; } | Set the template name assign params array and return rendered output in one method . Call this function in routes and controllers . |
235,826 | public function setTemplate ( $ tpl , $ clearParams = true ) { if ( $ clearParams ) { $ this -> clearParams ( ) ; } $ this -> templateFile = $ this -> templatesPath . $ tpl . '.tpl.php' ; } | Set the name of the template to be used . Should not include file extension . |
235,827 | private function setTemplatesPath ( $ templatesPath ) { $ this -> templatesPath = $ templatesPath ; if ( ! is_readable ( $ this -> templatesPath ) ) { $ this -> error ( "Template Root Path ({$this->templatesPath}) does not exist or not readable." ) ; } } | Set the path to the templates directory . |
235,828 | private function protectedInclude ( ) { $ _tpl = $ this ; $ _view = function ( $ tplName , $ params = [ ] ) use ( $ _tpl ) { $ tplCopy = clone $ _tpl ; echo ( $ tplCopy -> render ( $ tplName , $ params ) ) ; unset ( $ tplCopy ) ; } ; $ _ss = function ( $ str ) { return htmlspecialchars ( $ str , ENT_QUOTES ) ; } ; $ al... | Wrap our template include into a method scope . This allows our template to have access only to the template params . It also prevents collisions with the global namespace . |
235,829 | protected function useCache ( ) { if ( $ this -> cache && $ this -> cacheExists ( ) ) { $ this -> templateOutput = $ this -> getCache ( ) ; if ( $ this -> templateOutput !== false ) { return true ; } } return false ; } | Determine if we can use a cached version of the template and if so fetch it . |
235,830 | public function setCacheKey ( $ key ) { $ key = preg_replace ( '/[^\da-z]/i' , '' , $ key ) ; if ( ! empty ( $ key ) ) { $ this -> cacheKey = $ key ; } } | Manually set a name for the cached file instead of using the md5 of the template name . |
235,831 | public function cacheExists ( ) { $ cacheFile = $ this -> getCacheFile ( ) ; if ( file_exists ( $ cacheFile ) && filemtime ( $ cacheFile ) > ( time ( ) - $ this -> cachePeriod ) ) { return ( true ) ; } else { return ( false ) ; } } | Check whether a cache file exists and is not expired . |
235,832 | protected function setCache ( ) { if ( $ this -> cache ) { $ cacheFile = $ this -> getCacheFile ( ) ; file_put_contents ( $ cacheFile , $ this -> templateOutput ) ; } } | Cache the template if applicable . |
235,833 | private function getCacheFile ( ) { if ( is_null ( $ this -> cachePath ) || ! file_exists ( $ this -> cachePath ) ) { $ this -> error ( 'Invalid Cache Path. ' . $ this -> cachePath ) ; return false ; } $ cacheKey = is_null ( $ this -> cacheKey ) ? md5 ( $ this -> templateFile ) : $ this -> cacheKey ; return ( $ this ->... | Get the name of the file this template should be cached to . Using the supplied key or the md5 of the template name . |
235,834 | public function consume ( $ type = NULL ) { if ( ! $ this -> valid ( ) ) { throw new \ OutOfBoundsException ( 'No more tokens available' ) ; } $ token = $ this -> current ( ) ; if ( $ type !== NULL && ! $ token -> is ( $ type ) ) { throw new \ UnexpectedValueException ( sprintf ( 'Expected token type %s, read "%s" (%d)... | Consume the next token and return it . |
235,835 | public function moveTo ( $ mark ) { if ( is_array ( $ mark ) || $ mark instanceof \ Countable ) { $ this -> index = count ( $ mark ) ; } else { $ this -> index = ( int ) $ mark ; } return $ this ; } | Moves the cursor to the given mark . |
235,836 | public function move ( $ steps ) { if ( is_array ( $ steps ) || $ steps instanceof \ Countable ) { $ this -> index += count ( $ steps ) ; } else { $ this -> index += ( int ) $ steps ; } return $ this ; } | Move the cursor by the given number of steps . |
235,837 | public function moveToNext ( $ type , callable $ callback = NULL ) { $ delim = ( array ) $ type ; while ( $ this -> valid ( ) ) { $ token = $ this -> current ( ) ; if ( $ token -> isOneOf ( $ delim ) ) { return $ token ; } if ( $ callback !== NULL ) { $ callback ( $ token ) ; } $ this -> next ( ) ; } } | Move the cursor to the next occurance if the given token type . |
235,838 | public function readSequence ( array $ allowedTokenTypes ) { $ tokens = [ ] ; while ( $ this -> valid ( ) ) { $ token = $ this -> current ( ) ; if ( ! $ token -> isOneOf ( $ allowedTokenTypes ) ) { break ; } $ tokens [ ] = $ token ; $ this -> next ( ) ; } return $ this -> createTokenSequence ( $ tokens ) ; } | Get a TokenSequence containing only the allowed token types starting from the current position of the cursor . |
235,839 | public function readSequenceToNext ( $ type , $ skipDelimiter = false ) { $ tokens = [ ] ; $ delim = ( array ) $ type ; while ( $ this -> valid ( ) ) { $ token = $ this -> current ( ) ; if ( $ token -> isOneOf ( $ delim ) ) { if ( ! $ skipDelimiter ) { $ tokens [ ] = $ token ; } break ; } $ tokens [ ] = $ token ; $ thi... | Read tokens to the next occurance of the given token type and return a token sequence containing all found tokens . |
235,840 | public function readNextBlock ( $ openingDelimiter , $ closingDelimiter , $ skipDelimiters = true ) { $ od = ( array ) $ openingDelimiter ; $ cd = ( array ) $ closingDelimiter ; $ tokens = [ ] ; $ level = - 1 ; while ( $ this -> valid ( ) && $ level < 0 ) { $ token = $ this -> current ( ) ; if ( $ token -> isOneOf ( $ ... | Reads the next code block enclosed in the given delimiters returns an empty token sequence when no tokens were matched . |
235,841 | protected function loadLocalization ( $ domain , $ path ) { if ( is_textdomain_loaded ( $ domain ) ) { return ; } $ locale = get_locale ( ) ; $ locale = apply_filters ( Localization :: LOCALE_FILTER , $ locale , $ domain ) ; $ mofile = apply_filters ( Localization :: MOFILE_FILTER , sprintf ( '%1$s/%2$s-%3$s.mo' , $ pa... | Load localized strings . |
235,842 | public function get ( $ key ) { $ file = $ this -> cacheDir . $ this -> getDir ( $ key ) . $ this -> getFile ( $ key ) ; if ( file_exists ( $ file ) && is_readable ( $ file ) ) { if ( filemtime ( $ file ) > time ( ) ) { return file_get_contents ( $ file ) ; } } return false ; } | Get a stored value by it s key |
235,843 | public function set ( $ key , $ value , $ expiration = 0 ) { $ file = $ this -> cacheDir . $ this -> getDir ( $ key ) . $ this -> getFile ( $ key ) ; if ( ! file_exists ( dirname ( $ file ) ) ) { mkdir ( dirname ( $ file ) , 0755 , true ) ; } $ return = file_put_contents ( $ file , $ value ) ; touch ( $ file , time ( )... | Stores a value in the cache |
235,844 | protected function getDir ( $ key ) { $ dir = sha1 ( $ key ) ; $ dir = substr ( $ dir , 0 , 3 ) . '/' . substr ( $ dir , 3 , 3 ) . '/' ; return $ dir ; } | Calculates the Directory based on a key |
235,845 | public function flushAllAction ( ) { try { $ this -> getWorker ( ) -> execute ( 'flushAll' ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'Flush ALL executed successfully' ) ; } catch ( \ Exception $ e ) { $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'error' , 'We have encountered an... | Call flush all command for the current instance |
235,846 | public function flushDbAction ( $ id ) { try { $ this -> getWorker ( ) -> flushDB ( $ id ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'Flush DB on ' . $ id . ' executed successfully' ) ; } catch ( \ Exception $ e ) { $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'Une err... | Call flush DB command for the current instance and the current database |
235,847 | protected function setProtocol ( $ statuscode ) { if ( $ _SERVER [ 'SERVER_PROTOCOL' ] == 'HTTP/1.1' || $ statuscode == Response :: SC_CONTINUE || $ statuscode == Response :: SC_SWITCHING_PROTOCOLS || $ statuscode == Response :: SC_TEMPORARY_REDIRECT ) { header ( 'HTTP/1.1 ' . $ statuscode ) ; } elseif ( empty ( $ _SER... | setProtocol all response protocol decisions made here handle the exceptions to rules for protocol 1 . 1 vs 1 . 0 default to 1 . 0 when protocol not specified RFC |
235,848 | public function push ( $ handler ) { if ( ! $ handler ) { return $ this ; } if ( $ this -> next ) { return $ this -> next -> push ( $ handler ) ; } if ( ! $ handler instanceof MiddlewareInterface ) { $ handler = new Middleware ( $ handler ) ; } $ this -> next = $ handler ; return $ this -> next ; } | stack up the middleware . converts normal Application into middleware . |
235,849 | public function getClassifiedImageAddForm ( ) { if ( null === $ this -> classifiedImageAddForm ) { $ this -> classifiedImageAddForm = $ this -> getServiceLocator ( ) -> get ( 'document.form.classifiedimageadd' ) ; } return $ this -> classifiedImageAddForm ; } | Get useradd form |
235,850 | public function create ( array $ parameters , $ className , PropertyMapper $ propertyMapper ) { list ( $ objectStructure , $ propertyPaths ) = $ this -> getNestedStructureForDottedNotation ( $ parameters ) ; $ propertyMappingConfiguration = $ this -> getPropertyMappingConfigurationForPropertyPaths ( $ propertyPaths , $... | Creates a new object based in input parameters and a class name . |
235,851 | public function getPropertyMappingConfigurationForPropertyPaths ( array $ propertyPaths , $ className = '' ) { $ propertyMappingConfiguration = new PropertyMappingConfiguration ( ) ; $ propertyMappingConfiguration -> allowAllProperties ( ) ; $ propertyMappingConfiguration -> setTypeConverterOption ( PersistentObjectCon... | Creates a allow all property mapping configuration for all properties even recursively . |
235,852 | public function getNestedStructureForDottedNotation ( array $ row ) { $ propertyPaths = [ ] ; $ objectStructure = [ ] ; foreach ( $ row as $ key => $ value ) { self :: applyValueProcessors ( $ key , $ value ) ; self :: traverseObjectStructure ( $ objectStructure , $ propertyPaths , $ key , $ value ) ; } return [ $ obje... | The input structure needs to be a key = > value map . Every key should be a dot notation property path every value the corresponding value . |
235,853 | public function rememberLastObjectAs ( $ identifier ) { if ( array_key_exists ( $ identifier , $ this -> rememberedObjects ) ) { throw new \ Exception ( sprintf ( 'The identifier "%s" is already taken' , $ identifier ) , 1480605866 ) ; } if ( ! $ this -> startObjectTracking ) { throw new \ Exception ( 'Object tracking ... | The most recent object created gets remembered by a specific identifier as long as the current scenario runs . |
235,854 | public static function config ( Smarty_Internal_Config $ _config ) { static $ _incompatible_resources = array ( 'eval' => true , 'string' => true , 'extends' => true , 'php' => true ) ; $ config_resource = $ _config -> config_resource ; $ smarty = $ _config -> smarty ; self :: parseResourceName ( $ config_resource , $ ... | initialize Config Source Object for given resource |
235,855 | private function parseComposerLoader ( ) : void { $ map = $ this -> loader -> getPrefixes ( ) ; if ( Any :: isArray ( $ map ) ) { if ( array_key_exists ( 'Apps\\' , $ map ) ) { foreach ( $ map [ 'Apps\\' ] as $ appPath ) { $ this -> appRoots [ ] = $ appPath ; } } if ( array_key_exists ( 'Widgets\\' , $ map ) ) { foreac... | Find app s and widgets root directories over composer psr loader |
235,856 | public function compileBootableClasses ( ) : void { foreach ( $ this -> appRoots as $ app ) { $ app .= '/Apps/Controller/' . env_name ; $ files = File :: listFiles ( $ app , [ '.php' ] , true ) ; foreach ( $ files as $ file ) { $ class = 'Apps\Controller\\' . env_name . '\\' . Str :: cleanExtension ( $ file ) ; if ( cl... | Find all bootatble instances and set it to object map |
235,857 | public function run ( ) : bool { $ this -> startMeasure ( __METHOD__ ) ; if ( ! Any :: isArray ( $ this -> objects ) ) { return false ; } foreach ( $ this -> objects as $ class ) { forward_static_call ( [ $ class , 'boot' ] ) ; } $ this -> stopMeasure ( __METHOD__ ) ; return true ; } | Call bootable methods in apps and widgets |
235,858 | public function generateTable ( BeanInterface $ bean , $ findCondition = "" , $ returnString = false ) { $ this -> loadConfig ( ) ; if ( ( is_array ( $ findCondition ) && ! isset ( $ findCondition [ 'limit' ] ) ) || empty ( $ findCondition ) ) { $ recordLimitOnOnePage = $ this -> getConfigForElement ( $ this -> _table_... | This function generates the table with the Bean and findCondition is passed . |
235,859 | protected function Area ( ) { if ( ! $ this -> area ) { $ this -> area = new Area ( Request :: GetData ( 'area' ) ) ; } return $ this -> area ; } | The area from request |
235,860 | protected function Container ( ) { if ( ! $ this -> container ) { $ this -> container = new Container ( Request :: GetData ( 'container' ) ) ; } return $ this -> container ; } | The container from request |
235,861 | protected function Page ( ) { if ( ! $ this -> page ) { $ this -> page = new Page ( Request :: GetData ( 'page' ) ) ; } return $ this -> page ; } | The page from request |
235,862 | private function ParentItem ( ) { $ this -> parent = $ this -> GetTreeItem ( 'parent' ) ; return $ this -> parent -> Exists ( ) ? $ this -> parent : null ; } | Gets the parent tree item |
235,863 | private function PreviousItem ( ) { $ this -> previous = $ this -> GetTreeItem ( 'previous' ) ; return $ this -> previous -> Exists ( ) ? $ this -> previous : null ; } | The previous item |
235,864 | protected function Location ( ) { if ( $ this -> Container ( ) -> Exists ( ) ) { return Enums \ ContentLocation :: Container ( ) ; } else if ( $ this -> Area ( ) -> Exists ( ) ) { if ( $ this -> Page ( ) -> Exists ( ) ) { return Enums \ ContentLocation :: Page ( ) ; } return Enums \ ContentLocation :: Layout ( ) ; } re... | Gets the content location |
235,865 | private function InitContentRights ( ) { $ beContentRights = null ; if ( $ this -> Content ( ) -> Exists ( ) ) { $ beContentRights = $ this -> Content ( ) -> GetUserGroupRights ( ) ; } $ this -> contentRights = new ContentRights ( $ this -> FindParentRights ( ) , $ beContentRights ) ; } | Initialize the content rights snippet |
235,866 | private function FindParentRights ( ) { $ parentRights = null ; $ parentContent = $ this -> Content ( ) -> Exists ( ) ? ContentTreeUtil :: ParentOf ( $ this -> Content ( ) ) : null ; if ( $ parentContent ) { $ parentRights = RightsFinder :: FindContentRights ( $ parentContent ) ; } if ( ! $ parentRights ) { switch ( $ ... | Finds the parent rights |
235,867 | protected function RenderGroupRights ( ) { if ( ! $ this -> CanAssignGroup ( ) ) { return '' ; } $ result = $ this -> RenderElement ( 'UserGroup' ) ; return $ result . '<div id="group-rights">' . $ this -> contentRights -> Render ( ) . '</div>' ; } | Renders the group rights |
235,868 | private function AddGuestsOnlyField ( ) { $ field = new Checkbox ( 'GuestsOnly' , '1' , ( bool ) $ this -> Content ( ) -> GetGuestsOnly ( ) ) ; $ this -> AddField ( $ field , false , Trans ( 'Core.ContentForm.GuestsOnly' ) ) ; } | Adds the checkbox for guests only visibility of a content |
235,869 | protected function LoadElement ( ) { if ( $ this -> Content ( ) -> Exists ( ) ) { return $ this -> ElementSchema ( ) -> ByContent ( $ this -> Content ( ) ) ; } return $ this -> ElementSchema ( ) -> CreateInstance ( ) ; } | Helper function to retrieve the content element from database |
235,870 | private function SaveContent ( ) { $ this -> Content ( ) -> SetType ( $ this -> FrontendModule ( ) -> MyType ( ) ) ; $ this -> Content ( ) -> SetCssClass ( $ this -> Value ( 'CssClass' ) ) ; $ this -> Content ( ) -> SetCssID ( $ this -> Value ( 'CssID' ) ) ; $ this -> Content ( ) -> SetTemplate ( $ this -> Value ( 'Tem... | Saves content base properties |
235,871 | private function PublishDate ( $ baseName ) { if ( ! $ this -> Content ( ) -> GetPublish ( ) ) { return null ; } $ strDate = $ this -> Value ( $ baseName . 'Date' ) ; if ( ! $ strDate ) { return null ; } $ date = \ DateTime :: createFromFormat ( $ this -> dateFormat , $ strDate ) ; $ date -> setTime ( ( int ) $ this ->... | Gets a publishing date |
235,872 | private function SaveRights ( ) { $ userGroup = Usergroup :: Schema ( ) -> ByID ( $ this -> Value ( 'UserGroup' ) ) ; $ this -> Content ( ) -> SetUserGroup ( $ userGroup ) ; if ( ! $ userGroup ) { $ oldRights = $ this -> Content ( ) -> GetUserGroupRights ( ) ; if ( $ oldRights ) { $ oldRights -> Delete ( ) ; } $ this -... | Saves the content rights and user group |
235,873 | private function AttachContent ( $ isNew ) { switch ( $ this -> Location ( ) ) { case Enums \ ContentLocation :: Layout ( ) : $ this -> AttachLayoutContent ( $ isNew ) ; break ; case Enums \ ContentLocation :: Page ( ) : $ this -> AttachPageContent ( $ isNew ) ; break ; case Enums \ ContentLocation :: Container ( ) : $... | Attaches content to tree item |
235,874 | private function AttachContainerContent ( $ isNew ) { $ provider = new ContainerContentTreeProvider ( $ this -> Container ( ) ) ; $ tree = new TreeBuilder ( $ provider ) ; $ containerContent = $ this -> Content ( ) -> GetContainerContent ( ) ; if ( ! $ containerContent ) { $ containerContent = new ContainerContent ( ) ... | Attaches the content to the container |
235,875 | protected final function AddCssIDField ( ) { $ name = 'CssID' ; $ this -> AddField ( Input :: Text ( $ name , $ this -> Content ( ) -> GetCssID ( ) ) , false , Trans ( "Core.ContentForm.$name" ) ) ; } | Adds the css id form field |
235,876 | protected function AddCacheLifetimeField ( ) { $ name = 'CacheLifetime' ; $ label = "Core.ContentForm.$name" ; $ field = Input :: Text ( $ name , ( string ) ( int ) $ this -> Content ( ) -> GetCacheLifetime ( ) ) ; $ this -> AddField ( $ field , false , Trans ( $ label ) ) ; $ this -> AddValidator ( $ name , Integer ::... | Adds the lifetime field |
235,877 | protected final function AddTemplateField ( ) { $ name = 'Template' ; $ field = new Select ( $ name , ( string ) $ this -> Content ( ) -> GetTemplate ( ) ) ; $ field -> AddOption ( '' , Trans ( "Core.ContentForm.$name.Default" ) ) ; $ folder = PathUtil :: ModuleCustomTemplatesFolder ( $ this -> FrontendModule ( ) ) ; i... | Adds the template select field |
235,878 | protected function BackLink ( ) { $ selected = $ this -> SelectedTreeID ( ) ; switch ( $ this -> Location ( ) ) { case Enums \ ContentLocation :: Page ( ) : return $ this -> PageBackLink ( $ selected ) ; case Enums \ ContentLocation :: Layout ( ) : return $ this -> LayoutBackLink ( $ selected ) ; case Enums \ ContentLo... | The back link url |
235,879 | private function AddWordingFields ( ) { foreach ( $ this -> Wordings ( ) as $ name ) { $ wording = $ this -> FindWording ( $ name ) ; $ fieldName = $ this -> WordingFieldName ( $ name ) ; $ field = Input :: Text ( $ fieldName , $ wording ? $ wording -> GetText ( ) : '' ) ; $ field -> SetHtmlAttribute ( 'placeholder' , ... | Adds the wording fields |
235,880 | private function FindWording ( $ name ) { if ( ! $ this -> Content ( ) -> Exists ( ) ) { return null ; } $ sql = Access :: SqlBuilder ( ) ; $ tblWording = ContentWording :: Schema ( ) -> Table ( ) ; $ where = $ sql -> Equals ( $ tblWording -> Field ( 'Content' ) , $ sql -> Value ( $ this -> Content ( ) -> GetID ( ) ) )... | Finds the wording with the given placeholder name |
235,881 | private static function loopThroughBodyAndCalculatePixels ( BitmapBodyModel $ bitmapBodyModel ) { for ( $ i = 0 ; $ i < $ bitmapBodyModel -> bodySize ; $ i += 3 ) { if ( $ bitmapBodyModel -> x >= $ bitmapBodyModel -> width ) { if ( $ bitmapBodyModel -> usePadding ) { $ i += $ bitmapBodyModel -> width % 4 ; } $ bitmapBo... | Loop through the data in the body of the bitmap file and calculate each individual pixel based on the bytes |
235,882 | public static function imageCreateFromBmp ( $ pathToBitmapFile ) { $ bitmapFileData = self :: getBitmapFileData ( $ pathToBitmapFile ) ; $ temp = unpack ( 'H*' , $ bitmapFileData ) ; $ hex = $ temp [ 1 ] ; $ header = substr ( $ hex , 0 , 108 ) ; list ( $ width , $ height ) = self :: calculateWidthAndHeight ( $ header )... | Create Image resource from Bitmap |
235,883 | public function run ( $ args ) { $ this -> command = $ this -> getCommand ( $ args ) ; if ( NULL == $ this -> command ) { throw new CommandException ( 'Command: ' . $ args [ 1 ] . ' not found' ) ; } $ this -> processArgs ( $ this -> command , $ args ) ; return $ this -> command -> execute ( ) ; } | Runs the requested command . |
235,884 | public function getCommand ( $ args ) { $ class = strtoupper ( substr ( $ args [ 1 ] , 0 , 1 ) ) . substr ( $ args [ 1 ] , 1 ) ; $ class .= 'Command' ; $ command = NULL ; if ( class_exists ( $ class ) ) { $ command = new $ class ( ) ; } if ( NULL === $ command && ! empty ( $ this -> namespaces ) ) { foreach ( $ this ->... | Get the requested command . |
235,885 | public function processArgs ( ICommand & $ command , $ args ) { $ i = 0 ; $ ops = array_slice ( $ args , 2 ) ; while ( $ i < count ( $ ops ) ) { $ o = $ ops [ $ i ] ; if ( Option :: isShortCode ( $ o ) || Option :: isLongCode ( $ o ) ) { $ option = Command :: getOption ( $ command , $ o ) ; if ( $ option -> isRequired ... | Processes the command line arguments and sets the option values for the command . |
235,886 | public function withCellValuesAsField ( IField $ field ) : TableFieldBuilder { return new TableFieldBuilder ( $ this -> fieldBuilder -> type ( new TableType ( $ this -> cellClassName , $ this -> columnField , $ this -> rowField , $ field ) ) ) ; } | Defines the cell values as the supplied field . |
235,887 | public function setTwigGenerator ( TwigGenerator $ twigGenerator ) { $ this -> twigGenerator = $ twigGenerator ; $ this -> twigGenerator -> setTemplateDirs ( array ( __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Templates' ) ) ; $ this -> twigGenerator -> setMustOverwriteIfExists ( true ) ; } | Define the twig generator instance |
235,888 | public function load ( $ resources , $ extension = '' ) { $ finder = new Finder ( ) ; $ collection = array ( ) ; if ( is_array ( $ resources ) ) { foreach ( $ resources as $ resource ) { $ subcollection = array ( ) ; $ subcollection = $ this -> load ( $ resource ) ; $ collection = array_merge ( $ collection , $ subcoll... | Return a collection of files |
235,889 | private function getSaleOrderData ( $ saleId ) { $ entity = $ this -> daoGeneric -> getEntityByPk ( Cfg :: ENTITY_MAGE_SALES_ORDER , [ Cfg :: E_COMMON_A_ENTITY_ID => $ saleId ] , [ Cfg :: E_SALE_ORDER_A_CUSTOMER_ID , Cfg :: E_SALE_ORDER_A_INCREMENT_ID ] ) ; $ custId = $ entity [ Cfg :: E_SALE_ORDER_A_CUSTOMER_ID ] ; $ ... | Get significant attributes of the sale order . |
235,890 | private function getFieldType ( array $ formFieldConfiguration , array $ fieldConfiguration ) { if ( isset ( $ formFieldConfiguration [ 'fieldtype' ] ) ) { return $ formFieldConfiguration [ 'fieldtype' ] ; } $ fieldType = null ; switch ( $ fieldConfiguration [ 'datatype' ] ) { case 'BOOLEAN' : $ fieldType = CheckboxTyp... | Returns the field type for a field . |
235,891 | protected function getFieldOptions ( array $ formFieldConfiguration , array $ fieldConfiguration ) { $ options = array ( 'label' => '' , 'required' => false , 'constraints' => array ( ) , ) ; if ( empty ( $ fieldConfiguration ) ) { $ options [ 'mapped' ] = false ; } if ( isset ( $ fieldConfiguration [ 'label' ] ) ) { $... | Returns the field options for a field . |
235,892 | public function addFieldPlaceholder ( array & $ options , array $ formFieldConfiguration , array $ fieldConfiguration ) { $ fieldType = $ this -> getFieldType ( $ formFieldConfiguration , $ fieldConfiguration ) ; if ( isset ( $ formFieldConfiguration [ 'notices' ] [ 'placeholder' ] ) ) { if ( in_array ( $ fieldType , a... | Adds the placeholder for a field based on the type . |
235,893 | private function addFieldChoiceOptions ( array & $ options , array $ formFieldConfiguration , array $ fieldConfiguration ) { if ( isset ( $ formFieldConfiguration [ 'options' ] ) ) { $ fieldConfiguration [ 'options' ] = $ formFieldConfiguration [ 'options' ] ; } if ( isset ( $ fieldConfiguration [ 'options' ] ) ) { $ o... | Adds the choices option to the field options . |
235,894 | private function addFieldConstraintOptions ( array & $ options , array $ formFieldConfiguration ) { if ( $ options [ 'required' ] === true ) { $ options [ 'constraints' ] [ ] = new NotBlank ( ) ; } if ( isset ( $ formFieldConfiguration [ 'validators' ] ) ) { $ options [ 'constraints' ] = array ( ) ; foreach ( $ formFie... | Adds the constraints option to the field options . |
235,895 | public function setRows ( array $ rows ) { $ this -> rows = $ rows ; $ this -> setKeys ( array_keys ( $ this -> rows [ 0 ] ) ) ; return $ this ; } | Sets the array to be printed |
235,896 | protected function calculateDimensions ( ) { foreach ( $ this -> getRows ( ) as $ x => $ row ) { foreach ( $ row as $ y => $ value ) { $ this -> calculateDimensionsForCell ( $ x , $ y , $ value ) ; } } return $ this ; } | Calculates the dimensions of the table |
235,897 | public function print ( $ row_key ) { $ this -> calculateDimensions ( ) ; $ result = '' ; if ( $ this -> getPrintHeader ( ) ) { $ result .= $ this -> printHeader ( ) ; } else { $ result .= $ this -> printRowLine ( ) ; } if ( ! is_null ( $ row_key ) ) { $ result .= $ this -> printRow ( $ row_key , $ this -> getRows ( ) ... | Prints the data to a text table |
235,898 | static function path_to_url ( $ path ) { $ path = str_replace ( DIRECTORY_SEPARATOR , '/' , $ path ) ; $ abspath = str_replace ( DIRECTORY_SEPARATOR , '/' , ABSPATH ) ; $ url = str_replace ( $ abspath , '' , $ path ) ; return esc_url_raw ( site_url ( $ url ) ) ; } | Convert the given path to a URL . |
235,899 | private function queryToAndExpression ( LuceneQuery $ query ) { $ span = new SpanExpression ( 'AND' ) ; if ( ! $ query -> hasTrivialMainQuery ( ) ) $ span -> addExpression ( $ query -> getMainQuery ( ) ) ; $ span -> addExpressions ( $ query -> getFilterQueries ( ) ) ; return $ span ; } | Convert a query to an AND expression |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.