当前位置: 首页>>代码示例>>PHP>>正文


PHP request::isAjax方法代码示例

本文整理汇总了PHP中request::isAjax方法的典型用法代码示例。如果您正苦于以下问题:PHP request::isAjax方法的具体用法?PHP request::isAjax怎么用?PHP request::isAjax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在request的用法示例。


在下文中一共展示了request::isAjax方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showSettings

 public function showSettings()
 {
     if ($this->_block !== null) {
         echo '<h1>Настройки</h1>';
         echo '<form method="post" action="' . $this->arel() . '" success="' . $this->rel('') . '">';
         echo '<div class="content">';
         echo '<table>';
         foreach ($this->_defaultSettings as $name => $a) {
             $title = $a['title'];
             $default = $a['default'];
             $width = isset($a['width']) ? $a['width'] : '40px';
             echo '<tr><td style="padding-right: 10px;text-align: right;">';
             echo '<label for="s-' . $name . '">' . $title . '</label> ';
             echo '</td><td>';
             echo '<input id="s-' . $name . '" type="text" name="' . $name . '" style="width: ' . $width . '" value="' . $this->_block->getOption($name, $default) . '" />';
             echo '</td></tr>';
         }
         echo '</table>';
         echo '</div>';
         echo '<div class="footer"><input type="submit" class="button submit" value="Сохранить" />';
         if (request::isAjax()) {
             echo '<a href="' . $this->rel() . '" class="button close">Отменить</a>';
         }
         echo '</div>';
         echo '</form>';
     }
 }
开发者ID:alexqwert,项目名称:kanon,代码行数:27,代码来源:widgetController.php

示例2: back

 /**
  * Redirect to previous page
  */
 function back()
 {
     if (request::isAjax()) {
         exit;
     }
     response::back();
 }
开发者ID:alexqwert,项目名称:kanon,代码行数:10,代码来源:controllerPrototype.php

示例3: setHtmlEltIntern

	/**
	 * Used by the send function to replace place holders set by getHtmlelt
	 * by actual content
	 *
	 * @param string $content
	 * @return string
	 */
	protected function setHtmlEltIntern($content) {
		$ln = "\n";
		$jsBlocks = $this->getHtmlBlocks('js', $ln);
		$addJsBlocks = request::isAjax() && strpos($content, '[{[JS]}]') === false;
		return str_replace(
			array('[{[TITLE]}]', '[{[META]}]', '[{[CSS]}]', '[{[JS]}]'),
			array(
				'<title>'.utils::htmlOut($this->getMeta('title')).'</title>',
				$this->getHtmlMeta(),
				$this->getHtmlIncFiles('css', $ln).$ln.$this->getHtmlBlocks('css', $ln),
				$this->getHtmlIncFiles('js', $ln).$ln.$jsBlocks
			),
			$content).($addJsBlocks ? $jsBlocks : null);

	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:22,代码来源:html.class.php

示例4: send

	/**
	 * Send The response
	 *
	 * @param bool $headerOnly Send only the header and exit
	 */
	public function send($headerOnly = false) {
		if (!headers_sent()) {
			$this->sendHeaders();
			$this->beforeOut();
			if ($headerOnly)
				exit(0);
		}

		$layout = request::isAjax()? $this->cfg->ajaxLayout : $this->cfg->layout;
		$ret = null;
		if (!$layout) {
			$ret = $this->content;
		} else {
			$tpl = factory::get('tpl', array(
				'module'=>'out',
				'action'=>$layout,
				'default'=>'layout',
				'layout'=>false,
				'cache'=>array('auto'=>false)
			));
			$tpl->set('content', $this->content);
			$ret = $tpl->fetch();
		}
		//if ($ret) $this->addHeader('Content-Length', strlen($ret), true);
		return $ret;
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:31,代码来源:http.class.php

示例5: main

	/**
	 * Website main
	 */
	public static function main() {

		define('NYROVERSION', '0.2');
		
		$globalContent = null;
		$globalVars = null;
		$cacheInst = null;
		$cacheInstVars = null;

		try {
			self::init();

			$resp = response::getInstance();
			self::$cfg->overload(__CLASS__.'Response');
			
			if (self::$cfg->globalCache && !request::isPost() && count($_GET) == 0 && $resp->canGlobalCache()) {
				$prm = is_array(self::$cfg->globalCache) ? self::$cfg->globalCache : array();
				$cacheInst = cache::getInstance(array_merge(array('serialize'=>false), $prm));
				$id = str_replace('/', '._.', '/'.request::get('request')).(request::isAjax() ? '-ajax' : '');
				$cacheInst->get($globalContent, array(
					'id'=>$id
				));
				$cacheInstVars = cache::getInstance(array_merge(array('serialize'=>true), $prm));
				$cacheInstVars->get($globalVars, array(
					'id'=>$id.'-vars'
				));
			}
			if (is_null($globalContent)) {
				request::execModule();
				if (DEV) {
					debug::timer('nyroProcess');
					debug::timer('nyroRender');
				}
				$resp->setContent(request::publishModule());
			}
		} catch (module_exception $e) {
			session::setFlash('nyroError', 'MODULE or ACTION NOT FOUND<br />'.self::handleError($e));
			$resp->error(null, 404);
		} catch (nException $e) {
			session::setFlash('nyroError', self::handleError($e));
			$resp->error(null, 500);
		} catch (PDOException $e) {
			session::setFlash('nyroError', self::handleError($e));
			$resp->error(null, 500);
		} catch (Exception $e) {
			session::setFlash('nyroError', self::handleError($e));
			$resp->error(null, 500);
		}

		try {
			factory::saveCache();

			if ($cacheInst) {
				if ($globalContent) {
					$resp->setVarsFromGlobalCache($globalVars);
					echo $globalContent;
				} else {
					$globalVars = $resp->getVarsForGlobalCache();
					$globalContent = $resp->send();
					$cacheInst->save();
					$cacheInstVars->save();
					echo $globalContent;
				}
			} else {
				echo $resp->send();
			}
		} catch (Exception $e) {
			echo debug::trace($e);
		}
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:73,代码来源:nyro.class.php


注:本文中的request::isAjax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。