Пример #1
0
function smarty_modifier_static($param, $plugin = null)
{
	$static = CoOrg::staticFile($param, $plugin);
	if (is_array($static))
	{
		CoOrgSmarty::$_static_array = $static;
		return $static[0];
	}
	else
	{
		return $static;
	}
}
Пример #2
0
function smarty_block_a($params, $contents, $smarty)
{
	if ($contents !== NULL)
	{
		$stock = @$params['coorgStock'];
		unset($params['coorgStock']);
		$title = @$params['coorgTitle'];
		unset($params['coorgTitle']);
		$l = @$params['coorgLanguage'];
		unset($params['coorgLanguage']);
		$anchor = array_key_exists('coorgAnchor', $params) ? $params['coorgAnchor'] : null;
		unset($params['coorgAnchor']);
		$request = $params['request'];
		if ($request[0] != '#')
		{
			$urlParams = array($request);
			unset($params['request']);
			$urlParams = array_merge($urlParams, array_values($params));
			$url = CoOrg::createURL($urlParams, $l ? $l : null, $anchor);
		}
		else
		{
			$url = $request;
		}
		
		$a = '<a href="'.htmlspecialchars($url).'"'.
		         ($title ? ' title="'.$title.'"' : '').'>';
		if ($stock)
		{
			$stockInfo = CoOrg::stocks($stock);
			$a .= '<img src="'.CoOrg::staticFile($stockInfo['img']).'"
			            alt="'.$stockInfo['alt'].'"
			            title="'.$stockInfo['title'].'"/>';
			if ($stockInfo['text'])
			{
				$a .= $stockInfo['text'];
			}
			else if ($contents)
			{
				$a .= $contents;
			}
		}
		else
		{
			$a .= $contents;
		}
		$a .= '</a>';
		return $a;
	}
}
Пример #3
0
	public function render()
	{
		if (! $this->_stock)
		{
			return '<input type="submit" name="'.$this->_name.'" value="'.$this->_label.'"'.$this->renderOptions().'/>';
		}
		else
		{
			$stockInfo = CoOrg::stocks($this->_stock);
			$button = '<img src="'.CoOrg::staticFile($stockInfo['img']).'"
			                alt="'.$stockInfo['alt'].'"
			                title="'.$stockInfo['title'].'"/>';
			return '<button type="submit" name="'.$name.'" value="_"'.$this->renderOptions().'>'.$button.'</button>';
		}
	}
Пример #4
0
function smarty_block_button($params, $contents, $smarty)
{
	if ($contents !== NULL)
	{
		$confirm = @$params['coorgConfirm'];
		unset($params['coorgConfirm']);
		
		if ($confirm)
		{
			$confirm = htmlspecialchars($confirm);
			$confirm = str_replace('\'', '\\\'', $confirm);
		}
		
		$form = '<form action="'.CoOrg::createURL(explode('/', $params['request'])).
		              '" method="post" class="normal-post-url"'.
		              ($confirm ? '  onsubmit="return confirm(\''.$confirm.'\');"' : '').
		              '>';
		
		foreach ($params as $key => $value)
		{
			if (strpos($key, 'param_') === 0)
			{
				$name = substr($key, 6);
				$form .= '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'"/>';
			}
		}
		
		$stock = @$params['coorgStock'];
		unset($params['coorgStock']);
		if ($stock)
		{
			$stockInfo = CoOrg::stocks($stock);
			$contents = '<img src="'.CoOrg::staticFile($stockInfo['img']).'"
			            alt="'.$stockInfo['alt'].'"
			            title="'.$stockInfo['title'].'"/>';
			if ($stockInfo['text'])
			{
				$contents = $stockInfo['text'];
			}
		}
		
		$form .= '<button type="submit">'.$contents.'</button>';
		$form .= '</form>';
		return $form;
	}
}
Пример #5
0
	public function __construct()
	{
		$this->name = t('Users');
		$this->image = CoOrg::staticFile('images/user.png', 'user-admin');
		$this->priority = 2;
	}
Пример #6
0
	public function __construct()
	{
		$this->name = t('Menu');
		$this->image = CoOrg::staticFile('images/menu.png', 'menu');
		$this->priority = 2;
	}
Пример #7
0
	public function __construct()
	{
		$this->name = t('Site Configuration');
		$this->priority = 1;
		$this->image = CoOrg::staticFile('images/system.png', 'admin');
	}
Пример #8
0
	public function testThemes()
	{
		CoOrg::config()->set('path', '/');
		CoOrg::config()->set('theme', 'testtheme');
		CoOrg::process('/');
		
		$this->assertEquals('/static/testtheme/mockfile.css?v=testtheme',
		                    CoOrg::staticFile('mockfile.css'));

		$this->assertEquals('/static/default/onlydefault.css?v=A',
		                    CoOrg::staticFile('onlydefault.css'));
		                    
		$this->assertEquals('/coorg/tests/mocks/plugins/alpha/static/testtheme/somefile.css?v=alphaV',
		                    CoOrg::staticFile('somefile.css', 'alpha'));
		
		$this->assertEquals('/coorg/tests/mocks/plugins/alpha/static/default/onlydefault.css?v=2010-10-03',
		                    CoOrg::staticFile('onlydefault.css', 'alpha'));
		                    
		$this->assertEquals(array(
			'/coorg/tests/mocks/plugins/alpha/static/default/extends.css?v=baseV',
			'/coorg/tests/mocks/plugins/alpha/static/testtheme/extends.css?v=extendsV'),
		                    CoOrg::staticFile('extends.css', 'alpha'));

		$this->assertEquals(array(
			'/static/default/extends.css?v=baseV',
			'/static/testtheme/extends.css?v=extendsV'),
		                    CoOrg::staticFile('extends.css'));
	}
Пример #9
0
	public function __construct()
	{
		$this->name = t('Blog');
		$this->image = CoOrg::staticFile('images/blog.png', 'blog');
		$this->priority = 2;
	}
Пример #10
0
	public function __construct()
	{
		$this->name = t('Content');
		$this->image = CoOrg::staticFile('images/page.png', 'page');
		$this->priority = 2;
	}