Skip to content

Commit 5cf730a

Browse files
committedOct 27, 2011
изменение системных файлов добавление снипетов
1 parent 8b225c2 commit 5cf730a

38 files changed

+2528
-63
lines changed
 

Diff for: ‎README

+38-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@
1313

1414

1515
-------Изменение системных файлов----------------
16+
-поправил robot.txt
1617
-транслитерация файлов в менеджере картинко и файлов
1718
-wait.static.php - ускоряем переход на главную при сохранении
19+
-jot обновил шаблоны
20+
-правка managermanager - глюк тв параметра с картинкой mm_widget_showimagetvs
21+
-ditto отключение пагинации если 1 страничка (ditto.class.inc.php)
22+
-ditto замена ?=& при работе с @CODE на |xq|','|xe|','|xa| (template.class.inc.php)
23+
-transalias - правильная транслитерация по умолчанию
1824

1925

2026
------------------------Шаблоны----------------
@@ -33,20 +39,51 @@
3339
-MultiFiles 1.11
3440
-MultiPhotos 1.22
3541
-TvTable 1.1
42+
-aDate - вывод русской даты
43+
-GetField 1.3
44+
-parentTitle - получаем pagetitle парента
45+
-sitemap.xml 1.0.8
46+
-splitPagination 2.0 - красивая пагинация для Ditto
47+
-YouTube 0.1
3648

3749

3850
------------------------Плагины----------------
3951
-добавил плагин seo_strict_urls
4052
-добавил codemirror (подсветка кода)
4153
-TvTable 1.11
42-
-MultiFiles 1.01
54+
-MultiFiles 1.01
4355
-MultiPhotos 1.23
56+
-customTemplate 0.1
57+
-devStat 1.0
58+
-PHx 2.1.4
59+
4460

4561

4662
-------------------------Модули----------------
4763
-добавил Модуль doc finder
4864
-добавил Модуль mass redirect
4965

66+
67+
----------------Экстендеры для Ditto---------
68+
-customsort
69+
-distinct
70+
-jotcount
71+
-tvFilter
72+
-glossaryFilter
73+
74+
--------------setup.sql----------------------
75+
-Default admin account -> admin
76+
-My MODx site -> MODx Site By Dmi3yy
77+
-Шаблон по умолчанию СОСЕДНИЙ
78+
-Опубликованно по умолчанию
79+
-Дружественные урлы ВКЛ с вложенностью
80+
-капча 0,1,2,3,4,5,6,7,8,9
81+
-запоминать вкладки ДА
82+
83+
84+
85+
86+
5087

5188

5289
своя сборка modx

Diff for: ‎assets/plugins/managermanager/widgets/showimagetvs/showimagetvs.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ function mm_widget_showimagetvs($tvs='', $w=300, $h=100, $thumbnailerUrl='', $ro
7979
});
8080
}
8181
82-
}); // Trigger a change event on load
82+
$j.data(this,"lastvalue", $j(this).val());
83+
}).trigger("load"); // Trigger a change event on load
8384
8485
8586
';
@@ -94,7 +95,7 @@ function mm_widget_showimagetvs($tvs='', $w=300, $h=100, $thumbnailerUrl='', $ro
9495
$j(".imageField").each( function() {
9596
var $this = $j(this);
9697
if ($this.val() != $this.data("lastvalue") ) {
97-
$this.trigger("change").data("lastvalue", $this.val());
98+
$this.trigger("change");
9899
}
99100
});
100101
}

Diff for: ‎assets/plugins/phx/docs/install.txt

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Quick Installation and Setup quide:
2+
-------------------------------------
3+
4+
New Install:
5+
6+
1) Download and extract the archive.
7+
2) Create a directory called "phx" in your [MODx Directory]/assets/plugins directory
8+
3) FTP or copy the files into [MODx Directory]/assets/plugins/phx
9+
4) Create a new plugin in the manager called "PHx" and copy/paste the contents of phx.plugin.txt into the code field.
10+
5) Check "OnParseDocument" at the System Events tab
11+
12+
Update:
13+
14+
1) Download and extract the archive.
15+
2) Backup and delete the contents of [MODx Directory]/assets/snippets/phx
16+
3) Create a directory called "phx" in your [MODx Directory]/assets/plugins directory
17+
4) FTP or copy the files into [MODx Directory]/assets/plugins/phx
18+
5) Update the "PHx" plugin in the manager and copy/paste the contents of phx.plugin.txt into the code field.
19+
6) Check "OnParseDocument" at the System Events tab
20+
21+
Optional steps (as of 2.0):
22+
23+
On the Configuration tab -> Plugin configuration enter:
24+
25+
&phxdebug=Debug;int;0 &phxmaxpass=Max. Passes;int;50
26+
27+
28+
29+
30+
31+

Diff for: ‎assets/plugins/phx/modifiers/7bit.phx.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
/* Retrieved from http://wiki.modxcms.com/index.php/PHx/CustomModifiers
4+
* description: returns the 7bit representation of a string
5+
* usage: [+string:7bit+]
6+
*/
7+
8+
$text = mb_convert_encoding($output,'HTML-ENTITIES',mb_detect_encoding($output));
9+
$text = preg_replace(array('/&szlig;/','/&(..)lig;/','/&([aouAOU])uml;/','/&(.)[^;]*;/'),array('ss',"$1","$1".'e',"$1"),$text);
10+
return $text;
11+
12+
?>

Diff for: ‎assets/plugins/phx/modifiers/bbcode.phx.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
// Retrieved from http://wiki.modxcms.com/index.php/PHx/CustomModifiers
4+
// description: parse bb code (also escapes all html and MODx tags characters)
5+
// usage: [+variable:bbcode+]
6+
7+
$string = preg_replace("/&amp;(#[0-9]+|[a-z]+);/i", "&$1;", htmlspecialchars($output));
8+
$string = preg_replace('~\[b\](.+?)\[/b\]~is', '<b>\1</b>', $string);
9+
$string = preg_replace('~\[i\](.+?)\[/i\]~is', '<i>\1</i>', $string);
10+
$string = preg_replace('~\[u\](.+?)\[/u\]~is', '<u>\1</u>', $string);
11+
$string = preg_replace('~\[link\]www.(.+?)\[/link\]~is', '<a href="http://www.\1">www.\1</a>', $string);
12+
$string = preg_replace('~\[link\](.+?)\[/link\]~is', '<a href="\1">\1</a>', $string);
13+
$string = preg_replace('~\[link=(.+?)\](.+?)\[/link\]~is', '<a href="\1">\2</a>', $string);
14+
$string = preg_replace('~\[url\]www.(.+?)\[/url\]~is', '<a href="http://www.\1">www.\1</a>', $string);
15+
$string = preg_replace('~\[url\](.+?)\[/url\]~is', '<a href="\1">\1</a>', $string);
16+
$string = preg_replace('~\[url=(.+?)\](.+?)\[/url\]~is', '<a href="\1">\2</a>', $string);
17+
$string = preg_replace('~\[img\](.+?)\[/img\]~is', '<img src="\1" alt="[image]" style="margin: 5px 0px 5px 0px" />', $string);
18+
$string = preg_replace('~\[img-l\](.+?)\[/img\]~is', '<img src="\1" alt="[image]" style="border: thin solid #DFE5F2; FLOAT: left; MARGIN-RIGHT: 20px" />', $string);
19+
$string = preg_replace('~\[img-r\](.+?)\[/img\]~is', '<img src="\1" alt="[image]" style="border: thin solid #DFE5F2; FLOAT: right; MARGIN-LEFT: 20px;" />', $string);
20+
$string = str_replace(array("[","]","`"),array("&#91;","&#93;","&#96;"),$string);
21+
return $string;
22+
23+
24+
?>

Diff for: ‎assets/plugins/phx/modifiers/get.phx.php

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
// Returns the GET parameter which has been posted as a query string
4+
// It takes the paramater name as an argument
5+
// e.g. a page with URL of http://www.whatever.com/modx?paramname=rckt
6+
// [*phx:get=`paramname`*] returns "rckt"
7+
8+
return $_GET[$options];
9+
10+
?>

Diff for: ‎assets/plugins/phx/modifiers/ifnotempty.phx.php

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
/*
3+
* description: The opposite of the native PHX "isempty" function. Returns the option value ONLY if the input value is empty (excluding whitespace)
4+
* usage: [+string:ifnotempty=`String to return if not empty`+]
5+
*/
6+
7+
if (trim($output) != '') {
8+
return $options;
9+
}
10+
?>

Diff for: ‎assets/plugins/phx/modifiers/nohttp.phx.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
/*
4+
Retrieved from http://wiki.modxcms.com/index.php/PHx/CustomModifiers
5+
* description: Removes the http:// from a URL, to create a display-friendly web address
6+
* usage: [+string:nohttp+]
7+
8+
*/
9+
10+
$url = str_replace('http://', '', $output);
11+
return $url;
12+
?>

Diff for: ‎assets/plugins/phx/modifiers/parent.phx.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
/* Retrived from http://wiki.modxcms.com/index.php/PHx/CustomModifiers
4+
* description: get specified document field from parent document (id)
5+
* usage: [+variable:parent=`field`+]
6+
* defaults to pagetitle
7+
*/
8+
9+
$field = (strlen($options)>0) ? $options : 'pagetitle';
10+
$parent = $modx->getParent($output,1,$field);
11+
return $parent[$field];
12+
13+
?>

Diff for: ‎assets/plugins/phx/modifiers/post.phx.php

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
// Returns the POST parameter which has been posted
4+
// It takes the paramater name as an argument
5+
// [*phx:post=`paramname`*]
6+
7+
return $_POST[$options];
8+
9+
?>

Diff for: ‎assets/plugins/phx/modifiers/tidyword.phx.php

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
// Get the Word infested input
3+
$text = $output;
4+
5+
// Remove font tags
6+
$text = strip_selected_tags($text, "<font>");
7+
8+
// Remove weird quotes and accents
9+
// http://uk3.php.net/manual/en/function.preg-replace.php#64828
10+
$text = preg_replace('/([\xc0-\xdf].)/se', "'&#' . ((ord(substr('$1', 0, 1)) - 192) * 64 + (ord(substr('$1', 1, 1)) - 128)) . ';'", $text);
11+
$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);
12+
13+
// Strip inline styles
14+
$text = strip_styles($text);
15+
16+
// Remove class="MsoNormal"
17+
$text = str_replace('class="MsoNormal"', '', $text);
18+
19+
// Return it
20+
return $text;
21+
22+
23+
24+
/**
25+
* strip_selected_tags ( string str [, string strip_tags[, strip_content flag]] )
26+
* ---------------------------------------------------------------------
27+
* Like strip_tags() but inverse; the strip_tags tags will be stripped, not kept.
28+
* strip_tags: string with tags to strip, ex: "<a><p><quote>" etc.
29+
* strip_content flag: TRUE will also strip everything between open and closed tag
30+
* http://uk3.php.net/manual/en/function.preg-replace.php#71266
31+
*/
32+
function strip_selected_tags($str, $tags = "", $stripContent = false)
33+
{
34+
preg_match_all("/<([^>]+)>/i", $tags, $allTags, PREG_PATTERN_ORDER);
35+
foreach ($allTags[1] as $tag) {
36+
$replace = "%(<$tag.*?>)(.*?)(<\/$tag.*?>)%is";
37+
if ($stripContent) {
38+
$str = preg_replace($replace,'',$str);
39+
}
40+
$str = preg_replace($replace,'${2}',$str);
41+
}
42+
return $str;
43+
}
44+
45+
46+
47+
48+
// Remove styles
49+
// http://uk3.php.net/manual/en/function.preg-replace.php#63219
50+
51+
function strip_styles($source=NULL) {
52+
$exceptions = str_replace(',', '|', 'text-align');
53+
54+
/* First we want to fix anything that might potentially break the styler stripper, sow e try and replace
55+
* in-text instances of : with its html entity replacement.
56+
*/
57+
58+
function Replacer($text) {
59+
$check = array (
60+
'@:@s',
61+
);
62+
$replace = array(
63+
'&#58;',
64+
);
65+
66+
return preg_replace($check, $replace, $text[0]);
67+
}
68+
69+
$source = preg_replace_callback('@>(.*)<@Us', 'Replacer', $source);
70+
$regexp = '@([^;"]+)?(?<!'. $exceptions. ')(?<!\>\w):(?!\/\/(.+?)\/|<|>)((.*?)[^;"]+)(;)?@is';
71+
$source = preg_replace($regexp, '', $source);
72+
$source = preg_replace('@[a-z]*=""@is', '', $source);
73+
74+
return $source;
75+
}
76+
77+
78+
?>
79+
?>

