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


PHP nl2br_html5函数代码示例

本文整理汇总了PHP中nl2br_html5函数的典型用法代码示例。如果您正苦于以下问题:PHP nl2br_html5函数的具体用法?PHP nl2br_html5怎么用?PHP nl2br_html5使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     $rows = deserialize($this->tableitems);
     $this->Template->id = 'table_' . $this->id;
     $this->Template->summary = specialchars($this->summary);
     $this->Template->useHeader = $this->thead ? true : false;
     $this->Template->useFooter = $this->tfoot ? true : false;
     $this->Template->useLeftTh = $this->tleft ? true : false;
     $this->Template->sortable = $this->sortable ? true : false;
     $arrHeader = array();
     $arrBody = array();
     $arrFooter = array();
     // Table header
     if ($this->thead) {
         foreach ($rows[0] as $i => $v) {
             // Set table sort cookie
             if ($this->sortable && $i == $this->sortIndex) {
                 $co = 'TS_TABLE_' . $this->id;
                 $so = $this->sortOrder == 'descending' ? 'desc' : 'asc';
                 if (\Input::cookie($co) == '') {
                     \System::setCookie($co, $i . '|' . $so, 0);
                 }
             }
             // Add cell
             $arrHeader[] = array('class' => 'head_' . $i . ($i == 0 ? ' col_first' : '') . ($i == count($rows[0]) - 1 ? ' col_last' : '') . ($i == 0 && $this->tleft ? ' unsortable' : ''), 'content' => $v != '' ? nl2br_html5($v) : ' ');
         }
         array_shift($rows);
     }
     $this->Template->header = $arrHeader;
     $limit = $this->tfoot ? count($rows) - 1 : count($rows);
     // Table body
     for ($j = 0; $j < $limit; $j++) {
         $class_tr = '';
         if ($j == 0) {
             $class_tr .= ' row_first';
         }
         if ($j == $limit - 1) {
             $class_tr .= ' row_last';
         }
         $class_eo = $j % 2 == 0 ? ' odd' : ' even';
         foreach ($rows[$j] as $i => $v) {
             $class_td = '';
             if ($i == 0) {
                 $class_td .= ' col_first';
             }
             if ($i == count($rows[$j]) - 1) {
                 $class_td .= ' col_last';
             }
             $arrBody['row_' . $j . $class_tr . $class_eo][] = array('class' => 'col_' . $i . $class_td, 'content' => $v != '' ? nl2br_html5($v) : '&nbsp;');
         }
     }
     $this->Template->body = $arrBody;
     // Table footer
     if ($this->tfoot) {
         foreach ($rows[count($rows) - 1] as $i => $v) {
             $arrFooter[] = array('class' => 'foot_' . $i . ($i == 0 ? ' col_first' : '') . ($i == count($rows[count($rows) - 1]) - 1 ? ' col_last' : ''), 'content' => $v != '' ? nl2br_html5($v) : '&nbsp;');
         }
     }
     $this->Template->footer = $arrFooter;
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:63,代码来源:ContentTable.php

示例2: listNewsletterArticles

    /**
     * Add the type of input field
     * @param array
     * @return string
     */
    public function listNewsletterArticles($arrRow)
    {
        $strStats = '';
        $strContents = '';
        $objContents = \ContentModel::findPublishedByPidAndTable($arrRow['id'], 'tl_newsletter');
        if (!is_null($objContents)) {
            foreach ($objContents as $objContent) {
                $strContents .= $this->getContentElement($objContent->id) . '<hr>';
            }
        }
        $intTotal = $arrRow['recipients'] + $arrRow['rejected'];
        //		$intTracked = NewsletterContent\Models\NewsletterTrackingModel::countTrackedByPid($arrRow['id']);
        $objTracked = NewsletterContent\Models\NewsletterTrackingModel::findTrackedInteractionsByPid($arrRow['id']);
        $intTracked = !is_null($objTracked) ? $objTracked->count() : 0;
        $intPercent = @round($intTracked / $intTotal * 100);
        $strStats = sprintf($GLOBALS['TL_LANG']['tl_newsletter']['sentTo'], $arrRow['recipients'], strval($intTotal), strval($intTracked), strval($intPercent));
        return '
<div class="cte_type ' . ($arrRow['sent'] && $arrRow['date'] ? 'published' : 'unpublished') . '"><strong>' . $arrRow['subject'] . '</strong> - ' . ($arrRow['sent'] && $arrRow['date'] ? sprintf($GLOBALS['TL_LANG']['tl_newsletter']['sentOn'], Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $arrRow['date'])) . '<br>' . $strStats : $GLOBALS['TL_LANG']['tl_newsletter']['notSent']) . '</div>
<div class="limit_height' . (!$GLOBALS['TL_CONFIG']['doNotCollapse'] ? ' h128' : '') . '">
' . (!$arrRow['sendText'] && strlen($strContents) ? '
' . $strContents : '') . '
' . nl2br_html5($arrRow['text']) . '
</div>' . "\n";
        return '<div class="tl_content_left">' . $arrRow['subject'] . ' <span style="color:#b3b3b3;padding-left:3px">[' . $arrRow['senderName'] . ' &lt;' . $arrRow['sender'] . '&gt;]</span></div>';
    }
开发者ID:davidenke,项目名称:newsletter_content,代码行数:30,代码来源:tl_newsletter.php

