idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
38,100
public static function getClassname ( $ type ) { if ( ! isset ( self :: $ __classnames [ $ type ] ) ) { $ classname = 'AnDomainAttribute' . ucfirst ( $ type ) ; $ classname = class_exists ( $ classname ) ? $ classname : $ type ; if ( ! is ( $ classname , 'AnDomainAttributeInterface' ) ) { throw new AnDomainExceptionTyp...
If type is one of the aliases type then return the complete type name .
38,101
protected function findImport ( $ url ) { foreach ( ( array ) $ this -> importDir as $ dir ) { $ full = $ dir . ( substr ( $ dir , - 1 ) != '/' ? '/' : '' ) . $ url ; if ( $ this -> fileExists ( $ file = $ full . '.less' ) || $ this -> fileExists ( $ file = $ full ) ) { return $ file ; } } return ; }
attempts to find the path of an import url returns null for css files
38,102
protected function compileSelectors ( $ selectors ) { $ out = array ( ) ; foreach ( $ selectors as $ s ) { if ( is_array ( $ s ) ) { list ( , $ value ) = $ s ; $ out [ ] = $ this -> compileValue ( $ this -> reduce ( $ value ) ) ; } else { $ out [ ] = $ s ; } } return $ out ; }
reduces selector expressions
38,103
protected function colorArgs ( $ args ) { if ( $ args [ 0 ] != 'list' || count ( $ args [ 2 ] ) < 2 ) { return array ( array ( 'color' , 0 , 0 , 0 ) , 0 ) ; } list ( $ color , $ delta ) = $ args [ 2 ] ; $ color = $ this -> assertColor ( $ color ) ; $ delta = floatval ( $ delta [ 1 ] ) ; return array ( $ color , $ delta...
Helper function to get arguments for color manipulation functions . takes a list that contains a color like thing and a percentage .
38,104
protected function lib_alpha ( $ value ) { if ( ! is_null ( $ color = $ this -> coerceColor ( $ value ) ) ) { return isset ( $ color [ 4 ] ) ? $ color [ 4 ] : 1 ; } }
defaults to 1 for non - colors or colors without an alpha
38,105
protected function lib_fade ( $ args ) { list ( $ color , $ alpha ) = $ this -> colorArgs ( $ args ) ; $ color [ 4 ] = $ this -> clamp ( $ alpha / 100.0 ) ; return $ color ; }
set the alpha of the color
38,106
protected function evaluate ( $ exp ) { list ( , $ op , $ left , $ right , $ whiteBefore , $ whiteAfter ) = $ exp ; $ left = $ this -> reduce ( $ left ) ; $ right = $ this -> reduce ( $ right ) ; if ( $ leftColor = $ this -> coerceColor ( $ left ) ) { $ left = $ leftColor ; } if ( $ rightColor = $ this -> coerceColor (...
evaluate an expression
38,107
protected function op_number_number ( $ op , $ left , $ right ) { $ unit = empty ( $ left [ 2 ] ) ? $ right [ 2 ] : $ left [ 2 ] ; $ value = 0 ; switch ( $ op ) { case '+' : $ value = $ left [ 1 ] + $ right [ 1 ] ; break ; case '*' : $ value = $ left [ 1 ] * $ right [ 1 ] ; break ; case '-' : $ value = $ left [ 1 ] - $...
operator on two numbers
38,108
protected function pushEnv ( $ block = null ) { $ e = new stdclass ( ) ; $ e -> parent = $ this -> env ; $ e -> store = array ( ) ; $ e -> block = $ block ; $ this -> env = $ e ; return $ e ; }
the state of execution
38,109
protected function injectVariables ( $ args ) { $ this -> pushEnv ( ) ; $ parser = new lessc_parser ( $ this , __METHOD__ ) ; foreach ( $ args as $ name => $ strValue ) { if ( $ name { 0 } != '@' ) { $ name = '@' . $ name ; } $ parser -> count = 0 ; $ parser -> buffer = ( string ) $ strValue ; if ( ! $ parser -> proper...
inject array of unparsed strings into environment as variables
38,110
public function parse ( $ str = null , $ initialVariables = null ) { if ( is_array ( $ str ) ) { $ initialVariables = $ str ; $ str = null ; } $ oldVars = $ this -> registeredVars ; if ( $ initialVariables !== null ) { $ this -> setVariables ( $ initialVariables ) ; } if ( $ str == null ) { if ( empty ( $ this -> _pars...
This is deprecated
38,111
public static function ccompile ( $ in , $ out , $ less = null ) { if ( $ less === null ) { $ less = new self ( ) ; } return $ less -> checkedCompile ( $ in , $ out ) ; }
returns true when it compiles false otherwise
38,112
protected function expression ( & $ out ) { if ( $ this -> value ( $ lhs ) ) { $ out = $ this -> expHelper ( $ lhs , 0 ) ; if ( ! empty ( $ this -> env -> supressedDivision ) ) { unset ( $ this -> env -> supressedDivision ) ; $ s = $ this -> seek ( ) ; if ( $ this -> literal ( '/' ) && $ this -> value ( $ rhs ) ) { $ o...
Attempt to consume an expression .
38,113
protected function value ( & $ value ) { $ s = $ this -> seek ( ) ; if ( isset ( $ this -> buffer [ $ this -> count ] ) && $ this -> buffer [ $ this -> count ] == '-' ) { if ( $ this -> literal ( '-' , false ) && ( ( $ this -> variable ( $ inner ) && $ inner = array ( 'variable' , $ inner ) ) || $ this -> unit ( $ inne...
a single value
38,114
protected function import ( & $ out ) { $ s = $ this -> seek ( ) ; if ( ! $ this -> literal ( '@import' ) ) { return false ; } if ( $ this -> propertyValue ( $ value ) ) { $ out = array ( 'import' , $ value ) ; return true ; } }
an import statement
38,115
protected function argumentDef ( & $ args , & $ isVararg , $ delim = ',' ) { $ s = $ this -> seek ( ) ; if ( ! $ this -> literal ( '(' ) ) { return false ; } $ values = array ( ) ; $ isVararg = false ; while ( true ) { if ( $ this -> literal ( '...' ) ) { $ isVararg = true ; break ; } if ( $ this -> variable ( $ vname ...
or at the end a ... or a variable named followed by ...
38,116
protected function tags ( & $ tags , $ simple = false , $ delim = ',' ) { $ tags = array ( ) ; while ( $ this -> tag ( $ tt , $ simple ) ) { $ tags [ ] = $ tt ; if ( ! $ this -> literal ( $ delim ) ) { break ; } } if ( count ( $ tags ) == 0 ) { return false ; } return true ; }
this accepts a hanging delimiter
38,117
protected function tag ( & $ tag , $ simple = false ) { if ( $ simple ) { $ chars = '^,:;{}\][>\(\) "\'' ; } else { $ chars = '^,;{}["\'' ; } if ( ! $ simple && $ this -> tagExpression ( $ tag ) ) { return true ; } $ tag = '' ; while ( $ this -> tagBracket ( $ first ) ) { $ tag .= $ first ; } while ( true ) { if ( $ th...
a single tag
38,118
protected function variable ( & $ name ) { $ s = $ this -> seek ( ) ; if ( $ this -> literal ( $ this -> lessc -> vPrefix , false ) && ( $ this -> variable ( $ sub ) || $ this -> keyword ( $ name ) ) ) { if ( ! empty ( $ sub ) ) { $ name = array ( 'variable' , $ sub ) ; } else { $ name = $ this -> lessc -> vPrefix . $ ...
consume a less variable
38,119
protected function end ( ) { if ( $ this -> literal ( ';' ) ) { return true ; } elseif ( $ this -> count == strlen ( $ this -> buffer ) || $ this -> buffer { $ this -> count } == '}' ) { return true ; } return false ; }
consume an end of statement delimiter
38,120
public function purge ( $ lifetime = LibSessionsDomainEntitySession :: MAX_LIFETIME , $ guestOnly = true ) { $ past = time ( ) - $ lifetime ; $ query = $ this -> getQuery ( ) -> delete ( ) -> where ( 'time < ' . $ past ) ; if ( $ guestOnly ) { $ query -> where ( 'guest' , '=' , 1 ) ; } return ( boolean ) $ this -> getS...
Removes all expired sessions
38,121
protected function _beforeRepositoryFetch ( AnCommandContext $ context ) { if ( $ this -> _enable ) { $ key = $ this -> _getCacheKey ( $ context -> query ) ; if ( self :: $ _cache -> offsetExists ( $ key ) ) { $ context -> data = self :: $ _cache -> offsetGet ( $ key ) ; return false ; } } }
Check the object cache see if the data has already been retrieved .
38,122
protected function _afterRepositoryFetch ( AnCommandContext $ context ) { if ( $ this -> _enable ) { $ key = $ this -> _getCacheKey ( $ context -> query ) ; self :: $ _cache -> offsetSet ( $ key , $ context -> data ) ; } }
Stores the objects in the cache . This cache is persisted during the request life cycle .
38,123
public function canAdd ( ) { $ actor = $ this -> actor ; $ viewer = get_viewer ( ) ; if ( $ actor ) { if ( $ viewer -> blocking ( $ actor ) ) { return false ; } $ action = 'com_' . $ this -> _mixer -> getIdentifier ( ) -> package . ':' . $ this -> _mixer -> getIdentifier ( ) -> name . ':add' ; $ ret = $ actor -> author...
Authorize if viewer can add .
38,124
public function canExecute ( $ action ) { if ( $ this -> isOwnable ( ) && $ this -> actor && $ this -> actor -> authorize ( 'access' ) === false ) { return false ; } return parent :: canExecute ( $ action ) ; }
If an app is not enabled for an actor then don t let the viewer to see it .
38,125
protected function _afterControllerGet ( AnCommandContext $ context ) { $ flash = $ this -> _mixer -> getState ( ) -> flash ; $ message = $ flash -> getMessage ( ) ; if ( $ message ) { $ message [ 'message' ] = AnTranslator :: _ ( $ message [ 'message' ] ) ; $ this -> storeValue ( 'message' , $ message , true ) ; } }
If the message is still in the flash push that to the global message stack . This gives a chance for the message to be seen .
38,126
public function setMessage ( $ message , $ type = 'info' , $ global = false ) { if ( $ this -> getRequest ( ) -> isAjax ( ) ) { $ this -> getResponse ( ) -> setHeader ( 'X-Message' , json_encode ( array ( 'text' => AnTranslator :: _ ( $ message ) , 'type' => $ type ) ) ) ; } else { $ this -> storeValue ( 'message' , ar...
Sets a message .
38,127
public function storeValue ( $ key , $ value , $ global = false ) { if ( $ this -> _enabled ) { $ namespace = $ this -> _getQueueNamespace ( $ global ) ; $ session = AnService :: get ( 'com:sessions' , array ( 'namespace' => $ namespace -> namespace ) ) ; $ queue = $ session -> get ( $ namespace -> queue , new stdClass...
Stores a value in the session . This value is removed in the next request .
38,128
public function retrieveValue ( $ key , $ global = false ) { $ ret = null ; if ( $ this -> _enabled ) { $ namespace = $ this -> _getQueueNamespace ( $ global ) ; $ session = AnService :: get ( 'com:sessions' , array ( 'namespace' => $ namespace -> namespace ) ) ; $ queue = $ session -> get ( $ namespace -> queue , new ...
Retreive a stored value from the session .
38,129
private function _getSession ( $ sessionId ) { if ( is_null ( $ this -> _session ) ) { $ this -> _session = $ this -> _repository -> find ( array ( 'sessionId' => $ sessionId ) ) ; } return $ this -> _session ; }
loads the session entity
38,130
public function insert ( $ config ) { if ( is_string ( $ config ) ) { $ config = array ( 'name' => $ config ) ; } $ config = new AnConfig ( $ config ) ; if ( empty ( $ config -> link ) && ! empty ( $ this -> _resources ) ) { $ name = AnInflector :: singularize ( $ this -> main ( ) -> getName ( ) ) ; $ config -> link = ...
Adds a resource to the set the set of resources .
38,131
public function getResource ( $ name ) { foreach ( $ this -> _resources as $ resource ) { if ( $ resource -> getName ( ) == $ name ) { return $ resource ; } } }
Return the resource with name .
38,132
public function getColumn ( $ name ) { if ( $ name instanceof AnDomainResourceColumn ) { return $ name ; } if ( strpos ( $ name , '.' ) !== false ) { $ parts = explode ( '.' , $ name , 2 ) ; $ name = $ parts [ 1 ] ; foreach ( $ this -> _resources as $ resource ) { if ( $ resource -> getAlias ( ) == $ parts [ 0 ] ) { br...
Return a column in a resource using .
38,133
public function & getPlugin ( $ type , $ element = null ) { $ results = array ( ) ; $ this -> _load ( ) ; foreach ( $ this -> _plugins as $ plugin ) { if ( is_null ( $ element ) ) { if ( $ plugin -> type == $ type ) { $ results [ ] = $ plugin ; } } elseif ( $ plugin -> type == $ type && $ plugin -> element == $ element...
Get the plugin data of a specific type if no specific plugin is specified otherwise only the specific plugin data is returned
38,134
public function import ( $ type , $ element = null , $ autocreate = true , $ dispatcher = null ) { $ result = false ; $ this -> _load ( ) ; foreach ( $ this -> _plugins as $ plugin ) { if ( $ plugin -> type === $ type && ( is_null ( $ element ) || $ plugin -> element === $ element ) ) { $ this -> _import ( $ plugin , $...
Loads all the plugin files for a particular type if no specific plugin is specified otherwise only the specific pugin is loaded .
38,135
protected function _import ( $ plugin , $ autocreate = true , $ dispatcher = null ) { $ type = preg_replace ( '/[^A-Z0-9_\.-]/i' , '' , $ plugin -> type ) ; $ element = preg_replace ( '/[^A-Z0-9_\.-]/i' , '' , $ plugin -> element ) ; $ path = ANPATH_PLUGINS . DS . $ type . DS . $ element . '.php' ; if ( isset ( $ this ...
Loads the plugin file
38,136
protected function _load ( ) { if ( empty ( $ this -> _plugins ) ) { $ this -> _plugins = AnService :: get ( 'repos:settings.plugin' ) -> getQuery ( ) -> where ( 'enabled' , '=' , 1 ) -> toEntityset ( ) ; } return $ this -> _plugins ; }
Loads the published plugins
38,137
public function sanitizeComments ( $ comments ) { $ sanitizers = $ this -> _comment_sanitizer ; if ( isset ( $ sanitizers [ 'format' ] ) ) { $ sanitizers [ 'format' ] = $ this -> _repository -> getValidator ( ) -> getFilter ( $ sanitizers [ 'format' ] ) ; } foreach ( $ comments as $ comment ) { $ comment -> sanitizeDat...
Sanitize an array of comments .
38,138
public function resetStats ( array $ entities ) { foreach ( $ entities as $ entity ) { $ entity -> set ( 'numOfComments' , $ entity -> comments -> getTotal ( ) ) ; $ last_comment = $ entity -> comments -> reset ( ) -> order ( 'creationTime' , 'DESC' ) -> fetch ( ) ; $ entity -> set ( 'lastComment' , $ last_comment ) ; ...
Reset comment stats .
38,139
public function onGetShareAdapters ( AnEvent $ event ) { $ adapters = $ event -> adapters ; $ request = $ event -> request ; $ this -> getService ( 'repos:connect.session' ) ; $ sessions = $ request -> target -> sessions ; foreach ( $ sessions as $ session ) { $ identifier = $ this -> getIdentifier ( 'com:connect.share...
Called for getting share adapters .
38,140
public function getSubscriptions ( ) { if ( ! $ this -> __subscriptions ) { $ subscriptions = array ( ) ; foreach ( $ this -> getMethods ( ) as $ method ) { if ( substr ( $ method , 0 , 2 ) == 'on' ) { $ subscriptions [ ] = $ method ; } } $ this -> __subscriptions = $ subscriptions ; } return $ this -> __subscriptions ...
Get a list of subscribed events .
38,141
public function day ( $ options = array ( ) ) { $ options = new AnConfig ( $ options ) ; $ options -> append ( array ( 'selected' => null , 'prompt' => true , ) ) ; $ days = array_combine ( range ( 1 , 31 ) , range ( 1 , 31 ) ) ; $ selected = $ options -> selected ; unset ( $ options -> selected ) ; $ prompt = $ option...
Return a day selection from 1 to 31 .
38,142
public function country ( $ options = array ( ) ) { $ options = new AnConfig ( $ options ) ; $ options -> append ( array ( 'id' => 'an-se-selection-countries-' . uniqid ( ) , 'selected' => null , 'name' => 'country' , 'use_country_code' => true , 'prompt' => true , ) ) ; $ selected = $ options -> selected ; $ use_count...
Return a selection of countries .
38,143
public function state ( $ options = array ( ) ) { $ options = new AnConfig ( $ options ) ; $ options -> append ( array ( 'country_selector' => 'countery-selector' , 'country' => 'US' , 'selected' => null , 'use_state_code' => true , 'prompt' => true , ) ) ; $ country = strtolower ( $ options -> country ) ; $ country_se...
Return a selection of states or provinces for canada .
38,144
public function currency ( $ options = array ( ) ) { $ options = new AnConfig ( $ options ) ; $ options -> append ( array ( 'name' => 'currency' , 'prompt' => true , ) ) ; $ selected = $ options -> selected ; unset ( $ options -> selected ) ; $ currencies = array_combine ( self :: $ ISO_CURRENCY_SYMBOLS , self :: $ ISO...
Return a selection of standard currency codes .
38,145
public function toArray ( ) { $ data = $ this -> _data ; $ data [ 'message' ] = $ this -> getMessage ( ) ; $ data [ 'code' ] = $ this -> getCode ( ) ; $ data [ 'key' ] = $ this -> getkey ( ) ; $ data = array_reverse ( $ data ) ; return $ data ; }
Return an array represention of the error .
38,146
public function getScopes ( ) { if ( ! isset ( $ this -> _scopes ) ) { $ this -> _scopes = clone $ this -> getService ( 'com:components.domain.entityset.scope' ) ; } return $ this -> _scopes ; }
Return an array of scopes with a count per each scope .
38,147
public function api ( $ config = array ( ) ) { $ config = array_merge_recursive ( $ config , array ( 'key' => get_config_value ( 'locations.api_key' ) , 'service' => $ this -> _service , 'libraries' => array ( ) ) ) ; return $ this -> _render ( 'api_' . $ config [ 'service' ] , $ config ) ; }
includes location api javascript
38,148
public function nearby ( $ config = array ( ) ) { $ config = array_merge_recursive ( $ config , array ( 'service' => $ this -> _service ) ) ; return $ this -> _render ( 'nearby' , $ config ) ; }
includes places autocomplete javascript
38,149
public function map ( $ locations , $ config = array ( ) ) { if ( $ locations instanceof ComLocationsDomainEntityLocation ) { $ locations = array ( $ locations ) ; } $ data = array ( ) ; foreach ( $ locations as $ location ) { $ data [ ] = array ( 'longitude' => $ location -> longitude , 'latitude' => $ location -> lat...
renders a map
38,150
public function setData ( array $ data ) { if ( count ( $ data ) ) { $ data = array_combine ( $ data , $ data ) ; } $ this -> _data = $ data ; return $ this ; }
Set the set data .
38,151
public function unserialize ( $ data ) { if ( $ data ) { $ data = explode ( ',' , pick ( $ data , '' ) ) ; $ data = array_combine ( $ data , $ data ) ; } else { $ data = array ( ) ; } $ this -> _data = $ data ; return $ this ; }
Instantiate the set attribute with a comma seperate list of value .
38,152
protected function _layoutDefault ( ) { $ this -> set ( 'gadgets' , new LibBaseTemplateObjectContainer ( ) ) ; $ this -> set ( 'composers' , new LibBaseTemplateObjectContainer ( ) ) ; $ context = new AnCommandContext ( ) ; $ context -> actor = $ this -> viewer ; $ context -> gadgets = $ this -> gadgets ; $ context -> c...
Prepare default layout .
38,153
public static function strpos ( $ str , $ search , $ offset = false ) { if ( strlen ( $ str ) && strlen ( $ search ) ) { if ( $ offset === false ) { return mb_strpos ( $ str , $ search ) ; } else { return mb_strpos ( $ str , $ search , $ offset ) ; } } else { return false ; } }
UTF - 8 aware alternative to strpos
38,154
public static function strrpos ( $ str , $ search ) { if ( $ offset === false ) { if ( empty ( $ str ) ) { return false ; } return mb_strrpos ( $ str , $ search ) ; } else { if ( ! is_int ( $ offset ) ) { trigger_error ( 'utf8_strrpos expects parameter 3 to be long' , E_USER_WARNING ) ; return false ; } $ str = mb_subs...
UTF - 8 aware alternative to strrpos
38,155
public static function substr ( $ str , $ offset , $ length = false ) { if ( $ length === false ) { return mb_substr ( $ str , $ offset ) ; } else { return mb_substr ( $ str , $ offset , $ length ) ; } }
UTF - 8 aware alternative to substr
38,156
public static function str_ireplace ( $ search , $ replace , $ str , $ count = null ) { if ( ! is_array ( $ search ) ) { $ slen = strlen ( $ search ) ; $ lendif = strlen ( $ replace ) - $ slen ; if ( $ slen === 0 ) { return $ str ; } $ search = AnHelperString :: strtolower ( $ search ) ; $ search = preg_quote ( $ searc...
UTF - 8 aware alternative to str_ireplace
38,157
public static function str_split ( $ str , $ split_len = 1 ) { if ( ! preg_match ( '/^[0-9]+$/' , $ split_len ) || $ split_len < 1 ) { return false ; } $ len = AnHelperString :: strlen ( $ str ) ; if ( $ len <= $ split_len ) { return array ( $ str ) ; } preg_match_all ( '/.{' . $ split_len . '}|[^\x00]{1,' . $ split_le...
UTF - 8 aware alternative to str_split
38,158
public static function strcasecmp ( $ str1 , $ str2 ) { $ strX = AnHelperString :: strtolower ( $ strX ) ; $ strY = AnHelperString :: strtolower ( $ strY ) ; return strcmp ( $ strX , $ strY ) ; }
UTF - 8 aware alternative to strcasecmp
38,159
public static function stristr ( $ str , $ search ) { if ( strlen ( $ search ) === 0 ) { return $ str ; } $ lstr = AnHelperString :: strtolower ( $ str ) ; $ lsearch = AnHelperString :: strtolower ( $ search ) ; preg_match ( '|^(.*)' . preg_quote ( $ lsearch ) . '|Us' , $ lstr , $ matches ) ; if ( count ( $ matches ) =...
UTF - 8 aware alternative to stristr
38,160
public static function strspn ( $ str , $ mask , $ start = null , $ length = null ) { $ mask = preg_replace ( '!([\\\\\\-\\]\\[/^])!' , '\\\${1}' , $ mask ) ; if ( $ start !== null || $ length !== null ) { $ str = AnHelperString :: substr ( $ str , $ start , $ length ) ; } preg_match ( '/^[' . $ mask . ']+/u' , $ str ,...
UTF - 8 aware alternative to strspn
38,161
public static function substr_replace ( $ str , $ repl , $ start , $ length = null ) { preg_match_all ( '/./us' , $ str , $ ar ) ; preg_match_all ( '/./us' , $ repl , $ rar ) ; if ( $ length === null ) { $ length = AnHelperString :: strlen ( $ str ) ; } array_splice ( $ ar [ 0 ] , $ start , $ length , $ rar [ 0 ] ) ; r...
UTF - 8 aware substr_replace
38,162
public static function ucfirst ( $ str ) { switch ( AnHelperString :: strlen ( $ str ) ) { case 0 : return '' ; break ; case 1 : return AnHelperString :: strtoupper ( $ str ) ; break ; default : preg_match ( '/^(.{1})(.*)$/us' , $ str , $ matches ) ; return AnHelperString :: strtoupper ( $ matches [ 1 ] ) . $ matches [...
UTF - 8 aware alternative to ucfirst
38,163
public static function ucwords_callback ( $ matches ) { $ leadingws = $ matches [ 2 ] ; $ ucfirst = AnHelperString :: strtoupper ( $ matches [ 3 ] ) ; $ ucword = AnHelperString :: substr_replace ( ltrim ( $ matches [ 0 ] ) , $ ucfirst , 0 , 1 ) ; return $ leadingws . $ ucword ; }
Callback function for preg_replace_callback call in utf8_ucwords
38,164
protected function _actionEditsubscription ( AnCommandContext $ context ) { if ( $ subscription = $ this -> _subscriber -> changeSubscriptionTo ( $ this -> getItem ( ) ) ) { $ subscription -> endDate = $ context -> data -> endDate ; } }
reassign subscriber to a different package .
38,165
protected function _actionAddsubscriber ( AnCommandContext $ context ) { if ( $ subscription = $ this -> _subscriber -> subscribeTo ( $ this -> getItem ( ) ) ) { $ subscription -> endDate = $ context -> data -> endDate ; } }
Add a subscriber .
38,166
public function setMeta ( AnCommandContext $ context ) { $ data = $ context -> data ; $ this -> getItem ( ) -> setValue ( 'actorIds' , $ data -> actor_ids ) ; }
Set the entity meta fields .
38,167
public function setEndDate ( AnCommandContext $ context ) { $ data = $ context -> data ; if ( $ data -> day || $ data -> month || $ data -> year ) { $ date = new AnDate ( ) ; $ date -> day ( ( int ) $ data -> day ) ; $ date -> month ( ( int ) $ data -> month ) ; $ date -> year ( ( int ) $ data -> year ) ; $ data -> end...
Set End Time action .
38,168
public function getURL ( $ use_username = true ) { $ url = 'option=com_people&view=person&id=' . $ this -> id ; if ( $ use_username ) { $ url .= '&uniqueAlias=' . strtolower ( $ this -> alias ) ; } return $ url ; }
Return a person URL .
38,169
protected function _renderScript ( $ script , $ link , $ attribs = array ( ) ) { if ( $ link ) { $ script = pick ( $ this -> getService ( 'com:base.template.asset' ) -> getURL ( $ script ) , $ script ) ; } if ( AnRequest :: type ( ) == 'AJAX' ) { if ( $ link ) { $ file = $ this -> getService ( 'com:base.template.asset'...
Render script information .
38,170
protected function _afterControllerAdd ( AnCommandContext $ context ) { $ data = $ context -> data ; if ( $ data -> composed && $ data -> story ) { if ( $ context -> response -> isRedirect ( ) ) { $ context -> response -> setStatus ( AnHttpResponse :: OK ) ; $ context -> response -> removeHeader ( 'Location' ) ; } $ co...
Renders a story after an entity is created through composer .
38,171
public function compile ( $ config = array ( ) ) { $ config = new AnConfig ( $ config ) ; $ config -> append ( array ( 'parse_urls' => true , 'compress' => true , 'import' => array ( ) , 'force' => false , 'output' => null , 'input' => null , ) ) ; $ less = new lessc ( ) ; $ less -> setPreserveComments ( ! $ config -> ...
Compiles a less css file . The the compiler will create a css file output .
38,172
protected function _parseUrls ( $ text , array $ paths ) { $ matches = array ( ) ; $ replaces = array ( ) ; $ finder = $ this -> getService ( 'anahita:file.pathfinder' ) -> addSearchDirs ( array_reverse ( $ paths ) ) ; $ starting_path = $ paths [ 0 ] ; if ( preg_match_all ( '/url\((.*?)\)/' , $ text , $ matches ) ) { f...
Parse URLs .
38,173
public function setSubscriber ( $ subscriber ) { $ this -> _subscriber = $ subscriber ; if ( $ subscriber -> persisted ( ) ) { $ this -> actorId = $ this -> _subscriber -> id ; } else { $ this -> set ( 'actorId' , PHP_INT_MAX ) ; } $ this -> getRepository ( ) -> getSpace ( ) -> setSaveOrder ( $ this , $ this -> _subscr...
Set the transaction person .
38,174
public function setPackage ( $ package , $ upgraded = null ) { $ this -> currency = get_config_value ( 'subscriptions.currency' , 'US' ) ; $ this -> itemName = $ package -> name ; $ this -> itemId = $ package -> id ; $ this -> itemAmount = $ package -> price ; $ this -> duration = $ package -> duration ; $ this -> bill...
Set the transaction price .
38,175
public function getPayload ( ) { $ payload = $ this -> getService ( 'com:subscriptions.domain.payment.payload' , array ( 'order_id' => $ this -> orderId , 'description' => $ this -> _package -> name , 'amount' => $ this -> getItemAmountAfterDiscount ( ) , 'tax_amount' => $ this -> getTaxAmount ( ) , 'payment_method' =>...
Return a payload object for this order .
38,176
public function setPaymentMethod ( ComSubscriptionsDomainPaymentMethodInterface $ method ) { $ this -> _payment_method = $ method ; $ this -> method = ( string ) $ method ; return $ this ; }
The method of payment .
38,177
public function canProcess ( ) { if ( $ this -> persisted ( ) ) { return false ; } if ( ! $ this -> _subscriber ) { return false ; } if ( ! $ this -> validateEntity ( ) ) { return false ; } if ( ! $ this -> _subscriber -> persisted ( ) && ! $ this -> _subscriber -> validateEntity ( ) ) { return false ; } if ( ! isset (...
Retunr if an order can be processed .
38,178
public function setCountry ( $ country ) { $ this -> set ( 'country' , $ country ) ; $ vat = $ this -> getService ( 'repos:subscriptions.vat' ) -> find ( array ( 'country' => $ country ) ) ; if ( $ vat ) { $ this -> setVat ( $ vat ) ; } return $ this ; }
Set the country .
38,179
public function setCoupon ( $ coupon ) { $ this -> discountAmount = $ coupon -> discount ; $ this -> couponCode = $ coupon -> code ; return $ this ; }
Applies a coupon for the package once applied the package price is adjusted accordingly .
38,180
protected function _beforeEntityInsert ( AnCommandContext $ context ) { if ( ! empty ( $ this -> couponCode ) ) { $ coupon = $ this -> getService ( 'repos:subscriptions.coupon' ) -> find ( array ( 'code' => $ this -> couponCode , ) ) ; if ( $ coupon ) { $ coupon -> used ( ) ; } } }
Try to increment the coupong before inserting .
38,181
public function load ( ) { $ settings = $ this -> getService ( 'com:settings.setting' ) ; foreach ( $ this -> _attributes as $ key => $ value ) { $ this -> _attributes [ $ key ] = $ settings -> $ key ; } return $ this ; }
Load system setting attributes
38,182
public function save ( ) { if ( file_exists ( $ this -> _config_file_path ) ) { chmod ( $ this -> _config_file_path , 0644 ) ; $ content = "<?php\nclass AnSiteConfig{\n" ; foreach ( $ this -> _attributes as $ key => $ value ) { if ( ! is_array ( $ value ) ) { $ content .= " var \$$key = '$value';\n" ; } } $ content ...
Save system setting attributes
38,183
public function find ( $ conditions ) { $ conditions [ $ this -> _property ] = $ this -> _root ; $ found = $ this -> getRepository ( ) -> find ( $ conditions ) ; return $ found ; }
Find an entity with the passed condition .
38,184
public function insert ( $ entity ) { $ entity -> set ( $ this -> _property , $ this -> getRoot ( ) ) ; if ( $ this -> getObject ( ) -> isLoaded ( ) ) { $ this -> getObject ( ) -> insert ( $ entity ) ; } return $ entity ; }
Insert an entity to the aggregation .
38,185
public function extract ( $ entity ) { $ property = $ this -> getRepository ( ) -> getDescription ( ) -> getProperty ( $ this -> _property ) ; if ( $ property -> isRequired ( ) ) { $ entity -> delete ( ) ; } else { $ entity -> set ( $ this -> _property , null ) ; } }
Removes an object from the aggregation .
38,186
public function destroy ( $ conditions = array ( ) ) { $ conditions [ $ this -> _property ] = $ this -> _root ; $ this -> getRepository ( ) -> destroy ( $ conditions ) ; }
Destory a set of entities without instantiating them .
38,187
public function offsetExists ( $ offset ) { if ( false === $ result = parent :: offsetExists ( $ offset ) ) { if ( $ this -> _cache ) { $ result = apcu_exists ( $ this -> _cache_prefix . '-' . $ offset ) ; } } return $ result ; }
Check if the offset exists .
38,188
public function getMetadata ( $ language ) { $ path = $ this -> getLanguagePath ( ANPATH_BASE , $ language ) ; $ file = $ language . '.json' ; $ meta = null ; if ( file_exists ( $ path . DS . $ file ) ) { $ result = json_decode ( file_get_contents ( $ path . DS . $ file ) ) ; $ meta = $ result -> meta ; $ meta -> tag =...
Returns a associative array holding the metadata
38,189
public function get ( $ property = null , $ default = null ) { if ( isset ( $ this -> _meta -> property ) ) { return $ this -> _meta -> property ; } return $ default ; }
Get a matadata language property
38,190
public function getPaths ( $ extension = null ) { if ( isset ( $ extension ) ) { if ( isset ( $ this -> _paths [ $ extension ] ) ) { return $ this -> _paths [ $ extension ] ; } return array ( ) ; } else { return $ this -> _paths ; } }
Get a list of language files that have been loaded
38,191
public function getLocale ( ) { $ locales = explode ( ',' , $ this -> _meta -> locale ) ; for ( $ i = 0 ; $ i < count ( $ locales ) ; $ i ++ ) { $ locale = $ locales [ $ i ] ; $ locale = trim ( $ locale ) ; $ locales [ $ i ] = $ locale ; } return $ locales ; }
Get locale property
38,192
protected function _getCallerInfo ( ) { if ( ! function_exists ( 'debug_backtrace' ) ) { return null ; } $ backtrace = debug_backtrace ( ) ; $ info = array ( ) ; $ continue = true ; while ( $ continue && next ( $ backtrace ) ) { $ step = current ( $ backtrace ) ; $ class = @ $ step [ 'class' ] ; if ( $ class != 'AnLang...
Determine who called AnLanguage or AnTranslate
38,193
public function exists ( $ language , $ basePath = ANPATH_BASE ) { $ directory = $ this -> getLanguagePath ( $ basePath , $ language ) ; return is_dir ( $ directory ) ; }
Check if a language exists
38,194
public function materialize ( array $ data , $ entity ) { if ( $ this -> _cardinality == 1 ) { $ config = array ( ) ; $ config [ 'relationship' ] = $ this ; $ config [ 'value' ] = $ entity ; $ config [ 'property' ] = $ this -> _child_key ; $ config [ 'service_identifier' ] = $ this -> getChildRepository ( ) -> getDescr...
Materialize a relationship for the parent entity .
38,195
public function getNotifications ( ) { $ repository = $ this -> getService ( 'repos:notifications.notification' ) ; return $ repository -> getQuery ( ) -> status ( ComNotificationsDomainEntityNotification :: STATUS_SENT ) -> id ( $ this -> notificationIds -> toArray ( ) ) -> toEntityset ( ) ; }
Return a set of actor notifications .
38,196
public function addNotification ( $ notification ) { $ this -> _mixer -> getRepository ( ) -> registerCallback ( 'before.update' , array ( $ this , 'resetStats' ) , array ( $ this -> _mixer ) ) ; $ this -> _mixer -> getRepository ( ) -> registerCallback ( 'before.update' , array ( $ this , 'removeOldNotifications' ) , ...
Adds a new notification for the actor .
38,197
public function viewedNotifications ( $ notifications ) { $ notifications = ( array ) $ notifications ; $ ids = clone $ this -> newNotificationIds ; foreach ( $ notifications as $ notification ) { $ ids -> offsetUnset ( $ notification -> id ) ; } $ this -> set ( 'newNotificationIds' , $ ids ) ; $ this -> save ( ) ; }
Marks the notifications as read .
38,198
public function removeNotification ( $ notification ) { $ ids = clone $ this -> notificationIds ; $ ids -> offsetUnset ( $ notification -> id ) ; $ this -> set ( 'notificationIds' , $ ids ) ; $ ids = clone $ this -> newNotificationIds ; $ ids -> offsetUnset ( $ notification -> id ) ; $ this -> set ( 'newNotificationIds...
Removes a notification .
38,199
public function resetStats ( $ actors ) { foreach ( $ actors as $ actor ) { $ ids = $ actor -> notificationIds -> toArray ( ) ; $ ids = $ this -> getService ( 'repos:notifications.notification' ) -> getQuery ( ) -> id ( $ ids ) -> fetchValues ( 'id' ) ; $ actor -> set ( 'notificationIds' , AnDomainAttribute :: getInsta...
Reset stats .