Completed
Push — master ( 884a64...a86016 )
by 0x2f8f
06:59
created
Service/TypographService.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@
 block discarded – undo
7 7
 
8 8
 class TypographService
9 9
 {
10
-    protected $configs;
10
+	protected $configs;
11 11
 
12
-    public function __construct($configs)
13
-    {
14
-        $this->configs = $configs;
15
-    }
12
+	public function __construct($configs)
13
+	{
14
+		$this->configs = $configs;
15
+	}
16 16
 
17
-    public function apply($string, $config = null)
18
-    {
19
-        if (is_null($config)) {
20
-            $config = 'default';
21
-        }
17
+	public function apply($string, $config = null)
18
+	{
19
+		if (is_null($config)) {
20
+			$config = 'default';
21
+		}
22 22
 
23
-        if (!isset($this->configs[$config])) {
24
-            throw new InvalidConfigurationException('Typograph\'s config "'. $config .'" doesn\'t exist');
25
-        }
23
+		if (!isset($this->configs[$config])) {
24
+			throw new InvalidConfigurationException('Typograph\'s config "'. $config .'" doesn\'t exist');
25
+		}
26 26
 
27
-        return EMTypograph::fast_apply($string, $this->configs[$config]);
28
-    }
27
+		return EMTypograph::fast_apply($string, $this->configs[$config]);
28
+	}
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
EMT/EMTypograph.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@
 block discarded – undo
12 12
 class EMTypograph extends EMTBase
13 13
 {
14 14
 	public $trets = array(
15
-        '\Fenrizbes\TypographBundle\EMT\EMTTretQuote',
16
-        '\Fenrizbes\TypographBundle\EMT\EMTTretDash',
17
-        '\Fenrizbes\TypographBundle\EMT\EMTTretSymbol',
18
-        '\Fenrizbes\TypographBundle\EMT\EMTTretPunctmark',
19
-        '\Fenrizbes\TypographBundle\EMT\EMTTretNumber',
20
-        '\Fenrizbes\TypographBundle\EMT\EMTTretSpace',
21
-        '\Fenrizbes\TypographBundle\EMT\EMTTretAbbr',
22
-        '\Fenrizbes\TypographBundle\EMT\EMTTretNobr',
23
-        '\Fenrizbes\TypographBundle\EMT\EMTTretDate',
24
-        '\Fenrizbes\TypographBundle\EMT\EMTTretOptAlign',
25
-        '\Fenrizbes\TypographBundle\EMT\EMTTretEtc',
26
-        '\Fenrizbes\TypographBundle\EMT\EMTTretText'
27
-    );
15
+		'\Fenrizbes\TypographBundle\EMT\EMTTretQuote',
16
+		'\Fenrizbes\TypographBundle\EMT\EMTTretDash',
17
+		'\Fenrizbes\TypographBundle\EMT\EMTTretSymbol',
18
+		'\Fenrizbes\TypographBundle\EMT\EMTTretPunctmark',
19
+		'\Fenrizbes\TypographBundle\EMT\EMTTretNumber',
20
+		'\Fenrizbes\TypographBundle\EMT\EMTTretSpace',
21
+		'\Fenrizbes\TypographBundle\EMT\EMTTretAbbr',
22
+		'\Fenrizbes\TypographBundle\EMT\EMTTretNobr',
23
+		'\Fenrizbes\TypographBundle\EMT\EMTTretDate',
24
+		'\Fenrizbes\TypographBundle\EMT\EMTTretOptAlign',
25
+		'\Fenrizbes\TypographBundle\EMT\EMTTretEtc',
26
+		'\Fenrizbes\TypographBundle\EMT\EMTTretText'
27
+	);
28 28
 	
29 29
 	
30 30
 	protected $group_list  = array(
Please login to merge, or discard this patch.
EMT/EMTTretSpace.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	public $title = "Расстановка и удаление пробелов";
19 19
 	
20 20
 	public $domain_zones = array('ru','ру','ком','орг', 'уа', 'ua', 'uk', 'co', 'fr', 
21
-	                             'com', 'net', 'edu', 'gov', 'org', 'mil', 'int', 'info', 'biz', 'info', 'name', 'pro');
21
+								 'com', 'net', 'edu', 'gov', 'org', 'mil', 'int', 'info', 'biz', 'info', 'name', 'pro');
22 22
 	
23 23
 	public $classes = array(
24 24
 			'nowrap'           => 'word-spacing:nowrap;',
Please login to merge, or discard this patch.
EMT/EMTTretText.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 		
60 60
 		);
61 61
 
62
-    /**
62
+	/**
63 63
 	 * Расстановка защищенных тегов параграфа (<p>...</p>) и переноса строки
64 64
 	 *
65 65
 	 * @return  void
Please login to merge, or discard this patch.
EMT/EMTTretQuote.php 1 patch
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -15,178 +15,178 @@
 block discarded – undo
15 15
 
16 16
 class EMTTretQuote extends EMTTret
17 17
 {
18
-    /**
19
-     * Базовые параметры тофа
20
-     *
21
-     * @var array
22
-     */
23
-    public $title = "Кавычки";
24
-
25
-
26
-    public $rules = array(
27
-        'quotes_outside_a' => array(
28
-            'description'	=> 'Кавычки вне тэга <a>',
29
-            //'pattern' 		=> '/(\<%%\_\_.+?\>)\"(.+?)\"(\<\/%%\_\_.+?\>)/s',
30
-            'pattern' 		=> '/(\<%%\_\_[^\>]+\>)\"(.+?)\"(\<\/%%\_\_[^\>]+\>)/s',
31
-            'replacement' 	=> '"\1\2\3"'
32
-        ),
33
-
34
-        'open_quote' => array(
35
-            'description'	=> 'Открывающая кавычка',
36
-            'pattern' 		=> '/(^|\(|\s|\>|-)((\"|\\\")+)(\S+)/iue',
37
-            'replacement' 	=> '$m[1] . str_repeat(self::QUOTE_FIRS_OPEN, substr_count($m[2],"\"") ) . $m[4]'
38
-        ),
39
-        'close_quote' => array(
40
-            'description'	=> 'Закрывающая кавычка',
41
-            'pattern' 		=> '/([a-zа-яё0-9]|\.|\&hellip\;|\!|\?|\>|\)|\:|\+|\%|\@|\#|\$|\*)((\"|\\\")+)(\.|\&hellip\;|\;|\:|\?|\!|\,|\s|\)|\<\/|\<|$)/uie',
42
-            'replacement' 	=> '$m[1] . str_repeat(self::QUOTE_FIRS_CLOSE, substr_count($m[2],"\"") ) . $m[4]'
43
-        ),
44
-        'close_quote_adv' => array(
45
-            'description'	=> 'Закрывающая кавычка особые случаи',
46
-            //'pattern' 		=> '/([a-zа-яё0-9]|\.|\&hellip\;|\!|\?|\>|\)|\:)((\"|\\\"|\&laquo\;)+)(\<.+?\>)(\.|\&hellip\;|\;|\:|\?|\!|\,|\s|\)|\<\/|$)/uie',
47
-            'pattern' 		=>
48
-            array(
49
-                '/([a-zа-яё0-9]|\.|\&hellip\;|\!|\?|\>|\)|\:|\+|\%|\@|\#|\$|\*)((\"|\\\"|\&laquo\;)+)(\<[^\>]+\>)(\.|\&hellip\;|\;|\:|\?|\!|\,|\)|\<\/|$| )/uie',
50
-                '/([a-zа-яё0-9]|\.|\&hellip\;|\!|\?|\>|\)|\:|\+|\%|\@|\#|\$|\*)(\s+)((\"|\\\")+)(\s+)(\.|\&hellip\;|\;|\:|\?|\!|\,|\)|\<\/|$| )/uie',
51
-                '/\>(\&laquo\;)\.($|\s|\<)/ui',
52
-                '/\>(\&laquo\;),($|\s|\<|\S)/ui',
53
-                '/\>(\&laquo\;):($|\s|\<|\S)/ui',
54
-                '/\>(\&laquo\;);($|\s|\<|\S)/ui',
55
-                '/\>(\&laquo\;)\)($|\s|\<|\S)/ui',
56
-                '/((\"|\\\")+)$/uie',
57
-            ),
58
-            'replacement' 	=>
59
-            array(
60
-                '$m[1] . str_repeat(self::QUOTE_FIRS_CLOSE, substr_count($m[2],"\"")+substr_count($m[2],"&laquo;") ) . $m[4]. $m[5]',
61
-                '$m[1] .$m[2]. str_repeat(self::QUOTE_FIRS_CLOSE, substr_count($m[3],"\"")+substr_count($m[3],"&laquo;") ) . $m[5]. $m[6]',
62
-                '>&raquo;.\2',
63
-                '>&raquo;,\2',
64
-                '>&raquo;:\2',
65
-                '>&raquo;;\2',
66
-                '>&raquo;)\2',
67
-                'str_repeat(self::QUOTE_FIRS_CLOSE, substr_count($m[1],"\"") )',
68
-            ),
69
-        ),
70
-        'open_quote_adv' => array(
71
-            'description'	=> 'Открывающая кавычка особые случаи',
72
-            'pattern' 		=> '/(^|\(|\s|\>)(\"|\\\")(\s)(\S+)/iue',
73
-            'replacement' 	=> '$m[1] . self::QUOTE_FIRS_OPEN .$m[4]'
74
-        ),
75
-        'close_quote_adv_2' => array(
76
-            'description'	=> 'Закрывающая кавычка последний шанс',
77
-            'pattern' 		=> '/(\S)((\"|\\\")+)(\.|\&hellip\;|\;|\:|\?|\!|\,|\s|\)|\<\/|\<|$)/uie',
78
-            'replacement' 	=> '$m[1] . str_repeat(self::QUOTE_FIRS_CLOSE, substr_count($m[2],"\"") ) . $m[4]'
79
-        ),
80
-        'quotation' => array(
81
-            'description'	=> 'Внутренние кавычки-лапки и дюймы',
82
-            'function' => 'build_sub_quotations'
83
-        ),
84
-    );
85
-
86
-    protected function inject_in($pos, $text, &$thetext)
87
-    {
88
-        for($i=0;$i<strlen($text);$i++) $thetext[$pos+$i] = $text[$i];
89
-    }
90
-
91
-    protected function build_sub_quotations()
92
-    {
93
-        global $__ax,$__ay;
94
-
95
-        $exp = strpos($this->_text, "</cA===>")!==false ? "</cA===>" : (strpos($this->_text,"\r\n")!==false ? "\r\n\r\n" :"\n\n");
96
-
97
-        $texts_in = explode($exp, $this->_text);
98
-        $texts_out = array();
99
-
100
-        foreach($texts_in as $textx) {
101
-
102
-            $okposstack = array('0');
103
-            $okpos = 0;
104
-            $level = 0;
105
-            $off = 0;
106
-            while(true)
107
-            {
108
-                $p = EMTLib::strpos_ex($textx, array("&laquo;", "&raquo;"), $off);
109
-                if($p===false) break;
110
-                if($p['str'] == "&laquo;")
111
-                {
112
-                    if($level>0) if(!$this->is_on('no_bdquotes')) $this->inject_in($p['pos'], self::QUOTE_CRAWSE_OPEN, $textx);
113
-                    $level++;
114
-                }
115
-                if($p['str'] == "&raquo;")
116
-                {
117
-                    $level--;
118
-                    if($level>0) if(!$this->is_on('no_bdquotes')) $this->inject_in($p['pos'], self::QUOTE_CRAWSE_CLOSE, $textx);
119
-                }
120
-                $off = $p['pos']+strlen($p['str']);
121
-                if($level == 0)
122
-                {
123
-                    $okpos = $off;
124
-                    array_push($okposstack, $okpos);
125
-                } elseif($level<0) // уровень стал меньше нуля
126
-                {
127
-                    if(!$this->is_on('no_inches'))
128
-                    {
129
-                        do{
130
-                            $lokpos = array_pop($okposstack);
131
-                            $k = substr($textx, $lokpos, $off-$lokpos);
132
-                            $k = str_replace(self::QUOTE_CRAWSE_OPEN, self::QUOTE_FIRS_OPEN, $k);
133
-                            $k = str_replace(self::QUOTE_CRAWSE_CLOSE, self::QUOTE_FIRS_CLOSE, $k);
134
-                            //$k = preg_replace("/(^|[^0-9])([0-9]+)\&raquo\;/ui", '\1\2&Prime;', $k, 1, $amount);
135
-
136
-                            $amount = 0;
137
-                            $__ax = preg_match_all("/(^|[^0-9])([0-9]+)\&raquo\;/ui", $k, $m);
138
-                            $__ay = 0;
139
-                            if($__ax)
140
-                            {
141
-                                $k = preg_replace_callback("/(^|[^0-9])([0-9]+)\&raquo\;/ui",
142
-                                    create_function('$m','global $__ax,$__ay; $__ay++; if($__ay==$__ax){ return $m[1].$m[2]."&Prime;";} return $m[0];'),
143
-                                    $k);
144
-                                $amount = 1;
145
-                            }
146
-
147
-
148
-
149
-                        } while(($amount==0) && count($okposstack));
150
-
151
-                        // успешно сделали замену
152
-                        if($amount == 1)
153
-                        {
154
-                            // заново просмотрим содержимое
155
-                            $textx = substr($textx, 0, $lokpos). $k . substr($textx, $off);
156
-                            $off = $lokpos;
157
-                            $level = 0;
158
-                            continue;
159
-                        }
160
-
161
-                        // иначе просто заменим последнюю явно на &quot; от отчаяния
162
-                        if($amount == 0)
163
-                        {
164
-                            // говорим, что всё в порядке
165
-                            $level = 0;
166
-                            $textx = substr($textx, 0, $p['pos']). '&quot;' . substr($textx, $off);
167
-                            $off = $p['pos'] + strlen('&quot;');
168
-                            $okposstack = array($off);
169
-                            continue;
170
-                        }
171
-                    }
172
-                }
173
-
174
-
175
-            }
176
-            // не совпало количество, отменяем все подкавычки
177
-            if($level != 0 ){
178
-
179
-                // закрывающих меньше, чем надо
180
-                if($level>0)
181
-                {
182
-                    $k = substr($textx, $okpos);
183
-                    $k = str_replace(self::QUOTE_CRAWSE_OPEN, self::QUOTE_FIRS_OPEN, $k);
184
-                    $k = str_replace(self::QUOTE_CRAWSE_CLOSE, self::QUOTE_FIRS_CLOSE, $k);
185
-                    $textx = substr($textx, 0, $okpos). $k;
186
-                }
187
-            }
188
-            $texts_out[] = $textx;
189
-        }
190
-        $this->_text = implode($exp, $texts_out);
191
-    }
18
+	/**
19
+	 * Базовые параметры тофа
20
+	 *
21
+	 * @var array
22
+	 */
23
+	public $title = "Кавычки";
24
+
25
+
26
+	public $rules = array(
27
+		'quotes_outside_a' => array(
28
+			'description'	=> 'Кавычки вне тэга <a>',
29
+			//'pattern' 		=> '/(\<%%\_\_.+?\>)\"(.+?)\"(\<\/%%\_\_.+?\>)/s',
30
+			'pattern' 		=> '/(\<%%\_\_[^\>]+\>)\"(.+?)\"(\<\/%%\_\_[^\>]+\>)/s',
31
+			'replacement' 	=> '"\1\2\3"'
32
+		),
33
+
34
+		'open_quote' => array(
35
+			'description'	=> 'Открывающая кавычка',
36
+			'pattern' 		=> '/(^|\(|\s|\>|-)((\"|\\\")+)(\S+)/iue',
37
+			'replacement' 	=> '$m[1] . str_repeat(self::QUOTE_FIRS_OPEN, substr_count($m[2],"\"") ) . $m[4]'
38
+		),
39
+		'close_quote' => array(
40
+			'description'	=> 'Закрывающая кавычка',
41
+			'pattern' 		=> '/([a-zа-яё0-9]|\.|\&hellip\;|\!|\?|\>|\)|\:|\+|\%|\@|\#|\$|\*)((\"|\\\")+)(\.|\&hellip\;|\;|\:|\?|\!|\,|\s|\)|\<\/|\<|$)/uie',
42
+			'replacement' 	=> '$m[1] . str_repeat(self::QUOTE_FIRS_CLOSE, substr_count($m[2],"\"") ) . $m[4]'
43
+		),
44
+		'close_quote_adv' => array(
45
+			'description'	=> 'Закрывающая кавычка особые случаи',
46
+			//'pattern' 		=> '/([a-zа-яё0-9]|\.|\&hellip\;|\!|\?|\>|\)|\:)((\"|\\\"|\&laquo\;)+)(\<.+?\>)(\.|\&hellip\;|\;|\:|\?|\!|\,|\s|\)|\<\/|$)/uie',
47
+			'pattern' 		=>
48
+			array(
49
+				'/([a-zа-яё0-9]|\.|\&hellip\;|\!|\?|\>|\)|\:|\+|\%|\@|\#|\$|\*)((\"|\\\"|\&laquo\;)+)(\<[^\>]+\>)(\.|\&hellip\;|\;|\:|\?|\!|\,|\)|\<\/|$| )/uie',
50
+				'/([a-zа-яё0-9]|\.|\&hellip\;|\!|\?|\>|\)|\:|\+|\%|\@|\#|\$|\*)(\s+)((\"|\\\")+)(\s+)(\.|\&hellip\;|\;|\:|\?|\!|\,|\)|\<\/|$| )/uie',
51
+				'/\>(\&laquo\;)\.($|\s|\<)/ui',
52
+				'/\>(\&laquo\;),($|\s|\<|\S)/ui',
53
+				'/\>(\&laquo\;):($|\s|\<|\S)/ui',
54
+				'/\>(\&laquo\;);($|\s|\<|\S)/ui',
55
+				'/\>(\&laquo\;)\)($|\s|\<|\S)/ui',
56
+				'/((\"|\\\")+)$/uie',
57
+			),
58
+			'replacement' 	=>
59
+			array(
60
+				'$m[1] . str_repeat(self::QUOTE_FIRS_CLOSE, substr_count($m[2],"\"")+substr_count($m[2],"&laquo;") ) . $m[4]. $m[5]',
61
+				'$m[1] .$m[2]. str_repeat(self::QUOTE_FIRS_CLOSE, substr_count($m[3],"\"")+substr_count($m[3],"&laquo;") ) . $m[5]. $m[6]',
62
+				'>&raquo;.\2',
63
+				'>&raquo;,\2',
64
+				'>&raquo;:\2',
65
+				'>&raquo;;\2',
66
+				'>&raquo;)\2',
67
+				'str_repeat(self::QUOTE_FIRS_CLOSE, substr_count($m[1],"\"") )',
68
+			),
69
+		),
70
+		'open_quote_adv' => array(
71
+			'description'	=> 'Открывающая кавычка особые случаи',
72
+			'pattern' 		=> '/(^|\(|\s|\>)(\"|\\\")(\s)(\S+)/iue',
73
+			'replacement' 	=> '$m[1] . self::QUOTE_FIRS_OPEN .$m[4]'
74
+		),
75
+		'close_quote_adv_2' => array(
76
+			'description'	=> 'Закрывающая кавычка последний шанс',
77
+			'pattern' 		=> '/(\S)((\"|\\\")+)(\.|\&hellip\;|\;|\:|\?|\!|\,|\s|\)|\<\/|\<|$)/uie',
78
+			'replacement' 	=> '$m[1] . str_repeat(self::QUOTE_FIRS_CLOSE, substr_count($m[2],"\"") ) . $m[4]'
79
+		),
80
+		'quotation' => array(
81
+			'description'	=> 'Внутренние кавычки-лапки и дюймы',
82
+			'function' => 'build_sub_quotations'
83
+		),
84
+	);
85
+
86
+	protected function inject_in($pos, $text, &$thetext)
87
+	{
88
+		for($i=0;$i<strlen($text);$i++) $thetext[$pos+$i] = $text[$i];
89
+	}
90
+
91
+	protected function build_sub_quotations()
92
+	{
93
+		global $__ax,$__ay;
94
+
95
+		$exp = strpos($this->_text, "</cA===>")!==false ? "</cA===>" : (strpos($this->_text,"\r\n")!==false ? "\r\n\r\n" :"\n\n");
96
+
97
+		$texts_in = explode($exp, $this->_text);
98
+		$texts_out = array();
99
+
100
+		foreach($texts_in as $textx) {
101
+
102
+			$okposstack = array('0');
103
+			$okpos = 0;
104
+			$level = 0;
105
+			$off = 0;
106
+			while(true)
107
+			{
108
+				$p = EMTLib::strpos_ex($textx, array("&laquo;", "&raquo;"), $off);
109
+				if($p===false) break;
110
+				if($p['str'] == "&laquo;")
111
+				{
112
+					if($level>0) if(!$this->is_on('no_bdquotes')) $this->inject_in($p['pos'], self::QUOTE_CRAWSE_OPEN, $textx);
113
+					$level++;
114
+				}
115
+				if($p['str'] == "&raquo;")
116
+				{
117
+					$level--;
118
+					if($level>0) if(!$this->is_on('no_bdquotes')) $this->inject_in($p['pos'], self::QUOTE_CRAWSE_CLOSE, $textx);
119
+				}
120
+				$off = $p['pos']+strlen($p['str']);
121
+				if($level == 0)
122
+				{
123
+					$okpos = $off;
124
+					array_push($okposstack, $okpos);
125
+				} elseif($level<0) // уровень стал меньше нуля
126
+				{
127
+					if(!$this->is_on('no_inches'))
128
+					{
129
+						do{
130
+							$lokpos = array_pop($okposstack);
131
+							$k = substr($textx, $lokpos, $off-$lokpos);
132
+							$k = str_replace(self::QUOTE_CRAWSE_OPEN, self::QUOTE_FIRS_OPEN, $k);
133
+							$k = str_replace(self::QUOTE_CRAWSE_CLOSE, self::QUOTE_FIRS_CLOSE, $k);
134
+							//$k = preg_replace("/(^|[^0-9])([0-9]+)\&raquo\;/ui", '\1\2&Prime;', $k, 1, $amount);
135
+
136
+							$amount = 0;
137
+							$__ax = preg_match_all("/(^|[^0-9])([0-9]+)\&raquo\;/ui", $k, $m);
138
+							$__ay = 0;
139
+							if($__ax)
140
+							{
141
+								$k = preg_replace_callback("/(^|[^0-9])([0-9]+)\&raquo\;/ui",
142
+									create_function('$m','global $__ax,$__ay; $__ay++; if($__ay==$__ax){ return $m[1].$m[2]."&Prime;";} return $m[0];'),
143
+									$k);
144
+								$amount = 1;
145
+							}
146
+
147
+
148
+
149
+						} while(($amount==0) && count($okposstack));
150
+
151
+						// успешно сделали замену
152
+						if($amount == 1)
153
+						{
154
+							// заново просмотрим содержимое
155
+							$textx = substr($textx, 0, $lokpos). $k . substr($textx, $off);
156
+							$off = $lokpos;
157
+							$level = 0;
158
+							continue;
159
+						}
160
+
161
+						// иначе просто заменим последнюю явно на &quot; от отчаяния
162
+						if($amount == 0)
163
+						{
164
+							// говорим, что всё в порядке
165
+							$level = 0;
166
+							$textx = substr($textx, 0, $p['pos']). '&quot;' . substr($textx, $off);
167
+							$off = $p['pos'] + strlen('&quot;');
168
+							$okposstack = array($off);
169
+							continue;
170
+						}
171
+					}
172
+				}
173
+
174
+
175
+			}
176
+			// не совпало количество, отменяем все подкавычки
177
+			if($level != 0 ){
178
+
179
+				// закрывающих меньше, чем надо
180
+				if($level>0)
181
+				{
182
+					$k = substr($textx, $okpos);
183
+					$k = str_replace(self::QUOTE_CRAWSE_OPEN, self::QUOTE_FIRS_OPEN, $k);
184
+					$k = str_replace(self::QUOTE_CRAWSE_CLOSE, self::QUOTE_FIRS_CLOSE, $k);
185
+					$textx = substr($textx, 0, $okpos). $k;
186
+				}
187
+			}
188
+			$texts_out[] = $textx;
189
+		}
190
+		$this->_text = implode($exp, $texts_out);
191
+	}
192 192
 }
