function setConfig( $config, $value ) {
    switch( strtoupper( $config )) {
      case 'ALLOWEMPTY':
        $this->allowEmpty = $value;
        break;
      case 'DELIMITER':
        $this->delimiter = $value;
        break;
      case 'DIRECTORY':
        $value   = trim( $value );
        $nl      = $this->getConfig('delimiter');
        if( $nl == substr( $value, ( 0 - strlen( $nl ))))
          $value = substr( $value, 0, ( strlen( $value ) - strlen( $nl )));
        if( is_dir( $value )) {
            /* local directory */
          clearstatcache();
          $this->directory = $value;
          $this->url       = null;
          return TRUE;
        }
        else
          return FALSE;
        break;
      case 'FILENAME':
        $value   = trim( $value );
        if( !empty( $this->url )) {
            /* remote directory+file - URL */
          $this->filename = $value;
          return TRUE;
        }
        $dirfile = $this->getConfig( 'directory' ).$this->getConfig( 'delimiter' ).$value;
        if( file_exists( $dirfile )) {
            /* local existing file */
          if( is_readable( $dirfile ) || is_writable( $dirfile )) {
            clearstatcache();
            $this->filename = $value;
            return TRUE;
          }
          else
            return FALSE;
        }
        elseif( FALSE !== touch( $dirfile )) {
            /* new local file created */
          $this->filename = $value;
          return TRUE;
        }
        else
          return FALSE;
        break;
      case 'FORMAT':
        $value   = trim( $value );
        if( 'xcal' == strtolower( $value )) {
          $this->format             = 'xcal';
          $this->attributeDelimiter = $this->nl;
          $this->valueInit          = null;
        }
        else {
          $this->format             = null;
          $this->attributeDelimiter = ';';
          $this->valueInit          = ':';
        }
        break;
      case 'LANGUAGE':
         // set language for calendar component as defined in [RFC 1766]
        $value   = trim( $value );
        $this->language = $value;
        break;
      case 'NL':
      case 'NEWLINECHAR':
        $this->nl = $value;
        break;
      case 'UNIQUE_ID':
        $value   = trim( $value );
        $this->unique_id = $value;
        break;
      case 'URL':
            /* remote file - URL */
        $value     = trim( $value );
        $value     = str_replace( 'HTTP://',   'http://', $value );
        $value     = str_replace( 'WEBCAL://', 'http://', $value );
        $value     = str_replace( 'webcal://', 'http://', $value );
        $this->url = $value;
        $this->directory = null;
        $parts     = pathinfo( $value );
        return $this->setConfig( 'filename',  $parts['basename'] );
        break;
    }
  }
function setConfig( $config, $value ) {
    switch( strtoupper( $config )) {
      case 'ALLOWEMPTY':
        $this->allowEmpty = $value;
        break;
      case 'DELIMITER':
        $this->delimiter = $value;
        break;
      case 'DIRECTORY':
        $value   = trim( $value );
        $nl      = $this->getConfig('delimiter');
        if( $nl == substr( $value, ( 0 - strlen( $nl ))))
          $value = substr( $value, 0, ( strlen( $value ) - strlen( $nl )));
        if( is_dir( $value )) {
            /* local directory */
          clearstatcache();
          $this->directory = $value;
          $this->url       = null;
          return TRUE;
        }
        else
          return FALSE;
        break;
      case 'FILENAME':
        $value   = trim( $value );
        if( !empty( $this->url )) {
            /* remote directory+file - URL */
          $this->filename = $value;
          return TRUE;
        }
        $dirfile = $this->getConfig( 'directory' ).$this->getConfig( 'delimiter' ).$value;
        if( file_exists( $dirfile )) {
            /* local existing file */
          if( is_readable( $dirfile ) || is_writable( $dirfile )) {
            clearstatcache();
            $this->filename = $value;
            return TRUE;
          }
          else
            return FALSE;
        }
        elseif( FALSE !== touch( $dirfile )) {
            /* new local file created */
          $this->filename = $value;
          return TRUE;
        }
        else
          return FALSE;
        break;
      case 'FORMAT':
        $value   = trim( $value );
        if( 'xcal' == strtolower( $value )) {
          $this->format             = 'xcal';
          $this->attributeDelimiter = $this->nl;
          $this->valueInit          = null;
        }
        else {
          $this->format             = null;
          $this->attributeDelimiter = ';';
          $this->valueInit          = ':';
        }
        break;
      case 'LANGUAGE':
         // set language for calendar component as defined in [RFC 1766]
        $value   = trim( $value );
        $this->language = $value;
        break;
      case 'NL':
      case 'NEWLINECHAR':
        $this->nl = $value;
        break;
      case 'UNIQUE_ID':
        $value   = trim( $value );
        $this->unique_id = $value;
        break;
      case 'URL':
            /* remote file - URL */
        $value     = trim( $value );
        $value     = str_replace( 'HTTP://',   'http://', $value );
        $value     = str_replace( 'WEBCAL://', 'http://', $value );
        $value     = str_replace( 'webcal://', 'http://', $value );
        $this->url = $value;
        $this->directory = null;
        $parts     = pathinfo( $value );
        return $this->setConfig( 'filename',  $parts['basename'] );
        break;
    }
  }