示例3: listNewsletterArticles

    /**
     * Add the type of input field
     * @param array
     * @return string
     */
    public function listNewsletterArticles($arrRow)
    {
        $strStats = '';
        $strContents = '';
        $objContents = \ContentModel::findPublishedByPidAndTable($arrRow['id'], 'tl_newsletter');
        if (!is_null($objContents)) {
            foreach ($objContents as $objContent) {
                $strContents .= $this->getContentElement($objContent->id) . '<hr>';
            }
        }
        $strStats = sprintf($GLOBALS['TL_LANG']['tl_newsletter']['hoja_status_string'], $arrRow['hoja_recipients'], $arrRow['hoja_rejected']);
        return '
<div class="cte_type ' . ($arrRow['sent'] && $arrRow['date'] ? 'published' : 'unpublished') . '"><strong>' . $arrRow['subject'] . '</strong> - ' . ($arrRow['sent'] && $arrRow['date'] ? sprintf($GLOBALS['TL_LANG']['tl_newsletter']['sentOn'], Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $arrRow['date'])) . '<br>' . $strStats : $GLOBALS['TL_LANG']['tl_newsletter']['notSent']) . '</div>
<div class="limit_height' . (!$GLOBALS['TL_CONFIG']['doNotCollapse'] ? ' h128' : '') . '">
' . (!$arrRow['sendText'] && strlen($strContents) ? '
' . $strContents : '') . '
' . nl2br_html5($arrRow['text']) . '
</div>' . "\n";
    }
开发者ID:hojanssen,项目名称:contao_hoja_newsletter_extended,代码行数:24,代码来源:tl_newsletter.php