Please login to merge, or discard this patch.
EMT/EMTBase.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -103,130 +103,130 @@  discard block
 block discarded – undo
103 103
 	}
104 104
 	
105 105
 	/**
106
-     * Добавление защищенного блока
107
-     *
108
-     * <code>
109
-     *  Jare_Typograph_Tool::addCustomBlocks('<span>', '</span>');
110
-     *  Jare_Typograph_Tool::addCustomBlocks('\<nobr\>', '\<\/span\>', true);
111
-     * </code>
112
-     * 
113
-     * @param 	string $id идентификатор
114
-     * @param 	string $open начало блока
115
-     * @param 	string $close конец защищенного блока
116
-     * @param 	string $tag тэг
117
-     * @return  void
118
-     */
119
-    private function _add_safe_block($id, $open, $close, $tag)
120
-    {
121
-    	$this->_safe_blocks[] = array(
122
-    			'id' => $id,
123
-    			'tag' => $tag,
124
-    			'open' =>  $open,
125
-    			'close' =>  $close,
126
-    		);
127
-    }
106
+	 * Добавление защищенного блока
107
+	 *
108
+	 * <code>
109
+	 *  Jare_Typograph_Tool::addCustomBlocks('<span>', '</span>');
110
+	 *  Jare_Typograph_Tool::addCustomBlocks('\<nobr\>', '\<\/span\>', true);
111
+	 * </code>
112
+	 * 
113
+	 * @param 	string $id идентификатор
114
+	 * @param 	string $open начало блока
115
+	 * @param 	string $close конец защищенного блока
116
+	 * @param 	string $tag тэг
117
+	 * @return  void
118
+	 */
119
+	private function _add_safe_block($id, $open, $close, $tag)
120
+	{
121
+		$this->_safe_blocks[] = array(
122
+				'id' => $id,
123
+				'tag' => $tag,
124
+				'open' =>  $open,
125
+				'close' =>  $close,
126
+			);
127
+	}
128 128
     
