public function getHtmlLink($attributes = false)
 {
     $url = $this->getUrl();
     $text = $this->getText();
     if ($url && $text) {
         // Open  Link
         $htmlLink = '<a href="' . $url . '"';
         // Add Title (if not in attributes)
         if (!is_array($attributes) || !array_key_exists('title', $attributes)) {
             $htmlLink .= ' title="' . $text . '"';
         }
         // Add Target (if not in attributes)
         if ((!is_array($attributes) || !array_key_exists('title', $attributes)) && $this->target) {
             $htmlLink .= ' target="' . $this->target . '"';
         }
         // Add Attributes
         if (is_array($attributes)) {
             foreach ($attributes as $attr => $value) {
                 $htmlLink .= ' ' . $attr . '="' . $value . '"';
             }
         }
         // Close Up Link
         $htmlLink .= '>' . $text . '</a>';
         // Get Raw
         return TemplateHelper::getRaw($htmlLink);
     }
     return false;
 }
 /**
  * Get either a Gravatar URL or complete image tag for a specified email address.
  *
  * @param string $email The email address
  * @param string $size Size in pixels, defaults to 80px [ 1 - 2048 ]
  * @param string $default Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
  * @param string $rating Maximum rating (inclusive) [ g | pg | r | x ]
  * @param boole $img True to return a complete IMG tag False for just the URL
  * @param array $attr Optional, additional key/value attributes to include in the IMG tag
  * @return String containing either just a URL or a complete image tag
  * @source http://gravatar.com/site/implement/images/php/
  */
 public function get($email, $criteria, $img)
 {
     if (isset($criteria['size'])) {
         $size = $criteria['size'];
     } else {
         $size = 80;
     }
     if (isset($criteria['default'])) {
         $default = $criteria['default'];
     } else {
         $default = 'mm';
     }
     if (isset($criteria['rating'])) {
         $rating = $criteria['rating'];
     } else {
         $rating = 'g';
     }
     $url = '//www.gravatar.com/avatar/';
     $url .= md5(strtolower(trim($email)));
     $url .= "?s={$size}&d={$default}&r={$rating}";
     if ($img) {
         $url = '<img src="' . $url . '"';
         if (isset($criteria['attr'])) {
             foreach ($criteria['attr'] as $key => $val) {
                 $url .= ' ' . $key . '="' . $val . '"';
             }
         }
         $url .= ' />';
     }
     return TemplateHelper::getRaw($url);
 }
