idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
10,300 | public function setRoles ( Collection $ roles ) { $ this -> roles -> clear ( ) ; foreach ( $ roles as $ role ) { $ this -> roles [ ] = $ role ; } } | Set the list of roles . |
10,301 | public function bootstrap ( ) { $ languageRepository = $ this -> languageManager -> getLanguageRepository ( ) ; $ pageRepository = $ this -> pageManager -> getPageRepository ( ) ; $ blockRepository = $ this -> blockManager -> getBlockRepository ( ) ; $ languageRepository -> startTransaction ( ) ; if ( ! $ this -> remov... | Bootstraps the website |
10,302 | protected function removeActiveLanguages ( LanguageRepositoryInterface $ languageRepository ) { try { $ languages = $ languageRepository -> activeLanguages ( ) ; foreach ( $ languages as $ language ) { $ language -> delete ( ) ; } return true ; } catch ( \ Exception $ ex ) { $ this -> errorMessage = "An error occoured ... | Removes the active languages |
10,303 | protected function removeActivePages ( PageRepositoryInterface $ pageRepository ) { try { $ pages = $ pageRepository -> activePages ( ) ; foreach ( $ pages as $ page ) { $ page -> delete ( ) ; } return true ; } catch ( \ Exception $ ex ) { $ this -> errorMessage = "An error occoured during the removing of existing page... | Removes the active pages |
10,304 | public function getId027Attribute ( $ value ) { $ type = collect ( config ( 'pulsar.dataTypes' ) ) -> keyBy ( 'id' ) [ $ this -> data_type_id_026 ] -> type ; if ( $ type == 'array' ) $ value = explode ( ',' , $ value ) ; else settype ( $ value , $ type ) ; return $ value ; } | Accessor function when call id_026 set cast to value |
10,305 | public function onBeforeAddPageCommit ( BeforeAddPageCommitEvent $ event ) { if ( $ event -> isAborted ( ) ) { return ; } $ pageManager = $ event -> getContentManager ( ) ; $ pageRepository = $ pageManager -> getPageRepository ( ) ; $ values = $ event -> getValues ( ) ; if ( ! is_array ( $ values ) ) { throw new Invali... | Adds the page s seo attributes when a new page is added for each language of the site |
10,306 | public function createLogger ( $ name ) { if ( true === array_key_exists ( $ name , $ this -> _logger ) ) { return $ this -> _logger [ $ name ] ; } $ loggerConfig = $ this -> _getLoggerConfig ( $ name ) ; $ handlers = $ this -> createHandlers ( $ loggerConfig ) ; $ processors = $ this -> createProcessors ( $ loggerConf... | Creates a single Monolog \ Logger object depend on assigned logger name and configuration . Created loggers are cached for multiusage . |
10,307 | public function getFbAppIds ( ) { $ apps = array ( '' => 'Don\'t deploy on Facebook' ) ; $ results = $ this -> getEventManager ( ) -> trigger ( __FUNCTION__ , $ this , array ( 'apps' => $ apps , ) ) -> last ( ) ; if ( $ results ) { $ apps = $ results ; } return $ apps ; } | An event is triggered so that the module PlaygroundFacebook if installed can add the Facebook apps list without adherence between the 2 modules PlaygroundGame and PlaygroundFacebook |
10,308 | public function beforeValidate ( ) { $ this -> reset ( ) ; foreach ( $ this -> relations as $ key => $ relation ) { $ data = is_array ( $ relation ) ? $ relation : [ ] ; $ relation = is_array ( $ relation ) ? $ key : $ relation ; $ ruleLoad = FormHelper :: loadRelation ( $ this -> owner , $ relation , Yii :: $ app -> r... | Validates children models according to their class rules |
10,309 | public function getRelationSavingModels ( $ relation ) { $ result = isset ( $ this -> savingModels [ $ relation ] ) ? $ this -> savingModels [ $ relation ] : $ this -> owner -> $ relation ; return is_array ( $ result ) && ( ! $ this -> owner -> getRelation ( $ relation ) -> multiple ) ? reset ( $ result ) : $ result ; ... | Get either saving post data for related models or models themself |
10,310 | public function getQuery ( ) { $ query = $ this -> database -> getSelectQuery ( ) -> from ( $ this -> table ) ; foreach ( $ this -> join as $ join ) { if ( ! is_array ( $ join [ 2 ] ) ) { $ join [ 2 ] = [ $ join [ 2 ] ] ; } $ where = array_shift ( $ join [ 2 ] ) ; if ( ! empty ( $ join [ 2 ] ) ) { foreach ( $ join [ 2 ... | Builds query based on the data given |
10,311 | public function getTotal ( ) { $ query = $ this -> getQuery ( ) -> select ( 'COUNT(*) as total' ) ; $ rows = $ this -> database -> query ( $ query , $ this -> database -> getBinds ( ) ) ; if ( ! isset ( $ rows [ 0 ] [ 'total' ] ) ) { return 0 ; } return $ rows [ 0 ] [ 'total' ] ; } | Returns the total results |
10,312 | public function onBeforeDeleteLanguageCommit ( BeforeDeleteLanguageCommitEvent $ event ) { if ( $ event -> isAborted ( ) ) { return ; } $ this -> languageManager = $ event -> getContentManager ( ) ; $ languageRepository = $ this -> languageManager -> getLanguageRepository ( ) ; $ this -> sourceObjects = $ this -> setUp... | Listen the onBeforeDeleteLanguageCommit event to delete the source object to the new language |
10,313 | public function getSecretAttribute ( $ value ) { if ( $ value == null ) $ this -> update ( [ 'secret' => $ secret = ( new Hashids ( Hash :: random ( 20 ) , 15 ) ) -> encode ( $ this -> id ) ] ) ; return $ value ?? $ secret ; } | Get api secret |
10,314 | public function getApiKeyAttribute ( $ value ) { if ( $ value == null ) $ this -> update ( [ 'api_key' => $ key = Hash :: random ( 25 ) ] ) ; return $ value ?? $ key ; } | Get api key |
10,315 | public function generatePasswordResetHash ( ) { $ hashProvider = HashProvider :: getProvider ( ) ; $ hash = sha1 ( $ hashProvider -> createHash ( $ this -> UserID . uniqid ( ) , uniqid ( "salt" ) ) ) ; $ this -> PasswordResetHash = $ hash ; $ this -> PasswordResetDate = "now" ; $ this -> save ( ) ; return $ hash ; } | Creates and returns a reset password hash that can be emailed to the user to invite them to reset their password . |
10,316 | private function getSavedPasswordTokenData ( ) { if ( $ this -> isNewRecord ( ) ) { throw new TokenException ( "The user has not been saved" ) ; } return sha1 ( $ this -> Username . $ this -> Password . $ this -> FullName . $ this -> Enabled . $ this -> UserID ) ; } | Returns a unique StringColumn identifying this record in the user table . |
10,317 | public function createToken ( ) { $ hashProvider = HashProvider :: getProvider ( ) ; $ token = $ hashProvider -> createHash ( $ this -> getSavedPasswordTokenData ( ) , sha1 ( $ this -> Password ) ) ; $ this -> Token = $ token ; $ this -> TokenExpiry = date ( "Y-m-d H:i:s" , strtotime ( "+2 weeks" ) ) ; $ this -> save (... | Creates a token for the user which allows for logging in via a cookie . |
10,318 | public function validateToken ( $ token ) { if ( $ this -> Token != $ token ) { return false ; } if ( strtotime ( $ this -> TokenExpiry ) < time ( ) ) { return false ; } $ hashProvider = HashProvider :: getProvider ( ) ; return $ hashProvider -> compareHash ( $ this -> getSavedPasswordTokenData ( ) , $ token ) ; } | Checks that the token supplied is valid for this user . |
10,319 | public function postage ( ) { if ( ! $ this -> hasEstimate ( ) ) { return $ this -> redirect ( $ this -> Link ( "noestimate" ) ) ; } $ config = SiteConfig :: current_site_config ( ) ; $ member = Security :: getCurrentUser ( ) ; $ estimate = $ this -> getEstimate ( ) ; if ( ! $ member && ! $ config -> CheckoutAllowGuest... | Allowing user to select postage |
10,320 | public function complete ( ) { $ session = $ this -> getRequest ( ) -> getSession ( ) ; $ site = SiteConfig :: current_site_config ( ) ; $ id = $ this -> request -> param ( 'ID' ) ; $ error = ( $ id == "error" ) ? true : false ; if ( $ error ) { $ return = [ 'Title' => _t ( 'SilverCommerce\Checkout.OrderProblem' , 'The... | Deal with rendering a completion message to the end user |
10,321 | public function noestimate ( ) { if ( class_exists ( ShoppingCartFactory :: class ) ) { $ shopping_cart = ShoppingCartFactory :: create ( ) -> getCurrent ( ) ; return $ this -> redirect ( $ shopping_cart -> Link ( ) ) ; } $ this -> customise ( [ 'Title' => _t ( 'Checkout.OrderProblem' , 'There was a problem with your o... | Special function to be loaded when no estimate is available |
10,322 | public function CustomerForm ( ) { if ( ! $ this -> hasEstimate ( ) ) { return $ this -> redirect ( $ this -> Link ( "noestimate" ) ) ; } $ session = $ this -> getRequest ( ) -> getSession ( ) ; $ member = Security :: getCurrentUser ( ) ; $ contact = ( $ member ) ? $ member -> Contact ( ) : $ member ; $ form = Customer... | Form to capture the customers details |
10,323 | public function PostageForm ( ) { if ( ! $ this -> hasEstimate ( ) ) { return $ this -> redirect ( $ this -> Link ( "noestimate" ) ) ; } $ estimate = $ this -> getEstimate ( ) ; $ form = PostageForm :: create ( $ this , "PostageForm" , $ estimate , $ estimate -> SubTotal , $ estimate -> TotalWeight , $ estimate -> Tota... | Form to find postage options and allow user to select payment |
10,324 | public function GatewayForm ( ) { if ( ! $ this -> hasEstimate ( ) ) { return $ this -> redirect ( $ this -> Link ( "noestimate" ) ) ; } $ actions = FieldList :: create ( ) ; try { $ payment_methods = GatewayInfo :: getSupportedGateways ( ) ; $ reverse = array_reverse ( $ payment_methods ) ; $ gateway = $ this -> getPa... | Generate a gateway form to select available gateways |
10,325 | public function PaymentForm ( ) { if ( ! $ this -> hasEstimate ( ) ) { return $ this -> redirect ( $ this -> Link ( "noestimate" ) ) ; } $ factory = new GatewayFieldsFactory ( $ this -> getPaymentMethod ( ) ) ; $ form = Form :: create ( $ this , "PaymentForm" , $ factory -> getFields ( ) , FieldList :: create ( FormAct... | Generate a payment form using omnipay scafold |
10,326 | public function doUpdatePayment ( $ data , $ form ) { $ session = $ this -> getRequest ( ) -> getSession ( ) ; $ session -> set ( "Checkout.PaymentMethodID" , $ data [ "PaymentMethodID" ] ) ; return $ this -> redirectBack ( ) ; } | Update the selected payment gateway |
10,327 | protected function fetchEvent ( $ eventName ) { return ( array_key_exists ( $ eventName , $ this -> events ) ) ? $ this -> events [ $ eventName ] : null ; } | Returns the requested event if exists |
10,328 | public function build ( array $ config ) { $ container = new Container ( ) ; foreach ( ( array ) $ config as $ name => $ component ) { if ( ! is_array ( $ component ) || ! array_key_exists ( 'component' , $ component ) ) { $ container -> register ( $ name , $ component ) ; continue ; } $ component = $ this -> applyDefa... | Builds container and component definitions |
10,329 | public function applyDefaults ( $ definition ) { if ( ! is_array ( $ definition ) || ! isset ( $ definition [ 'component' ] ) ) { return $ definition ; } if ( is_callable ( $ definition [ 'component' ] ) ) { return array_merge ( $ this -> callableDefaults , $ definition ) ; } if ( ! isset ( $ definition [ 'component' ]... | Applies default values or missing properties to component definition |
10,330 | public function buildDefinition ( $ definition ) { if ( is_callable ( $ definition ) ) { return $ definition ; } if ( array_key_exists ( 'class' , $ definition ) ) { return new Component ( $ definition [ 'class' ] , $ definition [ 'arguments' ] ? : [ ] , $ definition [ 'calls' ] ? : [ ] ) ; } throw new AppException ( s... | Creates component definition |
10,331 | public function registerDecorator ( $ configKey , $ className ) { if ( isset ( $ this -> decorators [ $ configKey ] ) ) { throw new \ RuntimeException ( 'Decorator key already in use: ' . $ configKey ) ; } if ( in_array ( $ className , $ this -> decorators ) ) { throw new \ RuntimeException ( 'Decorator class already r... | Register a new decorator class |
10,332 | public function unregisterDecorator ( $ configKey ) { if ( ! isset ( $ this -> decorators [ $ configKey ] ) ) { throw new \ RuntimeException ( 'Decorator key not registered: ' . $ configKey ) ; } unset ( $ this -> decorators [ $ configKey ] ) ; } | Un - register a decorator class |
10,333 | private function applyDecorators ( LoggerInterface $ logger , array $ config ) { foreach ( $ this -> decorators as $ configKey => $ decoratorClassName ) { if ( ! isset ( $ config [ $ configKey ] ) ) { continue ; } if ( ! class_exists ( $ decoratorClassName ) ) { throw new \ RuntimeException ( 'Decorator class not found... | Apply any available decorators to the logger if configured |
10,334 | public function toString ( bool $ compact = false ) : string { if ( $ compact ) { return \ bin2hex ( $ this -> value ) ; } return \ vsprintf ( '%s%s-%s-%s-%s-%s%s%s' , \ str_split ( \ bin2hex ( $ this -> value ) , 4 ) ) ; } | Dump the UUID as a string . |
10,335 | public static function sendEmail ( $ data ) { $ data = self :: setTemplate ( $ data ) ; if ( isset ( $ data [ 'html' ] ) && isset ( $ data [ 'text' ] ) ) { Mail :: send ( [ 'pulsar::common.views.html_display' , 'pulsar::common.views.text_display' ] , $ data , function ( $ message ) use ( $ data ) { $ message -> to ( $ ... | Function that send a email |
10,336 | public function previousStep ( $ step = null ) { $ steps = $ this -> getStepsArray ( ) ; $ key = array_search ( $ step , $ steps ) ; if ( is_int ( $ key ) && $ key > 0 ) { return $ steps [ $ key - 1 ] ; } return false ; } | This method returns the previous step in the game workflow |
10,337 | public function nextStep ( $ step = null ) { $ steps = $ this -> getStepsArray ( ) ; $ key = array_search ( $ step , $ steps ) ; if ( is_int ( $ key ) && $ key < count ( $ steps ) - 1 ) { return $ steps [ $ key + 1 ] ; } return false ; } | This method returns the next step in the game workflow |
10,338 | public function getRouteURL ( ) { if ( empty ( $ this -> routeUrl ) ) { $ param = trim ( Server :: get ( 'REQUEST_URI' ) , '/' ) ; $ base_dir = $ this -> getBaseDir ( ) ; $ param = substr ( $ param , strlen ( $ base_dir ) ) ; $ path = trim ( explode ( '?' , $ param ) [ 0 ] , '/' ) ; $ this -> routeUrl = strtolower ( $ ... | Get request route . |
10,339 | public function getBaseDir ( ) { if ( empty ( $ this -> baseDir ) ) { $ this -> baseDir = trim ( str_replace ( 'index.php' , '' , Server :: get ( 'SCRIPT_NAME' ) ) , '/' ) ; } return $ this -> baseDir ; } | Get application base directory . |
10,340 | public function getAppURL ( ) { if ( empty ( $ this -> appURL ) ) { $ hostname = $ this -> getHostname ( ) ; if ( empty ( $ hostname ) ) { $ this -> appURL = config ( 'app.url' ) ; } else { $ protocol = $ this -> getProtocol ( ) ; $ this -> appURL = ( $ protocol ? : 'http' ) . '://' . $ hostname . '/' . $ this -> getBa... | Get application URL . |
10,341 | public function input ( $ key = null , $ default = null ) { if ( $ key ) { return $ this -> get ( $ key , $ default ) ; } else { return $ this -> all ( ) ; } } | Get request parameters |
10,342 | public function hasFile ( $ name ) { if ( isset ( $ _FILES [ $ name ] ) ) { $ file = $ _FILES [ $ name ] ; return isset ( $ file [ 'tmp_name' ] ) && file_exists ( $ file [ 'tmp_name' ] ) && is_uploaded_file ( $ file [ 'tmp_name' ] ) ; } return false ; } | Check if uploaded file exists |
10,343 | public static function createForeignKeyName ( $ table , $ columns , $ refTable ) { $ column = is_array ( $ columns ) ? implode ( '_' , $ columns ) . '_' : '' ; return preg_replace ( '/[^\w_-]/' , '' , "FK_{$table}_{$column}{$refTable}" ) ; } | Names new foreign key by convention . |
10,344 | public static function createIndex ( $ table , $ columns , $ unique = false ) { return Yii :: $ app -> db -> createCommand ( ) -> createIndex ( $ table . '_' . implode ( '-' , ( array ) $ columns ) . '_idx' , $ table , $ columns , $ unique ) -> execute ( ) ; } | Creates index with common name . |
10,345 | public static function addPrimaryKey ( $ table , $ columns ) { return Yii :: $ app -> db -> createCommand ( ) -> addPrimaryKey ( $ table . '_pk' , $ table , $ columns ) -> execute ( ) ; } | Adds PK with common name |
10,346 | public static function toBatchData ( $ data , $ adds = [ ] ) { foreach ( $ data as $ k => $ v ) { $ data [ $ k ] = array_merge ( [ $ v ] , $ adds ) ; } return $ data ; } | Merges array sub - arrays with another array which data is common for all sub - array elements . |
10,347 | public static function insertUpdate ( $ tableName , $ columns , $ data , $ db = 'db' ) { if ( ! $ data ) { return false ; } foreach ( $ data as $ key => $ row ) { $ data [ $ key ] = array_values ( $ row ) ; } $ sql = \ Yii :: $ app -> $ db -> createCommand ( ) -> batchInsert ( $ tableName , $ columns , $ data ) -> getS... | Inserts new data into table or updates on duplicate key . |
10,348 | public static function tableForeignKeys ( $ tableName ) { $ result = [ 'inner' => [ ] , 'outer' => [ ] ] ; foreach ( Yii :: $ app -> db -> schema -> tableSchemas as $ table ) { $ foreignKeys = static :: findConstraints ( $ table ) ; if ( $ table -> name == $ tableName ) { $ result [ 'inner' ] = $ foreignKeys ; continue... | Finds all foreign keys in the table and related to the table column from outer tables . |
10,349 | protected static function getCreateTableSql ( $ table ) { $ db = Yii :: $ app -> db ; $ row = $ db -> createCommand ( 'SHOW CREATE TABLE ' . $ db -> schema -> quoteTableName ( $ table -> fullName ) ) -> queryOne ( ) ; if ( isset ( $ row [ 'Create Table' ] ) ) { $ sql = $ row [ 'Create Table' ] ; } else { $ row = array_... | Gets the CREATE TABLE sql string . |
10,350 | public function receiveEvent ( Event $ event ) : void { $ event -> freeze ( ) ; $ schema = $ event :: schema ( ) ; $ curie = $ schema -> getCurie ( ) ; $ vendor = $ curie -> getVendor ( ) ; $ package = $ curie -> getPackage ( ) ; $ category = $ curie -> getCategory ( ) ; foreach ( $ schema -> getMixinIds ( ) as $ mixin... | Publishes the event to all subscribers using the dispatcher which processes events in memory . If any events throw an exception an EventExecutionFailed event will be published . |
10,351 | public function escape ( $ string ) { if ( ! $ this -> isConnected ( ) ) { $ this -> connect ( ) ; if ( ! $ this -> isConnected ( ) ) return false ; } return $ this -> _escape ( $ string ) ; } | escaping string against sql injection |
10,352 | public function fromRequest ( Request $ request ) { $ pageName = $ request -> get ( 'page' ) ; $ language = $ request -> get ( '_locale' ) ; $ permalink = $ request -> get ( 'permalink' ) ; $ options = array ( "pageName" => $ pageName , "languageName" => $ language , "permalink" => $ permalink , "pageId" => ( int ) $ r... | Initializes the DataManager object from a request |
10,353 | public function fromEntities ( Language $ language = null , Page $ page = null ) { $ this -> language = $ language ; $ this -> page = $ page ; if ( null !== $ this -> language && null !== $ this -> page ) { $ options = array ( "languageId" => $ this -> language -> getId ( ) , "pageId" => $ this -> page -> getId ( ) , )... | Initializes the DataManager object from the database entities |
10,354 | public function fromOptions ( array $ options ) { $ this -> seo = $ this -> setupSeo ( $ options ) ; if ( null !== $ this -> seo ) { $ this -> language = $ this -> seo -> getLanguage ( ) ; $ this -> page = $ this -> seo -> getPage ( ) ; } } | Initializes the DataManager object from and array of options |
10,355 | public function render ( $ sViewName , array $ aViewData = array ( ) ) { $ store = $ this -> store ( ) ; $ sNamespace = $ this -> sNamespace ; $ iSeparatorPosition = strrpos ( $ sViewName , '::' ) ; if ( $ iSeparatorPosition !== false ) { $ sNamespace = substr ( $ sViewName , 0 , $ iSeparatorPosition ) ; } if ( ! key_e... | Render a view using a store |
10,356 | public function getSlotManager ( $ slotName ) { if ( ! is_string ( $ slotName ) ) { return null ; } return ( array_key_exists ( $ slotName , $ this -> slotManagers ) ) ? $ this -> slotManagers [ $ slotName ] : null ; } | Returns the slot manager that matches the given parameter |
10,357 | public function slotToArray ( $ slotName ) { if ( ! is_string ( $ slotName ) ) { throw new InvalidArgumentTypeException ( 'exception_slotToArray_accepts_only_strings' ) ; } if ( ! array_key_exists ( $ slotName , $ this -> slotManagers ) ) { return array ( ) ; } $ slotManager = $ this -> slotManagers [ $ slotName ] ; re... | Returns the slot manager as an array |
10,358 | public function slotsToArray ( ) { $ slotContents = array ( ) ; foreach ( $ this -> slotManagers as $ slotName => $ slot ) { $ slotContents [ $ slotName ] = $ slot -> getBlockManagersCollection ( ) -> toArray ( ) ; } return $ slotContents ; } | Converts slotManagers to an array |
10,359 | public function refresh ( ThemeSlotsInterface $ themeSlots , Template $ template = null , PageBlocksInterface $ pageBlocks = null ) { $ this -> themeSlots = $ themeSlots ; $ this -> template = $ template ; $ this -> pageBlocks = $ pageBlocks ; $ this -> setUpSlotManagers ( ) ; return $ this ; } | Refreshes the TemplateManager |
10,360 | public function populate ( $ idLanguage , $ idPage , $ skipRepeated = false ) { try { $ this -> dispatcher -> dispatch ( Content \ TemplateManagerEvents :: BEFORE_POPULATE , new Content \ TemplateManager \ BeforePopulateEvent ( $ this ) ) ; $ result = false ; $ this -> blockRepository -> startTransaction ( ) ; foreach ... | Populates each slot using the default contents and saves them to the database . |
10,361 | public function clearBlocks ( $ skipRepeated = true ) { try { $ result = null ; $ this -> dispatcher -> dispatch ( Content \ TemplateManagerEvents :: BEFORE_CLEAR_BLOCKS , new Content \ TemplateManager \ BeforeClearBlocksEvent ( $ this ) ) ; $ this -> blockRepository -> startTransaction ( ) ; foreach ( $ this -> slotMa... | Removes the blocks from the whole slot managers managed by the template manager |
10,362 | public function clearPageBlocks ( $ languageId , $ pageId , $ skipRepeated = true ) { try { $ this -> blockRepository -> startTransaction ( ) ; $ pageBlocks = clone ( $ this -> pageBlocks ) ; $ this -> pageBlocks -> refresh ( $ languageId , $ pageId ) ; $ result = $ this -> clearBlocks ( $ skipRepeated ) ; $ this -> pa... | Clear the blocks from the whole slot managers managed by the template manager for a page identified by the required parameters |
10,363 | protected function setUpSlotManagers ( ) { if ( null === $ this -> themeSlots || null === $ this -> template ) { return ; } $ this -> slotManagers = array ( ) ; $ templateSlots = $ this -> template -> getSlots ( ) ; $ themeSlots = $ this -> themeSlots -> getSlots ( ) ; foreach ( $ themeSlots as $ slotName => $ slot ) {... | Creates the slot managers from the current template slot class |
10,364 | protected function createSlotManager ( Slot $ slot ) { $ slotName = $ slot -> getSlotName ( ) ; $ blocks = array ( ) ; if ( null !== $ this -> pageBlocks ) { $ blocks = $ this -> pageBlocks -> getSlotBlocks ( $ slotName ) ; } $ slotManager = new SlotManager ( $ slot , $ this -> blockRepository , $ this -> blockManagerF... | Creates the slot manager for the given slot |
10,365 | private function isIncluded ( $ slotName ) { if ( ! preg_match ( '/^([0-9]+)\-/' , $ slotName , $ matches ) ) { return false ; } $ blockId = $ matches [ 1 ] ; $ slotBlocks = $ this -> pageBlocks -> getBlocks ( ) ; foreach ( $ slotBlocks as $ blocks ) { foreach ( $ blocks as $ block ) { if ( $ block -> getId ( ) == $ bl... | Verifies when the block is included |
10,366 | public function publish ( $ payload , $ routingKey = null , $ deliveryMode = 1 ) { if ( empty ( $ payload ) ) { throw new Exception ( 'publish: payload not set.' ) ; } $ channel = $ this -> connection -> channel ( ) ; $ this -> setupExchange ( $ this -> exchangeOptions [ 'name' ] , $ this -> exchangeOptions [ 'type' ] ... | Publish a message to the message broker system . |
10,367 | public function consume ( $ callback , $ consumeAmount = null ) { $ channel = $ this -> connection -> channel ( ) ; $ this -> setupExchange ( $ this -> exchangeOptions [ 'name' ] , $ this -> exchangeOptions [ 'type' ] , $ channel ) ; foreach ( $ this -> queueOptions as $ queueOption ) { list ( $ channel , ) = $ this ->... | Consume messages from the message broker queue . |
10,368 | public function getAllMessages ( $ callback ) { $ channel = $ this -> connection -> channel ( ) ; $ this -> setupExchange ( $ this -> exchangeOptions [ 'name' ] , $ this -> exchangeOptions [ 'type' ] , $ channel ) ; foreach ( $ this -> queueOptions as $ queueOption ) { list ( $ channel , ) = $ this -> setupQueue ( $ qu... | Consume all messages from the message broker queue . |
10,369 | public function sendAck ( $ payload ) { if ( empty ( $ payload -> delivery_info [ 'delivery_tag' ] ) ) { throw new Exception ( 'sendAck: delivery_tag not set.' ) ; } $ payload -> delivery_info [ 'channel' ] -> basic_ack ( $ payload -> delivery_info [ 'delivery_tag' ] ) ; } | Sends an acknowledgement back to the message broker so the message can be removed from the queue . |
10,370 | public function sendNack ( $ payload , $ purge = false , $ requeue = true ) { if ( empty ( $ payload -> delivery_info [ 'delivery_tag' ] ) ) { throw new Exception ( 'sendNack: delivery_tag not set.' ) ; } $ payload -> delivery_info [ 'channel' ] -> basic_nack ( $ payload -> delivery_info [ 'delivery_tag' ] , $ purge , ... | Sends an non acknowledgement back to the message broker so the message can be rejected or returned to the queue . |
10,371 | public function setupExchange ( $ exchangeName , $ exchangeType , $ channel ) { $ channel -> exchange_declare ( $ exchangeName , $ exchangeType , $ this -> exchangeOptions [ 'passive' ] , $ this -> exchangeOptions [ 'durable' ] , $ this -> exchangeOptions [ 'auto_delete' ] ) ; return $ channel ; } | setupExchange - common create exchange functionality used to ensure exchange settings are the same for both producers and consumers . A producer will never communicate with a queue directly it s always through an exchange . |
10,372 | public function setupQueue ( $ queueName , $ channel ) { foreach ( $ this -> queueOptions as $ queue => $ queueOption ) { if ( $ queueOption [ 'name' ] == $ queueName ) { $ status = $ channel -> queue_declare ( $ queueName , $ queueOption [ 'passive' ] , $ queueOption [ 'durable' ] , $ queueOption [ 'exclusive' ] , $ q... | getQueue - common create queue functionality used to ensure queue settings are the same for both producers and consumers . If the queue already exists the details of the queue will be return . |
10,373 | public function stop ( ) { if ( ! empty ( $ this -> channel ) ) { echo 'Stopping consumer by removing callbacks.' . PHP_EOL ; $ this -> channel -> callbacks = null ; return true ; } else { return false ; } } | Close the channel to the server by removing channel callbacks . |
10,374 | public static function onlineUsers ( $ args ) { $ result = array ( ) ; $ result [ 'logged_in_count' ] = eZFunctionHandler :: execute ( 'user' , 'logged_in_count' , array ( ) ) ; $ result [ 'anonymous_count' ] = eZFunctionHandler :: execute ( 'user' , 'anonymous_count' , array ( ) ) ; return $ result ; } | Returns statistics about users which are currently online |
10,375 | public static function getValidItems ( $ args ) { $ http = eZHTTPTool :: instance ( ) ; $ tpl = eZTemplate :: factory ( ) ; $ result = array ( ) ; $ blockID = $ http -> postVariable ( 'block_id' ) ; $ offset = $ http -> postVariable ( 'offset' ) ; $ limit = $ http -> postVariable ( 'limit' ) ; $ validNodes = eZFlowPool... | Returns block item XHTML |
10,376 | public static function updateblockorder ( $ args ) { $ http = eZHTTPTool :: instance ( ) ; $ contentObjectAttributeID = ( int ) $ http -> postVariable ( 'contentobject_attribute_id' , 0 ) ; $ version = ( int ) $ http -> postVariable ( 'version' , 0 ) ; $ zoneID = $ http -> postVariable ( 'zone' , '' ) ; $ blockOrder = ... | Update blocks order based on AJAX data send after D&D operation is finished |
10,377 | public function getAuthorization ( $ signature , $ string = true ) { Argument :: i ( ) -> test ( 1 , 'string' ) -> test ( 2 , 'bool' ) ; $ params = array ( 'realm' => $ this -> realm , 'oauth_consumer_key' => $ this -> consumerKey , 'oauth_token' => $ this -> requestToken , 'oauth_signature_method' => self :: HMAC_SHA1... | Returns the authorization header string |
10,378 | public function getDomDocumentResponse ( array $ query = array ( ) ) { $ xml = new DOMDocument ( ) ; $ xml -> loadXML ( $ this -> getResponse ( $ query ) ) ; return $ xml ; } | Returns the results parsed as DOMDocument |
10,379 | public function getHmacSha1Signature ( array $ query = array ( ) ) { $ params = array ( 'oauth_consumer_key' => $ this -> consumerKey , 'oauth_token' => $ this -> requestToken , 'oauth_signature_method' => self :: HMAC_SHA1 , 'oauth_timestamp' => $ this -> time , 'oauth_nonce' => $ this -> nonce , 'oauth_version' => se... | Returns the signature |
10,380 | public function getJsonResponse ( array $ query = array ( ) , $ assoc = true ) { Argument :: i ( ) -> test ( 2 , 'bool' ) ; return json_decode ( $ this -> getResponse ( $ query ) , $ assoc ) ; } | Returns the json response from the server |
10,381 | public function getResponse ( array $ query = array ( ) ) { $ headers = $ this -> headers ; $ json = null ; if ( $ this -> json ) { $ json = json_encode ( $ query ) ; $ query = array ( ) ; } $ signature = $ this -> getSignature ( $ query ) ; $ authorization = $ this -> getAuthorization ( $ signature , false ) ; if ( $ ... | Returns the token from the server |
10,382 | public function getSignature ( array $ query = array ( ) ) { switch ( $ this -> signature ) { case self :: HMAC_SHA1 : return $ this -> getHmacSha1Signature ( $ query ) ; case self :: RSA_SHA1 : case self :: PLAIN_TEXT : default : return $ this -> getHmacPlainTextSignature ( ) ; } } | Returns the signature based on what signature method was set |
10,383 | public function setToken ( $ token , $ secret ) { Argument :: i ( ) -> test ( 1 , 'string' ) -> test ( 2 , 'string' ) ; $ this -> requestToken = $ token ; $ this -> requestSecret = $ secret ; return $ this ; } | Sets the request token and secret . This should be set if wanting an access token |
10,384 | protected function initializeCustomer ( array $ attr ) { if ( $ entity = $ this -> loadCustomerByEmailAndWebsiteId ( $ attr [ MemberNames :: EMAIL ] , $ attr [ MemberNames :: WEBSITE_ID ] ) ) { return $ this -> mergeEntity ( $ entity , $ attr ) ; } return $ attr ; } | Initialize the customer with the passed attributes and returns an instance . |
10,385 | public function getGenderByValue ( $ value ) { if ( isset ( $ this -> availableGenders [ $ value ] ) ) { return ( integer ) $ this -> availableGenders [ $ value ] ; } throw new \ Exception ( $ this -> appendExceptionSuffix ( sprintf ( 'Found invalid gender %s' , $ value ) ) ) ; } | Return s the gender ID for the passed value . |
10,386 | public function compile ( ) : string { $ code = 'new \\' . \ get_class ( $ this ) . '(' ; $ code .= \ var_export ( $ this -> namespace , true ) . ', [' ; $ index = 0 ; foreach ( $ this -> imports as $ k => $ v ) { if ( $ index ++ != 0 ) { $ code .= ', ' ; } $ code .= \ var_export ( $ k , true ) . ' => ' . \ var_export ... | Compiles the namespace context into PHP code that creates a new instance of the context . |
10,387 | public function hasImport ( string $ importName ) : bool { return \ array_key_exists ( \ strtolower ( \ trim ( $ importName , '\\' ) ) , $ this -> imports ) ; } | Check if an import for the given name is present . |
10,388 | public function addImport ( string $ importName ) : NamespaceContext { $ importName = \ trim ( $ importName , '\\' ) ; if ( false !== ( $ offset = \ strrpos ( $ importName , '\\' ) ) ) { $ this -> imports [ \ strtolower ( \ substr ( $ importName , $ offset + 1 ) ) ] = $ importName ; } else { $ this -> imports [ \ strto... | Add an import directive to the namespace context the imported type is addressed using the local name . |
10,389 | public function addAliasedImport ( string $ aliasName , string $ importName ) : NamespaceContext { $ this -> imports [ \ strtolower ( \ trim ( $ aliasName ) ) ] = \ trim ( $ importName , '\\' ) ; return $ this ; } | Add an aliased import to the namespace context the imported type or namespace is addressed using the given alias name . |
10,390 | public function lookup ( string $ localType ) : string { $ localType = \ trim ( $ localType ) ; if ( $ localType === '' ) { return $ this -> namespace ; } if ( $ localType [ 0 ] === '\\' ) { return \ trim ( $ localType , '\\' ) ; } $ type = \ strtolower ( $ localType ) ; if ( \ strpos ( $ type , '\\' ) === false ) { if... | Get the fully qualified name of the given local type within the namespace context . |
10,391 | public static function isEnabled ( ) { $ ini = eZINI :: instance ( 'squid.ini' ) ; if ( $ ini -> hasSection ( 'Squid' ) && $ ini -> hasVariable ( 'Squid' , 'PurgeCacheOnPublish' ) && $ ini -> variable ( 'Squid' , 'PurgeCacheOnPublish' ) == 'enabled' ) { return true ; } else { return false ; } } | Checks if Squid pruge cache is enabled for object publish action |
10,392 | public function languageExists ( $ laguageName ) { $ language = $ this -> languageRepository -> fromLanguageName ( $ laguageName ) ; return ( null !== $ language && count ( $ language ) > 0 ) ? true : false ; } | Checks when the given language name exists |
10,393 | public function addField ( Field $ field , Key $ key = null ) { if ( null !== $ key ) { $ field -> setKey ( $ key ) ; } $ this -> fields [ $ field -> getName ( ) ] = $ field ; return $ this ; } | Add field . |
10,394 | public function asInteger ( $ value , $ options = [ ] , $ textOptions = [ ] ) { if ( $ value === null ) { return $ this -> nullDisplay ; } $ value = $ this -> normalizeNumericValue ( $ value ) ; if ( $ this -> _intlLoaded ) { $ f = $ this -> createNumberFormatter ( NumberFormatter :: DECIMAL , null , $ options , $ text... | Formats the value as an integer number by removing any decimal digits without rounding . |
10,395 | protected function normalizeNumericValue ( $ value ) { if ( empty ( $ value ) ) { return 0 ; } if ( is_string ( $ value ) && is_numeric ( $ value ) ) { $ value = ( float ) $ value ; } if ( ! is_numeric ( $ value ) ) { throw new InvalidParamException ( "'$value' is not a numeric value." ) ; } return $ value ; } | Normalizes a numeric input value |
10,396 | public function copy ( $ source , $ destination ) { Eden_Array_Argument :: i ( ) -> test ( 1 , 'string' ) -> test ( 2 , 'string' ) ; $ this -> data [ $ destination ] = $ this -> data [ $ source ] ; return $ this ; } | Copies the value of source key into destination key |
10,397 | public function cut ( $ key ) { Eden_Array_Argument :: i ( ) -> test ( 1 , 'scalar' ) ; if ( ! isset ( $ this -> data [ $ key ] ) ) { return $ this ; } unset ( $ this -> data [ $ key ] ) ; $ this -> data = array_values ( $ this -> data ) ; return $ this ; } | Removes a row in an array and adjusts all the indexes |
10,398 | public function get ( $ modified = true ) { Eden_Array_Argument :: i ( ) -> test ( 1 , 'bool' ) ; return $ modified ? $ this -> data : $ this -> original ; } | Returns the value |
10,399 | public function paste ( $ after , $ value , $ key = null ) { Eden_Array_Argument :: i ( ) -> test ( 1 , 'scalar' ) -> test ( 3 , 'scalar' , 'null' ) ; $ list = array ( ) ; foreach ( $ this -> data as $ i => $ val ) { $ list [ $ i ] = $ val ; if ( $ after != $ i ) { continue ; } if ( ! is_null ( $ key ) ) { $ list [ $ k... | Inserts a row in an array after the given index and adjusts all the indexes |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.