idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
6,400
public function getTheatersNear ( $ nearLocation , $ lang = 'en' ) { $ dataResponse = $ this -> getData ( $ nearLocation , null , null , null , $ lang ) ; $ theaters = [ ] ; if ( $ dataResponse ) { $ crawler = $ dataResponse -> getCrawler ( ) ; $ parser = new ShowtimeParser ( $ crawler ) ; $ theaters = $ parser -> pars...
Returns Theaters near a location .
6,401
public function getMoviesNear ( $ nearLocation , $ lang = 'en' , $ dateOffset = null ) { $ dataResponse = $ this -> getData ( $ nearLocation , null , null , null , $ lang , null , null , 1 ) ; $ movies = [ ] ; if ( $ dataResponse ) { $ crawler = $ dataResponse -> getCrawler ( ) ; $ parser = new ShowtimeParser ( $ crawl...
Returns Showtimes near a location .
6,402
public function queryShowtimesByMovieNear ( $ movieTitle , $ nearLocation , $ lang = 'en' , $ dateOffset = null ) { $ dataResponse = $ this -> getData ( $ nearLocation , $ movieTitle , null , null , $ lang ) ; $ days = [ ] ; $ movie = null ; if ( $ dataResponse ) { $ dayDate = Carbon :: now ( ) ; $ dayDate -> setTime (...
Returns Showtimes found by a search for a movie title .
6,403
protected function postResolve ( array $ options = [ ] ) { $ this -> options [ 'base_url' ] = sprintf ( 'http%s://%s' , $ this -> options [ 'secure' ] ? 's' : '' , $ this -> options [ 'host' ] ) ; if ( ! $ this -> options [ 'adapter' ] ) { $ this -> options [ 'adapter' ] = new GuzzleAdapter ( new \ GuzzleHttp \ Client ...
Post resolve .
6,404
private function getData ( $ nearLocation = null , $ searchText = null , $ mid = null , $ tid = null , $ language = 'en' , $ dayOffset = null , $ pageOffset = null , $ sort = null ) { $ params = [ 'near' => $ nearLocation , 'mid' => $ mid , 'tid' => $ tid , 'q' => $ searchText , 'hl' => $ language , 'date' => $ dayOffs...
Get the requested html from google with the passed parameters .
6,405
public function clearFile ( ) { $ cleared = false ; if ( isset ( $ this -> file_pointer ) ) { $ cleared = $ this -> file_pointer -> ftruncate ( 0 ) ; } return $ cleared ; }
Truncates the File to zero bytes effectively clearing the file s contents . Does not delete the file .
6,406
public function initialize ( ) { $ full_file = "" ; if ( isset ( $ this -> file_path ) ) { $ full_file = $ this -> file_path . DIRECTORY_SEPARATOR ; } $ full_file .= $ this -> file_name ; try { $ this -> file_pointer = new \ SplFileObject ( $ full_file , "a" ) ; return true ; } catch ( \ Exception $ e ) { return false ...
Initializes the File for writing via append . Initialization attempts to create an SplFileObject pointer using the File s name and path properties .
6,407
protected function getCastedOriginal ( ) { $ original = [ ] ; foreach ( $ this -> original as $ key => $ value ) { $ original [ $ key ] = $ this -> hasCast ( $ key ) ? $ this -> castAttribute ( $ key , $ value ) : $ value ; } return $ original ; }
Get the casted original attributes .
6,408
public function Item ( $ ActivityID = 0 ) { $ this -> AddJsFile ( 'activity.js' ) ; $ this -> Title ( T ( 'Activity Item' ) ) ; if ( ! is_numeric ( $ ActivityID ) || $ ActivityID < 0 ) $ ActivityID = 0 ; $ this -> ActivityData = $ this -> ActivityModel -> GetWhere ( array ( 'ActivityID' => $ ActivityID ) ) ; $ this -> ...
Display a single activity item & comments .
6,409
public function Index ( $ Filter = FALSE , $ Page = FALSE ) { switch ( strtolower ( $ Filter ) ) { case 'mods' : $ this -> Title ( T ( 'Recent Moderator Activity' ) ) ; $ this -> Permission ( 'Garden.Moderation.Manage' ) ; $ NotifyUserID = ActivityModel :: NOTIFY_MODS ; break ; case 'admins' : $ this -> Title ( T ( 'Re...
Default activity stream .
6,410
public function Delete ( $ ActivityID = '' , $ TransientKey = '' ) { $ Session = Gdn :: Session ( ) ; if ( ! $ Session -> ValidateTransientKey ( $ TransientKey ) ) throw PermissionException ( ) ; if ( ! is_numeric ( $ ActivityID ) ) throw Gdn_UserException ( 'Invalid activity ID' ) ; $ HasPermission = $ Session -> Chec...
Delete an activity item .
6,411
public function Comment ( ) { $ this -> Permission ( 'Garden.Profiles.Edit' ) ; $ Session = Gdn :: Session ( ) ; $ this -> Form -> SetModel ( $ this -> ActivityModel ) ; $ NewActivityID = 0 ; if ( $ this -> Form -> IsPostBack ( ) ) { $ Body = $ this -> Form -> GetValue ( 'Body' , '' ) ; $ ActivityID = $ this -> Form ->...
Comment on an activity item .
6,412
public function connect ( ) { $ nodes = $ this -> nodeUrls ; while ( count ( $ nodes ) ) { $ idx = rand ( 0 , count ( $ nodes ) - 1 ) ; try { $ stream = new DefaultStream ( $ nodes [ $ idx ] , $ this -> log ) ; $ stream -> connect ( ) ; return $ stream ; } catch ( ConnectException $ e ) { $ this -> log -> warning ( $ e...
Connect to a random node in the node list .
6,413
private static function checkDocBlock ( $ str , $ tag = '' ) { if ( empty ( $ tag ) ) { return $ str ; } $ matches = array ( ) ; preg_match ( "/" . $ tag . "(.*)(\\r\\n|\\r|\\n)/U" , $ str , $ matches ) ; if ( isset ( $ matches [ 1 ] ) ) { return trim ( $ matches [ 1 ] ) ; } }
Get a block of comments from the coments string of a method using a tag
6,414
public static function inside_array ( $ array , $ key , $ needle ) { if ( array_has ( $ array , $ key ) ) { foreach ( array_get ( $ array , $ key ) as $ index => $ value ) { if ( $ value == $ needle ) { return $ index ; } } } return false ; }
Returns if a value is present in an array using dot notation for key
6,415
public static function translateArray ( $ array , $ prefix , $ function , $ close = "__" ) { $ result = [ ] ; foreach ( $ array as $ key => $ item ) { if ( gettype ( $ item ) != "Closure Object" ) { if ( is_array ( $ item ) ) { $ result [ $ key ] = \ Sirgrimorum \ CrudGenerator \ CrudGenerator :: translateArray ( $ arr...
Evaluate a custom function inside the config arrayetc .
6,416
public static function isFunctionOfType ( $ model , $ key , $ tipo = "Illuminate\Database\Eloquent\Collection" ) { if ( method_exists ( $ model , $ key ) ) { return is_a ( $ model -> $ key ( ) , $ tipo ) ; } else { return false ; } }
Get if a Model method returns certain type of value
6,417
public static function isFunction ( $ model , $ key ) { $ nombreLlamar = "" ; if ( is_callable ( [ $ model , $ key ] , true , $ nombreLlamar ) && method_exists ( $ model , $ key ) ) { $ refClass = new \ ReflectionClass ( $ model ) ; $ refFunc = $ refClass -> getMethod ( $ key ) ; return $ refFunc -> getNumberOfParamete...
Get if a Model has a function
6,418
private static function callFunction ( $ model , $ key , $ args , $ numArgs = false , $ valorRelleno = false ) { if ( $ numArgs === false ) { $ numArgs = \ Sirgrimorum \ CrudGenerator \ CrudGenerator :: isFunction ( $ model , $ key ) ; } if ( $ numArgs !== false ) { if ( $ numArgs > count ( $ args ) ) { for ( $ i = 0 ;...
Call a function from a model by name fixin the number of parameters
6,419
private static function getModel ( $ modelo , $ probable = '' ) { $ modeloClass = $ probable ; if ( ! class_exists ( $ modeloClass ) ) { $ modeloClass = "App\\" . $ modelo ; if ( ! class_exists ( $ modeloClass ) ) { $ modelo = strtolower ( $ modelo ) ; $ modeloM = ucfirst ( $ modelo ) ; $ modeloClass = "App\\" . $ mode...
Return the verified Class Name of a model
6,420
private static function splitQueryNames ( $ query ) { $ resultado = [ ] ; if ( ( $ left = ( stripos ( $ query , "`" ) ) ) !== false ) { while ( $ left !== false ) { if ( ( $ right = stripos ( $ query , "`" , $ left + 1 ) ) === false ) { $ right = strlen ( $ query ) ; } $ piece = substr ( $ query , $ left + 1 , $ right ...
Split a query string into names in an array
6,421
private static function getTypeByName ( $ name , $ options ) { if ( ! is_array ( $ options ) ) { $ options = config ( "sirgrimorum.crudgenerator.probable_" . $ options ) ; } return ( in_array ( $ name , $ options ) ) ; }
Know if a field name is of certain type by comparing it with a list of comonly used field names of the same type .
6,422
private static function getNameAttribute ( $ model ) { $ attributes = $ model -> getConnection ( ) -> getSchemaBuilder ( ) -> getColumnListing ( $ model -> getTable ( ) ) ; $ compares = config ( "sirgrimorum.crudgenerator.probable_name" ) ; foreach ( $ compares as $ compare ) { if ( in_array ( $ compare , $ attributes ...
Get the name attribute of a model by comparing its field names to a list of comonly used field names
6,423
public static function getNombreDeLista ( $ elemento , $ campo , $ separador = "-" ) { if ( is_object ( $ elemento ) ) { if ( is_array ( $ campo ) ) { $ strNombre = "" ; $ preNombre = "" ; foreach ( $ campo as $ indiceCampo => $ nombreCampo ) { $ strNombre .= $ preNombre . $ elemento -> { $ nombreCampo } ; $ preNombre ...
Return the value of a field from an object .
6,424
public static function getOpcionesDeCampo ( $ modelo , $ campo , $ trans = true ) { if ( $ modeloClass = \ Sirgrimorum \ CrudGenerator \ CrudGenerator :: getModel ( $ modelo , $ modelo ) ) { $ modelo = strtolower ( basename ( $ modeloClass ) ) ; if ( is_array ( $ campo ) ) { $ tiene = false ; if ( $ trans ) { foreach (...
Get the listo of distinct values for a field in a model
6,425
public static function urlType ( $ url ) { $ parsed = parse_url ( $ url ) ; if ( isset ( $ parsed [ 'host' ] ) ) { $ hostname = $ parsed [ 'host' ] ; } else { $ hostname = $ url ; } if ( strpos ( $ hostname , 'youtube' ) > 0 ) { return 'youtube' ; } elseif ( strpos ( $ hostname , 'vimeo' ) > 0 ) { return 'vimeo' ; } el...
get the type of a url by its host
6,426
public static function changeLocale ( $ locale , $ url = null ) { $ app = app ( ) ; $ base = "" ; $ currentLocale = $ app -> getLocale ( ) ; $ defaultLocale = $ app -> config -> get ( 'app.locale' ) ; if ( $ locale === null ) { $ locale = $ currentLocale ; } if ( ! in_array ( $ locale , $ app -> config -> get ( 'sirgri...
Change the locale of a url
6,427
private static function setColors ( $ wavelength , $ rgb ) { $ red = $ rgb [ "r" ] ; $ green = $ rgb [ "g" ] ; $ blue = $ rgb [ "b" ] ; if ( $ wavelength >= 380 && $ wavelength <= 439 ) { $ red = - ( $ wavelength - 440.0 ) / ( 440.0 - 380.0 ) ; $ green = 0.0 ; $ blue = 1.0 ; } elseif ( $ wavelength >= 440 && $ waveleng...
Define el rgb de un wavelength
6,428
public function delayed ( $ delay , Job $ job ) { return $ this -> connector -> delayed ( $ this -> queue , $ delay , $ job ) ; }
Pushes a new job onto the queue after a delay
6,429
public function setRacy ( $ racy = null ) { if ( $ this -> getMajorProtocolVersion ( ) == 2 ) { require_once 'Zend/Gdata/App/VersionException.php' ; throw new Zend_Gdata_App_VersionException ( 'Calling getRacy() on a YouTube VideoEntry is deprecated ' . 'as of version 2 of the API.' ) ; } $ this -> _racy = $ racy ; ret...
Specifies that the video has racy content .
6,430
public function getVideoTitle ( ) { $ this -> ensureMediaGroupIsNotNull ( ) ; if ( $ this -> getMediaGroup ( ) -> getTitle ( ) != null ) { return $ this -> getMediaGroup ( ) -> getTitle ( ) -> getText ( ) ; } else { return null ; } }
Gets the title of the video as a string . null is returned if the video title is not available .
6,431
public function setVideoTitle ( $ title ) { $ this -> ensureMediaGroupIsNotNull ( ) ; $ this -> getMediaGroup ( ) -> setTitle ( new Zend_Gdata_Media_Extension_MediaTitle ( $ title ) ) ; return $ this ; }
Sets the title of the video as a string .
6,432
public function setVideoDescription ( $ description ) { $ this -> ensureMediaGroupIsNotNull ( ) ; $ this -> getMediaGroup ( ) -> setDescription ( new Zend_Gdata_Media_Extension_MediaDescription ( $ description ) ) ; return $ this ; }
Sets the description of the video as a string .
6,433
public function getVideoDescription ( ) { $ this -> ensureMediaGroupIsNotNull ( ) ; if ( $ this -> getMediaGroup ( ) -> getDescription ( ) != null ) { return $ this -> getMediaGroup ( ) -> getDescription ( ) -> getText ( ) ; } else { return null ; } }
Gets the description of the video as a string . null is returned if the video description is not available .
6,434
public function getVideoWatchPageUrl ( ) { $ this -> ensureMediaGroupIsNotNull ( ) ; if ( $ this -> getMediaGroup ( ) -> getPlayer ( ) != null && array_key_exists ( 0 , $ this -> getMediaGroup ( ) -> getPlayer ( ) ) ) { $ players = $ this -> getMediaGroup ( ) -> getPlayer ( ) ; return $ players [ 0 ] -> getUrl ( ) ; } ...
Gets the URL of the YouTube video watch page . null is returned if the video watch page URL is not available .
6,435
public function getVideoThumbnails ( ) { $ this -> ensureMediaGroupIsNotNull ( ) ; if ( $ this -> getMediaGroup ( ) -> getThumbnail ( ) != null ) { $ thumbnailArray = array ( ) ; foreach ( $ this -> getMediaGroup ( ) -> getThumbnail ( ) as $ thumbnailObj ) { $ thumbnail = array ( ) ; $ thumbnail [ 'time' ] = $ thumbnai...
Gets an array of the thumbnails representing the video . Each thumbnail is an element of the array and is an array of the thumbnail properties - time height width and url . For convient usage inside a foreach loop an empty array is returned if there are no thumbnails .
6,436
public function getFlashPlayerUrl ( ) { $ this -> ensureMediaGroupIsNotNull ( ) ; foreach ( $ this -> getMediaGroup ( ) -> getContent ( ) as $ content ) { if ( $ content -> getType ( ) === 'application/x-shockwave-flash' ) { return $ content -> getUrl ( ) ; } } return null ; }
Gets the URL of the flash player SWF . null is returned if the duration value is not available .
6,437
public function getVideoDuration ( ) { $ this -> ensureMediaGroupIsNotNull ( ) ; if ( $ this -> getMediaGroup ( ) -> getDuration ( ) != null ) { return $ this -> getMediaGroup ( ) -> getDuration ( ) -> getSeconds ( ) ; } else { return null ; } }
Gets the duration of the video in seconds . null is returned if the duration value is not available .
6,438
public function getVideoTags ( ) { $ this -> ensureMediaGroupIsNotNull ( ) ; if ( $ this -> getMediaGroup ( ) -> getKeywords ( ) != null ) { $ keywords = $ this -> getMediaGroup ( ) -> getKeywords ( ) ; $ keywordsString = $ keywords -> getText ( ) ; if ( strlen ( trim ( $ keywordsString ) ) > 0 ) { return preg_split ( ...
Gets an array of the tags assigned to this video . For convient usage inside a foreach loop an empty array is returned when there are no tags assigned .
6,439
public function setVideoTags ( $ tags ) { $ this -> ensureMediaGroupIsNotNull ( ) ; $ keywords = new Zend_Gdata_Media_Extension_MediaKeywords ( ) ; if ( is_array ( $ tags ) ) { $ tags = implode ( ', ' , $ tags ) ; } $ keywords -> setText ( $ tags ) ; $ this -> getMediaGroup ( ) -> setKeywords ( $ keywords ) ; return $ ...
Sets the keyword tags for a video .
6,440
public function getVideoGeoLocation ( ) { if ( $ this -> getWhere ( ) != null && $ this -> getWhere ( ) -> getPoint ( ) != null && ( $ position = $ this -> getWhere ( ) -> getPoint ( ) -> getPos ( ) ) != null ) { $ positionString = $ position -> __toString ( ) ; if ( strlen ( trim ( $ positionString ) ) > 0 ) { $ posit...
Gets the location specified for this video if available . The location is returned as an array containing the keys longitude and latitude . null is returned if the location is not available .
6,441
public function getVideoRatingInfo ( ) { if ( $ this -> getRating ( ) != null ) { $ returnArray = array ( ) ; $ returnArray [ 'average' ] = $ this -> getRating ( ) -> getAverage ( ) ; $ returnArray [ 'numRaters' ] = $ this -> getRating ( ) -> getNumRaters ( ) ; return $ returnArray ; } else { return null ; } }
Gets the rating information for this video if available . The rating is returned as an array containing the keys average and numRaters . null is returned if the rating information is not available .
6,442
public function setVideoCategory ( $ category ) { $ this -> ensureMediaGroupIsNotNull ( ) ; $ this -> getMediaGroup ( ) -> setCategory ( array ( new Zend_Gdata_Media_Extension_MediaCategory ( $ category , self :: YOUTUBE_CATEGORY_SCHEMA ) ) ) ; return $ this ; }
Sets the category of the video as a string .
6,443
public function getVideoDeveloperTags ( ) { $ developerTags = null ; $ this -> ensureMediaGroupIsNotNull ( ) ; $ categoryArray = $ this -> getMediaGroup ( ) -> getCategory ( ) ; if ( $ categoryArray != null ) { foreach ( $ categoryArray as $ category ) { if ( $ category instanceof Zend_Gdata_Media_Extension_MediaCatego...
Gets the developer tags for the video if available and if client is authenticated with a valid developerKey . The tags are returned as an array . If no tags are set null is returned .
6,444
public function addVideoDeveloperTag ( $ developerTag ) { $ this -> ensureMediaGroupIsNotNull ( ) ; $ newCategory = new Zend_Gdata_Media_Extension_MediaCategory ( $ developerTag , self :: YOUTUBE_DEVELOPER_TAGS_SCHEMA ) ; if ( $ this -> getMediaGroup ( ) -> getCategory ( ) == null ) { $ this -> getMediaGroup ( ) -> set...
Adds a developer tag to array of tags for the video .
6,445
public function getVideoState ( ) { $ control = $ this -> getControl ( ) ; if ( $ control != null && $ control -> getDraft ( ) != null && $ control -> getDraft ( ) -> getText ( ) == 'yes' ) { return $ control -> getState ( ) ; } return null ; }
Get the current publishing state of the video .
6,446
public function setVideoRating ( $ ratingValue ) { if ( $ ratingValue < 1 || $ ratingValue > 5 ) { require_once 'Zend/Gdata/App/InvalidArgumentException.php' ; throw new Zend_Gdata_App_InvalidArgumentException ( 'Rating for video entry must be between 1 and 5 inclusive.' ) ; } require_once 'Zend/Gdata/Extension/Rating....
Helper function to conveniently set a video s rating .
6,447
public function getVideoCommentFeedUrl ( ) { $ commentsExtension = $ this -> getComments ( ) ; $ commentsFeedUrl = null ; if ( $ commentsExtension ) { $ commentsFeedLink = $ commentsExtension -> getFeedLink ( ) ; if ( $ commentsFeedLink ) { $ commentsFeedUrl = $ commentsFeedLink -> getHref ( ) ; } } return $ commentsFe...
Retrieve the URL for a video s comment feed .
6,448
public function unmap ( $ key ) { Option :: remove ( $ this -> _map , $ this -> _hashKey ( $ key ) ) ; return $ this ; }
Removes a mapping
6,449
public static function fromArray ( $ array ) { if ( ! is_array ( $ array ) ) { throw new InvalidArgumentException ( "Expected array, got " . gettype ( $ array ) ) ; } $ model = new static ( ) ; foreach ( $ array as $ key => $ value ) { if ( property_exists ( $ model , $ key ) ) { $ model -> $ key = $ value ; } } return...
Returns a new object with properties set from matching array keys
6,450
public static function fromObject ( $ object , $ before = null ) { if ( ! is_object ( $ object ) ) { throw new InvalidArgumentException ( "Expected object, got " . gettype ( $ object ) ) ; } $ model = new static ( ) ; if ( is_callable ( $ before ) ) { $ before ( $ model ) ; } $ backlog = [ ] ; $ members = get_object_va...
This method guarantees to first set scalar values and public properties then to set complex objects using set - methods .
6,451
public function getQueryBuilderFromRequest ( Request $ request ) { $ qb = $ this -> createValuedQueryBuilder ( 'c' ) ; if ( $ request -> get ( 'q' ) ) { $ qb -> leftJoin ( 'c.template' , 't' ) ; $ qb -> andWhere ( 'c.title LIKE :query OR c.alias LIKE :query OR c.slug LIKE :query OR t.displayName LIKE :query' ) -> setPa...
Get a querybuilder by request
6,452
public function findOneBySlug ( $ slug ) { $ query = $ this -> createValuedQueryBuilder ( 'c' ) -> where ( 'c.slug = :slug' ) -> setParameter ( 'slug' , $ slug ) -> getQuery ( ) ; return $ query -> useResultCache ( true , self :: CACHE_TTL ) -> getSingleResult ( ) ; }
Find one by slug
6,453
public function findActiveBySlug ( $ slug ) { $ query = $ this -> createValuedQueryBuilder ( 'c' ) -> where ( 'c.slug = :slug' ) -> andWhere ( 'c.active = :active' ) -> setParameters ( [ 'slug' => $ slug , 'active' => true ] ) -> getQuery ( ) ; return $ query -> useResultCache ( true , self :: CACHE_TTL ) -> getSingleR...
Find one by slug with active status
6,454
public function findOneByAlias ( $ alias ) { $ query = $ this -> createValuedQueryBuilder ( 'c' ) -> where ( 'c.alias = :alias' ) -> setParameter ( 'alias' , $ alias ) -> getQuery ( ) ; return $ query -> useResultCache ( true , self :: CACHE_TTL ) -> getSingleResult ( ) ; }
Find one by alias
6,455
public function findActiveByAlias ( $ alias ) { $ query = $ this -> createValuedQueryBuilder ( 'c' ) -> where ( 'c.alias = :alias' ) -> andWhere ( 'c.active = :active' ) -> setParameters ( [ 'alias' => $ alias , 'active' => true ] ) -> getQuery ( ) ; return $ query -> useResultCache ( true , self :: CACHE_TTL ) -> getS...
Find one by alias with active status
6,456
public function findAnonymouslyCreatedById ( $ id ) { $ query = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.id = :id' ) -> andWhere ( 'c.active = :active' ) -> setParameters ( [ 'id' => $ id , 'active' => 0 ] ) -> getQuery ( ) ; return $ query -> useResultCache ( true , self :: CACHE_TTL ) -> getSingleResult ( )...
Find an anonymously created item by it s ID
6,457
public function findByIds ( $ ids ) { if ( ! is_array ( $ ids ) ) { $ ids = explode ( ',' , $ ids ) ; } $ items = $ this -> createValuedQueryBuilder ( 'c' ) -> andWhere ( 'c.id IN (:ids)' ) -> setParameter ( 'ids' , $ ids ) -> andWhere ( 'c.deletedAt IS NULL' ) -> getQuery ( ) -> useResultCache ( true , self :: CACHE_T...
Find content items by multiple ids
6,458
public function showFeedback ( Request $ request , $ userId ) { $ user = User :: findOrFail ( $ userId ) ; switch ( $ request -> input ( 'type' ) ) { case 'positive' : $ feedbacks = $ user -> feedbackReceived ( ) -> positive ( ) -> paginate ( ) ; break ; case 'neutral' : $ feedbacks = $ user -> feedbackReceived ( ) -> ...
Return the user feedback view .
6,459
protected function fetchBlocks ( ) { if ( null === $ this -> blocks ) { $ this -> blocks = array ( ) ; $ allBlocks = ContentBlockQuery :: create ( ) -> find ( ) ; foreach ( $ allBlocks as $ block ) { $ this -> blocks [ $ block -> getName ( ) ] [ $ block -> getLocale ( ) ] = $ block ; } } }
Fetch all blocks in one query to minimize db access .
6,460
public function getRendererTemplateForPage ( ContentPage $ contentPage ) { if ( null !== $ contentPage -> getContentTypeId ( ) ) { return $ contentPage -> getContentType ( ) -> getTemplateName ( ) ; } return $ this -> defaultRendererTemplate ; }
Get the template to use for rendering content .
6,461
public function getTemplateForPage ( ContentPage $ contentPage ) { if ( null !== $ contentPage -> getTemplateId ( ) ) { return $ contentPage -> getTemplate ( ) -> getTemplateName ( ) ; } return $ this -> defaultTemplate ; }
Get the template to extend when rendering content .
6,462
public function fetchPage ( $ pageName ) { $ pageName = ( string ) $ pageName ; if ( ! array_key_exists ( $ pageName , $ this -> pages ) ) { if ( '' == $ pageName ) { $ page = ContentPageQuery :: create ( ) -> filterByIsPublished ( true ) -> filterByName ( null , Criteria :: ISNULL ) -> _or ( ) -> filterByName ( '' ) -...
Fetch a content page by its name
6,463
public function getOrCreateContentBlock ( $ name , $ locale = null , $ useLocaleFallback = null , $ defaultType = null , $ defaultValue = null ) { $ autoLocale = false ; if ( null === $ locale ) { $ locale = ( null !== $ this -> translator ) ? $ this -> translator -> getLocale ( ) : $ this -> defaultLocale ; $ autoLoca...
Fetch the ContentBlock object with the given name and locale . If no block with the given parameters exists it is created automatically and assigned the given default values if available .
6,464
public function hasContentBlock ( $ name , $ locale ) { $ this -> fetchBlocks ( ) ; return isset ( $ this -> blocks [ $ name ] [ $ locale ] ) ; }
Check if a content block with the given name and locale exists .
6,465
public function getContentBlock ( $ name , $ locale , $ useLocaleFallback = false ) { $ this -> fetchBlocks ( ) ; if ( $ this -> hasContentBlock ( $ name , $ locale ) ) { return $ this -> blocks [ $ name ] [ $ locale ] ; } elseif ( $ useLocaleFallback ) { $ key = array_search ( $ locale , $ this -> locales ) ; if ( fal...
Get the content block with the given parameters . Returns NULL if no block was found .
6,466
public function getMissingLocalesForBlockName ( $ name ) { $ locales = array ( ) ; foreach ( $ this -> locales as $ locale ) { if ( ! $ this -> hasContentBlock ( $ name , $ locale ) ) { $ locales [ $ locale ] = $ locale ; } } return $ locales ; }
Get all locales for the given block that have not been saved yet .
6,467
protected function createContentBlock ( $ name , $ locale , $ type , $ content ) { $ block = new ContentBlock ( ) ; $ block -> setName ( $ name ) -> setLocale ( $ locale ) -> setType ( $ type ) -> setContent ( $ content ) -> save ( ) ; $ this -> blocks [ $ name ] [ $ locale ] = $ block ; return $ block ; }
Create content block in database .
6,468
public function merge ( UnitOfWork $ other ) { if ( ! $ this -> uniqueId -> equals ( $ other -> uniqueId ) ) { throw new \ InvalidArgumentException ( 'Cannot merge units with different UIDs' ) ; } $ this -> workload = new Workload ( sprintf ( '%s%s' , $ this -> getQuery ( ) , $ other -> getQuery ( ) ) ) ; }
Merges this unit with given one
6,469
public static function Faom03 ( $ t ) { $ a ; $ a = fmod ( 450160.398036 + $ t * ( - 6962890.5431 + $ t * ( 7.4722 + $ t * ( 0.007702 + $ t * ( - 0.00005939 ) ) ) ) , TURNAS ) * DAS2R ; return $ a ; }
- - - - - - - - - - i a u F a o m 0 3 - - - - - - - - - -
6,470
protected function getBrandIds ( BrandCollectionTransfer $ brandCollectionTransfer ) : array { $ ids = [ ] ; foreach ( $ brandCollectionTransfer -> getBrands ( ) as $ brandTransfer ) { $ ids [ ] = $ brandTransfer -> getIdBrand ( ) ; } return $ ids ; }
Get brand ids
6,471
public function get ( $ key ) { $ entry = $ this -> redis -> hGet ( $ this -> cacheKey , $ key ) ; if ( $ entry ) { $ entry = unserialize ( $ entry ) ; if ( $ entry [ 'expire' ] ) { $ now = new \ DateTime ( 'now' , new \ DateTimeZone ( 'UTC' ) ) ; if ( ( int ) $ now -> format ( 'U' ) > $ entry [ 'expire' ] ) { $ this -...
Get entry from cache storage
6,472
public static function createFromObjects ( array $ objects = null ) { if ( $ objects === null ) { return null ; } $ collection = new static ( ) ; foreach ( $ objects as $ v ) { if ( ! ( $ v instanceof Contact ) && ( $ v instanceof stdClass ) ) { $ part = new Contact ( ) ; $ part -> updateFromObject ( $ v ) ; } $ collec...
Convert stdClass objects to a collection of email body parts .
6,473
protected function prepareDispatcher ( ) { $ this -> dispatcher = simpleDispatcher ( function ( RouteCollector $ r ) { foreach ( $ this -> routes as $ route ) { $ r -> addRoute ( $ route -> methods ( ) , $ route -> path ( ) , $ route -> data ( ) ) ; } } ) ; }
Prepare route dispatcher .
6,474
private function prepareContent ( $ postArray ) { $ returnArray = [ ] ; function combine ( $ item1 , $ item2 ) { return $ item1 . $ item2 ; } unset ( $ postArray [ '_token' ] ) ; foreach ( $ postArray as $ key => $ item ) { $ keys = explode ( '__' , $ key ) ; if ( is_array ( $ item ) ) { if ( isset ( $ item [ 'before' ...
create the array that will be saved in the file
6,475
public function getErrorMessages ( $ attribute = null ) { return is_null ( $ attribute ) ? $ this -> errorMessages : $ this -> errorMessages [ $ attribute ] ; }
Get error messages
6,476
public static function getInstance ( ) { $ calledClass = get_called_class ( ) ; $ registry = Registry :: getInstance ( ) ; return isset ( $ registry [ $ calledClass ] ) ? $ registry [ $ calledClass ] : ( $ registry [ $ calledClass ] = new $ calledClass ( ) ) ; }
Returns the instance of the called class .
6,477
public function set ( $ ip ) { if ( is_long ( $ ip ) ) { $ ip = long2ip ( $ ip ) ; } Assertion :: ip ( $ ip ) ; $ this -> callMethod ( 'setip' , compact ( 'ip' ) ) ; return true ; }
Sets an IP
6,478
public static function colorize ( $ text , $ status ) { $ out = "" ; switch ( $ status ) { case "SUCCESS" : $ out = "[42m" ; break ; case "FAILURE" : $ out = "[41m" ; break ; case "WARNING" : $ out = "[43m" ; break ; case "NOTE" : $ out = "[44m" ; break ; default : throw new Exception ( "Invalid status: " . $ status ) ...
Set background color of text
6,479
public function makeCountable ( Data $ data ) : ? CountableFormat { if ( ! $ data -> isCountable ( ) ) { return null ; } return CountableFormat :: make ( $ data ) ; }
Crea un objeto CountableFormat
6,480
public function makeThrowable ( Data $ data ) : ? ExceptionFormat { if ( ! $ data -> isThrowable ( ) ) { return null ; } return ExceptionFormat :: make ( $ data -> getValue ( ) ) ; }
Crea un objeto ExceptionFormat
6,481
public function makeStringifable ( Data $ data ) : ? ScalarFormat { if ( ! $ data -> isConvertibleToString ( ) ) { return null ; } return ScalarFormat :: make ( $ data ) ; }
Crea un objeto ScalarFormat
6,482
public function makeHashable ( Data $ data ) : ? HashableFormat { if ( ! $ data -> isHashable ( ) ) { return null ; } return HashableFormat :: make ( $ data ) ; }
Crea un objeto HashableFormat
6,483
public function makeData ( Data $ data ) : ? DataObjectFormat { if ( ! $ data -> isInstanceOf ( Data :: class ) ) { return null ; } return DataObjectFormat :: make ( $ data ) ; }
Crea un objeto DataFormat
6,484
public static function initialize ( $ namespace , $ config , $ cache ) { $ context = new self ( $ namespace ) ; $ context -> cache = $ cache ; $ context -> config = $ config ; $ context -> prefix = $ config -> get ( 'app.prefix' , null ) ; $ context -> parameters = Parameters :: wrap ( [ ] ) ; self :: $ instance = $ co...
Create an instance of the context .
6,485
private function setCurrentPage ( $ currentPage , $ totalPage ) { if ( 1 > $ currentPage ) { $ currentPage = 1 ; } if ( ( 0 < $ totalPage ) && ( $ totalPage < $ currentPage ) ) { $ currentPage = $ totalPage ; } $ this -> currentPage = $ currentPage ; }
Set current page .
6,486
private function addRoutesForModels ( ) { foreach ( $ this -> _models as $ model ) { $ modelName = strtolower ( $ model ) ; $ mainUrl = '/' . $ modelName ; $ resourceUrl = '/' . $ modelName . '/' . '[:id]' ; $ controllerName = $ model . 'Controller' ; $ controller = new $ controllerName ( ) ; if ( $ model :: $ get_all_...
This is where RESTful routes are mapped by Klein
6,487
private function addCustomRoutes ( ) { foreach ( Route :: getRoutes ( ) as $ route ) { $ this -> _router -> respond ( $ route [ 'method' ] , $ route [ 'path' ] , $ route [ 'callback' ] ) ; } }
RESTful routes defined by Cymbaline
6,488
public function parse ( $ markdown ) { $ document = $ this -> parser -> parse ( $ markdown ) ; $ html = $ this -> renderer -> renderBlock ( $ document ) ; return $ html ; }
Parse markdown to html
6,489
protected function initializeCommonMark ( $ mediaRoot ) { $ environment = Environment :: createCommonMarkEnvironment ( ) ; $ environment -> addInlineParser ( new MediaParser ( $ mediaRoot ) ) ; return $ environment ; }
Create a new instance of commonMark with some custom parser rules
6,490
public static function Tttcg ( $ tt1 , $ tt2 , & $ tcg1 , & $ tcg2 ) { $ t77t = DJM77 + TTMTAI / DAYSEC ; $ elgg = ELG / ( 1.0 - ELG ) ; if ( $ tt1 > $ tt2 ) { $ tcg1 = $ tt1 ; $ tcg2 = $ tt2 + ( ( $ tt1 - DJM0 ) + ( $ tt2 - $ t77t ) ) * $ elgg ; } else { $ tcg1 = $ tt1 + ( ( $ tt2 - DJM0 ) + ( $ tt1 - $ t77t ) ) * $ e...
- - - - - - - - - i a u T t t c g - - - - - - - - -
6,491
public function Index ( $ Keywords = '' , $ Page = '' , $ Order = '' ) { $ this -> Permission ( array ( 'Garden.Users.Add' , 'Garden.Users.Edit' , 'Garden.Users.Delete' ) , '' , FALSE ) ; $ this -> AddJsFile ( 'jquery.gardenmorepager.js' ) ; $ this -> AddJsFile ( 'user.js' ) ; $ this -> Title ( T ( 'Users' ) ) ; $ this...
User management list .
6,492
public function ApplicantCount ( ) { $ this -> Permission ( 'Garden.Users.Approve' ) ; $ RoleModel = new RoleModel ( ) ; $ Count = $ RoleModel -> GetApplicantCount ( ) ; if ( $ Count > 0 ) echo '<span class="Alert">' , $ Count , '</span>' ; }
Show how many applicants are in the queue .
6,493
public function Applicants ( ) { $ this -> Permission ( 'Garden.Users.Approve' ) ; $ this -> AddSideMenu ( 'dashboard/user/applicants' ) ; $ this -> AddJsFile ( 'jquery.gardencheckcolumn.js' ) ; $ this -> Title ( T ( 'Applicants' ) ) ; $ this -> FireEvent ( 'BeforeApplicants' ) ; if ( $ this -> Form -> AuthenticatedPos...
Show applicants queue .
6,494
public function AutoComplete ( ) { $ this -> DeliveryType ( DELIVERY_TYPE_NONE ) ; $ Q = GetIncomingValue ( 'q' ) ; $ UserModel = new UserModel ( ) ; $ Data = $ UserModel -> GetLike ( array ( 'u.Name' => $ Q ) , 'u.Name' , 'asc' , 10 , 0 ) ; foreach ( $ Data -> Result ( ) as $ User ) { echo htmlspecialchars ( $ User ->...
Autocomplete a username .
6,495
public function Ban ( $ UserID , $ Unban = FALSE ) { $ this -> Permission ( 'Garden.Moderation.Manage' ) ; $ User = Gdn :: UserModel ( ) -> GetID ( $ UserID , DATASET_TYPE_ARRAY ) ; if ( ! $ User ) throw NotFoundException ( $ User ) ; $ UserModel = Gdn :: UserModel ( ) ; $ User = $ UserModel -> GetID ( $ UserID ) ; if ...
Ban a user and optionally delete their content .
6,496
public function Browse ( $ Keywords = '' , $ Page = '' , $ Order = '' ) { $ this -> View = 'index' ; $ this -> Index ( $ Keywords , $ Page , $ Order = '' ) ; }
Page thru user list .
6,497
public function Decline ( $ UserID = '' , $ TransientKey = '' ) { $ this -> Permission ( 'Garden.Users.Approve' ) ; $ Session = Gdn :: Session ( ) ; if ( $ Session -> ValidateTransientKey ( $ TransientKey ) ) { if ( $ this -> HandleApplicant ( 'Decline' , $ UserID ) ) $ this -> InformMessage ( T ( 'Your changes have be...
Decline a user application .
6,498
public function Delete ( $ UserID = '' , $ Method = '' ) { $ this -> Permission ( 'Garden.Users.Delete' ) ; $ Session = Gdn :: Session ( ) ; if ( $ Session -> User -> UserID == $ UserID ) trigger_error ( ErrorMessage ( "You cannot delete the user you are logged in as." , $ this -> ClassName , 'FetchViewLocation' ) , E_...
Delete a user account .
6,499
public function EmailAvailable ( $ Email = '' ) { $ this -> _DeliveryType = DELIVERY_TYPE_BOOL ; $ Available = TRUE ; if ( C ( 'Garden.Registration.EmailUnique' , TRUE ) && $ Email != '' ) { $ UserModel = Gdn :: UserModel ( ) ; if ( $ UserModel -> GetByEmail ( $ Email ) ) $ Available = FALSE ; } if ( ! $ Available ) $ ...
Determine whether user can register with this email address .