mirror of
https://github.com/Mibew/CanteenHTML5.git
synced 2025-04-20 21:27:24 +03:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
a5b4190d60 | |||
6d7736e222 | |||
9f7340ec78 | |||
7bdec8e106 | |||
a29ea00c29 |
@ -10,4 +10,4 @@ docs.helpers=${docs.themedir}/path.js
|
|||||||
git=git
|
git=git
|
||||||
git.docs=gh-pages
|
git.docs=gh-pages
|
||||||
git.master=master
|
git.master=master
|
||||||
version=1.1.4
|
version=1.1.5
|
||||||
|
@ -1,32 +1,48 @@
|
|||||||
{
|
{
|
||||||
"name": "canteen/html5",
|
"name": "mibew/html5",
|
||||||
"description" : "Create dynamic, valid HTML5 markup with a simple an intuitive PHP API",
|
"description" : "Create dynamic, valid HTML5 markup with a simple an intuitive PHP API",
|
||||||
"version" : "1.1.4",
|
"version" : "1.1.5",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"keywords": ["html5", "markup", "document", "html", "tags"],
|
"keywords": [
|
||||||
|
"html5",
|
||||||
|
"markup",
|
||||||
|
"document",
|
||||||
|
"html",
|
||||||
|
"tags"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage" : "http://github.com/Canteen/CanteenHTML5",
|
"homepage" : "http://github.com/Mibew/CanteenHTML5",
|
||||||
"time": "2014-10-31",
|
"time": "2021-07-09",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Matt Karl",
|
"name": "Matt Karl",
|
||||||
"email": "matt@mattkarl.com",
|
"email": "matt@mattkarl.com",
|
||||||
"homepage": "http://github.com/bigtimebuddy",
|
"homepage": "http://github.com/bigtimebuddy"
|
||||||
"role": "Developer"
|
},
|
||||||
|
{
|
||||||
|
"name": "Mibew Messenger project",
|
||||||
|
"homepage": "https://mibew.org/"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {"Canteen\\HTML5\\": "src/"},
|
"psr-4": {
|
||||||
"files": ["src/HTML5.php"]
|
"Canteen\\HTML5\\": "src/"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/HTML5.php"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.0"
|
"php": ">=5.3.0"
|
||||||
},
|
},
|
||||||
|
"replace": {
|
||||||
|
"canteen/html5": "~1.1.4"
|
||||||
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://github.com/Canteen/CanteenHTML5"
|
"url": "https://github.com/Mibew/CanteenHTML5"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -53,5 +53,3 @@
|
|||||||
|
|
||||||
// Output the result formatted nice with indents
|
// Output the result formatted nice with indents
|
||||||
echo $doc;
|
echo $doc;
|
||||||
|
|
||||||
?>
|
|
@ -135,10 +135,14 @@ namespace Canteen\HTML5
|
|||||||
public function __get($name)
|
public function __get($name)
|
||||||
{
|
{
|
||||||
if (method_exists($this , $method =('get' . ucfirst($name))))
|
if (method_exists($this , $method =('get' . ucfirst($name))))
|
||||||
|
{
|
||||||
return $this->$method();
|
return $this->$method();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
throw new HTML5Error(HTML5Error::INVALID_GETTER, $name);
|
throw new HTML5Error(HTML5Error::INVALID_GETTER, $name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General purpose setter for setting attribute->name and attribute->value
|
* General purpose setter for setting attribute->name and attribute->value
|
||||||
@ -149,10 +153,14 @@ namespace Canteen\HTML5
|
|||||||
public function __set($name, $value)
|
public function __set($name, $value)
|
||||||
{
|
{
|
||||||
if (method_exists($this , $method =('set' . ucfirst($name))))
|
if (method_exists($this , $method =('set' . ucfirst($name))))
|
||||||
|
{
|
||||||
return $this->$method($value);
|
return $this->$method($value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
throw new HTML5Error(HTML5Error::INVALID_SETTER, $name);
|
throw new HTML5Error(HTML5Error::INVALID_SETTER, $name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See if a property exists
|
* See if a property exists
|
||||||
@ -166,5 +174,3 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -34,5 +34,3 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -86,7 +86,9 @@ namespace Canteen\HTML5
|
|||||||
{
|
{
|
||||||
$result = $this->docType . parent::__toString();
|
$result = $this->docType . parent::__toString();
|
||||||
if ($this->beautify)
|
if ($this->beautify)
|
||||||
|
{
|
||||||
$result = self::beautify($result);
|
$result = self::beautify($result);
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,5 +115,3 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -39,5 +39,3 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -22,7 +22,10 @@ namespace Canteen\HTML5
|
|||||||
spl_autoload_register(function($name)
|
spl_autoload_register(function($name)
|
||||||
{
|
{
|
||||||
// Ignore class names not in the HTML5 namespace
|
// Ignore class names not in the HTML5 namespace
|
||||||
if (!preg_match('/^Canteen\\\HTML5\\\/', $name)) return;
|
if (!preg_match('/^Canteen\\\HTML5\\\/', $name))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove the HTML5 namespace
|
// Remove the HTML5 namespace
|
||||||
$name = preg_replace('/^Canteen\\\HTML5\\\/', '', $name);
|
$name = preg_replace('/^Canteen\\\HTML5\\\/', '', $name);
|
||||||
@ -160,7 +163,9 @@ namespace Canteen\HTML5
|
|||||||
$node->id = substr($selector, 1);
|
$node->id = substr($selector, 1);
|
||||||
break;
|
break;
|
||||||
case '.' :
|
case '.' :
|
||||||
if ($node->class) $node->class .= ' ';
|
if ($node->class) {
|
||||||
|
$node->class .= ' ';
|
||||||
|
}
|
||||||
$node->class .= substr($selector, 1);
|
$node->class .= substr($selector, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -140,5 +140,3 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -12,11 +12,12 @@ namespace Canteen\HTML5
|
|||||||
* echo html('br');
|
* echo html('br');
|
||||||
*
|
*
|
||||||
* @class Node
|
* @class Node
|
||||||
|
* @extends Proto
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {String} [tag=null] The name of the tag
|
* @param {String} [tag=null] The name of the tag
|
||||||
* @param {Array|String} [attributes=null] The collection of tag attributes
|
* @param {Array|String} [attributes=null] The collection of tag attributes
|
||||||
*/
|
*/
|
||||||
class Node
|
class Node extends Proto
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The string name of the tag
|
* The string name of the tag
|
||||||
@ -138,9 +139,13 @@ namespace Canteen\HTML5
|
|||||||
if ($attribute->name === $name)
|
if ($attribute->name === $name)
|
||||||
{
|
{
|
||||||
if (!$this->isEmpty($value))
|
if (!$this->isEmpty($value))
|
||||||
|
{
|
||||||
$attribute->value = $value;
|
$attribute->value = $value;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
unset($this->_attributes[$i]);
|
unset($this->_attributes[$i]);
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,5 +341,3 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -233,5 +233,3 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
37
src/Proto.php
Normal file
37
src/Proto.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @module Canteen\HTML5
|
||||||
|
*/
|
||||||
|
namespace Canteen\HTML5
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Prototype class for all Canteen\HTML5 entities
|
||||||
|
*
|
||||||
|
* @class Proto
|
||||||
|
* @constructor
|
||||||
|
* @param {String} text the plain text string
|
||||||
|
*/
|
||||||
|
class Proto
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* General purpose getter to get attribute values
|
||||||
|
* @method __get
|
||||||
|
* @param {String} name The name of the property to set
|
||||||
|
*/
|
||||||
|
public function __get($name)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See if a property exists
|
||||||
|
* @method __isset
|
||||||
|
* @param {String} name The name of the attribute
|
||||||
|
*/
|
||||||
|
public function __isset($name)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -68,5 +68,3 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -58,7 +58,9 @@ namespace Canteen\HTML5
|
|||||||
'target'
|
'target'
|
||||||
),
|
),
|
||||||
'bdo' => array(),
|
'bdo' => array(),
|
||||||
'blockquote' => array('cite'),
|
'blockquote' => array(
|
||||||
|
'cite'
|
||||||
|
),
|
||||||
'body' => array(),
|
'body' => array(),
|
||||||
'br' => array(),
|
'br' => array(),
|
||||||
'button' => array(
|
'button' => array(
|
||||||
@ -82,7 +84,9 @@ namespace Canteen\HTML5
|
|||||||
'cite' => array(),
|
'cite' => array(),
|
||||||
'code' => array(),
|
'code' => array(),
|
||||||
'col' => null,
|
'col' => null,
|
||||||
'colgroup' => array('span'),
|
'colgroup' => array(
|
||||||
|
'span'
|
||||||
|
),
|
||||||
'command' => array(
|
'command' => array(
|
||||||
'checked',
|
'checked',
|
||||||
'disabled',
|
'disabled',
|
||||||
@ -137,7 +141,9 @@ namespace Canteen\HTML5
|
|||||||
'header' => array(),
|
'header' => array(),
|
||||||
'hgroup' => array(),
|
'hgroup' => array(),
|
||||||
'hr' => array(),
|
'hr' => array(),
|
||||||
'html' => array('manifest'),
|
'html' => array(
|
||||||
|
'manifest'
|
||||||
|
),
|
||||||
'img' => array(
|
'img' => array(
|
||||||
'alt',
|
'alt',
|
||||||
'crossorigin',
|
'crossorigin',
|
||||||
@ -207,7 +213,9 @@ namespace Canteen\HTML5
|
|||||||
'sizes',
|
'sizes',
|
||||||
'type'
|
'type'
|
||||||
),
|
),
|
||||||
'map' => array('name'),
|
'map' => array(
|
||||||
|
'name'
|
||||||
|
),
|
||||||
'mark' => array(),
|
'mark' => array(),
|
||||||
'menu' => array(),
|
'menu' => array(),
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
@ -266,7 +274,9 @@ namespace Canteen\HTML5
|
|||||||
'max',
|
'max',
|
||||||
'value'
|
'value'
|
||||||
),
|
),
|
||||||
'q' => array('cite'),
|
'q' => array(
|
||||||
|
'cite'
|
||||||
|
),
|
||||||
'rp' => array(),
|
'rp' => array(),
|
||||||
'rt' => array(),
|
'rt' => array(),
|
||||||
'ruby' => array(),
|
'ruby' => array(),
|
||||||
@ -290,18 +300,22 @@ namespace Canteen\HTML5
|
|||||||
'size'
|
'size'
|
||||||
),
|
),
|
||||||
'small' => array(),
|
'small' => array(),
|
||||||
'source' => array('media',
|
'source' => array(
|
||||||
|
'media',
|
||||||
'src',
|
'src',
|
||||||
'type'
|
'type'
|
||||||
),
|
),
|
||||||
'span' => array(),
|
'span' => array(),
|
||||||
'strong' => array(),
|
'strong' => array(),
|
||||||
'style' => array('media',
|
'style' => array(
|
||||||
|
'media',
|
||||||
'scoped',
|
'scoped',
|
||||||
'type'
|
'type'
|
||||||
),
|
),
|
||||||
'sub' => array(),
|
'sub' => array(),
|
||||||
'table' => array('border'),
|
'table' => array(
|
||||||
|
'border'
|
||||||
|
),
|
||||||
'tbody' => array(),
|
'tbody' => array(),
|
||||||
'td' => array(
|
'td' => array(
|
||||||
'colspan',
|
'colspan',
|
||||||
@ -329,7 +343,9 @@ namespace Canteen\HTML5
|
|||||||
'scope'
|
'scope'
|
||||||
),
|
),
|
||||||
'thead' => array(),
|
'thead' => array(),
|
||||||
'time' => array('datetime'),
|
'time' => array(
|
||||||
|
'datetime'
|
||||||
|
),
|
||||||
'title' => array(),
|
'title' => array(),
|
||||||
'tr' => array(),
|
'tr' => array(),
|
||||||
'track' => array(
|
'track' => array(
|
||||||
|
@ -72,7 +72,10 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
foreach ($d as $name=>$value)
|
foreach ($d as $name=>$value)
|
||||||
{
|
{
|
||||||
if ($name == $checkbox) continue;
|
if ($name == $checkbox)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$td = html('td', $value, 'class=' . $name);
|
$td = html('td', $value, 'class=' . $name);
|
||||||
$row->addChild($td);
|
$row->addChild($td);
|
||||||
}
|
}
|
||||||
@ -82,5 +85,3 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@ -35,5 +35,3 @@ namespace Canteen\HTML5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
Loading…
Reference in New Issue
Block a user