PHP 클래스 htmlHelper, nodejs-autorestart

파일 보기 프로젝트 열기: shimondoodkin/nodejs-autorestart 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$vorkHead array Array used internally by Vork to cache JavaScript and CSS snippets and place them in the head section Changing the contents of this property may cause Vork components to be rendered incorrectly.

보호된 프로퍼티들

프로퍼티 타입 설명
$_cssSingleton Flag array to avoid defining singleton JavaScript & CSS snippets more than once
$_docType string Sets the default doctype to XHTML 1.1
$_includedFiles array Internal list of included CSS & JS files used by $this->_tagBuilder() to assure that files are not included twice
$_jsSingleton Flag array to avoid defining singleton JavaScript & CSS snippets more than once
$_linkPrefix Internal storage of the link-prefix and hypertext protocol values
$_protocol Internal storage of the link-prefix and hypertext protocol values

공개 메소드들

메소드 설명
__call ( string $method, $args ) : string Creates virtual wrapper methods via $this->_tagBuilder() for the simple wrapper functions including: $html->css, js, cssInline, jsInline, div, li, p and h1-h4
__construct ( ) Sets the protocol (http/https)
alternator ( ) : boolean Returns an alternating Boolean, useful to generate alternating background colors Eg.: $colors = array(true => 'gray', false => 'white'); echo '
.
anchor ( array $args ) : string Creates an anchor or link container
code ( str $str ) : str Wrapper display computer-code samples
footer ( array $args = [] ) : string Returns an HTML footer and optional Google Analytics This method will trigger an error if executed without first calling the header() method This is meant to be utilized within layouts, not views (but will work in either)
formatProperties ( array $properties ) : string Takes an array of key-value pairs and formats them in the syntax of HTML-container properties
getNotifications ( mixed $messages, string $class = 'errormessage' ) : string Returns a list of notifications if there are any - similar to the Flash feature of Ruby on Rails
header ( array $args ) : string Returns an HTML header and opens the body container This method will trigger an error if executed more than once without first calling the footer() method on the prior usage This is meant to be utilized within layouts, not views (but will work in either)
isEven ( integer $number ) : boolean Will return true if the number passed in is even, false if odd.
jsLoad ( mixed $library, mixed $version = null, array $options = [] ) : str Load a JavaScript library via Google's AJAX API http://code.google.com/apis/ajaxlibs/documentation/
jsTools ( boolean $noJsWrapper = false ) : string Establishes a basic set of JavaScript tools, just echo $html->jsTools() before any JavaScript code that will use the tools.
link ( str $href, str $text = null, array $args = [] ) : str Shortcut to access the anchor method
setDocType ( string $docType ) Allows modification of the docType

보호된 메소드들

메소드 설명
_tagBuilder ( string $tagType, array $args = [] ) : string Creates simple HTML wrappers, accessed via $this->__call()

메소드 상세

__call() 공개 메소드

Creates virtual wrapper methods via $this->_tagBuilder() for the simple wrapper functions including: $html->css, js, cssInline, jsInline, div, li, p and h1-h4
public __call ( string $method, $args ) : string
$method string
리턴 string

__construct() 공개 메소드

Sets the protocol (http/https)
public __construct ( )

_tagBuilder() 보호된 메소드

JS and CSS files are never included more than once even if requested twice. If DEBUG mode is enabled than the second request will be added to the debug log as a duplicate. The jsSingleton and cssSingleton methods operate the same as the js & css methods except that they will silently skip duplicate requests instead of logging them. jsInlineSingleton and cssInlineSingleton makes sure a JavaScript or CSS snippet will only be output once, even if echoed out multiple times and this method will attempt to place the JS code into the head section, if has already been echoed out then it will return the JS code inline the same as jsInline. Eg.: $helloJs = "function helloWorld() {alert('Hello World');}"; echo $html->jsInlineSingleton($helloJs); Adding an optional extra argument to jsInlineSingleton/cssInlineSingleton will return the inline code bare (plus a trailing linebreak) if it cannot place it into the head section, this is used for joint JS/CSS statements: echo $html->jsInline($html->jsInlineSingleton($helloJs, true) . 'helloWorld();');
protected _tagBuilder ( string $tagType, array $args = [] ) : string
$tagType string
$args array
리턴 string

alternator() 공개 메소드

..
'; //gray background echo '
...
'; //white background echo '
...
'; //gray background
public alternator ( ) : boolean
리턴 boolean

anchor() 공개 메소드

Creates an anchor or link container
public anchor ( array $args ) : string
$args array
리턴 string

code() 공개 메소드