Exemple #3
0
 /**
  * Получение иконки:
  */
 public static function getIcon($site)
 {
     $site = str_replace('www.', '', parse_url($site, PHP_URL_HOST));
     if (is_file(WEB_DIR . '/ico/favicons/' . $site . '.gif')) {
         return 'http://' . TemplateHelper::getSiteUrl() . '/ico/favicons/' . $site . '.gif';
     }
     return 'http://favicon.yandex.net/favicon/' . $site;
 }
 public function renderFormCustomMacro($macro, array $args)
 {
     $oldPath = craft()->path->getTemplatesPath();
     $newPath = craft()->path->getPluginsPath() . 'teammanager/templates';
     craft()->path->setTemplatesPath($newPath);
     $html = craft()->templates->renderMacro('_includes/forms', $macro, array($args));
     craft()->path->setTemplatesPath($oldPath);
     return TemplateHelper::getRaw($html);
 }
 /**
  * @param FieldModel $field
  * @param mixed      $value
  * @param mixed      $settings
  * @param array|null $renderingOptions
  *
  * @return \Twig_Markup
  */
 public function getInputHtml($field, $value, $settings, array $renderingOptions = null)
 {
     $this->beginRendering();
     $options = $settings['options'];
     $options = craft()->sproutFields_emailSelectField->obfuscateEmailAddresses($options);
     $rendered = craft()->templates->render('emailselect/input', array('name' => $field->handle, 'value' => $value, 'options' => $options, 'settings' => $settings, 'field' => $field));
     $this->endRendering();
     return TemplateHelper::getRaw($rendered);
 }
 /**
  * The Parsedown filter
  *
  * @param string $text The text to be parsed
  * @param string $mode The parsing mode ('text' or 'line').
  * @param mixed $tags
  * @return string
  */
 public function parsedownFilter($text, $parseAs = 'text')
 {
     if ($parseAs == 'line') {
         $parsed = craft()->parsedown->parseLine($text);
     } else {
         $parsed = craft()->parsedown->parseText($text);
     }
     return TemplateHelper::getRaw($parsed);
 }
 /**
  * @param FieldModel $field
  * @param mixed      $value
  * @param mixed      $settings
  * @param array|null $renderingOptions
  *
  * @return \Twig_Markup
  */
 public function getInputHtml($field, $value, $settings, array $renderingOptions = null)
 {
     $this->beginRendering();
     $attributes = $field->getAttributes();
     $errorMessage = craft()->sproutFields_emailField->getErrorMessage($attributes['name'], $settings);
     $placeholder = isset($settings['placeholder']) ? $settings['placeholder'] : '';
     $rendered = craft()->templates->render('email/input', array('name' => $field->handle, 'value' => $value, 'field' => $field, 'pattern' => $settings['customPattern'], 'errorMessage' => $errorMessage, 'renderingOptions' => $renderingOptions, 'placeholder' => $placeholder));
     $this->endRendering();
     return TemplateHelper::getRaw($rendered);
 }
 public function getSettingsHtml()
 {
     // If not set, create a default row
     if (!$this->_matrixBlockColors) {
         $this->_matrixBlockColors = array(array('blockType' => '', 'backgroundColor' => ''));
     }
     // Generate table
     $matrixBlockColorsTable = craft()->templates->renderMacro('_includes/forms', 'editableTableField', array(array('label' => Craft::t('Block Type Colors'), 'instructions' => Craft::t('Add background colors to your matrix block types'), 'id' => 'matrixBlockColors', 'name' => 'matrixBlockColors', 'cols' => array('blockType' => array('heading' => Craft::t('Block Type Handle'), 'type' => 'singleline'), 'backgroundColor' => array('heading' => Craft::t('CSS Background Color'), 'type' => 'singleline', 'class' => 'code')), 'rows' => $this->_matrixBlockColors, 'addRowLabel' => Craft::t('Add a block type color'))));
     // Output settings template
     return craft()->templates->render('matrixcolors/_settings', array('matrixBlockColorsTable' => TemplateHelper::getRaw($matrixBlockColorsTable)));
 }
 /**
  * I'm invisible, I don't need to show up on the front end
  * I do need to save my value to session to retrieve it via prepValueFromPost()
  * You should also know that prepValueFromPost() won't be called unless you:
  * - Set a hidden field to an empty value with my name
  *
  * @param FieldModel $field
  * @param mixed      $value
  * @param mixed      $settings
  * @param array|null $renderingOptions
  *
  * @return \Twig_Markup
  */
 public function getInputHtml($field, $value, $settings, array $renderingOptions = null)
 {
     try {
         $value = craft()->templates->renderObjectTemplate($settings['value'], parent::getFieldVariables());
     } catch (\Exception $e) {
         SproutInvisibleFieldPlugin::log($e->getMessage());
     }
     craft()->httpSession->add($field->handle, $value);
     // We really don't need the extra processing that it takes to render a template
     return TemplateHelper::getRaw(sprintf('<input type="hidden" name="%s" />', $field->handle));
 }
 public function staticMap($data, $options = array())
 {
     if ($data instanceof GoogleMaps_MapDataModel) {
         $model = $data->getStaticMapModel($options);
         return TemplateHelper::getRaw(craft()->googleMaps_staticMap->image($model, $options));
     } else {
         $options = array_merge($options, $data);
         $model = GoogleMaps_StaticMapModel::populateModel($options);
         return TemplateHelper::getRaw(craft()->googleMaps_staticMap->image($model, $options));
     }
 }
