idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
37,800 | protected function _actionRead ( AnCommandContext $ context ) { if ( $ this -> invitetoken ) { $ token = $ this -> getRepository ( ) -> find ( array ( 'value' => $ this -> invitetoken ) ) ; $ this -> getToolbar ( 'menubar' ) -> setTitle ( null ) ; if ( ! $ token || ! isset ( $ token -> inviter ) ) { throw new LibBaseCo... | Token Read . |
37,801 | protected function _actionAdd ( AnCommandContext $ context ) { $ data = $ context -> data ; $ value = AnRequest :: get ( 'session.invite_token' , 'string' , null ) ; if ( empty ( $ data -> value ) || $ value != $ data -> value ) { throw new LibBaseControllerExceptionBadRequest ( 'Invalid token signature' ) ; return ; }... | Store a token for a service . |
37,802 | public function getTemplate ( ) { if ( ! $ this -> _template instanceof LibBaseTemplateAbstract ) { if ( ! ( $ this -> _template instanceof AnServiceIdentifier ) ) { $ this -> setTemplate ( $ this -> _template ) ; } $ config = array ( 'view' => $ this ) ; $ this -> _template = $ this -> getService ( $ this -> _template... | Get the identifier for the template with the same name . |
37,803 | public function setTemplate ( $ template ) { if ( ! ( $ template instanceof LibBaseTemplateAbstract ) ) { if ( is_string ( $ template ) && strpos ( $ template , '.' ) === false ) { $ identifier = clone $ this -> getIdentifier ( ) ; $ identifier -> path = array ( 'template' ) ; $ identifier -> name = $ template ; } else... | Method to set a template object attached to the view . |
37,804 | public static function getMeta ( $ name ) { static $ instances ; if ( ! isset ( $ instances [ $ name ] ) ) { $ app = AnService :: get ( 'repos:settings.app' ) -> find ( array ( 'package' => 'com_' . $ name ) ) ; $ instances [ $ name ] = json_decode ( $ app -> meta ) ; } return $ instances [ $ name ] ; } | Gets the meta object for the app |
37,805 | public function removeOwner ( $ owner ) { if ( ! $ this -> owners -> extract ( $ owner ) ) { $ this -> resetStats ( array ( $ this -> _mixer ) ) ; } } | Remove an owner . |
37,806 | public function resetStats ( array $ entities ) { foreach ( $ entities as $ entity ) { $ ids = $ this -> getService ( 'repos:base.ownership' ) -> getQuery ( ) -> ownable ( $ entity ) -> disableChain ( ) -> fetchValues ( 'owner.id' ) ; $ entity -> set ( 'sharedOwnerCount' , count ( $ ids ) ) ; $ entity -> set ( 'sharedO... | Reset share stats . |
37,807 | public function createCommentStory ( AnCommandContext $ context ) { $ entity = $ context -> comment ; $ parent = $ context -> comment -> parent ; $ owner = $ entity -> author ; if ( $ parent -> isOwnable ( ) ) { $ owner = $ parent -> owner ; } $ data = array ( 'name' => $ parent -> getIdentifier ( ) -> name . '_comment... | Create a story after a comment . |
37,808 | protected function _authorizeAddComment ( $ context ) { if ( isset ( $ this -> _entity -> object ) ) { if ( is_array ( $ this -> _entity -> object ) ) { return false ; } if ( ! $ this -> _entity -> object -> isAuthorizer ( ) ) { return false ; } return $ this -> _entity -> object -> authorize ( 'add.comment' ) ; } else... | Checks if a comment can be added to a story . |
37,809 | protected function _authorizeDeleteComment ( $ context ) { $ comment = $ context -> comment ; if ( $ this -> _viewer -> guest ( ) ) { return false ; } if ( isset ( $ this -> _entity -> object ) ) { if ( is_array ( $ this -> _entity -> object ) ) { return false ; } if ( ! $ this -> _entity -> object -> isAuthorizer ( ) ... | Authoriz deleting a comment . |
37,810 | protected function _actionProcess ( AnCommandContext $ context ) { $ query = $ this -> getService ( 'repos:notifications.notification' ) -> getQuery ( true ) -> status ( ComNotificationsDomainEntityNotification :: STATUS_NOT_SENT ) ; if ( $ this -> id ) { $ ids = ( array ) AnConfig :: unbox ( $ this -> id ) ; $ query -... | Process an array of notifications . |
37,811 | protected function _renderMails ( $ config ) { $ mails = array ( ) ; $ config = new AnConfig ( $ config ) ; $ settings = $ config -> settings ; $ people = $ config -> people ; $ notification = $ config -> notification ; foreach ( $ people as $ person ) { $ setting = $ settings -> { $ person -> id } ; if ( ! $ ret = $ n... | Renders emails for a list of people . |
37,812 | protected function _actionRestore ( $ context ) { $ revision = $ this -> getItem ( ) ; $ article = $ revision -> article ; $ article -> restore ( $ revision ) ; $ msg = AnTranslator :: sprintf ( 'COM-ARTICLES-ARTICLE-REVISIONS-RESTORATION-CONFIRMATION' , $ revision -> revisionNum ) ; $ context -> response -> setRedirec... | Restores an article back to a revision . |
37,813 | public function offsetGet ( $ object ) { if ( ! $ object instanceof AnObjectHandlable ) { throw new InvalidArgumentException ( 'Object needs to implement AnObjectHandlable' ) ; } return $ this -> _object_set -> offsetGet ( $ object -> getHandle ( ) ) ; } | Returns the object from the set |
37,814 | protected function _forward ( $ type , $ callable , $ arguments = array ( ) , $ return = null ) { settype ( $ arguments , 'array' ) ; $ results = array ( ) ; $ is_object = true ; $ is_boolean = true ; foreach ( $ this as $ object ) { if ( $ type == 'method' ) { $ value = call_object_method ( $ object , $ callable , $ a... | Forward a request to all the objects in the object set . |
37,815 | public function input ( $ options = array ( ) ) { $ options = new AnConfig ( $ options ) ; $ options -> append ( array ( 'id' => 'person-password' , 'name' => 'password' , 'class' => 'input-block-level' , 'required' => 'required' , 'minlength' => ComPeopleFilterPassword :: $ MIN_LENGTH , ) ) ; $ html = $ this -> getSer... | Renders a password input with the validation . |
37,816 | public function addError ( $ error ) { if ( is_string ( $ error ) ) { $ error = array ( 'message' => $ error ) ; } if ( is_array ( $ error ) ) { $ error = new AnError ( $ error ) ; } if ( ! isset ( $ this -> _errors [ $ this -> _mixer ] ) ) { $ this -> _errors [ $ this -> _mixer ] = new AnObjectSet ( ) ; } $ this -> _e... | Adds an error object for . |
37,817 | public function getErrors ( ) { if ( ! isset ( $ this -> _errors [ $ this -> _mixer ] ) ) { $ this -> _errors [ $ this -> _mixer ] = new AnObjectSet ( ) ; } return clone $ this -> _errors [ $ this -> _mixer ] ; } | Return a set of entity errors . |
37,818 | public function validateData ( $ property , $ validations = null ) { $ value = $ this -> _mixer -> get ( $ property ) ; $ ret = $ this -> _mixer -> getValidator ( ) -> validateData ( $ this -> _mixer , $ property , $ value , $ validations ) ; return $ ret !== false ; } | Validates an entity properties values using the passed validations . If no validations are passed the properties are validated using their default validations . |
37,819 | public function sanitizeData ( $ property , $ validations = null ) { $ value = $ this -> _mixer -> get ( $ property ) ; $ value = $ this -> _mixer -> getValidator ( ) -> sanitizeData ( $ this -> _mixer , $ property , $ value , $ validations ) ; $ this -> _mixer -> getRepository ( ) -> getCommandChain ( ) -> disable ( )... | Sanitizes an entity properties values using the passed validations . If no validations are passed the properties are validated using their default validations . |
37,820 | public function getValidator ( ) { if ( ! $ this -> _validator instanceof AnDomainValidatorAbstract ) { if ( ! $ this -> _validator instanceof AnServiceIdentifier ) { $ this -> setValidator ( $ this -> _validator ) ; } $ config = array ( 'description' => $ this -> _repository -> getDescription ( ) , ) ; $ this -> _vali... | Return the repository validator . |
37,821 | public function setValidator ( $ validator ) { if ( ! ( $ validator instanceof AnDomainValidatorAbstract ) ) { if ( is_string ( $ validator ) && strpos ( $ validator , '.' ) === false ) { $ identifier = clone $ this -> getIdentifier ( ) ; $ identifier -> path = array ( 'domain' , 'validator' ) ; $ identifier -> name = ... | Method to set the validator . |
37,822 | public function canShareRequest ( ComSharesSharerRequest $ request ) { $ object = $ request -> object ; return $ object -> access == 'public' && ! $ this -> _session -> isReadOnly ( ) ; } | Return whether a boolean . |
37,823 | public function shareRequest ( ComSharesSharerRequest $ request ) { $ ret = false ; if ( $ this -> canShareRequest ( $ request ) ) { $ this -> _session -> postUpdate ( $ request -> object -> body ) ; } } | Shares a request . |
37,824 | public static function getInstance ( ) { static $ _instance ; if ( ! $ _instance ) { $ _instance = new self ( new AnConfig ( array ( 'service_container' => AnService :: getInstance ( ) ) ) ) ; AnService :: set ( 'plg:contentfilter.chain' , $ _instance ) ; AnService :: get ( 'com:plugins.helper' ) -> import ( 'contentfi... | Return the singleton instnace of PlgContentfilterChain . This method also imports all the content filter plugins . |
37,825 | public function filter ( $ text , $ config = array ( ) ) { $ context = $ this -> _chain -> getContext ( ) ; $ context -> data = $ text ; $ context -> config = $ config ; if ( $ context -> config -> filter ) { $ filter = ( array ) AnConfig :: unbox ( $ context -> config -> filter ) ; $ filter [ ] = 'ptag' ; $ context ->... | Alias for the sanitize method . |
37,826 | protected function _sanitize ( $ value ) { if ( $ tidy = $ this -> getTidy ( $ value ) ) { if ( $ tidy -> cleanRepair ( ) ) { $ value = ( string ) $ tidy ; } } return $ value ; } | Sanitize a variable |
37,827 | public function getTidy ( $ string ) { if ( class_exists ( 'Tidy' ) ) { if ( ! $ this -> _tidy ) { $ this -> _tidy = new Tidy ( ) ; } $ this -> _tidy -> parseString ( $ string , $ this -> _config , $ this -> _encoding ) ; } return $ this -> _tidy ; } | Gets a Tidy object |
37,828 | public function substring ( $ text , $ searchword , $ length = 200 ) { $ textlen = AnHelperString :: strlen ( $ text ) ; $ lsearchword = AnHelperString :: strtolower ( $ searchword ) ; $ wordfound = false ; $ pos = 0 ; while ( $ wordfound === false && $ pos < $ textlen ) { if ( ( $ wordpos = @ AnHelperString :: strpos ... | returns substring of characters around a searchword . |
37,829 | public function highlight ( $ text , $ words , $ min = 3 ) { $ words = AnConfig :: unbox ( $ words ) ; settype ( $ words , 'array' ) ; foreach ( $ words as $ word ) { if ( strlen ( $ word ) >= $ min ) { $ text = AnHelperString :: str_ireplace ( $ word , '<span class="an-text-highlight">' . $ word . '</span>' , $ text )... | wraps the provided keywords in a text with span tags containing the highlight css tag . |
37,830 | public function script ( $ text ) { return htmlspecialchars ( $ this -> getService ( 'anahita:filter.string' ) -> sanitize ( AnHelperString :: str_ireplace ( array ( "\r\n" , "\n" ) , '' , $ text ) ) , ENT_QUOTES ) ; } | Return a sanitized version of a text which can be assigned to a javascript variable . |
37,831 | public function parse ( $ url ) { $ this -> _fixUrlForParsing ( $ url ) ; if ( empty ( $ url -> path ) && ! isset ( $ url -> query [ 'option' ] ) ) { $ url -> path = ( get_viewer ( ) -> guest ( ) ) ? 'pages' : 'dashboard' ; } $ segments = explode ( '/' , trim ( $ url -> path , '/' ) ) ; $ segments = array_filter ( $ se... | Parses the URI . |
37,832 | public function build ( & $ url = '' , $ fqr = true ) { if ( is_array ( $ url ) ) { $ url = '?' . http_build_query ( $ url , '' , '&' ) ; } $ url = ( string ) $ url ; if ( strpos ( $ url , 'index.php?' ) === 0 ) { $ url = substr ( $ url , 9 ) ; } elseif ( preg_match ( '%^[^?/]+=%' , $ url ) ) { $ url = '?' . $ url ; } ... | Builds a SEF URL . |
37,833 | public function getComponentRouter ( $ component ) { if ( ! isset ( $ this -> _routers [ $ component ] ) ) { $ identifier = clone $ this -> getIdentifier ( ) ; $ identifier -> path = array ( ) ; $ identifier -> package = str_replace ( 'com_' , '' , $ component ) ; $ identifier -> name = 'router' ; $ this -> _routers [ ... | Returna component router . |
37,834 | protected function _fixUrlForParsing ( $ url ) { $ path = $ url -> path ; if ( $ url -> format == 'php' ) { $ path .= '.php' ; $ url -> format = null ; } $ path = substr_replace ( $ path , '' , 0 , strlen ( $ this -> _base_url -> path ) ) ; $ path = preg_replace ( '/index\/?.php/' , '' , $ path ) ; $ path = trim ( $ pa... | Fixes the url path . |
37,835 | public function setEntityState ( $ entity , $ new ) { $ current = $ this -> getEntityState ( $ entity ) ; if ( $ this -> _state_machine -> stateChanged ( $ entity , $ current , $ new ) === true ) { if ( $ new & AnDomain :: STATE_CLEAN ) { unset ( $ this -> _states [ $ entity ] ) ; } else { $ this -> _states [ $ entity ... | Set an entity state return whether if the state change was succesful . |
37,836 | public function getEntityState ( $ entity ) { if ( isset ( $ this -> _states [ $ entity ] ) ) { return $ this -> _states [ $ entity ] ; } return AnDomain :: STATE_CLEAN ; } | Return an entity state . |
37,837 | public function setSaveOrder ( $ entity1 , $ entity2 ) { $ lower_priority = max ( $ this -> _entities -> getPriority ( $ entity1 ) , $ this -> _entities -> getPriority ( $ entity2 ) ) ; $ higher_priority = min ( $ this -> _entities -> getPriority ( $ entity1 ) , $ this -> _entities -> getPriority ( $ entity2 ) ) ; $ th... | Set the save order . |
37,838 | public function getCommitables ( ) { $ data = array ( ) ; foreach ( $ this -> _entities as $ entity ) { if ( $ entity -> getEntityState ( ) & AnDomain :: STATE_COMMITABLE ) { $ data [ ] = $ entity ; } } return $ data ; } | Return an array of entites that are commitable . |
37,839 | public function insertEntity ( $ entity , $ identifiers = array ( ) ) { if ( ! $ this -> _entities -> getPriority ( $ entity ) ) { $ priority = count ( $ this -> _entities ) ; $ this -> _entities -> enqueue ( $ entity , $ priority ) ; } $ classes = $ entity -> getEntityDescription ( ) -> getUniqueIdentifiers ( ) ; $ de... | Inserts an entity into the identity map . It uses the keys to uniquely identifies an entity . |
37,840 | public function findEntity ( $ description , $ identifiers ) { $ classes = $ description -> getUniqueIdentifiers ( ) ; foreach ( $ classes as $ class ) { foreach ( $ identifiers as $ key => $ value ) { $ property = $ description -> getProperty ( $ key ) ; $ value = $ property -> serialize ( $ value ) ; $ value = implod... | Checks to see if an entity of a class with passed in keys exists in the map . If it exist it will return the entity if not it will return null . |
37,841 | public function getEntities ( $ repository = null ) { return $ repository ? $ this -> _entities -> getRepositoryEntities ( $ repository ) : $ this -> _entities ; } | Return an array of entities . If the repository is set then return entities for the repository . |
37,842 | protected function _actionGet ( AnCommandContext $ context ) { $ this -> _request -> append ( array ( 'layout' => 'default' , ) ) ; $ this -> getCommandChain ( ) -> run ( 'layout.' . $ this -> getRequest ( ) -> get ( 'layout' ) , $ context ) ; if ( $ this -> getRequest ( ) -> get ( 'layout' ) == 'login' && ! $ this -> ... | Renders the sign up view . |
37,843 | protected function _actionPayment ( $ context ) { $ url = route ( 'option=com_subscriptions&view=signup&layout=payment&id=' . $ this -> getItem ( ) -> id ) ; $ context -> response -> setRedirect ( $ url ) ; } | Confirm the payment . |
37,844 | protected function _actionXpayment ( $ context ) { $ data = $ context -> data ; $ package = $ this -> getItem ( ) ; $ gateway = $ this -> getService ( 'com:subscriptions.controller.subscription' ) -> getGateway ( ) ; try { $ payload = $ this -> order -> getPayload ( ) ; $ confirm = route ( 'option=com_subscriptions&vie... | Express Payment . |
37,845 | protected function _actionProcess ( $ context ) { try { $ identifier = 'com:subscriptions.controller.subscription' ; $ subscription = $ this -> getService ( $ identifier ) -> setOrder ( $ this -> order -> cloneEntity ( ) ) -> add ( ) ; } catch ( ComSubscriptionsDomainPaymentException $ exception ) { $ this -> setMessag... | Process Action . |
37,846 | public function validatePayment ( AnCommandContext $ context ) { $ data = $ context -> data ; $ package = $ this -> getItem ( ) ; if ( $ data -> token ) { $ country = null ; $ identifier = 'com:subscriptions.controller.subscription' ; $ method = $ this -> getService ( $ identifier ) -> getGateway ( ) -> getExpressPayme... | Validates before confirm and process . |
37,847 | public function validateUser ( AnCommandContext $ context ) { $ package = $ this -> getItem ( ) ; if ( get_viewer ( ) -> guest ( ) && ! $ this -> person -> validateEntity ( ) ) { $ url = route ( 'option=com_subscriptions&view=signup&layout=login&id=' . $ package -> id ) ; $ context -> response -> setRedirect ( $ url ) ... | Validates a user . |
37,848 | public function execute ( $ name , AnCommandContext $ context ) { $ data = $ context -> data ; $ data -> append ( AnRequest :: get ( 'session.signup' , 'raw' , array ( ) ) ) ; AnRequest :: set ( 'session.signup' , $ data -> toArray ( ) ) ; $ result = parent :: execute ( $ name , $ context ) ; return $ result ; } | Override context . |
37,849 | public function instantiateDataFromSession ( AnCommandContext $ context ) { $ data = $ context -> data ; $ package = $ this -> getItem ( ) ; $ viewer = get_viewer ( ) ; $ this -> order = $ this -> getService ( 'repos:subscriptions.order' ) -> getEntity ( ) -> reset ( ) ; $ this -> order -> setPackage ( $ package , $ vi... | Instantiate Data from the session . |
37,850 | protected function _instantiateCoupon ( AnConfig $ data ) { $ this -> coupon_code = $ data -> coupon_code ; $ this -> coupon = $ this -> getService ( 'repos:subscriptions.coupon' ) -> find ( array ( 'code' => $ this -> coupon_code ) ) ; if ( ! $ this -> coupon ) { $ this -> coupon_code = '' ; } else { $ this -> order -... | Instantiate coupon . |
37,851 | protected function _instantiateContact ( $ data ) { $ data -> append ( array ( 'contact' => new AnConfig ( ) , ) ) ; $ contact = new AnObject ( ) ; $ contact -> set ( array ( 'address' => $ data -> contact -> address , 'city' => $ data -> contact -> city , 'country' => $ data -> contact -> country , 'state' => $ data -... | Instantiate a contact object . |
37,852 | protected function _instantiateCreditCard ( $ data ) { if ( $ data -> token ) { unset ( $ data [ 'creditcard' ] ) ; unset ( $ data [ 'contact' ] ) ; return ; } $ data -> append ( array ( 'creditcard' => new AnConfig ( ) , ) ) ; $ creditcard = $ data -> creditcard ; $ name = trim ( $ creditcard -> name ) ; $ space = AnH... | Instantiate a Merchant_Billing_CreditCard object . |
37,853 | protected function _instantiateUser ( $ data ) { if ( get_viewer ( ) -> guest ( ) ) { $ data -> append ( array ( 'person' => new AnConfig ( ) , ) ) ; $ person_data = array ( 'givenName' => $ data -> person -> givenName , 'familyName' => $ data -> person -> familyName , 'email' => $ data -> person -> email , 'username' ... | Instantiate a ComPeopleDomainEntityPerson object |
37,854 | public function offsetset ( $ key , $ package ) { $ key = $ package -> getVendor ( ) . '/' . $ package -> getName ( ) ; parent :: offsetSet ( $ key , $ package ) ; } | Appens only packages |
37,855 | public function addPackageFromComposerFiles ( $ composers ) { settype ( $ composers , 'array' ) ; foreach ( $ composers as $ file ) { $ data = ( array ) json_decode ( file_get_contents ( $ file ) ) ; if ( isset ( $ data [ 'type' ] ) && $ data [ 'type' ] == 'anahita-extension' ) { if ( ! isset ( $ data [ 'extension-sour... | Adds packages using the a set of composer files |
37,856 | public function getRoute ( $ url = '' , $ fqr = true ) { if ( ! is_array ( $ url ) ) { if ( strpos ( $ url , 'http' ) === 0 ) { return $ url ; } if ( strpos ( $ url , '/' ) === 0 ) { return route ( $ url ) ; } $ url = str_replace ( 'index.php?' , '' , trim ( $ url ) ) ; $ vars = array ( ) ; parse_str ( $ url , $ vars )... | Get a Route for a URL . |
37,857 | public function fetch ( $ query , $ mode ) { $ context = $ this -> getCommandContext ( ) ; $ context -> mode = $ mode ; $ context -> query = $ query ; $ context -> repository = $ query -> getRepository ( ) ; if ( $ this -> getCommandChain ( ) -> run ( 'before.fetch' , $ context ) !== false ) { $ modes = array ( AnDomai... | Fetch a result from a store . |
37,858 | public function insert ( $ repository , $ data ) { $ context = $ this -> getCommandContext ( ) ; $ context -> data = $ data ; $ context -> repository = $ repository ; if ( $ this -> getCommandChain ( ) -> run ( 'before.insert' , $ context ) !== false ) { $ vals = array ( ) ; $ this -> _adapter -> getConnection ( ) -> a... | Inserts an entity into the persistant store . It will return the insertId . |
37,859 | public function execute ( $ query ) { $ context = $ this -> getCommandContext ( ) ; $ context -> query = $ query ; if ( $ this -> getCommandChain ( ) -> run ( 'before.execute' , $ context ) !== false ) { $ context -> result = $ this -> _adapter -> execute ( to_str ( $ context -> query ) ) ; $ this -> getCommandChain ( ... | Executes a query . The execute is ran through the command chain . |
37,860 | public function getColumns ( $ table ) { if ( ! isset ( $ this -> _columns [ $ table ] ) ) { $ fields = $ this -> _adapter -> select ( 'SHOW COLUMNS FROM #__' . $ table , AnDatabase :: FETCH_ARRAY_LIST ) ; static $ column ; $ columns = array ( ) ; foreach ( $ fields as $ field ) { list ( $ type , $ length , $ scope ) =... | Return an array of columns for a resource . |
37,861 | public function quoteValue ( $ value ) { if ( $ value === null ) { return 'NULL' ; } if ( is_numeric ( $ value ) ) { return $ value ; } if ( $ value === false ) { return 0 ; } if ( empty ( $ value ) ) { return '\'\'' ; } if ( is_array ( $ value ) ) { $ values = array_unique ( $ value ) ; foreach ( $ values as $ key => ... | Quote Value . |
37,862 | protected function _parseColumnType ( $ spec ) { $ spec = strtolower ( $ spec ) ; $ type = null ; $ length = null ; $ scope = null ; $ pos = strpos ( $ spec , '(' ) ; if ( $ pos === false ) { $ type = $ spec ; } else { $ type = substr ( $ spec , 0 , $ pos ) ; $ length = trim ( substr ( $ spec , $ pos ) , '()' ) ; if ( ... | Given a raw column specification parse into datatype length and decimal scope . |
37,863 | public function getToolbar ( ) { $ view = $ this -> _template -> getView ( ) ; $ toolbar = $ view -> getState ( ) -> toolbar ; if ( ! $ toolbar ) { $ controller = $ this -> getController ( $ view -> getName ( ) ) ; $ toolbar = $ controller -> getIdentifier ( ) -> name ; if ( $ controller -> hasToolbar ( $ toolbar ) ) {... | Returns a toolbar object of a view . |
37,864 | public function getScopes ( ) { $ scopes = array ( ) ; $ repositories = $ this -> getEntityRepositories ( $ this -> _scope_identifier ) ; foreach ( $ repositories as $ repository ) { $ scopes [ ] = array ( 'repository' => $ repository , 'type' => $ this -> _scope_type ) ; } return $ scopes ; } | Return the nodes scopes . |
37,865 | public function enableCache ( $ enabled = true ) { if ( $ enabled && extension_loaded ( 'apcu' ) ) { $ this -> _cache = true ; } else { $ this -> _cache = false ; } return $ this -> _cache ; } | Enable class caching |
37,866 | protected function _findClass ( $ identifier ) { $ loader = $ this -> getService ( 'anahita:loader' ) ; $ classname = null ; $ classpath = $ identifier -> path ; $ classtype = ! empty ( $ classpath ) ? array_shift ( $ classpath ) : '' ; $ paths = array ( ) ; $ paths [ ] = ucfirst ( $ classtype ) . AnInflector :: cameli... | Find a class . |
37,867 | public function getPortraitFile ( $ size ) { if ( strpos ( $ this -> filename , '/' ) ) { $ filename = str_replace ( '/' , '/avatars/' . $ size , $ this -> filename ) ; } else { $ filename = $ this -> component . '/avatars/' . $ size . $ this -> filename ; } return $ filename ; } | Return the avatar file for a size . |
37,868 | public function resetStats ( $ actors ) { foreach ( $ actors as $ actor ) { if ( $ actor -> isFollowable ( ) ) { $ followerIds = $ actor -> followers -> getQuery ( true , true ) -> fetchValues ( 'id' ) ; $ actor -> set ( 'followerCount' , count ( $ followerIds ) ) ; $ actor -> set ( 'followerIds' , AnDomainAttribute ::... | Reset the all graph information for the actors . |
37,869 | protected function _actionRead ( AnCommandContext $ context ) { $ this -> getService ( 'repos:subscriptions.package' ) ; $ this -> setItem ( $ this -> actor -> subscription ) ; } | Read action . |
37,870 | protected function _layoutProfile ( ) { $ this -> profile = new AnConfig ( ) ; dispatch_plugin ( 'profile.onEdit' , array ( 'actor' => $ this -> _state -> getItem ( ) , 'profile' => $ this -> profile ) ) ; } | Layout Profile . |
37,871 | protected function _layoutPermissions ( ) { $ components = array ( ) ; foreach ( $ this -> _state -> getItem ( ) -> components as $ component ) { $ permissions = array ( ) ; if ( ! $ component -> isAssignable ( ) ) { continue ; } if ( ! count ( $ component -> getPermissions ( ) ) ) { continue ; } foreach ( $ component ... | Layout Privacy . |
37,872 | public function validateEmail ( $ email ) { $ person = $ this -> getService ( 'repos:people.person' ) -> find ( array ( 'email' => $ email ) ) ; if ( $ person ) { $ this -> setMessage ( 'Email is already in use' ) ; return false ; } return true ; } | Validates an email . |
37,873 | public function validateUsername ( $ username ) { $ person = $ this -> getService ( 'repos:people.person' ) -> find ( array ( 'username' => $ username ) ) ; if ( $ person ) { $ this -> setMessage ( 'Username is already in use' ) ; return false ; } return true ; } | Validates a username . |
37,874 | protected function _beforeEntityUpdate ( AnCommandContext $ context ) { if ( $ this -> _mixer -> getModifiedData ( ) -> isDefault ) { $ is_default = $ this -> _mixer -> isDefault === true ; $ query = $ this -> getScopedQuery ( $ context -> entity ) ; if ( $ is_default ) { $ this -> getRepository ( ) -> update ( array (... | Reorder After Update . |
37,875 | public function addAuthorizer ( $ authorizer ) { if ( ! $ authorizer instanceof LibBaseDomainAuthorizerAbstract ) { if ( is_string ( $ authorizer ) && strpos ( $ authorizer , '.' ) === false ) { $ identifier = clone $ this -> _repository -> getIdentifier ( ) ; $ identifier -> path = array ( 'domain' , 'authorizer' ) ; ... | Adds an authorizer . |
37,876 | public function authorize ( $ action , $ config = array ( ) ) { if ( is_string ( $ config ) ) { $ config = array ( $ action => $ config ) ; } $ config = AnConfig :: unbox ( $ config ) ; $ context = $ this -> _mixer -> getRepository ( ) -> getCommandContext ( ) ; $ context -> append ( $ config ) -> append ( array ( 'vie... | Authorize an action and return true or false . |
37,877 | protected function _actionPost ( AnCommandContext $ context ) { $ data = $ context -> data ; $ viewer = get_viewer ( ) ; $ setting = $ this -> getService ( 'repos:notifications.setting' ) -> findOrAddNew ( array ( 'person' => $ viewer , 'actor' => $ this -> actor , ) ) ; $ setting -> setValue ( 'posts' , null , $ data ... | Sets a notification setting . |
37,878 | public function canPost ( ) { $ viewer = get_viewer ( ) ; $ actor = $ this -> actor ; if ( ! $ actor ) { return false ; } if ( $ viewer -> eql ( $ actor ) ) { return false ; } if ( ! $ actor -> isFollowable ( ) ) { return false ; } if ( ! $ actor -> isSubscribable ( ) ) { return false ; } return $ viewer -> following (... | Authorizes a post only if the viewer is already following the owner . |
37,879 | public function link ( $ node , $ query = '' ) { if ( is_array ( $ node ) ) { $ links = array ( ) ; $ nodes = $ node ; foreach ( $ nodes as $ node ) { $ links [ ] = $ this -> link ( $ node , $ query ) ; } return implode ( ', ' , $ links ) ; } return '<a href="' . route ( $ node -> getURL ( ) ) . $ query . '">' . $ node... | Returns an HTML link to a node URL . |
37,880 | private function resetStats ( ) { $ this -> hashtag -> resetStats ( array ( $ this -> hashtag ) ) ; if ( count ( $ this -> hashtag -> tagables ) === 0 ) { $ this -> hashtag -> delete ( ) ; } } | Resets the hashtag . |
37,881 | public function setAssignmentForIdentifier ( $ identifier , $ access = null ) { if ( is_array ( $ identifier ) ) { foreach ( $ identifier as $ identifier => $ access ) { $ this -> setAssignmentForIdentifier ( $ identifier , $ access ) ; } } else { if ( strpos ( $ identifier , '.' ) === false ) { $ identifier = 'com:' .... | Set the assignment for an identifier . |
37,882 | public function getAssignmentForIdentifier ( $ identifier ) { $ assignment = $ this -> assignments -> find ( array ( 'actortype' => ( string ) $ identifier ) ) ; $ access = ( $ assignment ) ? $ assignment -> access : self :: ACCESS_NEVER ; return ( int ) $ access ; } | Return the assignment option . |
37,883 | public function activeForActor ( $ actor ) { $ actortype = $ actor -> getEntityDescription ( ) -> getInheritanceColumnValue ( ) -> getIdentifier ( ) ; $ access = $ this -> getAssignmentForIdentifier ( $ actortype ) ; $ return = false ; if ( $ access == self :: ACCESS_ALWAYS ) { $ return = true ; } elseif ( $ access == ... | Return whether the component is active for actor . A component is active if it has been assigned as awlays for the actor type or it has been enabled for the actor . |
37,884 | final public function execute ( $ action , AnCommandContext $ context ) { $ method = '_' . AnInflector :: variablize ( 'authorize.' . $ action ) ; $ result = self :: AUTH_NOT_IMPLEMENTED ; if ( method_exists ( $ this , $ method ) ) { $ this -> _entity = $ context -> mixer ; $ this -> _viewer = $ context -> viewer ; $ r... | Executes an authorization action with the passed arguments . |
37,885 | protected function _authorizeAction ( AnCommandContext $ context ) { $ method = '_authorize' . ucfirst ( $ context -> action ) ; $ ret = self :: AUTH_NOT_IMPLEMENTED ; if ( method_exists ( $ this , $ method ) ) { $ ret = $ this -> $ method ( $ context -> resource ) ; } elseif ( $ context -> actor ) { if ( $ this -> _en... | Authorizes whether the viewer can pubilsh anything within this component or not . |
37,886 | public function mailInvoice ( AnCommandContext $ context ) { if ( $ this -> getItem ( ) ) { $ mails [ ] = array ( 'to' => $ this -> getItem ( ) -> person -> email , 'subject' => AnTranslator :: _ ( 'COM-SUBSCRIPTIONS-CONFIRMATION-MESSAGE-SUBJECT' ) , 'template' => 'invoice' , ) ; $ this -> mail ( $ mails ) ; } } | Mail an invoice after adding a subscription . |
37,887 | public function setOrder ( $ order ) { $ this -> _order = $ order ; $ this -> _state -> order = $ order ; return $ this ; } | Sets the package . |
37,888 | public function addHashtagsFromBody ( ) { $ entity = $ this -> getItem ( ) ; $ terms = $ this -> extractHashtagTerms ( $ entity -> body ) ; foreach ( $ terms as $ term ) { $ entity -> addHashtag ( trim ( $ term ) ) ; } } | Extracts hashtag terms from the entity body and add them to the item . |
37,889 | public function updateHashtagsFromBody ( AnCommandContext $ context ) { $ entity = $ this -> getItem ( ) ; $ terms = $ this -> extractHashtagTerms ( $ entity -> body ) ; if ( is_array ( $ terms ) ) { foreach ( $ entity -> hashtags as $ hashtag ) { if ( ! in_array ( $ hashtag -> name , array_map ( 'strtolower' , $ terms... | Extracts hashtag terms from the entity body and updates the entity . |
37,890 | public function extractHashtagTerms ( $ text ) { $ matches = array ( ) ; if ( preg_match_all ( ComHashtagsDomainEntityHashtag :: PATTERN_HASHTAG , $ text , $ matches ) ) { return array_unique ( $ matches [ 1 ] ) ; } else { return array ( ) ; } } | extracts a list of hashtag terms from a given text . |
37,891 | public function getCoverSource ( $ size = ComPhotosDomainEntityPhoto :: SIZE_SQUARE ) { $ cover = $ this -> photos -> order ( 'photoSets.ordering' ) -> fetch ( ) ; $ filename = $ cover -> filename ; $ extension = explode ( '.' , $ filename ) ; $ extension = array_pop ( $ extension ) ; $ name = preg_replace ( '#\.[^.]*$... | Obtains the image file source . |
37,892 | public function addPhoto ( $ photo ) { $ photos = AnHelperArray :: getIterator ( $ photo ) ; foreach ( $ photos as $ photo ) { if ( ! $ this -> photos -> find ( $ photo ) ) { $ this -> photos -> insert ( $ photo , array ( 'author' => $ photo -> author , ) ) ; } } } | Adds a photo to a set . |
37,893 | public function removePhoto ( $ photo ) { $ photos = AnHelperArray :: getIterator ( $ photo ) ; foreach ( $ photos as $ photo ) { if ( $ edge = $ this -> photos -> find ( $ photo ) ) { $ edge -> delete ( ) ; } } } | Removes a photo or list of photos from the set . |
37,894 | public function reorder ( $ photo_ids ) { if ( count ( $ photo_ids ) == 1 ) { if ( $ edge = $ this -> getService ( 'repos:photos.edge' ) -> fetch ( array ( 'set' => $ this , 'photo.id' => $ photo_ids [ 0 ] , ) ) ) { $ edge -> ordering = $ this -> photos -> getTotal ( ) ; } return ; } foreach ( $ photo_ids as $ index =>... | Orders the photos in this set . |
37,895 | public function getCallbacks ( $ command ) { $ result = array ( ) ; $ command = strtolower ( $ command ) ; if ( isset ( $ this -> _callbacks [ $ command ] ) ) { $ result = $ this -> _callbacks [ $ command ] ; } return $ result ; } | Get the registered callbacks for a command |
37,896 | public function registerCallback ( $ commands , $ callback , $ params = array ( ) ) { $ commands = ( array ) $ commands ; $ params = ( array ) AnConfig :: unbox ( $ params ) ; foreach ( $ commands as $ command ) { $ command = strtolower ( $ command ) ; if ( ! isset ( $ this -> _callbacks [ $ command ] ) ) { $ this -> _... | Registers a callback function |
37,897 | public function unregisterCallback ( $ commands , $ callback = null ) { $ commands = ( array ) $ commands ; foreach ( $ commands as $ command ) { $ command = strtolower ( $ command ) ; if ( isset ( $ this -> _callbacks [ $ command ] ) ) { if ( $ callback ) { $ key = array_search ( $ callback , $ this -> _callbacks [ $ ... | Unregister a callback function |
37,898 | public static function getInstance ( $ config = null ) { static $ instance ; $ instance = $ instance ? clone $ instance : new self ( ) ; if ( ! $ config ) { $ config = new AnConfig ( ) ; } $ config -> append ( array ( 'date' => gmdate ( 'Y-m-d H:i:s' ) , ) ) ; $ instance -> setDate ( $ config -> date ) ; return $ insta... | Factory Method . |
37,899 | public function setDate ( $ date , $ format = DATE_FORMAT_ISO ) { if ( $ date instanceof AnDate ) { $ this -> copy ( $ date ) ; } elseif ( is_array ( $ date ) || $ date instanceof AnConfig ) { foreach ( $ date as $ key => $ value ) { $ this -> $ key = $ value ; } } else { parent :: setDate ( $ date , $ format ) ; } ret... | Sets the Date s internal date . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.