示例4: renderReadablePropertyValue

 /**
  * Render a property value to readable text.
  *
  * @param RenderReadablePropertyValueEvent $event The event being processed.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  */
 public static function renderReadablePropertyValue(RenderReadablePropertyValueEvent $event)
 {
     if ($event->getRendered() !== null) {
         return;
     }
     $dispatcher = $event->getEnvironment()->getEventDispatcher();
     $property = $event->getProperty();
     $value = self::decodeValue($event->getEnvironment(), $event->getModel(), $event->getProperty()->getName(), $event->getValue());
     $extra = $property->getExtra();
     // TODO: refactor - foreign key handling is not yet supported.
     /*
             if (isset($arrFieldConfig['foreignKey']))
             {
        $temp = array();
        $chunks = explode('.', $arrFieldConfig['foreignKey'], 2);
     
     
        foreach ((array) $value as $v)
        {
     //                    $objKey = $this->Database->prepare("SELECT " . $chunks[1] . " AS value FROM " . $chunks[0] . " WHERE id=?")
     //                            ->limit(1)
     //                            ->execute($v);
     //
     //                    if ($objKey->numRows)
     //                    {
     //                        $temp[] = $objKey->value;
     //                    }
        }
     
     //                $row[$i] = implode(', ', $temp);
             }
             // Decode array
             else
     */
     if (is_array($value)) {
         foreach ($value as $kk => $vv) {
             if (is_array($vv)) {
                 $vals = array_values($vv);
                 $value[$kk] = $vals[0] . ' (' . $vals[1] . ')';
             }
         }
         $event->setRendered(implode(', ', $value));
     } elseif (isset($extra['rgxp'])) {
         // Date format.
         if ($extra['rgxp'] == 'date' || $extra['rgxp'] == 'time' || $extra['rgxp'] == 'datim') {
             $event->setRendered(self::parseDateTime($dispatcher, $GLOBALS['TL_CONFIG'][$extra['rgxp'] . 'Format'], $value));
         }
     } elseif ($property->getName() == 'tstamp') {
         // Date and time format.
         $dateEvent = new ParseDateEvent($value, $GLOBALS['TL_CONFIG']['timeFormat']);
         $dispatcher->dispatch(ContaoEvents::DATE_PARSE, $dateEvent);
         $event->setRendered($dateEvent->getResult());
     } elseif ($property->getWidgetType() == 'checkbox' && !$extra['multiple']) {
         $event->setRendered(strlen($value) ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no']);
     } elseif ($property->getWidgetType() == 'textarea' && (!empty($extra['allowHtml']) || !empty($extra['preserveTags']))) {
         $event->setRendered(nl2br_html5(specialchars($value)));
     } elseif (isset($extra['reference']) && is_array($extra['reference'])) {
         if (isset($extra['reference'][$value])) {
             $event->setRendered(is_array($extra['reference'][$value]) ? $extra['reference'][$value][0] : $extra['reference'][$value]);
         }
     } elseif ($value instanceof \DateTime) {
         $dateEvent = new ParseDateEvent($value->getTimestamp(), $GLOBALS['TL_CONFIG']['datimFormat']);
         $dispatcher->dispatch(ContaoEvents::DATE_PARSE, $dateEvent);
         $event->setRendered($dateEvent->getResult());
     } else {
         $options = $property->getOptions();
         if (!$options) {
             $options = self::getOptions($event->getEnvironment(), $event->getModel(), $event->getProperty());
             if ($options) {
                 $property->setOptions($options);
             }
         }
         if (array_is_assoc($options)) {
             $event->setRendered($options[$value]);
         }
     }
 }
开发者ID:davidmaack,项目名称:dc-general,代码行数:87,代码来源:Subscriber.php

示例5: editTask

	/**
	 * Edit a task
	 */
	protected function editTask()
	{
		$this->Template = new BackendTemplate('be_task_edit');
		$fs = $this->Session->get('fieldset_states');

		$this->Template->titleClass = (isset($fs['tl_tasks']['title_legend']) && !$fs['tl_tasks']['title_legend']) ? ' collapsed' : '';
		$this->Template->assignClass = (isset($fs['tl_tasks']['assign_legend']) && !$fs['tl_tasks']['assign_legend']) ? ' collapsed' : '';
		$this->Template->statusClass = (isset($fs['tl_tasks']['status_legend']) && !$fs['tl_tasks']['status_legend']) ? ' collapsed' : '';
		$this->Template->historyClass = (isset($fs['tl_tasks']['history_legend']) && !$fs['tl_tasks']['history_legend']) ? ' collapsed' : '';

		$this->Template->goBack = $GLOBALS['TL_LANG']['MSC']['goBack'];
		$this->Template->headline = sprintf($GLOBALS['TL_LANG']['tl_task']['edit'][1], $this->Input->get('id'));

		$objTask = $this->Database->prepare("SELECT *, (SELECT name FROM tl_user u WHERE u.id=t.createdBy) AS creator FROM tl_task t WHERE id=?")
								  ->limit(1)
								  ->execute($this->Input->get('id'));

		if ($objTask->numRows < 1)
		{
			$this->log('Invalid task ID "' . $this->Input->get('id') . '"', 'ModuleTask editTask()', TL_ERROR);
			$this->redirect('contao/main.php?act=error');
		}

		// Check if the user is allowed to edit the task
		if (!$this->User->isAdmin && $objTask->createdBy != $this->User->id)
		{
			$this->log('Not enough permissions to edit task ID "' . $this->Input->get('id') . '"', 'ModuleTask editTask()', TL_ERROR);
			$this->redirect('contao/main.php?act=error');
		}

		// Advanced options
		$this->blnAdvanced = ($this->User->isAdmin || $objTask->createdBy == $this->User->id);
		$this->Template->advanced = $this->blnAdvanced;

		$this->Template->title = $this->blnAdvanced ? $this->getTitleWidget($objTask->title) : $objTask->title;
		$this->Template->deadline = $this->blnAdvanced ? $this->getDeadlineWidget($this->parseDate($GLOBALS['TL_CONFIG']['dateFormat'], $objTask->deadline)) : $this->parseDate($GLOBALS['TL_CONFIG']['dateFormat'], $objTask->deadline);

		$arrHistory = array();

		// Get the status
		$objStatus = $this->Database->prepare("SELECT *, (SELECT name FROM tl_user u WHERE u.id=s.assignedTo) AS name FROM tl_task_status s WHERE pid=? ORDER BY tstamp")
									->execute($this->Input->get('id'));

		while($objStatus->next())
		{
			$arrHistory[] = array
			(
				'creator' => $objTask->creator,
				'date' => $this->parseDate($GLOBALS['TL_CONFIG']['dateFormat'], $objStatus->tstamp),
				'status' => (($GLOBALS['TL_LANG']['tl_task_status'][$objStatus->status] != '') ? $GLOBALS['TL_LANG']['tl_task_status'][$objStatus->status] : $objStatus->status),
				'comment' => (($objStatus->comment != '') ? nl2br_html5($objStatus->comment) : '&nbsp;'),
				'assignedTo' => $objStatus->assignedTo,
				'progress' => $objStatus->progress,
				'class' => $objStatus->status,
				'name' => $objStatus->name
			);
		}

		$this->Template->assignedTo = $this->getAssignedToWidget($objStatus->assignedTo);
		$this->Template->notify = $this->getNotifyWidget();
		$this->Template->status = $this->getStatusWidget($objStatus->status, $objStatus->progress);
		$this->Template->progress = $this->getProgressWidget($objStatus->progress);
		$this->Template->comment = $this->getCommentWidget();

		// Update task
		if ($this->Input->post('FORM_SUBMIT') == 'tl_tasks' && $this->blnSave)
		{
			// Update task
			if ($this->blnAdvanced)
			{
				$deadline = new Date($this->Template->deadline->value, $GLOBALS['TL_CONFIG']['dateFormat']);

				$this->Database->prepare("UPDATE tl_task SET title=?, deadline=? WHERE id=?")
							   ->execute($this->Template->title->value, $deadline->dayBegin, $this->Input->get('id'));
			}

			// Insert status
			$arrSet = array
			(
				'pid' => $this->Input->get('id'),
				'tstamp' => time(),
				'assignedTo' => $this->Template->assignedTo->value,
				'status' => $this->Template->status->value,
				'progress' => (($this->Template->status->value == 'completed') ? 100 : $this->Template->progress->value),
				'comment' => trim($this->Template->comment->value)
			);

			$this->Database->prepare("INSERT INTO tl_task_status %s")->set($arrSet)->execute();

			// Notify user
			if ($this->Input->post('notify'))
			{
				$objUser = $this->Database->prepare("SELECT email FROM tl_user WHERE id=?")
										  ->limit(1)
										  ->execute($this->Template->assignedTo->value);

				if ($objUser->numRows)
//.........这里部分代码省略.........
开发者ID:narrenfrei,项目名称:core,代码行数:101,代码来源:ModuleTasks.php

示例6: nl2br_pre

/**
 * Replace line breaks with <br> tags preserving preformatted text
 * @param string
 * @param boolean
 * @return string
 */
function nl2br_pre($str, $xhtml = false)
{
    $str = $xhtml ? nl2br_xhtml($str) : nl2br_html5($str);
    if (stripos($str, '<pre') === false) {
        return $str;
    }
    $chunks = array();
    preg_match_all('/<pre[^>]*>.*<\\/pre>/Uis', $str, $chunks);
    foreach ($chunks as $chunk) {
        $str = str_replace($chunk, str_ireplace(array('<br>', '<br />'), '', $chunk), $str);
    }
    return $str;
}
开发者ID:jens-wetzel,项目名称:use2,代码行数:19,代码来源:functions.php

示例7: send


//.........这里部分代码省略.........
                if (!empty($_SESSION['REJECTED_RECIPIENTS'])) {
                    $intRejected = count($_SESSION['REJECTED_RECIPIENTS']);
                    $_SESSION['TL_INFO'][] = sprintf($GLOBALS['TL_LANG']['tl_newsletter']['rejected'], $intRejected);
                    $intTotal -= $intRejected;
                    foreach ($_SESSION['REJECTED_RECIPIENTS'] as $strRecipient) {
                        $this->Database->prepare("UPDATE tl_newsletter_recipients SET active='' WHERE email=?")->execute($strRecipient);
                        $this->log('Recipient address "' . $strRecipient . '" was rejected and has been deactivated', 'Newsletter sendNewsletter()', TL_ERROR);
                    }
                }
                $_SESSION['TL_CONFIRM'][] = sprintf($GLOBALS['TL_LANG']['tl_newsletter']['confirm'], $intTotal);
                echo '<script>setTimeout(\'window.location="' . $this->Environment->base . $referer . '"\', 1000);</script>';
                echo '<a href="' . $this->Environment->base . $referer . '">Please click here to proceed if you are not using JavaScript</a>';
            } else {
                $url = preg_replace('/&(amp;)?(start|mpc|recipient)=[^&]*/', '', $this->Environment->request) . '&start=' . ($intStart + $intPages) . '&mpc=' . $intPages;
                echo '<script>setTimeout(\'window.location="' . $this->Environment->base . $url . '"\', ' . $intTimeout * 1000 . ');</script>';
                echo '<a href="' . $this->Environment->base . $url . '">Please click here to proceed if you are not using JavaScript</a>';
            }
            echo '</div></div>';
            exit;
        }
        $strToken = md5(uniqid(mt_rand(), true));
        $this->Session->set('tl_newsletter_send', $strToken);
        $sprintf = strlen($objNewsletter->senderName) ? $objNewsletter->senderName . ' &lt;%s&gt;' : '%s';
        $this->import('BackendUser', 'User');
        // Preview newsletter
        $return = '
<div id="tl_buttons">
<a href="' . $this->getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBT']) . '" accesskey="b">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>

<h2 class="sub_headline">' . sprintf($GLOBALS['TL_LANG']['tl_newsletter']['send'][1], $objNewsletter->id) . '</h2>
' . $this->getMessages() . '
<form action="' . ampersand($this->Environment->script, true) . '" id="tl_newsletter_send" class="tl_form" method="get">
<div class="tl_formbody_edit tl_newsletter_send">
<input type="hidden" name="do" value="' . $this->Input->get('do') . '">
<input type="hidden" name="table" value="' . $this->Input->get('table') . '">
<input type="hidden" name="key" value="' . $this->Input->get('key') . '">
<input type="hidden" name="id" value="' . $this->Input->get('id') . '">
<input type="hidden" name="token" value="' . $strToken . '">
<table class="prev_header">
  <tr class="row_0">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['from'] . '</td>
    <td class="col_1">' . sprintf($sprintf, $objNewsletter->sender) . '</td>
  </tr>
  <tr class="row_1">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['subject'][0] . '</td>
    <td class="col_1">' . $objNewsletter->subject . '</td>
  </tr>
  <tr class="row_2">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['template'][0] . '</td>
    <td class="col_1">' . $objNewsletter->template . '</td>
  </tr>' . (is_array($arrAttachments) && count($arrAttachments) > 0 ? '
  <tr class="row_3">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['attachments'] . '</td>
    <td class="col_1">' . implode(', ', $arrAttachments) . '</td>
  </tr>' : '') . '
</table>' . (!$objNewsletter->sendText ? '
<div class="preview_html">
' . $html . '
</div>' : '') . '
<div class="preview_text">
' . nl2br_html5($text) . '
</div>
<div class="tl_tbox block">
<div class="w50">
  <h3><label for="ctrl_mpc">' . $GLOBALS['TL_LANG']['tl_newsletter']['mailsPerCycle'][0] . '</label></h3>
  <input type="text" name="mpc" id="ctrl_mpc" value="10" class="tl_text" onfocus="Backend.getScrollOffset();">' . ($GLOBALS['TL_LANG']['tl_newsletter']['mailsPerCycle'][1] && $GLOBALS['TL_CONFIG']['showHelp'] ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['mailsPerCycle'][1] . '</p>' : '') . '
</div>
<div class="w50">
  <h3><label for="ctrl_timeout">' . $GLOBALS['TL_LANG']['tl_newsletter']['timeout'][0] . '</label></h3>
  <input type="text" name="timeout" id="ctrl_timeout" value="1" class="tl_text" onfocus="Backend.getScrollOffset();">' . ($GLOBALS['TL_LANG']['tl_newsletter']['timeout'][1] && $GLOBALS['TL_CONFIG']['showHelp'] ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['timeout'][1] . '</p>' : '') . '
</div>
<div class="w50">
  <h3><label for="ctrl_start">' . $GLOBALS['TL_LANG']['tl_newsletter']['start'][0] . '</label></h3>
  <input type="text" name="start" id="ctrl_start" value="0" class="tl_text" onfocus="Backend.getScrollOffset();">' . ($GLOBALS['TL_LANG']['tl_newsletter']['start'][1] && $GLOBALS['TL_CONFIG']['showHelp'] ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['start'][1] . '</p>' : '') . '
</div>
<div class="w50">
  <h3><label for="ctrl_recipient">' . $GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][0] . '</label></h3>' . (strlen($_SESSION['TL_PREVIEW_ERROR']) ? '
  <div class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['email'] . '</div>' : '') . '
  <input type="text" name="recipient" id="ctrl_recipient" value="' . $this->User->email . '" class="tl_text" onfocus="Backend.getScrollOffset();">' . ($GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][1] && $GLOBALS['TL_CONFIG']['showHelp'] ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][1] . '</p>' : '') . '
</div>
</div>
</div>

<div class="tl_formbody_submit">

<div class="tl_submit_container">
<input type="submit" name="preview" class="tl_submit" accesskey="p" value="' . specialchars($GLOBALS['TL_LANG']['tl_newsletter']['preview']) . '">
<input type="submit" id="send" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['tl_newsletter']['send'][0]) . '" onclick="return confirm(\'' . str_replace("'", "\\'", $GLOBALS['TL_LANG']['tl_newsletter']['sendConfirm']) . '\')">
</div>