Exemple #11
0
 /**
  * @param FieldModel $field
  * @param mixed      $value
  * @param mixed      $settings
  * @param array|null $renderingOptions
  *
  * @return \Twig_Markup
  */
 public function getInputHtml($field, $value, $settings, array $renderingOptions = null)
 {
     $this->beginRendering();
     $name = $field->handle;
     $namespaceInputId = $this->getNamespace() . '-' . $name;
     $selectedStyle = $settings['style'];
     $pluginSettings = craft()->plugins->getPlugin('sproutfields')->getSettings()->getAttributes();
     $selectedStyleCss = str_replace("{{ name }}", $name, $pluginSettings[$selectedStyle]);
     $rendered = craft()->templates->render('notes/input', array('settings' => $settings, 'selectedStyleCss' => $selectedStyleCss));
     $this->endRendering();
     return TemplateHelper::getRaw($rendered);
 }
 /**
  * @param FieldModel $field
  * @param mixed      $value
  * @param mixed      $settings
  * @param array|null $renderingOptions
  *
  * @return \Twig_Markup
  */
 public function getInputHtml($field, $value, $settings, array $renderingOptions = null)
 {
     $this->beginRendering();
     try {
         $value = craft()->templates->renderObjectTemplate($settings['value'], parent::getFieldVariables());
     } catch (\Exception $e) {
         SproutFieldsPlugin::log($e->getMessage(), LogLevel::Error);
     }
     $rendered = craft()->templates->render('hidden/input', array('name' => $field->handle, 'value' => $value, 'field' => $field, 'renderingOptions' => $renderingOptions));
     $this->endRendering();
     return TemplateHelper::getRaw($rendered);
 }
Exemple #13
0
 /**
  * @param FieldModel $field
  * @param mixed      $value
  * @param mixed      $settings
  * @param array|null $renderingOptions
  *
  * @return \Twig_Markup
  */
 public function getInputHtml($field, $value, $settings, array $renderingOptions = null)
 {
     $this->beginRendering();
     $name = $field->handle;
     $namespaceInputId = $this->getNamespace() . '-' . $name;
     $pattern = craft()->sproutFields_phoneField->convertMaskToRegEx($settings['mask']);
     $pattern = trim($pattern, '/');
     $attributes = $field->getAttributes();
     $errorMessage = craft()->sproutFields_phoneField->getErrorMessage($attributes['name'], $settings);
     $rendered = craft()->templates->render('phone/input', array('name' => $name, 'value' => $value, 'settings' => $settings, 'field' => $field, 'pattern' => $pattern, 'errorMessage' => $errorMessage, 'namespaceInputId' => $namespaceInputId, 'renderingOptions' => $renderingOptions));
     $this->endRendering();
     return TemplateHelper::getRaw($rendered);
 }
