Merge branch 'ticket-10296' into develop
This commit is contained in:
commit
40457d1935
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
require_once('../../config/config.inc.php');
|
||||
require_once('../privatesales/Sale.php');
|
||||
require_once('html2text.php');
|
||||
|
||||
if (!defined('_PS_BASE_URL_'))
|
||||
define('_PS_BASE_URL_', Tools::getShopDomain(true));
|
||||
@ -21,12 +22,12 @@ class Catalog
|
||||
|
||||
public function __construct() {
|
||||
$this->_xml ="";
|
||||
$this->versions = array(
|
||||
$this->versions = array(
|
||||
'es' => 3,
|
||||
'fr' => 2
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function setContent($version = 'fr')
|
||||
{
|
||||
$sales_today = array();
|
||||
@ -40,10 +41,10 @@ class Catalog
|
||||
|
||||
foreach ($sales_today as &$sale) {
|
||||
$sql = '
|
||||
SELECT `value`
|
||||
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale`
|
||||
SELECT `value`
|
||||
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale`
|
||||
WHERE `id_field` = '.(int) self::FIELD_EXTRA .'
|
||||
AND `id_lang` = '.(int) $id_lang.'
|
||||
AND `id_lang` = '.(int) $id_lang.'
|
||||
AND id_sale = '.(int) $sale->id
|
||||
;
|
||||
|
||||
@ -52,13 +53,15 @@ class Catalog
|
||||
} else {
|
||||
$sale->reduction = 'Non défini';
|
||||
}
|
||||
$desc = new html2text($sale->description[(int) $id_lang]);
|
||||
$sale->description[(int) $id_lang] = $desc->get_text();
|
||||
}
|
||||
foreach ($sales_last_day as &$sale) {
|
||||
$sql = '
|
||||
SELECT `value`
|
||||
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale`
|
||||
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale`
|
||||
WHERE `id_field` = '.(int) self::FIELD_EXTRA .'
|
||||
AND `id_lang` ='.(int) $id_lang.'
|
||||
AND `id_lang` ='.(int) $id_lang.'
|
||||
AND `id_sale` ='.(int) $sale->id
|
||||
;
|
||||
if ($value = Db::getInstance()->getValue($sql)) {
|
||||
@ -66,13 +69,15 @@ class Catalog
|
||||
} else {
|
||||
$sale->reduction = 'Non défini';
|
||||
}
|
||||
$desc = new html2text($sale->description[(int) $id_lang]);
|
||||
$sale->description[(int) $id_lang] = $desc->get_text();
|
||||
}
|
||||
foreach ($sale_current as &$sale) {
|
||||
$sql = '
|
||||
SELECT `value`
|
||||
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale`
|
||||
WHERE `id_field` = '.(int) self::FIELD_EXTRA .'
|
||||
AND `id_lang` = '.(int) $id_lang.'
|
||||
WHERE `id_field` = '.(int) self::FIELD_EXTRA .'
|
||||
AND `id_lang` = '.(int) $id_lang.'
|
||||
AND `id_sale` = ' . (int) $sale->id
|
||||
;
|
||||
if ($value = Db::getInstance()->getValue($sql)) {
|
||||
@ -80,13 +85,15 @@ class Catalog
|
||||
} else {
|
||||
$sale->reduction = 'Non défini';
|
||||
}
|
||||
$desc = new html2text($sale->description[(int) $id_lang]);
|
||||
$sale->description[(int) $id_lang] = $desc->get_text();
|
||||
}
|
||||
|
||||
$this->setXml($sales_today, $sales_last_day, $sale_current, false, $version);
|
||||
}
|
||||
|
||||
|
||||
public function displayContent()
|
||||
|
||||
public function displayContent()
|
||||
{
|
||||
foreach ($this->versions as $version => $id_lang) {
|
||||
$this->setContent($version);
|
||||
@ -110,7 +117,7 @@ class Catalog
|
||||
$this->_xml .= '<link>www.bebeboutik.es</link>';
|
||||
$this->_xml .= '<description>Bebeboutik.es</description>';
|
||||
$this->_xml .= '<logo>http://www.bebeboutik.es/img/logo_3.png</logo>';
|
||||
|
||||
|
||||
$title_sunday = Configuration::get('TITLE_NEWS_DIMANCHE_ES');
|
||||
$link_sale = 'http://www.bebeboutik.es';
|
||||
} else {
|
||||
@ -122,14 +129,14 @@ class Catalog
|
||||
$this->_xml .= '<link>www.bebeboutik.com</link>';
|
||||
$this->_xml .= '<description>Bebeboutik.com</description>';
|
||||
$this->_xml .= '<logo>http://www.bebeboutik.com/img/logo.png</logo>';
|
||||
|
||||
|
||||
$title_sunday = Configuration::get('TITLE_NEWS_DIMANCHE');
|
||||
$link_sale = 'http://www.bebeboutik.com';
|
||||
}
|
||||
|
||||
|
||||
$sql_title = '
|
||||
SELECT `title`, `preheader`
|
||||
FROM `ps_privatesale_newsletter`
|
||||
FROM `ps_privatesale_newsletter`
|
||||
WHERE `date_pub` = CURDATE()
|
||||
AND `version` = "'.$version.'"'
|
||||
;
|
||||
@ -151,15 +158,15 @@ class Catalog
|
||||
$sale_link = $link->getCategoryLink($category->id, $category->link_rewrite[(int) $id_lang]);
|
||||
$this->_xml.='<sect_01>';
|
||||
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]>|<![CDATA['.$item->reduction.']]></title>';
|
||||
$this->_xml .= '<description><![CDATA['.$item->description[(int) $id_lang].']]></description>';
|
||||
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
|
||||
$this->_xml .= '<description><![CDATA['.$item->description[(int) $id_lang].']]></description>';
|
||||
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
|
||||
$this->_xml .= '<link>'.$link_sale.'</link>';
|
||||
$this->_xml .= '<reduction><![CDATA['.$item->reduction.']]></reduction>';
|
||||
$this->_xml .= '<image>';
|
||||
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]></title>';
|
||||
$this->_xml .= '<url>http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg</url>';
|
||||
$this->_xml .= '</image>';
|
||||
|
||||
|
||||
$this->_xml.='</sect_01>';
|
||||
}
|
||||
foreach ($sales_last_day as $item) {
|
||||
@ -168,30 +175,30 @@ class Catalog
|
||||
$sale_link = $link->getCategoryLink($category->id, $category->link_rewrite[(int) $id_lang]);
|
||||
|
||||
$sql = '
|
||||
SELECT `value`
|
||||
SELECT `value`
|
||||
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale`
|
||||
WHERE `id_field` = 1
|
||||
AND `id_lang` = '.(int) $id_lang.'
|
||||
WHERE `id_field` = 1
|
||||
AND `id_lang` = '.(int) $id_lang.'
|
||||
AND `id_sale` = '.(int) $item->id
|
||||
;
|
||||
if ($value = Db::getInstance()->getValue($sql)) {
|
||||
$item->small_title = $value;
|
||||
} else {
|
||||
$item->small_title = 'Non défini';
|
||||
$item->small_title = 'Non défini';
|
||||
}
|
||||
|
||||
|
||||
$this->_xml.='<sect_02>';
|
||||
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]>|<![CDATA['.$item->reduction.']]></title>';
|
||||
$this->_xml .= '<description><![CDATA['.$item->small_title.']]></description>';
|
||||
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
|
||||
$this->_xml .= '<link>'.$link_sale.'</link>';
|
||||
$this->_xml .= '<description><![CDATA['.$item->small_title.']]></description>';
|
||||
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
|
||||
$this->_xml .= '<link>'.$link_sale.'</link>';
|
||||
$this->_xml .= '<reduction><![CDATA['.$item->reduction.']]></reduction>';
|
||||
$this->_xml .= '<image>';
|
||||
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]></title>';
|
||||
$this->_xml .= '<url>http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg</url>';
|
||||
$this->_xml .= '</image>';
|
||||
|
||||
$this->_xml .= '</image>';
|
||||
|
||||
$this->_xml.='</sect_02>';
|
||||
}
|
||||
|
||||
@ -201,10 +208,10 @@ class Catalog
|
||||
$sale_link = $link->getCategoryLink($category->id, $category->link_rewrite[(int) $id_lang]);
|
||||
|
||||
$sql = '
|
||||
SELECT `value`
|
||||
SELECT `value`
|
||||
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale`
|
||||
WHERE `id_field` = 1
|
||||
AND `id_lang` = '.(int) $id_lang.'
|
||||
WHERE `id_field` = 1
|
||||
AND `id_lang` = '.(int) $id_lang.'
|
||||
AND `id_sale` = '. (int)$item->id
|
||||
;
|
||||
if ($value = Db::getInstance()->getValue($sql)) {
|
||||
@ -215,15 +222,15 @@ class Catalog
|
||||
|
||||
$this->_xml.='<sect_04>';
|
||||
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]>|<![CDATA['.$item->reduction.']]></title>';
|
||||
$this->_xml .= '<description><![CDATA['.$item->small_title.']]></description>';
|
||||
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
|
||||
$this->_xml .= '<description><![CDATA['.$item->small_title.']]></description>';
|
||||
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
|
||||
$this->_xml .= '<link>'.$link_sale.'</link>';
|
||||
$this->_xml .= '<reduction><![CDATA['.$item->reduction.']]></reduction>';
|
||||
$this->_xml .= '<image>';
|
||||
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]></title>';
|
||||
$this->_xml .= '<url>http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg</url>';
|
||||
$this->_xml .= '</image>';
|
||||
|
||||
|
||||
$this->_xml.='</sect_04>';
|
||||
}
|
||||
|
||||
@ -235,26 +242,26 @@ class Catalog
|
||||
$this->_xml.='<sect_03>';
|
||||
// $this->_xml .= '<id_vente>'.$item->id.'</id_vente>';
|
||||
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]>|<![CDATA['.$item->reduction.']]></title>';
|
||||
$this->_xml .= '<description><![CDATA['.$item->description[(int) $id_lang].']]></description>';
|
||||
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
|
||||
$this->_xml .= '<description><![CDATA['.$item->description[(int) $id_lang].']]></description>';
|
||||
$this->_xml .= '<category><![CDATA['.$category->name[(int) $id_lang].']]></category>';
|
||||
$this->_xml .= '<link>'.$link_sale.'</link>';
|
||||
$this->_xml .= '<reduction><![CDATA['.$item->reduction.']]></reduction>';
|
||||
$this->_xml .= '<image>';
|
||||
$this->_xml .= '<title><![CDATA['.$item->title[(int) $id_lang].']]></title>';
|
||||
$this->_xml .= '<url>http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg</url>';
|
||||
$this->_xml .= '</image>';
|
||||
|
||||
$this->_xml .= '</image>';
|
||||
|
||||
$this->_xml.='</sect_03>';
|
||||
}
|
||||
|
||||
$this->_xml .= '</channel>';
|
||||
$this->_xml .= '</rss>';
|
||||
|
||||
|
||||
fwrite($flux, $this->_xml);
|
||||
fclose($flux);
|
||||
fclose($flux);
|
||||
}
|
||||
|
||||
public static function getSales($enabled=NULL, $logout=NULL, $featured=NULL, $future=NULL, $lite=FALSE, $pub=FALSE, $order_by='`date_end` ASC', $limit=NULL, $sale_type=NULL, $site_version=FALSE)
|
||||
public static function getSales($enabled=NULL, $logout=NULL, $featured=NULL, $future=NULL, $lite=FALSE, $pub=FALSE, $order_by='`date_end` ASC', $limit=NULL, $sale_type=NULL, $site_version=FALSE)
|
||||
{
|
||||
$result = array();
|
||||
$where = array();
|
||||
@ -275,7 +282,7 @@ class Catalog
|
||||
$where[] = 'sv.`version` = "'.pSQL($site_version).'"';
|
||||
}
|
||||
|
||||
if($enabled !== NULL OR $logout !== NULL OR $featured !== NULL OR $future !== NULL) {
|
||||
if($enabled !== NULL OR $logout !== NULL OR $featured !== NULL OR $future !== NULL) {
|
||||
$enabled !== null? $where[] = '`enabled` = '.(int) $enabled: TRUE;
|
||||
$logout !== null? $where[] = '`logout` = '.(int) $logout: TRUE;
|
||||
$pub != FALSE? '': $where[] = '`public` = 0';
|
||||
@ -313,7 +320,7 @@ class Catalog
|
||||
if($limit !== NULL) {
|
||||
$query .= ' LIMIT '.$limit;
|
||||
}
|
||||
|
||||
|
||||
if($sales = Db::getInstance()->ExecuteS($query)) {
|
||||
if($lite) {
|
||||
foreach($sales AS $sale) {
|
||||
|
380
modules/emarsys_rss/html2text.php
Normal file
380
modules/emarsys_rss/html2text.php
Normal file
@ -0,0 +1,380 @@
|
||||
<?php
|
||||
|
||||
class html2text {
|
||||
/**
|
||||
* Contains the HTML content to convert.
|
||||
*
|
||||
* @var string $html
|
||||
* @access public
|
||||
*/
|
||||
var $html;
|
||||
|
||||
/**
|
||||
* Contains the converted, formatted text.
|
||||
*
|
||||
* @var string $text
|
||||
* @access public
|
||||
*/
|
||||
var $text;
|
||||
|
||||
/**
|
||||
* Maximum width of the formatted text, in columns.
|
||||
*
|
||||
* Set this value to 0 (or less) to ignore word wrapping
|
||||
* and not constrain text to a fixed-width column.
|
||||
*
|
||||
* @var integer $width
|
||||
* @access public
|
||||
*/
|
||||
var $width = 70;
|
||||
|
||||
/**
|
||||
* List of preg* regular expression patterns to search for,
|
||||
* used in conjunction with $replace.
|
||||
*
|
||||
* @var array $search
|
||||
* @access public
|
||||
* @see $replace
|
||||
*/
|
||||
var $search = array(
|
||||
"/\r/", // Non-legal carriage return
|
||||
"/[\n\t]+/", // Newlines and tabs
|
||||
'/[ ]{2,}/', // Runs of spaces, pre-handling
|
||||
'/<script[^>]*>.*?<\/script>/i', // <script>s -- which strip_tags supposedly has problems with
|
||||
'/<style[^>]*>.*?<\/style>/i', // <style>s -- which strip_tags supposedly has problems with
|
||||
//'/<!-- .* -->/', // Comments -- which strip_tags might have problem a with
|
||||
'/<h[123][^>]*>(.*?)<\/h[123]>/ie', // H1 - H3
|
||||
'/<h[456][^>]*>(.*?)<\/h[456]>/ie', // H4 - H6
|
||||
'/<p[^>]*>/i', // <P>
|
||||
'/<br[^>]*>/i', // <br>
|
||||
'/<b[^>]*>(.*?)<\/b>/ie', // <b>
|
||||
'/<strong[^>]*>(.*?)<\/strong>/ie', // <strong>
|
||||
'/<i[^>]*>(.*?)<\/i>/i', // <i>
|
||||
'/<em[^>]*>(.*?)<\/em>/i', // <em>
|
||||
'/(<ul[^>]*>|<\/ul>)/i', // <ul> and </ul>
|
||||
'/(<ol[^>]*>|<\/ol>)/i', // <ol> and </ol>
|
||||
'/<li[^>]*>(.*?)<\/li>/i', // <li> and </li>
|
||||
'/<li[^>]*>/i', // <li>
|
||||
'/<a [^>]*href="([^"]+)"[^>]*>(.*?)<\/a>/ie',
|
||||
// <a href="">
|
||||
'/<hr[^>]*>/i', // <hr>
|
||||
'/(<table[^>]*>|<\/table>)/i', // <table> and </table>
|
||||
'/(<tr[^>]*>|<\/tr>)/i', // <tr> and </tr>
|
||||
'/<td[^>]*>(.*?)<\/td>/i', // <td> and </td>
|
||||
'/<th[^>]*>(.*?)<\/th>/ie', // <th> and </th>
|
||||
'/&(nbsp|#160);/i', // Non-breaking space
|
||||
'/&(quot|rdquo|ldquo|#8220|#8221|#147|#148);/i',
|
||||
// Double quotes
|
||||
'/&(apos|rsquo|lsquo|#8216|#8217);/i', // Single quotes
|
||||
'/>/i', // Greater-than
|
||||
'/</i', // Less-than
|
||||
'/&(amp|#38);/i', // Ampersand
|
||||
'/&(copy|#169);/i', // Copyright
|
||||
'/&(trade|#8482|#153);/i', // Trademark
|
||||
'/&(reg|#174);/i', // Registered
|
||||
'/&(mdash|#151|#8212);/i', // mdash
|
||||
'/&(ndash|minus|#8211|#8722);/i', // ndash
|
||||
'/&(bull|#149|#8226);/i', // Bullet
|
||||
'/&(pound|#163);/i', // Pound sign
|
||||
'/&(euro|#8364);/i', // Euro sign
|
||||
'/&[^&;]+;/i', // Unknown/unhandled entities
|
||||
'/[ ]{2,}/' // Runs of spaces, post-handling
|
||||
);
|
||||
|
||||
/**
|
||||
* List of pattern replacements corresponding to patterns searched.
|
||||
*
|
||||
* @var array $replace
|
||||
* @access public
|
||||
* @see $search
|
||||
*/
|
||||
var $replace = array(
|
||||
'', // Non-legal carriage return
|
||||
' ', // Newlines and tabs
|
||||
' ', // Runs of spaces, pre-handling
|
||||
'', // <script>s -- which strip_tags supposedly has problems with
|
||||
'', // <style>s -- which strip_tags supposedly has problems with
|
||||
//'', // Comments -- which strip_tags might have problem a with
|
||||
"strtoupper(\"\n\n\\1\n\n\")", // H1 - H3
|
||||
"ucwords(\"\n\n\\1\n\n\")", // H4 - H6
|
||||
"\n\n\t", // <P>
|
||||
"\n", // <br>
|
||||
'strtoupper("\\1")', // <b>
|
||||
'strtoupper("\\1")', // <strong>
|
||||
'_\\1_', // <i>
|
||||
'_\\1_', // <em>
|
||||
"\n\n", // <ul> and </ul>
|
||||
"\n\n", // <ol> and </ol>
|
||||
"\t* \\1\n", // <li> and </li>
|
||||
"\n\t* ", // <li>
|
||||
'$this->_build_link_list("\\1", "\\2")',
|
||||
// <a href="">
|
||||
"\n-------------------------\n", // <hr>
|
||||
"\n\n", // <table> and </table>
|
||||
"\n", // <tr> and </tr>
|
||||
"\t\t\\1\n", // <td> and </td>
|
||||
"strtoupper(\"\t\t\\1\n\")", // <th> and </th>
|
||||
' ', // Non-breaking space
|
||||
'"', // Double quotes
|
||||
"'", // Single quotes
|
||||
'>',
|
||||
'<',
|
||||
'&',
|
||||
'(c)',
|
||||
'(tm)',
|
||||
'(R)',
|
||||
'--',
|
||||
'-',
|
||||
'*',
|
||||
'€',
|
||||
'EUR', // Euro sign. € ?
|
||||
'', // Unknown/unhandled entities
|
||||
' ' // Runs of spaces, post-handling
|
||||
);
|
||||
|
||||
/**
|
||||
* Contains a list of HTML tags to allow in the resulting text.
|
||||
*
|
||||
* @var string $allowed_tags
|
||||
* @access public
|
||||
* @see set_allowed_tags()
|
||||
*/
|
||||
var $allowed_tags = '';
|
||||
|
||||
/**
|
||||
* Contains the base URL that relative links should resolve to.
|
||||
*
|
||||
* @var string $url
|
||||
* @access public
|
||||
*/
|
||||
var $url;
|
||||
|
||||
/**
|
||||
* Indicates whether content in the $html variable has been converted yet.
|
||||
*
|
||||
* @var boolean $_converted
|
||||
* @access private
|
||||
* @see $html, $text
|
||||
*/
|
||||
var $_converted = false;
|
||||
|
||||
/**
|
||||
* Contains URL addresses from links to be rendered in plain text.
|
||||
*
|
||||
* @var string $_link_list
|
||||
* @access private
|
||||
* @see _build_link_list()
|
||||
*/
|
||||
var $_link_list = '';
|
||||
|
||||
/**
|
||||
* Number of valid links detected in the text, used for plain text
|
||||
* display (rendered similar to footnotes).
|
||||
*
|
||||
* @var integer $_link_count
|
||||
* @access private
|
||||
* @see _build_link_list()
|
||||
*/
|
||||
var $_link_count = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* If the HTML source string (or file) is supplied, the class
|
||||
* will instantiate with that source propagated, all that has
|
||||
* to be done it to call get_text().
|
||||
*
|
||||
* @param string $source HTML content
|
||||
* @param boolean $from_file Indicates $source is a file to pull content from
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function html2text( $source = '', $from_file = false )
|
||||
{
|
||||
if ( !empty($source) ) {
|
||||
$this->set_html($source, $from_file);
|
||||
}
|
||||
$this->set_base_url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads source HTML into memory, either from $source string or a file.
|
||||
*
|
||||
* @param string $source HTML content
|
||||
* @param boolean $from_file Indicates $source is a file to pull content from
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function set_html( $source, $from_file = false )
|
||||
{
|
||||
$this->html = $source;
|
||||
|
||||
if ( $from_file && file_exists($source) ) {
|
||||
$fp = fopen($source, 'r');
|
||||
$this->html = fread($fp, filesize($source));
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
$this->_converted = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the text, converted from HTML.
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
function get_text()
|
||||
{
|
||||
if ( !$this->_converted ) {
|
||||
$this->_convert();
|
||||
}
|
||||
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the text, converted from HTML.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function print_text()
|
||||
{
|
||||
print $this->get_text();
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias to print_text(), operates identically.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @see print_text()
|
||||
*/
|
||||
function p()
|
||||
{
|
||||
print $this->get_text();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the allowed HTML tags to pass through to the resulting text.
|
||||
*
|
||||
* Tags should be in the form "<p>", with no corresponding closing tag.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function set_allowed_tags( $allowed_tags = '' )
|
||||
{
|
||||
if ( !empty($allowed_tags) ) {
|
||||
$this->allowed_tags = $allowed_tags;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a base URL to handle relative links.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function set_base_url( $url = '' )
|
||||
{
|
||||
if ( empty($url) ) {
|
||||
if ( !empty($_SERVER['HTTP_HOST']) ) {
|
||||
$this->url = 'http://' . $_SERVER['HTTP_HOST'];
|
||||
} else {
|
||||
$this->url = '';
|
||||
}
|
||||
} else {
|
||||
// Strip any trailing slashes for consistency (relative
|
||||
// URLs may already start with a slash like "/file.html")
|
||||
if ( substr($url, -1) == '/' ) {
|
||||
$url = substr($url, 0, -1);
|
||||
}
|
||||
$this->url = $url;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Workhorse function that does actual conversion.
|
||||
*
|
||||
* First performs custom tag replacement specified by $search and
|
||||
* $replace arrays. Then strips any remaining HTML tags, reduces whitespace
|
||||
* and newlines to a readable format, and word wraps the text to
|
||||
* $width characters.
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
function _convert()
|
||||
{
|
||||
// Variables used for building the link list
|
||||
$this->_link_count = 0;
|
||||
$this->_link_list = '';
|
||||
|
||||
$text = trim(stripslashes($this->html));
|
||||
|
||||
// Run our defined search-and-replace
|
||||
$text = preg_replace($this->search, $this->replace, $text);
|
||||
|
||||
// Strip any other HTML tags
|
||||
$text = strip_tags($text, $this->allowed_tags);
|
||||
|
||||
// Bring down number of empty lines to 2 max
|
||||
$text = preg_replace("/\n\s+\n/", "\n\n", $text);
|
||||
$text = preg_replace("/[\n]{3,}/", "\n\n", $text);
|
||||
|
||||
// Add link list
|
||||
if ( !empty($this->_link_list) ) {
|
||||
$text .= "\n\nLinks:\n------\n" . $this->_link_list;
|
||||
}
|
||||
|
||||
// Wrap the text to a readable format
|
||||
// for PHP versions >= 4.0.2. Default width is 75
|
||||
// If width is 0 or less, don't wrap the text.
|
||||
if ( $this->width > 0 ) {
|
||||
$text = wordwrap($text, $this->width);
|
||||
}
|
||||
|
||||
$this->text = $text;
|
||||
|
||||
$this->_converted = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function called by preg_replace() on link replacement.
|
||||
*
|
||||
* Maintains an internal list of links to be displayed at the end of the
|
||||
* text, with numeric indices to the original point in the text they
|
||||
* appeared. Also makes an effort at identifying and handling absolute
|
||||
* and relative links.
|
||||
*
|
||||
* @param string $link URL of the link
|
||||
* @param string $display Part of the text to associate number with
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
function _build_link_list( $link, $display )
|
||||
{
|
||||
if ( substr($link, 0, 7) == 'http://' || substr($link, 0, 8) == 'https://' ||
|
||||
substr($link, 0, 7) == 'mailto:' ) {
|
||||
$this->_link_count++;
|
||||
$this->_link_list .= "[" . $this->_link_count . "] $link\n";
|
||||
$additional = ' [' . $this->_link_count . ']';
|
||||
} elseif ( substr($link, 0, 11) == 'javascript:' ) {
|
||||
// Don't count the link; ignore it
|
||||
$additional = '';
|
||||
// what about href="#anchor" ?
|
||||
} else {
|
||||
$this->_link_count++;
|
||||
$this->_link_list .= "[" . $this->_link_count . "] " . $this->url;
|
||||
if ( substr($link, 0, 1) != '/' ) {
|
||||
$this->_link_list .= '/';
|
||||
}
|
||||
$this->_link_list .= "$link\n";
|
||||
$additional = ' [' . $this->_link_count . ']';
|
||||
}
|
||||
|
||||
return $display . $additional;
|
||||
}
|
||||
}
|
@ -38,7 +38,7 @@
|
||||
$('.modalbox_shadow').fadeIn(100);
|
||||
$('.modalbox_login').fadeIn(250);
|
||||
});
|
||||
|
||||
|
||||
$('#create-account_form').submit(function(e){
|
||||
e.preventDefault();
|
||||
$('.modalbox_login').hide();
|
||||
@ -55,10 +55,10 @@
|
||||
{* Log in pop up *}
|
||||
{if !$cookie->isLogged() AND !$showtoguests}
|
||||
<div class="modalbox_shadow" style="display: none;"></div>
|
||||
<div class="modalbox_login" style="display: none;">
|
||||
<div class="modalbox_login" style="display: none;">
|
||||
<a class="close_button" title="{l s='fermer' mod='privatesales'}"></a>
|
||||
|
||||
|
||||
|
||||
|
||||
<form action="{$link->getPageLink('authentication.php', true)}" method="post" id="create-account_form" class="std">
|
||||
<fieldset>
|
||||
<h3>{l s='Join' mod='privatesales'}</h3>
|
||||
@ -110,7 +110,7 @@
|
||||
|
||||
<div class="modalbox_subscribe">
|
||||
<a class="close_button" title="{l s='fermer' mod='privatesales'}"></a>
|
||||
|
||||
|
||||
<form action="{$link->getPageLink('authentication.php', true)}" method="post" id="account-creation_form" class="std">
|
||||
<fieldset>
|
||||
<h3>{l s='Registered' mod='privatesales'}</h3>
|
||||
@ -169,7 +169,7 @@
|
||||
<span><sup>*</sup>{l s='Required field' mod='privatesales'}</span>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
{/if}
|
||||
@ -184,15 +184,15 @@
|
||||
<ul>{strip}{assign var=sales_index value=0}
|
||||
{foreach $sales as $sale name=sales}
|
||||
{if count(array_intersect($customer_groups, $sale->groups))>0}
|
||||
<li style="background:url('//static.bebeboutik.com{$path}img/{$sale->id}/liston_{$cookie->id_lang}.jpg') no-repeat;"
|
||||
<li style="background:url('//static.bebeboutik.com{$path}img/{$sale->id}/liston_{$cookie->id_lang}.jpg') no-repeat;"
|
||||
class="modalbox {if $sales_index > 4}{if ($sales_index + 2) % 3 == 0}first{/if}{else}{if ($sales_index) % 2 == 0}first{/if}{/if}"
|
||||
{if $cookie->isLogged() OR $showtoguests}
|
||||
onclick="window.location.href='{$link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang])|escape:'htmlall':'UTF-8'}';"
|
||||
{/if}>
|
||||
{*<a href="{$link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang])|escape:'htmlall':'UTF-8'}"><img class="background" alt="{$sale->title[$cookie->id_lang]}" src="{$path}img/{$sale->id}/liston_{$cookie->id_lang}.jpg" /></a>*}
|
||||
|
||||
|
||||
{include file="./themes/site/delay.tpl" delivery_delay=$sale->delivery_delay}
|
||||
|
||||
|
||||
<div class="short_desc">
|
||||
<h3>{$sale->title[$cookie->id_lang]}</h3>
|
||||
{if isset($extrafields[$sale->id])}
|
||||
@ -200,7 +200,7 @@
|
||||
{/if}
|
||||
<div style="clear:both;"></div>
|
||||
<div class="border-bottom"></div>
|
||||
<div class="show_desc">{$sale->description[$cookie->id_lang]|truncate:165:'...'|escape:'htmlall':'UTF-8'}</div>
|
||||
<div class="show_desc">{$sale->description[$cookie->id_lang]|truncate:165:'...'|escape:'UTF-8'}</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
@ -230,7 +230,7 @@
|
||||
<input type="submit" value="ok">
|
||||
<p><a href="/modules/invite/invite-program.php">{l s='Sponsor more friends' mod='privatesales'}</a></p>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</li>
|
||||
{elseif $sales_index == 3}
|
||||
<li id="list_gc">
|
||||
@ -275,7 +275,7 @@
|
||||
{$sale->description[$cookie->id_lang]|escape:'htmlall':'UTF-8'}
|
||||
<div class="date">{l s='From' mod='privatesales'} {$sale->date_start|date_format:'%A %e %b %H:%M'} {l s='To' mod='privatesales'} {$sale->date_end|date_format:'%A %e %b %H:%M'}</div>
|
||||
</div>*}
|
||||
|
||||
|
||||
{include file="./themes/site/delay.tpl" delivery_delay=$sale->delivery_delay}
|
||||
|
||||
<div class="short_desc">
|
||||
@ -329,7 +329,7 @@
|
||||
$('a.enter').click(function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
$(this).parent().parent().trigger('click');
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user