</div>
</form>';
        $_SESSION['TL_PREVIEW_ERROR'] = false;
        return $return;
    }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:101,代码来源:Newsletter.php

示例8: send


//.........这里部分代码省略.........
        }
        // Replace inserttags
        $arrName = explode(' ', $this->User->name);
        $preview = $this->replaceInsertTags($preview);
        $preview = $this->prepareLinkTracking($preview, $objNewsletter->id, $this->User->email, '&preview=1');
        $preview = $this->parseSimpleTokens($preview, array('firstname' => $arrName[0], 'lastname' => $arrName[sizeof($arrName) - 1], 'street' => 'Königsbrücker Str. 9', 'postal' => '01099', 'city' => 'Dresden', 'phone' => '0351 30966184', 'email' => $this->User->email, 'tracker_png' => \Environment::get('base') . 'tracking/?n=' . $objNewsletter->id . '&e=' . $this->User->email . '&preview=1&t=png', 'tracker_gif' => \Environment::get('base') . 'tracking/?n=' . $objNewsletter->id . '&e=' . $this->User->email . '&preview=1&t=gif', 'tracker_css' => \Environment::get('base') . 'tracking/?n=' . $objNewsletter->id . '&e=' . $this->User->email . '&preview=1&t=css', 'tracker_js' => \Environment::get('base') . 'tracking/?n=' . $objNewsletter->id . '&e=' . $this->User->email . '&preview=1&t=js'));
        // Create cache folder
        if (!file_exists(TL_ROOT . '/system/cache/newsletter')) {
            mkdir(TL_ROOT . '/system/cache/newsletter');
            file_put_contents(TL_ROOT . '/system/cache/newsletter/.htaccess', '<IfModule !mod_authz_core.c>
  Order allow,deny
  Allow from all
</IfModule>
<IfModule mod_authz_core.c>
  Require all granted
</IfModule>');
        }
        // Cache preview
        file_put_contents(TL_ROOT . '/system/cache/newsletter/' . $objNewsletter->alias . '.html', preg_replace('/^\\s+|\\n|\\r|\\s+$/m', '', $preview));
        // Preview newsletter
        $return = '
<div id="tl_buttons">
<a href="' . $this->getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>

<h2 class="sub_headline">' . sprintf($GLOBALS['TL_LANG']['tl_newsletter']['send'][1], $objNewsletter->id) . '</h2>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('script'), true) . '" id="tl_newsletter_send" class="tl_form" method="get">
<div class="tl_formbody_edit tl_newsletter_send">
<input type="hidden" name="do" value="' . \Input::get('do') . '">
<input type="hidden" name="table" value="' . \Input::get('table') . '">
<input type="hidden" name="key" value="' . \Input::get('key') . '">
<input type="hidden" name="id" value="' . \Input::get('id') . '">
<input type="hidden" name="token" value="' . $strToken . '">
<table class="prev_header">
  <tr class="row_0">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['from'] . '</td>
    <td class="col_1">' . sprintf($sprintf, $objNewsletter->sender) . '</td>
  </tr>
  <tr class="row_1">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['subject'][0] . '</td>
    <td class="col_1">' . $objNewsletter->subject . '</td>
  </tr>
  <tr class="row_2">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['template'][0] . '</td>
    <td class="col_1">' . $objNewsletter->template . '</td>
  </tr>' . (!empty($arrAttachments) && is_array($arrAttachments) ? '
  <tr class="row_3">
    <td class="col_0">' . $GLOBALS['TL_LANG']['tl_newsletter']['attachments'] . '</td>
    <td class="col_1">' . implode(', ', $arrAttachments) . '</td>
  </tr>' : '') . '
