[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/ -> subscription.php (summary)

(no description)

File Size: 693 lines (24 kb)
Included or required: 1 time
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

Subscription:: (18 methods):
  isenabled()
  file()
  lock()
  unlock()
  buildregex()
  subscribers()
  add()
  remove()
  user_subscription()
  send_bulk()
  send_diff()
  send_media_diff()
  send_register()
  send_digest()
  send_list()
  send()
  getMessageID()
  notifyaddresses()


Class: Subscription  - X-Ref

Class for handling (email) subscriptions

isenabled()   X-Ref
Check if subscription system is enabled

return: bool

file($id)   X-Ref
Return the subscription meta file for the given ID

author: Adrian Lang <lang@cosmocode.de>
param: string $id The target page or namespace, specified by id; Namespaces
return: string

lock($id)   X-Ref
Lock subscription info

We don't use io_lock() her because we do not wait for the lock and use a larger stale time

author: Adrian Lang <lang@cosmocode.de>
param: string $id The target page or namespace, specified by id; Namespaces
return: bool true, if you got a succesful lock

unlock($id)   X-Ref
Unlock subscription info

author: Adrian Lang <lang@cosmocode.de>
param: string $id The target page or namespace, specified by id; Namespaces
return: bool

buildregex($user = null, $style = null, $data = null)   X-Ref
Construct a regular expression for parsing a subscription definition line

author: Andreas Gohr <andi@splitbrain.org>
param: string|array $user
param: string|array $style
param: string|array $data
return: string complete regexp including delimiters

subscribers($page, $user = null, $style = null, $data = null)   X-Ref
Recursively search for matching subscriptions

This function searches all relevant subscription files for a page or
namespace.

author: Adrian Lang <lang@cosmocode.de>
param: string         $page The target object’s (namespace or page) id
param: string|array   $user
param: string|array   $style
param: string|array   $data
return: array

add($id, $user, $style, $data = '')   X-Ref
Adds a new subscription for the given page or namespace

This will automatically overwrite any existent subscription for the given user on this
*exact* page or namespace. It will *not* modify any subscription that may exist in higher namespaces.

param: string $id The target page or namespace, specified by id; Namespaces
param: string $user
param: string $style
param: string $data
return: bool

remove($id, $user = null, $style = null, $data = null)   X-Ref
Removes a subscription for the given page or namespace

This removes all subscriptions matching the given criteria on the given page or
namespace. It will *not* modify any subscriptions that may exist in higher
namespaces.

param: string         $id   The target object’s (namespace or page) id
param: string|array   $user
param: string|array   $style
param: string|array   $data
return: bool

user_subscription($id = '', $user = '')   X-Ref
Get data for $INFO['subscribed']

$INFO['subscribed'] is either false if no subscription for the current page
and user is in effect. Else it contains an array of arrays with the fields
“target”, “style”, and optionally “data”.

author: Adrian Lang <lang@cosmocode.de>
param: string $id  Page ID, defaults to global $ID
param: string $user User, defaults to $_SERVER['REMOTE_USER']
return: array

send_bulk($page)   X-Ref
Send digest and list subscriptions

This sends mails to all subscribers that have a subscription for namespaces above
the given page if the needed $conf['subscribe_time'] has passed already.

This function is called form lib/exe/indexer.php

param: string $page
return: int number of sent mails

send_diff($subscriber_mail, $template, $id, $rev = null, $summary = '')   X-Ref
Send the diff for some page change

param: string   $subscriber_mail The target mail address
param: string   $template        Mail template ('subscr_digest', 'subscr_single', 'mailtext', ...)
param: string   $id              Page for which the notification is
param: int|null $rev             Old revision if any
param: string   $summary         Change summary if any
return: bool                     true if successfully sent

send_media_diff($subscriber_mail, $template, $id, $rev = false)   X-Ref
Send the diff for some media change

param: string   $subscriber_mail The target mail address
param: string   $template        Mail template ('uploadmail', ...)
param: string   $id              Media file for which the notification is
param: int|bool $rev             Old revision if any

send_register($login, $fullname, $email)   X-Ref
Send a notify mail on new registration

author: Andreas Gohr <andi@splitbrain.org>
param: string $login    login name of the new user
param: string $fullname full name of the new user
param: string $email    email address of the new user
return: bool true if a mail was sent

send_digest($subscriber_mail, $id, $lastupdate)   X-Ref
Send a digest mail

Sends a digest mail showing a bunch of changes of a single page. Basically the same as send_diff()
but determines the last known revision first

author: Adrian Lang <lang@cosmocode.de>
param: string $subscriber_mail The target mail address
param: string $id              The ID
param: int    $lastupdate      Time of the last notification
return: bool

send_list($subscriber_mail, $ids, $ns_id)   X-Ref
Send a list mail

Sends a list mail showing a list of changed pages.

author: Adrian Lang <lang@cosmocode.de>
param: string $subscriber_mail The target mail address
param: array  $ids             Array of ids
param: string $ns_id           The id of the namespace
return: bool true if a mail was sent

send($subscriber_mail, $subject, $context, $template, $trep, $hrep = null, $headers = array()   X-Ref
Helper function for sending a mail

author: Adrian Lang <lang@cosmocode.de>
param: string $subscriber_mail The target mail address
param: string $subject         The lang id of the mail subject (without the
param: string $context         The context of this mail, eg. page or namespace id
param: string $template        The name of the mail template
param: array  $trep            Predefined parameters used to parse the
param: array  $hrep            Predefined parameters used to parse the
param: array  $headers         Additional mail headers in the form 'name' => 'value'
return: bool

getMessageID($id, $rev = null)   X-Ref
Get a valid message id for a certain $id and revision (or the current revision)

param: string $id  The id of the page (or media file) the message id should be for
param: string $rev The revision of the page, set to the current revision of the page $id if not set
return: string

notifyaddresses(&$data)   X-Ref
Default callback for COMMON_NOTIFY_ADDRESSLIST

Aggregates all email addresses of user who have subscribed the given page with 'every' style

author: Steven Danz <steven-danz@kc.rr.com>
author: Adrian Lang <lang@cosmocode.de>
param: array &$data Containing the entries: