Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
изменение системных файлов добавление снипетов
- Loading branch information
Showing
38 changed files
with
2,528 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Quick Installation and Setup quide: | ||
------------------------------------- | ||
|
||
New Install: | ||
|
||
1) Download and extract the archive. | ||
2) Create a directory called "phx" in your [MODx Directory]/assets/plugins directory | ||
3) FTP or copy the files into [MODx Directory]/assets/plugins/phx | ||
4) Create a new plugin in the manager called "PHx" and copy/paste the contents of phx.plugin.txt into the code field. | ||
5) Check "OnParseDocument" at the System Events tab | ||
|
||
Update: | ||
|
||
1) Download and extract the archive. | ||
2) Backup and delete the contents of [MODx Directory]/assets/snippets/phx | ||
3) Create a directory called "phx" in your [MODx Directory]/assets/plugins directory | ||
4) FTP or copy the files into [MODx Directory]/assets/plugins/phx | ||
5) Update the "PHx" plugin in the manager and copy/paste the contents of phx.plugin.txt into the code field. | ||
6) Check "OnParseDocument" at the System Events tab | ||
|
||
Optional steps (as of 2.0): | ||
|
||
On the Configuration tab -> Plugin configuration enter: | ||
|
||
&phxdebug=Debug;int;0 &phxmaxpass=Max. Passes;int;50 | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
/* Retrieved from http://wiki.modxcms.com/index.php/PHx/CustomModifiers | ||
* description: returns the 7bit representation of a string | ||
* usage: [+string:7bit+] | ||
*/ | ||
|
||
$text = mb_convert_encoding($output,'HTML-ENTITIES',mb_detect_encoding($output)); | ||
$text = preg_replace(array('/ß/','/&(..)lig;/','/&([aouAOU])uml;/','/&(.)[^;]*;/'),array('ss',"$1","$1".'e',"$1"),$text); | ||
return $text; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
// Retrieved from http://wiki.modxcms.com/index.php/PHx/CustomModifiers | ||
// description: parse bb code (also escapes all html and MODx tags characters) | ||
// usage: [+variable:bbcode+] | ||
|
||
$string = preg_replace("/&(#[0-9]+|[a-z]+);/i", "&$1;", htmlspecialchars($output)); | ||
$string = preg_replace('~\[b\](.+?)\[/b\]~is', '<b>\1</b>', $string); | ||
$string = preg_replace('~\[i\](.+?)\[/i\]~is', '<i>\1</i>', $string); | ||
$string = preg_replace('~\[u\](.+?)\[/u\]~is', '<u>\1</u>', $string); | ||
$string = preg_replace('~\[link\]www.(.+?)\[/link\]~is', '<a href="http://www.\1">www.\1</a>', $string); | ||
$string = preg_replace('~\[link\](.+?)\[/link\]~is', '<a href="\1">\1</a>', $string); | ||
$string = preg_replace('~\[link=(.+?)\](.+?)\[/link\]~is', '<a href="\1">\2</a>', $string); | ||
$string = preg_replace('~\[url\]www.(.+?)\[/url\]~is', '<a href="http://www.\1">www.\1</a>', $string); | ||
$string = preg_replace('~\[url\](.+?)\[/url\]~is', '<a href="\1">\1</a>', $string); | ||
$string = preg_replace('~\[url=(.+?)\](.+?)\[/url\]~is', '<a href="\1">\2</a>', $string); | ||
$string = preg_replace('~\[img\](.+?)\[/img\]~is', '<img src="\1" alt="[image]" style="margin: 5px 0px 5px 0px" />', $string); | ||
$string = preg_replace('~\[img-l\](.+?)\[/img\]~is', '<img src="\1" alt="[image]" style="border: thin solid #DFE5F2; FLOAT: left; MARGIN-RIGHT: 20px" />', $string); | ||
$string = preg_replace('~\[img-r\](.+?)\[/img\]~is', '<img src="\1" alt="[image]" style="border: thin solid #DFE5F2; FLOAT: right; MARGIN-LEFT: 20px;" />', $string); | ||
$string = str_replace(array("[","]","`"),array("[","]","`"),$string); | ||
return $string; | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
// Returns the GET parameter which has been posted as a query string | ||
// It takes the paramater name as an argument | ||
// e.g. a page with URL of http://www.whatever.com/modx?paramname=rckt | ||
// [*phx:get=`paramname`*] returns "rckt" | ||
|
||
return $_GET[$options]; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
/* | ||
* description: The opposite of the native PHX "isempty" function. Returns the option value ONLY if the input value is empty (excluding whitespace) | ||
* usage: [+string:ifnotempty=`String to return if not empty`+] | ||
*/ | ||
|
||
if (trim($output) != '') { | ||
return $options; | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
/* | ||
Retrieved from http://wiki.modxcms.com/index.php/PHx/CustomModifiers | ||
* description: Removes the http:// from a URL, to create a display-friendly web address | ||
* usage: [+string:nohttp+] | ||
*/ | ||
|
||
$url = str_replace('http://', '', $output); | ||
return $url; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
/* Retrived from http://wiki.modxcms.com/index.php/PHx/CustomModifiers | ||
* description: get specified document field from parent document (id) | ||
* usage: [+variable:parent=`field`+] | ||
* defaults to pagetitle | ||
*/ | ||
|
||
$field = (strlen($options)>0) ? $options : 'pagetitle'; | ||
$parent = $modx->getParent($output,1,$field); | ||
return $parent[$field]; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
// Returns the POST parameter which has been posted | ||
// It takes the paramater name as an argument | ||
// [*phx:post=`paramname`*] | ||
|
||
return $_POST[$options]; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
// Get the Word infested input | ||
$text = $output; | ||
|
||
// Remove font tags | ||
$text = strip_selected_tags($text, "<font>"); | ||
|
||
// Remove weird quotes and accents | ||
// http://uk3.php.net/manual/en/function.preg-replace.php#64828 | ||
$text = preg_replace('/([\xc0-\xdf].)/se', "'&#' . ((ord(substr('$1', 0, 1)) - 192) * 64 + (ord(substr('$1', 1, 1)) - 128)) . ';'", $text); | ||
$text = preg_replace('/([\xe0-\xef]..)/se', "'&#' . ((ord(substr('$1', 0, 1)) - 224) * 4096 + (ord(substr('$1', 1, 1)) - 128) * 64 + (ord(substr('$1', 2, 1)) - 128)) . ';'", $text); | ||
|
||
// Strip inline styles | ||
$text = strip_styles($text); | ||
|
||
// Remove class="MsoNormal" | ||
$text = str_replace('class="MsoNormal"', '', $text); | ||
|
||
// Return it | ||
return $text; | ||
|
||
|
||
|
||
/** | ||
* strip_selected_tags ( string str [, string strip_tags[, strip_content flag]] ) | ||
* --------------------------------------------------------------------- | ||
* Like strip_tags() but inverse; the strip_tags tags will be stripped, not kept. | ||
* strip_tags: string with tags to strip, ex: "<a><p><quote>" etc. | ||
* strip_content flag: TRUE will also strip everything between open and closed tag | ||
* http://uk3.php.net/manual/en/function.preg-replace.php#71266 | ||
*/ | ||
function strip_selected_tags($str, $tags = "", $stripContent = false) | ||
{ | ||
preg_match_all("/<([^>]+)>/i", $tags, $allTags, PREG_PATTERN_ORDER); | ||
foreach ($allTags[1] as $tag) { | ||
$replace = "%(<$tag.*?>)(.*?)(<\/$tag.*?>)%is"; | ||
if ($stripContent) { | ||
$str = preg_replace($replace,'',$str); | ||
} | ||
$str = preg_replace($replace,'${2}',$str); | ||
} | ||
return $str; | ||
} | ||
|
||
|
||
|
||
|
||
// Remove styles | ||
// http://uk3.php.net/manual/en/function.preg-replace.php#63219 | ||
|
||
function strip_styles($source=NULL) { | ||
$exceptions = str_replace(',', '|', 'text-align'); | ||
|
||
/* First we want to fix anything that might potentially break the styler stripper, sow e try and replace | ||
* in-text instances of : with its html entity replacement. | ||
*/ | ||
|
||
function Replacer($text) { | ||
$check = array ( | ||
'@:@s', | ||
); | ||
$replace = array( | ||
':', | ||
); | ||
|
||
return preg_replace($check, $replace, $text[0]); | ||
} | ||
|
||
$source = preg_replace_callback('@>(.*)<@Us', 'Replacer', $source); | ||
$regexp = '@([^;"]+)?(?<!'. $exceptions. ')(?<!\>\w):(?!\/\/(.+?)\/|<|>)((.*?)[^;"]+)(;)?@is'; | ||
$source = preg_replace($regexp, '', $source); | ||
$source = preg_replace('@[a-z]*=""@is', '', $source); | ||
|
||
return $source; | ||
} | ||
|
||
|
||
?> | ||
?> |
Oops, something went wrong.