</table>' . (!$objNewsletter->sendText ? '
<iframe class="preview_html" id="preview_html" seamless border="0" width="703px" height="503px" style="padding:0" src="system/cache/newsletter/' . $objNewsletter->alias . '.html"></iframe>
' : '') . '
<div class="preview_text">
' . nl2br_html5($text) . '
</div>

<div class="tl_tbox">
<div class="w50">
  <h3><label for="ctrl_mpc">' . $GLOBALS['TL_LANG']['tl_newsletter']['mailsPerCycle'][0] . '</label></h3>
  <input type="text" name="mpc" id="ctrl_mpc" value="10" class="tl_text" onfocus="Backend.getScrollOffset()">' . ($GLOBALS['TL_LANG']['tl_newsletter']['mailsPerCycle'][1] && $GLOBALS['TL_CONFIG']['showHelp'] ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['mailsPerCycle'][1] . '</p>' : '') . '
</div>
<div class="w50">
  <h3><label for="ctrl_timeout">' . $GLOBALS['TL_LANG']['tl_newsletter']['timeout'][0] . '</label></h3>
  <input type="text" name="timeout" id="ctrl_timeout" value="1" class="tl_text" onfocus="Backend.getScrollOffset()">' . ($GLOBALS['TL_LANG']['tl_newsletter']['timeout'][1] && $GLOBALS['TL_CONFIG']['showHelp'] ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['timeout'][1] . '</p>' : '') . '