Diff for: ‎assets/plugins/phx/phx.parser.class.inc.php

+446
Large diffs are not rendered by default.

Diff for: ‎assets/plugins/phx/phx.plugin.txt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//<?php
2+
/**
3+
* phx
4+
*
5+
* (Placeholders Xtended) Adds the capability of output modifiers when using placeholders, template variables and settings tags
6+
*
7+
* @category plugin
8+
* @version 2.1.4
9+
* @author Armand "bS" Pondman (apondman@zerobarrier.nl)
10+
* @internal @properties &phxdebug=Log events;int;0 &phxmaxpass=Max. Passes;int;50
11+
* @internal @events OnParseDocument
12+
* @internal @modx_category Manager and Admin
13+
*/
14+
15+
include_once $modx->config['rb_base_dir'] . "plugins/phx/phx.parser.class.inc.php";
16+
17+
$e = &$modx->Event;
18+
19+
$PHx = new PHxParser($phxdebug,$phxmaxpass);
20+
21+
switch($e->name) {
22+
case 'OnParseDocument':
23+
$PHx->OnParseDocument();
24+
break;
25+
26+
}

Diff for: ‎assets/snippets/ditto/classes/ditto.class.inc.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -1131,14 +1131,17 @@ function paginate($start, $stop, $total, $summarize, $tplPaginateNext, $tplPagin
11311131
$pages .= $this->template->replace(array('page'=>$display),$tplPaginateCurrentPage);
11321132
}
11331133
}
1134-
$modx->setPlaceholder($dittoID."next", $nextplaceholder);
1135-
$modx->setPlaceholder($dittoID."previous", $previousplaceholder);
1134+
1135+
if ($totalpages>1){
1136+
$modx->setPlaceholder($dittoID."next", $nextplaceholder);
1137+
$modx->setPlaceholder($dittoID."previous", $previousplaceholder);
1138+
$modx->setPlaceholder($dittoID."pages", $pages);
1139+
}
11361140
$modx->setPlaceholder($dittoID."splitter", $split);
11371141
$modx->setPlaceholder($dittoID."start", $start +1);
11381142
$modx->setPlaceholder($dittoID."urlStart", $start);
11391143
$modx->setPlaceholder($dittoID."stop", $limiter);
11401144
$modx->setPlaceholder($dittoID."total", $total);
1141-
$modx->setPlaceholder($dittoID."pages", $pages);
11421145
$modx->setPlaceholder($dittoID."perPage", $summarize);
11431146
$modx->setPlaceholder($dittoID."totalPages", $totalpages);
11441147
$modx->setPlaceholder($dittoID."ditto_pagination_set", true);

Diff for: ‎assets/snippets/ditto/classes/template.class.inc.php