function setConfig ( $ config , $ value ) { switch ( strtoupper ( $ config ) ) { case 'ALLOWEMPTY' : $ this -> allowEmpty = $ value ; break ; case 'DELIMITER' : $ this -> delimiter = $ value ; break ; case 'DIRECTORY' : $ value = trim ( $ value ) ; $ nl = $ this -> getConfig ( 'delimiter' ) ; if ( $ nl == substr ( $ value , ( 0 - strlen ( $ nl ) ) ) ) $ value = substr ( $ value , 0 , ( strlen ( $ value ) - strlen ( $ nl ) ) ) ; if ( is_dir ( $ value ) ) { /* local directory */ clearstatcache ( ) ; $ this -> directory = $ value ; $ this -> url = null ; return TRUE ; } else return FALSE ; break ; case 'FILENAME' : $ value = trim ( $ value ) ; if ( ! empty ( $ this -> url ) ) { /* remote directory+file - URL */ $ this -> filename = $ value ; return TRUE ; } $ dirfile = $ this -> getConfig ( 'directory' ) . $ this -> getConfig ( 'delimiter' ) . $ value ; if ( file_exists ( $ dirfile ) ) { /* local existing file */ if ( is_readable ( $ dirfile ) || is_writable ( $ dirfile ) ) { clearstatcache ( ) ; $ this -> filename = $ value ; return TRUE ; } else return FALSE ; } elseif ( FALSE !== touch ( $ dirfile ) ) { /* new local file created */ $ this -> filename = $ value ; return TRUE ; } else return FALSE ; break ; case 'FORMAT' : $ value = trim ( $ value ) ; if ( 'xcal' == strtolower ( $ value ) ) { $ this -> format = 'xcal' ; $ this -> attributeDelimiter = $ this -> nl ; $ this -> valueInit = null ; } else { $ this -> format = null ; $ this -> attributeDelimiter = ';' ; $ this -> valueInit = ':' ; } break ; case 'LANGUAGE' : // set language for calendar component as defined in [RFC 1766] $ value = trim ( $ value ) ; $ this -> language = $ value ; break ; case 'NL' : case 'NEWLINECHAR' : $ this -> nl = $ value ; break ; case 'UNIQUE_ID' : $ value = trim ( $ value ) ; $ this -> unique_id = $ value ; break ; case 'URL' : /* remote file - URL */ $ value = trim ( $ value ) ; $ value = str_replace ( 'HTTP://' , 'http://' , $ value ) ; $ value = str_replace ( 'WEBCAL://' , 'http://' , $ value ) ; $ value = str_replace ( 'webcal://' , 'http://' , $ value ) ; $ this -> url = $ value ; $ this -> directory = null ; $ parts = pathinfo ( $ value ) ; return $ this -> setConfig ( 'filename' , $ parts [ 'basename' ] ) ; break ; } }
general vcalendar config setting

@author Kjell-Inge Gustafsson <ical@kigkonsult.se>
@since 2.2.13 - 2007-12-30
@param string $config
@param string $value
@return void
general vcalendar config setting