Exemple #14
0
 /**
  * Смена темы:
  */
 public function switchAction(Application $application, Template $template)
 {
     $session = Session::getInstance();
     if ($_GET['theme'] == 'normal') {
         $session->persistenceSet('global_theme', false);
     } else {
         if (is_file(VIEWS_DIR . '/layout_' . str_replace('/', '', $_GET['theme']) . '.php')) {
             $session->persistenceSet('global_theme', 'layout_' . $_GET['theme']);
         }
     }
     $template->headerSeeOther('http://' . TemplateHelper::getSiteUrl() . '/');
     return false;
 }
 /**
  * @param string $url
  * @param int    $limit
  * @param int    $offset
  * @param null   $cacheDuration
  *
  * @return array
  */
 public function getFeedItems($url, $limit = 0, $offset = 0, $cacheDuration = null)
 {
     $limit = NumberHelper::makeNumeric($limit);
     $offset = NumberHelper::makeNumeric($offset);
     $items = craft()->feeds->getFeedItems($url, $limit, $offset, $cacheDuration);
     // Prevent everyone from having to use the |raw filter when outputting the title and content
     $rawProperties = array('title', 'content', 'summary');
     foreach ($items as &$item) {
         foreach ($rawProperties as $prop) {
             $item[$prop] = TemplateHelper::getRaw($item[$prop]);
         }
     }
     return $items;
 }
 public function getSettingsHtml()
 {
     // If Craft Pro
     if (craft()->getEdition() == Craft::Pro) {
         $options = array();
         $userGroups = craft()->userGroups->getAllGroups();
         foreach ($userGroups as $group) {
             $options[] = array('label' => $group->name, 'value' => $group->id);
         }
         $checkboxes = craft()->templates->render('_includes/forms/checkboxGroup', array('name' => 'userGroups', 'options' => $options, 'values' => $this->getSettings()->userGroups));
         $noGroups = '<p class="error">No user groups exist. <a href="' . UrlHelper::getCpUrl('settings/users/groups/new') . '">Create one now...</a></p>';
         craft()->templates->includeCssResource('autoassignusergroup/css/settings.css');
         return craft()->templates->render('autoassignusergroup/_settings', array('userGroupsField' => TemplateHelper::getRaw(count($userGroups) ? $checkboxes : $noGroups)));
     } else {
         craft()->templates->includeJs('$(".btn.submit").val("Continue");');
         $output = '<h2>Craft Upgrade Required</h2>';
         $output .= '<p>In order to use this plugin, Craft Pro is required.</p>';
         return craft()->templates->renderString($output);
     }
 }
 /**
  * Parses source markdown into valid html using various rules and parsers
  *
  * @param string $source  The markdown source to parse
  * @param array  $options Passed in parameters via a template filter call
  *
  * @return \Twig_Markup|DoxterModel The parsed content flagged as safe to output
  */
 public function parse($source, array $options = array())
 {
     if ($source instanceof DoxterModel) {
         return $source;
     }
     $codeBlockSnippet = null;
     $addHeaderAnchors = true;
     $addHeaderAnchorsTo = array('h1', 'h2', 'h3');
     $addTypographyStyles = true;
     $startingHeaderLevel = 1;
     $parseReferenceTags = true;
     $parseShortcodes = true;
     $options = array_merge(craft()->plugins->getPlugin('doxter')->getSettings()->getAttributes(), $options);
     extract($options);
     // Parsing reference tags first so that we can parse markdown within them
     if ($parseReferenceTags) {
         if ($this->onBeforeReferenceTagParsing(compact('source', 'options'))) {
             $source = $this->parseReferenceTags($source, $options);
         }
     }
     if ($parseShortcodes) {
         if ($this->onBeforeShortcodeParsing(compact('source'))) {
             $source = $this->parseShortcodes($source);
         }
     }
     if ($this->onBeforeMarkdownParsing(compact('source'))) {
         $source = $this->parseMarkdown($source);
     }
     if ($this->onBeforeCodeBlockParsing(compact('source', 'codeBlockSnippet'))) {
         $source = $this->parseCodeBlocks($source, compact('codeBlockSnippet'));
     }
     if ($addHeaderAnchors) {
         if ($this->onBeforeHeaderParsing(compact('source', 'addHeaderAnchorsTo'))) {
             $source = $this->parseHeaders($source, compact('addHeaderAnchorsTo', 'startingHeaderLevel'));
         }
     }
     if ($addTypographyStyles) {
         $source = $this->addTypographyStyles($source, $options);
     }
     return TemplateHelper::getRaw($source);
 }
 protected function injector($text, $class = 'chars', $after = '')
 {
     switch ($class) {
         case 'words':
             $parts = explode(' ', trim(strip_tags($text)));
             break;
         case 'lines':
             $parts = preg_split('/<br[^>]*>/i', strip_tags(nl2br(trim($text)), '<br>'));
             break;
         default:
             $parts = str_split(trim(strip_tags($text)));
             break;
     }
     $count = 1;
     $formattedParts = array_map(function ($part) use(&$count, $class, $after) {
         $part = '<span class="' . substr($class, 0, -1) . $count . '" aria-hidden="true">' . $part . '</span>' . $after;
         $count = $count + 1;
         return $part;
     }, $parts);
     $ariaLabel = TemplateHelper::getRaw(' aria-label="' . trim(strip_tags($text)) . '"');
     $joined = TemplateHelper::getRaw(implode('', $formattedParts));
     $result = ['original' => $text, 'ariaLabel' => $ariaLabel, $class => $joined];
     return $result;
 }
 /**
  * Upload new file.
  *
  * @param   string  $file      The name of the file.
  * @param   string  $location  Location for the new file.
  *
  * @return   boolean  True if file uploaded successfully, false otherwise
  *
  * @since   3.2
  */
 public function uploadFile($file, $location)
 {
     jimport('joomla.filesystem.folder');
     if ($template = $this->getTemplate()) {
         $app = JFactory::getApplication();
         $client = JApplicationHelper::getClientInfo($template->client_id);
         $path = JPath::clean($client->path . '/templates/' . $template->element . '/');
         $fileName = JFile::makeSafe($file['name']);
         $err = null;
         JLoader::register('TemplateHelper', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/template.php');
         if (!TemplateHelper::canUpload($file, $err)) {
             // Can't upload the file
             return false;
         }
         if (file_exists(JPath::clean($path . '/' . $location . '/' . $file['name']))) {
             $app->enqueueMessage(JText::_('COM_TEMPLATES_FILE_EXISTS'), 'error');
             return false;
         }
         if (!JFile::upload($file['tmp_name'], JPath::clean($path . '/' . $location . '/' . $fileName))) {
             $app->enqueueMessage(JText::_('COM_TEMPLATES_FILE_UPLOAD_ERROR'), 'error');
             return false;
         }
         $url = JPath::clean($location . '/' . $fileName);
         return $url;
     }
 }
Exemple #20
0
    }
    ?>
