class.atombuildertext.inc.php

来自「太烦了」· PHP 代码 · 共 67 行

PHP
67
字号
<?php
require_once 'class.AtomBuilderBase.inc.php';

/**
* Class for creating an Atom-Feed
* @author Michael Wimmer <flaimo@gmx.net>
* @category FLP
* @copyright Copyright 漏 2002-2006, Michael Wimmer
* @license Free for non-commercial use
* @link http://flp.sf.net/
* @package Atom
* @version 1.00
*/
class AtomBuilderText extends AtomBuilderBase {
	protected $data;
	protected $type;
	protected $allowed_types = array('xhtml', 'text', 'html');

	function __construct($data = '', $type = 'text') {
		parent::__construct();
		$this->setData($data);
		$this->type = 'text';
		$this->setContentType($type);
	} // end constructor


	public function setData($data = '') {
		$this->data = $data;
	} // end function

	public function setContentType($string = '') {
		if (in_array($string, $this->allowed_types) == TRUE) {
			return parent::setVar($string, 'type', 'string');
		} // end if
		return FALSE;
	} // end function
/*
	public function setMode($string = 'escaped') {
		if (array_key_exists($string, $this->allowed_modes) == TRUE) {
			if (!isset($this->type)) {
				return parent::setVar($string, 'mode', 'string');
			} // end if

			foreach ($this->allowed_modes as $mode => $types) {
				if (in_array($this->type, $types) == TRUE) {
					return parent::setVar($mode, 'mode', 'string');
				} // end if
			} // end foreach

			return FALSE;
		} // end if
	} // end function
*/
	public function getData() {
		return $this->data;
	} // end function

	public function getContentType() {
		return parent::getVar('type');
	} // end function
/*
	public function getMode() {
		return parent::getVar('mode');
	} // end function
*/
} // end class
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?