idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
38,300 | public function loadFile ( $ path ) { $ result = false ; if ( ! in_array ( realpath ( $ path ) , get_included_files ( ) ) && file_exists ( $ path ) ) { $ mask = E_ALL ^ E_WARNING ; if ( defined ( 'E_DEPRECATED' ) ) { $ mask = $ mask ^ E_DEPRECATED ; } $ old = error_reporting ( $ mask ) ; $ included = include $ path ; e... | Load a class based on a path |
38,301 | public function findPath ( AnServiceIdentifier $ identifier ) { $ path = '' ; if ( ! empty ( $ identifier -> path ) ) { $ path .= implode ( '/' , $ identifier -> path ) ; } if ( ! empty ( $ identifier -> name ) ) { $ path .= '/' . $ identifier -> name ; } $ path = $ identifier -> basepath . '/' . $ path . '.php' ; retu... | Get the path based on an identifier . |
38,302 | public function getItem ( $ create = false ) { $ item = $ this -> _mixer -> getState ( ) -> getItem ( ) ; if ( $ item == null && $ this -> _mixer -> getState ( ) -> isUnique ( ) ) { $ item = $ this -> fetchEntity ( new AnCommandContext ( ) ) ; } if ( $ item == null && $ create ) { $ this -> _mixer -> getState ( ) -> se... | Return the controller identifiable item . |
38,303 | public function getRepository ( ) { if ( ! $ this -> _repository instanceof AnDomainRepositoryAbstract ) { if ( ! $ this -> _repository instanceof AnServiceIdentifier ) { $ this -> setRepository ( $ this -> _repository ) ; } $ this -> _repository = AnDomain :: getRepository ( $ this -> _repository ) ; } return $ this -... | Return the controller repository . |
38,304 | public function read ( $ path , $ public = true ) { $ path = $ this -> _relativepath ( $ path , $ public ) ; return $ this -> _read ( $ path ) ; } | Return the content of a path . The boolean value determins whether to look for the path in the public or protected folder . |
38,305 | public function write ( $ path , $ data , $ public = true ) { $ path = $ this -> _relativepath ( $ path , $ public ) ; $ this -> _write ( $ path , $ data , $ public ) ; } | Write data to a path . The boolean value determins whether to look for the path in the public or protected folder . |
38,306 | public function delete ( $ path , $ public = true ) { $ path = $ this -> _relativepath ( $ path , $ public ) ; $ this -> _delete ( $ path ) ; } | Delete the content stored at path . |
38,307 | public function exists ( $ path , $ public = true ) { $ path = $ this -> _relativepath ( $ path , $ public ) ; return $ this -> _exists ( $ path ) ; } | Return whether a path exists or not . |
38,308 | public function getSerilizer ( ) { if ( ! $ this -> _serializer instanceof AnDomainSerializerAbstract ) { if ( ! $ this -> _serializer instanceof AnServiceIdentifier ) { $ this -> setSerializer ( $ this -> _serializer ) ; } $ this -> _serializer = $ this -> getService ( $ this -> _serializer ) ; } return $ this -> _ser... | Return a serializer object . |
38,309 | public function setSerializer ( $ serializer ) { if ( ! $ serializer instanceof AnDomainSerializerAbstract ) { if ( is_string ( $ serializer ) && strpos ( $ serializer , '.' ) === false ) { $ identifier = clone $ this -> _repository -> getIdentifier ( ) ; $ identifier -> path = array ( 'domain' , 'serializer' ) ; $ ide... | Set the serializer . |
38,310 | protected function _afterEntityInsert ( AnCommandContext $ context ) { parent :: _afterEntityInsert ( $ context ) ; if ( $ this -> _send_after_insert ) { $ command = sprintf ( 'php -d max_execution_time=30 %s/index.php %s id=%d >/dev/null 2>&1' , ANPATH_BASE , PROCESSOR_PATH , $ context -> entity -> id ) ; $ result = e... | After Insert command . Called after a notification is inserted . This method tries to send the notification . |
38,311 | public function viewerMenuLinks ( $ actor ) { $ context = new AnCommandContext ( ) ; $ context -> menuItems = new LibBaseTemplateObjectContainer ( ) ; $ context -> actor = $ actor ; $ context -> actor -> components -> registerEventDispatcher ( $ this -> getService ( 'anahita:event.dispatcher' ) ) ; $ this -> getService... | Return the list of enabled app links on an actor s profile . |
38,312 | public function usertypes ( $ options = array ( ) ) { $ viewer = get_viewer ( ) ; $ options = new AnConfig ( $ options ) ; $ options -> append ( array ( 'id' => 'person-userType' , 'selected' => 'registered' , 'name' => 'usertype' , 'class' => 'input-block-level' , ) ) ; $ selected = $ options -> selected ; unset ( $ o... | Displays selector for person usertypes . |
38,313 | public function geocode ( $ address ) { $ gecode = $ this -> _url . 'address=' . urlencode ( $ address ) ; if ( $ this -> _key ) { $ gecode .= '&key=' . $ this -> _key ; } $ data = json_decode ( file_get_contents ( $ gecode ) , true ) ; $ this -> _status = $ data [ 'status' ] ; if ( $ this -> _status === 'OK' ) { $ res... | obtains longitude and latitude values given an address |
38,314 | public function group ( $ notifications ) { $ dates = array ( ) ; $ actor = $ this -> getTemplate ( ) -> getView ( ) -> actor ; $ timezone = pick ( $ actor -> timezone , 0 ) ; foreach ( $ notifications as $ notification ) { $ current = AnDomainAttributeDate :: getInstance ( ) -> addHours ( $ timezone ) ; $ diff = $ cur... | Group a set of notifications by date . |
38,315 | public function loadFramework ( ) { if ( ! defined ( 'ANPATH_BASE' ) ) { $ _composerLoader = $ GLOBALS [ 'composerLoader' ] ; define ( 'ANPATH_BASE' , WWW_ROOT ) ; $ _SERVER [ 'HTTP_HOST' ] = '' ; require_once ( ANPATH_BASE . '/includes/framework.php' ) ; \ AnService :: get ( 'com://site/application.dispatcher' ) -> lo... | Loads the Anahita Framework |
38,316 | public function runCommand ( $ command ) { $ this -> setAutoExit ( false ) ; $ argv = explode ( ' ' , 'application ' . $ command ) ; $ input = new ArgvInput ( $ argv ) ; $ this -> run ( $ input ) ; } | Runs a command . |
38,317 | public function setValue ( $ type , $ value , $ send_email ) { $ filter = $ this -> getService ( 'anahita:filter.cmd' ) ; $ type = $ filter -> sanitize ( $ type ) ; $ value = $ filter -> sanitize ( $ value ) ; settype ( $ send_email , 'boolean' ) ; if ( ! in_range ( $ type , 0 , 2 ) ) { $ type = 1 ; } $ send_email = ( ... | Set a notification value for a notitification type . |
38,318 | public function getValue ( $ type , $ default = null ) { $ ret = $ this -> __call ( 'getValue' , array ( $ type , $ default ) ) ; if ( ! isset ( $ ret [ 'value' ] ) ) { return $ default ; } return $ ret [ 'value' ] ; } | Gets the value of the setting . If the notificaiton type has not been set then NULL value is returned . |
38,319 | public function sendEmail ( $ type , $ default = false ) { $ ret = $ this -> __call ( 'getValue' , array ( $ type ) ) ; if ( ! isset ( $ ret [ 'send_email' ] ) ) { return ( boolean ) $ default ; } return ( boolean ) $ ret [ 'send_email' ] ; } | Returns whether the setting should send an email for a notification or not for a notification type . |
38,320 | protected function _actionLead ( AnCommandContext $ context ) { if ( $ this -> getItem ( ) -> eql ( $ this -> actor ) ) { throw new LibBaseControllerExceptionForbidden ( 'Forbidden' ) ; } $ this -> getResponse ( ) -> status = AnHttpResponse :: RESET_CONTENT ; if ( ! $ this -> getItem ( ) -> following ( $ this -> actor ... | Add a leader to this actor . |
38,321 | protected function _actionUnlead ( AnCommandContext $ context ) { $ this -> getResponse ( ) -> status = AnHttpResponse :: RESET_CONTENT ; $ this -> getItem ( ) -> removeLeader ( $ this -> actor ) ; return $ this -> getItem ( ) ; } | Remove a leader from this actor . |
38,322 | protected function _actionBlock ( AnCommandContext $ context ) { $ this -> getResponse ( ) -> status = AnHttpResponse :: RESET_CONTENT ; $ this -> getItem ( ) -> addBlocker ( $ this -> actor ) ; return $ this -> getItem ( ) ; } | The viewers blocks the actor . |
38,323 | protected function _actionUnblock ( $ context ) { $ this -> getResponse ( ) -> status = AnHttpResponse :: RESET_CONTENT ; $ this -> getItem ( ) -> removeBlocker ( $ this -> actor ) ; return $ this -> getItem ( ) ; } | The viewers unblocks the actor . |
38,324 | protected function _actionGetgraph ( AnCommandContext $ context ) { $ this -> getState ( ) -> insert ( 'type' , 'followers' ) ; $ filters = array ( ) ; $ entities = array ( ) ; $ entity = $ this -> getItem ( ) ; $ viewer = get_viewer ( ) ; if ( $ this -> getItem ( ) -> isFollowable ( ) ) { if ( $ this -> type == 'follo... | Read Owner s Socialgraph . |
38,325 | public function getActor ( AnCommandContext $ context ) { $ data = $ context -> data ; if ( $ data -> actor ) { $ ret = $ this -> getService ( 'repos:actors.actor' ) -> fetch ( $ data -> actor ) ; } else { $ ret = get_viewer ( ) ; } $ this -> actor = $ ret ; return $ this -> actor ; } | Set the subejct before perform graph actions . |
38,326 | public function read ( & $ text ) { if ( preg_match_all ( '#@template\(\'(.*)\'#siU' , $ text , $ matches ) ) { foreach ( $ matches [ 1 ] as $ key => $ match ) { if ( is_string ( $ match ) && strpos ( $ match , '.' ) === false ) { $ path = dirname ( $ this -> getTemplate ( ) -> getPath ( ) ) . DS . $ match . '.php' ; $... | Replace template alias with loadFile functions . |
38,327 | public function display ( ) { $ this -> output = $ this -> content ; if ( $ this -> content instanceof Exception ) { $ data = array ( ) ; $ data [ 'code' ] = $ this -> content -> getCode ( ) ; $ data [ 'message' ] = ( string ) $ this -> content -> getMessage ( ) ; if ( $ this -> content instanceof AnErrorException ) { ... | Just return the content . |
38,328 | protected function _toData ( $ errors ) { $ data = array ( ) ; foreach ( $ errors as $ error ) { if ( $ error instanceof Exception ) { $ data [ ] = array ( 'code' => $ error -> getCode ( ) , 'message' => $ error -> getMessage ( ) ) ; } elseif ( $ error instanceof AnError ) { $ data [ ] = $ error -> toArray ( ) ; } } re... | Converts an array of error into an array of serializable data . |
38,329 | protected function _render ( $ story , $ paths , $ data ) { settype ( $ paths , 'array' ) ; foreach ( $ paths as $ path ) { if ( $ this -> _template -> findFile ( $ path ) ) { return $ this -> _template -> loadFile ( $ path , $ data ) -> render ( ) ; } } try { return $ this -> _template -> loadTemplate ( $ story -> nam... | Renders a story . |
38,330 | protected function _parseData ( $ data ) { $ output = array ( 'title' => '' , 'body' => '' ) ; $ matches = array ( ) ; if ( preg_match_all ( '#<data name="([^"]+)">(.*?)<\/data>#si' , $ data , $ matches ) ) { $ attributes = $ matches [ 1 ] ; $ contents = $ matches [ 2 ] ; foreach ( $ attributes as $ i => $ attribute ) ... | Parse the title body from data . |
38,331 | public function update ( $ query ) { $ resources = $ query -> getRepository ( ) -> getResources ( ) ; foreach ( $ resources as $ resource ) { $ names [ ] = $ query -> getPrefix ( ) . $ resource -> getName ( ) . ' AS ' . $ this -> _store -> quoteName ( $ resource -> getAlias ( ) ) ; if ( ! empty ( $ query -> order ) ) {... | Builds an update query . |
38,332 | public function delete ( $ query ) { $ resources = $ query -> getRepository ( ) -> getResources ( ) ; foreach ( $ resources -> getLinks ( ) as $ link ) { $ query -> where ( $ link -> child , '=' , $ link -> parent ) ; } $ names = array ( ) ; foreach ( $ resources as $ resource ) { $ query -> from ( $ resource -> getNam... | Builds an delete query . Handles multiple resources at once . |
38,333 | public function join ( $ query ) { $ clause = '' ; $ repository = $ query -> getRepository ( ) ; $ resources = $ repository -> getResources ( ) ; $ links = $ resources -> getLinks ( ) ; foreach ( $ links as $ link ) { $ type = strtoupper ( $ link -> resource -> getLinkType ( ) ) ; switch ( $ type ) { case 'STRONG' : $ ... | Return the join clause . |
38,334 | protected function _links ( $ query , $ links ) { settype ( $ links , 'array' ) ; foreach ( $ links as $ link ) { $ resource = $ link [ 'resource' ] ; $ description = $ link [ 'query' ] -> getRepository ( ) -> getDescription ( ) ; $ conditions = array ( ) ; foreach ( $ link [ 'conditions' ] as $ key => $ value ) { if (... | Recursively adds a the links to the query . |
38,335 | protected function _where ( $ query ) { $ link = null ; $ type_check = true ; if ( $ query instanceof AnConfig ) { $ type_check = false ; $ query = $ query -> query ; } $ description = $ query -> getRepository ( ) -> getDescription ( ) ; $ clauses = array ( ) ; if ( $ description -> getInheritanceColumn ( ) && $ type_c... | Builds Query where clauses recursively . |
38,336 | public function group ( $ query ) { $ clause = '' ; if ( ! empty ( $ query -> group ) ) { $ columns = AnDomainQueryHelper :: parseColumns ( $ query , $ query -> group ) ; $ clause = ' GROUP BY ' . implode ( ' , ' , $ columns ) ; } return $ clause ; } | Return the group clause . |
38,337 | public function having ( $ query ) { $ clause = '' ; if ( ! empty ( $ query -> having ) ) { $ clause = ' HAVING ' . implode ( ' , ' , $ query -> having ) ; } return $ clause ; } | Return the having clause . |
38,338 | public function order ( $ query ) { $ clause = '' ; if ( ! empty ( $ query -> order ) ) { $ clause = 'ORDER BY ' ; $ list = array ( ) ; foreach ( $ query -> order as $ order ) { $ columns = AnDomainQueryHelper :: parseColumns ( $ query , $ order [ 'column' ] ) ; foreach ( $ columns as $ column ) { $ list [ ] = $ column... | Return the order clause . |
38,339 | public function limit ( $ query ) { $ clause = '' ; if ( ! empty ( $ query -> limit ) ) { switch ( $ query -> operation [ 'type' ] ) { case AnDomainQuery :: QUERY_SELECT_DEFAULT : case AnDomainQuery :: QUERY_SELECT : $ clause = ' LIMIT ' . $ query -> offset . ' , ' . $ query -> limit ; break ; case AnDomainQuery :: QUE... | Return the limit clause . |
38,340 | protected function _inheritanceTree ( $ description ) { $ inheritance = '' ; if ( $ description instanceof AnServiceIdentifier || ( is_string ( $ description ) && strpos ( $ description , '.' ) && ! strpos ( $ description , ',' ) ) ) { $ description = AnService :: get ( $ description ) -> getRepository ( ) -> getDescri... | Creates a string representaiton of class hiearchy of an entity in format of Parent Class 1 Parent Class 2 Parent Class n Entity Class . |
38,341 | public function setDiscount ( $ discount ) { $ discount = ( float ) $ discount ; if ( $ discount > 1 ) { $ discount = min ( max ( $ discount , 0 ) , 100 ) ; $ discount = $ discount / 100 ; } $ this -> set ( 'discount' , $ discount ) ; } | Set the discount if the discount value is adjusted to be within the range of 0 and 100 . |
38,342 | public function expired ( ) { if ( empty ( $ this -> expiresOn ) ) { return false ; } return AnDomainAttributeDate :: getInstance ( ) -> toDate ( ) -> compare ( $ this -> expiresOn ) > 0 ; } | Return whether a subscriptions is expired or not . |
38,343 | public function addSearchDirs ( $ dirs ) { settype ( $ dirs , 'array' ) ; foreach ( $ dirs as $ dir ) { $ dir = $ this -> _unifyPath ( trim ( $ dir ) ) ; if ( substr ( $ dir , - 1 ) == DS ) { $ dir = substr_replace ( $ dir , '' , - 1 ) ; } array_unshift ( $ this -> _dirs , $ dir ) ; } return $ this ; } | Adds an array of search dirs to search for a path . |
38,344 | protected function _findPath ( $ path ) { $ path = $ this -> _unifyPath ( $ path ) ; $ dirs = $ this -> _dirs ; $ file = null ; foreach ( $ dirs as $ dir ) { if ( is_readable ( realpath ( $ dir . DS . $ path ) ) ) { $ file = $ dir . DS . $ path ; break ; } } return $ file ; } | Search for a relative path within the search directories . |
38,345 | public function display ( ) { if ( $ this -> content instanceof Exception ) { $ error = $ this -> content ; $ layout = $ error -> getCode ( ) ; if ( ! $ this -> getTemplate ( ) -> findPath ( 'errors' . DS . $ layout . '.php' ) ) { $ layout = 'default' ; } $ this -> content = $ this -> getTemplate ( ) -> loadTemplate ( ... | Displays the template . |
38,346 | public static function getInstance ( $ repository , $ conditions ) { if ( ! $ conditions instanceof self ) { if ( $ repository instanceof self ) { $ query = clone $ repository ; $ repository = $ query -> getRepository ( ) ; } else { $ query = $ repository -> getQuery ( ) ; } $ identity_property = $ repository -> getDes... | Creates a new query object from a set of conditions . |
38,347 | public function clause ( $ condition = 'AND' ) { if ( empty ( $ this -> where ) ) { $ condition = null ; } $ clause = new AnDomainQueryClause ( $ this , $ condition ) ; return $ clause ; } | Return a subclause . |
38,348 | public function select ( $ columns ) { settype ( $ columns , 'array' ) ; $ this -> columns = array_unique ( array_merge ( $ this -> columns , $ columns ) ) ; $ this -> operation = array ( 'type' => self :: QUERY_SELECT_DEFAULT , 'value' => '' ) ; return $ this ; } | Built a select query . |
38,349 | public function getLink ( $ link ) { return isset ( $ this -> link [ $ link ] ) ? $ this -> link [ $ link ] : null ; } | Returns a query link . |
38,350 | public function setRepository ( $ repository ) { if ( ! $ this -> _repository instanceof AnDomainRepositoryAbstract ) { if ( is_string ( $ repository ) && strpos ( $ repository , '.' ) === false ) { $ identifier = clone $ this -> getIdentifier ( ) ; $ identifier -> type = 'repos' ; $ identifier -> path = array ( ) ; $ ... | Set the repository using identifier or a repository object . |
38,351 | public function getKey ( ) { $ key = false ; if ( count ( $ this -> where ) == 1 ) { $ where = array_values ( $ this -> where ) ; $ where = array_pop ( $ where ) ; if ( isset ( $ where [ 'property' ] ) ) { $ property = $ where [ 'property' ] ; $ keys = $ this -> getRepository ( ) -> getDescription ( ) -> getIdentifying... | Return an identiable value for the query . |
38,352 | public function from ( $ resources ) { settype ( $ resources , 'array' ) ; foreach ( $ resources as & $ resource ) { if ( strpos ( $ resource , $ this -> _prefix ) !== 0 ) { $ resource = $ this -> _prefix . $ resource ; } } $ this -> from = array_unique ( array_merge ( $ this -> from , $ resources ) ) ; return $ this ;... | Built the from clause of the query . |
38,353 | public function join ( $ type , $ resource , $ condition ) { settype ( $ condition , 'array' ) ; if ( strpos ( $ resource , $ this -> _prefix ) !== 0 ) { $ resource = $ this -> _prefix . $ resource ; } $ this -> join [ ] = array ( 'type' => strtoupper ( $ type ) , 'resource' => $ resource , 'condition' => $ condition ,... | Built the join clause of the query . |
38,354 | public function bind ( $ key , $ value = null ) { $ data = $ key ; if ( ! is_array ( $ key ) ) { $ data = array ( $ key => $ value ) ; } foreach ( $ data as $ key => $ value ) { $ this -> binds [ $ key ] = $ value ; } return $ this ; } | Binds an array of params . |
38,355 | public function fetch ( $ condition = array ( ) ) { $ query = self :: getInstance ( $ this , $ condition ) ; return $ this -> getRepository ( ) -> fetch ( $ query ) ; } | Calls the query repositry fetch method and pass the query . |
38,356 | public function fetchSet ( $ condition = array ( ) ) { $ query = self :: getInstance ( $ this , $ condition ) ; return $ this -> getRepository ( ) -> fetch ( $ query , AnDomain :: FETCH_ENTITY_SET ) ; } | Calls the query repositry fetch method with the collection mode and pass the query . |
38,357 | public function getOperation ( ) { switch ( $ this -> operation [ 'type' ] ) { case self :: QUERY_UPDATE : return AnDomain :: OPERATION_UPDATE ; case self :: QUERY_DELETE : return AnDomain :: OPERATION_DELETE ; default : return AnDomain :: OPERATION_FETCH ; } } | Retun AnDomain operation based on the query operation . |
38,358 | public function canAdd ( ) { $ result = false ; $ component = $ this -> getService ( 'repos:components.component' ) -> find ( array ( 'component' => 'com_' . $ this -> getIdentifier ( ) -> package ) ) ; if ( $ component ) { $ result = $ component -> authorize ( 'add' ) ; } return $ result ; } | Authorize Add . |
38,359 | public function canAddfollower ( ) { if ( ! $ this -> actor ) { return false ; } if ( ! $ this -> getItem ( ) ) { return false ; } return $ this -> getItem ( ) -> authorize ( 'leadable' , array ( 'viewer' => $ this -> actor ) ) ; } | Authorize adding a follower to the actor . |
38,360 | public function canDeletefollow ( ) { if ( ! $ this -> actor ) { return false ; } if ( ! $ this -> getItem ( ) ) { return false ; } return $ this -> getItem ( ) -> authorize ( 'unfollow' , array ( 'viewer' => $ this -> actor ) ) ; } | Authorize unfollowing the actor . |
38,361 | public function canAddblock ( ) { if ( ! $ this -> actor ) { return false ; } if ( ! $ this -> getItem ( ) ) { return false ; } if ( $ this -> getItem ( ) -> isAdministrable ( ) && ! $ this -> canAdminister ( ) ) { return false ; } return $ this -> actor -> authorize ( 'blocker' , array ( 'viewer' => $ this -> getItem ... | Authorize blocking the actor . |
38,362 | public function canExecute ( $ action ) { if ( $ this -> getItem ( ) && $ this -> getItem ( ) -> blocking ( get_viewer ( ) ) ) { return false ; } if ( $ this -> isAdministrable ( ) ) { $ methods = $ this -> getBehavior ( 'administrable' ) -> getMethods ( ) ; if ( in_array ( '_action' . ucfirst ( $ action ) , $ methods ... | If the viewer has been blocked by an actor then don t bring up the actor . |
38,363 | public function run ( $ name , AnCommandContext $ context ) { if ( $ this -> _enabled ) { $ this -> getStack ( ) -> push ( clone $ this ) ; foreach ( $ this -> getStack ( ) -> top ( ) as $ command ) { if ( $ command -> execute ( $ name , $ context ) === $ this -> _break_condition ) { $ this -> getStack ( ) -> pop ( ) ;... | Run the commands in the chain |
38,364 | public function setAccess ( $ value ) { $ values = ( array ) $ value ; foreach ( $ values as $ key => $ value ) { if ( empty ( $ value ) ) { $ value = self :: GUEST ; } elseif ( ! is_numeric ( $ value ) ) { if ( ! in_array ( $ value , array ( 'public' , 'registered' , 'followers' , 'special' , 'leaders' , 'mutuals' , '... | Set the access value of the node . Access value is basically a read persmission for a node . This value can be checked during fetching the record from the database to see if the viewer has access to it or not . |
38,365 | public function getPermission ( $ key , $ default = self :: GUEST ) { if ( $ key == 'access' ) { return $ this -> access ; } return $ this -> permissions -> get ( $ key , $ default ) ; } | Return a permission value for of a resource . If the permission doesn t exists then it returns the default value . |
38,366 | public function setPermission ( $ key , $ value ) { if ( empty ( $ value ) ) { $ value = self :: GUEST ; } if ( $ key == 'access' ) { $ this -> access = $ value ; } else { $ permission = clone $ this -> permissions ; $ permission [ $ key ] = $ value ; $ this -> set ( 'permissions' , $ permission ) ; } return $ this ; } | Sets a permission for a resource . |
38,367 | public function hasPermission ( $ key , $ value ) { $ values = explode ( ',' , $ this -> getPermission ( $ key ) ) ; return in_array ( $ value , $ values ) ; } | Checks if an entity has a permission value for a key . |
38,368 | public function checkPermissions ( $ actor , $ permissions , $ owner ) { $ result = true ; foreach ( $ permissions as $ value ) { $ value = pick ( $ value , self :: GUEST ) ; switch ( $ value ) { case self :: GUEST : $ result = true ; break ; case self :: REG : $ result = ! $ actor -> guest ( ) ; break ; case self :: F... | Checks an array of permissions against an accessor using the socialgraph between the accessor and actor . |
38,369 | public function buildCondition ( $ actor_id , $ config , $ access = '@col(access)' ) { $ store = $ this -> _repository -> getStore ( ) ; $ viewer = $ config -> viewer ; $ where [ ] = 'CASE' ; $ where [ ] = "WHEN $access IS NULL THEN 1" ; $ where [ ] = "WHEN FIND_IN_SET('" . self :: GUEST . "', $access) THEN 1" ; if ( $... | Creates a where statement that checks actor id and access column values against viewer socialgraph and viewer id . |
38,370 | public function address ( ComLocationsDomainEntityLocation $ location ) { $ text = array ( ) ; if ( $ location -> address ) { $ text [ ] = $ location -> address ; } if ( $ location -> city ) { $ text [ ] = $ location -> city ; } if ( $ location -> state_province ) { $ text [ ] = $ location -> state_province ; } if ( $ ... | Method to render a location s address |
38,371 | protected function _renderComposedStory ( $ story ) { $ controller = $ this -> getService ( 'com://site/stories.controller.story' ) -> layout ( 'list' ) -> setItem ( $ story ) ; $ controller -> toolbar = $ controller -> getToolbar ( 'story' ) ; return $ controller -> getView ( ) -> display ( ) ; } | Convienet method to render a story . |
38,372 | protected function _commandDeleteLocation ( $ command ) { $ location = $ this -> getController ( ) -> getItem ( ) ; $ locatable = $ command -> locatable ; $ command -> setAttribute ( 'data-action' , 'deleteLocation' ) -> setAttribute ( 'data-location' , $ location -> id ) -> href ( $ locatable -> getURL ( ) ) ; $ comma... | Delete a location from a locatable entity |
38,373 | public static function get ( $ identifier , $ filter , $ default = null ) { list ( $ hash , $ keys ) = self :: _parseIdentifier ( $ identifier ) ; $ result = null ; if ( isset ( $ GLOBALS [ '_' . $ hash ] ) ) { $ result = $ GLOBALS [ '_' . $ hash ] ; foreach ( $ keys as $ key ) { if ( array_key_exists ( $ key , $ resul... | Get sanitized data from the request . |
38,374 | public static function set ( $ identifier , $ value ) { list ( $ hash , $ keys ) = self :: _parseIdentifier ( $ identifier ) ; if ( in_array ( $ hash , array ( 'GET' , 'POST' , 'COOKIE' ) ) ) { self :: set ( 'request.' . implode ( '.' , $ keys ) , $ value ) ; } if ( $ hash == 'COOKIE' && strpos ( AnRequest :: scheme ( ... | Set a variable in the request . Cookies and session data are stored persistently . |
38,375 | public static function accept ( $ type = null ) { if ( ! isset ( self :: $ _accept ) && isset ( $ _SERVER [ 'HTTP_ACCEPT' ] ) ) { $ accept = AnRequest :: get ( 'server.HTTP_ACCEPT' , 'string' ) ; self :: $ _accept [ 'format' ] = self :: _parseAccept ( $ accept ) ; if ( isset ( $ _SERVER [ 'HTTP_ACCEPT_ENCODING' ] ) ) {... | Get the accept request information |
38,376 | public static function url ( ) { if ( ! isset ( self :: $ _url ) ) { $ url = self :: scheme ( ) . '://' ; if ( PHP_SAPI !== 'cli' ) { if ( ! empty ( $ _SERVER [ 'PHP_SELF' ] ) && ! empty ( $ _SERVER [ 'REQUEST_URI' ] ) ) { $ url .= $ _SERVER [ 'HTTP_HOST' ] . $ _SERVER [ 'REQUEST_URI' ] ; } else { $ url .= $ _SERVER [ ... | Return the URI of the request regardless of the server |
38,377 | public static function root ( $ path = null ) { if ( ! is_null ( $ path ) ) { if ( ! $ path instanceof KhttpUrl ) { $ path = AnService :: get ( 'anahita:http.url' , array ( 'url' => $ path ) ) ; } self :: $ _root = $ path ; } if ( is_null ( self :: $ _root ) ) { self :: $ _root = self :: $ _base ; } return self :: $ _r... | Returns the root path of the request . |
38,378 | public static function token ( ) { $ token = null ; if ( self :: has ( 'server.HTTP_X_TOKEN' ) ) { $ token = self :: get ( 'server.HTTP_X_TOKEN' , 'md5' ) ; } if ( self :: has ( 'request._token' ) ) { $ token = self :: get ( 'request._token' , 'md5' ) ; } return $ token ; } | Return the request token |
38,379 | public static function format ( ) { $ format = null ; if ( count ( self :: accept ( 'format' ) ) == 1 ) { $ mime = explode ( '/' , key ( self :: accept ( 'format' ) ) ) ; $ format = $ mime [ 1 ] ; if ( $ pos = strpos ( $ format , '+' ) ) { $ format = substr ( $ format , 0 , $ pos ) ; } if ( $ format == '*' ) { $ format... | Return the request format |
38,380 | protected static function _stripSlashes ( $ value ) { if ( ! is_object ( $ value ) ) { $ value = is_array ( $ value ) ? array_map ( array ( 'AnRequest' , '_stripSlashes' ) , $ value ) : stripslashes ( $ value ) ; } return $ value ; } | Strips slashes recursively on an array |
38,381 | public function setOwner ( $ owner ) { $ owner = AnConfig :: unbox ( $ owner ) ; if ( is_array ( $ owner ) ) { deprecated ( 'array as owner' ) ; } if ( is_array ( $ owner ) && $ this -> isSharable ( ) ) { $ owners = AnHelperArray :: unique ( $ owner ) ; $ owner = array_shift ( $ owners ) ; } $ this -> _mixer -> set ( '... | Set the owner of the object . If multiple owners are passed then the first owner is the primary owner and the rest just share the object with the owner . |
38,382 | public function setDescription ( $ description ) { $ stripURLRegex = "/((?<!=\")(http|ftp)+(s)?:\/\/[^<>()\s]+)/i" ; $ description = preg_replace ( $ stripURLRegex , '' , $ description ) ; $ description = strip_tags ( $ description ) ; $ description = htmlentities ( $ description ) ; $ description = str_replace ( array... | Sets the description of the document |
38,383 | public function contains ( AnObjectHandlable $ object ) { $ result = false ; if ( $ handle = $ object -> getHandle ( ) ) { $ result = $ this -> _object_list -> offsetExists ( $ handle ) ; } return $ result ; } | Check if the queue does contain a given object |
38,384 | public function load ( $ data = array ( ) ) { $ current = $ this -> _template -> getPath ( ) ; if ( ! $ current ) { throw new LibBaseTemplateException ( 'There are no template being rendered' ) ; } if ( ! isset ( $ this -> _paths [ $ current ] ) ) { $ previous = null ; $ search_paths = $ this -> _template -> getSearchP... | Render the previous template of the current template . |
38,385 | public function getURL ( ) { if ( ! isset ( $ this -> _mixer -> _url ) ) { $ this -> _mixer -> _url = 'option=' . $ this -> component . '&view=' . $ this -> _mixer -> getIdentifier ( ) -> name ; if ( $ this -> _mixer -> id ) { $ this -> _mixer -> _url .= '&id=' . $ this -> _mixer -> id ; } if ( $ this -> alias ) { $ th... | Returns the node URL . |
38,386 | protected function _beforeRepositoryFetch ( AnCommandContext $ context ) { $ query = $ context -> query ; if ( $ query -> keyword ) { $ keywords = $ query -> keyword ; if ( $ keywords ) { if ( strpos ( $ keywords , ' OR ' ) ) { $ keywords = explode ( ' OR ' , $ keywords ) ; $ operation = 'OR' ; } else { $ keywords = ex... | If a query keyowrd is set it will incorporate it in the search . |
38,387 | public function includeMedia ( ) { $ document = $ this -> getService ( 'anahita:document' ) ; $ asset = $ this -> getService ( 'com:base.template.asset' ) ; $ url = $ asset -> getURL ( "com_{$this->getIdentifier()->package}/js/{$this->getIdentifier()->package}.js" ) ; if ( $ url ) { $ document -> addScript ( $ url ) ; ... | Include Media automatically . |
38,388 | protected function _actionException ( AnCommandContext $ context ) { $ viewer = $ this -> getService ( 'com:people.viewer' ) ; if ( $ viewer -> guest ( ) && $ context -> data instanceof LibBaseControllerExceptionUnauthorized ) { $ this -> getController ( ) -> setMessage ( 'COM-PEOPLE-PLEASE-LOGIN-TO-SEE' ) ; $ return =... | Allows the component to handle exception . By default this action passes the exception to the application exception handler . |
38,389 | public function getView ( ) { if ( ! $ this -> _view instanceof LibBaseViewAbstract ) { if ( ! ( $ this -> _view instanceof AnServiceIdentifier ) ) { $ this -> setView ( $ this -> _view ) ; } $ this -> _view = $ this -> getService ( $ this -> _view ) ; } return $ this -> _view ; } | Get the view object attached to the template . |
38,390 | public function loadFile ( $ file , $ data = array ( ) , $ process = true ) { $ this -> _load_stack [ ] = $ file ; $ data [ '__FILE__' ] = $ file ; $ data [ '__DIR__' ] = dirname ( $ file ) ; $ contents = file_get_contents ( $ file ) ; $ this -> loadString ( $ contents , $ data , $ process ) ; array_pop ( $ this -> _lo... | Load a template by path . |
38,391 | public function loadString ( $ string , $ data = array ( ) , $ process = true ) { $ this -> _contents = $ string ; $ this -> _data = array_merge ( ( array ) $ this -> _data , $ data ) ; if ( $ process == true ) { $ this -> __sandbox ( ) ; } return $ this ; } | Load a template from a string |
38,392 | protected function __sandbox ( ) { set_error_handler ( array ( $ this , 'handleError' ) , E_WARNING | E_NOTICE ) ; $ this -> getStack ( ) -> push ( clone $ this ) ; extract ( $ this -> _data , EXTR_SKIP ) ; ob_start ( ) ; include 'tmpl://' . $ this -> getStack ( ) -> getIdentifier ( ) ; $ this -> _contents = ob_get_cle... | Process the template using a simple sandbox |
38,393 | public function loadTemplate ( $ template , $ data = array ( ) , $ process = true ) { $ path = $ this -> findTemplate ( $ template ) ; if ( ! $ path ) { unset ( $ this -> _paths [ $ template . '.php' ] ) ; throw new LibBaseTemplateException ( $ template . ' template not found for ' . $ this -> getIdentifier ( ) ) ; ret... | Loads a template by first trying to find the template file . |
38,394 | public function renderHelper ( $ identifier , $ config = array ( ) ) { $ args = func_get_args ( ) ; $ identifier = array_shift ( $ args ) ; $ parts = explode ( '.' , $ identifier ) ; $ function = array_pop ( $ parts ) ; $ helper = implode ( '.' , $ parts ) ; $ helper = $ this -> getHelper ( $ helper ) ; if ( ! is_calla... | Load a template helper . On Contrary to Nooku it allows for any number of argument than just an array . |
38,395 | public function getHelper ( $ helper , $ config = array ( ) ) { $ name = ( string ) $ helper ; if ( ! isset ( $ this -> _helpers [ $ name ] ) ) { if ( is_string ( $ helper ) && strpos ( $ helper , '.' ) === false ) { $ identifier = clone $ this -> getIdentifier ( ) ; $ identifier -> path = array ( 'template' , 'helper'... | Get a template helper . |
38,396 | public function addSearchPath ( $ paths , $ append = false ) { settype ( $ paths , 'array' ) ; foreach ( $ paths as $ path ) { if ( empty ( $ path ) ) { continue ; } if ( in_array ( $ path , $ this -> _search_paths ) ) { continue ; } if ( $ append ) { $ this -> _search_paths [ ] = $ path ; } else { array_unshift ( $ th... | Add a new search path . By the default the path is added to the top of the search path . |
38,397 | public function parse ( ) { $ path = $ this -> _contents ; if ( ! isset ( $ this -> _parsed_data [ $ path ] ) ) { $ context = $ this -> getCommandContext ( ) ; $ context -> data = $ path ; $ this -> getCommandChain ( ) -> run ( LibBaseTemplateFilter :: MODE_READ , $ context ) ; $ this -> _parsed_data [ $ path ] = $ con... | Parse the data . If a data has been parsed it will serve it from the cache . |
38,398 | public function addFilter ( $ filters ) { $ filters = ( array ) AnConfig :: unbox ( $ filters ) ; foreach ( $ filters as $ filter ) { if ( ! ( $ filter instanceof LibBaseTemplateFilterInterface ) ) { $ filter = $ this -> getFilter ( $ filter ) ; } $ this -> getCommandChain ( ) -> enqueue ( $ filter ) ; $ this -> _filte... | Adds one or more filters for template transformation |
38,399 | public function getFilter ( $ filter ) { if ( is_string ( $ filter ) && strpos ( $ filter , '.' ) === false ) { $ identifier = clone $ this -> getIdentifier ( ) ; $ identifier -> path = array ( 'template' , 'filter' ) ; $ identifier -> name = $ filter ; } else { $ identifier = AnService :: getIdentifier ( $ filter ) ; ... | Get a filter by identifier . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.