Example #1
0
 /**
  * Factory
  * This static method is used to create a trackback object. (Services_Trackback::create($data))
  * The factory requires a data array as described below for creation. The 'id' key is
  * obligatory for this method. Every other data is not quite necessary for the creation, but
  * might be necessary for calling other methods afterwards. See the specific methods for
  * further info on which data is required.
  *
  * @since 0.2.0
  * @static
  * @access public
  * @param array $data Data for the trackback, which is obligatory:
  *      'id'                The ID of the trackback target.
  *  Data which is optional (for construction, not for specific methods):
  *      'title'             string  Title of the trackback sending/receiving blog entry.
  *      'excerpt'           string  Abstract of the trackback sending/receiving blog entry.
  *      'blog_name'         string  Name of the trackback sending/receiving weblog.
  *      'url'               string  URL of the trackback sending/receiving blog entry.
  *      'trackback_url'     string  URL to send trackbacks to.
  * @param array $options Options to set for this trackback. Valid options:
  *      'strictness':       int     The default strictness to use in @see Services_Trackback::autodiscover().
  *      'timeout':          int     The default timeout for network operations in seconds.
  *      'fetchlines':       int     The max number of lines to fetch over the network.
  *      'httpRequest'       array   The options utilized by HTTP_Request are stored here.
  *                                  The following options are the most commonly used for HTTP_Request in
  *                                  Services_Trackback. All other options are supported too, 
  *                                  @see HTTP_Request::HTTP_Request() for more detailed documentation.
  *                                  Some options for HTTP_Request are overwritten through the global settings of
  *                                  Services_Trackback (such as timeout).
  *          'timeout':          float   THE TIMEOUT SETTING IS OVERWRITTEN BY THE GLOBAL Services_Trackback SETTING.
  *          'allowRedirects':   bool    Wether to follow HTTP redirects or not.
  *          'maxRedirects':     int     Maximum number of redirects.
  *          'useragent':        string  The user agent to use for HTTP requests.
  *
  * @return object(Services_Trackback) The newly created Trackback.
  */
 function &create($data, $options = null)
 {
     $options = isset($options) ? $options : array();
     $trackback = new Services_Trackback();
     $res = $trackback->_fromArray($data);
     if (PEAR::isError($res)) {
         return $res;
     }
     $res = $trackback->setOptions($options);
     if (PEAR::isError($res)) {
         return $res;
     }
     return $trackback;
 }