[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_contact/helpers/ -> vcard.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: vcard.php 14401 2010-01-26 14:10:00Z louis $
   4   * @package        Joomla
   5   * @subpackage    Contact
   6   * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant to the
   9   * GNU General Public License, and as distributed it includes or is derivative
  10   * of works licensed under the GNU General Public License or other free or open
  11   * source software licenses. See COPYRIGHT.php for copyright notices and
  12   * details.
  13   */
  14  
  15  // no direct access
  16  defined('_JEXEC') or die('Restricted access');
  17  
  18  jimport('bitfolge.vcard');
  19  
  20  /**
  21   * Class needed to extend vcard class and to correct minor errors
  22   *
  23   * @pacakge Joomla
  24   * @subpackage    Contacts
  25   */
  26  class JvCard extends vCard
  27  {
  28      // needed to fix bug in vcard class
  29  	function setName( $family='', $first='', $additional='', $prefix='', $suffix='' ) {
  30          $this->properties["N"]     = "$family;$first;$additional;$prefix;$suffix";
  31          $this->setFormattedName( trim( "$prefix $first $additional $family $suffix" ) );
  32      }
  33  
  34      // needed to fix bug in vcard class
  35  	function setAddress( $postoffice='', $extended='', $street='', $city='', $region='', $zip='', $country='', $type='HOME;POSTAL' ) {
  36          // $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
  37          $separator = ';';
  38  
  39          $key         = 'ADR';
  40          if ( $type != '' ) {
  41              $key    .= $separator . $type;
  42          }
  43          $key.= ';ENCODING=QUOTED-PRINTABLE';
  44  
  45          $return = encode( $postoffice );
  46          $return .= $separator . encode( $extended );
  47          $return .= $separator . encode( $street );
  48          $return .= $separator . encode( $city );
  49          $return .= $separator . encode( $region);
  50          $return .= $separator . encode( $zip );
  51          $return .= $separator . encode( $country );
  52  
  53          $this->properties[$key] = $return;
  54      }
  55  
  56      // added ability to set filename
  57  	function setFilename( $filename ) {
  58          $this->filename = $filename .'.vcf';
  59      }
  60  
  61      // added ability to set position/title
  62  	function setTitle( $title ) {
  63          $title     = trim( $title );
  64  
  65          $this->properties['TITLE']     = $title;
  66      }
  67  
  68      // added ability to set organisation/company
  69  	function setOrg( $org ) {
  70          $org     = trim( $org );
  71  
  72          $this->properties['ORG'] = $org;
  73      }
  74  
  75  	function getVCard( $sitename ) {
  76          $text     = 'BEGIN:VCARD';
  77          $text    .= "\r\n";
  78          $text     .= 'VERSION:2.1';
  79          $text    .= "\r\n";
  80  
  81          foreach( $this->properties as $key => $value ) {
  82              $text    .= "$key:$value";
  83              $text    .= "\r\n";
  84          }
  85          $text    .= 'REV:'. date( 'Y-m-d' ) .'T'. date( 'H:i:s' ). 'Z';
  86          $text    .= "\r\n";
  87          $text    .= 'MAILER: Joomla! vCard for '. $sitename;
  88          $text    .= "\r\n";
  89          $text    .= 'END:VCARD';
  90          $text    .= "\r\n";
  91  
  92          return $text;
  93      }
  94  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1