129
-    /**
130
-     * Список защищенных блоков
131
-     *
132
-     * @return 	array
133
-     */
134
-    public function get_all_safe_blocks()
135
-    {
136
-    	return $this->_safe_blocks;
137
-    }
129
+	/**
130
+	 * Список защищенных блоков
131
+	 *
132
+	 * @return 	array
133
+	 */
134
+	public function get_all_safe_blocks()
135
+	{
136
+		return $this->_safe_blocks;
137
+	}
138 138
     
139
-    /**
140
-     * Удаленного блока по его номеру ключа
141
-     *
142
-     * @param 	string $id идентифиактор защищённого блока 
143
-     * @return  void
144
-     */
145
-    public function remove_safe_block($id)
146
-    {
147
-    	foreach($this->_safe_blocks as $k => $block) {
148
-    		if($block['id']==$id) unset($this->_safe_blocks[$k]);
149
-    	}
150
-    }
139
+	/**
140
+	 * Удаленного блока по его номеру ключа
141
+	 *
142
+	 * @param 	string $id идентифиактор защищённого блока 
143
+	 * @return  void
144
+	 */
145
+	public function remove_safe_block($id)
146
+	{
147
+		foreach($this->_safe_blocks as $k => $block) {
148
+			if($block['id']==$id) unset($this->_safe_blocks[$k]);
149
+		}
150
+	}
151 151
     
152 152
     
153
-    /**
154
-     * Добавление защищенного блока
155
-     *
156
-     * @param 	string $tag тэг, который должен быть защищён
157
-     * @return  void
158
-     */
159
-    public function add_safe_tag($tag)
160
-    {      	
161
-    	$open = preg_quote("<", '/'). $tag."[^>]*?" .  preg_quote(">", '/');
162
-    	$close = preg_quote("</$tag>", '/');
163
-    	$this->_add_safe_block($tag, $open, $close, $tag);
164
-    	return true;
165
-    }
153
+	/**
154
+	 * Добавление защищенного блока
155
+	 *
156
+	 * @param 	string $tag тэг, который должен быть защищён
157
+	 * @return  void
158
+	 */
159
+	public function add_safe_tag($tag)
160
+	{      	
161
+		$open = preg_quote("<", '/'). $tag."[^>]*?" .  preg_quote(">", '/');
162
+		$close = preg_quote("</$tag>", '/');
163
+		$this->_add_safe_block($tag, $open, $close, $tag);
164
+		return true;
165
+	}
166 166
     
167 167
     
168
-    /**
169
-     * Добавление защищенного блока
170
-     *
171
-     * @param 	string $open начало блока
172
-     * @param 	string $close конец защищенного блока
173
-     * @param 	bool $quoted специальные символы в начале и конце блока экранированы
174
-     * @return  void
175
-     */
176
-    public function add_safe_block($id, $open, $close, $quoted = false)
177
-    {
178
-    	$open = trim($open);
179
-    	$close = trim($close);
168
+	/**
169
+	 * Добавление защищенного блока
170
+	 *
171
+	 * @param 	string $open начало блока
172
+	 * @param 	string $close конец защищенного блока
173
+	 * @param 	bool $quoted специальные символы в начале и конце блока экранированы
174
+	 * @return  void
175
+	 */
176
+	public function add_safe_block($id, $open, $close, $quoted = false)
177
+	{
178
+		$open = trim($open);
179
+		$close = trim($close);
180 180
     	
181
-    	if (empty($open) || empty($close)) 
182
-    	{
183
-    		return false;
184
-    	}
181
+		if (empty($open) || empty($close)) 
182
+		{
183
+			return false;
184
+		}
185 185
     	
186
-    	if (false === $quoted) 
187
-    	{
188
-    		$open = preg_quote($open, '/');
189
-            $close = preg_quote($close, '/');
190
-    	}
186
+		if (false === $quoted) 
187
+		{
188
+			$open = preg_quote($open, '/');
189
+			$close = preg_quote($close, '/');
190
+		}
191 191
     	
192
-    	$this->_add_safe_block($id, $open, $close, "");
193
-    	return true;
194
-    }
192
+		$this->_add_safe_block($id, $open, $close, "");
193
+		return true;
194
+	}
195 195
     
