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


PHP core::req方法代码示例

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


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

示例1: context

	static function context()
	{
		if (!core::req('.cms-admin')) return new cmsDummy();
		return cmsGui::create('cmsContext');
	}
开发者ID:Emperor359,项目名称:conkit,代码行数:5,代码来源:cms.php

示例2: label

?>
</h1>
	<h2><?php 
echo core::vars('subheadline1');
?>
</h2>
	
	<?
		$c= cms::context();
		$c-> label('Upload new image') -> icon('file_upload') -> popup(core::url('upload-image'));
		if (core::req('.hide-image')) $c-> label('Unhide image') -> icon('visibility_on') -> url(core::url('upload-image','cms-form-action','unhide'));
		else $c-> label('Hide image') -> icon('visibility_off') -> url(core::url('upload-image','cms-form-action','hide'));
		echo cms::anchor($c);
	?>
	<div style="float:right;">
		<? if (!core::req('.hide-image')): ?>
			<img src="sample.jpg" style="max-width:400px; margin-left:2em;">
		<? endif ?>
	</div>
	<?php 
echo core::vars('text1');
?>
</div>

<? if(cms::admin()): ?>
	<?
		$c= cms::context() -> label('Edit') -> icon('edit') -> popup(core::url('edit-block','no',2)) -> popuptitle('Edit text block 2');
		echo cms::anchor($c,'Block 2');
	?>
	<div>
			<h1><?php 
开发者ID:Emperor359,项目名称:conkit,代码行数:31,代码来源:home.tpl.php

示例3: method

{
	$f= cms::form();
	$f-> method('post') -> action(core::urlAdd('cms-form-action','upload'));
	$f-> file('picture') -> preview('image');
	$f-> static('Use only jpeg for the sake of test simplicity');
	$f-> submit('Save');
	$f-> display(); 
}
elseif (core::req('cms-form-action')=='upload')
{
	$picture= core::req('picture');
	move_uploaded_file($picture['tmp_name'],core::config('data-path').'sample.jpg');
	core::req('.hide-image',false,'session');
	core::redirect('home');
}
elseif (core::req('cms-form-action')=='hide')
{
	core::req('.hide-image',true,'session');
	core::redirect('home');
}
elseif (core::req('cms-form-action')=='unhide')
{
	core::req('.hide-image',false,'session');
	core::redirect('home');
}
else
{
	core::halt(404,'Unknown action '.core::req('cms-form-action'));
}
return true;
开发者ID:Emperor359,项目名称:conkit,代码行数:30,代码来源:upload-image.mod.php

