From 0af572ffbaca04ac757a76ced22ab48a90e29a4a Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sun, 12 Jun 2016 18:23:10 +0200 Subject: [PATCH 01/16] frio: first part for event template work --- mod/events.php | 10 +- view/theme/frio/css/style.css | 62 ++++++++ view/theme/frio/js/modal.js | 11 +- view/theme/frio/js/theme.js | 156 +++++++++++++++++++ view/theme/frio/templates/event.tpl | 19 +++ view/theme/frio/templates/event_form.tpl | 53 +++++++ view/theme/frio/templates/event_head.tpl | 188 +++++++++++++++++++++++ view/theme/frio/templates/events-js.tpl | 41 +++++ 8 files changed, 537 insertions(+), 3 deletions(-) create mode 100644 view/theme/frio/templates/event.tpl create mode 100644 view/theme/frio/templates/event_form.tpl create mode 100644 view/theme/frio/templates/event_head.tpl create mode 100644 view/theme/frio/templates/events-js.tpl diff --git a/mod/events.php b/mod/events.php index 633aaf0c1..46f33355b 100644 --- a/mod/events.php +++ b/mod/events.php @@ -67,9 +67,9 @@ function events_post(&$a) { $action = ($event_id == '') ? 'new' : "event/" . $event_id; $onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish"; - if(strcmp($finish,$start) < 0 && !$nofinish) { + if(strcmp($finish,$start) < 0 && !$nofinish) { notice( t('Event can not end before it has started.') . EOL); - if(intval($_REQUEST['preview'])) { + if(intval($_REQUEST['preview'])) { echo( t('Event can not end before it has started.')); killme(); } @@ -462,6 +462,12 @@ function events_content(&$a) { '$events' => $events, + // eignene + "today" => t("today"), + "month" => t("month"), + "week" => t("week"), + "day" => t("day"), + )); diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 49d78e131..185888b71 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -163,6 +163,15 @@ a#item-delete-selected { .btn-link:focus, .btn-link:hover { color: #23527c; } +.btn-eventnav, btn-eventnav:hover { + font-size: 16px; + background: none; + background-color: transparent; + padding: 0 14px; +} +.btn-separator { + border-left: 1px solid #777; +} /*.btn-info { background: #6fdbe8; color: #fff!important; @@ -1901,6 +1910,59 @@ ul li:hover .contact-wrapper a.contact-action-link:hover { #poke-wrapper-end { clear: both; } + +/* Events page */ +#fc-header { + margin-top: 20px; + margin-bottom: 10px; +} +#fc-header-left, +#fc-header-right, +#event-calendar-title { + display: inline-block; +} +#fc-title { + margin: 0; + padding-left: 20px; + +} +#fc-header-right { + margin-top: -4px; +} +#event-calendar-title { + vertical-align: middle; +} +a#event-calendar-views { + padding: 6px 9px; + font-size: 14px +} +tr.fc-first, +tr.fc-first th { + border-left: none; + border-right: none; + border-top: none; +} +td.fc-day { + border-left: none; + border-right: none; + padding: 0 6px; +} +#events-calendar .fc-grid .fc-day-number { + float: left; + font-size: 0.9em; +} +.event-wrapper .event-owner { + margin-bottom: 15px; +} +.event-owner img { + margin-right: 5px; + height: 48px; + width: 48; + border-radius: 3px; +} +.event-wrapper .event-buttons { + margin-top: 15px; +} /* * Overwriting for transparency and other colors */ diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index 0a881f10f..f99946019 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -158,8 +158,17 @@ function loadModalTitle() { // hide the first element with the class "heading" of the modal body $("#modal-body .heading").first().hide(); + var title = ""; + // get the text of the first element with "heading" class - var title = $("#modal-body .heading").first().text(); + title = $("#modal-body .heading").first().text(); + + // for event modals we need some speacial handling + if($("#modal-body .event-wrapper .event-summary").length) { + title = ' '; + var eventsum = $("#modal-body .event-wrapper .event-summary").text(); + title = title + eventsum; + } // and append it to modal title if (title!=="") { diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index 28221dcd0..414df7c1a 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -482,3 +482,159 @@ String.prototype.rtrim = function() { return trimmed; }; + + +// $(document).ready(function() { +// $('#events-calendar').fullCalendar({ +// firstDay: {{$i18n.firstDay}}, +// monthNames: ['{{$i18n.January}}','{{$i18n.February}}','{{$i18n.March}}','{{$i18n.April}}','{{$i18n.May}}','{{$i18n.June}}','{{$i18n.July}}','{{$i18n.August}}','{{$i18n.September}}','{{$i18n.October}}','{{$i18n.November}}','{{$i18n.December}}'], +// monthNamesShort: ['{{$i18n.Jan}}','{{$i18n.Feb}}','{{$i18n.Mar}}','{{$i18n.Apr}}','{{$i18n.May}}','{{$i18n.Jun}}','{{$i18n.Jul}}','{{$i18n.Aug}}','{{$i18n.Sep}}','{{$i18n.Oct}}','{{$i18n.Nov}}','{{$i18n.Dec}}'], +// dayNames: ['{{$i18n.Sunday}}','{{$i18n.Monday}}','{{$i18n.Tuesday}}','{{$i18n.Wednesday}}','{{$i18n.Thursday}}','{{$i18n.Friday}}','{{$i18n.Saturday}}'], +// dayNamesShort: ['{{$i18n.Sun}}','{{$i18n.Mon}}','{{$i18n.Tue}}','{{$i18n.Wed}}','{{$i18n.Thu}}','{{$i18n.Fri}}','{{$i18n.Sat}}'], +// buttonText: { +// prev: "", +// next: "", +// prevYear: "«", +// nextYear: "»", +// today: '{{$i18n.today}}', +// month: '{{$i18n.month}}', +// week: '{{$i18n.week}}', +// day: '{{$i18n.day}}' +// }, +// events: '{{$baseurl}}/events/json/', +// header: { +// left: '', +// // center: 'title', +// right: '' +// }, +// timeFormat: 'H(:mm)', +// eventClick: function(calEvent, jsEvent, view) { +// showEvent(calEvent.id); +// }, +// loading: function(isLoading, view) { +// if(!isLoading) { +// $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); }); +// } +// }, +// +// eventRender: function(event, element, view) { +// //console.log(view.name); +// if (event.item['author-name']==null) return; +// switch(view.name){ +// case "month": +// element.find(".fc-event-title").html( +// "{1} : {2}".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.title +// )); +// break; +// case "agendaWeek": +// element.find(".fc-event-title").html( +// "{1}

{2}

{3}

".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.item.desc, +// event.item.location +// )); +// break; +// case "agendaDay": +// element.find(".fc-event-title").html( +// "{1}

{2}

{3}

".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.item.desc, +// event.item.location +// )); +// break; +// } +// } +// +// }) +// +// // center on date +// var args=location.href.replace(baseurl,"").split("/"); +// if (args.length>=4) { +// $("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1); +// } +// +// // echo the title +// var view = $('#events-calendar').fullCalendar('getView'); +// $('#fc-title').text(view.title); +// +// // show event popup +// var hash = location.hash.split("-") +// if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]); +// +// }); + +// $(document).ready(function() { +// $('#events-calendar').fullCalendar({ +// +// events: '{{$baseurl}}/events/json/', +// header: { +// left: '', +// // center: 'title', +// right: '' +// }, +// timeFormat: 'H(:mm)', +// eventClick: function(calEvent, jsEvent, view) { +// showEvent(calEvent.id); +// }, +// loading: function(isLoading, view) { +// if(!isLoading) { +// $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); }); +// } +// }, +// +// eventRender: function(event, element, view) { +// //console.log(view.name); +// if (event.item['author-name']==null) return; +// switch(view.name){ +// case "month": +// element.find(".fc-event-title").html( +// "{1} : {2}".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.title +// )); +// break; +// case "agendaWeek": +// element.find(".fc-event-title").html( +// "{1}

{2}

{3}

".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.item.desc, +// event.item.location +// )); +// break; +// case "agendaDay": +// element.find(".fc-event-title").html( +// "{1}

{2}

{3}

".format( +// event.item['author-avatar'], +// event.item['author-name'], +// event.item.desc, +// event.item.location +// )); +// break; +// } +// } +// +// }) +// +// // center on date +// var args=location.href.replace(baseurl,"").split("/"); +// if (args.length>=4) { +// $("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1); +// } +// +// // echo the title +// var view = $('#events-calendar').fullCalendar('getView'); +// $('#fc-title').text(view.title); +// +// // show event popup +// var hash = location.hash.split("-") +// if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]); +// +// }); + \ No newline at end of file diff --git a/view/theme/frio/templates/event.tpl b/view/theme/frio/templates/event.tpl new file mode 100644 index 000000000..380bc7cb1 --- /dev/null +++ b/view/theme/frio/templates/event.tpl @@ -0,0 +1,19 @@ + +{{foreach $events as $event}} +
+
+
+ {{if $event.item.author_name}} + {{$event.item.author_name}} + {{/if}} +
+ {{$event.html}} + +
+ {{if $event.item.plink}}{{/if}} + {{if $event.edit}}{{/if}} +
+
+
+
+{{/foreach}} diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl new file mode 100644 index 000000000..ff59833b5 --- /dev/null +++ b/view/theme/frio/templates/event_form.tpl @@ -0,0 +1,53 @@ + +

{{$title}}

+ +

+{{$desc}} +

+ +
+ + + + + + +
{{$s_text}}
+{{$s_dsel}} + +
{{$f_text}}
+{{$f_dsel}} + +
+ +
{{$n_text}}
+ +
+ +
{{$a_text}}
+ +
+ +
{{$t_text}}
+ + + +
{{$d_text}}
+ + + +
{{$l_text}}
+ + +
+ +
{{$sh_text}}
+
+ +{{$acl}} + +
+ + +
+ diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl new file mode 100644 index 000000000..e11f93ea7 --- /dev/null +++ b/view/theme/frio/templates/event_head.tpl @@ -0,0 +1,188 @@ + + + + + + + +{{if $editselect != 'none'}} + + + diff --git a/view/theme/frio/templates/events-js.tpl b/view/theme/frio/templates/events-js.tpl new file mode 100644 index 000000000..dcd522c58 --- /dev/null +++ b/view/theme/frio/templates/events-js.tpl @@ -0,0 +1,41 @@ +
+ {{$tabs}} + {{include file="section_title.tpl" title=$title}} + + + +
+
+ +
+
+ + + +
+ +