196 196
     
197
-    /**
198
-     * Сохранение содержимого защищенных блоков
199
-     *
200
-     * @param   string $text
201
-     * @param   bool $safe если true, то содержимое блоков будет сохранено, иначе - раскодировано. 
202
-     * @return  string
203
-     */
204
-    public function safe_blocks($text, $way, $show = true)
205
-    {
206
-    	if (count($this->_safe_blocks)) 
207
-    	{
208
-    		$safeType = true === $way ? "\Fenrizbes\TypographBundle\EMT\EMTLib::encrypt_tag(\$m[2])" : "stripslashes(\Fenrizbes\TypographBundle\EMT\EMTLib::decrypt_tag(\$m[2]))";
209
-    		$safeblocks = true === $way ? $this->_safe_blocks : array_reverse($this->_safe_blocks);
210
-       		foreach ($safeblocks as $block) 
211
-       		{
212
-        		$text = preg_replace_callback("/({$block['open']})(.+?)({$block['close']})/s",   create_function('$m','return $m[1].'.$safeType . '.$m[3];')   , $text);
213
-        	}
214
-    	}
197
+	/**
198
+	 * Сохранение содержимого защищенных блоков
199
+	 *
200
+	 * @param   string $text
201
+	 * @param   bool $safe если true, то содержимое блоков будет сохранено, иначе - раскодировано. 
202
+	 * @return  string
203
+	 */
204
+	public function safe_blocks($text, $way, $show = true)
205
+	{
206
+		if (count($this->_safe_blocks)) 
207
+		{
208
+			$safeType = true === $way ? "\Fenrizbes\TypographBundle\EMT\EMTLib::encrypt_tag(\$m[2])" : "stripslashes(\Fenrizbes\TypographBundle\EMT\EMTLib::decrypt_tag(\$m[2]))";
209
+			$safeblocks = true === $way ? $this->_safe_blocks : array_reverse($this->_safe_blocks);
210
+	   		foreach ($safeblocks as $block) 
211
+	   		{
212
+				$text = preg_replace_callback("/({$block['open']})(.+?)({$block['close']})/s",   create_function('$m','return $m[1].'.$safeType . '.$m[3];')   , $text);
213
+			}
214
+		}
215 215
     	
216
-    	return $text;
217
-    }
216
+		return $text;
217
+	}
218 218
     
219 219
     
220
-     /**
221
-     * Декодирование блоков, которые были скрыты в момент типографирования
222
-     *
223
-     * @param   string $text
224
-     * @return  string
225
-     */
226
-    public function decode_internal_blocks($text)
227
-    {
220
+	 /**
221
+	  * Декодирование блоков, которые были скрыты в момент типографирования
222
+	  *
223
+	  * @param   string $text
224
+	  * @return  string
225
+	  */
226
+	public function decode_internal_blocks($text)
227
+	{
228 228
 		return EMTLib::decode_internal_blocks($text);
229
-    }
229
+	}
230 230
 	