示例4: start

	static function start() /// Launches whole the action after configuration read
	{
		error_reporting(core::$config['error-reporting-lo']);

		foreach ($_COOKIE as $var=>$val) core::$req[$var]= $val;
		if (isset(core::$config['cookie-vars'])) foreach (core::$config['cookie-vars'] as $var=>$config)
		{
			core::$req[$var]= core::filter(core::req($var),$config);
		}

		foreach ($_GET as $var=>$val) if ($var!==session_name()) core::$req[$var]= core::$reqUrl[$var]= $val;
		unset(core::$reqUrl[core::config('module-var')]);
		foreach ($_POST as $var=>$val) if ($var!==session_name()) core::$req[$var]= $val;
		foreach ($_FILES as $var=>$val)
		{
			if (is_string($val['name'])) core::$req[$var]= $val;  // <input type=file name=xxx ...>
			else  // <input type=file name=xxx[yyy] ...>
			{
				foreach ($val['name'] as $key=>$void)
				{
		 			core::$req[$var][$key]= array(
						'name'=>$val['name'][$key],
						'type'=>$val['type'][$key],
						'tmp_name'=>$val['tmp_name'][$key],
						'error'=>$val['error'][$key],
						'size'=>$val['size'][$key]
					);
				}
			}
		}

		if (isset(core::$config['cookie-vars'])) foreach (core::$config['cookie-vars'] as $name=>$config) 
		{
			if (isset(core::$req[$name]))
			{
				core::$req[$name]= core::filter(core::$req[$name], $config);
				if (!isset($_COOKIE[$name]) || $_COOKIE[$name]!=core::$req[$name])
				{
					setcookie($name, core::$req[$name], $config['expire']);
				}
				unset(core::$reqUrl[$name]);
			}
		}
		
		// apply required vars
		if (isset(core::$config['required'])) foreach (core::$config['required'] as $name=>$config)
		{
			core::$req[$name]=  core::filter(core::$req[$name],$comfig);
			core::$reqUrl[$name]= core::$req[$name];
		}
		
		if (!core::moduleName())
		{
			if (is_array(core::$config['default-module']))
			{
				$args= href::processArgs(core::$config['default-module']);
				core::$req[core::$config['module-var']]= $args['template'];
				array_merge(core::$reques,$args['req']);
			}
		}
		core::$req[core::$config['module-var']]= str_replace('..','(dot)(dot)',core::moduleName()); //secure upper directories
		core::$req[core::$config['module-var']]= str_replace("\0",'(0)',core::moduleName()); //secure
		core::$req[core::$config['module-var']]= str_replace('<','(lt)',core::moduleName()); //secure
		core::$req[core::$config['module-var']]= str_replace('>','(gt)',core::moduleName()); //secure

		// set session var
		if (core::req(session_name()) || isset(core::$config['session-vars']))
		{
			if (!session_id()) session_start();
			foreach ($_SESSION as $name=>$val) core::$req[$name]= $val;
			if (isset(core::$config['session-vars'])) foreach (core::$config['session-vars'] as $name=>$config)
			{
				core::$req[$name]= core::filter(core::req($name),$config);
				unset(core::$reqUrl[$name]);
			}
		}

		if (core::req('cms-oper')) cms::perform();
		elseif (core::req('core-module')=='cms-resource') cmsGui::forward(core::req('file'));

		ob_start();
		if (isset(core::$config['pre-models'])) foreach(core::$config['pre-models'] as $model) core::model($model);
		core::insert(core::moduleName());
		$buffer= ob_get_contents();
		ob_end_clean();

		// Process pre- and post-templates
		if (!core::reg('run-naked'))
		{
			ob_start();
			if (isset(core::$config['pre-module'])) core::insert(core::$config['pre-module']);
			echo $buffer;
			if (isset(core::$config['post-module'])) core::insert(core::$config['post-module']);
			if (isset(core::$config['post-models'])) foreach(core::$config['post-models'] as $model) core::model($model);
			$buffer= ob_get_contents();
			ob_end_clean();
		}
		
		// Output
		echo $buffer;
//.........这里部分代码省略.........
开发者ID:Emperor359,项目名称:conkit,代码行数:101,代码来源:core.php

示例5: file

core::reg('run-naked',true);


if (!core::req('cms-form-action'))
{
	$no= core::req('no');
	$file= core::config('data-path')."block$no.txt";
	$block= file($file);
	
	$f= cms::form();
	$f-> method('post') -> action(core::urlAdd('cms-form-action','save'));
	$f-> hidden('no') -> value($no);
	$f-> text("headline") -> label('Headline') -> value($block[0]);
	$f-> text("subheadline") -> label('SubHeadline') -> value($block[1]);
	$f-> textarea("text") -> label('Text') -> value(implode('',array_slice($block,2)));
	$f-> submit('Save');
	$f-> display();
}
elseif (core::req('cms-form-action')=='save')
{
	$no= core::req('no');
	$file= core::config('data-path')."block$no.txt";
	file_put_contents($file, core::req("headline")."\n");
	file_put_contents($file, core::req("subheadline")."\n",FILE_APPEND);
	file_put_contents($file, core::req("text"),FILE_APPEND);
	core::redirect('home');
}


return true;
开发者ID:Emperor359,项目名称:conkit,代码行数:30,代码来源:edit-block.mod.php


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