本文整理汇总了PHP中General::in_iarray方法的典型用法代码示例。如果您正苦于以下问题:PHP General::in_iarray方法的具体用法?PHP General::in_iarray怎么用?PHP General::in_iarray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类General
的用法示例。
在下文中一共展示了General::in_iarray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMetaInfo
public static function getMetaInfo($file, $type)
{
$meta = array();
if (!file_exists($file) || !is_readable($file)) {
return $meta;
}
$meta['creation'] = DateTimeObj::get('c', filemtime($file));
if (General::in_iarray($type, fieldUpload::$imageMimeTypes) && ($array = @getimagesize($file))) {
$meta['width'] = $array[0];
$meta['height'] = $array[1];
}
return $meta;
}
示例2: generate
/**
* This function is called immediately from the Frontend class passing the current
* URL for generation. Generate will resolve the URL to the specific page in the Symphony
* and then execute all events and datasources registered to this page so that it can
* be rendered. A number of delegates are fired during stages of execution for extensions
* to hook into.
*
* @uses FrontendDevKitResolve
* @uses FrontendOutputPreGenerate
* @uses FrontendPreRenderHeaders
* @uses FrontendOutputPostGenerate
* @see __buildPage()
* @param string $page
* The URL of the current page that is being Rendered as returned by getCurrentPage
* @return string
* The page source after the XSLT has transformed this page's XML. This would be
* exactly the same as the 'view-source' from your browser
*/
public function generate($page)
{
$full_generate = true;
$devkit = null;
$output = null;
if ($this->is_logged_in) {
/**
* Allows a devkit object to be specified, and stop continued execution:
*
* @delegate FrontendDevKitResolve
* @param string $context
* '/frontend/'
* @param boolean $full_generate
* Whether this page will be completely generated (ie. invoke the XSLT transform)
* or not, by default this is true. Passed by reference
* @param mixed $devkit
* Allows a devkit to register to this page
*/
Symphony::ExtensionManager()->notifyMembers('FrontendDevKitResolve', '/frontend/', array('full_generate' => &$full_generate, 'devkit' => &$devkit));
}
Symphony::Profiler()->sample('Page creation process started');
$this->_page = $page;
$this->__buildPage();
if ($full_generate) {
/**
* Immediately before generating the page. Provided with the page object, XML and XSLT
* @delegate FrontendOutputPreGenerate
* @param string $context
* '/frontend/'
* @param FrontendPage $page
* This FrontendPage object, by reference
* @param string $xml
* This pages XML, including the Parameters, Datasource and Event XML, by reference
* @param string $xsl
* This pages XSLT
*/
Symphony::ExtensionManager()->notifyMembers('FrontendOutputPreGenerate', '/frontend/', array('page' => &$this, 'xml' => &$this->_xml, 'xsl' => $this->_xsl));
if (is_null($devkit)) {
if (General::in_iarray('XML', $this->_pageData['type'])) {
$this->addHeaderToPage('Content-Type', 'text/xml; charset=utf-8');
} else {
if (General::in_iarray('JSON', $this->_pageData['type'])) {
$this->addHeaderToPage('Content-Type', 'application/json; charset=utf-8');
} else {
$this->addHeaderToPage('Content-Type', 'text/html; charset=utf-8');
}
}
if (in_array('404', $this->_pageData['type'])) {
$this->addHeaderToPage('Status', '404 Not Found', 404);
} elseif (in_array('403', $this->_pageData['type'])) {
$this->addHeaderToPage('Status', '403 Forbidden', 403);
}
}
/**
* This is just prior to the page headers being rendered, and is suitable for changing them
* @delegate FrontendPreRenderHeaders
* @param string $context
* '/frontend/'
*/
Symphony::ExtensionManager()->notifyMembers('FrontendPreRenderHeaders', '/frontend/');
$output = parent::generate();
/**
* Immediately after generating the page. Provided with string containing page source
* @delegate FrontendOutputPostGenerate
* @param string $context
* '/frontend/'
* @param string $output
* The generated output of this page, ie. a string of HTML, passed by reference
*/
Symphony::ExtensionManager()->notifyMembers('FrontendOutputPostGenerate', '/frontend/', array('output' => &$output));
Symphony::Profiler()->sample('XSLT Transformation', PROFILE_LAP);
if (is_null($devkit) && !$output) {
$errstr = NULL;
while (list($key, $val) = $this->Proc->getError()) {
$errstr .= 'Line: ' . $val['line'] . ' - ' . $val['message'] . PHP_EOL;
}
GenericExceptionHandler::$enabled = true;
throw new SymphonyErrorPage(trim($errstr), NULL, 'xslt', array('proc' => clone $this->Proc));
}
Symphony::Profiler()->sample('Page creation complete');
}
if (!is_null($devkit)) {
//.........这里部分代码省略.........
示例3: generate
/**
* This function is called immediately from the Frontend class passing the current
* URL for generation. Generate will resolve the URL to the specific page in the Symphony
* and then execute all events and datasources registered to this page so that it can
* be rendered. A number of delegates are fired during stages of execution for extensions
* to hook into.
*
* @uses FrontendDevKitResolve
* @uses FrontendOutputPreGenerate
* @uses FrontendPreRenderHeaders
* @uses FrontendOutputPostGenerate
* @see __buildPage()
* @param string $page
* The URL of the current page that is being Rendered as returned by getCurrentPage
* @return string
* The page source after the XSLT has transformed this page's XML. This would be
* exactly the same as the 'view-source' from your browser
*/
public function generate($page = null)
{
$full_generate = true;
$devkit = null;
$output = null;
$this->addHeaderToPage('Cache-Control', 'no-cache, must-revalidate, max-age=0');
$this->addHeaderToPage('Expires', 'Mon, 12 Dec 1982 06:14:00 GMT');
$this->addHeaderToPage('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT');
$this->addHeaderToPage('Pragma', 'no-cache');
if ($this->is_logged_in) {
/**
* Allows a devkit object to be specified, and stop continued execution:
*
* @delegate FrontendDevKitResolve
* @param string $context
* '/frontend/'
* @param boolean $full_generate
* Whether this page will be completely generated (ie. invoke the XSLT transform)
* or not, by default this is true. Passed by reference
* @param mixed $devkit
* Allows a devkit to register to this page
*/
Symphony::ExtensionManager()->notifyMembers('FrontendDevKitResolve', '/frontend/', array('full_generate' => &$full_generate, 'devkit' => &$devkit));
}
Symphony::Profiler()->sample('Page creation process started');
$this->_page = $page;
$this->__buildPage();
if ($full_generate) {
/**
* Immediately before generating the page. Provided with the page object, XML and XSLT
* @delegate FrontendOutputPreGenerate
* @param string $context
* '/frontend/'
* @param FrontendPage $page
* This FrontendPage object, by reference
* @param string $xml
* This pages XML, including the Parameters, Datasource and Event XML, by reference
* @param string $xsl
* This pages XSLT, by reference
*/
Symphony::ExtensionManager()->notifyMembers('FrontendOutputPreGenerate', '/frontend/', array('page' => &$this, 'xml' => &$this->_xml, 'xsl' => &$this->_xsl));
if (is_null($devkit)) {
if (General::in_iarray('XML', $this->_pageData['type'])) {
$this->addHeaderToPage('Content-Type', 'text/xml; charset=utf-8');
} else {
if (General::in_iarray('JSON', $this->_pageData['type'])) {
$this->addHeaderToPage('Content-Type', 'application/json; charset=utf-8');
} else {
$this->addHeaderToPage('Content-Type', 'text/html; charset=utf-8');
}
}
if (in_array('404', $this->_pageData['type'])) {
$this->setHttpStatus(self::HTTP_STATUS_NOT_FOUND);
} else {
if (in_array('403', $this->_pageData['type'])) {
$this->setHttpStatus(self::HTTP_STATUS_FORBIDDEN);
}
}
}
/**
* This is just prior to the page headers being rendered, and is suitable for changing them
* @delegate FrontendPreRenderHeaders
* @param string $context
* '/frontend/'
*/
Symphony::ExtensionManager()->notifyMembers('FrontendPreRenderHeaders', '/frontend/');
$backup_param = $this->_param;
$this->_param['current-query-string'] = General::wrapInCDATA($this->_param['current-query-string']);
$output = parent::generate();
$this->_param = $backup_param;
/**
* Immediately after generating the page. Provided with string containing page source
* @delegate FrontendOutputPostGenerate
* @param string $context
* '/frontend/'
* @param string $output
* The generated output of this page, ie. a string of HTML, passed by reference
*/
Symphony::ExtensionManager()->notifyMembers('FrontendOutputPostGenerate', '/frontend/', array('output' => &$output));
Symphony::Profiler()->sample('XSLT Transformation', PROFILE_LAP);
if (is_null($devkit) && !$output) {
$errstr = NULL;
//.........这里部分代码省略.........
示例4: getMetaInfo
public static function getMetaInfo($file, $type)
{
$imageMimeTypes = array('image/gif', 'image/jpg', 'image/jpeg', 'image/png');
$meta = array();
$meta['creation'] = DateTimeObj::get('c', filemtime($file));
if (General::in_iarray($type, $imageMimeTypes) && ($array = @getimagesize($file))) {
$meta['width'] = $array[0];
$meta['height'] = $array[1];
}
return $meta;
}
示例5: __sniffMIMEType
private static function __sniffMIMEType($file)
{
$ext = strtolower(General::getExtension($file));
$imageMimeTypes = array('image/gif', 'image/jpg', 'image/jpeg', 'image/png');
if (General::in_iarray("image/{$ext}", $imageMimeTypes)) {
return "image/{$ext}";
}
return 'unknown';
}
示例6: isSvg
protected static function isSvg($type)
{
return General::in_iarray($type, self::$svgMimeTypes);
}