Net_SMS
[ class tree: Net_SMS ] [ index: Net_SMS ] [ all elements ]

Source for file vodafoneitaly_smtp.php

Documentation is available at vodafoneitaly_smtp.php

  1. <?php
  2. /**
  3.  * Net_SMS_vodafoneitaly_smtp Class implements the SMTP API for accessing
  4.  * the Vodafone Italy SMS gateway. Use of this gateway requires an email account
  5.  * with Vodafone Italy (www.190.it).
  6.  *
  7.  * Copyright 2003-2004 Marko Djukic <marko@oblo.com>
  8.  * Copyright 2003-2004 Matteo Zambelli <mmzambe@hotmail.com>
  9.  *
  10.  * See the enclosed file COPYING for license information (LGPL). If you did not
  11.  * receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  12.  *
  13.  * $Horde: framework/Net_SMS/SMS/vodafoneitaly_smtp.php,v 1.11 2004/04/28 23:38:29 mdjukic Exp $
  14.  *
  15.  * @author Marko Djukic <marko@oblo.com>
  16.  * @author Matteo Zambelli <mmzambe@hotmail.com>
  17.  * @version $Revision: 1.11 $
  18.  * @package Net_SMS
  19.  */
  20.  
  21.     /**
  22.      * An array of capabilities, so that the driver can report which operations
  23.      * it supports and which it doesn't. Possible values are:
  24.      *   auth        - The gateway require authentication before sending;
  25.      *   batch       - Batch sending is supported;
  26.      *   multi       - Sending of messages to multiple recipients is supported;
  27.      *   receive     - Whether this driver is capable of receiving SMS;
  28.      *   credit      - Is use of the gateway based on credits;
  29.      *   addressbook - Are gateway addressbooks supported;
  30.      *   lists       - Gateway support for distribution lists.
  31.      *
  32.      * @var array $capabilities 
  33.      */
  34.     var $capabilities = array('auth'        => false,
  35.                               'batch'       => false,
  36.                               'multi'       => false,
  37.                               'receive'     => false,
  38.                               'credit'      => false,
  39.                               'addressbook' => false,
  40.                               'lists'       => false);
  41.  
  42.     /**
  43.      * This function does the actual sending of the message.
  44.      *
  45.      * @access private
  46.      *
  47.      * @param array  $message  The array containing the message and its send
  48.      *                          parameters.
  49.      * @param string $to       The destination string.
  50.      *
  51.      * @return mixed  True on success or PEAR Error on failure.
  52.      */
  53.     function _send(&$message$to)
  54.     {
  55.         if (!@include_once 'Mail.php'{
  56.             return PEAR::raiseError(_("Missing required PEAR package Mail."));
  57.         }
  58.         $mailer &Mail::factory('mail');
  59.  
  60.         /* Since this only works for Italian numbers, this is hardcoded. */
  61.         if (preg_match('/^.*?<?(\+?39)?(\d{10})>?/'$to$matches)) {
  62.             $headers['From'$this->_params['user'];
  63.             $to $matches[2'@sms.vodafone.it';
  64.             $result $mailer->send($to$headers$message['text']);
  65.             return $result;
  66.         else {
  67.             return false;
  68.         }
  69.     }
  70.  
  71.     /**
  72.      * Identifies this gateway driver and returns a brief description.
  73.      *
  74.      * @access public
  75.      *
  76.      * @return array  Array of driver info.
  77.      */
  78.     function getInfo()
  79.     {
  80.         $info['name'_("Vodafone Italy via SMTP");
  81.         $info['desc'_("This driver allows sending of messages via SMTP through the Vodafone Italy gateway, only to Vodafone numbers. It requires an email account with Vodafone Italy (http://www.190.it).");
  82.  
  83.         return $info;
  84.     }
  85.  
  86.     /**
  87.      * Returns the required parameters for this gateway driver.
  88.      *
  89.      * @access public
  90.      *
  91.      * @return array  Array of required parameters.
  92.      */
  93.     function getParams()
  94.     {
  95.         $params = array();
  96.         $params['user']       = array('label'  => _("Username"),
  97.                                       'type'   => 'text');
  98.  
  99.         return $params;
  100.     }
  101.  
  102.     /**
  103.      * Returns the parameters that can be set as default for sending messages
  104.      * using this gateway driver and displayed when sending messages.
  105.      *
  106.      * @access public
  107.      *
  108.      * @return array  Array of parameters that can be set as default.
  109.      */
  110.     function getDefaultSendParams()
  111.     {
  112.         return array();
  113.     }
  114.  
  115.     /**
  116.      * Returns the parameters for sending messages using this gateway driver,
  117.      * displayed when sending messages. These are filtered out using the
  118.      * default values set up when creating the gateway.
  119.      *
  120.      * @access public
  121.      *
  122.      * @return array  Array of required parameters.
  123.      * @todo  Would be nice to use a time/date setup rather than minutes from
  124.      *         now for the delivery time. Upload field for ringtones/logos?
  125.      */
  126.     function getSendParams($params)
  127.     {
  128.         return array();
  129.     }
  130.  
  131.     /**
  132.      * Returns a string representation of an error code.
  133.      *
  134.      * @access public
  135.      *
  136.      * @param int $error             The error code to look up.
  137.      * @param optional string $text  An existing error text to use to raise a
  138.      *                                PEAR Error.
  139.      *
  140.      * @return mixed  A textual message corrisponding to the error code or a
  141.      *                 PEAR Error if passed an existing error text.
  142.      *
  143.      * @todo  Check which of these are actually required and trim down the list.
  144.      */
  145.     function getError($error$error_text '')
  146.     {
  147.     }
  148.  
  149. }

Documentation generated on Mon, 11 Mar 2019 10:17:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.