+ +
+
+
From 5e98f27fcd99f0431a5f62ca7a825a5ad6a2f8a3 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Mon, 13 Jun 2016 10:19:38 +0200 Subject: [PATCH 02/16] frio: events - work on event_form.tpl + datetime.php --- include/datetime.php | 20 ++++---- mod/events.php | 7 ++- view/theme/frio/templates/event_form.tpl | 59 ++++++++++++++++++------ view/theme/frio/templates/events-js.tpl | 2 +- 4 files changed, 63 insertions(+), 25 deletions(-) diff --git a/include/datetime.php b/include/datetime.php index 89305a240..bbb60ba72 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -202,7 +202,7 @@ function dob($dob) { * @return string Parsed HTML output. */ function datesel($format, $min, $max, $default, $id = 'datepicker') { - return datetimesel($format,$min,$max,$default,$id,true,false, '',''); + return datetimesel($format,$min,$max,$default,'',$id,true,false, '',''); } /** @@ -220,7 +220,7 @@ function datesel($format, $min, $max, $default, $id = 'datepicker') { * @return string Parsed HTML output. */ function timesel($format, $h, $m, $id='timepicker') { - return datetimesel($format,new DateTime(),new DateTime(),new DateTime("$h:$m"),$id,false,true); + return datetimesel($format,new DateTime(),new DateTime(),new DateTime("$h:$m"),'',$id,false,true); } /** @@ -251,7 +251,7 @@ function timesel($format, $h, $m, $id='timepicker') { * @todo Once browser support is better this could probably be replaced with * native HTML5 date picker. */ -function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) { +function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) { // First day of the week (0 = Sunday) $firstDay = get_pconfig(local_user(),'system','first_day_of_week'); @@ -283,9 +283,9 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic $extra_js = ''; $pickers .= ",dayOfWeekStart: ".$firstDay.",lang:'".$lang."'"; if($minfrom != '') - $extra_js .= "\$('#$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})"; + $extra_js .= "\$('id_#$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})"; if($maxfrom != '') - $extra_js .= "\$('#$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})"; + $extra_js .= "\$('#id_$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})"; $readable_format = $dateformat; $readable_format = str_replace('Y','yyyy',$readable_format); @@ -294,10 +294,14 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic $readable_format = str_replace('H','HH',$readable_format); $readable_format = str_replace('i','MM',$readable_format); - $o .= "
"; - $o .= '
'; + $tpl = get_markup_template('field_input.tpl'); + $o .= replace_macros($tpl,array( + '$field' => array($id, $label, $input_text, '', (($required) ? '*' : ''), 'placeholder="' . $readable_format . '" '), + )); +// $o .= "
"; +// $o .= '
'; $o .= ""; return $o; diff --git a/mod/events.php b/mod/events.php index 46f33355b..f6872a616 100644 --- a/mod/events.php +++ b/mod/events.php @@ -561,11 +561,11 @@ function events_content(&$a) { '$title' => t('Event details'), '$desc' => t('Starting date and Title are required.'), '$s_text' => t('Event Starts:') . ' *', - '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),'start_text',true,true,'','',true), + '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),t('Event Starts:'),'start_text',true,true,'','',true), '$n_text' => t('Finish date/time is not known or not relevant'), '$n_checked' => $n_checked, '$f_text' => t('Event Finishes:'), - '$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),'finish_text',true,true,'start_text'), + '$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),t('Event Finishes:'),'finish_text',true,true,'start_text'), '$a_text' => t('Adjust for viewer timezone'), '$a_checked' => $a_checked, '$d_text' => t('Description:'), @@ -574,8 +574,11 @@ function events_content(&$a) { '$l_orig' => $l_orig, '$t_text' => t('Title:') . ' *', '$t_orig' => $t_orig, + '$summary' => array('summary', t('Title:'), $t_orig, '', '*'), '$sh_text' => t('Share this event'), '$sh_checked' => $sh_checked, + '$nofinish' => array('nofinish', t('Finish date/time is not known or not relevant'), $n_checked), + '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked), '$preview' => t('Preview'), '$acl' => $acl, '$submit' => t('Submit') diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl index ff59833b5..ebe4faa35 100644 --- a/view/theme/frio/templates/event_form.tpl +++ b/view/theme/frio/templates/event_form.tpl @@ -12,28 +12,59 @@ -
{{$s_text}}
{{$s_dsel}} -
{{$f_text}}
{{$f_dsel}} -
+{{include file="field_checkbox.tpl" field=$nofinish}} -
{{$n_text}}
+{{include file="field_checkbox.tpl" field=$adjust}} -
+{{include file="field_input.tpl" field=$summary}} -
{{$a_text}}
+
+
{{$d_text}}
+ + +
+
{{$l_text}}
diff --git a/view/theme/frio/templates/events-js.tpl b/view/theme/frio/templates/events-js.tpl index dcd522c58..93c131b36 100644 --- a/view/theme/frio/templates/events-js.tpl +++ b/view/theme/frio/templates/events-js.tpl @@ -1,7 +1,7 @@
{{$tabs}} {{include file="section_title.tpl" title=$title}} - +
From 0167a2bd61f1153298607f2a8794e92bab89b17d Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 16 Jun 2016 11:38:12 +0200 Subject: [PATCH 03/16] port of Hubzillas code highlight feature --- include/bbcode.php | 12 + include/text.php | 40 + library/Text_Highlighter/README | 455 +++ library/Text_Highlighter/TODO | 12 + library/Text_Highlighter/Text/Highlighter.php | 398 +++ .../Text/Highlighter/ABAP.php | 519 +++ .../Text/Highlighter/AVRC.php | 894 ++++++ .../Text_Highlighter/Text/Highlighter/CPP.php | 891 ++++++ .../Text_Highlighter/Text/Highlighter/CSS.php | 437 +++ .../Text/Highlighter/DIFF.php | 384 +++ .../Text_Highlighter/Text/Highlighter/DTD.php | 426 +++ .../Text/Highlighter/Generator.php | 1291 ++++++++ .../Text/Highlighter/HTML.php | 234 ++ .../Text/Highlighter/JAVA.php | 802 +++++ .../Text/Highlighter/JAVASCRIPT.php | 631 ++++ .../Text/Highlighter/MYSQL.php | 434 +++ .../Text/Highlighter/PERL.php | 1352 ++++++++ .../Text_Highlighter/Text/Highlighter/PHP.php | 1107 +++++++ .../Text/Highlighter/PYTHON.php | 647 ++++ .../Text/Highlighter/RUBY.php | 825 +++++ .../Text/Highlighter/Renderer.php | 164 + .../Text/Highlighter/Renderer/Array.php | 200 ++ .../Text/Highlighter/Renderer/BB.php | 238 ++ .../Text/Highlighter/Renderer/Console.php | 208 ++ .../Text/Highlighter/Renderer/Html.php | 465 +++ .../Text/Highlighter/Renderer/HtmlTags.php | 187 ++ .../Text/Highlighter/Renderer/JSON.php | 86 + .../Text/Highlighter/Renderer/XML.php | 104 + .../Text_Highlighter/Text/Highlighter/SH.php | 1225 +++++++ .../Text_Highlighter/Text/Highlighter/SQL.php | 419 +++ .../Text/Highlighter/VBSCRIPT.php | 318 ++ .../Text_Highlighter/Text/Highlighter/XML.php | 263 ++ library/Text_Highlighter/abap.xml | 802 +++++ library/Text_Highlighter/avrc.xml | 316 ++ library/Text_Highlighter/cpp.xml | 201 ++ library/Text_Highlighter/css.xml | 368 +++ library/Text_Highlighter/diff.xml | 45 + library/Text_Highlighter/dtd.xml | 66 + library/Text_Highlighter/generate | 171 + library/Text_Highlighter/generate.bat | 188 ++ library/Text_Highlighter/html.xml | 33 + library/Text_Highlighter/java.xml | 2824 +++++++++++++++++ library/Text_Highlighter/javascript.xml | 174 + library/Text_Highlighter/mysql.xml | 424 +++ library/Text_Highlighter/perl.xml | 439 +++ library/Text_Highlighter/php.xml | 194 ++ library/Text_Highlighter/python.xml | 229 ++ library/Text_Highlighter/release | 4 + library/Text_Highlighter/ruby.xml | 141 + library/Text_Highlighter/sample.css | 62 + library/Text_Highlighter/sh.xml | 242 ++ library/Text_Highlighter/sql.xml | 496 +++ library/Text_Highlighter/vbscript.xml | 305 ++ library/Text_Highlighter/xml.xml | 37 + view/templates/head.tpl | 1 + view/theme/frio/templates/head.tpl | 1 + 56 files changed, 23431 insertions(+) create mode 100644 library/Text_Highlighter/README create mode 100644 library/Text_Highlighter/TODO create mode 100644 library/Text_Highlighter/Text/Highlighter.php create mode 100644 library/Text_Highlighter/Text/Highlighter/ABAP.php create mode 100644 library/Text_Highlighter/Text/Highlighter/AVRC.php create mode 100644 library/Text_Highlighter/Text/Highlighter/CPP.php create mode 100644 library/Text_Highlighter/Text/Highlighter/CSS.php create mode 100644 library/Text_Highlighter/Text/Highlighter/DIFF.php create mode 100644 library/Text_Highlighter/Text/Highlighter/DTD.php create mode 100644 library/Text_Highlighter/Text/Highlighter/Generator.php create mode 100644 library/Text_Highlighter/Text/Highlighter/HTML.php create mode 100644 library/Text_Highlighter/Text/Highlighter/JAVA.php create mode 100644 library/Text_Highlighter/Text/Highlighter/JAVASCRIPT.php create mode 100644 library/Text_Highlighter/Text/Highlighter/MYSQL.php create mode 100644 library/Text_Highlighter/Text/Highlighter/PERL.php create mode 100644 library/Text_Highlighter/Text/Highlighter/PHP.php create mode 100644 library/Text_Highlighter/Text/Highlighter/PYTHON.php create mode 100644 library/Text_Highlighter/Text/Highlighter/RUBY.php create mode 100644 library/Text_Highlighter/Text/Highlighter/Renderer.php create mode 100644 library/Text_Highlighter/Text/Highlighter/Renderer/Array.php create mode 100644 library/Text_Highlighter/Text/Highlighter/Renderer/BB.php create mode 100644 library/Text_Highlighter/Text/Highlighter/Renderer/Console.php create mode 100644 library/Text_Highlighter/Text/Highlighter/Renderer/Html.php create mode 100644 library/Text_Highlighter/Text/Highlighter/Renderer/HtmlTags.php create mode 100644 library/Text_Highlighter/Text/Highlighter/Renderer/JSON.php create mode 100644 library/Text_Highlighter/Text/Highlighter/Renderer/XML.php create mode 100644 library/Text_Highlighter/Text/Highlighter/SH.php create mode 100644 library/Text_Highlighter/Text/Highlighter/SQL.php create mode 100644 library/Text_Highlighter/Text/Highlighter/VBSCRIPT.php create mode 100644 library/Text_Highlighter/Text/Highlighter/XML.php create mode 100644 library/Text_Highlighter/abap.xml create mode 100644 library/Text_Highlighter/avrc.xml create mode 100644 library/Text_Highlighter/cpp.xml create mode 100644 library/Text_Highlighter/css.xml create mode 100644 library/Text_Highlighter/diff.xml create mode 100644 library/Text_Highlighter/dtd.xml create mode 100644 library/Text_Highlighter/generate create mode 100644 library/Text_Highlighter/generate.bat create mode 100644 library/Text_Highlighter/html.xml create mode 100644 library/Text_Highlighter/java.xml create mode 100644 library/Text_Highlighter/javascript.xml create mode 100644 library/Text_Highlighter/mysql.xml create mode 100644 library/Text_Highlighter/perl.xml create mode 100644 library/Text_Highlighter/php.xml create mode 100644 library/Text_Highlighter/python.xml create mode 100644 library/Text_Highlighter/release create mode 100644 library/Text_Highlighter/ruby.xml create mode 100644 library/Text_Highlighter/sample.css create mode 100644 library/Text_Highlighter/sh.xml create mode 100644 library/Text_Highlighter/sql.xml create mode 100644 library/Text_Highlighter/vbscript.xml create mode 100644 library/Text_Highlighter/xml.xml diff --git a/include/bbcode.php b/include/bbcode.php index 62f56558f..01aae691b 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -717,6 +717,13 @@ function bb_CleanPictureLinks($text) { return ($text); } +function bb_highlight($match) { + if(in_array(strtolower($match[1]),['php','css','mysql','sql','abap','diff','html','perl','ruby', + 'vbscript','avrc','dtd','java','xml','cpp','python','javascript','js','sh'])) + return text_highlight($match[2],strtolower($match[1])); + return $match[0]; +} + // BBcode 2 HTML was written by WAY2WEB.net // extended to work with Mistpark/Friendica - Mike Macgirvin @@ -769,6 +776,11 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal if (!$tryoembed) $Text = preg_replace("/\[share(.*?)avatar\s?=\s?'.*?'\s?(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","\n[share$1$2]$3[/share]",$Text); + // Check for [code] text here, before the linefeeds are messed with. + // The highlighter will unescape and re-escape the content. + if (strpos($Text,'[code=') !== false) { + $Text = preg_replace_callback("/\[code=(.*?)\](.*?)\[\/code\]/ism", 'bb_highlight', $Text); + } // Convert new line chars to html
tags // nlbr seems to be hopelessly messed up diff --git a/include/text.php b/include/text.php index c57af1feb..16c0845ac 100644 --- a/include/text.php +++ b/include/text.php @@ -2087,3 +2087,43 @@ function format_network_name($network, $url = 0) { } } + +/** + * @brief Syntax based code highlighting for popular languages. + * @param string $s Code block + * @param string $lang Programming language + * @return string Formated html + */ +function text_highlight($s,$lang) { + if($lang === 'js') + $lang = 'javascript'; + if(! strpos('Text_Highlighter',get_include_path())) { + set_include_path(get_include_path() . PATH_SEPARATOR . 'library/Text_Highlighter'); + } + require_once('library/Text_Highlighter/Text/Highlighter.php'); + require_once('library/Text_Highlighter/Text/Highlighter/Renderer/Html.php'); + $options = array( + 'numbers' => HL_NUMBERS_LI, + 'tabsize' => 4, + ); + $tag_added = false; + $s = trim(html_entity_decode($s,ENT_COMPAT)); + $s = str_replace(" ","\t",$s); + if($lang === 'php') { + if(strpos('setRenderer($renderer); + $o = $hl->highlight($s); + $o = str_replace([" ","\n"],["    ",''],$o); + if($tag_added) { + $b = substr($o,0,strpos($o,'
  • ')); + $e = substr($o,strpos($o,'
  • ')); + $o = $b . $e; + } + return('' . $o . ''); +} diff --git a/library/Text_Highlighter/README b/library/Text_Highlighter/README new file mode 100644 index 000000000..88f71aed2 --- /dev/null +++ b/library/Text_Highlighter/README @@ -0,0 +1,455 @@ +# $Id$ + +Introduction +============ + +Text_Highlighter is a class for syntax highlighting. The main idea is to +simplify creation of subclasses implementing syntax highlighting for +particular language. Subclasses do not implement any new functioanality, they +just provide syntax highlighting rules. The rules sources are in XML format. +To create a highlighter for a language, there is no need to code a new class +manually. Simply describe the rules in XML file and use Text_Highlighter_Generator +to create a new class. + + +This document does not contain a formal description of API - it is very +simple, and I believe providing some examples of code is sufficient. + + +Highlighter XML source +====================== + +Basics +------ + +Creating a new syntax highlighter begins with describing the highlighting +rules. There are two basic elements: block and region. A block is just a +portion of text matching a regular expression and highlighted with a single +color. Keyword is an example of a block. A region is defined by two regular +expressions: one for start of region, and another for the end. The main +difference from a block is that a region can contain blocks and regions +(including same-named regions). An example of a region is a group of +statements enclosed in curly brackets (this is used in many languages, for +example PHP and C). Also, characters matching start and end of a region may be +highlighted with their own color, and region contents with another. + +Blocks and regions may be declared as contained. Contained blocks and regions +can only appear inside regions. If a region or a block is not declared as +contained, it can appear both on top level and inside regions. Block or region +declared as not-contained can only appear on top level. + +For any region, a list of blocks and regions that can appear inside this +region can be specified. + +In this document, the term "color group" is used. Chunks of text assigned to +same color group will be highlighted with same color. Note that in versions +prior 0.5.0 color goups were refered as CSS classes, but since 0.5.0 not only +HTML output is supported, so "color group" is more appropriate term. + +Elements +-------- + +The toplevel element is . Attribute lang is required and denotes +the name of the language. Its value is used as a part of generated class name, +and must only contain letters, digits and underscores. Optional attribute +case, when given value yes, makes the language case sensitive (default is case +insensitive). Allowed subelements are: + + * : Information about the authors of the file. + : Information about a single author of the file. (May be used + multiple times, one per author.) + - name="...": Author's name. Required. + - email="...": Author's email address. Optional. + + * : Default color group. + - innerGroup="...": color group name. Required. + + * : Region definition + - name="...": Region name. Required. + - innerGroup="...": Default color group of region contents. Required. + - delimGroup="...": color group of start and end of region. Optional, + defaults to value of innerGroup attribute. + - start="...", end="...": Regular expression matching start and end + of region. Required. Regular expression delimiters are optional, but + if you need to specify delimiter, use /. The only case when the + delimiters are needed, is specifying regular expression modifiers, + such as m or U. Examples: \/\* or /$/m. + - contained="yes": Marks region as contained. + - never-contained="yes": Marks region as not-contained. + - : Elements allowed inside this region. + - all="yes" Region can contain any other region or block + (except not-contained). May be used multiple times. + - Do not allow certain regions or blocks. + - region="..." Name of region not allowed within + current region. + - block="..." Name of block not allowed within + current region. + - region="..." Name of region allowed within current region. + - block="..." Name of block allowed within current region. + - Only allow this region within certain regions. May be + used multiple times. + - block="..." Name of parent region + + * : Block definition + - name="...": Block name. Required. + - innerGroup="...": color group of block contents. Optional. If not + specified, color group of parent region or default color group will be + used. One would only want to omit this attribute if there are + keyword groups (see below) inherited from this block, and no special + highlighting should apply when the block does not match the keyword. + - match="..." Regular expression matching the block. Required. + Regular expression delimiters are optional, but if you need to + specify delimiter, use /. The only case when the delimiters are + needed, is specifying regular expression modifiers, such as m or U. + Examples: #|\/\/ or /$/m. + - contained="yes": Marks block as contained. + - never-contained="yes": Marks block as not-contained. + - Only allow this block within certain regions. May be used + multiple times. + - block="..." Name of parent region + - multiline="yes": Marks block as multi-line. By default, whole + blocks are assumed to reside in a single line. This make the things + faster. If you need to declare a multi-line block, use this + attribute. + - : Assigns another color group to a part of the block that + matched a subpattern. + - index="n": Subpattern index. Required. + - innerGroup="...": color group name. Required. + + This is an example from CSS highlighter: the measure is matched as + a whole, but the measurement units are highlighted with different + color. + + + + + + + * : Keyword group definition. Keyword groups are useful when you + want to highlight some words that match a condition for a block with a + different color. Keywords are defined with literal match, not regular + expressions. For example, you have a block named identifier matching a + general identifier, and want to highlight reserved words (which match + this block as well) with different color. You inherit a keyword group + "reserved" from "identifier" block. + - name="...": Keyword group. Required. + - ifdef="...", ifndef="..." : Conditional declaration. See + "Conditions" below. + - inherits="...": Inherited block name. Required. + - innerGroup="...": color group of keyword group. Required. + - case="yes|no": Overrides case-sensitivity of the language. + Optional, defaults to global value. + - : Single keyword definition. + - match="..." The keyword. Note: this is not a regular + expression, but literal match (possibly case insensitive). + +Note that for BC reasons element partClass is alias for partGroup, and +attributes innerClass and delimClass are aliases of innerGroup and +delimGroup, respectively. + + +Conditions +---------- + +Conditional declarations allow enabling or disabling certain highlighting +rules at runtime. For example, Java highlighter has a very big list of +keywords matching Java standard classes. Finding a match in this list can take +much time. For that reason, corresponding keyword group is declared with +"ifdef" attribute : + + + + + + ... + ... + + + + + +This keyword group will be only enabled when "java.builtins" is passed as an +element of "defines" option: + + $options = array( + 'defines' => array( + 'java.builtins', + ), + 'numbers' => HL_NUMBERS_TABLE, + ); + $highlighter = Text_Highlighter::factory('java', $options); + +"ifndef" attribute has reverse meaning. + +Currently, "ifdef" and "ifndef" attributes are only supported for +tag. + + + +Class generation +================ + +Creating XML description of highlighting rules is the most complicated part of +the process. To generate the class, you need just few lines of code: + + generate(); + $generator->saveCode('PHP.php'); + ?> + + + +Command-line class generation tool +================================== + +Example from previous section looks pretty simple, but it does not handle any +errors which may occur during parsing of XML source. The package provides a +command-line script to make generation of classes even more simple, and takes +care of possible errors. It is called generate (on Unix/Linux) or generate.bat +(on Windows). This script is able to process multiple files in one run, and +also to process XML from standard input and write generated code to standard +output. + + Usage: + generate options + + Options: + -x filename, --xml=filename + source XML file. Multiple input files can be specified, in which + case each -x option must be followed by -p unless -d is specified + Defaults to stdin + -p filename, --php=filename + destination PHP file. Defaults to stdout. If specied multiple times, + each -p must follow -x + -d dirname, --dir=dirname + Default destination directory. File names will be taken from XML input + ("lang" attribute of tag) + -h, --help + This help + +Examples + + Read from php.xml, write to PHP.php + + generate -x php.xml -p PHP.php + + Read from php.xml, write to standard output + + generate -x php.xml + + Read from php.xml, write to PHP.php, read from xml.xml, write to XML.php + + generate -x php.xml -p PHP.php -x xml.xml -p XML.php + + Read from php.xml, write to /some/dir/PHP.php, read from xml.xml, write to + /some/dir/XML.php (assuming that xml.xml contains , and + php.xml contains ) + + generate -x php.xml -x xml.xml -d /some/dir/ + + + +Renderers +========= + +Introduction +------------ + +Text_Highlighter supports renderes. Using renderers, you can get output in +different formats. Two renderers are included in the package: + + - HTML renderer. Generates HTML output. A style sheet should be linked to + the document to display colored text + + - Console renderer. Can be used to output highlighted text to + color-capable terminals, either directly or trough less -r + + +Renderers API +------------- + +Renderers are subclasses of Text_Highlighter_Renderer. Renderer should +override at least two methods - acceptToken and getOutput. Overriding other +methods is optional, depending on the nature of renderer's output and details +of implementation. + + string reset() + resets renderer state. This method is called every time before a new + source file is highlighted. + + string preprocess(string $code) + preprocesses code. Can be used, for example, to normalize whitespace + before highlighting. Returns preprocessed string. + + void acceptToken(string $group, string $content) + the core method of the renderer. Highlighter passes chunks of text to + this method in $content, and color group in $group + + void finalize() + signals the renderer that no more tokens are available. + + mixed getOutput() + returns generated output. + + +Setting renderer options +-------------------------------- + +Renderers accept an optional argument to their constructor - options array. +Elements of this array are renderer-specific. + +HTML renderer +------------- + +HTML renderer produces HTML output with optional line numbering. The renderer +itself does not provide information about actual colors of highlighted text. +Instead, is used, where XXX is replaced with color group +name (hl-var, hl-string, etc.). It is up to you to create a CSS stylesheet. +If 'use_language' option with value evaluating to true was passed, class names +will be formatted as "LANG-hl-XXX", where LANG is language name as defined in +highlighter XML source ("lang" attribute of tag) in lower case. + +There are 3 special CSS classes: + + hl-main - this class applies to whole output or right table column, + depending on 'numbers' option + hl-gutter - applies to left column in table + hl-table - applies to whole table + +HTML renderer accepts following options (each being optional): + + * numbers - line numbering style. + 0 - no numbering (default) + HL_NUMBERS_LI - use
      for line numbering + HL_NUMBERS_TABLE - create a 2-column table, with line numbers in left + column and highlighted text in right column + + * tabsize - tabulation size. Defaults to 4 + + Example: + + require_once 'Text/Highlighter/Renderer/Html.php'; + $options = array( + 'numbers' => HL_NUMBERS_LI, + 'tabsize' => 8, + ); + $renderer = new Text_Highlighter_Renderer_HTML($options); + +Console renderer +---------------- + +Console renderer produces output for displaying on a color-capable terminal, +either directly or through less -r, using ANSI escape sequences. By default, +this renderer only highlights most common color groups. Additional colors +can be specified using 'colors' option. This renderer also accepts 'numbers' +option - a boolean value, and 'tabsize' option. + + Example : + + require_once 'Text/Highlighter/Renderer/Console.php'; + $colors = array( + 'prepro' => "\033[35m", + 'types' => "\033[32m", + ); + $options = array( + 'numbers' => true, + 'tabsize' => 8, + 'colors' => $colors, + ); + $renderer = new Text_Highlighter_Renderer_Console($options); + + +ANSI color escape sequences have the following format: + + ESC[#;#;....;#m + +where ESC is character with ASCII code 27 (033 octal, 0x1B hexadecimal). # is +one of the following: + + 0 for normal display + 1 for bold on + 4 underline (mono only) + 5 blink on + 7 reverse video on + 8 nondisplayed (invisible) + 30 black foreground + 31 red foreground + 32 green foreground + 33 yellow foreground + 34 blue foreground + 35 magenta foreground + 36 cyan foreground + 37 white foreground + 40 black background + 41 red background + 42 green background + 43 yellow background + 44 blue background + 45 magenta background + 46 cyan background + 47 white background + + +How to use Text_Highlighter class +================================= + +Creating a highlighter object +----------------------------- + +To create a highlighter for a certain language, use Text_Highlighter::factory() +static method: + + require_once 'Text/Highlighter.php'; + $hl = Text_Highlighter::factory('php'); + + +Setting a renderer +------------------ + +Actual output is produced by a renderer. + + require_once 'Text/Highlighter.php'; + require_once 'Text/Highlighter/Renderer/Html.php'; + $options = array( + 'numbers' => HL_NUMBERS_LI, + 'tabsize' => 8, + ); + $renderer = new Text_Highlighter_Renderer_HTML($options); + $hl = Text_Highlighter::factory('php'); + $hl->setRenderer($renderer); + +Note that for BC reasons, it is possible to use highlighter without setting a +renderer. If no renderer is set, HTML renderer will be used by default. In +this case, you should pass options as second parameter to factory method. The +following example works exactly as previous one: + + require_once 'Text/Highlighter.php'; + $options = array( + 'numbers' => HL_NUMBERS_LI, + 'tabsize' => 8, + ); + $hl = Text_Highlighter::factory('php', $options); + + +Getting output +-------------- + +And finally, do the highlighting and get the output: + + require_once 'Text/Highlighter.php'; + require_once 'Text/Highlighter/Renderer/Html.php'; + $options = array( + 'numbers' => HL_NUMBERS_LI, + 'tabsize' => 8, + ); + $renderer = new Text_Highlighter_Renderer_HTML($options); + $hl = Text_Highlighter::factory('php'); + $hl->setRenderer($renderer); + $html = $hl->highlight(file_get_contents('example.php')); + +# vim: set autoindent tabstop=4 shiftwidth=4 softtabstop=4 tw=78: */ + diff --git a/library/Text_Highlighter/TODO b/library/Text_Highlighter/TODO new file mode 100644 index 000000000..77a148b8a --- /dev/null +++ b/library/Text_Highlighter/TODO @@ -0,0 +1,12 @@ +# $Id$ + +Major issues to solve (but I currently have no idea how) : + +- speedup highlighting process + +- switching between highlighters depending on context, for example : + PHP code -> HTML -> (JavaScript|CSS) + + +# vim: set autoindent tabstop=4 shiftwidth=4 softtabstop=4 tw=78: */ + diff --git a/library/Text_Highlighter/Text/Highlighter.php b/library/Text_Highlighter/Text/Highlighter.php new file mode 100644 index 000000000..480113c16 --- /dev/null +++ b/library/Text_Highlighter/Text/Highlighter.php @@ -0,0 +1,398 @@ + + * @copyright 2004-2006 Andrey Demenev + * @license http://www.php.net/license/3_0.txt PHP License + * @version CVS: $Id$ + * @link http://pear.php.net/package/Text_Highlighter + */ + +// require_once 'PEAR.php'; + +// {{{ BC constants + +// BC trick : define constants related to default +// renderer if needed +if (!defined('HL_NUMBERS_LI')) { + /**#@+ + * Constant for use with $options['numbers'] + * @see Text_Highlighter_Renderer_Html::_init() + */ + /** + * use numbered list + */ + define ('HL_NUMBERS_LI' , 1); + /** + * Use 2-column table with line numbers in left column and code in right column. + * Forces $options['tag'] = HL_TAG_PRE + */ + define ('HL_NUMBERS_TABLE' , 2); + /**#@-*/ +} + +// }}} +// {{{ constants +/** + * for our purpose, it is infinity + */ +define ('HL_INFINITY', 1000000000); + +// }}} + +/** + * Text highlighter base class + * + * @author Andrey Demenev + * @copyright 2004-2006 Andrey Demenev + * @license http://www.php.net/license/3_0.txt PHP License + * @version Release: @package_version@ + * @link http://pear.php.net/package/Text_Highlighter + */ + +// {{{ Text_Highlighter + +/** + * Text highlighter base class + * + * This class implements all functions necessary for highlighting, + * but it does not contain highlighting rules. Actual highlighting is + * done using a descendent of this class. + * + * One is not supposed to manually create descendent classes. + * Instead, describe highlighting rules in XML format and + * use {@link Text_Highlighter_Generator} to create descendent class. + * Alternatively, an instance of a descendent class can be created + * directly. + * + * Use {@link Text_Highlighter::factory()} to create an + * object for particular language highlighter + * + * Usage example + * + *require_once 'Text/Highlighter.php'; + *$hlSQL = Text_Highlighter::factory('SQL',array('numbers'=>true)); + *echo $hlSQL->highlight('SELECT * FROM table a WHERE id = 12'); + * + * + * @author Andrey Demenev + * @package Text_Highlighter + * @access public + */ + +class Text_Highlighter +{ + // {{{ members + + /** + * Syntax highlighting rules. + * Auto-generated classes set this var + * + * @access protected + * @see _init + * @var array + */ + var $_syntax; + + /** + * Renderer object. + * + * @access private + * @var array + */ + var $_renderer; + + /** + * Options. Keeped for BC + * + * @access protected + * @var array + */ + var $_options = array(); + + /** + * Conditionds + * + * @access protected + * @var array + */ + var $_conditions = array(); + + /** + * Disabled keywords + * + * @access protected + * @var array + */ + var $_disabled = array(); + + /** + * Language + * + * @access protected + * @var string + */ + var $_language = ''; + + // }}} + // {{{ _checkDefines + + /** + * Called by subclssses' constructors to enable/disable + * optional highlighter rules + * + * @param array $defines Conditional defines + * + * @access protected + */ + function _checkDefines() + { + if (isset($this->_options['defines'])) { + $defines = $this->_options['defines']; + } else { + $defines = array(); + } + foreach ($this->_conditions as $name => $actions) { + foreach($actions as $action) { + $present = in_array($name, $defines); + if (!$action[1]) { + $present = !$present; + } + if ($present) { + unset($this->_disabled[$action[0]]); + } else { + $this->_disabled[$action[0]] = true; + } + } + } + } + + // }}} + // {{{ factory + + /** + * Create a new Highlighter object for specified language + * + * @param string $lang language, for example "SQL" + * @param array $options Rendering options. This + * parameter is only keeped for BC reasons, use + * {@link Text_Highlighter::setRenderer()} instead + * + * @return mixed a newly created Highlighter object, or + * a PEAR error object on error + * + * @static + * @access public + */ + function &factory($lang, $options = array()) + { + $lang = strtoupper($lang); + @include_once 'Text/Highlighter/' . $lang . '.php'; + + $classname = 'Text_Highlighter_' . $lang; + + if (!class_exists($classname)) { + return PEAR::raiseError('Highlighter for ' . $lang . ' not found'); + } + + $obj = new $classname($options); + + return $obj; + } + + // }}} + // {{{ setRenderer + + /** + * Set renderer object + * + * @param object $renderer Text_Highlighter_Renderer + * + * @access public + */ + function setRenderer(&$renderer) + { + $this->_renderer = $renderer; + } + + // }}} + + /** + * Helper function to find matching brackets + * + * @access private + */ + function _matchingBrackets($str) + { + return strtr($str, '()<>[]{}', ')(><][}{'); + } + + + + + function _getToken() + { + if (!empty($this->_tokenStack)) { + return array_pop($this->_tokenStack); + } + if ($this->_pos >= $this->_len) { + return NULL; + } + + if ($this->_state != -1 && preg_match($this->_endpattern, $this->_str, $m, PREG_OFFSET_CAPTURE, $this->_pos)) { + $endpos = $m[0][1]; + $endmatch = $m[0][0]; + } else { + $endpos = -1; + } + preg_match ($this->_regs[$this->_state], $this->_str, $m, PREG_OFFSET_CAPTURE, $this->_pos); + $n = 1; + + + foreach ($this->_counts[$this->_state] as $i=>$count) { + if (!isset($m[$n])) { + break; + } + if ($m[$n][1]>-1 && ($endpos == -1 || $m[$n][1] < $endpos)) { + if ($this->_states[$this->_state][$i] != -1) { + $this->_tokenStack[] = array($this->_delim[$this->_state][$i], $m[$n][0]); + } else { + $inner = $this->_inner[$this->_state][$i]; + if (isset($this->_parts[$this->_state][$i])) { + $parts = array(); + $partpos = $m[$n][1]; + for ($j=1; $j<=$count; $j++) { + if ($m[$j+$n][1] < 0) { + continue; + } + if (isset($this->_parts[$this->_state][$i][$j])) { + if ($m[$j+$n][1] > $partpos) { + array_unshift($parts, array($inner, substr($this->_str, $partpos, $m[$j+$n][1]-$partpos))); + } + array_unshift($parts, array($this->_parts[$this->_state][$i][$j], $m[$j+$n][0])); + } + $partpos = $m[$j+$n][1] + strlen($m[$j+$n][0]); + } + if ($partpos < $m[$n][1] + strlen($m[$n][0])) { + array_unshift($parts, array($inner, substr($this->_str, $partpos, $m[$n][1] - $partpos + strlen($m[$n][0])))); + } + $this->_tokenStack = array_merge($this->_tokenStack, $parts); + } else { + foreach ($this->_keywords[$this->_state][$i] as $g => $re) { + if (isset($this->_disabled[$g])) { + continue; + } + if (preg_match($re, $m[$n][0])) { + $inner = $this->_kwmap[$g]; + break; + } + } + $this->_tokenStack[] = array($inner, $m[$n][0]); + } + } + if ($m[$n][1] > $this->_pos) { + $this->_tokenStack[] = array($this->_lastinner, substr($this->_str, $this->_pos, $m[$n][1]-$this->_pos)); + } + $this->_pos = $m[$n][1] + strlen($m[$n][0]); + if ($this->_states[$this->_state][$i] != -1) { + $this->_stack[] = array($this->_state, $this->_lastdelim, $this->_lastinner, $this->_endpattern); + $this->_lastinner = $this->_inner[$this->_state][$i]; + $this->_lastdelim = $this->_delim[$this->_state][$i]; + $l = $this->_state; + $this->_state = $this->_states[$this->_state][$i]; + $this->_endpattern = $this->_end[$this->_state]; + if ($this->_subst[$l][$i]) { + for ($k=0; $k<=$this->_counts[$l][$i]; $k++) { + if (!isset($m[$i+$k])) { + break; + } + $quoted = preg_quote($m[$n+$k][0], '/'); + $this->_endpattern = str_replace('%'.$k.'%', $quoted, $this->_endpattern); + $this->_endpattern = str_replace('%b'.$k.'%', $this->_matchingBrackets($quoted), $this->_endpattern); + } + } + } + return array_pop($this->_tokenStack); + } + $n += $count + 1; + } + + if ($endpos > -1) { + $this->_tokenStack[] = array($this->_lastdelim, $endmatch); + if ($endpos > $this->_pos) { + $this->_tokenStack[] = array($this->_lastinner, substr($this->_str, $this->_pos, $endpos-$this->_pos)); + } + list($this->_state, $this->_lastdelim, $this->_lastinner, $this->_endpattern) = array_pop($this->_stack); + $this->_pos = $endpos + strlen($endmatch); + return array_pop($this->_tokenStack); + } + $p = $this->_pos; + $this->_pos = HL_INFINITY; + return array($this->_lastinner, substr($this->_str, $p)); + } + + + + + // {{{ highlight + + /** + * Highlights code + * + * @param string $str Code to highlight + * @access public + * @return string Highlighted text + * + */ + + function highlight($str) + { + if (!($this->_renderer)) { + include_once('Text/Highlighter/Renderer/Html.php'); + $this->_renderer = new Text_Highlighter_Renderer_Html($this->_options); + } + $this->_state = -1; + $this->_pos = 0; + $this->_stack = array(); + $this->_tokenStack = array(); + $this->_lastinner = $this->_defClass; + $this->_lastdelim = $this->_defClass; + $this->_endpattern = ''; + $this->_renderer->reset(); + $this->_renderer->setCurrentLanguage($this->_language); + $this->_str = $this->_renderer->preprocess($str); + $this->_len = strlen($this->_str); + while ($token = $this->_getToken()) { + $this->_renderer->acceptToken($token[0], $token[1]); + } + $this->_renderer->finalize(); + return $this->_renderer->getOutput(); + } + + // }}} + +} + +// }}} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * End: + */ + +?> diff --git a/library/Text_Highlighter/Text/Highlighter/ABAP.php b/library/Text_Highlighter/Text/Highlighter/ABAP.php new file mode 100644 index 000000000..b2f7bda94 --- /dev/null +++ b/library/Text_Highlighter/Text/Highlighter/ABAP.php @@ -0,0 +1,519 @@ + + * + */ + +/** + * @ignore + */ + +require_once 'Text/Highlighter.php'; + +/** + * Auto-generated class. ABAP syntax highlighting + * + * @author Stoyan Stefanov + * @category Text + * @package Text_Highlighter + * @copyright 2004-2006 Andrey Demenev + * @license http://www.php.net/license/3_0.txt PHP License + * @version Release: @package_version@ + * @link http://pear.php.net/package/Text_Highlighter + */ +class Text_Highlighter_ABAP extends Text_Highlighter +{ + var $_language = 'abap'; + + /** + * PHP4 Compatible Constructor + * + * @param array $options + * @access public + */ + function Text_Highlighter_ABAP($options=array()) + { + $this->__construct($options); + } + + + /** + * Constructor + * + * @param array $options + * @access public + */ + function __construct($options=array()) + { + + $this->_options = $options; + $this->_regs = array ( + -1 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)^\\*|")|((?i)\')|((?i)[a-z_\\-]\\w*)/', + 0 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)^\\*|")|((?i)\')|((?i)0[xX][\\da-f]+)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)[a-z_\\-]\\w*)/', + 1 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)^\\*|")|((?i)\')|((?i)0[xX][\\da-f]+)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)[a-z_\\-]\\w*)/', + 2 => '/((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)^\\*|")|((?i)\')|((?i)0[xX][\\da-f]+)|((?i)\\d\\d*|\\b0\\b)|((?i)0[0-7]+)|((?i)(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)[a-z_\\-]\\w*)/', + 3 => '//', + 4 => '//', + ); + $this->_counts = array ( + -1 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + ), + 0 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + ), + 1 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + ), + 2 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_delim = array ( + -1 => + array ( + 0 => 'brackets', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'comment', + 4 => 'quotes', + 5 => '', + ), + 0 => + array ( + 0 => 'brackets', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'comment', + 4 => 'quotes', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => '', + ), + 1 => + array ( + 0 => 'brackets', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'comment', + 4 => 'quotes', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => '', + ), + 2 => + array ( + 0 => 'brackets', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'comment', + 4 => 'quotes', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => '', + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_inner = array ( + -1 => + array ( + 0 => 'code', + 1 => 'code', + 2 => 'code', + 3 => 'comment', + 4 => 'string', + 5 => 'identifier', + ), + 0 => + array ( + 0 => 'code', + 1 => 'code', + 2 => 'code', + 3 => 'comment', + 4 => 'string', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'identifier', + ), + 1 => + array ( + 0 => 'code', + 1 => 'code', + 2 => 'code', + 3 => 'comment', + 4 => 'string', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'identifier', + ), + 2 => + array ( + 0 => 'code', + 1 => 'code', + 2 => 'code', + 3 => 'comment', + 4 => 'string', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'identifier', + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_end = array ( + 0 => '/(?i)\\}/', + 1 => '/(?i)\\)/', + 2 => '/(?i)\\]/', + 3 => '/(?mi)$/', + 4 => '/(?i)\'/', + ); + $this->_states = array ( + -1 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => -1, + ), + 0 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => -1, + ), + 1 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => -1, + ), + 2 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => -1, + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_keywords = array ( + -1 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => -1, + 5 => + array ( + 'sy' => '/^((?i)screen-name|screen-group1|screen-group2|screen-group3|screen-group4|screen-required|screen-input|screen-output|screen-intensified|screen-invisible|screen-length|screen-active|sy-index|sy-pagno|sy-tabix|sy-tfill|sy-tlopc|sy-tmaxl|sy-toccu|sy-ttabc|sy-tstis|sy-ttabi|sy-dbcnt|sy-fdpos|sy-colno|sy-linct|sy-linno|sy-linsz|sy-pagct|sy-macol|sy-marow|sy-tleng|sy-sfoff|sy-willi|sy-lilli|sy-subrc|sy-fleng|sy-cucol|sy-curow|sy-lsind|sy-listi|sy-stepl|sy-tpagi|sy-winx1|sy-winy1|sy-winx2|sy-winy2|sy-winco|sy-winro|sy-windi|sy-srows|sy-scols|sy-loopc|sy-folen|sy-fodec|sy-tzone|sy-dayst|sy-ftype|sy-appli|sy-fdayw|sy-ccurs|sy-ccurt|sy-debug|sy-ctype|sy-input|sy-langu|sy-modno|sy-batch|sy-binpt|sy-calld|sy-dynnr|sy-dyngr|sy-newpa|sy-pri40|sy-rstrt|sy-wtitl|sy-cpage|sy-dbnam|sy-mandt|sy-prefx|sy-fmkey|sy-pexpi|sy-prini|sy-primm|sy-prrel|sy-playo|sy-prbig|sy-playp|sy-prnew|sy-prlog|sy-pdest|sy-plist|sy-pauth|sy-prdsn|sy-pnwpa|sy-callr|sy-repi2|sy-rtitl|sy-prrec|sy-prtxt|sy-prabt|sy-lpass|sy-nrpag|sy-paart|sy-prcop|sy-batzs|sy-bspld|sy-brep4|sy-batzo|sy-batzd|sy-batzw|sy-batzm|sy-ctabl|sy-dbsys|sy-dcsys|sy-macdb|sy-sysid|sy-opsys|sy-pfkey|sy-saprl|sy-tcode|sy-ucomm|sy-cfwae|sy-chwae|sy-spono|sy-sponr|sy-waers|sy-cdate|sy-datum|sy-slset|sy-subty|sy-subcs|sy-group|sy-ffile|sy-uzeit|sy-dsnam|sy-repid|sy-tabid|sy-tfdsn|sy-uname|sy-lstat|sy-abcde|sy-marky|sy-sfnam|sy-tname|sy-msgli|sy-title|sy-entry|sy-lisel|sy-uline|sy-xcode|sy-cprog|sy-xprog|sy-xform|sy-ldbpg|sy-tvar0|sy-tvar1|sy-tvar2|sy-tvar3|sy-tvar4|sy-tvar5|sy-tvar6|sy-tvar7|sy-tvar8|sy-tvar9|sy-msgid|sy-msgty|sy-msgno|sy-msgv1|sy-msgv2|sy-msgv3|sy-msgv4|sy-oncom|sy-vline|sy-winsl|sy-staco|sy-staro|sy-datar|sy-host|sy-locdb|sy-locop|sy-datlo|sy-timlo|sy-zonlo|syst-index|syst-pagno|syst-tabix|syst-tfill|syst-tlopc|syst-tmaxl|syst-toccu|syst-ttabc|syst-tstis|syst-ttabi|syst-dbcnt|syst-fdpos|syst-colno|syst-linct|syst-linno|syst-linsz|syst-pagct|syst-macol|syst-marow|syst-tleng|syst-sfoff|syst-willi|syst-lilli|syst-subrc|syst-fleng|syst-cucol|syst-curow|syst-lsind|syst-listi|syst-stepl|syst-tpagi|syst-winx1|syst-winy1|syst-winx2|syst-winy2|syst-winco|syst-winro|syst-windi|syst-srows|syst-scols|syst-loopc|syst-folen|syst-fodec|syst-tzone|syst-dayst|syst-ftype|syst-appli|syst-fdayw|syst-ccurs|syst-ccurt|syst-debug|syst-ctype|syst-input|syst-langu|syst-modno|syst-batch|syst-binpt|syst-calld|syst-dynnr|syst-dyngr|syst-newpa|syst-pri40|syst-rstrt|syst-wtitl|syst-cpage|syst-dbnam|syst-mandt|syst-prefx|syst-fmkey|syst-pexpi|syst-prini|syst-primm|syst-prrel|syst-playo|syst-prbig|syst-playp|syst-prnew|syst-prlog|syst-pdest|syst-plist|syst-pauth|syst-prdsn|syst-pnwpa|syst-callr|syst-repi2|syst-rtitl|syst-prrec|syst-prtxt|syst-prabt|syst-lpass|syst-nrpag|syst-paart|syst-prcop|syst-batzs|syst-bspld|syst-brep4|syst-batzo|syst-batzd|syst-batzw|syst-batzm|syst-ctabl|syst-dbsys|syst-dcsys|syst-macdb|syst-sysid|syst-opsys|syst-pfkey|syst-saprl|syst-tcode|syst-ucomm|syst-cfwae|syst-chwae|syst-spono|syst-sponr|syst-waers|syst-cdate|syst-datum|syst-slset|syst-subty|syst-subcs|syst-group|syst-ffile|syst-uzeit|syst-dsnam|syst-repid|syst-tabid|syst-tfdsn|syst-uname|syst-lstat|syst-abcde|syst-marky|syst-sfnam|syst-tname|syst-msgli|syst-title|syst-entry|syst-lisel|syst-uline|syst-xcode|syst-cprog|syst-xprog|syst-xform|syst-ldbpg|syst-tvar0|syst-tvar1|syst-tvar2|syst-tvar3|syst-tvar4|syst-tvar5|syst-tvar6|syst-tvar7|syst-tvar8|syst-tvar9|syst-msgid|syst-msgty|syst-msgno|syst-msgv1|syst-msgv2|syst-msgv3|syst-msgv4|syst-oncom|syst-vline|syst-winsl|syst-staco|syst-staro|syst-datar|syst-host|syst-locdb|syst-locop|syst-datlo|syst-timlo|syst-zonlo)$/', + 'reserved' => '/^((?i)abs|acos|add|add-corresponding|adjacent|after|aliases|all|analyzer|and|any|append|as|ascending|asin|assign|assigned|assigning|at|atan|authority-check|avg|back|before|begin|binary|bit|bit-and|bit-not|bit-or|bit-xor|blank|block|break-point|buffer|by|c|call|case|catch|ceil|centered|chain|change|changing|check|checkbox|class|class-data|class-events|class-methods|class-pool|clear|client|close|cnt|code|collect|color|comment|commit|communication|compute|concatenate|condense|constants|context|contexts|continue|control|controls|convert|copy|corresponding|cos|cosh|count|country|create|currency|cursor|customer-function|data|database|dataset|delete|decimals|default|define|demand|descending|describe|dialog|distinct|div|divide|divide-corresponding|do|duplicates|dynpro|edit|editor-call|else|elseif|end|end-of-definition|end-of-page|end-of-selection|endat|endcase|endcatch|endchain|endclass|enddo|endexec|endform|endfunction|endif|endinterface|endloop|endmethod|endmodule|endon|endprovide|endselect|endwhile|entries|events|exec|exit|exit-command|exp|exponent|export|exporting|exceptions|extended|extract|fetch|field|field-groups|field-symbols|fields|floor|for|form|format|frac|frame|free|from|function|function-pool|generate|get|group|hashed|header|help-id|help-request|hide|hotspot|icon|id|if|import|importing|include|index|infotypes|initialization|inner|input|insert|intensified|interface|interface-pool|interfaces|into|inverse|join|key|language|last|leave|left|left-justified|like|line|line-count|line-selection|line-size|lines|list-processing|load|load-of-program|local|locale|log|log10|loop|m|margin|mask|matchcode|max|memory|message|message-id|messages|method|methods|min|mod|mode|modif|modify|module|move|move-corresponding|multiply|multiply-corresponding|new|new-line|new-page|next|no|no-gap|no-gaps|no-heading|no-scrolling|no-sign|no-title|no-zero|nodes|non-unique|o|object|obligatory|occurs|of|off|on|open|or|order|others|outer|output|overlay|pack|page|parameter|parameters|perform|pf-status|position|print|print-control|private|process|program|property|protected|provide|public|put|radiobutton|raise|raising|range|ranges|read|receive|refresh|reject|replace|report|requested|reserve|reset|right-justified|rollback|round|rows|rtti|run|scan|screen|search|separated|scroll|scroll-boundary|select|select-options|selection-screen|selection-table|set|shared|shift|sign|sin|single|sinh|size|skip|sort|sorted|split|sql|sqrt|stamp|standard|start-of-selection|statics|stop|string|strlen|structure|submit|subtract|subtract-corresponding|sum|supply|suppress|symbol|syntax-check|syntax-trace|system-call|system-exceptions|table|table_line|tables|tan|tanh|text|textpool|time|times|title|titlebar|to|top-of-page|transaction|transfer|translate|transporting|trunc|type|type-pool|type-pools|types|uline|under|unique|unit|unpack|up|update|user-command|using|value|value-request|values|vary|when|where|while|window|with|with-title|work|write|x|xstring|z|zone)$/', + 'constants' => '/^((?i)initial|null|space|col_background|col_heading|col_normal|col_total|col_key|col_positive|col_negative|col_group)$/', + ), + ), + 0 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => -1, + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => + array ( + 'sy' => '/^((?i)screen-name|screen-group1|screen-group2|screen-group3|screen-group4|screen-required|screen-input|screen-output|screen-intensified|screen-invisible|screen-length|screen-active|sy-index|sy-pagno|sy-tabix|sy-tfill|sy-tlopc|sy-tmaxl|sy-toccu|sy-ttabc|sy-tstis|sy-ttabi|sy-dbcnt|sy-fdpos|sy-colno|sy-linct|sy-linno|sy-linsz|sy-pagct|sy-macol|sy-marow|sy-tleng|sy-sfoff|sy-willi|sy-lilli|sy-subrc|sy-fleng|sy-cucol|sy-curow|sy-lsind|sy-listi|sy-stepl|sy-tpagi|sy-winx1|sy-winy1|sy-winx2|sy-winy2|sy-winco|sy-winro|sy-windi|sy-srows|sy-scols|sy-loopc|sy-folen|sy-fodec|sy-tzone|sy-dayst|sy-ftype|sy-appli|sy-fdayw|sy-ccurs|sy-ccurt|sy-debug|sy-ctype|sy-input|sy-langu|sy-modno|sy-batch|sy-binpt|sy-calld|sy-dynnr|sy-dyngr|sy-newpa|sy-pri40|sy-rstrt|sy-wtitl|sy-cpage|sy-dbnam|sy-mandt|sy-prefx|sy-fmkey|sy-pexpi|sy-prini|sy-primm|sy-prrel|sy-playo|sy-prbig|sy-playp|sy-prnew|sy-prlog|sy-pdest|sy-plist|sy-pauth|sy-prdsn|sy-pnwpa|sy-callr|sy-repi2|sy-rtitl|sy-prrec|sy-prtxt|sy-prabt|sy-lpass|sy-nrpag|sy-paart|sy-prcop|sy-batzs|sy-bspld|sy-brep4|sy-batzo|sy-batzd|sy-batzw|sy-batzm|sy-ctabl|sy-dbsys|sy-dcsys|sy-macdb|sy-sysid|sy-opsys|sy-pfkey|sy-saprl|sy-tcode|sy-ucomm|sy-cfwae|sy-chwae|sy-spono|sy-sponr|sy-waers|sy-cdate|sy-datum|sy-slset|sy-subty|sy-subcs|sy-group|sy-ffile|sy-uzeit|sy-dsnam|sy-repid|sy-tabid|sy-tfdsn|sy-uname|sy-lstat|sy-abcde|sy-marky|sy-sfnam|sy-tname|sy-msgli|sy-title|sy-entry|sy-lisel|sy-uline|sy-xcode|sy-cprog|sy-xprog|sy-xform|sy-ldbpg|sy-tvar0|sy-tvar1|sy-tvar2|sy-tvar3|sy-tvar4|sy-tvar5|sy-tvar6|sy-tvar7|sy-tvar8|sy-tvar9|sy-msgid|sy-msgty|sy-msgno|sy-msgv1|sy-msgv2|sy-msgv3|sy-msgv4|sy-oncom|sy-vline|sy-winsl|sy-staco|sy-staro|sy-datar|sy-host|sy-locdb|sy-locop|sy-datlo|sy-timlo|sy-zonlo|syst-index|syst-pagno|syst-tabix|syst-tfill|syst-tlopc|syst-tmaxl|syst-toccu|syst-ttabc|syst-tstis|syst-ttabi|syst-dbcnt|syst-fdpos|syst-colno|syst-linct|syst-linno|syst-linsz|syst-pagct|syst-macol|syst-marow|syst-tleng|syst-sfoff|syst-willi|syst-lilli|syst-subrc|syst-fleng|syst-cucol|syst-curow|syst-lsind|syst-listi|syst-stepl|syst-tpagi|syst-winx1|syst-winy1|syst-winx2|syst-winy2|syst-winco|syst-winro|syst-windi|syst-srows|syst-scols|syst-loopc|syst-folen|syst-fodec|syst-tzone|syst-dayst|syst-ftype|syst-appli|syst-fdayw|syst-ccurs|syst-ccurt|syst-debug|syst-ctype|syst-input|syst-langu|syst-modno|syst-batch|syst-binpt|syst-calld|syst-dynnr|syst-dyngr|syst-newpa|syst-pri40|syst-rstrt|syst-wtitl|syst-cpage|syst-dbnam|syst-mandt|syst-prefx|syst-fmkey|syst-pexpi|syst-prini|syst-primm|syst-prrel|syst-playo|syst-prbig|syst-playp|syst-prnew|syst-prlog|syst-pdest|syst-plist|syst-pauth|syst-prdsn|syst-pnwpa|syst-callr|syst-repi2|syst-rtitl|syst-prrec|syst-prtxt|syst-prabt|syst-lpass|syst-nrpag|syst-paart|syst-prcop|syst-batzs|syst-bspld|syst-brep4|syst-batzo|syst-batzd|syst-batzw|syst-batzm|syst-ctabl|syst-dbsys|syst-dcsys|syst-macdb|syst-sysid|syst-opsys|syst-pfkey|syst-saprl|syst-tcode|syst-ucomm|syst-cfwae|syst-chwae|syst-spono|syst-sponr|syst-waers|syst-cdate|syst-datum|syst-slset|syst-subty|syst-subcs|syst-group|syst-ffile|syst-uzeit|syst-dsnam|syst-repid|syst-tabid|syst-tfdsn|syst-uname|syst-lstat|syst-abcde|syst-marky|syst-sfnam|syst-tname|syst-msgli|syst-title|syst-entry|syst-lisel|syst-uline|syst-xcode|syst-cprog|syst-xprog|syst-xform|syst-ldbpg|syst-tvar0|syst-tvar1|syst-tvar2|syst-tvar3|syst-tvar4|syst-tvar5|syst-tvar6|syst-tvar7|syst-tvar8|syst-tvar9|syst-msgid|syst-msgty|syst-msgno|syst-msgv1|syst-msgv2|syst-msgv3|syst-msgv4|syst-oncom|syst-vline|syst-winsl|syst-staco|syst-staro|syst-datar|syst-host|syst-locdb|syst-locop|syst-datlo|syst-timlo|syst-zonlo)$/', + 'reserved' => '/^((?i)abs|acos|add|add-corresponding|adjacent|after|aliases|all|analyzer|and|any|append|as|ascending|asin|assign|assigned|assigning|at|atan|authority-check|avg|back|before|begin|binary|bit|bit-and|bit-not|bit-or|bit-xor|blank|block|break-point|buffer|by|c|call|case|catch|ceil|centered|chain|change|changing|check|checkbox|class|class-data|class-events|class-methods|class-pool|clear|client|close|cnt|code|collect|color|comment|commit|communication|compute|concatenate|condense|constants|context|contexts|continue|control|controls|convert|copy|corresponding|cos|cosh|count|country|create|currency|cursor|customer-function|data|database|dataset|delete|decimals|default|define|demand|descending|describe|dialog|distinct|div|divide|divide-corresponding|do|duplicates|dynpro|edit|editor-call|else|elseif|end|end-of-definition|end-of-page|end-of-selection|endat|endcase|endcatch|endchain|endclass|enddo|endexec|endform|endfunction|endif|endinterface|endloop|endmethod|endmodule|endon|endprovide|endselect|endwhile|entries|events|exec|exit|exit-command|exp|exponent|export|exporting|exceptions|extended|extract|fetch|field|field-groups|field-symbols|fields|floor|for|form|format|frac|frame|free|from|function|function-pool|generate|get|group|hashed|header|help-id|help-request|hide|hotspot|icon|id|if|import|importing|include|index|infotypes|initialization|inner|input|insert|intensified|interface|interface-pool|interfaces|into|inverse|join|key|language|last|leave|left|left-justified|like|line|line-count|line-selection|line-size|lines|list-processing|load|load-of-program|local|locale|log|log10|loop|m|margin|mask|matchcode|max|memory|message|message-id|messages|method|methods|min|mod|mode|modif|modify|module|move|move-corresponding|multiply|multiply-corresponding|new|new-line|new-page|next|no|no-gap|no-gaps|no-heading|no-scrolling|no-sign|no-title|no-zero|nodes|non-unique|o|object|obligatory|occurs|of|off|on|open|or|order|others|outer|output|overlay|pack|page|parameter|parameters|perform|pf-status|position|print|print-control|private|process|program|property|protected|provide|public|put|radiobutton|raise|raising|range|ranges|read|receive|refresh|reject|replace|report|requested|reserve|reset|right-justified|rollback|round|rows|rtti|run|scan|screen|search|separated|scroll|scroll-boundary|select|select-options|selection-screen|selection-table|set|shared|shift|sign|sin|single|sinh|size|skip|sort|sorted|split|sql|sqrt|stamp|standard|start-of-selection|statics|stop|string|strlen|structure|submit|subtract|subtract-corresponding|sum|supply|suppress|symbol|syntax-check|syntax-trace|system-call|system-exceptions|table|table_line|tables|tan|tanh|text|textpool|time|times|title|titlebar|to|top-of-page|transaction|transfer|translate|transporting|trunc|type|type-pool|type-pools|types|uline|under|unique|unit|unpack|up|update|user-command|using|value|value-request|values|vary|when|where|while|window|with|with-title|work|write|x|xstring|z|zone)$/', + 'constants' => '/^((?i)initial|null|space|col_background|col_heading|col_normal|col_total|col_key|col_positive|col_negative|col_group)$/', + ), + ), + 1 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => -1, + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => + array ( + 'sy' => '/^((?i)screen-name|screen-group1|screen-group2|screen-group3|screen-group4|screen-required|screen-input|screen-output|screen-intensified|screen-invisible|screen-length|screen-active|sy-index|sy-pagno|sy-tabix|sy-tfill|sy-tlopc|sy-tmaxl|sy-toccu|sy-ttabc|sy-tstis|sy-ttabi|sy-dbcnt|sy-fdpos|sy-colno|sy-linct|sy-linno|sy-linsz|sy-pagct|sy-macol|sy-marow|sy-tleng|sy-sfoff|sy-willi|sy-lilli|sy-subrc|sy-fleng|sy-cucol|sy-curow|sy-lsind|sy-listi|sy-stepl|sy-tpagi|sy-winx1|sy-winy1|sy-winx2|sy-winy2|sy-winco|sy-winro|sy-windi|sy-srows|sy-scols|sy-loopc|sy-folen|sy-fodec|sy-tzone|sy-dayst|sy-ftype|sy-appli|sy-fdayw|sy-ccurs|sy-ccurt|sy-debug|sy-ctype|sy-input|sy-langu|sy-modno|sy-batch|sy-binpt|sy-calld|sy-dynnr|sy-dyngr|sy-newpa|sy-pri40|sy-rstrt|sy-wtitl|sy-cpage|sy-dbnam|sy-mandt|sy-prefx|sy-fmkey|sy-pexpi|sy-prini|sy-primm|sy-prrel|sy-playo|sy-prbig|sy-playp|sy-prnew|sy-prlog|sy-pdest|sy-plist|sy-pauth|sy-prdsn|sy-pnwpa|sy-callr|sy-repi2|sy-rtitl|sy-prrec|sy-prtxt|sy-prabt|sy-lpass|sy-nrpag|sy-paart|sy-prcop|sy-batzs|sy-bspld|sy-brep4|sy-batzo|sy-batzd|sy-batzw|sy-batzm|sy-ctabl|sy-dbsys|sy-dcsys|sy-macdb|sy-sysid|sy-opsys|sy-pfkey|sy-saprl|sy-tcode|sy-ucomm|sy-cfwae|sy-chwae|sy-spono|sy-sponr|sy-waers|sy-cdate|sy-datum|sy-slset|sy-subty|sy-subcs|sy-group|sy-ffile|sy-uzeit|sy-dsnam|sy-repid|sy-tabid|sy-tfdsn|sy-uname|sy-lstat|sy-abcde|sy-marky|sy-sfnam|sy-tname|sy-msgli|sy-title|sy-entry|sy-lisel|sy-uline|sy-xcode|sy-cprog|sy-xprog|sy-xform|sy-ldbpg|sy-tvar0|sy-tvar1|sy-tvar2|sy-tvar3|sy-tvar4|sy-tvar5|sy-tvar6|sy-tvar7|sy-tvar8|sy-tvar9|sy-msgid|sy-msgty|sy-msgno|sy-msgv1|sy-msgv2|sy-msgv3|sy-msgv4|sy-oncom|sy-vline|sy-winsl|sy-staco|sy-staro|sy-datar|sy-host|sy-locdb|sy-locop|sy-datlo|sy-timlo|sy-zonlo|syst-index|syst-pagno|syst-tabix|syst-tfill|syst-tlopc|syst-tmaxl|syst-toccu|syst-ttabc|syst-tstis|syst-ttabi|syst-dbcnt|syst-fdpos|syst-colno|syst-linct|syst-linno|syst-linsz|syst-pagct|syst-macol|syst-marow|syst-tleng|syst-sfoff|syst-willi|syst-lilli|syst-subrc|syst-fleng|syst-cucol|syst-curow|syst-lsind|syst-listi|syst-stepl|syst-tpagi|syst-winx1|syst-winy1|syst-winx2|syst-winy2|syst-winco|syst-winro|syst-windi|syst-srows|syst-scols|syst-loopc|syst-folen|syst-fodec|syst-tzone|syst-dayst|syst-ftype|syst-appli|syst-fdayw|syst-ccurs|syst-ccurt|syst-debug|syst-ctype|syst-input|syst-langu|syst-modno|syst-batch|syst-binpt|syst-calld|syst-dynnr|syst-dyngr|syst-newpa|syst-pri40|syst-rstrt|syst-wtitl|syst-cpage|syst-dbnam|syst-mandt|syst-prefx|syst-fmkey|syst-pexpi|syst-prini|syst-primm|syst-prrel|syst-playo|syst-prbig|syst-playp|syst-prnew|syst-prlog|syst-pdest|syst-plist|syst-pauth|syst-prdsn|syst-pnwpa|syst-callr|syst-repi2|syst-rtitl|syst-prrec|syst-prtxt|syst-prabt|syst-lpass|syst-nrpag|syst-paart|syst-prcop|syst-batzs|syst-bspld|syst-brep4|syst-batzo|syst-batzd|syst-batzw|syst-batzm|syst-ctabl|syst-dbsys|syst-dcsys|syst-macdb|syst-sysid|syst-opsys|syst-pfkey|syst-saprl|syst-tcode|syst-ucomm|syst-cfwae|syst-chwae|syst-spono|syst-sponr|syst-waers|syst-cdate|syst-datum|syst-slset|syst-subty|syst-subcs|syst-group|syst-ffile|syst-uzeit|syst-dsnam|syst-repid|syst-tabid|syst-tfdsn|syst-uname|syst-lstat|syst-abcde|syst-marky|syst-sfnam|syst-tname|syst-msgli|syst-title|syst-entry|syst-lisel|syst-uline|syst-xcode|syst-cprog|syst-xprog|syst-xform|syst-ldbpg|syst-tvar0|syst-tvar1|syst-tvar2|syst-tvar3|syst-tvar4|syst-tvar5|syst-tvar6|syst-tvar7|syst-tvar8|syst-tvar9|syst-msgid|syst-msgty|syst-msgno|syst-msgv1|syst-msgv2|syst-msgv3|syst-msgv4|syst-oncom|syst-vline|syst-winsl|syst-staco|syst-staro|syst-datar|syst-host|syst-locdb|syst-locop|syst-datlo|syst-timlo|syst-zonlo)$/', + 'reserved' => '/^((?i)abs|acos|add|add-corresponding|adjacent|after|aliases|all|analyzer|and|any|append|as|ascending|asin|assign|assigned|assigning|at|atan|authority-check|avg|back|before|begin|binary|bit|bit-and|bit-not|bit-or|bit-xor|blank|block|break-point|buffer|by|c|call|case|catch|ceil|centered|chain|change|changing|check|checkbox|class|class-data|class-events|class-methods|class-pool|clear|client|close|cnt|code|collect|color|comment|commit|communication|compute|concatenate|condense|constants|context|contexts|continue|control|controls|convert|copy|corresponding|cos|cosh|count|country|create|currency|cursor|customer-function|data|database|dataset|delete|decimals|default|define|demand|descending|describe|dialog|distinct|div|divide|divide-corresponding|do|duplicates|dynpro|edit|editor-call|else|elseif|end|end-of-definition|end-of-page|end-of-selection|endat|endcase|endcatch|endchain|endclass|enddo|endexec|endform|endfunction|endif|endinterface|endloop|endmethod|endmodule|endon|endprovide|endselect|endwhile|entries|events|exec|exit|exit-command|exp|exponent|export|exporting|exceptions|extended|extract|fetch|field|field-groups|field-symbols|fields|floor|for|form|format|frac|frame|free|from|function|function-pool|generate|get|group|hashed|header|help-id|help-request|hide|hotspot|icon|id|if|import|importing|include|index|infotypes|initialization|inner|input|insert|intensified|interface|interface-pool|interfaces|into|inverse|join|key|language|last|leave|left|left-justified|like|line|line-count|line-selection|line-size|lines|list-processing|load|load-of-program|local|locale|log|log10|loop|m|margin|mask|matchcode|max|memory|message|message-id|messages|method|methods|min|mod|mode|modif|modify|module|move|move-corresponding|multiply|multiply-corresponding|new|new-line|new-page|next|no|no-gap|no-gaps|no-heading|no-scrolling|no-sign|no-title|no-zero|nodes|non-unique|o|object|obligatory|occurs|of|off|on|open|or|order|others|outer|output|overlay|pack|page|parameter|parameters|perform|pf-status|position|print|print-control|private|process|program|property|protected|provide|public|put|radiobutton|raise|raising|range|ranges|read|receive|refresh|reject|replace|report|requested|reserve|reset|right-justified|rollback|round|rows|rtti|run|scan|screen|search|separated|scroll|scroll-boundary|select|select-options|selection-screen|selection-table|set|shared|shift|sign|sin|single|sinh|size|skip|sort|sorted|split|sql|sqrt|stamp|standard|start-of-selection|statics|stop|string|strlen|structure|submit|subtract|subtract-corresponding|sum|supply|suppress|symbol|syntax-check|syntax-trace|system-call|system-exceptions|table|table_line|tables|tan|tanh|text|textpool|time|times|title|titlebar|to|top-of-page|transaction|transfer|translate|transporting|trunc|type|type-pool|type-pools|types|uline|under|unique|unit|unpack|up|update|user-command|using|value|value-request|values|vary|when|where|while|window|with|with-title|work|write|x|xstring|z|zone)$/', + 'constants' => '/^((?i)initial|null|space|col_background|col_heading|col_normal|col_total|col_key|col_positive|col_negative|col_group)$/', + ), + ), + 2 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => -1, + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => + array ( + 'sy' => '/^((?i)screen-name|screen-group1|screen-group2|screen-group3|screen-group4|screen-required|screen-input|screen-output|screen-intensified|screen-invisible|screen-length|screen-active|sy-index|sy-pagno|sy-tabix|sy-tfill|sy-tlopc|sy-tmaxl|sy-toccu|sy-ttabc|sy-tstis|sy-ttabi|sy-dbcnt|sy-fdpos|sy-colno|sy-linct|sy-linno|sy-linsz|sy-pagct|sy-macol|sy-marow|sy-tleng|sy-sfoff|sy-willi|sy-lilli|sy-subrc|sy-fleng|sy-cucol|sy-curow|sy-lsind|sy-listi|sy-stepl|sy-tpagi|sy-winx1|sy-winy1|sy-winx2|sy-winy2|sy-winco|sy-winro|sy-windi|sy-srows|sy-scols|sy-loopc|sy-folen|sy-fodec|sy-tzone|sy-dayst|sy-ftype|sy-appli|sy-fdayw|sy-ccurs|sy-ccurt|sy-debug|sy-ctype|sy-input|sy-langu|sy-modno|sy-batch|sy-binpt|sy-calld|sy-dynnr|sy-dyngr|sy-newpa|sy-pri40|sy-rstrt|sy-wtitl|sy-cpage|sy-dbnam|sy-mandt|sy-prefx|sy-fmkey|sy-pexpi|sy-prini|sy-primm|sy-prrel|sy-playo|sy-prbig|sy-playp|sy-prnew|sy-prlog|sy-pdest|sy-plist|sy-pauth|sy-prdsn|sy-pnwpa|sy-callr|sy-repi2|sy-rtitl|sy-prrec|sy-prtxt|sy-prabt|sy-lpass|sy-nrpag|sy-paart|sy-prcop|sy-batzs|sy-bspld|sy-brep4|sy-batzo|sy-batzd|sy-batzw|sy-batzm|sy-ctabl|sy-dbsys|sy-dcsys|sy-macdb|sy-sysid|sy-opsys|sy-pfkey|sy-saprl|sy-tcode|sy-ucomm|sy-cfwae|sy-chwae|sy-spono|sy-sponr|sy-waers|sy-cdate|sy-datum|sy-slset|sy-subty|sy-subcs|sy-group|sy-ffile|sy-uzeit|sy-dsnam|sy-repid|sy-tabid|sy-tfdsn|sy-uname|sy-lstat|sy-abcde|sy-marky|sy-sfnam|sy-tname|sy-msgli|sy-title|sy-entry|sy-lisel|sy-uline|sy-xcode|sy-cprog|sy-xprog|sy-xform|sy-ldbpg|sy-tvar0|sy-tvar1|sy-tvar2|sy-tvar3|sy-tvar4|sy-tvar5|sy-tvar6|sy-tvar7|sy-tvar8|sy-tvar9|sy-msgid|sy-msgty|sy-msgno|sy-msgv1|sy-msgv2|sy-msgv3|sy-msgv4|sy-oncom|sy-vline|sy-winsl|sy-staco|sy-staro|sy-datar|sy-host|sy-locdb|sy-locop|sy-datlo|sy-timlo|sy-zonlo|syst-index|syst-pagno|syst-tabix|syst-tfill|syst-tlopc|syst-tmaxl|syst-toccu|syst-ttabc|syst-tstis|syst-ttabi|syst-dbcnt|syst-fdpos|syst-colno|syst-linct|syst-linno|syst-linsz|syst-pagct|syst-macol|syst-marow|syst-tleng|syst-sfoff|syst-willi|syst-lilli|syst-subrc|syst-fleng|syst-cucol|syst-curow|syst-lsind|syst-listi|syst-stepl|syst-tpagi|syst-winx1|syst-winy1|syst-winx2|syst-winy2|syst-winco|syst-winro|syst-windi|syst-srows|syst-scols|syst-loopc|syst-folen|syst-fodec|syst-tzone|syst-dayst|syst-ftype|syst-appli|syst-fdayw|syst-ccurs|syst-ccurt|syst-debug|syst-ctype|syst-input|syst-langu|syst-modno|syst-batch|syst-binpt|syst-calld|syst-dynnr|syst-dyngr|syst-newpa|syst-pri40|syst-rstrt|syst-wtitl|syst-cpage|syst-dbnam|syst-mandt|syst-prefx|syst-fmkey|syst-pexpi|syst-prini|syst-primm|syst-prrel|syst-playo|syst-prbig|syst-playp|syst-prnew|syst-prlog|syst-pdest|syst-plist|syst-pauth|syst-prdsn|syst-pnwpa|syst-callr|syst-repi2|syst-rtitl|syst-prrec|syst-prtxt|syst-prabt|syst-lpass|syst-nrpag|syst-paart|syst-prcop|syst-batzs|syst-bspld|syst-brep4|syst-batzo|syst-batzd|syst-batzw|syst-batzm|syst-ctabl|syst-dbsys|syst-dcsys|syst-macdb|syst-sysid|syst-opsys|syst-pfkey|syst-saprl|syst-tcode|syst-ucomm|syst-cfwae|syst-chwae|syst-spono|syst-sponr|syst-waers|syst-cdate|syst-datum|syst-slset|syst-subty|syst-subcs|syst-group|syst-ffile|syst-uzeit|syst-dsnam|syst-repid|syst-tabid|syst-tfdsn|syst-uname|syst-lstat|syst-abcde|syst-marky|syst-sfnam|syst-tname|syst-msgli|syst-title|syst-entry|syst-lisel|syst-uline|syst-xcode|syst-cprog|syst-xprog|syst-xform|syst-ldbpg|syst-tvar0|syst-tvar1|syst-tvar2|syst-tvar3|syst-tvar4|syst-tvar5|syst-tvar6|syst-tvar7|syst-tvar8|syst-tvar9|syst-msgid|syst-msgty|syst-msgno|syst-msgv1|syst-msgv2|syst-msgv3|syst-msgv4|syst-oncom|syst-vline|syst-winsl|syst-staco|syst-staro|syst-datar|syst-host|syst-locdb|syst-locop|syst-datlo|syst-timlo|syst-zonlo)$/', + 'reserved' => '/^((?i)abs|acos|add|add-corresponding|adjacent|after|aliases|all|analyzer|and|any|append|as|ascending|asin|assign|assigned|assigning|at|atan|authority-check|avg|back|before|begin|binary|bit|bit-and|bit-not|bit-or|bit-xor|blank|block|break-point|buffer|by|c|call|case|catch|ceil|centered|chain|change|changing|check|checkbox|class|class-data|class-events|class-methods|class-pool|clear|client|close|cnt|code|collect|color|comment|commit|communication|compute|concatenate|condense|constants|context|contexts|continue|control|controls|convert|copy|corresponding|cos|cosh|count|country|create|currency|cursor|customer-function|data|database|dataset|delete|decimals|default|define|demand|descending|describe|dialog|distinct|div|divide|divide-corresponding|do|duplicates|dynpro|edit|editor-call|else|elseif|end|end-of-definition|end-of-page|end-of-selection|endat|endcase|endcatch|endchain|endclass|enddo|endexec|endform|endfunction|endif|endinterface|endloop|endmethod|endmodule|endon|endprovide|endselect|endwhile|entries|events|exec|exit|exit-command|exp|exponent|export|exporting|exceptions|extended|extract|fetch|field|field-groups|field-symbols|fields|floor|for|form|format|frac|frame|free|from|function|function-pool|generate|get|group|hashed|header|help-id|help-request|hide|hotspot|icon|id|if|import|importing|include|index|infotypes|initialization|inner|input|insert|intensified|interface|interface-pool|interfaces|into|inverse|join|key|language|last|leave|left|left-justified|like|line|line-count|line-selection|line-size|lines|list-processing|load|load-of-program|local|locale|log|log10|loop|m|margin|mask|matchcode|max|memory|message|message-id|messages|method|methods|min|mod|mode|modif|modify|module|move|move-corresponding|multiply|multiply-corresponding|new|new-line|new-page|next|no|no-gap|no-gaps|no-heading|no-scrolling|no-sign|no-title|no-zero|nodes|non-unique|o|object|obligatory|occurs|of|off|on|open|or|order|others|outer|output|overlay|pack|page|parameter|parameters|perform|pf-status|position|print|print-control|private|process|program|property|protected|provide|public|put|radiobutton|raise|raising|range|ranges|read|receive|refresh|reject|replace|report|requested|reserve|reset|right-justified|rollback|round|rows|rtti|run|scan|screen|search|separated|scroll|scroll-boundary|select|select-options|selection-screen|selection-table|set|shared|shift|sign|sin|single|sinh|size|skip|sort|sorted|split|sql|sqrt|stamp|standard|start-of-selection|statics|stop|string|strlen|structure|submit|subtract|subtract-corresponding|sum|supply|suppress|symbol|syntax-check|syntax-trace|system-call|system-exceptions|table|table_line|tables|tan|tanh|text|textpool|time|times|title|titlebar|to|top-of-page|transaction|transfer|translate|transporting|trunc|type|type-pool|type-pools|types|uline|under|unique|unit|unpack|up|update|user-command|using|value|value-request|values|vary|when|where|while|window|with|with-title|work|write|x|xstring|z|zone)$/', + 'constants' => '/^((?i)initial|null|space|col_background|col_heading|col_normal|col_total|col_key|col_positive|col_negative|col_group)$/', + ), + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_parts = array ( + 0 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + ), + 1 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + ), + 2 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_subst = array ( + -1 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + ), + 0 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + ), + 1 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + ), + 2 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_conditions = array ( + ); + $this->_kwmap = array ( + 'sy' => 'reserved', + 'reserved' => 'reserved', + 'constants' => 'reserved', + ); + $this->_defClass = 'code'; + $this->_checkDefines(); + } + +} \ No newline at end of file diff --git a/library/Text_Highlighter/Text/Highlighter/AVRC.php b/library/Text_Highlighter/Text/Highlighter/AVRC.php new file mode 100644 index 000000000..de4b82ccd --- /dev/null +++ b/library/Text_Highlighter/Text/Highlighter/AVRC.php @@ -0,0 +1,894 @@ + + + * + */ + +/** + * @ignore + */ + +require_once 'Text/Highlighter.php'; + +/** + * Auto-generated class. AVRC syntax highlighting + * + * @author Andrey Demenev + * @category Text + * @package Text_Highlighter + * @copyright 2004-2006 Andrey Demenev + * @license http://www.php.net/license/3_0.txt PHP License + * @version Release: 0.7.0 + * @link http://pear.php.net/package/Text_Highlighter + */ +class Text_Highlighter_AVRC extends Text_Highlighter +{ + var $_language = 'avrc'; + + /** + * PHP4 Compatible Constructor + * + * @param array $options + * @access public + */ + function Text_Highlighter_AVRC($options=array()) + { + $this->__construct($options); + } + + + /** + * Constructor + * + * @param array $options + * @access public + */ + function __construct($options=array()) + { + + $this->_options = $options; + $this->_regs = array ( + -1 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)\\b0[xX][\\da-f]+)|((?i)\\b\\d\\d*|\\b0\\b)|((?i)\\b0[0-7]+)|((?i)\\b(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?mi)^[ \\t]*#include)|((?mii)^[ \\t]*#[ \\t]*[a-z]+)|((?i)\\d*\\.?\\d+)|((?i)\\/\\*)|((?i)\\/\\/.+)/', + 0 => '/((?i)\\\\)/', + 1 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)\\b0[xX][\\da-f]+)|((?i)\\b\\d\\d*|\\b0\\b)|((?i)\\b0[0-7]+)|((?i)\\b(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?mi)^[ \\t]*#include)|((?mii)^[ \\t]*#[ \\t]*[a-z]+)|((?i)\\d*\\.?\\d+)|((?i)\\/\\*)|((?i)\\/\\/.+)/', + 2 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)\\b0[xX][\\da-f]+)|((?i)\\b\\d\\d*|\\b0\\b)|((?i)\\b0[0-7]+)|((?i)\\b(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?mi)^[ \\t]*#include)|((?mii)^[ \\t]*#[ \\t]*[a-z]+)|((?i)\\d*\\.?\\d+)|((?i)\\/\\*)|((?i)\\/\\/.+)/', + 3 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)\\b0[xX][\\da-f]+)|((?i)\\b\\d\\d*|\\b0\\b)|((?i)\\b0[0-7]+)|((?i)\\b(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?mi)^[ \\t]*#include)|((?mii)^[ \\t]*#[ \\t]*[a-z]+)|((?i)\\d*\\.?\\d+)|((?i)\\/\\*)|((?i)\\/\\/.+)/', + 4 => '//', + 5 => '/((?i)")|((?i)<)/', + 6 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)[a-z_]\\w*)|((?i)\\b0[xX][\\da-f]+)|((?i)\\b\\d\\d*|\\b0\\b)|((?i)\\b0[0-7]+)|((?i)\\b(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)\\/\\*)|((?i)\\/\\/.+)/', + 7 => '/((?i)\\$\\w+\\s*:.+\\$)/', + 8 => '/((?i)\\$\\w+\\s*:.+\\$)/', + ); + $this->_counts = array ( + -1 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + 10 => 0, + 11 => 0, + 12 => 0, + 13 => 0, + ), + 0 => + array ( + 0 => 0, + ), + 1 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + 10 => 0, + 11 => 0, + 12 => 0, + 13 => 0, + ), + 2 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + 10 => 0, + 11 => 0, + 12 => 0, + 13 => 0, + ), + 3 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + 10 => 0, + 11 => 0, + 12 => 0, + 13 => 0, + ), + 4 => + array ( + ), + 5 => + array ( + 0 => 0, + 1 => 0, + ), + 6 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 2, + 8 => 0, + 9 => 0, + ), + 7 => + array ( + 0 => 0, + ), + 8 => + array ( + 0 => 0, + ), + ); + $this->_delim = array ( + -1 => + array ( + 0 => 'quotes', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'brackets', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => 'prepro', + 10 => 'prepro', + 11 => '', + 12 => 'mlcomment', + 13 => 'comment', + ), + 0 => + array ( + 0 => '', + ), + 1 => + array ( + 0 => 'quotes', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'brackets', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => 'prepro', + 10 => 'prepro', + 11 => '', + 12 => 'mlcomment', + 13 => 'comment', + ), + 2 => + array ( + 0 => 'quotes', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'brackets', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => 'prepro', + 10 => 'prepro', + 11 => '', + 12 => 'mlcomment', + 13 => 'comment', + ), + 3 => + array ( + 0 => 'quotes', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'brackets', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => 'prepro', + 10 => 'prepro', + 11 => '', + 12 => 'mlcomment', + 13 => 'comment', + ), + 4 => + array ( + ), + 5 => + array ( + 0 => 'quotes', + 1 => 'quotes', + ), + 6 => + array ( + 0 => 'quotes', + 1 => 'brackets', + 2 => 'brackets', + 3 => '', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => 'mlcomment', + 9 => 'comment', + ), + 7 => + array ( + 0 => '', + ), + 8 => + array ( + 0 => '', + ), + ); + $this->_inner = array ( + -1 => + array ( + 0 => 'string', + 1 => 'code', + 2 => 'code', + 3 => 'code', + 4 => 'identifier', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'prepro', + 10 => 'code', + 11 => 'number', + 12 => 'mlcomment', + 13 => 'comment', + ), + 0 => + array ( + 0 => 'special', + ), + 1 => + array ( + 0 => 'string', + 1 => 'code', + 2 => 'code', + 3 => 'code', + 4 => 'identifier', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'prepro', + 10 => 'code', + 11 => 'number', + 12 => 'mlcomment', + 13 => 'comment', + ), + 2 => + array ( + 0 => 'string', + 1 => 'code', + 2 => 'code', + 3 => 'code', + 4 => 'identifier', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'prepro', + 10 => 'code', + 11 => 'number', + 12 => 'mlcomment', + 13 => 'comment', + ), + 3 => + array ( + 0 => 'string', + 1 => 'code', + 2 => 'code', + 3 => 'code', + 4 => 'identifier', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'prepro', + 10 => 'code', + 11 => 'number', + 12 => 'mlcomment', + 13 => 'comment', + ), + 4 => + array ( + ), + 5 => + array ( + 0 => 'string', + 1 => 'string', + ), + 6 => + array ( + 0 => 'string', + 1 => 'code', + 2 => 'code', + 3 => 'identifier', + 4 => 'number', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'mlcomment', + 9 => 'comment', + ), + 7 => + array ( + 0 => 'inlinedoc', + ), + 8 => + array ( + 0 => 'inlinedoc', + ), + ); + $this->_end = array ( + 0 => '/(?i)"/', + 1 => '/(?i)\\}/', + 2 => '/(?i)\\)/', + 3 => '/(?i)\\]/', + 4 => '/(?i)>/', + 5 => '/(?mi)(? '/(?mi)(? '/(?i)\\*\\//', + 8 => '/(?mi)$/', + ); + $this->_states = array ( + -1 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => 5, + 10 => 6, + 11 => -1, + 12 => 7, + 13 => 8, + ), + 0 => + array ( + 0 => -1, + ), + 1 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => 5, + 10 => 6, + 11 => -1, + 12 => 7, + 13 => 8, + ), + 2 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => 5, + 10 => 6, + 11 => -1, + 12 => 7, + 13 => 8, + ), + 3 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => 5, + 10 => 6, + 11 => -1, + 12 => 7, + 13 => 8, + ), + 4 => + array ( + ), + 5 => + array ( + 0 => 0, + 1 => 4, + ), + 6 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => -1, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => 7, + 9 => 8, + ), + 7 => + array ( + 0 => -1, + ), + 8 => + array ( + 0 => -1, + ), + ); + $this->_keywords = array ( + -1 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => + array ( + 'reserved' => '/^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/', + 'registers' => '/^(ACSR|ADCH|ADCL|ADCSRA|ADMUX|ASSR|DDRA|DDRB|DDRC|DDRD|DDRE|DDRF|DDRG|EEARH|EEARL|EECR|EEDR|EICRA|EICRB|EIFR|EIMSK|ETIFR|ETIMSK|GICR|GIFR|ICR1H|ICR1L|ICR3H|ICR3L|MCUCR|MCUCSR|OCDR|OCR0|OCR1AH|OCR1AL|OCR1BH|OCR1BL|OCR1CH|OCR1CL|OCR2|OCR3AH|OCR3AL|OCR3BH|OCR3BL|OCR3CH|OCR3CL|OSCCAL|PINA|PINB|PINC|PIND|PINE|PINF|PING|PORTA|PORTB|PORTC|PORTD|PORTE|PORTF|PORTG|RAMPZ|SFIOR|SPCR|SPDR|SPH|SPL|SPMCR|SPMCSR|SPSR|SREG|TCCR0|TCCR1A|TCCR1B|TCCR1C|TCCR2|TCCR3A|TCCR3B|TCCR3C|TCNT0|TCNT1H|TCNT1L|TCNT2|TCNT3H|TCNT3L|TIFR|TIMSK|TWAR|TWBR|TWCR|TWDR|TWSR|UBRR0H|UBRR0L|UBRR1H|UBRR1L|UBRRH|UBRRL|UCSR0A|UCSR0B|UCSR0C|UCSR1A|UCSR1B|UCSR1C|UCSRA|UCSRB|UCSRC|UDR|UDR0|UDR1|WDTCR|XDIV|XMCRA|XMCRB)$/', + 'types' => '/^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/', + 'Common Macros' => '/^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/', + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => -1, + 10 => -1, + 11 => + array ( + ), + 12 => -1, + 13 => -1, + ), + 0 => + array ( + 0 => + array ( + ), + ), + 1 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => + array ( + 'reserved' => '/^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/', + 'registers' => '/^(ACSR|ADCH|ADCL|ADCSRA|ADMUX|ASSR|DDRA|DDRB|DDRC|DDRD|DDRE|DDRF|DDRG|EEARH|EEARL|EECR|EEDR|EICRA|EICRB|EIFR|EIMSK|ETIFR|ETIMSK|GICR|GIFR|ICR1H|ICR1L|ICR3H|ICR3L|MCUCR|MCUCSR|OCDR|OCR0|OCR1AH|OCR1AL|OCR1BH|OCR1BL|OCR1CH|OCR1CL|OCR2|OCR3AH|OCR3AL|OCR3BH|OCR3BL|OCR3CH|OCR3CL|OSCCAL|PINA|PINB|PINC|PIND|PINE|PINF|PING|PORTA|PORTB|PORTC|PORTD|PORTE|PORTF|PORTG|RAMPZ|SFIOR|SPCR|SPDR|SPH|SPL|SPMCR|SPMCSR|SPSR|SREG|TCCR0|TCCR1A|TCCR1B|TCCR1C|TCCR2|TCCR3A|TCCR3B|TCCR3C|TCNT0|TCNT1H|TCNT1L|TCNT2|TCNT3H|TCNT3L|TIFR|TIMSK|TWAR|TWBR|TWCR|TWDR|TWSR|UBRR0H|UBRR0L|UBRR1H|UBRR1L|UBRRH|UBRRL|UCSR0A|UCSR0B|UCSR0C|UCSR1A|UCSR1B|UCSR1C|UCSRA|UCSRB|UCSRC|UDR|UDR0|UDR1|WDTCR|XDIV|XMCRA|XMCRB)$/', + 'types' => '/^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/', + 'Common Macros' => '/^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/', + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => -1, + 10 => -1, + 11 => + array ( + ), + 12 => -1, + 13 => -1, + ), + 2 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => + array ( + 'reserved' => '/^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/', + 'registers' => '/^(ACSR|ADCH|ADCL|ADCSRA|ADMUX|ASSR|DDRA|DDRB|DDRC|DDRD|DDRE|DDRF|DDRG|EEARH|EEARL|EECR|EEDR|EICRA|EICRB|EIFR|EIMSK|ETIFR|ETIMSK|GICR|GIFR|ICR1H|ICR1L|ICR3H|ICR3L|MCUCR|MCUCSR|OCDR|OCR0|OCR1AH|OCR1AL|OCR1BH|OCR1BL|OCR1CH|OCR1CL|OCR2|OCR3AH|OCR3AL|OCR3BH|OCR3BL|OCR3CH|OCR3CL|OSCCAL|PINA|PINB|PINC|PIND|PINE|PINF|PING|PORTA|PORTB|PORTC|PORTD|PORTE|PORTF|PORTG|RAMPZ|SFIOR|SPCR|SPDR|SPH|SPL|SPMCR|SPMCSR|SPSR|SREG|TCCR0|TCCR1A|TCCR1B|TCCR1C|TCCR2|TCCR3A|TCCR3B|TCCR3C|TCNT0|TCNT1H|TCNT1L|TCNT2|TCNT3H|TCNT3L|TIFR|TIMSK|TWAR|TWBR|TWCR|TWDR|TWSR|UBRR0H|UBRR0L|UBRR1H|UBRR1L|UBRRH|UBRRL|UCSR0A|UCSR0B|UCSR0C|UCSR1A|UCSR1B|UCSR1C|UCSRA|UCSRB|UCSRC|UDR|UDR0|UDR1|WDTCR|XDIV|XMCRA|XMCRB)$/', + 'types' => '/^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/', + 'Common Macros' => '/^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/', + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => -1, + 10 => -1, + 11 => + array ( + ), + 12 => -1, + 13 => -1, + ), + 3 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => + array ( + 'reserved' => '/^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/', + 'registers' => '/^(ACSR|ADCH|ADCL|ADCSRA|ADMUX|ASSR|DDRA|DDRB|DDRC|DDRD|DDRE|DDRF|DDRG|EEARH|EEARL|EECR|EEDR|EICRA|EICRB|EIFR|EIMSK|ETIFR|ETIMSK|GICR|GIFR|ICR1H|ICR1L|ICR3H|ICR3L|MCUCR|MCUCSR|OCDR|OCR0|OCR1AH|OCR1AL|OCR1BH|OCR1BL|OCR1CH|OCR1CL|OCR2|OCR3AH|OCR3AL|OCR3BH|OCR3BL|OCR3CH|OCR3CL|OSCCAL|PINA|PINB|PINC|PIND|PINE|PINF|PING|PORTA|PORTB|PORTC|PORTD|PORTE|PORTF|PORTG|RAMPZ|SFIOR|SPCR|SPDR|SPH|SPL|SPMCR|SPMCSR|SPSR|SREG|TCCR0|TCCR1A|TCCR1B|TCCR1C|TCCR2|TCCR3A|TCCR3B|TCCR3C|TCNT0|TCNT1H|TCNT1L|TCNT2|TCNT3H|TCNT3L|TIFR|TIMSK|TWAR|TWBR|TWCR|TWDR|TWSR|UBRR0H|UBRR0L|UBRR1H|UBRR1L|UBRRH|UBRRL|UCSR0A|UCSR0B|UCSR0C|UCSR1A|UCSR1B|UCSR1C|UCSRA|UCSRB|UCSRC|UDR|UDR0|UDR1|WDTCR|XDIV|XMCRA|XMCRB)$/', + 'types' => '/^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/', + 'Common Macros' => '/^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/', + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => -1, + 10 => -1, + 11 => + array ( + ), + 12 => -1, + 13 => -1, + ), + 4 => + array ( + ), + 5 => + array ( + 0 => -1, + 1 => -1, + ), + 6 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => + array ( + 'reserved' => '/^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/', + 'registers' => '/^(ACSR|ADCH|ADCL|ADCSRA|ADMUX|ASSR|DDRA|DDRB|DDRC|DDRD|DDRE|DDRF|DDRG|EEARH|EEARL|EECR|EEDR|EICRA|EICRB|EIFR|EIMSK|ETIFR|ETIMSK|GICR|GIFR|ICR1H|ICR1L|ICR3H|ICR3L|MCUCR|MCUCSR|OCDR|OCR0|OCR1AH|OCR1AL|OCR1BH|OCR1BL|OCR1CH|OCR1CL|OCR2|OCR3AH|OCR3AL|OCR3BH|OCR3BL|OCR3CH|OCR3CL|OSCCAL|PINA|PINB|PINC|PIND|PINE|PINF|PING|PORTA|PORTB|PORTC|PORTD|PORTE|PORTF|PORTG|RAMPZ|SFIOR|SPCR|SPDR|SPH|SPL|SPMCR|SPMCSR|SPSR|SREG|TCCR0|TCCR1A|TCCR1B|TCCR1C|TCCR2|TCCR3A|TCCR3B|TCCR3C|TCNT0|TCNT1H|TCNT1L|TCNT2|TCNT3H|TCNT3L|TIFR|TIMSK|TWAR|TWBR|TWCR|TWDR|TWSR|UBRR0H|UBRR0L|UBRR1H|UBRR1L|UBRRH|UBRRL|UCSR0A|UCSR0B|UCSR0C|UCSR1A|UCSR1B|UCSR1C|UCSRA|UCSRB|UCSRC|UDR|UDR0|UDR1|WDTCR|XDIV|XMCRA|XMCRB)$/', + 'types' => '/^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/', + 'Common Macros' => '/^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/', + ), + 4 => + array ( + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => -1, + 9 => -1, + ), + 7 => + array ( + 0 => + array ( + ), + ), + 8 => + array ( + 0 => + array ( + ), + ), + ); + $this->_parts = array ( + 0 => + array ( + 0 => NULL, + ), + 1 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + 10 => NULL, + 11 => NULL, + 12 => NULL, + 13 => NULL, + ), + 2 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + 10 => NULL, + 11 => NULL, + 12 => NULL, + 13 => NULL, + ), + 3 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + 10 => NULL, + 11 => NULL, + 12 => NULL, + 13 => NULL, + ), + 4 => + array ( + ), + 5 => + array ( + 0 => NULL, + 1 => NULL, + ), + 6 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + ), + 7 => + array ( + 0 => NULL, + ), + 8 => + array ( + 0 => NULL, + ), + ); + $this->_subst = array ( + -1 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + 10 => false, + 11 => false, + 12 => false, + 13 => false, + ), + 0 => + array ( + 0 => false, + ), + 1 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + 10 => false, + 11 => false, + 12 => false, + 13 => false, + ), + 2 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + 10 => false, + 11 => false, + 12 => false, + 13 => false, + ), + 3 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + 10 => false, + 11 => false, + 12 => false, + 13 => false, + ), + 4 => + array ( + ), + 5 => + array ( + 0 => false, + 1 => false, + ), + 6 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + ), + 7 => + array ( + 0 => false, + ), + 8 => + array ( + 0 => false, + ), + ); + $this->_conditions = array ( + ); + $this->_kwmap = array ( + 'reserved' => 'reserved', + 'registers' => 'reserved', + 'types' => 'types', + 'Common Macros' => 'prepro', + ); + $this->_defClass = 'code'; + $this->_checkDefines(); + } + +} \ No newline at end of file diff --git a/library/Text_Highlighter/Text/Highlighter/CPP.php b/library/Text_Highlighter/Text/Highlighter/CPP.php new file mode 100644 index 000000000..eaa47c575 --- /dev/null +++ b/library/Text_Highlighter/Text/Highlighter/CPP.php @@ -0,0 +1,891 @@ + + + * + */ + +/** + * @ignore + */ + +require_once 'Text/Highlighter.php'; + +/** + * Auto-generated class. CPP syntax highlighting + * + * @author Aaron Kalin + * @author Andrey Demenev + * @category Text + * @package Text_Highlighter + * @copyright 2004-2006 Andrey Demenev + * @license http://www.php.net/license/3_0.txt PHP License + * @version Release: 0.7.0 + * @link http://pear.php.net/package/Text_Highlighter + */ +class Text_Highlighter_CPP extends Text_Highlighter +{ + var $_language = 'cpp'; + + /** + * PHP4 Compatible Constructor + * + * @param array $options + * @access public + */ + function Text_Highlighter_CPP($options=array()) + { + $this->__construct($options); + } + + + /** + * Constructor + * + * @param array $options + * @access public + */ + function __construct($options=array()) + { + + $this->_options = $options; + $this->_regs = array ( + -1 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)\\b0[xX][\\da-f]+)|((?i)\\b\\d\\d*|\\b0\\b)|((?i)\\b0[0-7]+)|((?i)\\b(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?mi)^[ \\t]*#include)|((?mii)^[ \\t]*#[ \\t]*[a-z]+)|((?i)\\d*\\.?\\d+)|((?i)\\/\\*)|((?i)\\/\\/.+)/', + 0 => '/((?i)\\\\)/', + 1 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)\\b0[xX][\\da-f]+)|((?i)\\b\\d\\d*|\\b0\\b)|((?i)\\b0[0-7]+)|((?i)\\b(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?mi)^[ \\t]*#include)|((?mii)^[ \\t]*#[ \\t]*[a-z]+)|((?i)\\d*\\.?\\d+)|((?i)\\/\\*)|((?i)\\/\\/.+)/', + 2 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)\\b0[xX][\\da-f]+)|((?i)\\b\\d\\d*|\\b0\\b)|((?i)\\b0[0-7]+)|((?i)\\b(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?mi)^[ \\t]*#include)|((?mii)^[ \\t]*#[ \\t]*[a-z]+)|((?i)\\d*\\.?\\d+)|((?i)\\/\\*)|((?i)\\/\\/.+)/', + 3 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)\\[)|((?i)[a-z_]\\w*)|((?i)\\b0[xX][\\da-f]+)|((?i)\\b\\d\\d*|\\b0\\b)|((?i)\\b0[0-7]+)|((?i)\\b(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?mi)^[ \\t]*#include)|((?mii)^[ \\t]*#[ \\t]*[a-z]+)|((?i)\\d*\\.?\\d+)|((?i)\\/\\*)|((?i)\\/\\/.+)/', + 4 => '//', + 5 => '/((?i)")|((?i)<)/', + 6 => '/((?i)")|((?i)\\{)|((?i)\\()|((?i)[a-z_]\\w*)|((?i)\\b0[xX][\\da-f]+)|((?i)\\b\\d\\d*|\\b0\\b)|((?i)\\b0[0-7]+)|((?i)\\b(\\d*\\.\\d+)|(\\d+\\.\\d*))|((?i)\\/\\*)|((?i)\\/\\/.+)/', + 7 => '/((?i)\\$\\w+\\s*:.+\\$)/', + 8 => '/((?i)\\$\\w+\\s*:.+\\$)/', + ); + $this->_counts = array ( + -1 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + 10 => 0, + 11 => 0, + 12 => 0, + 13 => 0, + ), + 0 => + array ( + 0 => 0, + ), + 1 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + 10 => 0, + 11 => 0, + 12 => 0, + 13 => 0, + ), + 2 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + 10 => 0, + 11 => 0, + 12 => 0, + 13 => 0, + ), + 3 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 2, + 9 => 0, + 10 => 0, + 11 => 0, + 12 => 0, + 13 => 0, + ), + 4 => + array ( + ), + 5 => + array ( + 0 => 0, + 1 => 0, + ), + 6 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 2, + 8 => 0, + 9 => 0, + ), + 7 => + array ( + 0 => 0, + ), + 8 => + array ( + 0 => 0, + ), + ); + $this->_delim = array ( + -1 => + array ( + 0 => 'quotes', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'brackets', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => 'prepro', + 10 => 'prepro', + 11 => '', + 12 => 'mlcomment', + 13 => 'comment', + ), + 0 => + array ( + 0 => '', + ), + 1 => + array ( + 0 => 'quotes', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'brackets', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => 'prepro', + 10 => 'prepro', + 11 => '', + 12 => 'mlcomment', + 13 => 'comment', + ), + 2 => + array ( + 0 => 'quotes', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'brackets', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => 'prepro', + 10 => 'prepro', + 11 => '', + 12 => 'mlcomment', + 13 => 'comment', + ), + 3 => + array ( + 0 => 'quotes', + 1 => 'brackets', + 2 => 'brackets', + 3 => 'brackets', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => 'prepro', + 10 => 'prepro', + 11 => '', + 12 => 'mlcomment', + 13 => 'comment', + ), + 4 => + array ( + ), + 5 => + array ( + 0 => 'quotes', + 1 => 'quotes', + ), + 6 => + array ( + 0 => 'quotes', + 1 => 'brackets', + 2 => 'brackets', + 3 => '', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => 'mlcomment', + 9 => 'comment', + ), + 7 => + array ( + 0 => '', + ), + 8 => + array ( + 0 => '', + ), + ); + $this->_inner = array ( + -1 => + array ( + 0 => 'string', + 1 => 'code', + 2 => 'code', + 3 => 'code', + 4 => 'identifier', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'prepro', + 10 => 'code', + 11 => 'number', + 12 => 'mlcomment', + 13 => 'comment', + ), + 0 => + array ( + 0 => 'special', + ), + 1 => + array ( + 0 => 'string', + 1 => 'code', + 2 => 'code', + 3 => 'code', + 4 => 'identifier', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'prepro', + 10 => 'code', + 11 => 'number', + 12 => 'mlcomment', + 13 => 'comment', + ), + 2 => + array ( + 0 => 'string', + 1 => 'code', + 2 => 'code', + 3 => 'code', + 4 => 'identifier', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'prepro', + 10 => 'code', + 11 => 'number', + 12 => 'mlcomment', + 13 => 'comment', + ), + 3 => + array ( + 0 => 'string', + 1 => 'code', + 2 => 'code', + 3 => 'code', + 4 => 'identifier', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'number', + 9 => 'prepro', + 10 => 'code', + 11 => 'number', + 12 => 'mlcomment', + 13 => 'comment', + ), + 4 => + array ( + ), + 5 => + array ( + 0 => 'string', + 1 => 'string', + ), + 6 => + array ( + 0 => 'string', + 1 => 'code', + 2 => 'code', + 3 => 'identifier', + 4 => 'number', + 5 => 'number', + 6 => 'number', + 7 => 'number', + 8 => 'mlcomment', + 9 => 'comment', + ), + 7 => + array ( + 0 => 'inlinedoc', + ), + 8 => + array ( + 0 => 'inlinedoc', + ), + ); + $this->_end = array ( + 0 => '/(?i)"/', + 1 => '/(?i)\\}/', + 2 => '/(?i)\\)/', + 3 => '/(?i)\\]/', + 4 => '/(?i)>/', + 5 => '/(?mi)(? '/(?mi)(? '/(?i)\\*\\//', + 8 => '/(?mi)$/', + ); + $this->_states = array ( + -1 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => 5, + 10 => 6, + 11 => -1, + 12 => 7, + 13 => 8, + ), + 0 => + array ( + 0 => -1, + ), + 1 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => 5, + 10 => 6, + 11 => -1, + 12 => 7, + 13 => 8, + ), + 2 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => 5, + 10 => 6, + 11 => -1, + 12 => 7, + 13 => 8, + ), + 3 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => 3, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => 5, + 10 => 6, + 11 => -1, + 12 => 7, + 13 => 8, + ), + 4 => + array ( + ), + 5 => + array ( + 0 => 0, + 1 => 4, + ), + 6 => + array ( + 0 => 0, + 1 => 1, + 2 => 2, + 3 => -1, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => 7, + 9 => 8, + ), + 7 => + array ( + 0 => -1, + ), + 8 => + array ( + 0 => -1, + ), + ); + $this->_keywords = array ( + -1 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => + array ( + 'reserved' => '/^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/', + 'types' => '/^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/', + 'Common Macros' => '/^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/', + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => -1, + 10 => -1, + 11 => + array ( + ), + 12 => -1, + 13 => -1, + ), + 0 => + array ( + 0 => + array ( + ), + ), + 1 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => + array ( + 'reserved' => '/^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/', + 'types' => '/^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/', + 'Common Macros' => '/^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/', + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => -1, + 10 => -1, + 11 => + array ( + ), + 12 => -1, + 13 => -1, + ), + 2 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => + array ( + 'reserved' => '/^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/', + 'types' => '/^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/', + 'Common Macros' => '/^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/', + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => -1, + 10 => -1, + 11 => + array ( + ), + 12 => -1, + 13 => -1, + ), + 3 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => + array ( + 'reserved' => '/^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/', + 'types' => '/^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/', + 'Common Macros' => '/^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/', + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => -1, + 10 => -1, + 11 => + array ( + ), + 12 => -1, + 13 => -1, + ), + 4 => + array ( + ), + 5 => + array ( + 0 => -1, + 1 => -1, + ), + 6 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => + array ( + 'reserved' => '/^(and|and_eq|asm|bitand|bitor|break|case|catch|compl|const_cast|continue|default|delete|do|dynamic_cast|else|for|fortran|friend|goto|if|new|not|not_eq|operator|or|or_eq|private|protected|public|reinterpret_cast|return|sizeof|static_cast|switch|this|throw|try|typeid|using|while|xor|xor_eq|false|true)$/', + 'types' => '/^(auto|bool|char|class|const|double|enum|explicit|export|extern|float|inline|int|long|mutable|namespace|register|short|signed|static|struct|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)$/', + 'Common Macros' => '/^(NULL|TRUE|FALSE|MAX|MIN|__LINE__|__DATA__|__FILE__|__TIME__|__STDC__)$/', + ), + 4 => + array ( + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => -1, + 9 => -1, + ), + 7 => + array ( + 0 => + array ( + ), + ), + 8 => + array ( + 0 => + array ( + ), + ), + ); + $this->_parts = array ( + 0 => + array ( + 0 => NULL, + ), + 1 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + 10 => NULL, + 11 => NULL, + 12 => NULL, + 13 => NULL, + ), + 2 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + 10 => NULL, + 11 => NULL, + 12 => NULL, + 13 => NULL, + ), + 3 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + 10 => NULL, + 11 => NULL, + 12 => NULL, + 13 => NULL, + ), + 4 => + array ( + ), + 5 => + array ( + 0 => NULL, + 1 => NULL, + ), + 6 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + 4 => NULL, + 5 => NULL, + 6 => NULL, + 7 => NULL, + 8 => NULL, + 9 => NULL, + ), + 7 => + array ( + 0 => NULL, + ), + 8 => + array ( + 0 => NULL, + ), + ); + $this->_subst = array ( + -1 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + 10 => false, + 11 => false, + 12 => false, + 13 => false, + ), + 0 => + array ( + 0 => false, + ), + 1 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + 10 => false, + 11 => false, + 12 => false, + 13 => false, + ), + 2 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + 10 => false, + 11 => false, + 12 => false, + 13 => false, + ), + 3 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + 10 => false, + 11 => false, + 12 => false, + 13 => false, + ), + 4 => + array ( + ), + 5 => + array ( + 0 => false, + 1 => false, + ), + 6 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + ), + 7 => + array ( + 0 => false, + ), + 8 => + array ( + 0 => false, + ), + ); + $this->_conditions = array ( + ); + $this->_kwmap = array ( + 'reserved' => 'reserved', + 'types' => 'types', + 'Common Macros' => 'prepro', + ); + $this->_defClass = 'code'; + $this->_checkDefines(); + } + +} \ No newline at end of file diff --git a/library/Text_Highlighter/Text/Highlighter/CSS.php b/library/Text_Highlighter/Text/Highlighter/CSS.php new file mode 100644 index 000000000..51757c88e --- /dev/null +++ b/library/Text_Highlighter/Text/Highlighter/CSS.php @@ -0,0 +1,437 @@ + + * + */ + +/** + * @ignore + */ + +require_once 'Text/Highlighter.php'; + +/** + * Auto-generated class. CSS syntax highlighting + * + * @author Andrey Demenev + * @category Text + * @package Text_Highlighter + * @copyright 2004-2006 Andrey Demenev + * @license http://www.php.net/license/3_0.txt PHP License + * @version Release: 0.7.0 + * @link http://pear.php.net/package/Text_Highlighter + */ +class Text_Highlighter_CSS extends Text_Highlighter +{ + var $_language = 'css'; + + /** + * PHP4 Compatible Constructor + * + * @param array $options + * @access public + */ + function Text_Highlighter_CSS($options=array()) + { + $this->__construct($options); + } + + + /** + * Constructor + * + * @param array $options + * @access public + */ + function __construct($options=array()) + { + + $this->_options = $options; + $this->_regs = array ( + -1 => '/((?i)\\/\\*)|((?i)(@[a-z\\d]+))|((?i)(((\\.|#)?[a-z]+[a-z\\d\\-]*(?![a-z\\d\\-]))|(\\*))(?!\\s*:\\s*[\\s\\{]))|((?i):[a-z][a-z\\d\\-]*)|((?i)\\[)|((?i)\\{)/', + 0 => '//', + 1 => '/((?i)\\d*\\.?\\d+(\\%|em|ex|pc|pt|px|in|mm|cm))|((?i)\\d*\\.?\\d+)|((?i)[a-z][a-z\\d\\-]*)|((?i)#([\\da-f]{6}|[\\da-f]{3})\\b)/', + 2 => '/((?i)\')|((?i)")|((?i)[\\w\\-\\:]+)/', + 3 => '/((?i)\\/\\*)|((?i)[a-z][a-z\\d\\-]*\\s*:)|((?i)(((\\.|#)?[a-z]+[a-z\\d\\-]*(?![a-z\\d\\-]))|(\\*))(?!\\s*:\\s*[\\s\\{]))|((?i)\\{)/', + 4 => '/((?i)\\\\[\\\\(\\\\)\\\\])/', + 5 => '/((?i)\\\\\\\\|\\\\"|\\\\\'|\\\\`)/', + 6 => '/((?i)\\\\\\\\|\\\\"|\\\\\'|\\\\`|\\\\t|\\\\n|\\\\r)/', + ); + $this->_counts = array ( + -1 => + array ( + 0 => 0, + 1 => 1, + 2 => 4, + 3 => 0, + 4 => 0, + 5 => 0, + ), + 0 => + array ( + ), + 1 => + array ( + 0 => 1, + 1 => 0, + 2 => 0, + 3 => 1, + ), + 2 => + array ( + 0 => 0, + 1 => 0, + 2 => 0, + ), + 3 => + array ( + 0 => 0, + 1 => 0, + 2 => 4, + 3 => 0, + ), + 4 => + array ( + 0 => 0, + ), + 5 => + array ( + 0 => 0, + ), + 6 => + array ( + 0 => 0, + ), + ); + $this->_delim = array ( + -1 => + array ( + 0 => 'comment', + 1 => '', + 2 => '', + 3 => '', + 4 => 'brackets', + 5 => 'brackets', + ), + 0 => + array ( + ), + 1 => + array ( + 0 => '', + 1 => '', + 2 => '', + 3 => '', + ), + 2 => + array ( + 0 => 'quotes', + 1 => 'quotes', + 2 => '', + ), + 3 => + array ( + 0 => 'comment', + 1 => 'reserved', + 2 => '', + 3 => 'brackets', + ), + 4 => + array ( + 0 => '', + ), + 5 => + array ( + 0 => '', + ), + 6 => + array ( + 0 => '', + ), + ); + $this->_inner = array ( + -1 => + array ( + 0 => 'comment', + 1 => 'var', + 2 => 'identifier', + 3 => 'special', + 4 => 'code', + 5 => 'code', + ), + 0 => + array ( + ), + 1 => + array ( + 0 => 'number', + 1 => 'number', + 2 => 'code', + 3 => 'var', + ), + 2 => + array ( + 0 => 'string', + 1 => 'string', + 2 => 'var', + ), + 3 => + array ( + 0 => 'comment', + 1 => 'code', + 2 => 'identifier', + 3 => 'code', + ), + 4 => + array ( + 0 => 'string', + ), + 5 => + array ( + 0 => 'special', + ), + 6 => + array ( + 0 => 'special', + ), + ); + $this->_end = array ( + 0 => '/(?i)\\*\\//', + 1 => '/(?i)(?=;|\\})/', + 2 => '/(?i)\\]/', + 3 => '/(?i)\\}/', + 4 => '/(?i)\\)/', + 5 => '/(?i)\'/', + 6 => '/(?i)"/', + ); + $this->_states = array ( + -1 => + array ( + 0 => 0, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => 2, + 5 => 3, + ), + 0 => + array ( + ), + 1 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + ), + 2 => + array ( + 0 => 5, + 1 => 6, + 2 => -1, + ), + 3 => + array ( + 0 => 0, + 1 => 1, + 2 => -1, + 3 => 3, + ), + 4 => + array ( + 0 => -1, + ), + 5 => + array ( + 0 => -1, + ), + 6 => + array ( + 0 => -1, + ), + ); + $this->_keywords = array ( + -1 => + array ( + 0 => -1, + 1 => + array ( + ), + 2 => + array ( + ), + 3 => + array ( + ), + 4 => -1, + 5 => -1, + ), + 0 => + array ( + ), + 1 => + array ( + 0 => + array ( + ), + 1 => + array ( + ), + 2 => + array ( + 'propertyValue' => '/^((?i)far-left|left|center-left|center-right|center|far-right|right-side|right|behind|leftwards|rightwards|inherit|scroll|fixed|transparent|none|repeat-x|repeat-y|repeat|no-repeat|collapse|separate|auto|top|bottom|both|open-quote|close-quote|no-open-quote|no-close-quote|crosshair|default|pointer|move|e-resize|ne-resize|nw-resize|n-resize|se-resize|sw-resize|s-resize|text|wait|help|ltr|rtl|inline|block|list-item|run-in|compact|marker|table|inline-table|table-row-group|table-header-group|table-footer-group|table-row|table-column-group|table-column|table-cell|table-caption|below|level|above|higher|lower|show|hide|caption|icon|menu|message-box|small-caption|status-bar|normal|wider|narrower|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|italic|oblique|small-caps|bold|bolder|lighter|inside|outside|disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha|crop|cross|invert|visible|hidden|always|avoid|x-low|low|medium|high|x-high|mix?|repeat?|static|relative|absolute|portrait|landscape|spell-out|once|digits|continuous|code|x-slow|slow|fast|x-fast|faster|slower|justify|underline|overline|line-through|blink|capitalize|uppercase|lowercase|embed|bidi-override|baseline|sub|super|text-top|middle|text-bottom|silent|x-soft|soft|loud|x-loud|pre|nowrap|serif|sans-serif|cursive|fantasy|monospace|empty|string|strict|loose|char|true|false|dotted|dashed|solid|double|groove|ridge|inset|outset|larger|smaller|xx-small|x-small|small|large|x-large|xx-large|all|newspaper|distribute|distribute-all-lines|distribute-center-last|inter-word|inter-ideograph|inter-cluster|kashida|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|keep-all|break-all|break-word|lr-tb|tb-rl|thin|thick|inline-block|w-resize|hand|distribute-letter|distribute-space|whitespace|male|female|child)$/', + 'namedcolor' => '/^((?i)aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow|activeborder|activecaption|appworkspace|background|buttonface|buttonhighlight|buttonshadow|buttontext|captiontext|graytext|highlight|highlighttext|inactiveborder|inactivecaption|inactivecaptiontext|infobackground|infotext|menu|menutext|scrollbar|threeddarkshadow|threedface|threedhighlight|threedlightshadow|threedshadow|window|windowframe|windowtext)$/', + ), + 3 => + array ( + ), + ), + 2 => + array ( + 0 => -1, + 1 => -1, + 2 => + array ( + ), + ), + 3 => + array ( + 0 => -1, + 1 => -1, + 2 => + array ( + ), + 3 => -1, + ), + 4 => + array ( + 0 => + array ( + ), + ), + 5 => + array ( + 0 => + array ( + ), + ), + 6 => + array ( + 0 => + array ( + ), + ), + ); + $this->_parts = array ( + 0 => + array ( + ), + 1 => + array ( + 0 => + array ( + 1 => 'string', + ), + 1 => NULL, + 2 => NULL, + 3 => NULL, + ), + 2 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + ), + 3 => + array ( + 0 => NULL, + 1 => NULL, + 2 => NULL, + 3 => NULL, + ), + 4 => + array ( + 0 => NULL, + ), + 5 => + array ( + 0 => NULL, + ), + 6 => + array ( + 0 => NULL, + ), + ); + $this->_subst = array ( + -1 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + ), + 0 => + array ( + ), + 1 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + ), + 2 => + array ( + 0 => false, + 1 => false, + 2 => false, + ), + 3 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + ), + 4 => + array ( + 0 => false, + ), + 5 => + array ( + 0 => false, + ), + 6 => + array ( + 0 => false, + ), + ); + $this->_conditions = array ( + ); + $this->_kwmap = array ( + 'propertyValue' => 'string', + 'namedcolor' => 'var', + ); + $this->_defClass = 'code'; + $this->_checkDefines(); + } + +} diff --git a/library/Text_Highlighter/Text/Highlighter/DIFF.php b/library/Text_Highlighter/Text/Highlighter/DIFF.php new file mode 100644 index 000000000..2bb25a453 --- /dev/null +++ b/library/Text_Highlighter/Text/Highlighter/DIFF.php @@ -0,0 +1,384 @@ + + * + */ + +/** + * @ignore + */ + +require_once 'Text/Highlighter.php'; + +/** + * Auto-generated class. DIFF syntax highlighting + * + * @author Andrey Demenev + * @category Text + * @package Text_Highlighter + * @copyright 2004-2006 Andrey Demenev + * @license http://www.php.net/license/3_0.txt PHP License + * @version Release: @package_version@ + * @link http://pear.php.net/package/Text_Highlighter + */ +class Text_Highlighter_DIFF extends Text_Highlighter +{ + var $_language = 'diff'; + + /** + * PHP4 Compatible Constructor + * + * @param array $options + * @access public + */ + function Text_Highlighter_DIFF($options=array()) + { + $this->__construct($options); + } + + + /** + * Constructor + * + * @param array $options + * @access public + */ + function __construct($options=array()) + { + + $this->_options = $options; + $this->_regs = array ( + -1 => '/((?m)^\\\\\\sNo\\snewline.+$)|((?m)^\\-\\-\\-$)|((?m)^(diff\\s+\\-|Only\\s+|Index).*$)|((?m)^(\\-\\-\\-|\\+\\+\\+)\\s.+$)|((?m)^\\*.*$)|((?m)^\\+.*$)|((?m)^!.*$)|((?m)^\\<\\s.*$)|((?m)^\\>\\s.*$)|((?m)^\\d+(\\,\\d+)?[acd]\\d+(,\\d+)?$)|((?m)^\\-.*$)|((?m)^\\+.*$)|((?m)^@@.+@@$)|((?m)^d\\d+\\s\\d+$)|((?m)^a\\d+\\s\\d+$)|((?m)^(\\d+)(,\\d+)?(a)$)|((?m)^(\\d+)(,\\d+)?(c)$)|((?m)^(\\d+)(,\\d+)?(d)$)|((?m)^a(\\d+)(\\s\\d+)?$)|((?m)^c(\\d+)(\\s\\d+)?$)|((?m)^d(\\d+)(\\s\\d+)?$)/', + 0 => '//', + 1 => '//', + 2 => '//', + 3 => '//', + 4 => '//', + ); + $this->_counts = array ( + -1 => + array ( + 0 => 0, + 1 => 0, + 2 => 1, + 3 => 1, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 0, + 8 => 0, + 9 => 2, + 10 => 0, + 11 => 0, + 12 => 0, + 13 => 0, + 14 => 0, + 15 => 3, + 16 => 3, + 17 => 3, + 18 => 2, + 19 => 2, + 20 => 2, + ), + 0 => + array ( + ), + 1 => + array ( + ), + 2 => + array ( + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_delim = array ( + -1 => + array ( + 0 => '', + 1 => '', + 2 => '', + 3 => '', + 4 => '', + 5 => '', + 6 => '', + 7 => '', + 8 => '', + 9 => '', + 10 => '', + 11 => '', + 12 => '', + 13 => '', + 14 => 'code', + 15 => 'code', + 16 => 'code', + 17 => '', + 18 => 'code', + 19 => 'code', + 20 => '', + ), + 0 => + array ( + ), + 1 => + array ( + ), + 2 => + array ( + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_inner = array ( + -1 => + array ( + 0 => 'special', + 1 => 'code', + 2 => 'var', + 3 => 'reserved', + 4 => 'quotes', + 5 => 'string', + 6 => 'inlinedoc', + 7 => 'quotes', + 8 => 'string', + 9 => 'code', + 10 => 'quotes', + 11 => 'string', + 12 => 'code', + 13 => 'code', + 14 => 'var', + 15 => 'string', + 16 => 'inlinedoc', + 17 => 'code', + 18 => 'string', + 19 => 'inlinedoc', + 20 => 'code', + ), + 0 => + array ( + ), + 1 => + array ( + ), + 2 => + array ( + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_end = array ( + 0 => '/(?m)(?=^[ad]\\d+\\s\\d+)/', + 1 => '/(?m)^(\\.)$/', + 2 => '/(?m)^(\\.)$/', + 3 => '/(?m)^(\\.)$/', + 4 => '/(?m)^(\\.)$/', + ); + $this->_states = array ( + -1 => + array ( + 0 => -1, + 1 => -1, + 2 => -1, + 3 => -1, + 4 => -1, + 5 => -1, + 6 => -1, + 7 => -1, + 8 => -1, + 9 => -1, + 10 => -1, + 11 => -1, + 12 => -1, + 13 => -1, + 14 => 0, + 15 => 1, + 16 => 2, + 17 => -1, + 18 => 3, + 19 => 4, + 20 => -1, + ), + 0 => + array ( + ), + 1 => + array ( + ), + 2 => + array ( + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_keywords = array ( + -1 => + array ( + 0 => + array ( + ), + 1 => + array ( + ), + 2 => + array ( + ), + 3 => + array ( + ), + 4 => + array ( + ), + 5 => + array ( + ), + 6 => + array ( + ), + 7 => + array ( + ), + 8 => + array ( + ), + 9 => + array ( + ), + 10 => + array ( + ), + 11 => + array ( + ), + 12 => + array ( + ), + 13 => + array ( + ), + 14 => -1, + 15 => -1, + 16 => -1, + 17 => + array ( + ), + 18 => -1, + 19 => -1, + 20 => + array ( + ), + ), + 0 => + array ( + ), + 1 => + array ( + ), + 2 => + array ( + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_parts = array ( + 0 => + array ( + ), + 1 => + array ( + ), + 2 => + array ( + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_subst = array ( + -1 => + array ( + 0 => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => false, + 7 => false, + 8 => false, + 9 => false, + 10 => false, + 11 => false, + 12 => false, + 13 => false, + 14 => false, + 15 => false, + 16 => false, + 17 => false, + 18 => false, + 19 => false, + 20 => false, + ), + 0 => + array ( + ), + 1 => + array ( + ), + 2 => + array ( + ), + 3 => + array ( + ), + 4 => + array ( + ), + ); + $this->_conditions = array ( + ); + $this->_kwmap = array ( + ); + $this->_defClass = 'default'; + $this->_checkDefines(); + } + +} \ No newline at end of file diff --git a/library/Text_Highlighter/Text/Highlighter/DTD.php b/library/Text_Highlighter/Text/Highlighter/DTD.php new file mode 100644 index 000000000..41b0faa78 --- /dev/null +++ b/library/Text_Highlighter/Text/Highlighter/DTD.php @@ -0,0 +1,426 @@ + + * + */ + +/** + * @ignore + */ + +require_once 'Text/Highlighter.php'; + +/** + * Auto-generated class. DTD syntax highlighting + * + * @author Andrey Demenev + * @category Text + * @package Text_Highlighter + * @copyright 2004-2006 Andrey Demenev + * @license http://www.php.net/license/3_0.txt PHP License + * @version Release: @package_version@ + * @link http://pear.php.net/package/Text_Highlighter + */ +class Text_Highlighter_DTD extends Text_Highlighter +{ + var $_language = 'dtd'; + + /** + * PHP4 Compatible Constructor + * + * @param array $options + * @access public + */ + function Text_Highlighter_DTD($options=array()) + { + $this->__construct($options); + } + + + /** + * Constructor + * + * @param array $options + * @access public + */ + function __construct($options=array()) + { + + $this->_options = $options; + $this->_regs = array ( + -1 => '/(\\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/avrc.xml b/library/Text_Highlighter/avrc.xml new file mode 100644 index 000000000..dec571e13 --- /dev/null +++ b/library/Text_Highlighter/avrc.xml @@ -0,0 +1,316 @@ + + + + + + + + + + + C/C++ highlighter specific to Atmel AVR microcontrollers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/cpp.xml b/library/Text_Highlighter/cpp.xml new file mode 100644 index 000000000..2cbaa930f --- /dev/null +++ b/library/Text_Highlighter/cpp.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + +Thanks to Aaron Kalin for initial +implementation of this highlighter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/css.xml b/library/Text_Highlighter/css.xml new file mode 100644 index 000000000..2473bcfb7 --- /dev/null +++ b/library/Text_Highlighter/css.xml @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/diff.xml b/library/Text_Highlighter/diff.xml new file mode 100644 index 000000000..d088f9257 --- /dev/null +++ b/library/Text_Highlighter/diff.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/dtd.xml b/library/Text_Highlighter/dtd.xml new file mode 100644 index 000000000..18fa07db7 --- /dev/null +++ b/library/Text_Highlighter/dtd.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/generate b/library/Text_Highlighter/generate new file mode 100644 index 000000000..4e22e82fd --- /dev/null +++ b/library/Text_Highlighter/generate @@ -0,0 +1,171 @@ +#!@php_bin@ + + * @copyright 2004 Andrey Demenev + * @license http://www.php.net/license/3_0.txt PHP License + * @version CVS: $Id$ + * @link http://pear.php.net/package/Text_Highlighter + */ + +require_once 'Text/Highlighter/Generator.php'; +require_once 'Console/Getopt.php'; + +$options = Console_Getopt::getopt($argv, 'x:p:d:h', array('xml=', 'php=','dir=', 'help')); + +if (PEAR::isError($options)) { + $message = str_replace('Console_Getopt: ','',$options->message); + usage($message); +} + +$source = array(); +$dest = array(); +$dir = ''; + +$expectp = false; +$expectx = false; +$unexpectedx = false; +$unexpectedp = false; +$si = $di = 0; + +foreach ($options[0] as $option) { + switch ($option[0]) { + case 'x': + case '--xml': + $source[$si] = $option[1]; + if ($si) { + $di++; + } + $si++; + if ($expectp) { + $unexpectedx = true; + } + $expectp = true; + $expectx = false; + break; + + case 'p': + case '--php': + if ($expectx) { + $unexpectedp = true; + } + $dest[$di] = $option[1]; + $expectp = false; + $expectx = true; + break; + + case 'd': + case '--dir': + $dir = $option[1]; + break; + + case 'h': + case '--help': + usage(); + break; + } +} + + +if ($unexpectedx && !$dir) { + usage('Unexpected -x or --xml', STDERR); +} + +if ($unexpectedp) { + usage('Unexpected -p or --php', STDERR); +} + +$nsource = count($source); +$ndest = count($dest); + +if (!$nsource && !$ndest) { + $source[]='php://stdin'; + if (!$dir) { + $dest[]='php://stdout'; + } else { + $dest[] = null; + } +} elseif ($expectp && !$dir && $nsource > 1) { + usage('-x or --xml without following -p or --php', STDERR); +} elseif ($nsource == 1 && !$ndest && !$dir) { + $dest[]='php://stdout'; +} + +if ($dir && substr($dir,-1)!='/' && substr($dir,-1)!=='\\' ) { + $dir .= DIRECTORY_SEPARATOR; +} + + +foreach ($source as $i => $xmlfile) +{ + $gen = new Text_Highlighter_Generator; + $gen->setInputFile($xmlfile); + if ($gen->hasErrors()) { + break; + } + $gen->generate(); + if ($gen->hasErrors()) { + break; + } + if (isset($dest[$i])) { + $phpfile = $dest[$i]; + } else { + $phpfile = $dir . $gen->language . '.php'; + } + $gen->saveCode($phpfile); + if ($gen->hasErrors()) { + break; + } +} +if ($gen->hasErrors()) { + $errors = $gen->getErrors(); + foreach ($errors as $error) { + fwrite (STDERR, $error . "\n"); + } + exit(1); +} + +function usage($message='', $file=STDOUT) +{ + $code = 0; + if ($message) { + $message .= "\n\n"; + $code = 1; + } + $message .= << tag) + -h, --help + This help +MSG; + fwrite ($file, $message); + exit($code); +} +?> + diff --git a/library/Text_Highlighter/generate.bat b/library/Text_Highlighter/generate.bat new file mode 100644 index 000000000..3960486c1 --- /dev/null +++ b/library/Text_Highlighter/generate.bat @@ -0,0 +1,188 @@ +@echo off +rem vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: + +rem Console highlighter class generator + +rem PHP versions 4 and 5 + +rem LICENSE: This source file is subject to version 3.0 of the PHP license +rem that is available through the world-wide-web at the following URI: +rem http://www.php.net/license/3_0.txt. If you did not receive a copy of +rem the PHP License and are unable to obtain it through the web, please +rem send a note to license@php.net so we can mail you a copy immediately. + +rem @category Text +rem @package Text_Highlighter +rem @author Andrey Demenev +rem @copyright 2004 Andrey Demenev +rem @license http://www.php.net/license/3_0.txt PHP License +rem @version CVS: $Id: generate.bat,v 1.1 2007-06-03 02:35:28 ssttoo Exp $ +rem @link http://pear.php.net/package/Text_Highlighter + +set "MHL_PARAMS=" +:doshift +set "MHL_PARAMS=%MHL_PARAMS% %1" +shift +if -%1- == -- GOTO noshift +GOTO doshift +:noshift +@php_bin@ -q -d output_buffering=1 -d include_path="@php_dir@" @bin_dir@/Text/Highlighter/generate.bat %MHL_PARAMS% + +GOTO finish +message); + usage($message); +} + +$source = array(); +$dest = array(); +$dir = ''; + +$expectp = false; +$expectx = false; +$unexpectedx = false; +$unexpectedp = false; +$si = $di = 0; + +foreach ($options[0] as $option) { + switch ($option[0]) { + case 'x': + case '--xml': + $source[$si] = $option[1]; + if ($si) { + $di++; + } + $si++; + if ($expectp) { + $unexpectedx = true; + } + $expectp = true; + $expectx = false; + break; + + case 'p': + case '--php': + if ($expectx) { + $unexpectedp = true; + } + $dest[$di] = $option[1]; + $expectp = false; + $expectx = true; + break; + + case 'd': + case '--dir': + $dir = $option[1]; + break; + + case 'h': + case '--help': + usage(); + break; + } +} + + +if ($unexpectedx && !$dir) { + usage('Unexpected -x or --xml', STDERR); +} + +if ($unexpectedp) { + usage('Unexpected -p or --php', STDERR); +} + +$nsource = count($source); +$ndest = count($dest); + +if (!$nsource && !$ndest) { + $source[]='php://stdin'; + if (!$dir) { + $dest[]='php://stdout'; + } else { + $dest[] = null; + } +} elseif ($expectp && !$dir && $nsource > 1) { + usage('-x or --xml without following -p or --php', STDERR); +} elseif ($nsource == 1 && !$ndest && !$dir) { + $dest[]='php://stdout'; +} + +if ($dir && substr($dir,-1)!='/' && substr($dir,-1)!=='\\' ) { + $dir .= DIRECTORY_SEPARATOR; +} + + +foreach ($source as $i => $xmlfile) +{ + $gen = new Text_Highlighter_Generator; + $gen->setInputFile($xmlfile); + if ($gen->hasErrors()) { + break; + } + $gen->generate(); + if ($gen->hasErrors()) { + break; + } + if (isset($dest[$i])) { + $phpfile = $dest[$i]; + } else { + $phpfile = $dir . $gen->language . '.php'; + } + $gen->saveCode($phpfile); + if ($gen->hasErrors()) { + break; + } +} +if ($gen->hasErrors()) { + $errors = $gen->getErrors(); + foreach ($errors as $error) { + fwrite (STDERR, $error . "\n"); + } + exit(1); +} + +exit(0); + +function usage($message='', $file=STDOUT) +{ + $code = 0; + if ($message) { + $message .= "\n\n"; + $code = 1; + } + $message .= << tag) + -h, --help + This help +MSG; + fwrite ($file, $message); + exit($code); +} +?> +:finish diff --git a/library/Text_Highlighter/html.xml b/library/Text_Highlighter/html.xml new file mode 100644 index 000000000..58d51fc5b --- /dev/null +++ b/library/Text_Highlighter/html.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/java.xml b/library/Text_Highlighter/java.xml new file mode 100644 index 000000000..12052b5db --- /dev/null +++ b/library/Text_Highlighter/java.xml @@ -0,0 +1,2824 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/javascript.xml b/library/Text_Highlighter/javascript.xml new file mode 100644 index 000000000..e478515a7 --- /dev/null +++ b/library/Text_Highlighter/javascript.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/mysql.xml b/library/Text_Highlighter/mysql.xml new file mode 100644 index 000000000..082b62795 --- /dev/null +++ b/library/Text_Highlighter/mysql.xml @@ -0,0 +1,424 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/perl.xml b/library/Text_Highlighter/perl.xml new file mode 100644 index 000000000..54f8835ea --- /dev/null +++ b/library/Text_Highlighter/perl.xml @@ -0,0 +1,439 @@ + + + + + + + + + + + This highlighter is EXPERIMENTAL, so that it may work incorrectly. +Most rules were created by Mariusz Jakubowski, and extended by me. +My knowledge of Perl is poor, and Perl syntax seems too +complicated to me. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/php.xml b/library/Text_Highlighter/php.xml new file mode 100644 index 000000000..1b08ea203 --- /dev/null +++ b/library/Text_Highlighter/php.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/python.xml b/library/Text_Highlighter/python.xml new file mode 100644 index 000000000..29e77203c --- /dev/null +++ b/library/Text_Highlighter/python.xml @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/release b/library/Text_Highlighter/release new file mode 100644 index 000000000..66f1fa603 --- /dev/null +++ b/library/Text_Highlighter/release @@ -0,0 +1,4 @@ +#!/bin/sh + +/usr/local/bin/php package.php make +/usr/local/bin/pear package diff --git a/library/Text_Highlighter/ruby.xml b/library/Text_Highlighter/ruby.xml new file mode 100644 index 000000000..599f5af17 --- /dev/null +++ b/library/Text_Highlighter/ruby.xml @@ -0,0 +1,141 @@ + + + + + + + + + + +FIXME: While this construction : s.split /z/i +is valid, regular expression is not recognized as such +(/ folowing an identifier or number is not recognized as +start of RE), making highlighting improper + +%q(a (nested) string) does not get highlighted correctly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/sample.css b/library/Text_Highlighter/sample.css new file mode 100644 index 000000000..b4b38c5fc --- /dev/null +++ b/library/Text_Highlighter/sample.css @@ -0,0 +1,62 @@ +.hl-main ol { + line-height: 1.0; +} +.hl-default { + color: Black; +} +.hl-code { + color: Black; +} +.hl-brackets { + color: Olive; +} +.hl-comment { + color: Purple; +} +.hl-quotes { + color: Darkred; +} +.hl-string { + color: Red; +} +.hl-identifier { + color: Blue; +} +.hl-builtin { + color: Teal; +} +.hl-reserved { + color: Green; +} +.hl-inlinedoc { + color: Blue; +} +.hl-var { + color: Darkblue; +} +.hl-url { + color: Blue; +} +.hl-special { + color: Navy; +} +.hl-number { + color: Maroon; +} +.hl-inlinetags { + color: Blue; +} +.hl-main { + background: #ccc none repeat scroll 0 0; + color: #000; +/* background-color: White; */ +} +.hl-gutter { + background-color: #999999; + color: White +} +.hl-table { + font-family: courier; + font-size: 12px; + border: solid 1px Lightgrey; +} diff --git a/library/Text_Highlighter/sh.xml b/library/Text_Highlighter/sh.xml new file mode 100644 index 000000000..1250de3bc --- /dev/null +++ b/library/Text_Highlighter/sh.xml @@ -0,0 +1,242 @@ + + + + + + + + + + This highlighter is EXPERIMENTAL. It may work incorrectly. + It is a crude hack of the perl syntax, which itself wasn't so good. + But this seems to work OK. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/sql.xml b/library/Text_Highlighter/sql.xml new file mode 100644 index 000000000..19cae49a0 --- /dev/null +++ b/library/Text_Highlighter/sql.xml @@ -0,0 +1,496 @@ + + + + + + + + + + + Based on SQL-99 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/vbscript.xml b/library/Text_Highlighter/vbscript.xml new file mode 100644 index 000000000..09c37ffde --- /dev/null +++ b/library/Text_Highlighter/vbscript.xml @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/Text_Highlighter/xml.xml b/library/Text_Highlighter/xml.xml new file mode 100644 index 000000000..2271ff3ae --- /dev/null +++ b/library/Text_Highlighter/xml.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/view/templates/head.tpl b/view/templates/head.tpl index b4f82aca4..70add44c2 100644 --- a/view/templates/head.tpl +++ b/view/templates/head.tpl @@ -7,6 +7,7 @@ + diff --git a/view/theme/frio/templates/head.tpl b/view/theme/frio/templates/head.tpl index 57148736d..72d7cbf07 100644 --- a/view/theme/frio/templates/head.tpl +++ b/view/theme/frio/templates/head.tpl @@ -12,6 +12,7 @@ + From 8b4c41671372a074750798080d8e2d262552bee4 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 16 Jun 2016 20:16:16 +0200 Subject: [PATCH 04/16] frio: events - split event form in different sections --- include/datetime.php | 6 +- view/theme/frio/templates/event_form.tpl | 189 +++++++++++++++-------- view/theme/frio/templates/event_head.tpl | 45 +++++- 3 files changed, 168 insertions(+), 72 deletions(-) diff --git a/include/datetime.php b/include/datetime.php index bbb60ba72..4b0bbb576 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -273,7 +273,7 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke $minjs = $min ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : ''; $maxjs = $max ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : ''; - $input_text = $default ? 'value="' . date($dateformat, $default->getTimestamp()) . '"' : ''; + $input_text = $default ? date($dateformat, $default->getTimestamp()) : ''; $defaultdatejs = $default ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : ''; $pickers = ''; @@ -283,7 +283,7 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke $extra_js = ''; $pickers .= ",dayOfWeekStart: ".$firstDay.",lang:'".$lang."'"; if($minfrom != '') - $extra_js .= "\$('id_#$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})"; + $extra_js .= "\$('#id_$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})"; if($maxfrom != '') $extra_js .= "\$('#id_$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})"; @@ -296,7 +296,7 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke $tpl = get_markup_template('field_input.tpl'); $o .= replace_macros($tpl,array( - '$field' => array($id, $label, $input_text, '', (($required) ? '*' : ''), 'placeholder="' . $readable_format . '" '), + '$field' => array($id, $label, $input_text, '', (($required) ? '*' : ''), 'placeholder="' . $readable_format . '"'), )); // $o .= "
      "; // $o .= '
      '; diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl index ebe4faa35..3a6161198 100644 --- a/view/theme/frio/templates/event_form.tpl +++ b/view/theme/frio/templates/event_form.tpl @@ -1,84 +1,139 @@

      {{$title}}

      -

      -{{$desc}} -

      +{{* The event edit navigation menu (text input, permissions, preview, filebrowser) *}} +
      - - - - + + + + -{{$s_dsel}} +
      +

      + {{$desc}} +

      -{{$f_dsel}} + {{$s_dsel}} -{{include file="field_checkbox.tpl" field=$nofinish}} + {{$f_dsel}} -{{include file="field_checkbox.tpl" field=$adjust}} + {{include file="field_checkbox.tpl" field=$nofinish}} -{{include file="field_input.tpl" field=$summary}} + {{include file="field_checkbox.tpl" field=$adjust}} -
      -
      {{$d_text}}
      - -
      + + -
    1. - - - -
    2. -
    3. - - - -
    4. -
    5. - - - -
    6. -
    7. - - - -
    8. -
      -
      - -
      {{$l_text}}
      - - -
      - -
      {{$sh_text}}
      -
      - -{{$acl}} - -
      - -
      diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl index e11f93ea7..e0cfceec9 100644 --- a/view/theme/frio/templates/event_head.tpl +++ b/view/theme/frio/templates/event_head.tpl @@ -159,13 +159,17 @@ $("#comment-edit-text-desc").bbco_autocomplete('bbcode'); {{/if}} - $('#event-share-checkbox').change(function() { + $('body').change("#event-share-checkbox", function() { - if ($('#event-share-checkbox').is(':checked')) { + if ($('#event-share-checkbox').is(':checked') && !( $('#event-share-checkbox').attr("disabled"))) { $('#acl-wrapper').show(); + $("a#event-perms-lnk").parent("li").show(); + toggleEventNav("a#event-perms-lnk"); + eventAclActive(); } else { $('#acl-wrapper').hide(); + $("a#event-perms-lnk").parent("li").hide(); } }).trigger('change'); @@ -182,7 +186,44 @@ }).trigger('change'); + // Event nav menu. + $("body").on("click", "#event-nav li a", function(e){ + e.preventDefault(); + toggleEventNav(this); + }); + }); + From c99da380cf3d22f023e7526881d78027f8f41acf Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 10:33:12 +0200 Subject: [PATCH 05/16] frio: events - adapt changes to the templates of the other themes --- mod/events.php | 1 + view/templates/event_form.tpl | 20 +- view/templates/event_head.tpl | 17 +- view/theme/frio/js/modal.js | 2 +- view/theme/frio/templates/event.tpl | 2 +- view/theme/frio/templates/event_form.tpl | 259 +++++++++++--------- view/theme/frio/templates/event_head.tpl | 69 +++++- view/theme/frio/templates/events-js.tpl | 2 +- view/theme/frost/js/theme.js | 4 +- view/theme/frost/templates/event_form.tpl | 20 +- view/theme/quattro/templates/event_form.tpl | 20 +- view/theme/vier/templates/event_form.tpl | 20 +- 12 files changed, 247 insertions(+), 189 deletions(-) diff --git a/mod/events.php b/mod/events.php index f6872a616..778613609 100644 --- a/mod/events.php +++ b/mod/events.php @@ -576,6 +576,7 @@ function events_content(&$a) { '$t_orig' => $t_orig, '$summary' => array('summary', t('Title:'), $t_orig, '', '*'), '$sh_text' => t('Share this event'), + '$share' => array('share', t('Share this event'), $sh_checked, ''), '$sh_checked' => $sh_checked, '$nofinish' => array('nofinish', t('Finish date/time is not known or not relevant'), $n_checked), '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked), diff --git a/view/templates/event_form.tpl b/view/templates/event_form.tpl index 1c065477b..de8de44e8 100644 --- a/view/templates/event_form.tpl +++ b/view/templates/event_form.tpl @@ -12,24 +12,15 @@ -
      {{$s_text}}
      {{$s_dsel}} -
      {{$f_text}}
      {{$f_dsel}} -
      +{{include file="field_checkbox.tpl" field=$nofinish}} -
      {{$n_text}}
      +{{include file="field_checkbox.tpl" field=$adjust}} -
      - -
      {{$a_text}}
      - -
      - -
      {{$t_text}}
      - +{{include file="field_input.tpl" field=$summary}}
      {{$d_text}}
      @@ -41,8 +32,9 @@
      -
      {{$sh_text}}
      -
      +{{if ! $eid}} +{{include file="field_checkbox.tpl" field=$share}} +{{/if}} {{$acl}} diff --git a/view/templates/event_head.tpl b/view/templates/event_head.tpl index de5ad6070..0c015f4bf 100644 --- a/view/templates/event_head.tpl +++ b/view/templates/event_head.tpl @@ -21,6 +21,14 @@ $('#event-edit-preview').val(0); } + // disable the input for the finish date if it is not available + function enableDisableFinishDate() { + if( $('#id_nofinish').is(':checked')) + $('#id_finish_text').prop("disabled", true); + else + $('#id_finish_text').prop("disabled", false); + } + $(document).ready(function() { $('#events-calendar').fullCalendar({ @@ -152,9 +160,9 @@ $("#comment-edit-text-desc").bbco_autocomplete('bbcode'); {{/if}} - $('#event-share-checkbox').change(function() { + $('#id_share').change(function() { - if ($('#event-share-checkbox').is(':checked')) { + if ($('#id_share').is(':checked')) { $('#acl-wrapper').show(); } else { @@ -175,6 +183,11 @@ }).trigger('change'); + // disable the finish time input if the user disable it + $('body').change("#id_nofinish", function() { + enableDisableFinishDate() + }).trigger('change'); + }); diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index f99946019..d27048e2d 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -153,7 +153,7 @@ Dialog._load = function(url) { */ function loadModalTitle() { // clear the text of the title - //$("#modal-title").empty(); + $("#modal-title").empty(); // hide the first element with the class "heading" of the modal body $("#modal-body .heading").first().hide(); diff --git a/view/theme/frio/templates/event.tpl b/view/theme/frio/templates/event.tpl index 380bc7cb1..27965bb59 100644 --- a/view/theme/frio/templates/event.tpl +++ b/view/theme/frio/templates/event.tpl @@ -11,7 +11,7 @@
      {{if $event.item.plink}}{{/if}} - {{if $event.edit}}{{/if}} + {{if $event.edit}}{{/if}}
      diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl index 3a6161198..df97e01ff 100644 --- a/view/theme/frio/templates/event_form.tpl +++ b/view/theme/frio/templates/event_form.tpl @@ -1,139 +1,162 @@ -

      {{$title}}

      +
      +

      {{$title}}

      -{{* The event edit navigation menu (text input, permissions, preview, filebrowser) *}} - + {{* The event edit navigation menu (text input, permissions, preview, filebrowser) *}} + -
      +
      + - - - - + + + + -
      -

      - {{$desc}} -

      +
      +

      + {{$desc}} +

      - {{$s_dsel}} + {{$s_dsel}} - {{$f_dsel}} + {{$f_dsel}} - {{include file="field_checkbox.tpl" field=$nofinish}} + {{include file="field_checkbox.tpl" field=$nofinish}} - {{include file="field_checkbox.tpl" field=$adjust}} + {{include file="field_checkbox.tpl" field=$adjust}} - {{include file="field_input.tpl" field=$summary}} + {{include file="field_input.tpl" field=$summary}} -
      -
      {{$d_text}}
      - - +
      +
      + +
      +
      {{$l_text}}
      + + +
      +
      + + {{if ! $eid}} + {{include file="field_checkbox.tpl" field=$share}} + {{/if}} + +
      + +
      -
      -
      {{$l_text}}
      - - -
      + -
      {{$sh_text}}
      -
      + - - +
      + +
      +
      - - -
      - - - + \ No newline at end of file diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl index e0cfceec9..dc1457a87 100644 --- a/view/theme/frio/templates/event_head.tpl +++ b/view/theme/frio/templates/event_head.tpl @@ -5,16 +5,18 @@ @@ -200,18 +223,19 @@ // the following functions show/hide the specific event-edit content // in dependence of the selected nav function eventAclActive() { - $("#event-edit-wrapper, .modal-body #jot-preview-content, .modal-body #jot-fbrowser-wrapper").hide(); + $("#event-edit-wrapper, #event-preview").hide(); $("#event-acl-wrapper").show(); } - function previewActive() { - $(".modal-body #profile-jot-wrapper, .modal-body #profile-jot-acl-wrapper,.modal-body #jot-fbrowser-wrapper").hide(); - preview_post(); + function eventPreviewActive() { + $("#event-acl-wrapper, #event-edit-wrapper").hide(); + $("#event-preview").show(); + doEventPreview(); } function eventEditActive() { - $("#event-acl-wrapper, .modal-body #jot-preview-content, .modal-body #jot-fbrowser-wrapper").hide(); + $("#event-acl-wrapper, #event-preview").hide(); $("#event-edit-wrapper").show(); //make sure jot text does have really the active class (we do this because there are some @@ -226,4 +250,25 @@ // add the active class to the parent of the link which was selected $(elm).parent("li").addClass("active"); } + + // this function load the content of the edit url into a modal + function eventEdit(url) { + var char = qOrAmp(url); + url = url + char + 'mode=none'; + + $.get(url, function(data) { + $("#modal-body").empty(); + $("#modal-body").append(data); + }).done(function() { + loadModalTitle(); + }); + } + + // disable the input for the finish date if it is not available + function enableDisableFinishDate() { + if( $('#id_nofinish').is(':checked')) + $('#id_finish_text').prop("disabled", true); + else + $('#id_finish_text').prop("disabled", false); + } diff --git a/view/theme/frio/templates/events-js.tpl b/view/theme/frio/templates/events-js.tpl index 93c131b36..dcd522c58 100644 --- a/view/theme/frio/templates/events-js.tpl +++ b/view/theme/frio/templates/events-js.tpl @@ -1,7 +1,7 @@
      {{$tabs}} {{include file="section_title.tpl" title=$title}} - +
      diff --git a/view/theme/frost/js/theme.js b/view/theme/frost/js/theme.js index fc1bb643c..038f83e0e 100644 --- a/view/theme/frost/js/theme.js +++ b/view/theme/frost/js/theme.js @@ -70,9 +70,9 @@ $(document).ready(function() { return false; });*/ - $('#event-share-checkbox').change(function() { + $('#id_share').change(function() { - if ($('#event-share-checkbox').is(':checked')) { + if ($('#id_share').is(':checked')) { $('#acl-wrapper').show(); } else { diff --git a/view/theme/frost/templates/event_form.tpl b/view/theme/frost/templates/event_form.tpl index 43f2a782f..27631d9f7 100644 --- a/view/theme/frost/templates/event_form.tpl +++ b/view/theme/frost/templates/event_form.tpl @@ -12,24 +12,15 @@ -
      {{$s_text}}
      {{$s_dsel}} -
      {{$f_text}}
      {{$f_dsel}} -
      +{{include file="field_checkbox.tpl" field=$nofinish}} -
      {{$n_text}}
      +{{include file="field_checkbox.tpl" field=$adjust}} -
      - -
      {{$a_text}}
      - -
      - -
      {{$t_text}}
      - +{{include file="field_input.tpl" field=$summary}}
      {{$d_text}}
      @@ -40,8 +31,9 @@
      -
      {{$sh_text}}
      -
      +{{if ! $eid}} +{{include file="field_checkbox.tpl" field=$share}} +{{/if}} {{$acl}} diff --git a/view/theme/quattro/templates/event_form.tpl b/view/theme/quattro/templates/event_form.tpl index 098b57850..484fe6744 100644 --- a/view/theme/quattro/templates/event_form.tpl +++ b/view/theme/quattro/templates/event_form.tpl @@ -10,23 +10,23 @@ - {{include file="field_custom.tpl" field=array('start_text', $s_text, $s_dsel, "")}} - {{include file="field_custom.tpl" field=array('finish_text', $f_text, $f_dsel, "")}} + {{$s_dsel}} - {{include file="field_checkbox.tpl" field=array('nofinish', $n_text, $n_checked, "")}} - {{include file="field_checkbox.tpl" field=array('adjust', $a_text, $a_checked, "")}} + {{$f_dsel}} + + {{include file="field_checkbox.tpl" field=$nofinish}} + + {{include file="field_checkbox.tpl" field=$adjust}}
      - {{include file="field_input.tpl" field=array('summary', $t_text, $t_orig, "")}} + {{include file="field_input.tpl" field=$summary}} {{include file="field_textarea.tpl" field=array('desc', $d_text, $d_orig, "")}} {{include file="field_textarea.tpl" field=array('location', $l_text, $l_orig, "")}}
      -
      - - - -
      + {{if ! $eid}} + {{include file="field_checkbox.tpl" field=$share}} + {{/if}} {{$acl}} diff --git a/view/theme/vier/templates/event_form.tpl b/view/theme/vier/templates/event_form.tpl index 4f3240de8..0507c36aa 100644 --- a/view/theme/vier/templates/event_form.tpl +++ b/view/theme/vier/templates/event_form.tpl @@ -13,24 +13,15 @@ -
      {{$s_text}}
      {{$s_dsel}} -
      {{$f_text}}
      {{$f_dsel}} -
      +{{include file="field_checkbox.tpl" field=$nofinish}} -
      {{$n_text}}
      +{{include file="field_checkbox.tpl" field=$adjust}} -
      - -
      {{$a_text}}
      - -
      - -
      {{$t_text}}
      - +{{include file="field_input.tpl" field=$summary}}
      {{$d_text}}
      @@ -61,8 +52,9 @@
      -
      {{$sh_text}}
      -
      +{{if ! $eid}} +{{include file="field_checkbox.tpl" field=$share}} +{{/if}} {{$acl}} From 2f266382c5c096eacd3127786fc8126f4ee8d4a1 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 11:02:27 +0200 Subject: [PATCH 06/16] code highlight - add docu --- doc/BBCode.md | 6 ++++++ doc/de/BBCode.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/doc/BBCode.md b/doc/BBCode.md index 186b1cda9..d22f7afa5 100644 --- a/doc/BBCode.md +++ b/doc/BBCode.md @@ -42,6 +42,12 @@ Block

       

      +
      [code=php]function text_highlight($s,$lang)[/code]
      + +
      1.  function text_highlight($s,$lang)
      + +

       

      +
      [quote]quote[/quote]
      quote
      diff --git a/doc/de/BBCode.md b/doc/de/BBCode.md index cd9fa7673..d852a4a4f 100644 --- a/doc/de/BBCode.md +++ b/doc/de/BBCode.md @@ -42,6 +42,12 @@ Block Tags

       

      +
      [code=php]function text_highlight($s,$lang)[/code]
      + +
      1.  function text_highlight($s,$lang)
      + +

       

      +
      [quote]Zitat[/quote]
      Zitat
      From 0148d0e5d2676d174305930110850ce74f2fa474 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 11:18:54 +0200 Subject: [PATCH 07/16] frio - event - correct some js --- view/templates/event_head.tpl | 2 +- view/theme/frio/templates/event_head.tpl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/view/templates/event_head.tpl b/view/templates/event_head.tpl index 0c015f4bf..01c69b8b3 100644 --- a/view/templates/event_head.tpl +++ b/view/templates/event_head.tpl @@ -184,7 +184,7 @@ }).trigger('change'); // disable the finish time input if the user disable it - $('body').change("#id_nofinish", function() { + $('#id_nofinish').change(function() { enableDisableFinishDate() }).trigger('change'); diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl index dc1457a87..ee60f183e 100644 --- a/view/theme/frio/templates/event_head.tpl +++ b/view/theme/frio/templates/event_head.tpl @@ -163,7 +163,7 @@ {{/if}} // go to the permissions tab if the checkbox is checked - $('body').change("#id_share", function() { + $('body').on("change", "#id_share", function() { if ($('#id_share').is(':checked') && !( $('#id_share').attr("disabled"))) { $('#acl-wrapper').show(); @@ -178,7 +178,7 @@ }).trigger('change'); // disable the finish time input if the user disable it - $('body').change("#id_nofinish", function() { + $('body').on("change", "#id_nofinish", function() { enableDisableFinishDate() }).trigger('change'); From 606f42701ccd545a04fdf0b2a6bea3bce2ee9dd0 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 14:09:18 +0200 Subject: [PATCH 08/16] frio - event - some js and template refactoring + event view css styling --- mod/events.php | 6 +- view/theme/frio/css/style.css | 20 ++++ view/theme/frio/js/event.js | 124 +++++++++++++++++++++++ view/theme/frio/templates/event.tpl | 19 ++-- view/theme/frio/templates/event_form.tpl | 47 +++++---- view/theme/frio/templates/event_head.tpl | 119 ---------------------- view/theme/frio/templates/events-js.tpl | 2 +- 7 files changed, 187 insertions(+), 150 deletions(-) create mode 100644 view/theme/frio/js/event.js diff --git a/mod/events.php b/mod/events.php index 778613609..e4526ac59 100644 --- a/mod/events.php +++ b/mod/events.php @@ -455,6 +455,7 @@ function events_content(&$a) { '$baseurl' => $a->get_baseurl(), '$tabs' => $tabs, '$title' => t('Events'), + '$view' => t('View'), '$new_event'=> array($a->get_baseurl().'/events/new',t('Create New Event'),'',''), '$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''), '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''), @@ -462,7 +463,6 @@ function events_content(&$a) { '$events' => $events, - // eignene "today" => t("today"), "month" => t("month"), "week" => t("week"), @@ -582,7 +582,9 @@ function events_content(&$a) { '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked), '$preview' => t('Preview'), '$acl' => $acl, - '$submit' => t('Submit') + '$submit' => t('Submit'), + '$basic' => t("Basic"), + '$advanced' => t("Advanced") )); diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 185888b71..deb3436de 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -1954,15 +1954,35 @@ td.fc-day { .event-wrapper .event-owner { margin-bottom: 15px; } +.event-wrapper .event-owner img { + display: block; +} .event-owner img { margin-right: 5px; height: 48px; width: 48; border-radius: 3px; } +.event-wrapper .vevent { + margin-left: 0; + margin-right: 0; + box-shadow: 1.5px 0 0 0 rgba(0, 0, 0, .1) inset; +} .event-wrapper .event-buttons { margin-top: 15px; } +#event-form-wrapper { + padding-top: 5px; +} +#event-edit-form-wrapper { + padding-top: 15px; +} +#event-nav a { + color: #555; +} +#event-edit-form-wrapper #event-edit-time { + padding: 10px 0; +} /* * Overwriting for transparency and other colors */ diff --git a/view/theme/frio/js/event.js b/view/theme/frio/js/event.js new file mode 100644 index 000000000..c6a3541f6 --- /dev/null +++ b/view/theme/frio/js/event.js @@ -0,0 +1,124 @@ +$(document).ready(function() { + // go to the permissions tab if the checkbox is checked + $('body').on("change", "#id_share", function() { + + if ($('#id_share').is(':checked') && !( $('#id_share').attr("disabled"))) { + $('#acl-wrapper').show(); + $("a#event-perms-lnk").parent("li").show(); + toggleEventNav("a#event-perms-lnk"); + eventAclActive(); + } + else { + $('#acl-wrapper').hide(); + $("a#event-perms-lnk").parent("li").hide(); + } + }).trigger('change'); + + // disable the finish time input if the user disable it + $('body').on("change", "#id_nofinish", function() { + enableDisableFinishDate() + }).trigger('change'); + + // js for the permission sextion + $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() { + var selstr; + $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() { + selstr = $(this).text(); + $('#jot-public').hide(); + }); + if(selstr == null) { + $('#jot-public').show(); + } + + }).trigger('change'); + + // Change the event nav menu.tabs on click + $("body").on("click", "#event-nav > li > a", function(e){ + e.preventDefault(); + toggleEventNav(this); + }); + + // this is experimental. We maybe can make use of it to inject + // some js code while the event modal opens + //$('body').on('show.bs.modal', function () { + // enableDisableFinishDate(); + //}); + + // clear some elements (e.g. the event-preview container) when + // selecting a event nav link so it don't appear more than once + $('body').on("click", "#event-nav a", function(e) { + $("#event-preview").empty(); + e.preventDefault(); + }); + +}); + +// Load the html of the actual event and incect the output to the +// event-edit section +function doEventPreview() { + $('#event-edit-preview').val(1); + $.post('events',$('#event-edit-form').serialize(), function(data) { + $("#event-preview").append(data); + }); + $('#event-edit-preview').val(0); +} + + +// this function load the content of the edit url into a modal +function eventEdit(url) { + var char = qOrAmp(url); + url = url + char + 'mode=none'; + + $.get(url, function(data) { + $("#modal-body").empty(); + $("#modal-body").append(data); + }).done(function() { + loadModalTitle(); + }); +} + +// the following functions show/hide the specific event-edit content +// in dependence of the selected nav +function eventAclActive() { + $("#event-edit-wrapper, #event-preview, #event-desc-wrapper").hide(); + $("#event-acl-wrapper").show(); +} + + +function eventPreviewActive() { + $("#event-acl-wrapper, #event-edit-wrapper, #event-desc-wrapper").hide(); + $("#event-preview").show(); + doEventPreview(); +} + +function eventEditActive() { + $("#event-acl-wrapper, #event-preview, #event-desc-wrapper").hide(); + $("#event-edit-wrapper").show(); + + //make sure jot text does have really the active class (we do this because there are some + // other events which trigger jot text + toggleEventNav($("#event-edit-lnk")); +} + +function eventDescActive() { + $("#event-edit-wrapper, #event-preview, #event-acl-wrapper").hide(); + $("#event-desc-wrapper").show(); +} + +// Give the active "event-nav" list element the class "active" +function toggleEventNav (elm) { + // select all li of #event-nav and remove the active class + $(elm).closest("#event-nav").children("li").removeClass("active"); + // add the active class to the parent of the link which was selected + $(elm).parent("li").addClass("active"); +} + + + +// disable the input for the finish date if it is not available +function enableDisableFinishDate() { + if( $('#id_nofinish').is(':checked')) + $('#id_finish_text').prop("disabled", true); + else + $('#id_finish_text').prop("disabled", false); +} diff --git a/view/theme/frio/templates/event.tpl b/view/theme/frio/templates/event.tpl index 27965bb59..32e740581 100644 --- a/view/theme/frio/templates/event.tpl +++ b/view/theme/frio/templates/event.tpl @@ -1,16 +1,23 @@ + {{foreach $events as $event}}
      -
      - {{if $event.item.author_name}} - {{$event.item.author_name}} - {{/if}} +
      +
      + {{if $event.item.author_name}} + + {{$event.item.author_name}} + {{/if}} +
      +
      + {{$event.html}} +
      - {{$event.html}}
      - {{if $event.item.plink}}{{/if}} + {{if $event.item.plink}}{{/if}} {{if $event.edit}}{{/if}}
      diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl index df97e01ff..6ccce703b 100644 --- a/view/theme/frio/templates/event_form.tpl +++ b/view/theme/frio/templates/event_form.tpl @@ -1,4 +1,5 @@ - +

      {{$title}}

      @@ -6,7 +7,8 @@
      - - {{if ! $eid}} - {{include file="field_checkbox.tpl" field=$share}} - {{/if}} - -
      - -
      -
      From d0900c5389dc2b0a753d7d022928f569951b81e2 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 14:35:24 +0200 Subject: [PATCH 10/16] Merge develop into 1206-events-template - restore gitignore --- .gitignore | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.gitignore b/.gitignore index 77151060d..b300f579e 100644 --- a/.gitignore +++ b/.gitignore @@ -42,16 +42,3 @@ nbproject #ignore local folder /local/ - -#other stuff -.directory -.gitignore - -/view/theme/Friendiboot -/view/theme/Viereinhalb -/view/theme/blog -/view/theme/boheme -/view/theme/clean -/view/theme/suckerberg - -/addon/frio_hovercard From 134d5949d5d1ddb3c03c5f6aa294edf73b027350 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 14:39:59 +0200 Subject: [PATCH 11/16] frio - events - restore lost css bracket after merging develop branch --- view/theme/frio/css/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index eda0b3d71..edc4a55a7 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -2040,6 +2040,7 @@ td.fc-day { } #event-edit-form-wrapper #event-edit-time { padding: 10px 0; +} /* Profiles Page */ .profile-listing-table { display: table; From 48a77af49d51a203b95e6fb07fcb5a78d40bee1b Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 14:52:42 +0200 Subject: [PATCH 12/16] frio - events - delete unneeded css --- view/theme/frio/css/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index edc4a55a7..bfce21a65 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -1769,8 +1769,8 @@ ul.dropdown-menu li:hover { .contacts-content-wrapper, .suggest-content-wrapper, .common-content-wrapper, .allfriends-content-wrapper, .match-content-wrapper, .dirfind-content-wrapper, .directory-content-wrapper, .manage-content-wrapper, .notes-content-wrapper, -.events-content-wrapper, .message-content-wrapper, .apps-content-wrapper, -.notifications-content-wrapper, .admin-content-wrapper, .group-content-wrapper { +.message-content-wrapper, .apps-content-wrapper, .notifications-content-wrapper, +.admin-content-wrapper, .group-content-wrapper { min-height: calc(100vh - 150px); padding: 15px; padding-bottom: 20px; From b977efc95ca923ccd1a8f6928ba65b40d366e0e2 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 17 Jun 2016 15:29:01 +0200 Subject: [PATCH 13/16] code highlight - some spacing for readability --- include/text.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/include/text.php b/include/text.php index 16c0845ac..9b34b0884 100644 --- a/include/text.php +++ b/include/text.php @@ -2097,33 +2097,44 @@ function format_network_name($network, $url = 0) { function text_highlight($s,$lang) { if($lang === 'js') $lang = 'javascript'; + if(! strpos('Text_Highlighter',get_include_path())) { set_include_path(get_include_path() . PATH_SEPARATOR . 'library/Text_Highlighter'); } + require_once('library/Text_Highlighter/Text/Highlighter.php'); require_once('library/Text_Highlighter/Text/Highlighter/Renderer/Html.php'); $options = array( 'numbers' => HL_NUMBERS_LI, 'tabsize' => 4, ); + $tag_added = false; $s = trim(html_entity_decode($s,ENT_COMPAT)); $s = str_replace(" ","\t",$s); + + // The highlighter library insists on an opening php tag for php code blocks. If + // it isn't present, nothing is highlighted. So we're going to see if it's present. + // If not, we'll add it, and then quietly remove it after we get the processed output back. + if($lang === 'php') { if(strpos('setRenderer($renderer); - $o = $hl->highlight($s); - $o = str_replace([" ","\n"],["    ",''],$o); - if($tag_added) { - $b = substr($o,0,strpos($o,'
    9. ')); - $e = substr($o,strpos($o,'
    10. ')); - $o = $b . $e; - } + $o = $hl->highlight($s); + $o = str_replace([" ","\n"],["    ",''],$o); + + if($tag_added) { + $b = substr($o,0,strpos($o,'
    11. ')); + $e = substr($o,strpos($o,'
    12. ')); + $o = $b . $e; + } + return('' . $o . ''); } From 22de27327c030a8f494348c52bef3f6a4f85b0fc Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Sat, 18 Jun 2016 08:16:09 -0400 Subject: [PATCH 14/16] recreate fix for #2617 on correct branch --- .htaccess | 9 ++++++++- util/.htaccess | 11 +++++++++-- view/.htaccess | 11 +++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.htaccess b/.htaccess index 1b63f9ad6..2348cdc38 100644 --- a/.htaccess +++ b/.htaccess @@ -4,7 +4,14 @@ AddType audio/ogg .oga #AddHandler php53-cgi .php -Deny from all + + #Apache 2.4 + Require all denied + + + #Apache 2.2 + Deny from all + diff --git a/util/.htaccess b/util/.htaccess index b311c14c2..7b1f94f0e 100644 --- a/util/.htaccess +++ b/util/.htaccess @@ -1,5 +1,12 @@ Options -Indexes -# Remove the following line or modify it to run the string translator utility -Deny from all +# Remove the following lines or modify it to run the string translator utility + + #Apache 2.4 + Require all denied + + + #Apache 2.2 + Deny from all + diff --git a/view/.htaccess b/view/.htaccess index 559a5fcc0..04cd54685 100644 --- a/view/.htaccess +++ b/view/.htaccess @@ -1,3 +1,10 @@ -Deny from all - \ No newline at end of file + + #Apache 2.4 + Require all denied + + + #Apache 2.2 + Deny from all + + From ee0942b96d9b9054d29eb5492bc910e74bc92ff9 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sat, 18 Jun 2016 15:23:35 +0200 Subject: [PATCH 15/16] frio - events - fix double click on date --- view/theme/frio/templates/event_head.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl index a44fd30be..3e7dfc1c5 100644 --- a/view/theme/frio/templates/event_head.tpl +++ b/view/theme/frio/templates/event_head.tpl @@ -45,7 +45,7 @@ }, loading: function(isLoading, view) { if(!isLoading) { - $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); }); + $('td.fc-day').dblclick(function() { addToModal('/events/new?start='+$(this).data('date')); }); } }, From 7495a34b32fdf1ea08bd2eaa378b216345077f7f Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sun, 19 Jun 2016 22:04:34 +0200 Subject: [PATCH 16/16] implement a public calendar for vistors of someones profile page --- include/event.php | 187 ++++++++++++ include/identity.php | 18 +- mod/cal.php | 279 ++++++++++++++++++ mod/events.php | 147 ++------- view/templates/event_head.tpl | 12 +- view/theme/frio/templates/event_head.tpl | 14 +- view/theme/frost-mobile/js/theme.js | 10 +- .../frost-mobile/templates/event_head.tpl | 2 + view/theme/frost/js/theme.js | 12 +- view/theme/frost/templates/event_head.tpl | 2 + 10 files changed, 542 insertions(+), 141 deletions(-) create mode 100644 mod/cal.php diff --git a/include/event.php b/include/event.php index c5e5ff18d..df9b95857 100644 --- a/include/event.php +++ b/include/event.php @@ -1,7 +1,12 @@ $firstDay, + "Sun" => t("Sun"), + "Mon" => t("Mon"), + "Tue" => t("Tue"), + "Wed" => t("Wed"), + "Thu" => t("Thu"), + "Fri" => t("Fri"), + "Sat" => t("Sat"), + "Sunday" => t("Sunday"), + "Monday" => t("Monday"), + "Tuesday" => t("Tuesday"), + "Wednesday" => t("Wednesday"), + "Thursday" => t("Thursday"), + "Friday" => t("Friday"), + "Saturday" => t("Saturday"), + "Jan" => t("Jan"), + "Feb" => t("Feb"), + "Mar" => t("Mar"), + "Apr" => t("Apr"), + "May" => t("May"), + "Jun" => t("Jun"), + "Jul" => t("Jul"), + "Aug" => t("Aug"), + "Sep" => t("Sept"), + "Oct" => t("Oct"), + "Nov" => t("Nov"), + "Dec" => t("Dec"), + "January" => t("January"), + "February" => t("February"), + "March" => t("March"), + "April" => t("April"), + "May" => t("May"), + "June" => t("June"), + "July" => t("July"), + "August" => t("August"), + "September" => t("September"), + "October" => t("October"), + "November" => t("November"), + "December" => t("December"), + "today" => t("today"), + "month" => t("month"), + "week" => t("week"), + "day" => t("day"), + ); + + return $i18n; +} + +/** + * @brief Get an event by its event ID + * + * @param type $owner_uid The User ID of the owner of the event + * @param type $event_params An assoziative array with + * int 'event_id' => The ID of the event in the event table + * @param type $sql_extra + * @return array Query result + */ +function event_by_id($owner_uid = 0, $event_params, $sql_extra = '') { + // ownly allow events if there is a valid owner_id + if($owner_uid == 0) + return; + + // query for the event by event id + $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`, + `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` + LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` AND `item`.`uid` = `event`.`uid` + WHERE `event`.`uid` = %d AND `event`.`id` = %d $sql_extra", + intval($owner_uid), + intval($event_params["event_id"]) + ); + + if(count($r)) + return $r; + +} + +/** + * @brief Get all events in a specific timeframe + * + * @param int $owner_uid The User ID of the owner of the events + * @param array $event_params An assoziative array with + * int 'ignored' => + * string 'start' => Start time of the timeframe + * string 'finish' => Finish time of the timeframe + * string 'adjust_start' => + * string 'adjust_start' => + * + * @param string $sql_extra Additional sql conditions (e.g. permission request) + * @return array Query results + */ +function events_by_date($owner_uid = 0, $event_params, $sql_extra = '') { + // ownly allow events if there is a valid owner_id + if($owner_uid == 0) + return; + + // query for the event by date + $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`, + `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` + LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` AND `item`.`uid` = `event`.`uid` + WHERE `event`.`uid` = %d AND event.ignore = %d + AND ((`adjust` = 0 AND (`finish` >= '%s' OR (nofinish AND start >= '%s')) AND `start` <= '%s') + OR (`adjust` = 1 AND (`finish` >= '%s' OR (nofinish AND start >= '%s')) AND `start` <= '%s')) + $sql_extra ", + intval($owner_uid), + intval($event_params["ignored"]), + dbesc($event_params["start"]), + dbesc($event_params["start"]), + dbesc($event_params["finish"]), + dbesc($event_params["adjust_start"]), + dbesc($event_params["adjust_start"]), + dbesc($event_params["adjust_finish"]) + ); + + if(count($r)) + return $r; +} + +/** + * @brief Convert an array query results in an arry which could be used by the events template + * + * @param array $arr Event query array + * @return array Event array for the template + */ +function process_events ($arr) { + $events=array(); + + $last_date = ''; + $fmt = t('l, F j'); + if (count($arr)) { + foreach($arr as $rr) { + + $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); + $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt)); + $d = day_translate($d); + + $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c')); + if ($rr['nofinish']){ + $end = null; + } else { + $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c')); + } + + + $is_first = ($d !== $last_date); + + $last_date = $d; + $edit = ((! $rr['cid']) ? array(App::get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null); + $title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8')); + if(! $title) { + list($title, $_trash) = explode("$rr['id'], + 'start'=> $start, + 'end' => $end, + 'allDay' => false, + 'title' => $title, + + 'j' => $j, + 'd' => $d, + 'is_first'=>$is_first, + 'item'=>$rr, + 'html'=>$html, + 'plink' => array($rr['plink'],t('link to source'),'',''), + ); + } + } + + return $events; +} diff --git a/include/identity.php b/include/identity.php index 48a6c5bbf..136452e78 100644 --- a/include/identity.php +++ b/include/identity.php @@ -740,8 +740,8 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){ ), ); - if ($is_owner){ - if ($a->theme_events_in_profile) + // the calendar link for the full featured events calendar + if ($is_owner && $a->theme_events_in_profile) { $tabs[] = array( 'label' => t('Events'), 'url' => $a->get_baseurl() . '/events', @@ -750,6 +750,20 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){ 'id' => 'events-tab', 'accesskey' => 'e', ); + // if the user is not the owner of the calendar we only show a calendar + // with the public events of the calendar owner + } elseif (! $is_owner) { + $tabs[] = array( + 'label' => t('Events'), + 'url' => $a->get_baseurl() . '/cal/' . $nickname, + 'sel' =>((!isset($tab)&&$a->argv[0]=='cal')?'active':''), + 'title' => t('Events and Calendar'), + 'id' => 'events-tab', + 'accesskey' => 'e', + ); + } + + if ($is_owner){ $tabs[] = array( 'label' => t('Personal Notes'), 'url' => $a->get_baseurl() . '/notes', diff --git a/mod/cal.php b/mod/cal.php new file mode 100644 index 000000000..0cde2a6ec --- /dev/null +++ b/mod/cal.php @@ -0,0 +1,279 @@ +argc > 1) + auto_redir($a, $a->argv[1]); + + if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { + return; + } + + nav_set_selected('events'); + + $o = ''; + + if($a->argc > 1) { + $nick = $a->argv[1]; + $user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1", + dbesc($nick) + ); + + if(! count($user)) + return; + + $a->data['user'] = $user[0]; + $a->profile_uid = $user[0]['uid']; + + $profile = get_profiledata_by_nick($nick, $a->profile_uid); + + if((intval($profile['page-flags']) == PAGE_COMMUNITY) || (intval($profile['page-flags']) == PAGE_PRVGROUP)) + $account_type = t('Forum'); + else + $account_type = ""; + + $tpl = get_markup_template("vcard-widget.tpl"); + + $vcard_widget .= replace_macros($tpl, array( + '$name' => $profile['name'], + '$photo' => $profile['photo'], + '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ""), + '$account_type' => $account_type, + '$pdesc' => (($profile['pdesc'] != "") ? $profile['pdesc'] : ""), + )); + + if(! x($a->page,'aside')) + $a->page['aside'] = ''; + + $a->page['aside'] .= $vcard_widget; + } + + return; +} + +function cal_content(&$a) { + nav_set_selected('events'); + + $editselect = 'none'; + if( feature_enabled(local_user(), 'richtext') ) + $editselect = 'textareas'; + + // First day of the week (0 = Sunday) + $firstDay = get_pconfig(local_user(),'system','first_day_of_week'); + if ($firstDay === false) $firstDay=0; + + // get the translation strings for the callendar + $i18n = get_event_strings(); + + $htpl = get_markup_template('event_head.tpl'); + $a->page['htmlhead'] .= replace_macros($htpl,array( + '$baseurl' => $a->get_baseurl(), + '$module_url' => '/cal/' . $a->data['user']['nickname'], + '$modparams' => 2, + '$i18n' => $i18n, + '$editselect' => $editselect + )); + + $etpl = get_markup_template('event_end.tpl'); + $a->page['end'] .= replace_macros($etpl,array( + '$baseurl' => $a->get_baseurl(), + '$editselect' => $editselect + )); + + $o =""; + + $mode = 'view'; + $y = 0; + $m = 0; + $ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0); + + // + // Setup permissions structures + // + + $contact = null; + $remote_contact = false; + $contact_id = 0; + + $owner_uid = $a->data['user']['uid']; + + if(is_array($_SESSION['remote'])) { + foreach($_SESSION['remote'] as $v) { + if($v['uid'] == $a->profile['profile_uid']) { + $contact_id = $v['cid']; + break; + } + } + } + if($contact_id) { + $groups = init_groups_visitor($contact_id); + $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + intval($contact_id), + intval($a->profile['profile_uid']) + ); + if(count($r)) { + $contact = $r[0]; + $remote_contact = true; + } + } + if(! $remote_contact) { + if(local_user()) { + $contact_id = $_SESSION['cid']; + $contact = $a->contact; + } + } + $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false); + + if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) { + notice( t('Access to this profile has been restricted.') . EOL); + return; + } + + $sql_extra = item_permissions_sql($owner_uid,$remote_contact,$groups); + + // get the tab navigation bar + $tabs .= profile_tabs($a,false, $a->data['user']['nickname']); + + // The view mode part is similiar to /mod/events.php + if($mode == 'view') { + + + $thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y'); + $thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m'); + if(! $y) + $y = intval($thisyear); + if(! $m) + $m = intval($thismonth); + + // Put some limits on dates. The PHP date functions don't seem to do so well before 1900. + // An upper limit was chosen to keep search engines from exploring links millions of years in the future. + + if($y < 1901) + $y = 1900; + if($y > 2099) + $y = 2100; + + $nextyear = $y; + $nextmonth = $m + 1; + if($nextmonth > 12) { + $nextmonth = 1; + $nextyear ++; + } + + $prevyear = $y; + if($m > 1) + $prevmonth = $m - 1; + else { + $prevmonth = 12; + $prevyear --; + } + + $dim = get_dim($y,$m); + $start = sprintf('%d-%d-%d %d:%d:%d',$y,$m,1,0,0,0); + $finish = sprintf('%d-%d-%d %d:%d:%d',$y,$m,$dim,23,59,59); + + + if ($a->argv[2] === 'json'){ + if (x($_GET,'start')) $start = date("Y-m-d h:i:s", $_GET['start']); + if (x($_GET,'end')) $finish = date("Y-m-d h:i:s", $_GET['end']); + } + + $start = datetime_convert('UTC','UTC',$start); + $finish = datetime_convert('UTC','UTC',$finish); + + $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start); + $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish); + + // put the event parametes in an array so we can better transmit them + $event_params = array( + 'event_id' => (x($_GET,'id') ? $_GET["id"] : 0), + 'start' => $start, + 'finish' => $finish, + 'adjust_start' => $adjust_start, + 'adjust_finish' => $adjust_finish, + 'ignored' => $ignored, + ); + + // get events by id or by date + if (x($_GET,'id')){ + $r = event_by_id($owner_uid, $event_params, $sql_extra); + } else { + $r = events_by_date($owner_uid, $event_params, $sql_extra); + } + + $links = array(); + + if(count($r)) { + $r = sort_by_date($r); + foreach($r as $rr) { + $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); + if(! x($links,$j)) + $links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j; + } + } + + + $events=array(); + + // transform the event in a usable array + if(count($r)) + $r = sort_by_date($r); + $events = process_events($r); + + if ($a->argv[2] === 'json'){ + echo json_encode($events); killme(); + } + + // links: array('href', 'text', 'extra css classes', 'title') + if (x($_GET,'id')){ + $tpl = get_markup_template("event.tpl"); + } else { +// if (get_config('experimentals','new_calendar')==1){ + $tpl = get_markup_template("events-js.tpl"); +// } else { +// $tpl = get_markup_template("events.tpl"); +// } + } + + // Get rid of dashes in key names, Smarty3 can't handle them + foreach($events as $key => $event) { + $event_item = array(); + foreach($event['item'] as $k => $v) { + $k = str_replace('-','_',$k); + $event_item[$k] = $v; + } + $events[$key]['item'] = $event_item; + } + + $o = replace_macros($tpl, array( + '$baseurl' => $a->get_baseurl(), + '$tabs' => $tabs, + '$title' => t('Events'), + '$view' => t('View'), + '$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''), + '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''), + '$calendar' => cal($y,$m,$links, ' eventcal'), + + '$events' => $events, + + "today" => t("today"), + "month" => t("month"), + "week" => t("week"), + "day" => t("day"), + + + )); + + if (x($_GET,'id')){ echo $o; killme(); } + + return $o; + } +} diff --git a/mod/events.php b/mod/events.php index e4526ac59..617627ac4 100644 --- a/mod/events.php +++ b/mod/events.php @@ -1,5 +1,8 @@ $firstDay, - "Sun" => t("Sun"), - "Mon" => t("Mon"), - "Tue" => t("Tue"), - "Wed" => t("Wed"), - "Thu" => t("Thu"), - "Fri" => t("Fri"), - "Sat" => t("Sat"), - "Sunday" => t("Sunday"), - "Monday" => t("Monday"), - "Tuesday" => t("Tuesday"), - "Wednesday" => t("Wednesday"), - "Thursday" => t("Thursday"), - "Friday" => t("Friday"), - "Saturday" => t("Saturday"), - "Jan" => t("Jan"), - "Feb" => t("Feb"), - "Mar" => t("Mar"), - "Apr" => t("Apr"), - "May" => t("May"), - "Jun" => t("Jun"), - "Jul" => t("Jul"), - "Aug" => t("Aug"), - "Sep" => t("Sept"), - "Oct" => t("Oct"), - "Nov" => t("Nov"), - "Dec" => t("Dec"), - "January" => t("January"), - "February" => t("February"), - "March" => t("March"), - "April" => t("April"), - "May" => t("May"), - "June" => t("June"), - "July" => t("July"), - "August" => t("August"), - "September" => t("September"), - "October" => t("October"), - "November" => t("November"), - "December" => t("December"), - "today" => t("today"), - "month" => t("month"), - "week" => t("week"), - "day" => t("day"), - ); + // get the translation strings for the callendar + $i18n = get_event_strings(); $htpl = get_markup_template('event_head.tpl'); $a->page['htmlhead'] .= replace_macros($htpl,array( '$baseurl' => $a->get_baseurl(), + '$module_url' => '/events', + '$modparams' => 1, '$i18n' => $i18n, '$editselect' => $editselect )); @@ -284,6 +242,7 @@ function events_content(&$a) { } } + // The view mode part is similiar to /mod/cal.php if($mode == 'view') { @@ -333,31 +292,21 @@ function events_content(&$a) { $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start); $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish); + // put the event parametes in an array so we can better transmit them + $event_params = array( + 'event_id' => (x($_GET,'id') ? $_GET["id"] : 0), + 'start' => $start, + 'finish' => $finish, + 'adjust_start' => $adjust_start, + 'adjust_finish' => $adjust_finish, + 'ignored' => $ignored, + ); + // get events by id or by date if (x($_GET,'id')){ - $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`, - `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` - LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` AND `item`.`uid` = `event`.`uid` - WHERE `event`.`uid` = %d AND `event`.`id` = %d", - intval(local_user()), - intval($_GET['id']) - ); + $r = event_by_id(local_user(), $event_params); } else { - $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`, - `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` - LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` AND `item`.`uid` = `event`.`uid` - WHERE `event`.`uid` = %d and event.ignore = %d - AND ((`adjust` = 0 AND (`finish` >= '%s' OR (nofinish AND start >= '%s')) AND `start` <= '%s') - OR (`adjust` = 1 AND (`finish` >= '%s' OR (nofinish AND start >= '%s')) AND `start` <= '%s')) ", - intval(local_user()), - intval($ignored), - dbesc($start), - dbesc($start), - dbesc($finish), - dbesc($adjust_start), - dbesc($adjust_start), - dbesc($adjust_finish) - ); + $r = events_by_date(local_user(), $event_params); } $links = array(); @@ -371,60 +320,12 @@ function events_content(&$a) { } } - $events=array(); - $last_date = ''; - $fmt = t('l, F j'); - - if(count($r)) { + // transform the event in a usable array + if(count($r)) $r = sort_by_date($r); - foreach($r as $rr) { - - - $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); - $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt)); - $d = day_translate($d); - - $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c')); - if ($rr['nofinish']){ - $end = null; - } else { - $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c')); - } - - - $is_first = ($d !== $last_date); - - $last_date = $d; - $edit = ((! $rr['cid']) ? array($a->get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null); - $title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8')); - if(! $title) { - list($title, $_trash) = explode("$rr['id'], - 'start'=> $start, - 'end' => $end, - 'allDay' => false, - 'title' => $title, - - 'j' => $j, - 'd' => $d, - 'edit' => $edit, - 'is_first'=>$is_first, - 'item'=>$rr, - 'html'=>$html, - 'plink' => array($rr['plink'],t('link to source'),'',''), - ); - - - } - } + $events = process_events($r); if ($a->argv[1] === 'json'){ echo json_encode($events); killme(); diff --git a/view/templates/event_head.tpl b/view/templates/event_head.tpl index 01c69b8b3..99a320a89 100644 --- a/view/templates/event_head.tpl +++ b/view/templates/event_head.tpl @@ -6,7 +6,7 @@ diff --git a/view/theme/frost/js/theme.js b/view/theme/frost/js/theme.js index 038f83e0e..eb8bb51cc 100644 --- a/view/theme/frost/js/theme.js +++ b/view/theme/frost/js/theme.js @@ -149,7 +149,7 @@ $(document).ready(function() { if(window.aclType == "event_head") { $('#events-calendar').fullCalendar({ - events: baseurl + '/events/json/', + events: baseurl + window.eventModuleUrl +'/json/', header: { left: 'prev,next today', center: 'title', @@ -202,10 +202,12 @@ $(document).ready(function() { // center on date var args=location.href.replace(baseurl,"").split("/"); - if (args.length>=4) { + if (args.length>=5 && window.eventModeParams == 2) { + $("#events-calendar").fullCalendar('gotoDate',args[3] , args[4]-1); + } else if (args.length>=4 && window.eventModeParams == 1) { $("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1); - } - + } + // show event popup var hash = location.hash.split("-") if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]); @@ -352,7 +354,7 @@ if(typeof window.photoEdit != 'undefined') { function showEvent(eventid) { $.get( - baseurl + '/events/?id='+eventid, + baseurl + window.eventModuleUrl + '/?id=' + eventid, function(data){ $.colorbox({html:data}); $.colorbox.resize(); diff --git a/view/theme/frost/templates/event_head.tpl b/view/theme/frost/templates/event_head.tpl index f33f7fce2..47efb56ae 100644 --- a/view/theme/frost/templates/event_head.tpl +++ b/view/theme/frost/templates/event_head.tpl @@ -4,5 +4,7 @@