</div>
<div class="w50">
  <h3><label for="ctrl_start">' . $GLOBALS['TL_LANG']['tl_newsletter']['start'][0] . '</label></h3>
  <input type="text" name="start" id="ctrl_start" value="0" class="tl_text" onfocus="Backend.getScrollOffset()">' . ($GLOBALS['TL_LANG']['tl_newsletter']['start'][1] && $GLOBALS['TL_CONFIG']['showHelp'] ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['start'][1] . '</p>' : '') . '
</div>
<div class="w50">
  <h3><label for="ctrl_recipient">' . $GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][0] . '</label></h3>
  <input type="text" name="recipient" id="ctrl_recipient" value="' . $this->User->email . '" class="tl_text" onfocus="Backend.getScrollOffset()">' . (isset($_SESSION['TL_PREVIEW_MAIL_ERROR']) ? '
  <div class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['email'] . '</div>' : ($GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][1] && $GLOBALS['TL_CONFIG']['showHelp'] ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_newsletter']['sendPreviewTo'][1] . '</p>' : '')) . '
</div>
<div class="clear"></div>
</div>
</div>';
        // Do not send the newsletter if there is an attachment format error
        if (!$blnAttachmentsFormatError) {
            $return .= '

<div class="tl_formbody_submit">
<div class="tl_submit_container">
<input type="submit" name="preview" class="tl_submit" accesskey="p" value="' . specialchars($GLOBALS['TL_LANG']['tl_newsletter']['preview']) . '">
<input type="submit" id="send" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['tl_newsletter']['send'][0]) . '" onclick="return confirm(\'' . str_replace("'", "\\'", $GLOBALS['TL_LANG']['tl_newsletter']['sendConfirm']) . '\')">
</div>
</div>';
        }
        $return .= '

</form>';
        unset($_SESSION['TL_PREVIEW_MAIL_ERROR']);
        return $return;
    }
开发者ID:naitsirk68,项目名称:newsletter_content,代码行数:101,代码来源:NewsletterContent.php

示例9: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     $this->Template->content = '';
     $this->Template->referer = 'javascript:history.go(-1)';
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     $objNewsletter = \NewsletterModel::findSentByParentAndIdOrAlias(\Input::get('items'), $this->nl_channels);
     if (null === $objNewsletter) {
         throw new PageNotFoundException('Page not found: ' . \Environment::get('uri'));
     }
     // Overwrite the page title (see #2853 and #4955)
     if ($objNewsletter->subject != '') {
         $objPage->pageTitle = strip_tags(\StringUtil::stripInsertTags($objNewsletter->subject));
     }
     // Add enclosure
     if ($objNewsletter->addFile) {
         $this->addEnclosuresToTemplate($this->Template, $objNewsletter->row(), 'files');
     }
     // Support plain text newsletters (thanks to Hagen Klemp)
     if ($objNewsletter->sendText) {
         $strContent = nl2br_html5($objNewsletter->text);
     } else {
         $strContent = str_ireplace(' align="center"', '', $objNewsletter->content);
     }
     // Parse simple tokens and insert tags
     $strContent = $this->replaceInsertTags($strContent);
     $strContent = \StringUtil::parseSimpleTokens($strContent, array());
     // Encode e-mail addresses
     $strContent = \StringUtil::encodeEmail($strContent);
     $this->Template->content = $strContent;
     $this->Template->subject = $objNewsletter->subject;
 }
开发者ID:contao,项目名称:newsletter-bundle,代码行数:36,代码来源:ModuleNewsletterReader.php

