idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
8,100 | public function renameRelation ( string $ name , string $ new ) : array { if ( ! isset ( $ this -> relations [ $ name ] ) ) { throw new DBException ( "Relation not found" ) ; } if ( isset ( $ this -> relations [ $ new ] ) ) { throw new DBException ( "A relation with that name already exists" ) ; } $ temp = $ this -> re... | Rename a relation |
8,101 | public function onKernelRequest ( GetResponseEvent $ event ) { if ( $ event -> getRequestType ( ) !== HttpKernelInterface :: MASTER_REQUEST ) { return ; } $ request = $ event -> getRequest ( ) ; if ( 1 === intval ( $ request -> query -> get ( 'cms-editor-enable' , 0 ) ) ) { $ this -> editor -> setEnabled ( true ) ; } i... | Kernel request event handler . |
8,102 | public function onKernelResponse ( FilterResponseEvent $ event ) { if ( $ this -> editor -> isEnabled ( ) ) { $ event -> getResponse ( ) -> setSharedMaxAge ( 0 ) -> setMaxAge ( 0 ) -> setExpires ( null ) -> setLastModified ( null ) -> setPrivate ( ) ; } } | Kernel response event . |
8,103 | private function validateEachCanonicalLocaleExists ( array $ config ) { $ canonicals = $ config [ 'canonicals' ] ?? [ ] ; foreach ( $ canonicals as $ locale => $ canonical ) { if ( ! $ this -> existsAsLocale ( $ config [ 'locales' ] , $ locale ) ) { throw new InvalidConfig ( 'Canonical key ' . $ locale . ' is not prese... | Each custom canonical entry should point to an existing locale . |
8,104 | public static function GenerateRandomString ( int $ length = 20 ) { $ characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ; $ charactersLength = strlen ( $ characters ) ; $ randomString = '' ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ randomString .= $ characters [ rand ( 0 , $ charactersL... | Creates a random string |
8,105 | protected function getAssetType ( $ asset , array $ availables , $ type ) { $ type = null === $ type ? $ this -> findAssetType ( $ asset , $ availables ) : $ this -> formatAssetType ( $ type ) ; if ( null !== $ type ) { return $ type ; } throw new InvalidArgumentException ( sprintf ( 'The asset type is required for the... | Get the asset type . |
8,106 | public static function convertLocationCoordinates ( Location $ location ) { $ coordinates = $ location -> getCoordinates ( ) -> getCoordinates ( ) ; $ coordinate = doubleval ( $ coordinates [ 1 ] ) . '%' . doubleval ( $ coordinates [ 0 ] ) ; $ coordinate = strtr ( $ coordinate , [ '%' => ',' , ',' => '.' ] ) ; return $... | Convert Location coordinate into acceptable solr document format |
8,107 | public static function convertSolrDateToPhpDateTime ( $ solrDate ) { $ solrDate = trim ( $ solrDate ) ; $ dateTime = DateTime :: createFromFormat ( Manager :: SOLR_DATE_FORMAT , $ solrDate ) ; $ valid = $ dateTime && ( $ dateTime -> format ( Manager :: SOLR_DATE_FORMAT ) === $ solrDate ) ; if ( ! $ valid ) { throw new ... | Convert Solr date into a PHP DateTime object |
8,108 | public function viewLoginAction ( ) { if ( $ this -> getSecurityContext ( ) -> hasCustomerUser ( ) ) { return $ this -> generateRedirect ( URL :: getInstance ( ) -> getIndexPage ( ) ) ; } return $ this -> render ( "login" ) ; } | Display the register template if no customer logged |
8,109 | public function viewAction ( ) { $ this -> checkAuth ( ) ; $ customer = $ this -> getSecurityContext ( ) -> getCustomerUser ( ) ; $ newsletter = NewsletterQuery :: create ( ) -> findOneByEmail ( $ customer -> getEmail ( ) ) ; $ data = array ( 'id' => $ customer -> getId ( ) , 'title' => $ customer -> getTitleId ( ) , '... | Prepare customer data update . |
8,110 | public function logoutAction ( ) { if ( $ this -> getSecurityContext ( ) -> hasCustomerUser ( ) ) { $ this -> dispatch ( TheliaEvents :: CUSTOMER_LOGOUT ) ; } $ this -> clearRememberMeCookie ( $ this -> getRememberMeCookieName ( ) ) ; return $ this -> generateRedirect ( URL :: getInstance ( ) -> getIndexPage ( ) ) ; } | Perform customer logout . |
8,111 | public function isDescendant ( $ group = null ) { if ( is_numeric ( $ group ) ) { $ group = Group :: factory ( ( int ) $ group ) ; } if ( ! isset ( $ group -> guid ) ) { return false ; } if ( ! isset ( $ this -> parent ) ) { return false ; } if ( $ this -> parent -> is ( $ group ) ) { return true ; } if ( $ this -> par... | Check whether the group is a descendant of a group . |
8,112 | public function getDescendants ( $ andSelf = false ) { $ return = [ ] ; $ entities = Nymph :: getEntities ( [ 'class' => '\Tilmeld\Entities\Group' ] , [ '&' , 'equal' => [ 'enabled' , true ] , 'ref' => [ 'parent' , $ this ] ] ) ; foreach ( $ entities as $ entity ) { $ childArray = $ entity -> getDescendants ( true ) ; ... | Gets an array of the group s descendant groups . |
8,113 | public function getLevel ( ) { $ group = $ this ; $ level = 0 ; while ( isset ( $ group -> parent ) && $ group -> parent -> enabled ) { $ level ++ ; $ group = $ group -> parent ; } return $ level ; } | Get the number of parents the group has . |
8,114 | public function getUsers ( $ descendants = false ) { if ( $ descendants ) { $ groups = $ this -> getDescendants ( ) ; $ or = [ '|' , 'ref' => [ [ 'group' , $ groups ] , [ 'groups' , $ groups ] ] ] ; } else { $ or = null ; } $ groups [ ] = $ this ; $ return = Nymph :: getEntities ( [ 'class' => '\Tilmeld\Entities\User' ... | Gets an array of users in the group . |
8,115 | public function checkGroupname ( ) { if ( Tilmeld :: $ config [ 'email_usernames' ] && $ this -> groupname === $ this -> email ) { return $ this -> checkEmail ( ) ; } if ( empty ( $ this -> groupname ) ) { return [ 'result' => false , 'message' => 'Please specify a groupname.' ] ; } if ( Tilmeld :: $ config [ 'max_user... | Check that a groupname is valid . |
8,116 | public function checkEmail ( ) { if ( $ this -> email === '' ) { return [ 'result' => true , 'message' => '' ] ; } if ( empty ( $ this -> email ) ) { return [ 'result' => false , 'message' => 'Please specify a valid email.' ] ; } if ( ! preg_match ( '/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i' , $ this -> email ) ) { ... | Check that an email is unique . |
8,117 | public function getTime ( ) { $ time = new \ DateTime ( $ this -> data [ 'transaction_date' ] , new \ DateTimeZone ( 'EST' ) ) ; $ time -> setTimezone ( new \ DateTimeZone ( 'UTC' ) ) ; return $ time -> format ( 'c' ) ; } | Get payment time . |
8,118 | public function calculateHash ( ) { $ raw = file_get_contents ( 'php://input' ) ; $ fields = substr ( $ raw , 0 , strpos ( $ raw , '&key=' ) ) ; $ secret = $ this -> request -> getSecret ( ) ; $ supposed_hash = md5 ( $ fields . $ secret ) ; $ kvs = '' ; foreach ( $ this -> data as $ k => $ v ) { if ( $ k !== 'key' && $... | Calculate hash to validate incoming IPN notifications . |
8,119 | public function addTemplateDirectory ( $ templateType , $ templateName , $ templateDirectory , $ key , $ addAtBeginning = false ) { Tlog :: getInstance ( ) -> addDebug ( "Adding template directory $templateDirectory, type:$templateType name:$templateName, key: $key" ) ; if ( true === $ addAtBeginning && isset ( $ this ... | Add a template directory to the current template list |
8,120 | public function getTemplateDirectories ( $ templateType ) { if ( ! isset ( $ this -> templateDirectories [ $ templateType ] ) ) { throw new InvalidArgumentException ( "Failed to get template type %" , $ templateType ) ; } return $ this -> templateDirectories [ $ templateType ] ; } | Return the registered template directories for a given template type |
8,121 | public function pushTemplateDefinition ( TemplateDefinition $ templateDefinition , $ fallbackToDefaultTemplate = false ) { if ( null !== $ this -> templateDefinition ) { array_push ( $ this -> tplStack , [ $ this -> templateDefinition , $ this -> fallbackToDefaultTemplate ] ) ; } $ this -> setTemplateDefinition ( $ tem... | Set a new template definition and save the current one |
8,122 | public function popTemplateDefinition ( ) { if ( count ( $ this -> tplStack ) > 0 ) { list ( $ templateDefinition , $ fallbackToDefaultTemplate ) = array_pop ( $ this -> tplStack ) ; $ this -> setTemplateDefinition ( $ templateDefinition , $ fallbackToDefaultTemplate ) ; } } | Restore the previous stored template definition if one exists . |
8,123 | public function getTemplateDefinition ( $ webAssetTemplateName = false ) { $ ret = clone $ this -> templateDefinition ; if ( false !== $ webAssetTemplateName ) { $ customPath = str_replace ( $ ret -> getName ( ) , $ webAssetTemplateName , $ ret -> getPath ( ) ) ; $ ret -> setName ( $ webAssetTemplateName ) ; $ ret -> s... | Get template definition |
8,124 | protected function internalRenderer ( $ resourceType , $ resourceContent , array $ parameters , $ compressOutput = true ) { if ( $ compressOutput == false ) { $ this -> unregisterFilter ( 'output' , array ( $ this , "trimWhitespaces" ) ) ; } foreach ( $ this -> parserContext as $ var => $ value ) { $ this -> assign ( $... | Return a rendered template either from file or from a string |
8,125 | public function render ( $ realTemplateName , array $ parameters = array ( ) , $ compressOutput = true ) { if ( false === $ this -> templateExists ( $ realTemplateName ) || false === $ this -> checkTemplate ( $ realTemplateName ) ) { throw new ResourceNotFoundException ( Translator :: getInstance ( ) -> trans ( "Templa... | Return a rendered template file |
8,126 | public function renderString ( $ templateText , array $ parameters = array ( ) , $ compressOutput = true ) { return $ this -> internalRenderer ( 'string' , $ templateText , $ parameters , $ compressOutput ) ; } | Return a rendered template text |
8,127 | public function load ( \ Asgard \ Entity \ Definition $ definition ) { $ this -> entityClass = $ definition -> getClass ( ) ; if ( ! $ definition -> has ( 'order_by' ) ) $ definition -> set ( 'order_by' , 'id DESC' ) ; $ definition -> hook ( 'get' , [ $ this , 'hookGet' ] ) ; $ definition -> hook ( 'getTranslations' , ... | Behavior loading . |
8,128 | protected function getDataMapper ( ) { if ( ! $ this -> dataMapper ) $ this -> dataMapper = $ this -> definition -> getContainer ( ) [ 'dataMapper' ] ; return $ this -> dataMapper ; } | Return the datamapper . |
8,129 | public function hookGet ( \ Asgard \ Hook \ Chain $ chain , \ Asgard \ Entity \ Entity $ entity , $ name ) { $ name = strtolower ( $ name ) ; if ( $ this -> getDataMapper ( ) -> hasRelation ( $ this -> definition , $ name ) ) { if ( $ entity -> data [ 'properties' ] [ $ name ] === null ) { $ entity -> set ( $ name , $ ... | Hook for the entity get method . |
8,130 | public function hookgetTranslations ( \ Asgard \ Hook \ Chain $ chain , \ Asgard \ Entity \ Entity $ entity , $ name , $ locale ) { return $ this -> getDataMapper ( ) -> getTranslations ( $ entity , $ locale ) ; } | Hook for the entity translations get method . |
8,131 | public function hookValidation ( \ Asgard \ Hook \ Chain $ chain , \ Asgard \ Entity \ Entity $ entity , \ Asgard \ Validation \ ValidatorInterface $ validator ) { $ this -> getDataMapper ( ) -> prepareValidator ( $ entity , $ validator ) ; } | Hook for the entity validation . |
8,132 | public function staticCatchAll ( $ name , array $ args , & $ processed ) { if ( method_exists ( 'Asgard\Orm\ORM' , $ name ) ) { $ processed = true ; return call_user_func_array ( [ $ this -> getDataMapper ( ) -> orm ( $ this -> entityClass ) , $ name ] , $ args ) ; } } | Catch all static calls . |
8,133 | public function callCatchAll ( $ entity , $ name , $ args , & $ processed ) { if ( $ this -> getDataMapper ( ) -> hasRelation ( $ this -> definition , $ name ) ) { $ processed = true ; return $ this -> getDataMapper ( ) -> related ( $ entity , $ name ) ; } } | Catch all calls . |
8,134 | public function appendChild ( RouteDefinition $ routeDefinition ) { if ( $ routeDefinition -> getPosition ( ) == 0 ) { $ routeDefinition -> setPosition ( count ( $ this -> children ) ) ; } $ seo = $ routeDefinition -> getSeo ( ) ; if ( ! $ this -> seo [ 'follow' ] && $ seo [ 'follow' ] ) { $ seo [ 'follow' ] = false ; ... | Adds a child route definition |
8,135 | public function findChildByRouteName ( $ routeName ) { if ( $ this -> hasChildren ( ) ) { if ( array_key_exists ( $ routeName , $ this -> children ) ) { return $ this -> children [ $ routeName ] ; } foreach ( $ this -> children as $ definition ) { if ( null !== $ child = $ definition -> findChildByRouteName ( $ routeNa... | Returns a child definition |
8,136 | public function sortChildren ( ) { if ( $ this -> hasChildren ( ) ) { foreach ( $ this -> children as $ definition ) { $ definition -> sortChildren ( ) ; } uasort ( $ this -> children , function ( $ a , $ b ) { if ( $ a -> getPosition ( ) == $ b -> getPosition ( ) ) { return 0 ; } return $ a -> getPosition ( ) < $ b ->... | Sorts children definitions by position |
8,137 | public function addConfiguration ( NodeDefinition $ builder ) { $ builder -> children ( ) -> scalarNode ( 'key' ) -> isRequired ( ) -> cannotBeEmpty ( ) -> end ( ) -> scalarNode ( 'secret_key' ) -> isRequired ( ) -> cannotBeEmpty ( ) -> end ( ) -> scalarNode ( 'bucket_name' ) -> isRequired ( ) -> cannotBeEmpty ( ) -> e... | Adds configuration nodes for the factory |
8,138 | public function getBaseData ( ) { $ applicationMenuLinks = MenuLink :: applicationMenuLinks ( ) ; $ cmsMenus = MenuLink :: cmsMenus ( ) ; $ user = Auth :: user ( ) ; $ user -> avatar = $ user -> avatar ( 200 , 200 , true ) ; $ labels = Language :: getlabels ( ) ; $ pluginsConfigs = Plugin :: configs ( ) ; $ logoutLink ... | Get Base data for Vue start . |
8,139 | public function belongsTo ( NodeInterface $ node ) { $ this -> masterNode = $ node ; $ this -> refresh ( ) ; if ( $ node instanceof NodeLeafInterface ) { $ this -> setLeafInterface ( true ) ; } } | Pass the original entity the nested set node belongs to |
8,140 | public function delete ( ) { if ( $ this -> deleted ) { return ; } $ this -> deleted = true ; $ left = $ this -> getLeftValue ( ) ; $ spaceUsed = $ this -> getIntervalSize ( ) + 1 ; $ this -> repository -> delete ( $ this ) ; $ this -> repository -> truncate ( $ left , $ spaceUsed ) ; } | Deletes the current node from the repository |
8,141 | public function getNumberDescendants ( ) { $ intervalSize = $ this -> getIntervalSize ( ) ; $ intervalSize = $ intervalSize - 1 ; if ( $ intervalSize % 2 != 0 ) { $ dump = static :: dump ( $ this ) ; throw new Exception \ InvalidStructure ( "The size of node {$dump} must be odd number, even number received" ) ; } $ des... | Get number of descendants |
8,142 | public function getParent ( ) { if ( ! $ this -> hasParent ( ) ) { return null ; } $ parents = $ this -> getAncestors ( 1 ) ; if ( ! isset ( $ parents [ 0 ] ) ) { $ dump = static :: dump ( $ this ) ; throw new Exception \ InvalidStructure ( "Parent node was not found for {$dump} but must exist" ) ; } $ parent = $ paren... | Get node s parent node |
8,143 | public function getAncestors ( $ levelLimit = 0 , $ includeNode = false ) { $ left = $ this -> getLeftValue ( ) ; $ right = $ this -> getRightValue ( ) ; $ level = $ this -> getLevel ( ) ; $ searchCondition = $ this -> repository -> createSearchCondition ( ) ; $ searchCondition -> leftLessThan ( $ left ) -> rightGreate... | Get array of ancestor nodes starting the deepest element |
8,144 | public function getDescendants ( $ levelLimit = 0 , $ includeNode = false ) { $ left = $ this -> getLeftValue ( ) ; $ right = $ this -> getRightValue ( ) ; $ level = $ this -> getLevel ( ) ; $ searchCondition = $ this -> repository -> createSearchCondition ( ) ; if ( $ includeNode ) { $ searchCondition -> leftGreaterTh... | Get array of descendant nodes |
8,145 | public function getFirstChild ( ) { if ( ! $ this -> hasChildren ( ) ) { return null ; } $ left = $ this -> getLeftValue ( ) + 1 ; $ searchCondition = $ this -> repository -> createSearchCondition ( ) ; $ searchCondition -> leftEqualsTo ( $ left ) ; $ firstChild = $ this -> repository -> search ( $ searchCondition ) ; ... | Get the first node children . Null is returned if it hasn t any . |
8,146 | public function getLastChild ( ) { if ( ! $ this -> hasChildren ( ) ) { return null ; } $ right = $ this -> getRightValue ( ) - 1 ; $ searchCondition = $ this -> repository -> createSearchCondition ( ) -> rightEqualsTo ( $ right ) ; $ lastChild = $ this -> repository -> search ( $ searchCondition ) ; if ( ! isset ( $ l... | Get the last node children . Null is returned if it hasn t any . |
8,147 | public function getNextSibling ( ) { $ left = $ this -> getRightValue ( ) + 1 ; $ searchCondition = $ this -> repository -> createSearchCondition ( ) -> leftEqualsTo ( $ left ) ; $ nextSibling = $ this -> repository -> search ( $ searchCondition ) ; if ( ! isset ( $ nextSibling [ 0 ] ) ) { return null ; } $ nextSibling... | Get next sibling |
8,148 | public function getPrevSibling ( ) { $ right = $ this -> getLeftValue ( ) - 1 ; if ( $ right <= 0 ) { return null ; } $ searchCondition = $ this -> repository -> createSearchCondition ( ) -> rightEqualsTo ( $ right ) ; $ prevSibling = $ this -> repository -> search ( $ searchCondition ) ; if ( ! isset ( $ prevSibling [... | Get previous sibling |
8,149 | public function getSiblings ( $ includeNode = true ) { $ parent = $ this -> getParent ( ) ; $ siblings = null ; if ( ! is_null ( $ parent ) ) { $ siblings = $ parent -> getChildren ( ) ; } else { $ siblings = $ this -> repository -> getRootNodes ( ) ; } if ( ! $ includeNode ) { foreach ( $ siblings as $ key => $ siblin... | Get siblings of the current node |
8,150 | public function moveAsNextSiblingOf ( NodeInterface $ afterNode ) { $ pos = $ afterNode -> getRightValue ( ) + 1 ; $ level = $ afterNode -> getLevel ( ) ; $ this -> move ( $ pos , $ level ) ; return $ this ; } | Move the current node as next sibling of the node passed |
8,151 | public function moveAsPrevSiblingOf ( NodeInterface $ beforeNode ) { $ pos = $ beforeNode -> getLeftValue ( ) ; $ level = $ beforeNode -> getLevel ( ) ; $ this -> move ( $ pos , $ level ) ; return $ this ; } | Move the current node as previous sibling of the node passed |
8,152 | private function validateAddingChildren ( NodeInterface $ parentNode ) { $ allow = true ; if ( $ parentNode instanceof NodeAbstraction ) { if ( $ parentNode -> leafInterface ) { $ allow = false ; } } if ( $ parentNode instanceof NodeLeafInterface ) { $ allow = false ; } if ( ! $ allow ) { $ parentDump = static :: dump ... | Check if children can be added to the node |
8,153 | public function moveAsFirstChildOf ( NodeInterface $ parentNode ) { $ this -> validateAddingChildren ( $ parentNode ) ; $ pos = $ parentNode -> getLeftValue ( ) + 1 ; $ level = $ parentNode -> getLevel ( ) + 1 ; $ this -> move ( $ pos , $ level ) ; return $ this ; } | Move the current node as the first child of the node passed |
8,154 | public function moveAsLastChildOf ( NodeInterface $ parentNode ) { $ this -> validateAddingChildren ( $ parentNode ) ; $ pos = $ parentNode -> getRightValue ( ) ; $ level = $ parentNode -> getLevel ( ) + 1 ; $ this -> move ( $ pos , $ level ) ; return $ this ; } | Move the current node as last child of the node passed |
8,155 | public function isAncestorOf ( NodeInterface $ node ) { if ( $ this -> getLeftValue ( ) < $ node -> getLeftValue ( ) && $ this -> getRightValue ( ) > $ node -> getRightValue ( ) ) { return true ; } return false ; } | If the current node is ancestor of the given node |
8,156 | protected function move ( $ pos , $ level ) { $ validMove = $ this -> validateMove ( $ pos ) ; if ( ! $ validMove ) { return $ this ; } $ levelDiff = $ level - $ this -> getLevel ( ) ; $ this -> repository -> move ( $ this , $ pos , $ levelDiff ) ; return $ this ; } | Inner move function for node |
8,157 | protected function validateMove ( $ pos ) { if ( $ this -> getLeftValue ( ) <= $ pos && $ this -> getRightValue ( ) >= $ pos ) { return false ; } return true ; } | Check if the move is valid block node movement under it s descendants |
8,158 | public static function output ( array $ nodes ) { $ tree = '' ; $ prevNode = null ; $ array = array ( ) ; foreach ( $ nodes as $ item ) { $ leftValue = $ item -> getLeftValue ( ) ; if ( isset ( $ array [ $ leftValue ] ) ) { throw new Exception \ InvalidStructure ( "Two nodes with equal left value '$leftValue' are found... | Debug output of node collection |
8,159 | public static function dump ( NodeInterface $ node ) { $ prefix = str_repeat ( static :: DUMP_PREFIX , $ node -> getLevel ( ) ) ; $ left = $ node -> getLeftValue ( ) ; $ right = $ node -> getRightValue ( ) ; $ level = $ node -> getLevel ( ) ; $ title = $ node -> getNodeTitle ( ) ; $ dumpData = array ( static :: DUMP_PR... | Dump the node data as string |
8,160 | protected function getSignaturesRegexp ( ) { $ signatures = array_map ( 'preg_quote' , array_keys ( $ this -> markupElements ) ) ; $ signaturesRegexp = '(?:' . join ( ')|(?:' , $ signatures ) . ')' ; return $ signaturesRegexp ; } | Returns regular expressiont to be used for matching for knwon signatures . |
8,161 | protected function extractSignature ( $ elementString ) { $ match = array ( ) ; $ regexp = '@\{/?(' . $ this -> getSignaturesRegexp ( ) . ').*?/?\}@ims' ; preg_match ( $ regexp , $ elementString , $ match ) ; if ( empty ( $ match [ 1 ] ) ) { return null ; } return $ match [ 1 ] ; } | Returns element signature from splitted fragment . |
8,162 | protected function oauthCallback ( SS_HTTPRequest $ request ) { OpauthAuthenticator :: opauth ( true , array ( 'strategy' => $ request -> param ( 'Strategy' ) , 'action' => $ request -> param ( 'StrategyMethod' ) , ) ) ; } | This is executed when the Oauth provider redirects back to us Opauth handles everything sent back in this request . |
8,163 | public function finished ( SS_HTTPRequest $ request ) { $ opauth = OpauthAuthenticator :: opauth ( false ) ; $ response = $ this -> getOpauthResponse ( ) ; if ( ! $ response ) { $ response = array ( ) ; } Session :: clear ( 'opauth' ) ; try { $ this -> validateOpauthResponse ( $ opauth , $ response ) ; } catch ( Opauth... | Equivalent to callback . php in the Opauth package . If there is a problem with the response we throw an HTTP error . When done validating we return back to the Authenticator continue auth . |
8,164 | protected function getOpauthResponse ( ) { $ config = OpauthAuthenticator :: get_opauth_config ( ) ; $ transportMethod = $ config [ 'callback_transport' ] ; switch ( $ transportMethod ) { case 'session' : return $ this -> getResponseFromSession ( ) ; case 'get' : case 'post' : return $ this -> getResponseFromRequest ( ... | Returns the response from the Oauth callback . |
8,165 | protected function validateOpauthResponse ( $ opauth , $ response ) { if ( ! empty ( $ response [ 'error' ] ) ) { throw new OpauthValidationException ( 'Oauth provider error' , 1 , $ response [ 'error' ] ) ; } $ this -> requireResponseComponents ( array ( 'auth' , 'timestamp' , 'signature' ) , $ response ) ; $ this -> ... | Validates the Oauth response for Opauth . |
8,166 | protected function requireResponseComponents ( array $ components , $ response ) { foreach ( $ components as $ component ) { if ( empty ( $ response [ $ component ] ) ) { throw new OpauthValidationException ( 'Required component missing' , 2 , $ component ) ; } } } | Shorthand for quickly finding missing components and complaining about it |
8,167 | public function defineMap ( $ name , callable $ map , $ priority = 0 ) { $ this -> areMapsSorted = false ; $ this -> maps [ $ name ] = new PrioritizedMap ( $ map , $ priority , count ( $ this -> maps ) ) ; if ( ! isset ( $ this -> rules [ $ name ] ) ) $ this -> rules [ $ name ] = [ ] ; return $ this ; } | Register a map |
8,168 | public function callbackRule ( callable $ callback , $ expected , $ value , $ priority = 0 ) { $ key = is_string ( $ callback ) ? $ callback : $ this -> getFreeKey ( ) ; $ this -> defineMap ( $ key , $ callback , $ priority ) -> rule ( $ key , $ expected , $ value ) ; return $ this ; } | Create a rule providing directly a callable |
8,169 | public function matchByMapValue ( $ mapName , $ matchingValue , $ fakeValue = null ) { if ( isset ( $ this -> rules [ $ mapName ] [ $ matchingValue ] ) ) return $ this -> rules [ $ mapName ] [ $ matchingValue ] ( $ fakeValue ) ; $ defaultCallback = $ this -> getDefault ( ) ; return $ defaultCallback ( $ fakeValue ) ; } | Retrieve a the return value linked to a map value |
8,170 | private function getFreeKey ( ) { $ index = count ( $ this -> maps ) ; while ( isset ( $ this -> maps [ $ index ] ) ) $ index ++ ; return $ index ; } | Generate a defineMap key not already taken |
8,171 | private function sortMaps ( ) { uasort ( $ this -> activeMaps , function ( PrioritizedMap $ m1 , PrioritizedMap $ m2 ) { if ( $ p = $ m2 -> priority - $ m1 -> priority ) return $ p ; return $ m1 -> priority2 - $ m2 -> priority2 ; } ) ; } | Sort maps by priority . On equal prioriy first inserted wins |
8,172 | private function activateMap ( $ mapName ) { if ( ! isset ( $ this -> activeMaps [ $ mapName ] ) ) $ this -> activeMaps [ $ mapName ] = $ this -> maps [ $ mapName ] ; } | Put a map to the activate map array |
8,173 | protected function loadExternalType ( ) { parent :: loadExternalType ( ) ; $ this -> formTypeClassName = YesNoModelFormItem :: class ; $ this -> tableItemClassName = YesNoModelItem :: class ; $ this -> viewItemClassName = YesNoModelItem :: class ; } | = false ; |
8,174 | protected function prepareTree ( $ results ) { $ hasRoot = false ; $ map = array ( ) ; foreach ( $ results as $ localization ) { $ path = $ localization -> getPathEntity ( ) ; if ( empty ( $ path ) ) { continue ; } $ isActive = $ path -> isActive ( ) && $ localization -> isActive ( ) ; if ( $ isActive ) { $ map [ $ loc... | Prepares tree as array |
8,175 | static function inspect ( Component $ component , $ deep = false ) { if ( self :: $ inspecting ) return '' ; self :: $ inspecting = true ; self :: $ recursionMap = new SplObjectStorage ; ob_start ( ) ; self :: _inspect ( $ component , $ deep ) ; self :: $ inspecting = false ; return "<code>" . ob_get_clean ( ) . "</cod... | Returns a textual representation of the component suitable for debugging purposes . |
8,176 | static function inspectSet ( array $ components = null , $ deep = false , $ nested = false ) { if ( ! $ components || self :: $ inspecting ) return '' ; self :: $ inspecting = true ; self :: $ recursionMap = new SplObjectStorage ; ob_start ( ) ; foreach ( $ components as $ component ) self :: _inspect ( $ component , $... | Inspects the given set of components . |
8,177 | private static function getBindingValue ( $ prop , Component $ component , & $ error ) { $ error = $ l = false ; try { $ l = ob_get_level ( ) ; $ v = $ component -> getComputedPropValue ( $ prop ) ; } catch ( \ Exception $ e ) { $ error = true ; while ( ob_get_level ( ) > $ l ) ob_end_clean ( ) ; return "<b style='colo... | Error - resilient getter for a component s computed property value . |
8,178 | public static function create ( ) { $ builder = NotifireBuilder :: create ( ) ; if ( \ class_exists ( 'Swift_Mailer' ) ) { $ transport = new \ Swift_SmtpTransport ( 'localhost' , 25 ) ; $ mailer = new \ Swift_Mailer ( $ transport ) ; $ handler = new SwiftMailerHandler ( $ mailer , 'default' ) ; if ( \ class_exists ( 'T... | Configuration shortcut to a base library initialization . |
8,179 | protected function beginContent ( ) { if ( isset ( $ this -> tag ) && ! $ this -> tag -> isContentSet ) { echo '>' ; $ this -> tag -> isContentSet = true ; } } | Always call this before outputting any content inside the wrapper tag . |
8,180 | public function deleteAction ( ) { $ this -> checkLock ( ) ; $ this -> isPostRequest ( ) ; $ page = $ this -> getPageLocalization ( ) -> getMaster ( ) ; if ( $ page -> hasChildren ( ) ) { throw new CmsException ( null , "Cannot remove page with children" ) ; } $ entityManager = $ this -> getEntityManager ( ) ; $ entity... | Page delete action . |
8,181 | public function update ( Model \ ContainerInterface $ container , Request $ request ) { return $ this -> editor -> getContainerPlugin ( $ container -> getType ( ) ) -> update ( $ container , $ request ) ; } | Updates the container . |
8,182 | public function delete ( Model \ ContainerInterface $ container ) { if ( $ container -> isAlone ( ) || $ container -> isNamed ( ) || $ container -> isTitled ( ) ) { throw new InvalidOperationException ( "The container can't be removed because it is named or the parent content does not have enough children." ) ; } if ( ... | Deletes the container . |
8,183 | public function moveUp ( Model \ ContainerInterface $ container ) { $ sibling = $ this -> editor -> getRepository ( ) -> findSiblingContainer ( $ container , false ) ; if ( null === $ sibling ) { throw new InvalidOperationException ( "The container can't be moved up as no sibling container has been found." ) ; } $ cont... | Moves the container up . |
8,184 | public function moveDown ( Model \ ContainerInterface $ container ) { $ sibling = $ this -> editor -> getRepository ( ) -> findSiblingContainer ( $ container , true ) ; if ( null === $ sibling ) { throw new InvalidOperationException ( "The container can't be moved down as no sibling container has been found." ) ; } $ c... | Moves the container down . |
8,185 | public function fixRowsPositions ( Model \ ContainerInterface $ container ) { $ this -> sortChildrenByPosition ( $ container , 'rows' ) ; $ rows = $ container -> getRows ( ) ; $ position = 0 ; foreach ( $ rows as $ row ) { $ row -> setPosition ( $ position ) ; $ position ++ ; } return $ this ; } | Fix the rows positions . |
8,186 | protected function checkEmptyLoop ( $ params ) { $ loopName = $ this -> getParam ( $ params , 'rel' ) ; if ( null == $ loopName ) { throw new \ InvalidArgumentException ( $ this -> translator -> trans ( "Missing 'rel' parameter in ifloop/elseloop arguments" ) ) ; } if ( ! isset ( $ this -> loopstack [ $ loopName ] ) ) ... | Check if a loop has returned results . The loop shoud have been executed before or an InvalidArgumentException is thrown |
8,187 | public function fetchHooks ( $ class ) { $ hooks = [ ] ; $ reader = new \ Doctrine \ Common \ Annotations \ SimpleAnnotationReader ( ) ; $ reader -> addNamespace ( 'Asgard\Hook\Annotation' ) ; if ( $ this -> cache ) { $ reader = new \ Doctrine \ Common \ Annotations \ CachedReader ( $ reader , $ this -> cache , $ this ... | Return the hooks of a container . |
8,188 | public function maybe ( $ value , $ subPattern = null ) { return $ this -> add ( $ this -> sanitise ( $ value ) , $ subPattern , '?' ) ; } | Add value or not |
8,189 | public function startOfLine ( ) { if ( false === strpos ( $ this -> prefixes , '^' ) ) { $ this -> prefixes = '^' . $ this -> prefixes ; } return $ this ; } | Add start of line prefix |
8,190 | public function then ( $ value , $ subPattern = null ) { return $ this -> add ( $ this -> sanitise ( $ value ) , $ subPattern ) ; } | Add a sanitised value check |
8,191 | public function anyOf ( $ value , $ subPattern = null ) { return $ this -> add ( '[' . $ this -> sanitise ( $ value ) . ']' , $ subPattern ) ; } | Any of the specified characters |
8,192 | public function range ( $ subPattern = null ) { $ arguments = func_get_args ( ) ; if ( count ( $ arguments ) % 2 === 1 ) { $ subPattern = array_pop ( $ arguments ) ; } else { $ subPattern = null ; } $ value = '[' ; for ( $ fromIndex = 0 ; $ fromIndex < count ( $ arguments ) ; $ fromIndex += 2 ) { $ toIndex = $ fromInde... | Characters in range - requires pairs of arguments provide subPattern as final argument |
8,193 | public function add ( $ expression , $ subPattern = null , $ additionalCharacters = '' ) { $ this -> expression .= $ this -> addBrackets ( $ expression , $ subPattern ) . $ additionalCharacters ; return $ this ; } | Add a regular expression partial |
8,194 | public function multiple ( $ value ) { $ value = $ this -> sanitise ( $ value ) ; switch ( substr ( $ value , - 1 ) ) { case '*' : case '+' : break ; default : $ value .= '+' ; } return $ this -> add ( $ value ) ; } | Shortcut for adding multiples |
8,195 | public function orPipe ( $ value ) { if ( false === strpos ( $ this -> prefixes , '(' ) ) { $ this -> prefixes .= $ this -> generateOpeningBracket ( ) ; } if ( false === strpos ( $ this -> suffixes , ')' ) ) { $ this -> suffixes = ')' . $ this -> suffixes ; } $ this -> add ( ')|' . $ this -> generateOpeningBracket ( ) ... | Add or expression |
8,196 | private function sanitise ( $ value ) { if ( $ value instanceof VerbalExpression ) { return $ value ; } if ( ! is_string ( $ value ) ) { $ value = ( string ) $ value ; } $ regExp = '/[^\w]/' ; return preg_replace_callback ( $ regExp , function ( $ matches ) { return "\\" . $ matches [ 0 ] ; } , $ value ) ; } | Sanitise the added value |
8,197 | private function addBrackets ( $ text , $ subPattern = null ) { if ( $ text instanceof VerbalExpression ) { return $ text -> compile ( ) ; } return $ this -> generateOpeningBracket ( $ subPattern ) . $ text . ')' ; } | Wrap string in brackets |
8,198 | private function generateOpeningBracket ( $ subPattern = null ) { if ( $ subPattern !== true && ( false === $ subPattern || false === $ this -> subPattern ) ) { return '(?:' ; } return '(' ; } | Generate the opening bracket |
8,199 | private function deleteDirectory ( $ slug ) { if ( is_dir ( accioPath ( "resources/lang/" . $ slug ) ) ) { File :: deleteDirectory ( accioPath ( "resources/lang/" . $ slug ) ) ; } if ( is_dir ( base_path ( "resources/lang/" . $ slug ) ) ) { File :: deleteDirectory ( base_path ( "resources/lang/" . $ slug ) ) ; } } | Used te delete language label directories . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.