+22-18
Original file line numberDiff line numberDiff line change
@@ -194,24 +194,28 @@ function determine($templates,$x,$start,$stop,$id) {
194194
//
195195
// http://modxcms.com/forums/index.php/topic,5344.msg41096.html#msg41096
196196
// ---------------------------------------------------
197-
function fetch($tpl){
198-
global $modx;
199-
$template = "";
200-
if ($modx->getChunk($tpl) != "") {
201-
$template = $modx->getChunk($tpl);
202-
} else if(substr($tpl, 0, 6) == "@FILE:") {
203-
$template = $this->get_file_contents(substr($tpl, 6));
204-
} else if(substr($tpl, 0, 6) == "@CODE:") {
205-
$template = substr($tpl, 6);
206-
} else if(substr($tpl, 0, 5) == "@FILE") {
207-
$template = $this->get_file_contents(trim(substr($tpl, 5)));
208-
} else if(substr($tpl, 0, 5) == "@CODE") {
209-
$template = trim(substr($tpl, 5));
210-
} else {
211-
$template = $this->language['missing_placeholders_tpl'];
212-
}
213-
return $template;
214-
}
197+
function fetch($tpl){
198+
global $modx;
199+
$template = "";
200+
if ($modx->getChunk($tpl) != "") {
201+
$template = $modx->getChunk($tpl);
202+
} else if(substr($tpl, 0, 6) == "@FILE:") {
203+
$template = $this->get_file_contents(substr($tpl, 6));
204+
} else if(substr($tpl, 0, 6) == "@CODE:") {
205+
$template = substr($tpl, 6);
206+
//Taken from feedx snippe
207+
$template = str_replace(array('|xq|','|xe|','|xa|'), array('?','=','&'), $template);
208+
} else if(substr($tpl, 0, 5) == "@FILE") {
209+
$template = $this->get_file_contents(trim(substr($tpl, 5)));
210+
} else if(substr($tpl, 0, 5) == "@CODE") {
211+
$template = trim(substr($tpl, 5));
212+
//Taken from feedx snippet
213+
$template = str_replace(array('|xq|','|xe|','|xa|'), array('?','=','&'), $template);
214+
} else {
215+
$template = $this->language['missing_placeholders_tpl'];
216+
}
217+
return $template;
218+
}
215219

216220
// ---------------------------------------------------
217221
// Function: get_file_contents
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
if (!function_exists('customsort'))
4+
{
5+
function customsort($a, $b)
6+
{
7+
$pos_a=array_search($a['id'],$GLOBALS['documents']);
8+
$pos_b=array_search($b['id'],$GLOBALS['documents']);
9+
10+
if ($pos_a == $pos_b)
11+
{
12+
return 0;
13+
}
14+
return ($pos_a < $pos_b)?-1:1;
15+
}
16+
}
17+
18+
$GLOBALS['documents']=explode(',',$documents);
19+
$orderBy["custom"][] = array ("id", "customsort");
20+
$ditto->advSort = true;
21+
22+
?>
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
3+
/*
4+
* Title: Distinct
5+
* Purpose:
6+
* Return only distinct / unique results, based on a fieldname supplied as &distinct parameter
7+
* Version: 1.0.1
8+
* Author: Nick Crossland (ncrossland)
9+
* Installation: Put file "distinct.extender.inc.php" into /assets/snippets/ditto/extenders
10+
* Usage: In the Ditto call, add "distinct" to the extenders param, and specify the &distinct parameter with the name(s) of the field which you would like to be unique.
11+
* If you would like to make the combined values of more than one field unique, separate them with commas
12+
* e.g. [[Ditto? &tpl=`myTemplate` &extenders=`distinct` &distinct=`pagetitle`]] -- will return only unique page titles.
13+
* e.g. [[Ditto? &tpl=`myTemplate` &extenders=`distinct` &distinct=`pagetitle,pub_date`]] -- will return only unique page titles for each date.
14+
*
15+
* Changelog:
16+
* 1.0: initial release
17+
* 1.0.1: Bugfixes only
18+
*/
19+
20+
21+
$distinct = isset($distinct) ? $distinct : false;
22+
/*
23+
Param: distinct
24+
25+
Purpose:
26+
What field should we search for being distinct?
27+
28+
Options:
29+
Fieldname
30+
31+
Default:
32+
"default"
33+
*/
34+
35+
36+
// If no fieldname value has been supplied, don't do anything else
37+
if ($distinct === false) {
38+
return false;
39+
}
40+
41+
// It would be nice if this was class based, so it doesn't pollute the global namespace
42+
// But - create an array of document values we've seen, and the fieldnames we're making distinct
43+
global $seen;
44+
global $distinct_fieldname;
45+
$distinct_fieldname = explode(',',$distinct);
46+
47+
// Remove any extra spaces from the fieldnames (in case they have been supplied with commas and spaces)
48+
$distinct_fieldname = array_map('trim', $distinct_fieldname);
49+
50+
51+
// The filter function
52+
if (!function_exists("makeDistinct")) {
53+
54+
function makeDistinct($resource) {
55+
global $seen;
56+
global $distinct_fieldname;
57+
58+
// Make a unique string based on the fieldname and value of each field we've been asked to make distinct
59+
$distinct_string = '';
60+
foreach ($distinct_fieldname as $f) {
61+
$distinct_string .= '~'. $f.'|'.$resource[$f];
62+
}
63+
64+
// Check if this string has been seen yet -- if it has, don't include it in the results
65+
if (isset($seen[$distinct_string]) && ($seen[$distinct_string])==true ) { // If this value of the fieldname has been seen before, remove it from the list
66+
return false;
67+
} else {
68+
$seen[$distinct_string] = true; // Otherwise, remember the value has been seen, and allow it in the list (this time)
69+
return true;
70+
}
71+
72+
}
73+
}
74+
75+
// Add the custom function
76+
$filters["custom"]["distinct"] = array(implode(',',$distinct_fieldname) ,"makeDistinct");
77+
78+
79+
?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/*
3+
* Ditto Extender: glossaryFilter - advanced filtering of documents
4+
* Released under the terms of General Public License
5+
* Copyright (c) 2010 Aleksander Maksymiuk, http://setpro.pl/
6+
7+
* Last modified: 2010-08-30, 23:53
8+
9+
* Parameters:
10+
* filterVar - optional; documents attribute or template variable used for matching (default: pagetitle)
11+
* notice: you should rather avoid to use content field for this purpose
12+
* filterMode - optional; specifies how matching should be performed
13+
* possible values are:
14+
* class (default) - match with RegExp /^[...]/i where ... is substituted with the value of filterBy parameter
15+
* custom - match with full-fledged RegExp provided with filterBy parameter
16+
* chunk - match with full-fledged RegExp privided with a chunk whose name is kept within filterBy parameter
17+
* filterBy - optional, however, you SHOULD specify at least this one parameter, otherwise extender does no filtering
18+
* forceUTF8 - optional; specifies whether filterBy value should be treated as UTF-8 string or not
19+
* it affects extender's behavior while running in class mode
20+
* possible values are: 0, 1 (default: 0)
21+
* Example:
22+
* fetch documents within 3, 4, and 5 containers whose pagetitles start with A, B, C, or D
23+
* [[Ditto? &parents=`3,4,5` &depth=`0` &display=`all` &extenders=`glossaryFilter` &filterBy=`A-D` &tpl=`...` ...]]
24+
* fetch documents within 3, 4, and 5 containers whose aliases do not start with numeric
25+
* [[Ditto? &parents=`3,4,5` &depth=`0` &display=`all` &extenders=`glossaryFilter` &filterVar=`alias` &filterBy=`^0-9` &tpl=`...` ...]]
26+
* Full article, sample implementations, downloading latest version:
27+
* http://setpro.pl/software/ditto-stuff/glossary-extender
28+
*/
29+
30+
$GLOBALS['filterVar'] = isset($filterVar) ? $filterVar : 'pagetitle';
31+
$GLOBALS['filterMode'] = isset($filterMode) && preg_match('/^(chunk|class|custom)$/', $filterMode) ? $filterMode : 'class';
32+
$GLOBALS['filterBy'] = isset($filterBy) ? $filterBy : '';
33+
$GLOBALS['forceUTF8'] = isset($forceUTF8) ? $forceUTF8 : 0;
34+
if ($GLOBALS['filterMode'] == 'chunk') {
35+
$GLOBALS['filterBy'] = $modx->getChunk($GLOBALS['filterBy']);
36+
}
37+
$GLOBALS['forceUTF8'] = $GLOBALS['forceUTF8'] ? 'u' : '';
38+
39+
$filters['custom']['glossaryFilter'] = array($GLOBALS['filterVar'], 'glossaryFilter');
40+
41+
if (!function_exists('glossaryFilter')) {
42+
function glossaryFilter($resource) {
43+
if (!$GLOBALS['filterBy']) {
44+
# do nothing (simply leave document within final dataset)
45+
return 1;
46+
}
47+
$regExpBegin = preg_match('/^(chunk|custom)$/', $GLOBALS['filterMode']) ? '' : '/^[';
48+
$regExpEnd = preg_match('/^(chunk|custom)$/', $GLOBALS['filterMode']) ? '' : ']/i' . $GLOBALS['forceUTF8'];
49+
# do filtering
50+
return preg_match($regExpBegin . $GLOBALS['filterBy'] . $regExpEnd, $resource[$GLOBALS['filterVar']]) ? 1 : 0;
51+
}
52+
}
53+
54+
?>
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
// çàïðàøèâàåì êîììåíòàðèè èç áàçû, ïîïóòíî ñ÷èòàÿ èõ êîëè÷åñòâî ÷åðåç COUNT(*) (óäàëåííûå è íåîïóáëèêîâàííûå íå ñ÷èòàåì)
3+
$result = $modx->db->select('uparent, COUNT(*)', $modx->getFullTableName("jot_content"), 'published=1 AND deleted=0 GROUP BY uparent', 'COUNT(*) DESC');
4+
$counts = $modx->db->makeArray( $result );
5+
6+
// ïðèâîäèì ìàññèâ â âèä document_id => comments_count
7+
$jotcount = array();
8+
foreach($counts as $k=>$v) $jotcount[$v['uparent']] = $v['COUNT(*)'];
9+
// íåêðàñèâî "ãëîáàëèçóåì" ìàññèâ äëÿ âûçîâà èç ôóíêöèè jotph()
10+
$GLOBALS['jotcount'] = $jotcount;
11+
12+
// äîáàâëÿåì îáðàáîò÷èê ïëåéñõîëäåðà [+jotcount+] â ditto
13+
$placeholders['jotcount'] = array(array("id","*"),"jotph","id");
14+
15+
// ôóêíöèÿ, çàïîëíÿþùàÿ [+jotcount+] äëÿ âûâîäà â øàáëîíå &tpl
16+
if(!function_exists("jotph")) {
17+
function jotph($resource) {
18+
global $jotcount;
19+
if(!$r = $jotcount[$resource['id']]) $r = 0;
20+
return $r;
21+
}
22+
}
23+
?>
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/*
3+
* Ditto Extender: tvFilter
4+
* Filters out documents by TV assignment
5+
* Copyright (c) 2009-2010 Aleksander Maksymiuk, http://setpro.net.pl/
6+
* Parameters:
7+
* tvFilterBy - TV name to filter by (required)
8+
* tvFilterMode
9+
* 1: excludes document if it has the requested TV assigned (default)
10+
* 0: excludes document if it has not the requested TV assigned
11+
* Example: display all documents within 3, 4, and 5 containers that are not linked with dummy TV
12+
* [[Ditto? &parents=`3,4,5` &display=`all` &tpl=`...` &extenders=`tvFilter` &tvFilerBy=`dummy` tvFilterMode=`0`]]
13+
*/
14+
15+
$GLOBALS['tvFilterBy'] = isset($tvFilterBy) ? $tvFilterBy : '';
16+
$GLOBALS['tvFilterMode'] = isset($tvFilterMode) ? $tvFilterMode : 1;
17+
18+
$filters['custom']['tvFilter'] = array('template', 'tvFilter');
19+
20+
if (!function_exists('tvFilter')) {
21+
function tvFilter($resource) {
22+
global $modx;
23+
if (!$GLOBALS['tvFilterBy']) {
24+
# do nothing (leave document within result set)
25+
return 1;
26+
}
27+
$sql = "SELECT " . $modx->getFullTableName('site_tmplvars') . ".id " .
28+
"FROM " . $modx->getFullTableName('site_tmplvars') . " " .
29+
"INNER JOIN " . $modx->getFullTableName('site_tmplvar_templates') . " " .
30+
"ON " . $modx->getFullTableName('site_tmplvars') . ".id = " . $modx->getFullTableName('site_tmplvar_templates') . ".tmplvarid " .
31+
"WHERE (" . $modx->getFullTableName('site_tmplvars') . ".name = '" . $GLOBALS['tvFilterBy'] . "') AND (" . $modx->getFullTableName('site_tmplvar_templates') . ".templateid = '" . $resource['template'] . "')";
32+
return $GLOBALS['tvFilterMode'] ? !mysql_numrows(mysql_query($sql)) : mysql_numrows(mysql_query($sql));
33+
}
34+
}
35+
36+
?>

Diff for: ‎assets/snippets/getfield/GetField.tpl

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/*
3+
==================================================
4+
GetField
5+
==================================================
6+
7+
Returns any document field or template variable from any document or any of its parents.
8+
9+
Author: Grzegorz Adamiak [grad]
10+
Version: 1.3 beta @2006-11-08 14:40:04
11+
License: LGPL
12+
MODx: 0.9.2.1+
13+
14+
See GetField.txt for instructions and version history.
15+
--------------------------------------------------
16+
*/
17+
18+
/* Parameters
19+
----------------------------------------------- */
20+
21+
# $docid [ int ]
22+
# ID of the document for which to get a field content.
23+
# Default: current document
24+
25+
$gfIntDocId = (isset($docid)) ? $docid : $modx->documentIdentifier;
26+
27+
# $field [ string ]
28+
# Name of the field for which to get the content:
29+
# - any of the document object fields (http://modxcms.com/the-document-object.html)
30+
# - template variable
31+
# Default: 'pagetitle'
32+
33+
$gfStrDocField = (isset($field)) ? trim($field) : 'pagetitle';
34+
35+
# $parent [ 0 | 1 ]
36+
# If set to 1, the snippet will return value for the document parent.
37+
# Default: 0
38+
39+
$gfBoolParent = (isset($parent)) ? $parent : 0;
40+
41+
# $parentLevel [ int ]
42+
# Specifies how high in the document tree to search for the parent of the document:
43+
# - $parentLevel = 0 - returns the ultimate parent (right under site root)
44+
# - $parentLevel = 1 - returns the direct parent
45+
# Default: 0
46+
47+
$gfIntParentLevel = (isset($parentLevel) && is_int((int) $parentLevel)) ? $parentLevel : 0;
48+
49+
# $topid [ int ]
50+
# Id of the topmost document in the document tree under which to search for a parent. Used only with $parent set to 1.
51+
# Default: 0
52+
53+
$gfIntTopDocId = (isset($topid) && is_int((int) $topid)) ? $topid : 0;
54+
55+
/* Do not edit the code below!
56+
----------------------------------------------- */
57+
58+
# Include logic
59+
include_once('assets/snippets/getfield/getfield.inc.php');
60+
61+
# Get parent document ID
62+
if ($gfBoolParent)
63+
$gfIntDocId = gfGetParentId($modx, $gfIntDocId, $gfIntTopDocId, $gfIntParentLevel);
64+
65+
# Get content of the field
66+
$output = gfGetFieldContent($modx,$gfIntDocId,$gfStrDocField);
67+
68+
unset($gfIntDocId, $gfStrDocField, $gfBoolParent, $gfIntParentLevel, $gfIntTopDocId);
69+
70+
return $output;
71+
?>

Diff for: ‎assets/snippets/getfield/getfield.inc.php

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?php
2+
/*
3+
==================================================
4+
GetField
5+
==================================================
6+
7+
Returns any document field or template variable from any document or any of its parents.
8+
9+
Author: Grzegorz Adamiak [grad]
10+
Version: 1.3 beta @2006-11-08 14:40:04
11+
License: LGPL
12+
MODx: 0.9.2.1+
13+
14+
See GetField.txt for instructions and version history.
15+
--------------------------------------------------
16+
*/
17+
18+
unset($docid, $field, $parent, $parentLevel, $topid);
19+
20+
# GetField functions
21+
# ---------------------------------------------
22+
23+
# gfGetFieldContent
24+
# Returns the inherited value of any content field
25+
if (!function_exists(gfGetFieldContent))
26+
{
27+
function gfGetFieldContent($modx,$gfIntDocId,$gfStrDocField)
28+
{
29+
/* apparently in 0.9.2.1 the getTemplateVarOutput function doesn't work as expected and doesn't return INHERITED value; this is probably to be fixed for next release; see http://modxcms.com/bugs/task/464
30+
$gfArrTV = $modx->getTemplateVarOutput($gfStrDocField,$gfIntDocId);
31+
return $gfArrTV[$gfStrDocField];
32+
*/
33+
34+
while ($gfArrParent = $modx->getDocument($gfIntDocId,'parent'))
35+
{
36+
$gfArrTV = $modx->getTemplateVar($gfStrDocField,'*',$gfIntDocId);
37+
if (($gfArrTV['value'] && substr($gfArrTV['value'],0,8) != '@INHERIT') or !$gfArrTV['value']) // tv default value is overriden (including empty)
38+
{
39+
$output = $modx->getTemplateVarOutput($gfStrDocField,$gfIntDocId);
40+
$output = $output[$gfStrDocField];
41+
break;
42+
}
43+
else // there is no parent with default value overriden
44+
{
45+
$output = trim(substr($gfArrTV['value'],8));
46+
}
47+
$gfIntDocId = $gfArrParent['parent']; // move up one document in document tree
48+
} // end while
49+
50+
return $output;
51+
}
52+
}
53+
54+
# gfGetParentId
55+
# Returns the parent document ID
56+
if (!function_exists(gfGetParentId))
57+
{
58+
function gfGetParentId($modx, $gfIntDocId, $gfIntTopDocId, $gfIntParentLevel)
59+
{
60+
# build an array of document ancestors IDs
61+
$gfArrParentIds = array (); // initialize;
62+
$gfArrParentIds[] = $gfIntDocId; // add the specified document ID on first place
63+
64+
// get IDs of all parents back to root of the document tree
65+
while (($gfArrParent = $modx->getDocument($gfIntDocId,'parent')) && ($gfArrParent['parent'] != 0))
66+
{
67+
$gfIntDocId = $gfArrParent['parent']; // move up one document in the document tree
68+
$gfArrParentIds[] = $gfIntDocId; // add parent ID to the array
69+
} // end while
70+
unset($gfIntDocId, $gfArrParent);
71+
72+
$gfIntParentsCount = count($gfArrParentIds); // number of the parents
73+
74+
# determine the ID of the specified parent
75+
switch ($gfIntTopDocId)
76+
{
77+
case 0: // not set or set to the root of the document tree
78+
79+
($gfIntParentLevel && ($gfIntParentLevel < $gfIntParentsCount)) ?
80+
($gfIntDocId = $gfArrParentIds[$gfIntParentLevel]) : // find parent in specified levels up
81+
($gfIntDocId = $gfArrParentIds[$gfIntParentsCount - 1]); // if not set return the topmost (ultimate) parent
82+
83+
break;
84+
85+
default: // set to any other document
86+
87+
$gfIntParentKey = array_search($gfIntTopDocId, $gfArrParentIds); // find the index of parent
88+
switch ($gfIntParentKey)
89+
{
90+
case 0: // not an ancestor or the document itself
91+
92+
$gfIntDocId = 0;
93+
break;
94+
95+
default: // parent is above the document in document tree
96+
97+
($gfIntParentLevel && ($gfIntParentLevel < $gfIntParentKey)) ?
98+
($gfIntDocId = $gfArrParentIds[$gfIntParentLevel]) : // find parent in specified levels up
99+
($gfIntDocId = $gfArrParentIds[$gfIntParentKey - 1]);
100+
} // end switch
101+
} // end switch
102+
unset($gfIntTopDocId, $gfIntParentLevel, $gfIntParentsCount, $gfIntParentKey, $gfArrParentIds);
103+
104+
return $gfIntDocId;
105+
}
106+
}
107+
?>
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<div class="comment [+comment.createdby:isnt=`0`:then=`adminn`+]" style="padding-left:[+comment.depth+]0pt; ">
2+
<a name="jc[+jot.link.id+][+comment.id+]"></a><a name="[+comment.createdon+]"></a>
3+
<div class="content">[+comment.content:wordwrap:esc:nl2br+]
4+
<!---
5+
6+
[+comment.title:isnt=`new comment`:then=`
7+
<br /><br /><strong>Админ:</strong>[+comment.title:wordwrap:esc:nl2br+]
8+
`+]
9+
--->
10+
11+
12+
<div class="aboutpost" style="margin:5px 0 0 0;">
13+
[+comment.createdby:isnt=`0`:then=`<b>`+][+comment.createdby:userinfo=`fulname`:ifempty=`[+comment.custom.name:ifempty=`[+jot.guestname+]`:esc+]`+][+comment.createdby:isnt=`0`:then=`</b>`+]
14+
<!--- [+comment.createdon:date=`%d.%m.%Y в %H.%M`+] --->
15+
16+
</div>
17+
18+
19+
<!--[+jot.moderation.enabled:is=`1`:then=`
20+
21+
22+
23+
<a href="[+jot.link.delete:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Действительно хотите удалить комментарий?')" title="Delete Comment"><img src="[(base_url)]manager/media/style/MODxCarbon/images/icons/event3.png" width="16" height="16" alt="Удалить" border="0" /></a>
24+
`:strip+]
25+
[+jot.user.canedit:is=`1`:and:if=`[+comment.createdby+]`:is=`[+jot.user.id+]`:or:if=`[+jot.moderation.enabled+]`:is=`1`:then=`
26+
<a href="[+jot.link.edit:esc+][+jot.querykey.id+]=[+comment.id+]#jf[+jot.link.id+]" onclick="return confirm('Вы хотите отредактировать этот комментарий?')" title="Отредактировать комментарий"><img src="[(base_url)]manager/media/style/MODxCarbon/images/icons/logging.gif" width="16" height="16" alt="Отредактировать комментарий" border="0" /></a>
27+
`:strip+] -->
28+
<div class="jot-mod">
29+
[+jot.moderation.enabled:is=`1`:then=`
30+
<a href="[+jot.link.delete:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to delete this comment?')" title="Delete Comment"><img src="[(base_url)]assets/snippets/jot/templates/delete.gif" width="16" height="16" alt="Delete Comment" border="0" /></a>
31+
[+comment.published:is=`0`:then=`
32+
<a href="[+jot.link.publish:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to publish this comment?')" title="Publish Comment"><img src="[(base_url)]assets/snippets/jot/templates/publish.png" width="16" height="16" alt="Publish Comment" border="0" /></a>
33+
`+]
34+
[+comment.published:is=`1`:then=`
35+
<a href="[+jot.link.unpublish:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to unpublish this comment?')" title="Unpublish Comment"><img src="[(base_url)]assets/snippets/jot/templates/unpublish.png" width="16" height="16" alt="Unpublish Comment" border="0" /></a>
36+
`+]
37+
`:strip+]
38+
[+jot.user.canedit:is=`1`:and:if=`[+comment.createdby+]`:is=`[+jot.user.id+]`:or:if=`[+jot.moderation.enabled+]`:is=`1`:then=`
39+
<a href="[+jot.link.edit:esc+][+jot.querykey.id+]=[+comment.id+]#jf[+jot.link.id+]" onclick="return confirm('Are you sure you wish to edit this comment?')" title="Edit Comment"><img src="[(base_url)]assets/snippets/jot/templates/edit.gif" width="16" height="16" alt="Edit Comment" border="0" /></a>
40+
`:strip+]
41+
</div>
42+
43+
</div>
44+
[+comment.title:isnt=`new comment`:then=`
45+
<div class="adminn">
46+
[+comment.title:wordwrap:esc:nl2br+]
47+
</div>`+]
48+
49+
50+
51+
</div>
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<a name="jc[+jot.link.id+][+comment.id+]"></a>
2+
<div class="jot-row [+chunk.rowclass+] [+comment.published:is=`0`:then=`jot-row-up`+]">
3+
<div class="jot-comment">
4+
5+
<div class="jot-user">
6+
[+comment.createdby:isnt=`0`:then=`<b>`+][+comment.createdby:userinfo=`username`:ifempty=`[+comment.custom.name:ifempty=`[+jot.guestname+]`:esc+]`+][+comment.createdby:isnt=`0`:then=`</b>`+]
7+
<br />Posts: [+comment.userpostcount+]
8+
</div>
9+
10+
<div class="jot-content">
11+
12+
<div class="jot-posticon">
13+
[+phx:userinfo=`lastlogin`:ifempty=`9999999999`:lt=`[+comment.createdon+]`:then=`
14+
<img src="[(base_url)]assets/snippets/jot/templates/comment.gif" width="16" height="16" alt="New comment" border="0" />
15+
`:else=`
16+
<img src="[(base_url)]assets/snippets/jot/templates/comment_trans.gif" width="16" height="16" alt="Comment" border="0" />
17+
`:strip+]
18+
</div>
19+
20+
<div class="jot-mod">
21+
[+jot.moderation.enabled:is=`1`:then=`
22+
<a href="[+jot.link.delete:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to delete this comment?')" title="Delete Comment"><img src="[(base_url)]assets/snippets/jot/templates/delete.gif" width="16" height="16" alt="Delete Comment" border="0" /></a>
23+
[+comment.published:is=`0`:then=`
24+
<a href="[+jot.link.publish:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to publish this comment?')" title="Publish Comment"><img src="[(base_url)]assets/snippets/jot/templates/publish.png" width="16" height="16" alt="Publish Comment" border="0" /></a>
25+
`+]
26+
[+comment.published:is=`1`:then=`
27+
<a href="[+jot.link.unpublish:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to unpublish this comment?')" title="Unpublish Comment"><img src="[(base_url)]assets/snippets/jot/templates/unpublish.png" width="16" height="16" alt="Unpublish Comment" border="0" /></a>
28+
`+]
29+
`:strip+]
30+
[+jot.user.canedit:is=`1`:and:if=`[+comment.createdby+]`:is=`[+jot.user.id+]`:or:if=`[+jot.moderation.enabled+]`:is=`1`:then=`
31+
<a href="[+jot.link.edit:esc+][+jot.querykey.id+]=[+comment.id+]#jf[+jot.link.id+]" onclick="return confirm('Are you sure you wish to edit this comment?')" title="Edit Comment"><img src="[(base_url)]assets/snippets/jot/templates/edit.gif" width="16" height="16" alt="Edit Comment" border="0" /></a>
32+
`:strip+]
33+
</div>
34+
35+
<span class="jot-subject">[+comment.title:limit:esc+]</span><br />
36+
<span class="jot-poster"><b>Reply #[+comment.postnumber+] on :</b> [+comment.createdon:date=`%a %B %d, %Y, %H:%M:%S`+]</span>
37+
<hr />
38+
<div class="jot-message">[+comment.content:wordwrap:esc:nl2br+]</div>
39+
<div class="jot-extra">
40+
[+comment.editedon:isnt=`0`:then=`
41+
<span class="jot-editby">Last Edit: [+comment.editedon:date=`%B %d, %Y, %H:%M:%S`+] by [+comment.editedby:userinfo=`username`:ifempty=` * `+]</span>
42+
&nbsp;`+] [+jot.moderation.enabled:is=`1`:then=`<a target="_blank" href="http://www.ripe.net/perl/whois?searchtext=[+comment.secip+]">[+comment.secip+]</a>`+]</div>
43+
</div>
44+
45+
</div>
46+
47+
</div>

Diff for: ‎assets/snippets/jot/templates/chunk.comment.inc.html

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
<a name="jc[+jot.link.id+][+comment.id+]"></a>
1+
 <a name="jc[+jot.link.id+][+comment.id+]"></a>
22
<div class="jot-row [+chunk.rowclass+] [+comment.published:is=`0`:then=`jot-row-up`+]">
33
<div class="jot-comment">
44

55
<div class="jot-user">
66
[+comment.createdby:isnt=`0`:then=`<b>`+][+comment.createdby:userinfo=`username`:ifempty=`[+comment.custom.name:ifempty=`[+jot.guestname+]`:esc+]`+][+comment.createdby:isnt=`0`:then=`</b>`+]
7-
<br />Posts: [+comment.userpostcount+]
7+
<br />Ответов: [+comment.userpostcount+]
88
</div>
99

1010
<div class="jot-content">
1111

1212
<div class="jot-posticon">
1313
[+phx:userinfo=`lastlogin`:ifempty=`9999999999`:lt=`[+comment.createdon+]`:then=`
14-
<img src="[(base_url)]assets/snippets/jot/templates/comment.gif" width="16" height="16" alt="New comment" border="0" />
14+
<img src="[(base_url)]manager/media/style/MODx/images/icons/folder_page_add.gif" width="18" height="18" alt="Новый комментарий" border="0" />
1515
`:else=`
16-
<img src="[(base_url)]assets/snippets/jot/templates/comment_trans.gif" width="16" height="16" alt="Comment" border="0" />
16+
<img src="[(base_url)]manager/media/style/MODx/images/icons/newdoc.gif" width="16" height="16" alt="Комментарий" border="0" />
1717
`:strip+]
1818
</div>
1919

2020
<div class="jot-mod">
2121
[+jot.moderation.enabled:is=`1`:then=`
22-
<a href="[+jot.link.delete:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to delete this comment?')" title="Delete Comment"><img src="[(base_url)]assets/snippets/jot/templates/delete.gif" width="16" height="16" alt="Delete Comment" border="0" /></a>
22+
<a href="[+jot.link.delete:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Действительно хотите удалить комментарий?')" title="Delete Comment"><img src="[(base_url)]manager/media/style/MODxCarbon/images/icons/event3.gif" width="16" height="16" alt="Удалить" border="0" /></a>
2323
[+comment.published:is=`0`:then=`
24-
<a href="[+jot.link.publish:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to publish this comment?')" title="Publish Comment"><img src="[(base_url)]assets/snippets/jot/templates/publish.png" width="16" height="16" alt="Publish Comment" border="0" /></a>
24+
<a href="[+jot.link.publish:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Если разрешить комментарий он будет доступен для просмотра пользователям, уверены, что хотите этого?')" title="Publish Comment"><img src="[(base_url)]manager/media/style/MODxCarbon/images/icons/add.png" width="16" height="16" alt="Опубликовать" border="0" /></a>
2525
`+]
2626
[+comment.published:is=`1`:then=`
27-
<a href="[+jot.link.unpublish:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to unpublish this comment?')" title="Unpublish Comment"><img src="[(base_url)]assets/snippets/jot/templates/unpublish.png" width="16" height="16" alt="Unpublish Comment" border="0" /></a>
27+
<a href="[+jot.link.unpublish:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Если запретить комментарий он не будет доступен для просмотра пользователями, уверены, что хотите этого?')" title="Unpublish Comment"><img src="[(base_url)]manager/media/style/MODxCarbon/images/icons/delete.png" width="16" height="16" alt="Запретить" border="0" /></a>
2828
`+]
2929
`:strip+]
3030
[+jot.user.canedit:is=`1`:and:if=`[+comment.createdby+]`:is=`[+jot.user.id+]`:or:if=`[+jot.moderation.enabled+]`:is=`1`:then=`
31-
<a href="[+jot.link.edit:esc+][+jot.querykey.id+]=[+comment.id+]#jf[+jot.link.id+]" onclick="return confirm('Are you sure you wish to edit this comment?')" title="Edit Comment"><img src="[(base_url)]assets/snippets/jot/templates/edit.gif" width="16" height="16" alt="Edit Comment" border="0" /></a>
31+
<a href="[+jot.link.edit:esc+][+jot.querykey.id+]=[+comment.id+]#jf[+jot.link.id+]" onclick="return confirm('Вы хотите отредактировать этот комментарий?')" title="Отредактировать комментарий"><img src="[(base_url)]manager/media/style/MODxCarbon/images/icons/logging.gif" width="16" height="16" alt="Отредактировать комментарий" border="0" /></a>
3232
`:strip+]
3333
</div>
3434

3535
<span class="jot-subject">[+comment.title:limit:esc+]</span><br />
36-
<span class="jot-poster"><b>Reply #[+comment.postnumber+] on :</b> [+comment.createdon:date=`%a %B %d, %Y, %H:%M:%S`+]</span>
36+
<span class="jot-poster"><b>Ответ #[+comment.postnumber+] дата :</b> [+comment.createdon:date=`%a %B %d, %Y, %H:%M:%S`+]</span>
3737
<hr />
3838
<div class="jot-message">[+comment.content:wordwrap:esc:nl2br+]</div>
3939
<div class="jot-extra">
4040
[+comment.editedon:isnt=`0`:then=`
41-
<span class="jot-editby">Last Edit: [+comment.editedon:date=`%B %d, %Y, %H:%M:%S`+] by [+comment.editedby:userinfo=`username`:ifempty=` * `+]</span>
41+
<span class="jot-editby">Последняя правка: [+comment.editedon:date=`%B %d, %Y, %H:%M:%S`+] пользователем [+comment.editedby:userinfo=`username`:ifempty=` * `+]</span>
4242
&nbsp;`+] [+jot.moderation.enabled:is=`1`:then=`<a target="_blank" href="http://www.ripe.net/perl/whois?searchtext=[+comment.secip+]">[+comment.secip+]</a>`+]</div>
4343
</div>
4444

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<!--<a name="jf[+jot.link.id+]"></a>-->
2+
<h3 class=forceup>[+form.edit:is=`1`:then=`Правка`:else=`Задать вопрос`+]</h3>
3+
[+form.error:isnt=`0`:then=`
4+
<div class="jot-err">
5+
[+form.error:select=`
6+
&-3=Вы отправляете один и тот же пост - не стоит нажимать на кнопку более 1 раза.
7+
&-2=Ваш вопрос отвергнут.
8+
&-1=Ваш вопрос отправлен - ждет проверки модератора, после проверки будет опубликован.
9+
&1=Вы отправляете один и тот же пост - не стоит нажимать на кнопку более 1 раза.
10+
&2=Код на изображении не совпадает с тем, что вы указали.
11+
&3=Не торопитесь, ограничение на время повторного поста [+jot.postdelay+] секунд.
12+
&4=Ваш вопрос отвергнут.
13+
&5=[+form.errormsg:ifempty=`Необходимо заполнять поля помеченные знаком *`+]
14+
`+]
15+
</div>
16+
`:strip+]
17+
[+form.confirm:isnt=`0`:then=`
18+
<div class="jot-cfm">
19+
[+form.confirm:select=`
20+
&1=Ваш вопрос успешно добавлен.
21+
&2=Ваш вопрос отправлен - ждет проверки модератора, после проверки будет опубликован.
22+
&3=Ваш вопрос сохранен.
23+
`+]
24+
</div>
25+
`:strip+]
26+
<form method="post" action="[+form.action:esc+]#jf[+jot.link.id+]" class="jot-form">
27+
<fieldset>
28+
<input name="JotForm" type="hidden" value="[+jot.id+]" />
29+
<input name="JotNow" type="hidden" value="[+jot.seed+]" />
30+
<input name="parent" type="hidden" value="[+form.field.parent+]" />
31+
32+
[+form.moderation:is=`1`:then=`
33+
<div class="jot-row">
34+
<b>Создан:</b> [+form.field.createdon:date=`%a %B %d, %Y at %H:%M`+]<br />
35+
<b>Автор:</b> [+form.field.createdby:userinfo=`username`:ifempty=`[+jot.guestname+]`+]<br />
36+
<b>IP address:</b> [+form.field.secip+]<br />
37+
<b>Статус:</b> [+form.field.published:select=`0=No&1=Yes`+]<br />
38+
[+form.field.publishedon:gt=`0`:then=`
39+
<b>Опубликован:</b> [+form.field.publishedon:date=`%a %B %d, %Y at %H:%M`+]<br />
40+
<b>Опубликовал:</b> [+form.field.publishedby:userinfo=`username`:ifempty=` - `+]<br />
41+
`+]
42+
[+form.field.editedon:gt=`0`:then=`
43+
<b>Отредактирован:</b> [+form.field.editedon:date=`%a %B %d, %Y at %H:%M`+]<br />
44+
<b>Отредактировал:</b> [+form.field.editedby:userinfo=`username`:ifempty=` -`+]<br />
45+
`+]
46+
</div>
47+
`:strip+]
48+
49+
[+form.guest:is=`1`:then=`
50+
<label for="name[+jot.id+]">Имя:<span style="font-weight:bold; color:#FF0000">*</span><br />
51+
<input tabindex="[+jot.seed:math=`?+1`+]" name="name" type="text" size="40" value="[+form.field.custom.name:esc+]" id="name[+jot.id+]" />
52+
</label>
53+
<label for="email[+jot.id+]">Email:<span style="font-weight:bold; color:#FF0000">*</span><br />
54+
<input tabindex="[+jot.seed:math=`?+2`+]" name="email" type="text" size="40" value="[+form.field.custom.email:esc+]" id="email[+jot.id+]"/>
55+
</label>
56+
`:strip+]
57+
[+form.moderation:is=`1`:then=`
58+
<label for="title[+jot.id+]">Ответ:<br />
59+
<textarea tabindex="[+jot.seed:math=`?+3`+]" name="title" cols="50" rows="8" id="title[+jot.id+]"/>[+form.field.title:esc+]</textarea>
60+
</label>
61+
`:strip+]
62+
<!---<label for="ans[+jot.id+]">Телефон:<br />
63+
<input tabindex="[+jot.seed:math=`?+9`+]" name="ans" type="text" size="40" value="[+form.field.custom.ans:esc+]" id="ans[+jot.id+]"/>
64+
</label>--->
65+
<label for="content[+jot.id+]">Ваш вопрос:<span style="font-weight:bold; color:#FF0000">*</span><br />
66+
<textarea tabindex="[+jot.seed:math=`?+4`+]" name="content" cols="50" rows="8" id="content[+jot.id+]">[+form.field.content:esc+]</textarea>
67+
</label><br />
68+
<!--- [+form.moderation:is=`1`:then=`
69+
70+
<label for="title[+jot.id+]">Комментарий админа:<br />
71+
<textarea tabindex="[+jot.seed:math=`?+3`+]" name="title" cols="50" rows="8" id="title[+jot.id+]"/>[+form.field.title:esc+]</textarea>
72+
73+
</label>
74+
75+
`:strip+]
76+
--->
77+
[+jot.captcha:is=`1`:then=`
78+
<div style="width:150px;margin-top: 5px;margin-bottom: 5px;"><a href="[+jot.link.current:esc+]"><img src="[(base_url)]manager/includes/veriword.php?rand=[+jot.seed+]" width="148" height="60" alt="Если у Вас возникли проблемы с чтением кода, нажмите на картинку с кодом для нового кода." style="border: 1px solid #003399" /></a></div>
79+
<label for="vericode[+jot.id+]">Для защиты от спама - введите код:<br /><input type="text" name="vericode" style="width:150px;" size="20" id="vericode[+jot.id+]" /></label>&nbsp;
80+
`:strip+]
81+
82+
<div style="float:right;width: 100px;"></div>
83+
<input class="butti" tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="[+form.edit:is=`1`:then=`Сохранить изменения`:else=`Отправить вопрос`+]" />
84+
[+form.edit:is=`1`:then=`
85+
<input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="Отмена" onclick="history.go(-1);return false;" />
86+
`+]
87+
</fieldset>
88+
</form>
+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<a name="jf[+jot.link.id+]"></a>
2+
<h2>[+form.edit:is=`1`:then=`Edit comment`:else=`Write a comment`+]</h2>
3+
<div class="jot-list">
4+
<ul>
5+
<li>Required fields are marked with <b>*</b>.</li>
6+
</ul>
7+
</div>
8+
[+form.error:isnt=`0`:then=`
9+
<div class="jot-err">
10+
[+form.error:select=`
11+
&-3=You are trying to re-submit the same post. You have probably clicked the submit button more than once.
12+
&-2=Your comment has been rejected.
13+
&-1=Your comment has been saved, it will first be reviewed before it is published.
14+
&1=You are trying to re-submit the same post. You have probably clicked the submit button more than once.
15+
&2=The security code you entered was incorrect.
16+
&3=You can only post once each [+jot.postdelay+] seconds.
17+
&4=Your comment has been rejected.
18+
&5=[+form.errormsg:ifempty=`You didn't enter all the required fields`+]
19+
`+]
20+
</div>
21+
`:strip+]
22+
[+form.confirm:isnt=`0`:then=`
23+
<div class="jot-cfm">
24+
[+form.confirm:select=`
25+
&1=Your comment has been published.
26+
&2=Your comment has been saved, it will first be reviewed before it is published.
27+
&3=Comment saved.
28+
`+]
29+
</div>
30+
`:strip+]
31+
<form method="post" action="[+form.action:esc+]#jf[+jot.link.id+]" class="jot-form">
32+
<fieldset>
33+
<input name="JotForm" type="hidden" value="[+jot.id+]" />
34+
<input name="JotNow" type="hidden" value="[+jot.seed+]" />
35+
<input name="parent" type="hidden" value="[+form.field.parent+]" />
36+
37+
[+form.moderation:is=`1`:then=`
38+
<div class="jot-row">
39+
<b>Created on:</b> [+form.field.createdon:date=`%a %B %d, %Y at %H:%M`+]<br />
40+
<b>Created by:</b> [+form.field.createdby:userinfo=`username`:ifempty=`[+jot.guestname+]`+]<br />
41+
<b>IP address:</b> [+form.field.secip+]<br />
42+
<b>Published:</b> [+form.field.published:select=`0=No&1=Yes`+]<br />
43+
[+form.field.publishedon:gt=`0`:then=`
44+
<b>Published on:</b> [+form.field.publishedon:date=`%a %B %d, %Y at %H:%M`+]<br />
45+
<b>Published by:</b> [+form.field.publishedby:userinfo=`username`:ifempty=` - `+]<br />
46+
`+]
47+
[+form.field.editedon:gt=`0`:then=`
48+
<b>Edited on:</b> [+form.field.editedon:date=`%a %B %d, %Y at %H:%M`+]<br />
49+
<b>Edited by:</b> [+form.field.editedby:userinfo=`username`:ifempty=` -`+]<br />
50+
`+]
51+
</div>
52+
`:strip+]
53+
54+
[+form.guest:is=`1`:then=`
55+
<label for="name[+jot.id+]">Name:<br />
56+
<input tabindex="[+jot.seed:math=`?+1`+]" name="name" type="text" size="40" value="[+form.field.custom.name:esc+]" id="name[+jot.id+]" />
57+
</label>
58+
<label for="email[+jot.id+]">Email:<br />
59+
<input tabindex="[+jot.seed:math=`?+2`+]" name="email" type="text" size="40" value="[+form.field.custom.email:esc+]" id="email[+jot.id+]"/>
60+
</label>
61+
`:strip+]
62+
63+
<label for="title[+jot.id+]">Subject:<br />
64+
<input tabindex="[+jot.seed:math=`?+3`+]" name="title" type="text" size="40" value="[+form.field.title:esc+]" id="title[+jot.id+]"/>
65+
</label>
66+
<label for="content[+jot.id+]">Comment: *<br />
67+
<textarea tabindex="[+jot.seed:math=`?+4`+]" name="content" cols="50" rows="8" id="content[+jot.id+]">[+form.field.content:esc+]</textarea>
68+
</label><br />
69+
70+
[+jot.captcha:is=`1`:then=`
71+
<div style="width:150px;margin-top: 5px;margin-bottom: 5px;"><a href="[+jot.link.current:esc+]"><img src="[(base_url)]manager/includes/veriword.php?rand=[+jot.seed+]" width="148" height="60" alt="If you have trouble reading the code, click on the code itself to generate a new random code." style="border: 1px solid #003399" /></a></div>
72+
<label for="vericode[+jot.id+]">Help prevent spam - enter security code above:<br /><input type="text" name="vericode" style="width:150px;" size="20" id="vericode[+jot.id+]" /></label>&nbsp;
73+
`:strip+]
74+
75+
<div style="float:right;width: 100px;"></div>
76+
<input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="[+form.edit:is=`1`:then=`Save Comment`:else=`Post Comment`+]" />
77+
[+form.edit:is=`1`:then=`
78+
<input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="Cancel" onclick="history.go(-1);return false;" />
79+
`+]
80+
</fieldset>
81+
</form>

Diff for: ‎assets/snippets/jot/templates/chunk.form.inc.html

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
<a name="jf[+jot.link.id+]"></a>
2-
<h2>[+form.edit:is=`1`:then=`Edit comment`:else=`Write a comment`+]</h2>
1+
<a name="jf[+jot.link.id+]"></a>
2+
<h2>[+form.edit:is=`1`:then=`Правка комментария`:else=`Написать комментарий`+]</h2>
33
<div class="jot-list">
44
<ul>
5-
<li>Required fields are marked with <b>*</b>.</li>
5+
<li>Обязательные для заполнения поля помечены знаком <span style="font-weight:bold; color:#FF0000">*</span>.</li>
66
</ul>
77
</div>
88
[+form.error:isnt=`0`:then=`
99
<div class="jot-err">
1010
[+form.error:select=`
11-
&-3=You are trying to re-submit the same post. You have probably clicked the submit button more than once.
12-
&-2=Your comment has been rejected.
13-
&-1=Your comment has been saved, it will first be reviewed before it is published.
14-
&1=You are trying to re-submit the same post. You have probably clicked the submit button more than once.
15-
&2=The security code you entered was incorrect.
16-
&3=You can only post once each [+jot.postdelay+] seconds.
17-
&4=Your comment has been rejected.
18-
&5=[+form.errormsg:ifempty=`You didn't enter all the required fields`+]
11+
&-3=Вы отправляете один и тот же пост - не стоит нажимать на кнопку более 1 раза.
12+
&-2=Ваш комментарий отвергнут.
13+
&-1=Комментарий отправлен - ждет проверки модератора, после проверки будет опубликован.
14+
&1=Вы отправляете один и тот же пост - не стоит нажимать на кнопку более 1 раза.
15+
&2=Код на изображении не совпадает с тем, что вы указали.
16+
&3=Не торопитесь, ограничение на время повторного поста [+jot.postdelay+] секунд.
17+
&4=Ваш комментарий отвергнут.
18+
&5=[+form.errormsg:ifempty=`Необходимо заполнять поля помеченные знаком *`+]
1919
`+]
2020
</div>
2121
`:strip+]
2222
[+form.confirm:isnt=`0`:then=`
2323
<div class="jot-cfm">
2424
[+form.confirm:select=`
25-
&1=Your comment has been published.
26-
&2=Your comment has been saved, it will first be reviewed before it is published.
27-
&3=Comment saved.
25+
&1=Ваш комментарий успешно добавлен.
26+
&2=Комментарий отправлен - ждет проверки модератора, после проверки будет опубликован.
27+
&3=Комментарий сохранен.
2828
`+]
2929
</div>
3030
`:strip+]
@@ -36,46 +36,46 @@ <h2>[+form.edit:is=`1`:then=`Edit comment`:else=`Write a comment`+]</h2>
3636

3737
[+form.moderation:is=`1`:then=`
3838
<div class="jot-row">
39-
<b>Created on:</b> [+form.field.createdon:date=`%a %B %d, %Y at %H:%M`+]<br />
40-
<b>Created by:</b> [+form.field.createdby:userinfo=`username`:ifempty=`[+jot.guestname+]`+]<br />
39+
<b>Создан:</b> [+form.field.createdon:date=`%a %B %d, %Y at %H:%M`+]<br />
40+
<b>Автор:</b> [+form.field.createdby:userinfo=`username`:ifempty=`[+jot.guestname+]`+]<br />
4141
<b>IP address:</b> [+form.field.secip+]<br />
42-
<b>Published:</b> [+form.field.published:select=`0=No&1=Yes`+]<br />
42+
<b>Статус:</b> [+form.field.published:select=`0=No&1=Yes`+]<br />
4343
[+form.field.publishedon:gt=`0`:then=`
44-
<b>Published on:</b> [+form.field.publishedon:date=`%a %B %d, %Y at %H:%M`+]<br />
45-
<b>Published by:</b> [+form.field.publishedby:userinfo=`username`:ifempty=` - `+]<br />
44+
<b>Опубликован:</b> [+form.field.publishedon:date=`%a %B %d, %Y at %H:%M`+]<br />
45+
<b>Опубликовал:</b> [+form.field.publishedby:userinfo=`username`:ifempty=` - `+]<br />
4646
`+]
4747
[+form.field.editedon:gt=`0`:then=`
48-
<b>Edited on:</b> [+form.field.editedon:date=`%a %B %d, %Y at %H:%M`+]<br />
49-
<b>Edited by:</b> [+form.field.editedby:userinfo=`username`:ifempty=` -`+]<br />
48+
<b>Отредактирован:</b> [+form.field.editedon:date=`%a %B %d, %Y at %H:%M`+]<br />
49+
<b>Отредактировал:</b> [+form.field.editedby:userinfo=`username`:ifempty=` -`+]<br />
5050
`+]
5151
</div>
5252
`:strip+]
5353

5454
[+form.guest:is=`1`:then=`
55-
<label for="name[+jot.id+]">Name:<br />
55+
<label for="name[+jot.id+]">Имя:<br />
5656
<input tabindex="[+jot.seed:math=`?+1`+]" name="name" type="text" size="40" value="[+form.field.custom.name:esc+]" id="name[+jot.id+]" />
5757
</label>
5858
<label for="email[+jot.id+]">Email:<br />
5959
<input tabindex="[+jot.seed:math=`?+2`+]" name="email" type="text" size="40" value="[+form.field.custom.email:esc+]" id="email[+jot.id+]"/>
6060
</label>
6161
`:strip+]
6262

63-
<label for="title[+jot.id+]">Subject:<br />
63+
<label for="title[+jot.id+]">Тема:<br />
6464
<input tabindex="[+jot.seed:math=`?+3`+]" name="title" type="text" size="40" value="[+form.field.title:esc+]" id="title[+jot.id+]"/>
6565
</label>
66-
<label for="content[+jot.id+]">Comment: *<br />
66+
<label for="content[+jot.id+]">Комментарий: <span style="font-weight:bold; color:#FF0000">*</span><br />
6767
<textarea tabindex="[+jot.seed:math=`?+4`+]" name="content" cols="50" rows="8" id="content[+jot.id+]">[+form.field.content:esc+]</textarea>
6868
</label><br />
6969

7070
[+jot.captcha:is=`1`:then=`
71-
<div style="width:150px;margin-top: 5px;margin-bottom: 5px;"><a href="[+jot.link.current:esc+]"><img src="[(base_url)]manager/includes/veriword.php?rand=[+jot.seed+]" width="148" height="60" alt="If you have trouble reading the code, click on the code itself to generate a new random code." style="border: 1px solid #003399" /></a></div>
72-
<label for="vericode[+jot.id+]">Help prevent spam - enter security code above:<br /><input type="text" name="vericode" style="width:150px;" size="20" id="vericode[+jot.id+]" /></label>&nbsp;
71+
<div style="width:150px;margin-top: 5px;margin-bottom: 5px;"><a href="[+jot.link.current:esc+]"><img src="[(base_url)]manager/includes/veriword.php?rand=[+jot.seed+]" width="148" height="60" alt="Если у Вас возникли проблемы с чтением кода, нажмите на картинку с кодом для нового кода." style="border: 1px solid #003399" /></a></div>
72+
<label for="vericode[+jot.id+]">Для защиты от спама - введите код:<br /><input type="text" name="vericode" style="width:150px;" size="20" id="vericode[+jot.id+]" /></label>&nbsp;
7373
`:strip+]
7474

7575
<div style="float:right;width: 100px;"></div>
76-
<input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="[+form.edit:is=`1`:then=`Save Comment`:else=`Post Comment`+]" />
76+
<input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="[+form.edit:is=`1`:then=`Сохранить изменения`:else=`Отправить комментарий`+]" />
7777
[+form.edit:is=`1`:then=`
78-
<input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="Cancel" onclick="history.go(-1);return false;" />
78+
<input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="Отмена" onclick="history.go(-1);return false;" />
7979
`+]
8080
</fieldset>
8181
</form>

Diff for: ‎install/assets/plugins/customTemplate.tpl

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//<?php
2+
/**
3+
* custom Template
4+
*
5+
* Newly created Resources use the template configured in plugin
6+
*
7+
* @category plugin
8+
* @version 0.1
9+
* @author Dmi3yy (dmi3yy@gmail.com)
10+
* @internal @properties &customTemplates=customTemplates;text;100,101|102,103
11+
* @internal @events OnDocFormPrerender
12+
* @internal @modx_category Manager and Admin
13+
*/
14+
15+
/*
16+
* custom Template
17+
*
18+
* Written By Dmi3yy - 13 Sep 2011
19+
*
20+
*
21+
* Configuration:
22+
* check the OnDocFormPrerender event
23+
* add properties &customTemplates=customTemplates;text;100,101|102,103
24+
* Version 0.1
25+
*
26+
*/
27+
28+
global $content;
29+
$e = &$modx->Event;
30+
$cusTemp=explode('|',$customTemplates);
31+
switch($e->name) {
32+
case 'OnDocFormPrerender':
33+
34+
35+
if ($parent = $modx->getPageInfo($_REQUEST['pid'],0,'template')) {
36+
37+
foreach ($cusTemp as $value) {
38+
$tpl=explode(',',$value);
39+
if ($parent['template'] == $tpl[0]){ $content['template'] = $tpl[1];}
40+
}
41+
42+
}
43+
44+
break;
45+
default:
46+
break;
47+
}

Diff for: ‎install/assets/plugins/devStat_plugin.tpl

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//<?php
2+
3+
/**
4+
* devStat
5+
*
6+
* Logging developer info
7+
*
8+
* @category plugin
9+
* @version 1.0
10+
* @internal @properties &alert_time=Критичное время генерации;int;3 &alert_query=Критичное число запросов;int;100
11+
* @internal @events OnWebPagePrerender
12+
* @internal @legacy_names devStat
13+
* @author Andchir <http://wdevblog.net.ru>
14+
*/
15+
16+
$e = &$modx->Event;
17+
18+
if ($e->name == 'OnWebPagePrerender'){
19+
20+
if(!isset($alert_time)) $alert_tim = 3;
21+
if(!isset($alert_query)) $alert_query = 100;
22+
23+
$totalTime = ($modx->getMicroTime() - $modx->tstart);
24+
$queryTime = $modx->queryTime;
25+
$phpTime = $totalTime - $queryTime;
26+
27+
$queryTime = sprintf("%2.4f сек.", $queryTime);
28+
$totalTime = sprintf("%2.4f сек.", $totalTime);
29+
$phpTime = sprintf("%2.4f сек.", $phpTime);
30+
$source = $modx->documentGenerated == 1 ? "базы данных" : "кэша";
31+
$queries = isset ($modx->executedQueries) ? $modx->executedQueries : 0;
32+
33+
if($totalTime >= $alert_time || $queries >= $alert_query){
34+
$page_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
35+
$info_mess = '<a href="'.$page_url.'" target="_blank">'.$page_url.'</a>: ';
36+
$info_mess .= "<b>MySQL</b>: $queryTime, $queries запрос(ов), <b>PHP</b>: $phpTime, <b>общее время</b>: $totalTime, документ получен из <b>$source</b>";
37+
$modx->logEvent(45,1,$info_mess,"devStat: $queries / $totalTime");
38+
}
39+
40+
}
41+
42+
43+
//?>

Diff for: ‎install/assets/plugins/phx.tpl

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//<?php
2+
/**
3+
* phx
4+
*
5+
* (Placeholders Xtended) Adds the capability of output modifiers when using placeholders, template variables and settings tags
6+
*
7+
* @category plugin
8+
* @version 2.1.4
9+
* @author Armand "bS" Pondman (apondman@zerobarrier.nl)
10+
* @internal @properties &phxdebug=Log events;int;0 &phxmaxpass=Max. Passes;int;50
11+
* @internal @events OnParseDocument
12+
* @internal @modx_category Manager and Admin
13+
*/
14+
15+
include_once $modx->config['rb_base_dir'] . "plugins/phx/phx.parser.class.inc.php";
16+
17+
$e = &$modx->Event;
18+
19+
$PHx = new PHxParser($phxdebug,$phxmaxpass);
20+
21+
switch($e->name) {
22+
case 'OnParseDocument':
23+
$PHx->OnParseDocument();
24+
break;
25+
26+
}

Diff for: ‎install/assets/plugins/transalias.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @package modx
1111
* @subpackage modx.plugins.transalias
1212
* @author Olivier B. Deland, additions by Mike Schell, rfoster
13-
* @internal @properties &table_name=Trans table;list;common,russian,utf8,utf8lowercase;utf8lowercase &char_restrict=Restrict alias to;list;lowercase alphanumeric,alphanumeric,legal characters;legal characters &remove_periods=Remove Periods;list;Yes,No;No &word_separator=Word Separator;list;dash,underscore,none;dash &override_tv=Override TV name;string;
13+
* @internal @properties &table_name=Trans table;list;common,russian,utf8,utf8lowercase;russian &char_restrict=Restrict alias to;list;lowercase alphanumeric,alphanumeric,legal characters;lowercase alphanumeric &remove_periods=Remove Periods;list;Yes,No;No &word_separator=Word Separator;list;dash,underscore,none;dash &override_tv=Override TV name;string;
1414
* @internal @events OnStripAlias
1515
* @internal @modx_category Manager and Admin
1616
* @internal @installset base, sample

Diff for: ‎install/assets/snippets/adate.tpl

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//<?php
2+
/**
3+
* aDate
4+
*
5+
* Вывод даты с русским названием месяца
6+
*
7+
* @category snippet
8+
* @version 0.1
9+
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
10+
* @internal @properties
11+
* @internal @modx_category add
12+
*/
13+
14+
//пример: [[aDate? &date=`[*createdon*]` &date2=`[*pub_date*]`]]
15+
16+
$output = "";
17+
$format = "%d.%m.%Y";
18+
if (isset($date2) && $date2>0 ) {
19+
$output = strftime($format,$date2);
20+
}
21+
else{
22+
$output = strftime($format,$date);
23+
}
24+
25+
$date=explode(".", $output);
26+
switch ($date[1]){
27+
case 1: $m='января'; break;
28+
case 2: $m='февраля'; break;
29+
case 3: $m='марта'; break;
30+
case 4: $m='апреля'; break;
31+
case 5: $m='мая'; break;
32+
case 6: $m='июня'; break;
33+
case 7: $m='июля'; break;
34+
case 8: $m='августа'; break;
35+
case 9: $m='сентября'; break;
36+
case 10: $m='октября'; break;
37+
case 11: $m='ноября'; break;
38+
case 12: $m='декабря'; break;
39+
}
40+
echo $date[0].'&nbsp;'.$m.'&nbsp;'.$date[2];

Diff for: ‎install/assets/snippets/getfield.tpl

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
//<?php
2+
/**
3+
* GetField
4+
*
5+
* Берем любое поле из любого документа
6+
*
7+
* @category snippet
8+
* @version 1.3
9+
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
10+
* @internal @properties
11+
* @internal @modx_category add
12+
*/
13+
14+
15+
/*
16+
==================================================
17+
GetField
18+
==================================================
19+
20+
Returns any document field or template variable from any document or any of its parents.
21+
22+
Author: Grzegorz Adamiak [grad]
23+
Version: 1.3 beta @2006-11-08 14:40:04
24+
License: LGPL
25+
MODx: 0.9.2.1+
26+
27+
See GetField.txt for instructions and version history.
28+
--------------------------------------------------
29+
*/
30+
31+
/* Parameters
32+
----------------------------------------------- */
33+
34+
# $docid [ int ]
35+
# ID of the document for which to get a field content.
36+
# Default: current document
37+
38+
$gfIntDocId = (isset($docid)) ? $docid : $modx->documentIdentifier;
39+
40+
# $field [ string ]
41+
# Name of the field for which to get the content:
42+
# - any of the document object fields (http://modxcms.com/the-document-object.html)
43+
# - template variable
44+
# Default: 'pagetitle'
45+
46+
$gfStrDocField = (isset($field)) ? trim($field) : 'pagetitle';
47+
48+
# $parent [ 0 | 1 ]
49+
# If set to 1, the snippet will return value for the document parent.
50+
# Default: 0
51+
52+
$gfBoolParent = (isset($parent)) ? $parent : 0;
53+
54+
# $parentLevel [ int ]
55+
# Specifies how high in the document tree to search for the parent of the document:
56+
# - $parentLevel = 0 - returns the ultimate parent (right under site root)
57+
# - $parentLevel = 1 - returns the direct parent
58+
# Default: 0
59+
60+
$gfIntParentLevel = (isset($parentLevel) && is_int((int) $parentLevel)) ? $parentLevel : 0;
61+
62+
# $topid [ int ]
63+
# Id of the topmost document in the document tree under which to search for a parent. Used only with $parent set to 1.
64+
# Default: 0
65+
66+
$gfIntTopDocId = (isset($topid) && is_int((int) $topid)) ? $topid : 0;
67+
68+
/* Do not edit the code below!
69+
----------------------------------------------- */
70+
71+
# Include logic
72+
include_once('assets/snippets/getfield/getfield.inc.php');
73+
74+
# Get parent document ID
75+
if ($gfBoolParent)
76+
$gfIntDocId = gfGetParentId($modx, $gfIntDocId, $gfIntTopDocId, $gfIntParentLevel);
77+
78+
# Get content of the field
79+
$output = gfGetFieldContent($modx,$gfIntDocId,$gfStrDocField);
80+
81+
unset($gfIntDocId, $gfStrDocField, $gfBoolParent, $gfIntParentLevel, $gfIntTopDocId);
82+
83+
return $output;

Diff for: ‎install/assets/snippets/parentTitle.tpl

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//<?php
2+
/**
3+
* parentTitle
4+
*
5+
* Берем имя родителя
6+
*
7+
* @category snippet
8+
* @version 1.3
9+
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
10+
* @internal @properties
11+
* @internal @modx_category add
12+
*/
13+
14+
15+
/*
16+
[!parentTitle? &getID = `[*parent*]`!]
17+
*/
18+
19+
//specify page id you want to get data for
20+
$getID = $getID;
21+
//get content field for page id
22+
$tvOutput = $modx->getTemplateVarOutput('pagetitle', $getID);
23+
$content = $tvOutput['pagetitle'];
24+
25+
//output the data to wherever the snippet is being called
26+
return $content;

Diff for: ‎install/assets/snippets/sitemap.tpl

+302
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
//<?php
2+
/**
3+
* sitemap
4+
*
5+
* google-sitemap.xml
6+
*
7+
* @category snippet
8+
* @version 1.0.8
9+
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
10+
* @internal @properties
11+
* @internal @modx_category add
12+
*/
13+
14+
15+
/*
16+
==================================================
17+
sitemap
18+
==================================================
19+
20+
Outputs a machine readable site map for search
21+
engines and robots. Supports the following
22+
formats:
23+
24+
- Sitemap Protocol used by Google Sitemaps
25+
(http://www.google.com/webmasters/sitemaps/)
26+
27+
- URL list in text format
28+
(e.g. Yahoo! submission)
29+
30+
Author: Grzegorz Adamiak [grad]
31+
Version: 1.0.8 @ 22-AUG-2008
32+
License: LGPL
33+
MODx: 0.9.2.1, 0.9.6.1
34+
35+
History:
36+
# 1.0.8
37+
- excludeTemplates can now also be specified as a template ID instead of template name.
38+
Useful if you change the names of your templates frequently. (ncrossland)
39+
e.g. &excludeTemplates=`myTemplateName,3,4`
40+
# 1.0.7
41+
- Unpublished and deleted documents were showing up in the sitemap. Even though they could not be viewed,
42+
they were showing up as broken links to search engines. (ncrossland)
43+
# 1.0.6
44+
- Add optional parameter (excludeWeblinks) to exclude weblinks from the sitemap, since they often point to external
45+
sites (which don't belong on your sitemap), or redirecting to other internal pages (which are already
46+
in the sitemap). Google Webmaster Tools generates warnings for excessive redirects.
47+
Default is false - e.g. default behaviour remains unchanged. (ncrossland)
48+
# 1.0.5
49+
- Modification about non searchable documents, as suggested by forum user JayBee
50+
(http://modxcms.com/forums/index.php/topic,5754.msg99895.html#msg99895)
51+
# 1.0.4 (By Bert Catsburg, bert@catsburg.com)
52+
- Added display option 'ulli'.
53+
An <ul><li> list of all published documents.
54+
# 1.0.3
55+
- Added ability to specify the XSL URL - you don't always need one and it
56+
seems to create a lot of support confusion!
57+
It is now a parameter (&xsl=``) which can take either an alias or a doc ID (ncrossland)
58+
- Modifications suggested by forum users Grad and Picachu incorporated
59+
(http://modxcms.com/forums/index.php/topic,5754.60.html)
60+
# 1.0.2
61+
- Reworked fetching of template variable value to
62+
get INHERITED value.
63+
# 1.0.1
64+
- Reworked fetching of template variable value,
65+
now it gets computed value instead of nominal;
66+
however, still not the inherited value.
67+
# 1.0
68+
- First public release.
69+
70+
TODO:
71+
- provide output for ROR
72+
--------------------------------------------------
73+
*/
74+
75+
/* Parameters
76+
----------------------------------------------- */
77+
78+
# $startid [ int ]
79+
# Id of the 'root' document from which the sitemap
80+
# starts.
81+
# Default: 0
82+
83+
$startid = (isset($startid)) ? $startid : 0;
84+
85+
# $format [ sp | txt | ror ]
86+
# Which format of sitemap to use:
87+
# - sp <- Sitemap Protocol used by Google
88+
# - txt <- text file with list of URLs
89+
# TODO - ror <- Resource Of Resources
90+
# Default: sp
91+
92+
$format = (isset($format) && ($format != 'ror')) ? $format : 'sp';
93+
94+
# $priority [ str ]
95+
# Name of TV which sets the relative priority of
96+
# the document. If there is no such TV, this
97+
# parameter will not be used.
98+
# Default: sitemap_priority
99+
100+
$priority = (isset($priority)) ? $priority : 'sitemap_priority';
101+
102+
# $changefreq [ str ]
103+
# Name of TV which sets the change frequency. If
104+
# there is no such TV this parameter will not be
105+
# used.
106+
# Default: sitemap_changefreq
107+
108+
$changefreq = (isset($changefreq)) ? $changefreq : 'sitemap_changefreq';
109+
110+
# $excludeTemplates [ str ]
111+
# Documents based on which templates should not be
112+
# included in the sitemap. Comma separated list
113+
# with names of templates.
114+
# Default: empty
115+
116+
$excludeTemplates = (isset($excludeTemplates)) ? $excludeTemplates : array();
117+
118+
# $excludeTV [ str ]
119+
# Name of TV (boolean type) which sets document
120+
# exclusion form sitemap. If there is no such TV
121+
# this parameter will not be used.
122+
# Default: 'sitemap_exclude'
123+
124+
$excludeTV = (isset($excludeTV)) ? $excludeTV : 'sitemap_exclude';
125+
126+
# $xsl [ str ]
127+
# URL to the XSL style sheet
128+
# or
129+
# $xsl [ int ]
130+
# doc ID of the XSL style sheet
131+
132+
$xsl = (isset($xsl)) ? $xsl : '';
133+
if (is_numeric($xsl)) { $xsl = $modx->makeUrl($xsl); }
134+
135+
136+
# $excludeWeblinks [ bool ]
137+
# Should weblinks be excluded?
138+
# You may not want to include links to external sites in your sitemap,
139+
# and Google gives warnings about multiple redirects to pages
140+
# within your site.
141+
# Default: false
142+
$excludeWeblinks = (isset($excludeWeblinks)) ? $excludeWeblinks : false;
143+
144+
145+
/* End parameters
146+
----------------------------------------------- */
147+
148+
# get list of documents
149+
# ---------------------------------------------
150+
$docs = getDocs($modx,$startid,$priority,$changefreq,$excludeTV);
151+
152+
153+
# filter out documents by template or TV
154+
# ---------------------------------------------
155+
// get all templates
156+
$select = $modx->db->select("id, templatename", $modx->getFullTableName('site_templates'));
157+
while ($query = $modx->db->getRow($select)) {
158+
$allTemplates[$query['id']] = $query['templatename'];
159+
}
160+
161+
$remainingTemplates = $allTemplates;
162+
163+
// get templates to exclude, and remove them from the all templates list
164+
if (!empty ($excludeTemplates)) {
165+
166+
$excludeTemplates = explode(",", $excludeTemplates);
167+
168+
// Loop through each template we want to exclude
169+
foreach ($excludeTemplates as $template) {
170+
$template = trim($template);
171+
172+
// If it's numeric, assume it's an ID, and remove directly from the $allTemplates array
173+
if (is_numeric($template) && isset($remainingTemplates[$template])) {
174+
unset($remainingTemplates[$template]);
175+
} else if (trim($template) && in_array($template, $remainingTemplates)) { // If it's text, and not empty, assume it's a template name
176+
unset($remainingTemplates[array_search($template, $remainingTemplates)]);
177+
}
178+
} // end foreach
179+
}
180+
181+
$output= array();
182+
// filter out documents which shouldn't be included
183+
foreach ($docs as $doc)
184+
{
185+
if (isset($remainingTemplates[$doc['template']]) && !$doc[$excludeTV] && $doc['published'] && $doc['template']!=0 && $doc['searchable']) {
186+
if (!$excludeWeblinks || ($excludeWeblinks && $doc['type'] != 'reference')) {
187+
$output[] = $doc;
188+
}
189+
}
190+
}
191+
$docs = $output;
192+
unset ($output, $allTemplates, $excludeTemplates);
193+
194+
195+
# build sitemap in specified format
196+
# ---------------------------------------------
197+
198+
switch ($format)
199+
{
200+
// Next case added in version 1.0.4
201+
case 'ulli': // UL List
202+
$output .= "<ul class=\"sitemap\">\n";
203+
// TODO: Sort the array on Menu Index
204+
// TODO: Make a nested ul-li based on the levels in the document tree.
205+
foreach ($docs as $doc)
206+
{
207+
$s = " <li class=\"sitemap\">";
208+
$s .= "<a href=\"[(site_url)][~" . $doc['id'] . "~]\" class=\"sitemap\">" . $doc['pagetitle'] . "</a>";
209+
$s .= "</li>\n";
210+
$output .= $s;
211+
} // end foreach
212+
$output .= "</ul>\n";
213+
break;
214+
215+
case 'txt': // plain text list of URLs
216+
217+
foreach ($docs as $doc)
218+
{
219+
$url = '[(site_url)][~'.$doc['id'].'~]';
220+
221+
$output .= $url."\n";
222+
} // end foreach
223+
break;
224+
225+
case 'ror': // TODO
226+
default: // Sitemap Protocol
227+
228+
229+
$output = '<?xml version="1.0" encoding="UTF-8"?>'."\n";
230+
if ($xsl != '') {
231+
$output .='<?xml-stylesheet type="text/xsl" href="'.$xsl.'"?>'."\n";
232+
}
233+
$output .='<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
234+
235+
236+
foreach ($docs as $doc) {
237+
$url = '[(site_url)][~'.$doc['id'].'~]';
238+
$date = $doc['editedon'];
239+
$date = date("Y-m-d", $date);
240+
$docPriority = ($doc[$priority]) ? $doc[$priority] : 0; // false if TV doesn't exist
241+
$docChangefreq = ($doc[$changefreq]) ? $doc[$changefreq] : 0; // false if TV doesn't exist
242+
243+
$output .= "\t".'<url>'."\n";
244+
$output .= "\t\t".'<loc>'.$url.'</loc>'."\n";
245+
$output .= "\t\t".'<lastmod>'.$date.'</lastmod>'."\n";
246+
$output .= ($docPriority) ? ("\t\t".'<priority>'.$docPriority.'</priority>'."\n") : ''; // don't output anything if TV doesn't exist
247+
$output .= ($docChangefreq) ? ("\t\t".'<changefreq>'.$docChangefreq.'</changefreq>'."\n") : ''; // don't output anything if TV doesn't exist
248+
$output .= "\t".'</url>'."\n";
249+
} // end foreach
250+
$output .= '</urlset>';
251+
252+
} // end switch
253+
254+
return $output;
255+
256+
# functions
257+
# ---------------------------------------------
258+
259+
# gets (inherited) value of template variable
260+
function getTV($modx,$docid,$doctv)
261+
{
262+
/* apparently in 0.9.2.1 the getTemplateVarOutput function doesn't work as expected and doesn't return INHERITED value; this is probably to be fixed for next release; see http://modxcms.com/bugs/task/464
263+
$output = $modx->getTemplateVarOutput($tv,$docid);
264+
return $output[$tv];
265+
*/
266+
267+
while ($pid = $modx->getDocument($docid,'parent'))
268+
{
269+
$tv = $modx->getTemplateVar($doctv,'*',$docid);
270+
if (($tv['value'] && substr($tv['value'],0,8) != '@INHERIT') or !$tv['value']) // tv default value is overriden (including empty)
271+
{
272+
$output = $tv['value'];
273+
break;
274+
}
275+
else // there is no parent with default value overriden
276+
{
277+
$output = trim(substr($tv['value'],8));
278+
}
279+
$docid = $pid['parent']; // move up one document in document tree
280+
} // end while
281+
282+
return $output;
283+
}
284+
285+
# gets list of published documents with properties
286+
function getDocs($modx,$startid,$priority,$changefreq,$excludeTV)
287+
{
288+
// get children documents
289+
$docs = $modx->getActiveChildren($startid,'menuindex','asc','id,editedon,template,published,searchable,pagetitle,type');
290+
// add sub-children to the list
291+
foreach ($docs as $key => $doc)
292+
{
293+
$id = $doc['id'];
294+
$docs[$key][$priority] = getTV($modx,$id,$priority); // add priority property
295+
$docs[$key][$changefreq] = getTV($modx,$id,$changefreq); // add changefreq property
296+
$docs[$key][$excludeTV] = getTV($modx,$id,$excludeTV); // add excludeTV property
297+
298+
if ($modx->getActiveChildren($id))
299+
$docs = array_merge($docs, getDocs($modx,$id,$priority,$changefreq,$excludeTV));
300+
} // end foreach
301+
return $docs;
302+
}

Diff for: ‎install/assets/snippets/splitPagination.tpl

+424
Large diffs are not rendered by default.

Diff for: ‎install/assets/snippets/youtube.tpl

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
//<?php
2+
/**
3+
* YouTube
4+
*
5+
* YouTube на сайте
6+
*
7+
* @category snippet
8+
* @version 0.1
9+
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
10+
* @internal @properties
11+
* @internal @modx_category add
12+
*/
13+
14+
15+
//SETTINGS
16+
$width = isset($width)?$width:425;
17+
$height = isset($height)?$height:350;
18+
19+
// YouTube API settings
20+
$related = isset($related)?$related:true;
21+
$autoplay = isset($autoplay)?$autoplay:false;
22+
$loop = isset($loop)?$loop:false;
23+
$disablekb = isset($disablekb)?$disablekb:false;
24+
$egm = isset($egm)?$egm:false;
25+
$border = isset($border)?$border:false;
26+
$color1 = isset($color1)?$color1:'';
27+
$color2 = isset($color2)?$color2:'';
28+
29+
// Javascript
30+
$js = isset($js)?$js:true;
31+
$swfobject_url = isset($swfobject_url)?$swfobject_url:'/assets/js/swfobject/swfobject.js';
32+
$swfobject_express_url = isset($swfobject_url)?$swfobject_url:'/assets/js/swfobject/expressInstall.swf';
33+
$missing = isset($missing)?$missing:'<p>This video requires the free Flash plugin.</p>';
34+
35+
// If a URL is supplied, work out the ID part of it
36+
if (isset($url) && $ytid = (getIdFromUrl(urldecode($url))) ) {
37+
// $ytid is already set
38+
} else if (isset($id)) {
39+
$ytid = $id;
40+
} else { // No URL or ID supplied
41+
return;
42+
}
43+
44+
// Ensure the "related" value is appropriate for the YouTube URL
45+
$related_val = ($related)?'&rel=1':'&rel=0';
46+
$autoplay_val = ($autoplay)?'&autoplay=1':'&autoplay=0';
47+
$loop_val = ($loop)?'&loop=1':'&loop=0';
48+
$disablekb_val = ($disablekb)?'&disablekb=1':'&disablekb=0';
49+
$egm_val = ($egm)?'&egm=1':'&egm=0';
50+
$border_val = ($border)?'&border=1':'&border=0';
51+
$color1_val = (!empty($color1))?'&color1='.$color1:'';
52+
$color2_val = (!empty($color2))?'&color2='.$color2:'';
53+
54+
// Construct the YouTube URL
55+
$yturl =' http://www.youtube.com/v/'.$ytid.$related_val.$autoplay_val.$loop_val.$disablekb_val.$egm_val.$border_val.$color1_val.$color2_val.'&hl=en';
56+
57+
// HTML template, based on cross-browser recommendation from SWFobject project
58+
$html = '
59+
<object id="'.$ytid.'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'.$width.'" height="'.$height.'">
60+
<param name="movie" value="'.$yturl.'" />
61+
<!--[if !IE]>-->
62+
<object type="application/x-shockwave-flash" data="'.$yturl.'" width="'.$width.'" height="'.$height.'">
63+
<!--<![endif]-->
64+
'.$missing.'
65+
<!--[if !IE]>-->
66+
</object>
67+
<!--<![endif]-->
68+
</object>
69+
';
70+
71+
72+
// If we want to use javascript to check Flash version, etc.
73+
if ($js) {
74+
// Register the SWFObject script
75+
$modx->regClientStartupScript($swfobject_url);
76+
77+
// Activate the content with JS
78+
$script = '
79+
<script type="text/javascript">
80+
swfobject.registerObject("'.$ytid.'", "8.0.0", "'.$swfobject_express_url.'");
81+
</script>
82+
';
83+
$modx->regClientStartupScript($script);
84+
}
85+
86+
return $html;
87+
88+
if(!function_exists('getIdFromUrl')) {
89+
function getIdFromUrl($url) {
90+
$url_parts = parse_url($url);
91+
parse_str($url_parts['query']);
92+
if(isset($v)) {
93+
return $v;
94+
} else {
95+
return false;
96+
}
97+
}
98+
}

0 commit comments

Comments
 (0)
Please sign in to comment.