示例10: listNewsletters

    /**
     * List records
     * @param array
     * @return string
     */
    public function listNewsletters($arrRow)
    {
        return '
<div class="cte_type ' . ($arrRow['sent'] && $arrRow['date'] ? 'published' : 'unpublished') . '"><strong>' . $arrRow['subject'] . '</strong> - ' . ($arrRow['sent'] && $arrRow['date'] ? sprintf($GLOBALS['TL_LANG']['tl_newsletter']['sentOn'], $this->parseDate($GLOBALS['TL_CONFIG']['datimFormat'], $arrRow['date'])) : $GLOBALS['TL_LANG']['tl_newsletter']['notSent']) . '</div>
<div class="limit_height' . (!$GLOBALS['TL_CONFIG']['doNotCollapse'] ? ' h128' : '') . '">' . (!$arrRow['sendText'] ? '
' . $arrRow['content'] . '<hr>' : '') . '
' . nl2br_html5($arrRow['text']) . '
</div>' . "\n";
    }
开发者ID:jens-wetzel,项目名称:use2,代码行数:14,代码来源:tl_newsletter.php

示例11: getReadableFieldValue

 /**
  * Get for a field the readable value
  *
  * @param string $strFieldName
  * @param mixed $mixValue
  * @return mixed [string|int]
  */
 public function getReadableFieldValue($strFieldName, $mixValue)
 {
     if (!key_exists($strFieldName, $this->arrDCA['fields'])) {
         return $mixValue;
     }
     // Load the config for current field
     $arrFieldConfig = $this->arrDCA['fields'][$strFieldName];
     $mixModelField = $this->objCurrentModel->getProperty($strFieldName);
     /*
      * @todo Maybe the controlle should handle this ?
      */
     if (isset($arrFieldConfig['foreignKey'])) {
         $temp = array();
         $chunks = explode('.', $arrFieldConfig['foreignKey'], 2);
         foreach ((array) $value as $v) {
             //                    $objKey = $this->Database->prepare("SELECT " . $chunks[1] . " AS value FROM " . $chunks[0] . " WHERE id=?")
             //                            ->limit(1)
             //                            ->execute($v);
             //
             //                    if ($objKey->numRows)
             //                    {
             //                        $temp[] = $objKey->value;
             //                    }
         }
         //                $row[$i] = implode(', ', $temp);
     } else {
         if (is_array($mixValue)) {
             foreach ($mixValue as $kk => $vv) {
                 if (is_array($vv)) {
                     $vals = array_values($vv);
                     $mixValue[$kk] = $vals[0] . ' (' . $vals[1] . ')';
                 }
             }
             return implode(', ', $mixValue);
         } else {
             if ($arrFieldConfig['eval']['rgxp'] == 'date') {
                 return $this->parseDate($GLOBALS['TL_CONFIG']['dateFormat'], $mixValue);
             } else {
                 if ($arrFieldConfig['eval']['rgxp'] == 'time') {
                     return $this->parseDate($GLOBALS['TL_CONFIG']['timeFormat'], $mixValue);
                 } else {
                     if ($arrFieldConfig['eval']['rgxp'] == 'datim' || in_array($arrFieldConfig['flag'], array(5, 6, 7, 8, 9, 10)) || $strFieldName == 'tstamp') {
                         return $this->parseDate($GLOBALS['TL_CONFIG']['datimFormat'], $mixValue);
                     } else {
                         if ($arrFieldConfig['inputType'] == 'checkbox' && !$arrFieldConfig['eval']['multiple']) {
                             return strlen($mixValue) ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no'];
                         } else {
                             if ($arrFieldConfig['inputType'] == 'textarea' && ($arrFieldConfig['eval']['allowHtml'] || $arrFieldConfig['eval']['preserveTags'])) {
                                 return nl2br_html5(specialchars($mixValue));
                             } else {
                                 if (is_array($arrFieldConfig['reference'])) {
                                     return isset($arrFieldConfig['reference'][$mixModelField]) ? is_array($arrFieldConfig['reference'][$mixModelField]) ? $arrFieldConfig['reference'][$mixModelField][0] : $arrFieldConfig['reference'][$mixModelField] : $mixModelField;
                                 } else {
                                     if (array_is_assoc($arrFieldConfig['options'])) {
                                         return $arrFieldConfig['options'][$mixModelField];
                                     } else {
                                         return $mixValue;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:metamodels,项目名称:dc_general,代码行数:74,代码来源:DC_General.php

示例12: renderTextAreaReadable

 /**
  * Render a string if not allow html or preserve tags is given.
  *
  * @param RenderReadablePropertyValueEvent $event The event to store the value to.
  *
  * @param array                            $extra The extra data from the property.
  *
  * @param string                           $value The value to format.
  *
  * @return void
  */
 private static function renderTextAreaReadable(RenderReadablePropertyValueEvent $event, $extra, $value)
 {
     if (empty($extra['allowHtml']) && empty($extra['preserveTags'])) {
         return;
     }
     $event->setRendered(nl2br_html5(specialchars($value)));
 }
开发者ID:zonky2,项目名称:dc-general,代码行数:18,代码来源:Subscriber.php

示例13: getAlbumInformationArray

 /**
  * Returns the information-array about an album
  *
  * @param $intAlbumId
  * @param $objContentElement
  * @return array
  */
 public static function getAlbumInformationArray($intAlbumId, $objContentElement)
 {
     global $objPage;
     // Get the page model
     $objPageModel = \PageModel::findByPk($objPage->id);
     $objAlbum = \Database::getInstance()->prepare('SELECT * FROM tl_gallery_creator_albums WHERE id=?')->execute($intAlbumId);
     //Anzahl Subalben ermitteln
     $objSubAlbums = \Database::getInstance()->prepare('SELECT thumb, count(id) AS countSubalbums FROM tl_gallery_creator_albums WHERE published=? AND pid=? GROUP BY ?')->execute('1', $intAlbumId, 'id');
     $objPics = \Database::getInstance()->prepare('SELECT * FROM tl_gallery_creator_pictures WHERE pid=? AND published=?')->execute($objAlbum->id, '1');
     //Array Thumbnailbreite
     $arrSize = unserialize($objContentElement->gc_size_albumlisting);
     $href = null;
     if (TL_MODE == 'FE') {
         //generate the url as a formated string
         $href = $objPageModel->getFrontendUrl($GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/items/%s', $objPage->language);
         // add albumAlias
         $href = sprintf($href, $objAlbum->alias);
     }
     $arrPreviewThumb = $objContentElement->getAlbumPreviewThumb($objAlbum->id);
     $strImageSrc = $arrPreviewThumb['path'];
     //Generate the thumbnails and the picture element
     try {
         $thumbSrc = \Image::create($strImageSrc, $arrSize)->executeResize()->getResizedPath();
         $picture = \Picture::create($strImageSrc, $arrSize)->getTemplateData();
         if ($thumbSrc !== $strImageSrc) {
             new \File(rawurldecode($thumbSrc), true);
         }
     } catch (\Exception $e) {
         \System::log('Image "' . $strImageSrc . '" could not be processed: ' . $e->getMessage(), __METHOD__, TL_ERROR);
     }
     $picture['alt'] = specialchars($objAlbum->name);
     $picture['title'] = specialchars($objAlbum->name);
     // CSS class
     $strCSSClass = \GalleryCreatorAlbumsModel::hasChildAlbums($objAlbum->id) ? 'has-child-album' : '';
     $strCSSClass .= $objPics->numRows < 1 ? ' empty-album' : '';
     $arrAlbum = array('id' => $objAlbum->id, 'pid' => $objAlbum->pid, 'sorting' => $objAlbum->sorting, 'published' => $objAlbum->published, 'owner' => $objAlbum->owner, 'owners_name' => $objAlbum->owners_name, 'tstamp' => $objAlbum->tstamp, 'event_tstamp' => $objAlbum->date, 'date' => $objAlbum->date, 'event_date' => \Date::parse($GLOBALS['TL_CONFIG']['dateFormat'], $objAlbum->date), 'event_location' => specialchars($objAlbum->event_location), 'name' => specialchars($objAlbum->name), 'alias' => $objAlbum->alias, 'comment' => $objPage->outputFormat == 'xhtml' ? \StringUtil::toXhtml(nl2br_xhtml($objAlbum->comment)) : \StringUtil::toHtml5(nl2br_html5($objAlbum->comment)), 'caption' => $objPage->outputFormat == 'xhtml' ? \StringUtil::toXhtml(nl2br_xhtml($objAlbum->comment)) : \StringUtil::toHtml5(nl2br_html5($objAlbum->comment)), 'visitors' => $objAlbum->visitors, 'href' => $href, 'title' => $objAlbum->name . ' [' . ($objPics->numRows ? $objPics->numRows . ' ' . $GLOBALS['TL_LANG']['gallery_creator']['pictures'] : '') . ($objContentElement->gc_hierarchicalOutput && $objSubAlbums->countSubalbums > 0 ? ' ' . $GLOBALS['TL_LANG']['gallery_creator']['contains'] . ' ' . $objSubAlbums->countSubalbums . '  ' . $GLOBALS['TL_LANG']['gallery_creator']['subalbums'] . ']' : ']'), 'count' => $objPics->numRows, 'count_subalbums' => count(\GalleryCreatorAlbumsModel::getChildAlbums($objAlbum->id)), 'alt' => $arrPreviewThumb['name'], 'src' => TL_FILES_URL . $arrPreviewThumb['path'], 'thumb_src' => TL_FILES_URL . \Image::get($arrPreviewThumb['path'], $arrSize[0], $arrSize[1], $arrSize[2]), 'insert_article_pre' => $objAlbum->insert_article_pre ? $objAlbum->insert_article_pre : null, 'insert_article_post' => $objAlbum->insert_article_post ? $objAlbum->insert_article_post : null, 'class' => 'thumb', 'size' => $arrSize, 'thumbMouseover' => $objContentElement->gc_activateThumbSlider ? "objGalleryCreator.initThumbSlide(this," . $objAlbum->id . "," . $objPics->numRows . ");" : "", 'picture' => $picture, 'cssClass' => trim($strCSSClass));
     // Fuegt dem Array weitere Eintraege hinzu, falls tl_gallery_creator_albums erweitert wurde
     $objAlbum = \GalleryCreatorAlbumsModel::findByPk($intAlbumId);
     if ($objAlbum !== null) {
         $arrAlbum = array_merge($objAlbum->row(), $arrAlbum);
     }
     return $arrAlbum;
 }
开发者ID:markocupic,项目名称:gallery_creator,代码行数:50,代码来源:GcHelpers.php


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