231 231
 	
232 232
 	private function create_object($tret)
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 *
308 308
 	 * @param mixed $class - имя класса трета, или сам объект
309 309
 	 * @param string $altname - альтернативное имя, если хотим например иметь два одинаоковых терта в обработке
310
- 	 * @return unknown
310
+	 * @return unknown
311 311
 	 */
312 312
 	public function add_tret($class, $altname = false)
313 313
 	{
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 		
450 450
 		if($this->is_on('dounicode'))
451 451
 		{
452
-            EMTLib::convert_html_entities_to_unicode($this->_text);
452
+			EMTLib::convert_html_entities_to_unicode($this->_text);
453 453
 		}
454 454
 		
455 455
 		$this->_text = EMTLib::safe_tag_chars($this->_text, false);
@@ -612,8 +612,8 @@  discard block
 block discarded – undo
612 612
 				$rule_pattern = implode(".", $pa);
613 613
 			}
614 614
 		}
615
-        EMTLib::_process_selector_pattern($tret_pattern);
616
-        EMTLib::_process_selector_pattern($rule_pattern);
615
+		EMTLib::_process_selector_pattern($tret_pattern);
616
+		EMTLib::_process_selector_pattern($rule_pattern);
617 617
 		if($selector == "*") $this->settings[$key] = $value;
618 618
 		
619 619
 		foreach ($this->trets as $tret) 		
Please login to merge, or discard this patch.
EMT/EMTLib.php 1 patch
Indentation   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		'1/2' 	=> array('html' => array('&frac12;', '&#189;'),
44 44
 						 'utf8' => array(0x00BD)),
45 45
 		'1/4' 	=> array('html' => array('&frac14;', '&#188;'),
46
-					     'utf8' => array(0x00BC)),
46
+						 'utf8' => array(0x00BC)),
47 47
 		'3/4' 	=> array('html' => array('&frac34;', '&#190;'),
48 48
 						 'utf8' => array(0x00BE)),
49 49
 		'+-' 	=> array('html' => array('&plusmn;', '&#177;'),
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
 		'(r)' 	=> array('html' => array('&reg;', '&#174;'), 
56 56
 						 'utf8' => array(0x00AE)),
57 57
 		'(c)' 	=> array('html' => array('&copy;', '&#169;'), 
58
-					     'utf8' => array(0x00A9)),
58
+						 'utf8' => array(0x00A9)),
59 59
 		'§' 	=> array('html' => array('&sect;', '&#167;'), 
60
-					     'utf8' => array(0x00A7)),
60
+						 'utf8' => array(0x00A7)),
61 61
 		'`' 	=> array('html' => array('&#769;')),
62 62
 		'\'' 	=> array('html' => array('&rsquo;', '’')),
63 63
 		'x' 	=> array('html' => array('&times;', '&#215;'), 
64
-					     'utf8' => array('×') /* какой же у него может быть код? */),
64
+						 'utf8' => array('×') /* какой же у него может быть код? */),
65 65
 		
66 66
 	);
67 67
 
@@ -76,32 +76,32 @@  discard block
 block discarded – undo
76 76
 	
77 77
 	
78 78
 	/**
79
-     * Костыли для работы с символами UTF-8
80
-     * 
81
-     * @author	somebody?
82
-     * @param	int $c код символа в кодировке UTF-8 (например, 0x00AB)
83
-     * @return	bool|string
84
-     */
85
-    public static function _getUnicodeChar($c)
86
-    {
87
-    	if ($c <= 0x7F) {
88
-        	return chr($c);
89
-    	} else if ($c <= 0x7FF) {
90
-        	return chr(0xC0 | $c >> 6)
91
-        	     . chr(0x80 | $c & 0x3F);
92
-    	} else if ($c <= 0xFFFF) {
93
-        	return chr(0xE0 | $c >> 12)
94
-        	     . chr(0x80 | $c >> 6 & 0x3F)
95
-                 . chr(0x80 | $c & 0x3F);
96
-    	} else if ($c <= 0x10FFFF) {
97
-        	return chr(0xF0 | $c >> 18) 
98
-        		 . chr(0x80 | $c >> 12 & 0x3F)                 	
99
-        		 . chr(0x80 | $c >> 6 & 0x3F)
100
-                 . chr(0x80 | $c & 0x3F);
101
-    	} else {
102
-        	return false;
103
-    	}
104
-    }
79
+	 * Костыли для работы с символами UTF-8
80
+	 * 
81
+	 * @author	somebody?
82
+	 * @param	int $c код символа в кодировке UTF-8 (например, 0x00AB)
83
+	 * @return	bool|string
84
+	 */
85
+	public static function _getUnicodeChar($c)
86
+	{
87
+		if ($c <= 0x7F) {
88
+			return chr($c);
89
+		} else if ($c <= 0x7FF) {
90
+			return chr(0xC0 | $c >> 6)
91
+				 . chr(0x80 | $c & 0x3F);
92
+		} else if ($c <= 0xFFFF) {
93
+			return chr(0xE0 | $c >> 12)
94
+				 . chr(0x80 | $c >> 6 & 0x3F)
95
+				 . chr(0x80 | $c & 0x3F);
96
+		} else if ($c <= 0x10FFFF) {
97
+			return chr(0xF0 | $c >> 18) 
98
+				 . chr(0x80 | $c >> 12 & 0x3F)                 	
99
+				 . chr(0x80 | $c >> 6 & 0x3F)
100
+				 . chr(0x80 | $c & 0x3F);
101
+		} else {
102
+			return false;
103
+		}
104
+	}
105 105
 	
106 106
 
