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


PHP response::getInstance方法代码示例

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


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

示例1: to

 public function to($type)
 {
     if ($type == 'html' && $this->cfg->mode == 'edit') {
         response::getInstance()->addJs('checkboxFields');
     }
     return parent::to($type);
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:7,代码来源:fields.class.php

示例2: execTinyMce

	protected function execTinyMce($prm=null) {
		$search = 'js/tiny_mce/';
		$request = request::get('request');
		$pos = strpos($request, $search);
		if ($pos === false)
			exit;
		$tmp = substr($request, $pos+strlen($search));
		$file = file::nyroExists(array(
			'name'=>'lib'.DS.'tinyMce'.DS.$tmp,
			'realName'=>true,
			'type'=>'other'
		));
		if (strpos($file, '.php') !== false) {
			array_walk($_GET, create_function('&$v', '$v = urldecode($v);'));
			$path = str_replace($tmp, '', $file);
			ini_set('include_path', $path);
			define('TINYMCEPATH', substr($path, 0, -1));
			define('TINYMCECACHEPATH', substr(TMPROOT, 0, -1));
			if (ob_get_length())
				ob_clean();
			include($file);
			exit;
		} else
			response::getInstance()->showFile($file);
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:25,代码来源:controller.class.php

示例3: toHtml

    public function toHtml()
    {
        if ($this->cfg->useJs) {
            $this->cfg->setInArray('html', 'class', $this->cfg->getInArray('html', 'class') . ' date');
            $resp = response::getInstance();
            $resp->addJs('jqueryui');
            if (($lang = request::get('lang')) != 'en') {
                $resp->addJs('i18n_ui.datepicker-' . $lang);
            }
            $jsPrmMin = $this->cfg->jsPrm;
            $jsPrmMax = $this->cfg->jsPrm;
            $minId = $this->makeId($this->name . '[0]');
            $maxId = $this->makeId($this->name . '[1]');
            $minDate = $this->dates['min']->getJs(null);
            $maxDate = $this->dates['max']->getJs(null);
            $jsPrmMin['onSelect'] = 'function(dateText) {$("#' . $maxId . '").datepicker("option", "minDate", $("#' . $minId . '").datepicker("getDate"));}';
            if ($maxDate) {
                $jsPrmMin['maxDate'] = $maxDate;
            }
            $jsPrmMax['onSelect'] = 'function(dateText) {$("#' . $minId . '").datepicker("option", "maxDate", $("#' . $maxId . '").datepicker("getDate"));}';
            if ($minDate) {
                $jsPrmMax['minDate'] = $minDate;
            }
            $resp->blockJquery('
				$("#' . $minId . '").datepicker(' . utils::jsEncode($jsPrmMin) . ');
				$("#' . $maxId . '").datepicker(' . utils::jsEncode($jsPrmMax) . ');
			');
        }
        return parent::toHtml();
    }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:30,代码来源:date.class.php

示例4: afterInit

 protected function afterInit()
 {
     if (empty($this->cfg->value)) {
         $this->cfg->value = $this->get(true);
         $this->saved = true;
     }
     if ($this->cfg->autoSave) {
         response::getInstance()->addBeforeOut(array($this, 'save'));
     }
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:10,代码来源:cookie.class.php

示例5: toHtml

    public function toHtml()
    {
        if ($this->cfg->mode == 'view') {
            return $this->getValue();
        }
        $options = $this->tinyMce;
        if (is_array($this->cfg->tinyBrowser) && $this->cfg->getInArray('tinyBrowser', 'active')) {
            $tinyBrowser = $this->cfg->tinyBrowser;
            $options['file_browser_callback'] = 'function(field_name, url, type, win) {
				tinyMCE.activeEditor.windowManager.open({
					file : "' . $tinyBrowser['url'] . '?' . session::getInstance()->getSessIdForce() . '=' . urlencode(session_id()) . '&type=" + type' . ($tinyBrowser['subdir'] ? '+"&subdir=' . $tinyBrowser['subdir'] . '"' : '') . ',
					title : "' . $tinyBrowser['title'] . '",
					width : ' . $tinyBrowser['width'] . ',
					height : ' . $tinyBrowser['height'] . ',
					resizable : "yes",
					scrollbars : "yes",
					inline : "yes",  // This parameter only has an effect if you use the inlinepopups plugin!
					close_previous : "no"
				}, {
					window : win,
					input : field_name
				});
				return false;
			}';
        } else {
            if (is_array($this->cfg->nyroBrowser) && $this->cfg->getInArray('nyroBrowser', 'active')) {
                $nyroBrowser = $this->cfg->nyroBrowser;
                $options['file_browser_callback'] = 'function(field_name, url, type, win) {
				tinyMCE.activeEditor.windowManager.open({
					file : "' . $nyroBrowser['url'] . '?' . session::getInstance()->getSessIdForce() . '=' . urlencode(session_id()) . '&type="+type+"&config=' . $nyroBrowser['config'] . '&",
					title : "' . $nyroBrowser['title'] . '",
					width : ' . $nyroBrowser['width'] . ',
					height : ' . $nyroBrowser['height'] . ',
					resizable : "yes",
					scrollbars : "yes",
					inline : "yes",  // This parameter only has an effect if you use the inlinepopups plugin!
					close_previous : "no"
				}, {
					window : win,
					input : field_name
				});
				return false;
			}';
            }
        }
        if (array_key_exists('content_css', $options) && $options['content_css']) {
            $contentCss = $options['content_css'];
            $options['setup'] = 'function(ed) {ed.onInit.add(function(ed) {setTimeout(function() {ed.dom.add(ed.dom.select("head"), "link", {rel : "stylesheet", href : "' . $contentCss . '"});}, 5);});}';
        }
        unset($options['content_css']);
        $resp = response::getInstance()->getProxy();
        $resp->addJs('jquery.tinymce');
        $resp->blockjQuery('$("#' . $this->id . '").tinymce(' . utils::jsEncode($options) . ');');
        return utils::htmlTag($this->htmlTagName, array_merge($this->html, array('name' => $this->name, 'id' => $this->id)), utils::htmlOut($this->getValue()));
    }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:55,代码来源:richtext.class.php

示例6: get

	/**
	 * Show the file to the client
	 *
	 * @param string $prm File requested
	 */
	public static function get($prm) {
		self::init();
		$prm = self::$cfg->dir.
			str_replace(
				array(self::$cfg->webDir.'/', '/'),
				array('', DS)
				, $prm);
		if (self::$cfg->getInArray('forceDownload', file::getExt($prm)))
			response::getInstance()->sendFile($prm);
		else
			response::getInstance()->showFile($prm);
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:17,代码来源:upload.class.php

示例7: toHtml

 public function toHtml()
 {
     if ($this->cfg->mode == 'view') {
         return $this->date->format('date', 'short2');
     }
     if ($this->cfg->useJs) {
         $resp = response::getInstance();
         $resp->addJs('jqueryui');
         $resp->blockJquery('$("#' . $this->id . '").datepicker(' . utils::jsEncode($this->jsPrm) . ');');
     }
     return utils::htmlTag($this->htmlTagName, array_merge($this->html, array('name' => $this->name, 'id' => $this->id, 'value' => $this->date->format('date', 'short2'))));
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:12,代码来源:date.class.php

示例8: to

 public function to($type)
 {
     $ret = parent::to($type);
     if ($type == 'html' && $this->cfg->mode == 'edit') {
         $ret = '<span id="' . $this->id . 'Container">' . $ret . '</span>';
         $resp = response::getInstance();
         $resp->addJs('jqueryui');
         $resp->addJs('formAutocomplete');
         $prm = $this->cfg->jsPrm;
         $prm['name'] = $this->id . '[]';
         $prm['nameNew'] = $this->id . '[new]';
         $resp->blockJquery('$("#' . $this->id . 'Container").formAutocomplete(' . json_encode($prm) . ');');
     }
     return $ret;
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:15,代码来源:autocomplete.class.php

示例9: check

	public function check(array $url = null, $redirect=true) {
		if (is_null($url))
			$url = request::get();

		$hasRight = !$this->isContained($url, $this->cfg->spec);

		if (!$hasRight && $redirect) {
			$request = request::removeLangOutUrl('/'.request::get('request'));
			if ($request != $this->getPage('forbidden') && $request != $this->getPage('login')) {
				session::setFlash('nyroError', 'Don\'t have the permission to access to this page.');
				response::getInstance()->redirect($this->getPage('forbidden', true), 403);
			}
		}

		return $hasRight;
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:16,代码来源:public.class.php

示例10: toHtml

    public function toHtml()
    {
        $ret = parent::toHtml();
        if ($this->cfg->useJs) {
            $id = $this->makeid($this->name . '-slider');
            $ret = '<div id="' . $id . '" class="range-slider"></div>' . $ret;
            $min = $this->cfg->getInarray('allowedRange', 'min');
            $max = $this->cfg->getInarray('allowedRange', 'max');
            if (!$min) {
                $min = 0;
            }
            if (!$max) {
                $max = 100;
            }
            $minVal = $this->getValue('min');
            $maxVal = $this->getValue('max');
            if (!$minVal) {
                $minVal = $min;
            }
            if (!$maxVal) {
                $maxVal = $max;
            }
            $resp = response::getInstance();
            $resp->addJs('jqueryui');
            $resp->blockJquery('$("#' . $id . '").slider({
				range: true,
				min: ' . $min . ',
				max: ' . $max . ',
				values: [' . $minVal . ',' . $maxVal . '],
				slide: function(event, ui) {
					$("#' . $this->makeId($this->name . '[0]') . '").val(ui.values[0]);
					$("#' . $this->makeId($this->name . '[1]') . '").val(ui.values[1]);
				},
				change: function() {
					$("#' . $this->makeId($this->name . '[0]') . '").change();
					$("#' . $this->makeId($this->name . '[1]') . '").change();
				}
			})' . ($this->cfg->disabled ? '.next(".range").find("input").attr("disabled", "disabled")' : null) . ';
			;');
        }
        return $ret;
    }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:42,代码来源:numeric.class.php

示例11: execIndex

	protected function execIndex(array $prm = array()) {
		$this->prepare();
		
		$pattern = FILESROOT.$this->dir.DS.'*';
		$search = http_vars::getInstance()->get('search');
		if ($search) {
			$pattern.= strtolower($search).'*';
			$this->uri.= 'search='.$search.'&';
		}
		
		$delete = http_vars::getInstance()->get('delete');
		if ($delete) {
			$file = FILESROOT.urldecode($delete);
			if (file::exists($file)) {
				file::delete($file);
				file::multipleDelete(substr($file, 0, -strlen(file::getExt($file))-1).'_*');
				response::getInstance()->redirect($this->uri);
			}
		}
		
		$form = $this->getForm();
		
		if (request::isPost()) {
			$form->refill();
			if ($form->isValid())
				response::getInstance()->sendText('ok');
		}
		
		$files = array();
		foreach(file::search($pattern) as $f) {
			if (strpos($f, 'nyroBrowserThumb') === false) {
				$name = basename($f);
				if ($this->type == 'image' && strlen($name) > 15)
					$name = substr($name, 0, 15).'...'.file::getExt($f);
				$files[] = array(
					$f,
					request::uploadedUri(str_replace(FILESROOT, '', $f), $this->myCfg['uploadedUri']),
					$name,
					file::humanSize($f),
					utils::formatDate(filemtime($f)),
					$this->uri.'delete='.urlencode(str_replace(FILESROOT, '', $f)).'&'
				);
			}
		}
		
		$this->setViewVars(array(
			'uri'=>$this->uri,
			'form'=>$form,
			'config'=>$this->config,
			'type'=>$this->type,
			'files'=>$files,
			'searchButton'=>$this->myCfg['search'],
			'search'=>$search,
			'imgHelper'=>$this->myCfg['imgHelper'],
			'filesTitle'=>$this->myCfg['filesTitle'],
			'noFiles'=>$this->myCfg['noFiles'],
			'name'=>$this->myCfg['name'],
			'size'=>$this->myCfg['size'],
			'date'=>$this->myCfg['date'],
			'delete'=>$this->myCfg['delete'],
		));
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:62,代码来源:controller.class.php

示例12: 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

示例13: forceSecure

	/**
	 * Force the request to be secure, by redirting to the same url with https
	 */
	public static function forceSecure() {
		if (!self::get('secure'))
			response::getInstance()->redirect(str_replace('http://', 'https://', self::uriDef(array('absolute'=>1))));
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:7,代码来源:request.class.php

示例14: check

	public function check(array $url = null, $redirect = true) {
		if (is_null($url))
			$url = request::get();

		if ($this->isContained($url, $this->cfg->noSecurity))
			return true;

		$hasRight = $this->cfg->default;
		if ($this->isContained($url, $this->cfg->spec)) {
			if ($hasRight) {
				$hasRight = $this->isLogged();
			} else {
				$hasRight = true;
			}
		} else if ($this->isLogged()) {
			if (!empty($this->cfg->rightRoles)) {
				$checks = array();
				foreach($this->hasRole() as $r=>$t) {
					$tmp = $this->cfg->getInArray('rightRoles', $r);
					if (is_array($tmp)) {
						foreach($tmp as $c)
							$checks[] = $c;
					}
				}
				$hasRight = $this->isContained($url, $checks);
			} else
				$hasRight = true;
		}

		if (!$hasRight && $redirect) {
			$request = request::removeLangOutUrl('/'.request::get('request'));
			if ($request != $this->getPage('forbidden') && $request != $this->getPage('login')) {
				$this->session->pageFrom = request::get('localUri');
				session::setFlash('nyroError', $this->cfg->errorText);
				$this->hook('redirectError');
				response::getInstance()->redirect($this->getPage('forbidden', true), 403);
			}
		}

		return $hasRight;
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:41,代码来源:default.class.php

示例15: debugger

 /**
  * Get the HTML for the debugger, and add the CSS and JS to the response
  *
  * @param array $elts
  * @return string
  */
 public static function debugger(array $elts = null)
 {
     if (is_null($elts)) {
         debug::timer('nyro');
         debug::timer('nyroRender');
         return debug::debugger(array('timing' => array('Timing', debug::timer(), 'time'), 'included' => array('Included Files', get_included_files(), array('name' => 'code_red', 'type' => 'script')), 'session' => array('Session vars', $_SESSION, 'shield'), 'db_queries' => array('DB Queries', db::log(), 'database'), 'consts' => array('Constants', array_reverse(get_defined_constants(true), true), array('name' => 'gear', 'type' => 'script')), 'request' => array('Request', request::get(), array('name' => 'right', 'type' => 'arrow')), 'cookies' => array('Cookies', $_COOKIE, array('name' => 'gray', 'type' => 'user')), 'get' => array('Get', $_GET, array('name' => 'show', 'type' => 'tag')), 'post' => array('Post', $_POST, array('name' => 'green', 'type' => 'tag')), 'files' => array('Files', $_FILES, array('name' => 'orange', 'type' => 'tag')), 'response' => array('Response', array('Headers' => response::getInstance()->getHeader(), 'Included Files' => response::getInstance()->getIncFiles()), array('name' => 'right', 'type' => 'arrow'))));
     }
     if (request::get('out') != 'html') {
         return;
     }
     $menu = array();
     $content = array();
     $close = utils::getIcon(array('name' => 'cross', 'type' => 'default', 'attr' => array('class' => 'close', 'alt' => 'Close')));
     foreach ($elts as $k => $v) {
         $icon = array_key_exists(2, $v) ? utils::getIcon(is_array($v[2]) ? $v[2] : array('name' => 'show', 'type' => $v[2])) : null;
         $menu[] = '<a rel="' . $k . '">' . $icon . $v[0] . '</a>';
         $tmp = '<div class="debugElt" id="' . $k . '" style="display: none;">' . $close . '<h2>' . $icon . $v[0] . '</h2>';
         if (is_array($v[1])) {
             if (is_numeric(key($v[1])) && !is_array($v[1])) {
                 $tmp .= '<ol><li>' . implode('</li><li>', $v[1]) . '</li></ol>';
             } else {
                 $tmp .= debug::trace($v[1]);
             }
         } else {
             $tmp .= $v[1];
         }
         $tmp .= '</div>';
         $content[] = $tmp;
     }
     $resp = response::getInstance();
     return '<div id="nyroDebugger">' . $resp->getIncludeTagFile('js', 'debug') . $resp->getIncludeTagFile('css', 'debug') . '<ul><li id="close">' . $close . '</li><li>' . implode('</li><li>', $menu) . '</li></ul>' . implode("\n", $content) . '</div>';
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:38,代码来源:debug.class.php


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