" /> <img src="http://<?php 
    echo TemplateHelper::getSiteUrl();
    ?>
/ico/key.gif" width="16" height="16" alt="" class="js-key-icon<?php 
    if (empty($room['password'])) {
        ?>
 g-hidden<?php 
    }
    ?>
"/>
							</div>
							<div class="b-chat-rooms_b-room_b-info">
								<em><?php 
    echo TemplateHelper::ending(Chat_ChatRoomsModel::GetRoomOnline($room['room_id']), 'участник', 'участника', 'участников');
    ?>
</em>
							</div>
							<div class="b-chat-rooms_b-room_b-description">
								<p><?php 
    echo $room['description'];
    ?>
</p>
							</div>
						</div>
						<?php 
}
?>

					</div>
 /**
  * Preps the field value for use.
  *
  * @param mixed $value
  * @return mixed
  */
 public function prepValue($value)
 {
     if (is_array($value)) {
         // Get Defaults
         $defaults = $this->getLinkitValueDefaults();
         // Settings
         $settings = $this->getSettings();
         // Merge With Defaults
         $value = array_merge($defaults, $value);
         // Process?
         if ($value['type'] == '') {
             $value = false;
         } else {
             // Process Entry Field - Criteria
             // TODO - Should I Be Using the craft()->entries->getEntryById( $entryId )
             $entryCriteria = craft()->elements->getCriteria(ElementType::Entry);
             if ($value['entry'] && $value['type'] == 'entry') {
                 if (is_array($value['entry'])) {
                     $entryCriteria->id = array_values(array_filter($value['entry']));
                 } else {
                     $entryCriteria->id = false;
                 }
             } else {
                 $entryCriteria->id = false;
             }
             $entryCriteria->locale = $this->getTargetLocale('Entry');
             $value['entryCriteria'] = $entryCriteria;
             // Process Asset Field - Criteria
             $assetCriteria = craft()->elements->getCriteria(ElementType::Asset);
             if ($value['asset'] && $value['type'] == 'asset') {
                 if (is_array($value['asset'])) {
                     $assetCriteria->id = array_values(array_filter($value['asset']));
                 } else {
                     $assetCriteria->id = false;
                 }
             } else {
                 $assetCriteria->id = false;
             }
             $assetCriteria->locale = $this->getTargetLocale('Asset');
             $value['assetCriteria'] = $assetCriteria;
             // Process Category Field - Criteria
             $categoryCriteria = craft()->elements->getCriteria(ElementType::Category);
             if ($value['category'] && $value['type'] == 'category') {
                 if (is_array($value['category'])) {
                     $categoryCriteria->id = array_values(array_filter($value['category']));
                 } else {
                     $categoryCriteria->id = false;
                 }
             } else {
                 $categoryCriteria->id = false;
             }
             $categoryCriteria->locale = $this->getTargetLocale('Category');
             $value['categoryCriteria'] = $categoryCriteria;
             /*
             Alternate Version Added from BaseElementFieldType - Do we need all this?
             
             $entryCriteria = craft()->elements->getCriteria(ElementType::Entry);
             $entryCriteria->locale = $this->getEntryTargetLocale();
             $entryCriteria->limit = null;
             
             if($value['entry'])
             {
             	// $value will be an array of element IDs if there was a validation error
             	// or we're loading a draft/version.
             	if (is_array($value['entry']))
             	{
             		$entryCriteria->id = array_values(array_filter($value['entry']));
             		$entryCriteria->fixedOrder = true;
             	}
             	else if ($value['entry'] === '')
             	{
             		$entryCriteria->id = false;
             	}
             	else if (isset($this->element) && $this->element->id)
             	{
             		$entryCriteria->relatedTo = array(
             			'sourceElement' => $this->element->id,
             			'sourceLocale'  => $this->element->locale,
             			'field'         => $this->model->id
             		);
             
             		if ($this->sortable)
             		{
             			$entryCriteria->order = 'sortOrder';
             		}
             	}
             	else
             	{
             		$entryCriteria->id = false;
             	}
             }
             else
             {
             	$entryCriteria->id = false;
             }
             $value['criteria'] = $entryCriteria;			
             */
             // Set default link text?
             $linkText = $settings['defaultText'] != '' && $value['text'] == '' ? $settings['defaultText'] : $value['text'];
             // Define Links, URL & Link Text Per Type
             switch ($value['type']) {
                 case 'email':
                     $value['url'] = $value['email'] ? 'mailto:' . $value['email'] : false;
                     $value['linkText'] = $linkText ? $linkText : $value['email'];
                     break;
                 case 'tel':
                     $value['url'] = $value['tel'] ? 'tel:' . $value['tel'] : false;
                     $value['linkText'] = $linkText ? $linkText : $value['tel'];
                     break;
                 case 'custom':
                     $value['url'] = $value['custom'] ? $value['custom'] : false;
                     $value['linkText'] = $linkText ? $linkText : $value['custom'];
                     break;
                 case 'entry':
                     if ($entryCriteria->first()) {
                         $value['entry'] = $entryCriteria->first();
                         $value['url'] = $entryCriteria->first()->getUrl();
                         $value['linkText'] = $linkText ? $linkText : $entryCriteria->first()->title;
                     } else {
                         $value['entry'] = false;
                         $value['url'] = false;
                         $value['linkText'] = $linkText ? $linkText : '';
                     }
                     break;
                 case 'asset':
                     if ($assetCriteria->first()) {
                         $value['asset'] = $assetCriteria->first();
                         $value['url'] = $assetCriteria->first()->getUrl();
                         $value['linkText'] = $linkText ? $linkText : $assetCriteria->first()->title;
                     } else {
                         $value['asset'] = false;
                         $value['url'] = false;
                         $value['linkText'] = $linkText ? $linkText : '';
                     }
                     break;
                 case 'category':
                     if ($categoryCriteria->first()) {
                         $value['category'] = $categoryCriteria->first();
                         $value['url'] = $categoryCriteria->first()->getUrl();
                         $value['linkText'] = $linkText ? $linkText : $categoryCriteria->first()->title;
                     } else {
                         $value['category'] = false;
                         $value['url'] = false;
                         $value['linkText'] = $linkText ? $linkText : '';
                     }
                     break;
             }
             // Set Unused Link Types To false
             $value['email'] = $value['type'] == 'email' ? $value['email'] : false;
             $value['custom'] = $value['type'] == 'custom' ? $value['custom'] : false;
             $value['tel'] = $value['type'] == 'tel' ? $value['tel'] : false;
             $value['entry'] = $value['type'] == 'entry' ? $value['entry'] : false;
             $value['asset'] = $value['type'] == 'asset' ? $value['asset'] : false;
             $value['category'] = $value['type'] == 'category' ? $value['category'] : false;
             // Set Target
             $value['target'] = $value['target'] == '1' ? '_blank' : false;
             // Build The Link
             $value['link'] = $value['url'] ? TemplateHelper::getRaw('<a href="' . $value['url'] . '"' . ($value['target'] ? ' target="' . $value['target'] . '"' : '') . ' title="' . $value['linkText'] . '">' . $value['linkText'] . '</a>') : false;
         }
     }
     return $value;
 }