107 107
 	/**
@@ -194,71 +194,71 @@  discard block
 block discarded – undo
194 194
 	}
195 195
 	
196 196
 	/**
197
-     * Сохраняем содержимое тегов HTML
198
-     *
199
-     * Тег 'a' кодируется со специальным префиксом для дальнейшей
200
-     * возможности выносить за него кавычки.
201
-     * 
202
-     * @param 	string $text
203
-     * @param 	bool $safe
204
-     * @return  string
205
-     */
206
-    public static function safe_tag_chars($text, $way)
207
-    {
208
-    	if ($way) 
209
-        	$text = preg_replace_callback('/(\<\/?)(.+?)(\>)/s', create_function('$m','return $m[1].( substr(trim($m[2]), 0, 1) === "a" ? "%%___"  : ""  ) . \Fenrizbes\TypographBundle\EMT\EMTLib::encrypt_tag(trim($m[2]))  . $m[3];'), $text);
210
-        else
211
-        	$text = preg_replace_callback('/(\<\/?)(.+?)(\>)/s', create_function('$m','return $m[1].( substr(trim($m[2]), 0, 3) === "%%___" ? \Fenrizbes\TypographBundle\EMT\EMTLib::decrypt_tag(substr(trim($m[2]), 4)) : \Fenrizbes\TypographBundle\EMT\EMTLib::decrypt_tag(trim($m[2])) ) . $m[3];'), $text);
212
-        return $text;
213
-    }
197
+	 * Сохраняем содержимое тегов HTML
198
+	 *
199
+	 * Тег 'a' кодируется со специальным префиксом для дальнейшей
200
+	 * возможности выносить за него кавычки.
201
+	 * 
202
+	 * @param 	string $text
203
+	 * @param 	bool $safe
204
+	 * @return  string
205
+	 */
206
+	public static function safe_tag_chars($text, $way)
207
+	{
208
+		if ($way) 
209
+			$text = preg_replace_callback('/(\<\/?)(.+?)(\>)/s', create_function('$m','return $m[1].( substr(trim($m[2]), 0, 1) === "a" ? "%%___"  : ""  ) . \Fenrizbes\TypographBundle\EMT\EMTLib::encrypt_tag(trim($m[2]))  . $m[3];'), $text);
210
+		else
211
+			$text = preg_replace_callback('/(\<\/?)(.+?)(\>)/s', create_function('$m','return $m[1].( substr(trim($m[2]), 0, 3) === "%%___" ? \Fenrizbes\TypographBundle\EMT\EMTLib::decrypt_tag(substr(trim($m[2]), 4)) : \Fenrizbes\TypographBundle\EMT\EMTLib::decrypt_tag(trim($m[2])) ) . $m[3];'), $text);
212
+		return $text;
213
+	}
214 214
     
215 215
     
216
-    /**
217
-     * Декодриует спец блоки
218
-     *
219
-     * @param 	string $text
220
-     * @return  string
221
-     */
222
-    public static function decode_internal_blocks($text)
223
-    {
224
-    	$text = preg_replace_callback('/'.EMTLib::INTERNAL_BLOCK_OPEN.'([a-zA-Z0-9\/=]+?)'.EMTLib::INTERNAL_BLOCK_CLOSE.'/s', create_function('$m','return \Fenrizbes\TypographBundle\EMT\EMTLib::decrypt_tag($m[1]);'), $text);
225
-        return $text;
226
-    }
216
+	/**
217
+	 * Декодриует спец блоки
218
+	 *
219
+	 * @param 	string $text
220
+	 * @return  string
221
+	 */
222
+	public static function decode_internal_blocks($text)
223
+	{
224
+		$text = preg_replace_callback('/'.EMTLib::INTERNAL_BLOCK_OPEN.'([a-zA-Z0-9\/=]+?)'.EMTLib::INTERNAL_BLOCK_CLOSE.'/s', create_function('$m','return \Fenrizbes\TypographBundle\EMT\EMTLib::decrypt_tag($m[1]);'), $text);
225
+		return $text;
226
+	}
227 227
     
228
-    /**
229
-     * Кодирует спец блок
230
-     *
231
-     * @param 	string $text
232
-     * @return  string
233
-     */
234
-    public static function iblock($text)
235
-    {
236
-        return EMTLib::INTERNAL_BLOCK_OPEN. EMTLib::encrypt_tag($text).EMTLib::INTERNAL_BLOCK_CLOSE;
237
-    }
228
+	/**
229
+	 * Кодирует спец блок
230
+	 *
231
+	 * @param 	string $text
232
+	 * @return  string
233
+	 */
234
+	public static function iblock($text)
235
+	{
236
+		return EMTLib::INTERNAL_BLOCK_OPEN. EMTLib::encrypt_tag($text).EMTLib::INTERNAL_BLOCK_CLOSE;
237
+	}
238 238
     
239 239
     
240
-    /**
241
-     * Создание тега с защищенным содержимым 
242
-     *
243
-     * @param 	string $content текст, который будет обрамлен тегом
244
-     * @param 	string $tag тэг 
245
-     * @param 	array $attribute список атрибутов, где ключ - имя атрибута, а значение - само значение данного атрибута
246
-     * @return 	string
247
-     */
248
-    public static function build_safe_tag($content, $tag = 'span', $attribute = array(), $layout = EMTLib::LAYOUT_STYLE )
249
-    {
250
-    	$htmlTag = $tag;
240
+	/**
241
+	 * Создание тега с защищенным содержимым 
242
+	 *
243
+	 * @param 	string $content текст, который будет обрамлен тегом
244
+	 * @param 	string $tag тэг 
245
+	 * @param 	array $attribute список атрибутов, где ключ - имя атрибута, а значение - само значение данного атрибута
246
+	 * @return 	string
247
+	 */
248
+	public static function build_safe_tag($content, $tag = 'span', $attribute = array(), $layout = EMTLib::LAYOUT_STYLE )
249
+	{
250
+		$htmlTag = $tag;
251 251
 		
252
-    	if (self::$_typographSpecificTagId) 
253
-    	{
254
-    		if(!isset($attribute['id'])) 
255
-    		{
256
-    			$attribute['id'] = 'emt-2' . mt_rand(1000,9999);
257
-    		}
258
-    	}
252
+		if (self::$_typographSpecificTagId) 
253
+		{
254
+			if(!isset($attribute['id'])) 
255
+			{
256
+				$attribute['id'] = 'emt-2' . mt_rand(1000,9999);
257
+			}
258
+		}
259 259
     	
260 260
 		$classname = "";
261
-    	if (count($attribute)) 
261
+		if (count($attribute)) 
262 262
 		{
263 263
 			
264 264
 			if($layout & EMTLib::LAYOUT_STYLE)
@@ -291,66 +291,66 @@  discard block
 block discarded – undo
291 291
 		}
292 292
     	
293 293
 		if( ($layout & EMTLib::LAYOUT_CLASS ) && $classname) {
294
-    		$htmlTag .= " class=\"$classname\"";
295
-    	}
294
+			$htmlTag .= " class=\"$classname\"";
295
+		}
296 296
     	
297 297
 		return "<" . self::encrypt_tag($htmlTag) . ">$content</" . self::encrypt_tag($tag) . ">";
298
-    }
298
+	}
299 299
     
300
-    /**
301
-     * Метод, осуществляющий кодирование (сохранение) информации
302
-     * с целью невозможности типографировать ее
303
-     *
304
-     * @param 	string $text
305
-     * @return 	string
306
-     */
307
-    public static function encrypt_tag($text)
308
-    {
309
-    	return base64_encode($text)."=";
310
-    }
300
+	/**
301
+	 * Метод, осуществляющий кодирование (сохранение) информации
302
+	 * с целью невозможности типографировать ее
303
+	 *
304
+	 * @param 	string $text
305
+	 * @return 	string
306
+	 */
307
+	public static function encrypt_tag($text)
308
+	{
309
+		return base64_encode($text)."=";
310
+	}
311 311
     
