<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Движок сайтов S2 — Заработает ли сборка s2-dev-r1713 на PHP 5.4]]></title>
	<link rel="self" href="https://s2cms.ru/forum/feed/atom/topic/248/"/>
	<updated>2014-11-15T16:24:02Z</updated>
	<generator>PunBB</generator>
	<id>https://s2cms.ru/forum/topic/248/</id>
		<entry>
			<title type="html"><![CDATA[Re: Заработает ли сборка s2-dev-r1713 на PHP 5.4]]></title>
			<link rel="alternate" href="https://s2cms.ru/forum/post/1201/#p1201"/>
			<content type="html"><![CDATA[<p>Убрал флаг &quot;e&quot;:<br /><a href="http://s2cms.ru/trac/changeset/1723">http://s2cms.ru/trac/changeset/1723</a><br /><a href="https://github.com/parpalak/s2/commit/da0b4aca4fe39e9941f7f40d16ad6fa5c7343e1b">https://github.com/parpalak/s2/commit/d … a5c7343e1b</a></p>]]></content>
			<author>
				<name><![CDATA[Роман]]></name>
				<uri>https://s2cms.ru/forum/user/2/</uri>
			</author>
			<updated>2014-11-15T16:24:02Z</updated>
			<id>https://s2cms.ru/forum/post/1201/#p1201</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Заработает ли сборка s2-dev-r1713 на PHP 5.4]]></title>
			<link rel="alternate" href="https://s2cms.ru/forum/post/1200/#p1200"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>boo пишет:</cite><blockquote><p>Очень хорошо! Обновил, всё работает.</p></blockquote></div><p>У меня выскакивали ошибки после комментариев. Решается заменой preg_replace() с флагом &quot;e&quot; на preg_replace_callback():</p><div class="codebox"><pre><code>// Строка ~230-240, файл _include/comments.php
function s2_bbcode_to_html ($s)
{
    global $lang_common;

    // Надо создать анонимную функцию
    $callback = function ($m) {
        $link = $m[1];
        
        $long  = utf8_strlen($m[1]) &gt; 55;
        $short = ($long ? utf8_substr($m[1], 0 , 42) . &#039; &amp;hellip; &#039; . utf8_substr($m[1], -10) : $m[1]);
        
        return &quot;&lt;noindex&gt;&lt;a href=\&quot;$link\&quot; rel=\&quot;nofollow\&quot;&gt;$short&lt;/a&gt;&lt;/noindex&gt;&quot;;
    };

    $s = str_replace(&quot;&#039;&#039;&quot;, &#039;&quot;&#039;, $s);
    $s = str_replace(&quot;\r&quot;, &#039;&#039;, $s);

    $s = preg_replace(&#039;#\[I\](.*?)\[/I\]#isS&#039;, &#039;&lt;em&gt;\1&lt;/em&gt;&#039;, $s);
    $s = preg_replace(&#039;#\[B\](.*?)\[/B\]#isS&#039;, &#039;&lt;strong&gt;\1&lt;/strong&gt;&#039;, $s);

    while (preg_match (&#039;/\[Q\s*=\s*([^\]]*)\].*?\[\/Q\]/isS&#039;, $s))
        $s = preg_replace(&#039;/\s*\[Q\s*=\s*([^\]]*)\]\s*(.*?)\s*\[\/Q\]\s*/isS&#039;, &#039;&lt;blockquote&gt;&lt;strong&gt;\\1&lt;/strong&gt; &#039;.$lang_common[&#039;Wrote&#039;].&#039;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;\\2&lt;/em&gt;&lt;/blockquote&gt;&#039;, $s);

    while (preg_match (&#039;/\[Q\].*?\[\/Q\]/isS&#039;, $s))
        $s = preg_replace(&#039;/\s*\[Q\]\s*(.*?)\s*\[\/Q\]\s*/isS&#039;, &#039;&lt;blockquote&gt;\\1&lt;/blockquote&gt;&#039;, $s);
    
    // И вот тут надо поменять второй аргумент и убрать флаг &#039;e&#039;
    $s = preg_replace_callback(&#039;#(https?://\S{2,}?)(?=[\s\),\&#039;\&gt;&lt;\]]|&amp;lt;|&amp;gt;|[\.;:](?:\s|$)|$)#u&#039;, $callback, $s);
    $s = str_replace(&quot;\n&quot;, &#039;&lt;br /&gt;&#039;, $s);
    return $s;
}</code></pre></div><p>Надеюсь это вам поможет.</p>]]></content>
			<author>
				<name><![CDATA[volter9]]></name>
				<uri>https://s2cms.ru/forum/user/206/</uri>
			</author>
			<updated>2014-11-13T00:41:32Z</updated>
			<id>https://s2cms.ru/forum/post/1200/#p1200</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Заработает ли сборка s2-dev-r1713 на PHP 5.4]]></title>
			<link rel="alternate" href="https://s2cms.ru/forum/post/1140/#p1140"/>
			<content type="html"><![CDATA[<p>Очень хорошо! Обновил, всё работает.</p>]]></content>
			<author>
				<name><![CDATA[boo]]></name>
				<uri>https://s2cms.ru/forum/user/63/</uri>
			</author>
			<updated>2014-06-17T18:46:50Z</updated>
			<id>https://s2cms.ru/forum/post/1140/#p1140</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Заработает ли сборка s2-dev-r1713 на PHP 5.4]]></title>
			<link rel="alternate" href="https://s2cms.ru/forum/post/1139/#p1139"/>
			<content type="html"><![CDATA[<p>Конечно.</p><p>В зависимости от настроек PHP могут быть предупреждения про часовые пояса. Тогда надо будет добавить в config.php функцию выбора часового пояса.</p>]]></content>
			<author>
				<name><![CDATA[Роман]]></name>
				<uri>https://s2cms.ru/forum/user/2/</uri>
			</author>
			<updated>2014-06-17T18:28:36Z</updated>
			<id>https://s2cms.ru/forum/post/1139/#p1139</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Заработает ли сборка s2-dev-r1713 на PHP 5.4]]></title>
			<link rel="alternate" href="https://s2cms.ru/forum/post/1138/#p1138"/>
			<content type="html"><![CDATA[<p>Хостер решил обновить оборудование и заодно переехать на новую версию PHP 5.4. <br />Собственно, вопрос: будет ли работать?</p>]]></content>
			<author>
				<name><![CDATA[boo]]></name>
				<uri>https://s2cms.ru/forum/user/63/</uri>
			</author>
			<updated>2014-06-17T16:40:12Z</updated>
			<id>https://s2cms.ru/forum/post/1138/#p1138</id>
		</entry>
</feed>
