idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
6,300
public function removeFeaturedSkills ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Video not found.' ] ) ; } try { $ this -> doRemoveFeaturedSkills ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e ->...
Removes FeaturedSkills from Video
6,301
public function removeFeaturedTutorialSkills ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Video not found.' ] ) ; } try { $ this -> doRemoveFeaturedTutorialSkills ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'e...
Removes FeaturedTutorialSkills from Video
6,302
public function setReferenceId ( $ id , $ relatedId ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Video not found.' ] ) ; } if ( $ this -> doSetReferenceId ( $ model , $ relatedId ) ) { $ this -> dispatch ( VideoEvent :: PRE_REFERENCE_UPDATE , $ model ) ; $ this ...
Sets the Reference id
6,303
public function updateFeaturedSkills ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Video not found.' ] ) ; } try { $ this -> doUpdateFeaturedSkills ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'errors' => $ e ->...
Updates FeaturedSkills on Video
6,304
public function updateFeaturedTutorialSkills ( $ id , $ data ) { $ model = $ this -> get ( $ id ) ; if ( $ model === null ) { return new NotFound ( [ 'message' => 'Video not found.' ] ) ; } try { $ this -> doUpdateFeaturedTutorialSkills ( $ model , $ data ) ; } catch ( ErrorsException $ e ) { return new NotValid ( [ 'e...
Updates FeaturedTutorialSkills on Video
6,305
protected function doAddFeaturedSkills ( Video $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addFeaturedSkill ( $ related )...
Interal mechanism to add FeaturedSkills to Video
6,306
protected function doAddFeaturedTutorialSkills ( Video $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addFeaturedTutorialSki...
Interal mechanism to add FeaturedTutorialSkills to Video
6,307
protected function doRemoveFeaturedSkills ( Video $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeFeaturedSkill ( $ rel...
Interal mechanism to remove FeaturedSkills from Video
6,308
protected function doRemoveFeaturedTutorialSkills ( Video $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> removeFeaturedTutor...
Interal mechanism to remove FeaturedTutorialSkills from Video
6,309
protected function doSetReferenceId ( Video $ model , $ relatedId ) { if ( $ model -> getReferenceId ( ) !== $ relatedId ) { $ model -> setReferenceId ( $ relatedId ) ; return true ; } return false ; }
Internal mechanism to set the Reference id
6,310
protected function doUpdateFeaturedSkills ( Video $ model , $ data ) { SkillQuery :: create ( ) -> filterByFeaturedVideo ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ...
Internal update mechanism of FeaturedSkills on Video
6,311
protected function doUpdateFeaturedTutorialSkills ( Video $ model , $ data ) { SkillQuery :: create ( ) -> filterByFeaturedTutorial ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :...
Internal update mechanism of FeaturedTutorialSkills on Video
6,312
public static function convertToArray ( $ var , $ deep = false ) { if ( null === $ var ) { return [ ] ; } if ( is_scalar ( $ var ) ) { return [ $ var ] ; } if ( is_object ( $ var ) ) { if ( $ var instanceof \ stdClass ) { $ var = ( array ) $ var ; } elseif ( $ var instanceof Collection ) { $ var = $ var -> all ( ) ; } ...
Ensures passed var is an array
6,313
public static function collectionFromString ( $ string , $ separator = '&' , $ assignment = '=' , $ options = ',' ) { $ collection = [ ] ; if ( strlen ( trim ( $ string ) ) > 0 ) { static :: explode ( $ string , $ separator ) -> each ( function ( $ item ) use ( $ assignment , $ options , & $ collection ) { if ( false =...
Creates a new collection for a string that describes key values
6,314
public static function collectionFromIniString ( $ ini , $ sections = false , $ mode = INI_SCANNER_NORMAL ) { return new Collection ( parse_ini_string ( $ ini , $ sections , $ mode ) ) ; }
Creates a new collection by exploding the string using a delimiter
6,315
public static function collectionFromUrl ( $ url ) { $ url = Collection :: collect ( parse_url ( $ url ) ) ; $ url -> set ( 'query' , static :: collectionFromUrlQuery ( $ url -> get ( 'query' ) ) ) ; return $ url ; }
Creates a new collection by parsing the url will also process the query components
6,316
public function findByNames ( array $ names ) : array { $ result = [ ] ; if ( count ( $ names ) > 0 ) { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'cc' ) -> from ( CraftingCategory :: class , 'cc' ) -> andWhere ( 'cc.name IN (:names)' ) -> setParameter ( 'names' , ar...
Finds the crafting categories with the specified names .
6,317
protected function findOrphanedIds ( ) : array { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'cc.id AS id' ) -> from ( CraftingCategory :: class , 'cc' ) -> leftJoin ( 'cc.machines' , 'm' ) -> leftJoin ( 'cc.recipes' , 'r' ) -> andWhere ( 'm.id IS NULL' ) -> andWhere ...
Returns the ids of orphaned crafting categories which are no longer used by any recipe or machine .
6,318
protected function removeIds ( array $ craftingCategoryIds ) : void { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> delete ( CraftingCategory :: class , 'cc' ) -> andWhere ( 'cc.id IN (:craftingCategoryIds)' ) -> setParameter ( 'craftingCategoryIds' , array_values ( $ craftingCa...
Removes the crafting categories with the specified ids from the database .
6,319
final public function add ( RpcMethod $ method ) { $ name = $ method -> getName ( ) ; if ( array_key_exists ( $ name , $ this -> rpc_methods ) ) { $ this -> logger -> warning ( "Cannot add method $name: duplicate entry" ) ; return false ; } else { $ this -> rpc_methods [ $ name ] = $ method ; $ this -> logger -> debug ...
Add an RPC method
6,320
final public function delete ( $ name ) { if ( array_key_exists ( $ name , $ this -> rpc_methods ) ) { unset ( $ this -> rpc_methods [ $ name ] ) ; $ this -> logger -> debug ( "Deleted method $name" ) ; return true ; } else { $ this -> logger -> warning ( "Cannot delete method $name: entry not found" ) ; return false ;...
Delete a method
6,321
protected function renderProperty ( $ key , $ value , $ important , array $ addAttr = array ( ) ) { $ markup = '' ; $ escape = $ this -> getEscapeHtmlHelper ( ) ; $ eattr = $ this -> getEscapeHtmlAttrHelper ( ) ; $ name = empty ( $ addAttr [ 'name' ] ) ? $ key : $ addAttr [ 'name' ] . '[' . $ key . ']' ; $ this -> vali...
Render a priority
6,322
public static function check ( $ token ) { $ token_name = 'token' ; if ( Session :: exists ( $ token_name ) && $ token == Session :: exists ( $ token_name ) ) { Session :: delete ( $ token_name ) ; return true ; } return false ; }
check if token exists
6,323
protected function voteForReadAction ( $ media , TokenInterface $ token ) { return $ this -> isSubjectInPerimeter ( $ media -> getMediaFolder ( ) -> getPath ( ) , $ token -> getUser ( ) , MediaFolderInterface :: ENTITY_TYPE ) ; }
Vote for Read action A user can read a media if it is located into a folder is in his perimeter
6,324
public function GenerateDaoClasses ( ) { $ tableList = $ this -> app ( ) -> dal ( ) -> getDalInstance ( ) -> GetListOfTablesInDatabase ( ) ; if ( $ tableList > 0 ) { foreach ( $ tableList as $ table ) { $ tableName = $ table [ 0 ] ; $ tableColumnNames = $ this -> app ( ) -> dal ( ) -> getDalInstance ( ) -> GetTableColu...
Generates the Dao classes from a database .
6,325
protected function removeListener ( callable $ listener ) : interfaces \ Emitter { foreach ( $ this -> listeners as $ event => $ priorityMap ) { foreach ( $ priorityMap as $ priority => $ listeners ) { if ( false !== $ key = array_search ( $ listener , $ listeners , true ) ) { unset ( $ this -> listeners [ $ event ] [ ...
Removes the given listener from all events it is listening to .
6,326
protected function removeListenerFromEvent ( callable $ listener , string $ event ) : interfaces \ Emitter { foreach ( $ this -> listeners [ $ event ] as $ priority => $ listeners ) { if ( false !== $ key = array_search ( $ listener , $ listeners , true ) ) { unset ( $ this -> listeners [ $ event ] [ $ priority ] [ $ k...
Removes the given listener from the given event .
6,327
protected function sortListeners ( string $ event ) : interfaces \ Emitter { if ( ! isset ( $ this -> listeners [ $ event ] ) ) { return $ this ; } krsort ( $ this -> listeners [ $ event ] ) ; $ this -> chain [ $ event ] = array_merge ( ... $ this -> listeners [ $ event ] ) ; return $ this ; }
Sorts the listeners for the given event name descending by priority so the higher priority listeners can get called first in the chain .
6,328
public function query ( $ query , $ return_set = false , $ buffered = true ) { $ query = trim ( $ query ) ; $ Result = @ $ this -> _Connection -> query ( $ query ) ; if ( ! ( $ Result instanceof \ SQLite3Result ) ) { $ message = sprintf ( 'Invalid query, SQLite returned "%s" (code: %s)' , $ this -> _Connection -> lastE...
Execute a query against the SQLite3 database .
6,329
public function setUrl ( $ url ) { if ( ! is_string ( $ url ) && strlen ( trim ( $ url ) ) == 0 ) throw new InvalidArgumentException ( __METHOD__ . '; Invalid url, must be a non empty string' ) ; $ this -> url = $ url ; }
Set url of this Request
6,330
public function setMethod ( $ method ) { if ( ! is_string ( $ method ) && strlen ( trim ( $ method ) ) == 0 ) throw new InvalidArgumentException ( __METHOD__ . '; Invalid method, must be a non empty string' ) ; $ this -> method = $ method ; }
Set method of this Request
6,331
public function setData ( $ data ) { if ( ! is_string ( $ data ) && strlen ( trim ( $ data ) ) == 0 ) throw new InvalidArgumentException ( __METHOD__ . '; Invalid data, must be a non empty string' ) ; $ this -> data = $ data ; }
Set data of this Request
6,332
public function setUsername ( $ username ) { if ( ! is_string ( $ username ) && strlen ( trim ( $ username ) ) == 0 ) throw new InvalidArgumentException ( __METHOD__ . '; Invalid username, must be a non empty string' ) ; $ this -> username = $ username ; }
Set username of this Request
6,333
public function setPassword ( $ password ) { if ( ! is_string ( $ password ) && strlen ( trim ( $ password ) ) == 0 ) throw new InvalidArgumentException ( __METHOD__ . '; Invalid password, must be a non empty string' ) ; $ this -> password = $ password ; }
Set password of this Request
6,334
protected function buildEnvironment ( $ config ) { $ environmentId = $ config [ 'env.id' ] ; if ( ! EnvironmentProvider :: hasEnvironment ( $ environmentId ) ) EnvironmentProvider :: buildEnvironment ( $ environmentId , $ config [ 'env.class' ] ) ; $ env = EnvironmentProvider :: getEnvironment ( $ environmentId ) ; $ e...
Returns an execution environment
6,335
protected final function getReflection ( string $ className ) : ReflectionClass { try { $ reflexion = new ReflectionClass ( $ className ) ; } catch ( ReflectionException $ e ) { throw new NotFoundException ( "Can't get reflection for " . $ className . ": not found" ) ; } if ( ! $ reflexion -> isInstantiable ( ) ) { thr...
Get reflexion class
6,336
public static function Atco13 ( $ rc , $ dc , $ pr , $ pd , $ px , $ rv , $ utc1 , $ utc2 , $ dut1 , $ elong , $ phi , $ hm , $ xp , $ yp , $ phpa , $ tc , $ rh , $ wl , & $ aob , & $ zob , & $ hob , & $ dob , & $ rob , & $ eo ) { $ j ; $ astrom = new iauASTROM ( ) ; $ ri ; $ di ; $ j = IAU :: Apco13 ( $ utc1 , $ utc2 ...
- - - - - - - - - - i a u A t c o 1 3 - - - - - - - - - -
6,337
protected function processFormData ( WebRequest $ request , Response $ response , EntityGroup $ group ) { $ result = $ this -> layout -> validateFormData ( $ request , $ response , function ( $ formValues ) use ( $ group ) { return $ this -> validateData ( $ group , $ formValues [ 'required-data.groupname' ] ) ; } ) ; ...
Validates the form data updates the group and saves the group into the database .
6,338
protected function cleanAccessLevels ( $ uuid , $ accessLevels ) { foreach ( $ accessLevels as $ key => $ accessLevel ) { if ( $ this -> hasGroupLoop ( $ accessLevel , $ uuid ) ) { unset ( $ accessLevels [ $ key ] ) ; } } return $ accessLevels ; }
Removes the the access level for this group if it is added to the access levels .
6,339
protected function hasGroupLoop ( $ accessLevel , $ modifiedUuid ) { $ parts = explode ( '\\' , $ accessLevel ) ; if ( count ( $ parts ) < 3 || $ parts [ 1 ] !== 'Group' ) { return false ; } if ( $ parts [ 2 ] === $ modifiedUuid ) { return true ; } if ( $ this -> hasPermissionForModifiedGroup ( $ modifiedUuid , $ parts...
Returns true if the given modified group id has a loop between two groups if we add the given access level .
6,340
protected function hasPermissionForModifiedGroup ( $ modifiedUuid , $ groupUuid ) { $ permissions = $ this -> accessControlManager -> getPermissionsRawForUuid ( $ groupUuid ) ; if ( $ permissions === false ) { return false ; } foreach ( $ permissions as $ permission ) { $ result = $ this -> hasGroupLoop ( $ permission ...
Returns true if the given group uuid has a permission for the given modified group uuid .
6,341
protected function validateData ( EntityGroup $ group , $ groupname ) { $ errors = array ( ) ; if ( $ this -> groupManager -> hasGroupForName ( $ groupname ) && $ this -> groupManager -> getGroupForName ( $ groupname ) -> getUuid ( ) != $ group -> getUuid ( ) ) { $ errors [ ] = new Error ( Error :: GENERAL_ERROR , $ th...
Validates the group data .
6,342
public function login ( ) { $ this -> dataCollection -> add ( 'meta' , Config :: getInstance ( ) -> get ( 'Eureka\Global\Meta' ) ) ; $ hasError = false ; $ server = Http \ Server :: getInstance ( ) ; $ session = Http \ Session :: getInstance ( ) ; $ email = '' ; if ( $ server -> isPost ( ) ) { try { $ userMapper = new ...
User login controller action
6,343
public function logout ( ) { Http \ Session :: getInstance ( ) -> set ( 'id' , null ) -> set ( 'email' , null ) ; Http \ Server :: getInstance ( ) -> redirect ( RouteCollection :: getInstance ( ) -> get ( 'login' ) -> getUri ( ) ) ; }
User logout controller action .
6,344
protected function getLayout ( TemplateInterface $ template ) { $ layout = new Template ( $ this -> getThemeLayoutTemplate ( ) ) ; $ layout -> setVar ( 'content' , $ template -> render ( ) ) ; $ layout -> setVar ( 'meta' , Config :: getInstance ( ) -> get ( 'Eureka\Global\Meta' ) ) ; return $ layout ; }
Get Main layout template
6,345
public function getArray ( ) { $ data = [ ] ; $ sheet = $ this -> excel -> getActiveSheet ( ) ; $ hrow = $ sheet -> getHighestRow ( ) ; $ hcol = $ sheet -> getHighestColumn ( ) ; $ hcoli = \ PHPExcel_Cell :: columnIndexFromString ( $ hcol ) ; for ( $ r = 1 ; $ r <= $ hrow ; $ r ++ ) { $ dr = [ ] ; for ( $ c = 0 ; $ c <...
Get data in array .
6,346
private static function getExcel ( array $ data ) { $ excel = new \ PHPExcel ( ) ; $ row = 1 ; $ col = 0 ; $ sheet = $ excel -> getActiveSheet ( ) ; foreach ( $ data as $ d ) { if ( is_array ( $ d ) ) { foreach ( $ d as $ dd ) { $ sheet -> getCellByColumnAndRow ( $ col , $ row ) -> setValue ( ( string ) $ dd ) ; $ col ...
Get PHPExcel from array .
6,347
public function savePid ( $ pid , JobReportInterface $ report ) { $ report -> setPid ( $ pid ) ; $ this -> reportManager -> add ( $ report , true ) ; }
Save job pid .
6,348
protected function parseKeywords ( ) : array { $ wpq = $ this -> wpQuery ; $ keywords = [ ] ; if ( $ wpq -> is_single ) $ keywords [ ] = 'single' ; if ( $ wpq -> is_preview ) $ keywords [ ] = 'preview' ; if ( $ wpq -> is_page ) $ keywords [ ] = 'page' ; if ( $ wpq -> is_archive ) $ keywords [ ] = 'archive' ; if ( $ wpq...
Set array of keywords to condition comparation
6,349
public function move ( $ disk ) { if ( ! in_array ( $ disk , array_keys ( config ( 'filesystems.disks' ) ) ) ) { throw new \ InvalidArgumentException ( "Filesystem \"{$disk}\" is not defined." ) ; } if ( $ this -> disk !== $ disk ) { Storage :: disk ( $ disk ) -> put ( $ this -> path , $ this -> storage -> get ( $ this...
Move file to other filesystem .
6,350
public function isRunning ( $ key ) : bool { $ activeItem = $ this -> activeItems [ $ key ] ?? null ; return ! ( null === $ activeItem ) ; }
Return if item is running
6,351
public function start ( $ name = null ) : self { if ( null !== $ name ) { $ this -> items [ $ name ] = clone $ this -> items [ self :: BASE_ITEM ] ; $ this -> activeItems [ $ name ] = $ item = $ this -> items [ $ name ] ?? new Item ( $ name ) ; $ item -> start ( $ name ) ; return $ this ; } $ this -> activeItems [ self...
Add new item to array and start timing on this item
6,352
public function stop ( ? string $ name = null ) : Item { $ name = $ name ?? self :: BASE_ITEM ; $ item = $ this -> items [ $ name ] ?? null ; if ( null !== $ item ) { unset ( $ this -> activeItems [ $ name ] ) ; return $ item -> stop ( ) ; } throw new \ InvalidArgumentException ( sprintf ( 'Item with name %s not found!...
Stop timing on selected item and return instance of this item
6,353
public static function isValid ( $ data ) { static :: compileValidPattern ( ) ; $ pattern_found = preg_match ( static :: $ valid_pattern , $ data , $ matches ) ; return ( bool ) $ pattern_found ; }
Determines whether a given string adheres to the RFC3986 specification for the extending URI part .
6,354
protected function encode ( $ string ) { $ encoded_query = $ string ; if ( ! empty ( static :: $ unencoded_characters ) ) { $ string_helper = new StringHelper ( $ string ) ; $ encoded_query = $ string_helper -> affectChunks ( "rawurlencode" , ... static :: $ unencoded_characters ) ; } return $ encoded_query ; }
Percent - encodes invalid characters within a given string . Percent - encoding ignores valid as defined by the component per RFC3986 .
6,355
protected static function compileUnencodedCharacters ( ) { foreach ( static :: $ compositions as $ composition ) { $ composition_characters = self :: $ { $ composition } ; $ delta = array_diff ( $ composition_characters , static :: $ unencoded_characters ) ; if ( ! empty ( $ delta ) ) { static :: $ unencoded_characters...
Compiles unencoded characters provided a URI part s composition as defined by its compositions property . Note that unencoded characters form the basis for the URI part s validation pattern .
6,356
public function apply ( Builder $ query , string $ tableAlias = null , string $ customName = null ) { if ( $ this -> hasBeenApplied ( ) ) { return ; } $ name = $ this -> buildDbName ( $ tableAlias , $ customName ) ; switch ( $ this -> operation ) { case '=' : case '!=' : case '>' : case '<' : case '>=' : case '<=' : $ ...
Applies condition to Eloquent query builder
6,357
protected function buildDbName ( ? string $ tableAlias , ? string $ customName ) : string { $ tableAlias = ( $ tableAlias != null ) ? str_finish ( $ tableAlias , '.' ) : '' ; $ name = ( $ customName ) ? $ tableAlias . $ customName : $ tableAlias . $ this -> name ; return $ name ; }
It builds db name
6,358
protected function doAddRootSkills ( FunctionPhase $ model , $ data ) { $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: create ( ) -> findOneById ( $ entry [ 'id' ] ) ; $ model -> addRootSkill ( $ related )...
Interal mechanism to add RootSkills to FunctionPhase
6,359
protected function doUpdateRootSkills ( FunctionPhase $ model , $ data ) { SkillQuery :: create ( ) -> filterByFunctionPhaseRoot ( $ model ) -> delete ( ) ; $ errors = [ ] ; foreach ( $ data as $ entry ) { if ( ! isset ( $ entry [ 'id' ] ) ) { $ errors [ ] = 'Missing id for Skill' ; } else { $ related = SkillQuery :: c...
Internal update mechanism of RootSkills on FunctionPhase
6,360
public function DiscussionSummaryQuery ( $ AdditionalFields = array ( ) , $ Join = TRUE ) { if ( $ this -> Watching ) $ Perms = CategoryModel :: CategoryWatch ( ) ; else $ Perms = self :: CategoryPermissions ( ) ; if ( $ Perms !== TRUE ) { $ this -> SQL -> WhereIn ( 'd.CategoryID' , $ Perms ) ; } $ this -> SQL -> Selec...
Builds base SQL query for discussion data .
6,361
public function RemoveAnnouncements ( $ Data ) { $ Result = & $ Data -> Result ( ) ; $ Unset = FALSE ; foreach ( $ Result as $ Key => & $ Discussion ) { if ( isset ( $ this -> _AnnouncementIDs ) ) { if ( in_array ( $ Discussion -> DiscussionID , $ this -> _AnnouncementIDs ) ) { unset ( $ Result [ $ Key ] ) ; $ Unset = ...
Removes undismissed announcements from the data .
6,362
public function AddDenormalizedViews ( & $ Discussions ) { if ( $ Discussions instanceof Gdn_DataSet ) { $ Result = $ Discussions -> Result ( ) ; foreach ( $ Result as & $ Discussion ) { $ CacheKey = sprintf ( DiscussionModel :: CACHE_DISCUSSIONVIEWS , $ Discussion -> DiscussionID ) ; $ CacheViews = Gdn :: Cache ( ) ->...
Add denormalized views to discussions
6,363
public function AddDiscussionColumns ( $ Data ) { $ Result = & $ Data -> Result ( ) ; foreach ( $ Result as & $ Discussion ) { $ this -> Calculate ( $ Discussion ) ; } }
Modifies discussion data before it is returned .
6,364
public function AddArchiveWhere ( $ Sql = NULL ) { if ( is_null ( $ Sql ) ) $ Sql = $ this -> SQL ; $ Exclude = Gdn :: Config ( 'Vanilla.Archive.Exclude' ) ; if ( $ Exclude ) { $ ArchiveDate = Gdn :: Config ( 'Vanilla.Archive.Date' ) ; if ( $ ArchiveDate ) { $ Sql -> Where ( 'd.DateLastComment >' , $ ArchiveDate ) ; } ...
Add SQL Where to account for archive date .
6,365
public function GetAnnouncements ( $ Wheres = '' ) { $ Session = Gdn :: Session ( ) ; $ Limit = Gdn :: Config ( 'Vanilla.Discussions.PerPage' , 50 ) ; $ Offset = 0 ; $ UserID = $ Session -> UserID > 0 ? $ Session -> UserID : 0 ; $ CacheKey = 'Announcements' ; $ AnnouncementIDs = $ this -> SQL -> Cache ( $ CacheKey ) ->...
Gets announced discussions .
6,366
public function GetBookmarkUsers ( $ DiscussionID ) { return $ this -> SQL -> Select ( 'UserID' ) -> From ( 'UserDiscussion' ) -> Where ( 'DiscussionID' , $ DiscussionID ) -> Where ( 'Bookmarked' , '1' ) -> Get ( ) ; }
Gets all users who have bookmarked the specified discussion .
6,367
public static function CategoryPermissions ( $ Escape = FALSE ) { if ( is_null ( self :: $ _CategoryPermissions ) ) { $ Session = Gdn :: Session ( ) ; if ( ( is_object ( $ Session -> User ) && $ Session -> User -> Admin ) ) { self :: $ _CategoryPermissions = TRUE ; } elseif ( C ( 'Garden.Permissions.Disabled.Category' ...
Identify current user s category permissions and set as local array .
6,368
public function GetCount ( $ Wheres = '' , $ ForceNoAnnouncements = FALSE ) { if ( is_array ( $ Wheres ) && count ( $ Wheres ) == 0 ) $ Wheres = '' ; if ( $ this -> Watching ) $ Perms = CategoryModel :: CategoryWatch ( ) ; else $ Perms = self :: CategoryPermissions ( ) ; if ( ! $ Wheres || ( count ( $ Wheres ) == 1 && ...
Count how many discussions match the given criteria .
6,369
public function GetForeignID ( $ ForeignID , $ Type = '' ) { $ Hash = ForeignIDHash ( $ ForeignID ) ; $ Session = Gdn :: Session ( ) ; $ this -> FireEvent ( 'BeforeGetForeignID' ) ; $ this -> SQL -> Select ( 'd.*' ) -> Select ( 'ca.Name' , '' , 'Category' ) -> Select ( 'ca.UrlCode' , '' , 'CategoryUrlCode' ) -> Select ...
Get data for a single discussion by ForeignID .
6,370
public function GetID ( $ DiscussionID ) { $ Session = Gdn :: Session ( ) ; $ this -> FireEvent ( 'BeforeGetID' ) ; $ Discussion = $ this -> SQL -> Select ( 'd.*' ) -> Select ( 'w.DateLastViewed, w.Dismissed, w.Bookmarked' ) -> Select ( 'w.CountComments' , '' , 'CountCommentWatch' ) -> Select ( 'd.DateLastComment' , ''...
Get data for a single discussion by ID .
6,371
public function GetIn ( $ DiscussionIDs ) { $ Session = Gdn :: Session ( ) ; $ this -> FireEvent ( 'BeforeGetIn' ) ; $ Result = $ this -> SQL -> Select ( 'd.*' ) -> Select ( 'ca.Name' , '' , 'Category' ) -> Select ( 'ca.UrlCode' , '' , 'CategoryUrlCode' ) -> Select ( 'ca.PermissionCategoryID' ) -> Select ( 'w.DateLastV...
Get discussions that have IDs in the provided array .
6,372
public static function GetSortField ( ) { $ SortField = C ( 'Vanilla.Discussions.SortField' , 'd.DateLastComment' ) ; if ( C ( 'Vanilla.Discussions.UserSortField' ) ) $ SortField = Gdn :: Session ( ) -> GetPreference ( 'Discussions.SortField' , $ SortField ) ; return $ SortField ; }
Get discussions sort order based on config and optional user preference .
6,373
public function DismissAnnouncement ( $ DiscussionID , $ UserID ) { $ Count = $ this -> SQL -> Select ( 'UserID' ) -> From ( 'UserDiscussion' ) -> Where ( 'DiscussionID' , $ DiscussionID ) -> Where ( 'UserID' , $ UserID ) -> Get ( ) -> NumRows ( ) ; $ CountComments = $ this -> SQL -> Select ( 'CountComments' ) -> From ...
Marks the specified announcement as dismissed by the specified user .
6,374
public function UpdateDiscussionCount ( $ CategoryID , $ Discussion = FALSE ) { $ DiscussionID = GetValue ( 'DiscussionID' , $ Discussion , FALSE ) ; if ( strcasecmp ( $ CategoryID , 'All' ) == 0 ) { $ Exclude = ( bool ) Gdn :: Config ( 'Vanilla.Archive.Exclude' ) ; $ ArchiveDate = Gdn :: Config ( 'Vanilla.Archive.Date...
Updates the CountDiscussions value on the category based on the CategoryID being saved .
6,375
public function SetUserBookmarkCount ( $ UserID ) { $ Count = $ this -> UserBookmarkCount ( $ UserID ) ; Gdn :: UserModel ( ) -> SetField ( $ UserID , 'CountBookmarks' , $ Count ) ; return $ Count ; }
Update and get bookmark count for the specified user .
6,376
public function SetProperty ( $ DiscussionID , $ Property , $ ForceValue = NULL ) { if ( $ ForceValue !== NULL ) { $ Value = $ ForceValue ; } else { $ Value = '1' ; $ Discussion = $ this -> GetID ( $ DiscussionID ) ; $ Value = ( $ Discussion -> $ Property == '1' ? '0' : '1' ) ; } $ this -> SQL -> Update ( 'Discussion' ...
Updates a discussion field .
6,377
public function SetUserScore ( $ DiscussionID , $ UserID , $ Score ) { $ this -> SQL -> Replace ( 'UserDiscussion' , array ( 'Score' => $ Score ) , array ( 'DiscussionID' => $ DiscussionID , 'UserID' => $ UserID ) ) ; $ TotalScore = $ this -> SQL -> Select ( 'Score' , 'sum' , 'TotalScore' ) -> From ( 'UserDiscussion' )...
Sets the discussion score for specified user .
6,378
public function AddView ( $ DiscussionID ) { $ IncrementBy = 0 ; if ( C ( 'Vanilla.Views.Denormalize' , FALSE ) && Gdn :: Cache ( ) -> ActiveEnabled ( ) ) { $ WritebackLimit = C ( 'Vanilla.Views.DenormalizeWriteback' , 10 ) ; $ CacheKey = sprintf ( DiscussionModel :: CACHE_DISCUSSIONVIEWS , $ DiscussionID ) ; $ Views =...
Increments view count for the specified discussion .
6,379
public function UserBookmarkCount ( $ UserID ) { $ Data = $ this -> SQL -> Select ( 'ud.DiscussionID' , 'count' , 'Count' ) -> From ( 'UserDiscussion ud' ) -> Join ( 'Discussion d' , 'd.DiscussionID = ud.DiscussionID' ) -> Where ( 'ud.UserID' , $ UserID ) -> Where ( 'ud.Bookmarked' , '1' ) -> Get ( ) -> FirstRow ( ) ; ...
Gets number of bookmarks specified user has .
6,380
protected function FormatTags ( $ Tags ) { if ( ! $ Tags ) return '' ; $ TagsArray = Gdn_Format :: Unserialize ( $ Tags ) ; if ( is_string ( $ TagsArray ) && $ TagsArray == $ Tags ) $ TagsArray = explode ( ' ' , $ Tags ) ; $ TagsArray = Gdn_Format :: Text ( $ TagsArray ) ; return implode ( ',' , $ TagsArray ) ; }
Convert tags from stored format to user - presentable format .
6,381
public function executeCronManagement ( ) { $ dateTime = new \ DateTime ( ) ; $ actualFrequency = array ( 'i' => $ dateTime -> format ( 'i' ) , 'H' => $ dateTime -> format ( 'H' ) , 'd' => $ dateTime -> format ( 'd' ) , 'm' => $ dateTime -> format ( 'm' ) , 'w' => $ dateTime -> format ( 'w' ) ) ; $ file = $ this -> app...
Ejecuta el cron management del framework el cual analiza las tareas definidas en el archivo de configuracion y ejecuta las que corresponda .
6,382
public function executeCron ( $ cron , $ method = "index" , $ propertiesEsp = NULL ) { $ dir = PATHAPP . 'src/crons/' . $ cron . '.php' ; if ( file_exists ( $ dir ) ) { $ cronIns = $ this -> instanceClass ( $ dir , $ cron , $ propertiesEsp ) ; if ( method_exists ( $ cronIns , $ method ) ) { $ cronIns -> $ method ( $ th...
Ejecuta el Cron mediante el metodo indicado Este es utilizado por el metodo forward del CronController y de uso interno al modulo
6,383
public function executeShellScript ( $ shell , $ method = "index" , $ propertiesEsp = NULL ) { $ dir = PATHFRA . 'Commands/' . $ shell . '.php' ; if ( file_exists ( $ dir ) ) { $ class = "Enola\\Commands\\" . $ shell ; $ shellIns = new $ class ( ) ; if ( $ propertiesEsp != NULL ) { $ this -> app -> dependenciesEngine -...
Ejecuta el Shell Script mediante el metodo indicado Este es de uso interno al modulo
6,384
public function activeFrequency ( $ frequency , $ actualFrequency ) { $ frequency = explode ( ' ' , trim ( $ frequency , ' ' ) ) ; $ condition = $ this -> validInterval ( $ frequency [ 0 ] , $ actualFrequency [ 'i' ] ) && $ this -> validInterval ( $ frequency [ 1 ] , $ actualFrequency [ 'H' ] ) && $ this -> validInterv...
Retorna si una frecuencia esta activa en determinado dateTime
6,385
protected function instanceClass ( $ dir , $ name , $ propertiesEsp = NULL ) { require_once $ dir ; $ dir = explode ( "/" , $ name ) ; $ class = $ dir [ count ( $ dir ) - 1 ] ; $ instance = new $ class ( ) ; if ( $ propertiesEsp != NULL ) { $ this -> app -> dependenciesEngine -> injectProperties ( $ instance , $ proper...
En base a una direccion y un nombre instancia la clase correspondiente e injecta las propiedades correspondientes
6,386
public function addError ( $ error ) { if ( $ error -> getErrorCode ( ) == null ) { require_once 'Zend/Gdata/App/Exception.php' ; throw new Zend_Gdata_App_Exception ( "Error encountered without corresponding error code." ) ; } $ this -> _errors [ $ error -> getErrorCode ( ) ] = $ error ; }
Add a single Error object to the list of errors received by the server .
6,387
public function getError ( $ errorCode ) { if ( array_key_exists ( $ errorCode , $ this -> _errors ) ) { $ result = $ this -> _errors [ $ errorCode ] ; return $ result ; } else { return null ; } }
Return the Error object associated with a specific error code .
6,388
public function importFromString ( $ string ) { if ( $ string ) { @ ini_set ( 'track_errors' , 1 ) ; $ doc = new DOMDocument ( ) ; $ doc = @ Zend_Xml_Security :: scan ( $ string , $ doc ) ; @ ini_restore ( 'track_errors' ) ; if ( ! $ doc ) { require_once 'Zend/Gdata/App/Exception.php' ; throw new Zend_Gdata_App_Excepti...
Import an AppsForYourDomain error from XML .
6,389
protected function needsQuirk ( ) { if ( $ this -> disableProxyWorkaround ) { return false ; } $ ver = curl_version ( ) ; $ versionNum = $ ver [ 'version_number' ] ; return $ versionNum < Curl :: NO_QUIRK_VERSION ; }
Test for the presence of a cURL header processing bug
6,390
public function untag ( $ tags = null ) { if ( $ tags === null ) { $ this -> removeAllTags ( ) ; return ; } $ this -> removeTags ( $ this -> getWorkableTags ( $ tags ) ) ; }
Remove tag or tags
6,391
protected function extractResponseProperty ( ActionInterface $ action , CallableInterface $ callable , \ ReflectionProperty $ property ) { $ docBlock = new DocBlock ( $ property ) ; $ description = $ docBlock -> getShortDescription ( ) ; $ type = 'mixed' ; $ child = null ; $ varTags = $ docBlock -> getTagsByName ( 'var...
Extract response property
6,392
protected function tryFormatPhpType ( DocBlock \ Tag \ VarTag $ varTag , $ varType ) { if ( isset ( $ this -> phpTypeAliases [ $ varType ] ) ) { return $ this -> phpTypeAliases [ $ varType ] ; } return $ varType ; }
Try format php type
6,393
private static function createPolygon ( array $ coordinates ) : Polygon { $ polygon = array_shift ( $ coordinates ) ; return new Polygon ( array_map ( Coordinate :: class . '::create' , $ polygon ) , ... array_map ( function ( array $ poly ) { return array_map ( Coordinate :: class . '::create' , $ poly ) ; } , $ coord...
Creates a Polygon object from coordinates array .
6,394
public function onUpdate ( \ Niirrty \ Observer \ IObservable $ observable , $ extras = null ) { echo '- Observable change property ' ; if ( \ is_array ( $ extras ) && isset ( $ extras [ 'property' ] ) ) { echo '"' . $ extras [ 'property' ] , '" ' ; } echo "to a new value\n" ; }
Is called by an observed observable to inform the observer about an update .
6,395
public function addByField ( $ column , array $ params ) { $ value = [ ] ; $ value [ ] = sprintf ( 'FIELD(%s,' , $ column ) ; $ sub = [ ] ; while ( $ param = array_shift ( $ params ) ) { $ sub [ ] = '?' ; $ this -> params [ ] = $ param ; } $ value [ ] = join ( ', ' , $ sub ) . ')' ; $ this -> set ( join ( ' ' , $ value...
add order by field .
6,396
public function toSQL ( ) { if ( ! $ this -> has ( ) ) return '' ; $ sql = [ ] ; $ sql [ ] = 'ORDER BY' ; $ sub = array ( ) ; foreach ( $ this -> conditions as $ condition ) { $ sub [ ] = $ condition ; } $ sql [ ] = join ( ', ' , $ sub ) ; return join ( ' ' , $ sql ) ; }
convert to SQL
6,397
public function make ( Name $ name , array $ options ) : string { $ options = ( new Map ( $ options ) ) -> filter ( function ( $ key , $ value ) { return ! $ value -> isExceptional ( ) ; } ) ; return $ this -> url ( $ name , $ options ) ; }
Make a URL .
6,398
public function getShowtimesByMovieId ( $ mid , $ nearLocation , $ lang = 'en' , $ dateOffset = 0 ) { $ dataResponse = $ this -> getData ( $ nearLocation , null , $ mid , null , $ lang , $ dateOffset ) ; $ days = [ ] ; if ( $ dataResponse ) { $ dayDate = Carbon :: now ( ) ; $ dayDate -> setTime ( 0 , 0 , 0 ) ; $ parser...
Returns Showtimes for a specific movie near a location .
6,399
public function getShowtimesByTheaterId ( $ tid , $ nearLocation , $ lang = 'en' , $ dateOffset = 0 ) { $ dataResponse = $ this -> getData ( $ nearLocation , null , null , $ tid , $ lang , $ dateOffset ) ; $ days = [ ] ; if ( $ dataResponse ) { $ dayDate = Carbon :: now ( ) ; $ dayDate -> setTime ( 0 , 0 , 0 ) ; $ pars...
Returns Showtimes for a specific Theater .