312
-    /**
313
-     * Метод, осуществляющий декодирование информации
314
-     *
315
-     * @param 	string $text
316
-     * @return 	string
317
-     */
318
-    public static function decrypt_tag($text)
319
-    {
320
-    	return base64_decode(substr($text,0,-1));
321
-    }
312
+	/**
313
+	 * Метод, осуществляющий декодирование информации
314
+	 *
315
+	 * @param 	string $text
316
+	 * @return 	string
317
+	 */
318
+	public static function decrypt_tag($text)
319
+	{
320
+		return base64_decode(substr($text,0,-1));
321
+	}
322 322
     
323 323
     
324 324
     
325
-    public static function strpos_ex(&$haystack, $needle, $offset = null)
326
-    {
327
-    	if(is_array($needle))
328
-    	{
329
-    		$m = false;
330
-    		$w = false;
331
-    		foreach($needle as $n)
332
-    		{
333
-    			$p = strpos($haystack, $n , $offset);
334
-    			if($p===false) continue;
335
-    			if($m === false)
336
-    			{
337
-    				$m = $p;
338
-    				$w = $n;
339
-    				continue;
340
-    			}
341
-    			if($p < $m)
342
-    			{
343
-    				$m = $p;
344
-    				$w = $n;
345
-    			}
346
-    		}
347
-    		if($m === false) return false;
348
-    		return array('pos' => $m, 'str' => $w);
349
-    	}
350
-    	return strpos($haystack, $needle, $offset);    	
351
-    }
325
+	public static function strpos_ex(&$haystack, $needle, $offset = null)
326
+	{
327
+		if(is_array($needle))
328
+		{
329
+			$m = false;
330
+			$w = false;
331
+			foreach($needle as $n)
332
+			{
333
+				$p = strpos($haystack, $n , $offset);
334
+				if($p===false) continue;
335
+				if($m === false)
336
+				{
337
+					$m = $p;
338
+					$w = $n;
339
+					continue;
340
+				}
341
+				if($p < $m)
342
+				{
343
+					$m = $p;
344
+					$w = $n;
345
+				}
346
+			}
347
+			if($m === false) return false;
348
+			return array('pos' => $m, 'str' => $w);
349
+		}
350
+		return strpos($haystack, $needle, $offset);    	
351
+	}
352 352
     
353
-    public static function _process_selector_pattern(&$pattern)
353
+	public static function _process_selector_pattern(&$pattern)
354 354
 	{
355 355
 		if($pattern===false) return;
356 356
 		$pattern = preg_quote($pattern , '/');
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
 		return preg_match($pattern, $text);
364 364
 	}
365 365
 	
366
-    public static function strtolower($string)
367
-    { 
366
+	public static function strtolower($string)
367
+	{ 
368 368
 		$convert_to = array( 
369 369
 			"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", 
370 370
 			"v", "w", "x", "y", "z", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", 
@@ -670,28 +670,28 @@  discard block
 block discarded – undo
670 670
 	
671 671
 	public static function rstrpos ($haystack, $needle, $offset = 0){
672 672
 	    
673
-	    if(trim($haystack) != "" && trim($needle) != "" && $offset <= mb_strlen($haystack))
674
-	    {
675
-	        $last_pos = $offset;
676
-	        $found = false;
677
-	        while(($curr_pos = mb_strpos($haystack, $needle, $last_pos)) !== false)
678
-	        {
679
-	            $found = true;
680
-	            $last_pos = $curr_pos + 1;
681
-	        }
682
-	        if($found)
683
-	        {
684
-	            return $last_pos - 1;
685
-	        }
686
-	        else
687
-	        {
688
-	            return false;
689
-	        }
690
-	    }
691
-	    else
692
-	    {
693
-	        return false;
694
-	    } 
673
+		if(trim($haystack) != "" && trim($needle) != "" && $offset <= mb_strlen($haystack))
674
+		{
675
+			$last_pos = $offset;
676
+			$found = false;
677
+			while(($curr_pos = mb_strpos($haystack, $needle, $last_pos)) !== false)
678
+			{
679
+				$found = true;
680
+				$last_pos = $curr_pos + 1;
681
+			}
682
+			if($found)
683
+			{
684
+				return $last_pos - 1;
685
+			}
686
+			else
687
+			{
688
+				return false;
689
+			}
690
+		}
691
+		else
692
+		{
693
+			return false;
694
+		} 
695 695
 	}
696 696
 	
697 697
 	public static function ifop($cond, $true, $false) {
Please login to merge, or discard this patch.
EMT/EMTTret.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@
 block discarded – undo
59 59
 	 * Типы кавычек
60 60
 	 */
61 61
 	const QUOTE_FIRS_OPEN = '&laquo;';
62
-    const QUOTE_FIRS_CLOSE = '&raquo;';
63
-    const QUOTE_CRAWSE_OPEN = '&bdquo;';
64
-    const QUOTE_CRAWSE_CLOSE = '&ldquo;';
62
+	const QUOTE_FIRS_CLOSE = '&raquo;';
63
+	const QUOTE_CRAWSE_OPEN = '&bdquo;';
64
+	const QUOTE_CRAWSE_CLOSE = '&ldquo;';
65 65
 	
66 66
 	
67 67
 	private function log($str, $data = null)
Please login to merge, or discard this patch.
Twig/TypographTwigExtension.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 block discarded – undo
6 6
 
7 7
 class TypographTwigExtension extends \Twig_Extension
8 8
 {
9
-    protected $typograph;
9
+	protected $typograph;
10 10
 
11
-    public function __construct(TypographService $typograph)
12
-    {
13
-        $this->typograph = $typograph;
14
-    }
11
+	public function __construct(TypographService $typograph)
12
+	{
13
+		$this->typograph = $typograph;
14
+	}
15 15
 
16
-    public function getName()
17
-    {
18
-        return 'FenrizbesTypograph';
19
-    }
16
+	public function getName()
17
+	{
18
+		return 'FenrizbesTypograph';
19
+	}
20 20
 
21
-    public function getFilters()
22
-    {
23
-        return array(
24
-            new \Twig_SimpleFilter('typograph', array($this, 'applyTypograph'), array('is_safe' => array('html')))
25
-        );
26
-    }
21
+	public function getFilters()
22
+	{
23
+		return array(
24
+			new \Twig_SimpleFilter('typograph', array($this, 'applyTypograph'), array('is_safe' => array('html')))
25
+		);
26
+	}
27 27
 
28
-    public function applyTypograph($string, $config = null)
29
-    {
30
-        return $this->typograph->apply($string, $config);
31
-    }
28
+	public function applyTypograph($string, $config = null)
29
+	{
30
+		return $this->typograph->apply($string, $config);
31
+	}
32 32
 }
33 33
\ No newline at end of file
Please login to merge, or discard this patch.