Class Klutz_Comic

Description

Klutz Comic Class.

$Horde: klutz/lib/Comic.php,v 1.33 2006/11/26 03:18:55 chuck Exp $

Located in /lib/Comic.php (line 10)


	
			
Direct descendents
Class Description
 class Klutz_Comic_bysize Klutz_Comic_bysize Class.
 class Klutz_Comic_direct Klutz_Comic_direct Class.
 class Klutz_Comic_search Klutz_Comic_search Class.
Variable Summary
 string $agent
 string $author
 string $comment
 array $cookies
 array $days
 array $headers
 string $homepage
 HTTP_Request $http
 integer $icount
 date $idate
 string $iformat
 string $isow
 string $itype
 string $name
 boolean $nohistory
 string $offset
 array $override
 string $pass
 string $referer
 array $subs
 string $url
 string $user
Method Summary
 Klutz_Comic Klutz_Comic ( &$comic, string $comic)
 string getInstance (timestamp $date)
 integer getInstance_monthly (timestamp $date)
 integer getInstance_ref (timestamp $date)
 integer getInstance_weekly (timestamp $date)
 integer getInstance_yearly (timestamp $date)
 mixed getOverride (string $setting, [timestamp $date = null], [string $array_map = null])
 string substitute (string $string, [timestamp $date = null])
 void _initHTTP (timestamp $date,  $url)
Variables
string $agent = null (line 99)

The user-agent to use when fetching the comic.

string $author = null (line 24)

The author or authors of the comic (the byline)

string $comment = null (line 47)

Some comment to display for this comic

array $cookies = array() (line 120)

Cookies to set when fetching the comic.

array $days = array('mon','tue','wed','thu','fri','sat','sun') (line 40)

Days (lowercase, three-letter english abbreviation) that this comic is is available.

array $headers = array() (line 127)

Headers to set when fetching the comic.

string $homepage = null (line 32)

The URL for the official homepage (not necessarily where we get the comic from.

HTTP_Request $http = null (line 73)

Web browser object used to fetch pages

integer $icount = 0 (line 161)

The number of the "first" instance of the comic (the reference number) when using the reference-based instance type

date $idate = null (line 168)

The date for which the reference is icount.

string $iformat = '%d' (line 153)

Format string for the instance construct (printf string)

string $isow = 'sun' (line 176)

The day the "week" starts for instance type weekly.

Abbreviated day name in english, lowercase.

string $itype = null (line 146)

Method for counting instances (when using the 'i' construct in substitutions.

string $name = null (line 17)

The title of the comics (Dilbert, The 5th Wave, etc.)

boolean $nohistory = false (line 62)

Are past episodes available? Some comics are difficult or impossible to retrieve other than the day it's published.

string $offset = 0 (line 54)

Days behind the current date this comic is published

array $override = array() (line 185)

The array of overrides by weekday. If sun_url exists, then when trying to fetch the sunday edition of this comic, it will fetch it from the specified url instead of $url.

string $pass = null (line 113)

The password to use when fetching the comic.

string $referer = null (line 92)

The referral URL to use when fetching the comic.

array $subs = null (line 134)

An array of the fields we need to do substitution on.

string $url (line 80)

The first url we need to hit to get the comic we want.

string $user = null (line 106)

The username to use when fetching the comic.

Methods
Constructor Klutz_Comic (line 192)

Loads the $comics[$comic] array into this object

Klutz_Comic Klutz_Comic ( &$comic, string $comic)
  • string $comic: The comic to create this object from
  • &$comic
getInstance (line 409)

Get the instance requested based on the date. The instance is determined by itype, iformat, idate, isow

  • return: An strftime-formatted string based on the iformat parameter
string getInstance (timestamp $date)
  • timestamp $date: The date the instance occurs on
getInstance_monthly (line 432)

Get an instance number for a comic that appears monthly

  • return: The instance number (unformatted)
integer getInstance_monthly (timestamp $date)
  • timestamp $date: The date the comic appears
getInstance_ref (line 491)

Get an instance number for a comic based on a date reference.

This takes the idate option as a reference date, then uses the 'days' setting to determine how often it appears. Using this information it extrapolates which instance will occur on the date requested.

  • return: The instance number (unformatted)
integer getInstance_ref (timestamp $date)
  • timestamp $date: The date the comic appears
getInstance_weekly (line 463)

Get an instance number for a comic that appears weekly

  • return: The instance number (unformatted)
integer getInstance_weekly (timestamp $date)
  • timestamp $date: The date the comic appears
getInstance_yearly (line 475)

Get an instance number for a comic that appears yearly (NOT IMPLEMENTED!)

  • return: The instance number (unformatted)
integer getInstance_yearly (timestamp $date)
  • timestamp $date: The date the comic appears
getOverride (line 322)

Check for "override" settings - settings that override other settings depending on the day on which the comic appears

  • return: If the setting is an array, returns the setting passed through array_map if array_map was passed. Otherwise, returns the value of the setting, overridden if an override is present
mixed getOverride (string $setting, [timestamp $date = null], [string $array_map = null])
  • string $setting: The name of the setting to override
  • timestamp $date: The date to check for overrides
  • string $array_map: Filter to be used with array_map
substitute (line 366)

Process known substitutions in a string. Currently known options:

  • {dow(int day, string format)} day is numeric day of the week, format format is an strftime string (e.g. '%Y%m%d'), replaced with the formatted date for the requested day of the week
  • {i} replaced with the instance of this comic as determined by the various instance configuration options
  • {format} format is an strftime string, replaced with todays date formatted according to the format string
  • {lc(string)} replaces string with string lowercased
  • {uc(string)} replaces string with string uppercased
  • {t(string)} removes extra space surrounding string
  • {tl0(string)} removes leading zeroes from string

  • return: A string with all substitutions made
string substitute (string $string, [timestamp $date = null])
  • string $string: String to process
  • timestamp $date: Date to use when processing subs
_initHTTP (line 249)

Create an HTTP_Request object and set all parameters necessary to perform fetches for this comic.

void _initHTTP (timestamp $date,  $url)
  • timestamp $date: Date of the comic to retrieve (default today)
  • $url

Documentation generated on Sun, 30 Jan 2011 05:30:34 +0000 by phpDocumentor 1.4.3