CRON + latte + texy vyžaduje prihlásenie

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
Čamo
Člen | 798
+
0
-

Ahoj,
nevie niekto prečo mi takýto riadok v emailovej šablone

<td>{!$article->text|texy}</td>

vypíše do konzoly, keď ho spustím cez CronPresenter takýto text?

<h1>Redirect</h1>
<p><a href="http://reporter.wt.sk/sign/in">Please click here to continue</a>.</p>
David Matějka
Moderator | 6445
+
0
-

tento radek to nezpusobuje, zpusobuje to asi tohle

Čamo
Člen | 798
+
0
-

matej21
Ako to myslíš? Keď ten helper odstránim tak to funguje. Ani ten $invalidLinkmode tam už tiež nemám.
Nechápem vôbec prečo sa to deje. Keď to spustím normálne cez http, tak funguje aj s tým helperom. Ale cez príkazový riadok to neprejde. Keby to aspoň dávalo nejaký zmysel…

David Matějka
Moderator | 6445
+
0
-

divny, ukaz kod toho filtru..

Čamo
Člen | 798
+
0
-

Našiel som toto ale ja som to ešte nepozeral:

<?php

namespace WT\Helpers;

use Nette\Object,
	Nette\DI\Container,
	Nette\Caching\Cache,
	Nette\Application\UI\Control;

/**
 * @property-read \Texy $texy
 * @property Nette\Application\UI\Control
 * @property bool $safe
 */
class Texy extends Object
{
	/** @var Nette\DI\Container */
	protected $context;

	/** @var Nette\Application\Control */
	protected $control;



	/**
	 * @param Nette\DI\Container
	 */
	public function __construct(Container $context)
	{
		$this->context = $context;
	}



	/**
	 * @param Nette\Application\UI\Control
	 * @return WT\Helpers\Texy
	 */
	public function setControl(Control $control)
	{
	    $this->control = $control;
	    return $this;
	}



	/**
	 * @return Nette\Application\UI\Control
	 */
	public function getControl()
	{
	    return $this->control;
	}



	/**
	 * @param string
	 * @param bool
	 * @return string
	 */
	public function process($string, $safe = false)
	{
		static $texy;

		$context = $this->context;
		$control = $this->control;

		if ($texy === NULL) {
			$baseUrl = $context->httpRequest->url->baseUrl;

			$texy = new \Texy();
			$texy::$advertisingNotice = false;
			$texy->setOutputMode(\Texy::XHTML5);

			// task references
			$texy->addHandler('newReference', function ($parser, $ref) use ($context, $control) {
			    if (!$control || !is_numeric($ref)) {
			        return false;
			    }

				$mode = $control->isLinkCurrent('Tickets:*') ? 'ticket' : 'task';

				$cache = new Cache($context->cacheStorage, 'WT.Helpers.Texy.' . ucfirst($mode) .'Reference');
				if (isset($cache[$ref])) {
					$data = $cache[$ref];
				} else {
					$model = $context->database->table($mode)
							->select('id,name' . ($mode == 'ticket' ? ',customer_id' : NULL))
							->where('id', (int) $ref)
							->fetch();
					if ($model) {
						$data = array('id' => $model->id, 'name' => $model->name, 'prefix' => ($mode == 'ticket' && $model->customer_id ? $model->customer->prefix : NULL));
					} else {
						$data = false;
					}
					$cache->save($ref, $data, array(Cache::EXPIRE => '+1 week'));
				}

				if (!$data) {
					return false;
				}

				$el = \TexyHtml::el('a');
				$el->attrs['href'] = $control->link(ucfirst($mode) . 's:detail', $ref);
				$el->attrs['class'][] = 'ref-task';
				$el->attrs['title'][] = $data['id'] . ' - ' . $data['name'];
				$el->setText("[" . (isset($data['prefix']) ? $data['prefix'] . "\xE2\x80\x91" : NULL) . $ref . "]");
				return $el;
			});

			$texy->htmlOutputModule->baseIndent = 0;
			$texy->htmlOutputModule->lineWrap = false;
			$texy->htmlOutputModule->removeOptional = false;

			// headings
			$texy->allowed['heading/surrounded'] = true;
			$texy->allowed['heading/underlined'] = true;
			$texy->headingModule->top = 2;

			// horizontal line
			$texy->allowed['horizline'] = true;

			// HTML code
			$texy->allowed['html/tag']     = true;
			$texy->allowed['html/comment'] = false;

			// images
			$texy->allowed['image'] = true;
			$texy->allowed['image/definition'] = false;
			$texy->imageModule->root       = $baseUrl . 'images';
			$texy->imageModule->linkedRoot = WWW_DIR . 'images';
			$texy->imageModule->leftClass  ='left';
			$texy->imageModule->rightClass = 'right';

			// links
			$texy->allowed['link/definition'] = true;
			$texy->allowed['link/reference']  = true;
			$texy->allowed['link/url']        = true;
			$texy->allowed['link/email']      = true;
			$texy->linkModule->forceNoFollow  = false;

			// lists
			$texy->allowed['list'] = true;
			$texy->allowed['list/definition'] = true;

			// split long words
			$texy->allowed['longwords'] = true;
			$texy->longWordsModule->wordLimit = 20;

			// tables
			$texy->allowed['table/definition'] = false;

			// typography
			$texy->allowed['typography'] = true;
			$texy->typographyModule->locale = $context->parameters['lang'];

			// emoticons
			$texy->allowed['emoticon'] = true;
			$texy->emoticonModule->root     = $baseUrl . 'css/images/emoticons';
			$texy->emoticonModule->fileRoot = WWW_DIR . '/css/images/emoticons';
			$texy->emoticonModule->icons    = array(
				':-)' => 'smile.png',     ':)' => 'smile.png',
				':-(' => 'unhappy.png',   ':(' => 'unhappy.png',
				';-)' => 'wink.png',      ';)' => 'wink.png',
				':-D' => 'grin.png',      ':D' => 'grin.png',
				':-P' => 'tongue.png',    ':P' => 'tongue.png',
				':-O' => 'surprised.png', ':O' => 'surprised.png'
			);

			// user scripts
			$texy->allowed['script'] = false;
		}

		if ($safe) {
			\TexyConfigurator::safeMode($texy);
		}

		return $texy->process($string, false);
	}
}