Wrapper display computer-code samples
public code ( str $str ) : str
$str str
리턴 str

formatProperties() 공개 정적인 메소드

Takes an array of key-value pairs and formats them in the syntax of HTML-container properties
public static formatProperties ( array $properties ) : string
$properties array
리턴 string

getNotifications() 공개 메소드

Returns a list of notifications if there are any - similar to the Flash feature of Ruby on Rails
public getNotifications ( mixed $messages, string $class = 'errormessage' ) : string
$messages mixed String or an array of strings
$class string
리턴 string Returns null if there are no notifications to return

header() 공개 메소드

Returns an HTML header and opens the body container This method will trigger an error if executed more than once without first calling the footer() method on the prior usage This is meant to be utilized within layouts, not views (but will work in either)
public header ( array $args ) : string
$args array
리턴 string

isEven() 공개 메소드

Will return true if the number passed in is even, false if odd.
public isEven ( integer $number ) : boolean
$number integer
리턴 boolean

jsLoad() 공개 메소드

Version is optional and can be exact (1.8.2) or just version-major (1 or 1.8) Usage: echo $html->jsLoad('jquery'); echo $html->jsLoad(array('yui', 'mootools')); echo $html->jsLoad(array('yui' => 2.7, 'jquery', 'dojo' => '1.3.1', 'scriptaculous')); You can also use the Google API format JSON-decoded in which case version is required & name must be lowercase $jsLibs = array(array('name' => 'mootools', 'version' => 1.2, 'base_domain' => 'ditu.google.cn'), array(...)); echo $html->jsLoad($jsLibs);
public jsLoad ( mixed $library, mixed $version = null, array $options = [] ) : str
$library mixed Can be a string, array(str1, str2...) or , array(name1 => version1, name2 => version2...) or JSON-decoded Google API syntax array(array('name' => 'yui', 'version' => 2), array(...))
$version mixed Optional, int or str, this is only used if $library is a string
$options array Optional, passed to Google "optionalSettings" argument, only used if $library == str
리턴 str

jsTools() 공개 메소드

This method will only operate from the first occurrence in your code, subsequent calls will not output anything but you should add it anyway as it will make sure that your code continues to work if you later remove a previous call to jsTools. Tools provided: dom() method is a direct replacement for document.getElementById() that works in all JS-capable browsers Y2k and newer. vork object - defines a global vork storage space; use by appending your own properties, eg.: vork.widgetCount
public jsTools ( boolean $noJsWrapper = false ) : string
$noJsWrapper boolean set to True if calling from within a $html->jsInline() wrapper
리턴 string

setDocType() 공개 메소드

Can either set to an actual doctype definition or to one of the presets (case-insensitive): XHTML Mobile 1.2 XHTML Mobile 1.1 XHTML Mobile 1.0 Mobile 1.2 (alias for XHTML Mobile 1.2) Mobile 1.1 (alias for XHTML Mobile 1.1) Mobile 1.0 (alias for XHTML Mobile 1.0) Mobile (alias for the most-strict Mobile DTD, currently 1.2) XHTML 1.1 (this is the default DTD, there is no need to apply this method for an XHTML 1.1 doctype) XHTML (Alias for XHTML 1.1) XHTML 1.0 Strict XHTML 1.0 Transitional XHTML 1.0 Frameset XHTML 1.0 (Alias for XHTML 1.0 Strict) HTML 5 HTML 4.01 HTML (Alias for HTML 4.01)
public setDocType ( string $docType )
$docType string

프로퍼티 상세

$_cssSingleton 보호되어 있는 프로퍼티

Flag array to avoid defining singleton JavaScript & CSS snippets more than once
protected $_cssSingleton

$_docType 보호되어 있는 프로퍼티

Sets the default doctype to XHTML 1.1
protected string $_docType
리턴 string

$_includedFiles 보호되어 있는 프로퍼티

Internal list of included CSS & JS files used by $this->_tagBuilder() to assure that files are not included twice
protected array $_includedFiles
리턴 array

$_jsSingleton 보호되어 있는 프로퍼티

Flag array to avoid defining singleton JavaScript & CSS snippets more than once
protected $_jsSingleton

$_linkPrefix 보호되어 있는 프로퍼티

Internal storage of the link-prefix and hypertext protocol values
protected $_linkPrefix

$_protocol 보호되어 있는 프로퍼티

Internal storage of the link-prefix and hypertext protocol values
protected $_protocol

$vorkHead 공개적으로 프로퍼티

Array used internally by Vork to cache JavaScript and CSS snippets and place them in the head section Changing the contents of this property may cause Vork components to be rendered incorrectly.
public array $vorkHead
리턴 array