Exemple #22
0
					<input type="hidden" name="referer" value="<?php 
echo $this->getParameter('referer');
?>
" />
						<div class="b-blog-form_b-form_b-field">
							<h2>Обратный тест тьюринга:</h2>
							<input type="hidden" name="captcha_key" value="<?php 
echo $this->getParameter('captcha_key');
?>
" />
							<p>
								Для продолжения введите символы, изображенные на картинке.
							</p>
							<p>
								<img src="http://<?php 
echo TemplateHelper::getSiteUrl();
?>
/captcha/?key=<?php 
echo $this->getParameter('captcha_key');
?>
&<?php 
echo session_name();
?>
=<?php 
echo session_id();
?>
">
								<input type="text" name="captcha" value=""<?php 
if ($this->getParameter('captcha_err')) {
    ?>
 class="g-input-error"<?php 
Exemple #23
0
 /**
  * Returns an <img> tag based on this asset.
  *
  * @return \Twig_Markup|null
  */
 public function getImg()
 {
     if ($this->kind == 'image') {
         $img = '<img src="' . $this->url . '" width="' . $this->getWidth() . '" height="' . $this->getHeight() . '" alt="' . HtmlHelper::encode($this->title) . '" />';
         return TemplateHelper::getRaw($img);
     }
 }
 public function renderJSONLD($object = array())
 {
     $result = craft()->seomatic->renderJSONLD($object);
     return TemplateHelper::getRaw(rtrim($result));
 }
Exemple #25
0
 /**
  * Finish importing.
  *
  * @param array  $settings
  * @param string $backup
  */
 public function finish($settings, $backup)
 {
     craft()->import_history->end($settings['history'], ImportModel::StatusFinished);
     if ($settings['email']) {
         // Gather results
         $results = array('success' => $settings['rows'], 'errors' => array());
         // Gather errors
         foreach ($this->log as $line => $result) {
             $results['errors'][$line] = $result;
         }
         // Recalculate successful results
         $results['success'] -= count($results['errors']);
         // Prepare the mail
         $email = new EmailModel();
         $emailSettings = craft()->email->getSettings();
         $email->toEmail = $emailSettings['emailAddress'];
         // Get current user
         $currentUser = craft()->userSession->getUser();
         // Zip the backup
         if ($currentUser->can('backup') && $settings['backup'] && IOHelper::fileExists($backup)) {
             $destZip = craft()->path->getTempPath() . IOHelper::getFileName($backup, false) . '.zip';
             if (IOHelper::fileExists($destZip)) {
                 IOHelper::deleteFile($destZip, true);
             }
             IOHelper::createFile($destZip);
             if (Zip::add($destZip, $backup, craft()->path->getDbBackupPath())) {
                 $backup = $destZip;
             }
         }
         // Set email content
         $email->subject = Craft::t('The import task is finished');
         $email->htmlBody = TemplateHelper::getRaw(craft()->templates->render('import/_email', array('results' => $results, 'backup' => $backup)));
         // Send it
         craft()->email->sendEmail($email);
     }
 }
 /**
  * Returns getFootHtml() wrapped in a \Twig_Markup object.
  *
  * @return \Twig_Markup
  */
 public function getFootHtmlFunction()
 {
     $html = craft()->templates->getFootHtml();
     return TemplateHelper::getRaw($html);
 }
 /**
  * Returns an anchor pre-filled with this element's URL and title.
  *
  * @return \Twig_Markup
  */
 public function getLink()
 {
     $link = '<a href="' . $this->getUrl() . '">' . HtmlHelper::encode($this->__toString()) . '</a>';
     return TemplateHelper::getRaw($link);
 }
 /**
  * Sends a password reset email to a user.
  *
  * A new verification code will generated for the user overwriting any existing one.
  *
  * @param UserModel $user The user to send the forgot password email to.
  *
  * @return bool Whether the email was sent successfully.
  */
 public function sendPasswordResetEmail(UserModel $user)
 {
     $url = $this->getPasswordResetUrl($user);
     return craft()->email->sendEmailByKey($user, 'forgot_password', array('link' => TemplateHelper::getRaw($url)));
 }
Exemple #29
0
                <?php 
if (isset($room)) {
    ?>
				<div class="b-chat" id="room_<?php 
    echo $room['room_id'];
    ?>
">
					<div class="b-chat_b-header">
						<div class="b-chat_b-header_b-title js-room-title"><?php 
    echo $room['title'];
    ?>
</div>
						<div class="b-chat_b-header_b-statistics js-room-statistics"><?php 
    $count = Chat_ChatRoomsModel::GetRoomOnline($room['room_id']);
    echo TemplateHelper::ending($count == 0 ? 1 : $count, 'участник', 'участника', 'участников');
    ?>
</div>
					</div>
					<div class="b-chat_b-messages g-clearfix">
					
					<textarea id="template_message_password" style="display:none">
						<div class="b-chat_b-message m-info">
							<div class="b-chat_b-message_b-body">
							<form action="" method="post" id="password_form">
								<p>
									Для входа в комнату необходимо ввести пароль: <input type="text" class="js-room-password" value="" /> <input type="submit" value="Вход" />
								</p>
							</form>
							</div>
						</div>
 /**
  * Renders the recipient list UI for this mailer
  *
  * @param SproutEmail_EntryModel[] $values
  *
  * @return string|\Twig_Markup
  */
 public function getRecipientListsHtml(array $values = null)
 {
     $lists = $this->getRecipientLists();
     $options = array();
     $selected = array();
     if (!count($lists)) {
         return craft()->templates->render('sproutemail/settings/_defaultmailer-norecipients');
     }
     foreach ($lists as $list) {
         $options[] = array('label' => $list->name, 'value' => $list->id);
     }
     if (is_array($values) && count($values)) {
         foreach ($values as $value) {
             $selected[] = $value->list;
         }
     }
     $html = craft()->templates->renderMacro('_includes/forms', 'checkboxGroup', array(array('id' => 'recipientLists', 'name' => 'recipient[recipientLists]', 'options' => $options, 'values' => $selected)));
     return TemplateHelper::getRaw($html);
 }