Overview

Packages

  • Horde
    • Block
  • Klutz
  • None

Classes

  • Klutz
  • Klutz_Comic
  • Klutz_Comic_Bysize
  • Klutz_Comic_Direct
  • Klutz_Comic_Search
  • Klutz_Driver
  • Klutz_Driver_File
  • Klutz_Driver_Sql
  • Klutz_Image
  • Overview
  • Package
  • Class
  • Tree

Class Klutz_Comic

Klutz Comic Class.

Direct known subclasses

Klutz_Comic_Bysize, Klutz_Comic_Direct, Klutz_Comic_Search
Package: Klutz
Author: Marcus I. Ryan marcus@riboflavin.net
Located at Comic.php
Methods summary
public
# Klutz_Comic( string & $comic )

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

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

Parameters

$comic
The comic to create this object from
public
# _initHTTP( timestamp $date, mixed $url )

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

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

Parameters

$date
Date of the comic to retrieve (default today)
$url
public array
# _prepareSearch( array $search )

Turn the search strings from the configuration file into preg_match-formatted strings

Turn the search strings from the configuration file into preg_match-formatted strings

Parameters

$search
<p>$comic An array containing the content portion of Perl regular expressions</p>

Returns

array

Search strings properly formatted to be used with preg_match

public mixed
# getOverride( string $setting, timestamp $date = null, string $array_map = null )

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

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

Parameters

$setting
The name of the setting to override
$date
The date to check for overrides
$array_map
Filter to be used with array_map

Returns

mixed

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

public string
# substitute( string $string, timestamp $date = null )

Process known substitutions in a string. Currently known options:
o {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 o {i} replaced with the instance of this comic as determined by the various instance configuration options
o {format} format is an strftime string, replaced with todays date formatted according to the format string
o {lc(string)} replaces string with string lowercased
o {uc(string)} replaces string with string uppercased
o {t(string)} removes extra space surrounding string
o {tl0(string)} removes leading zeroes from string

Process known substitutions in a string. Currently known options:
o {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 o {i} replaced with the instance of this comic as determined by the various instance configuration options
o {format} format is an strftime string, replaced with todays date formatted according to the format string
o {lc(string)} replaces string with string lowercased
o {uc(string)} replaces string with string uppercased
o {t(string)} removes extra space surrounding string
o {tl0(string)} removes leading zeroes from string

Parameters

$string
String to process
$date
Date to use when processing subs

Returns

string
A string with all substitutions made
public string
# getInstance( timestamp $date )

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

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

Parameters

$date
The date the instance occurs on

Returns

string

An strftime-formatted string based on the iformat parameter

public integer
# getInstance_monthly( timestamp $date )

Get an instance number for a comic that appears monthly

Get an instance number for a comic that appears monthly

Parameters

$date
The date the comic appears

Returns

integer
The instance number (unformatted)
public integer
# getInstance_weekly( timestamp $date )

Get an instance number for a comic that appears weekly

Get an instance number for a comic that appears weekly

Parameters

$date
The date the comic appears

Returns

integer
The instance number (unformatted)
public integer
# getInstance_yearly( timestamp $date )

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

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

Parameters

$date
The date the comic appears

Returns

integer
The instance number (unformatted)
public integer
# getInstance_ref( timestamp $date )

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.

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.

Parameters

$date
The date the comic appears

Returns

integer
The instance number (unformatted)
Properties summary
public string $name

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

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

# null
public string $author

The author or authors of the comic (the byline)

The author or authors of the comic (the byline)

# null
public string $homepage

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

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

# null
public array $days

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

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

# array('mon','tue','wed','thu','fri','sat','sun')
public string $comment

Some comment to display for this comic

Some comment to display for this comic

# null
public string $offset

Days behind the current date this comic is published

Days behind the current date this comic is published

# 0
public boolean $nohistory

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

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

# false
public HTTP_Request $http

Web browser object used to fetch pages

Web browser object used to fetch pages

# null
public string $url

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

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

#
public string $referer

The referral URL to use when fetching the comic.

The referral URL to use when fetching the comic.

# null
public string $agent

The user-agent to use when fetching the comic.

The user-agent to use when fetching the comic.

# null
public string $user

The username to use when fetching the comic.

The username to use when fetching the comic.

# null
public string $pass

The password to use when fetching the comic.

The password to use when fetching the comic.

# null
public array $cookies

Cookies to set when fetching the comic.

Cookies to set when fetching the comic.

# array()
public array $headers

Headers to set when fetching the comic.

Headers to set when fetching the comic.

# array()
public array $subs

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

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

# null
public string $itype

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

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

# null
public string $iformat

Format string for the instance construct (printf string)

Format string for the instance construct (printf string)

# '%d'
public integer $icount

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

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

# 0
public date $idate

The date for which the reference is icount.

The date for which the reference is icount.

# null
public string $isow

The day the "week" starts for instance type weekly. Abbreviated day name in english, lowercase.

The day the "week" starts for instance type weekly. Abbreviated day name in english, lowercase.

# 'sun'
public array $override

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.

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.

# array()
API documentation generated by ApiGen