From 29dc4f32ec672f86f16846b70a777990822d184c Mon Sep 17 00:00:00 2001 From: Mikael Mallander Date: Sat, 2 Jul 2011 13:19:32 +0200 Subject: Swedish language update --- inc/lang/sv/lang.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/lang/sv/lang.php b/inc/lang/sv/lang.php index 801e2d879..06b21afe8 100644 --- a/inc/lang/sv/lang.php +++ b/inc/lang/sv/lang.php @@ -16,6 +16,7 @@ * @author Emil Lind * @author Bogge Bogge * @author Peter Åström + * @author mikael@mallander.net */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -225,8 +226,8 @@ $lang['img_camera'] = 'Kamera'; $lang['img_keywords'] = 'Nyckelord'; $lang['subscr_m_new_header'] = 'Lägg till prenumeration'; $lang['subscr_m_current_header'] = 'Nuvarande prenumerationer'; -$lang['subscr_m_unsubscribe'] = 'Prenumerera'; -$lang['subscr_m_subscribe'] = 'Avsluta prenumeration'; +$lang['subscr_m_unsubscribe'] = 'Avsluta prenumeration'; +$lang['subscr_m_subscribe'] = 'Prenumerera'; $lang['subscr_m_receive'] = 'Ta emot'; $lang['subscr_style_every'] = 'skicka epost vid varje ändring'; $lang['authmodfailed'] = 'Felaktiga inställningar för användarautentisering. Var vänlig meddela wikiadministratören.'; -- cgit v1.2.3 From 6619f42eb475ad91a0b73d1aa6268ff41c6129a2 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Fri, 1 Jul 2011 16:49:28 +0200 Subject: Refactor CSS and JS caching * Increase HTTP cache time since the resources are timestamped on request anyway * Check userscript.js only once for JS cache validation * Use cache class --- inc/httputils.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'inc') diff --git a/inc/httputils.php b/inc/httputils.php index 8da42e3b7..0ad97a9a1 100644 --- a/inc/httputils.php +++ b/inc/httputils.php @@ -197,3 +197,55 @@ function http_gzip_valid($uncompressed_file) { return true; } + +/** + * Set HTTP headers and echo cachefile, if useable + * + * This function handles output of cacheable resource files. It ses the needed + * HTTP headers. If a useable cache is present, it is passed to the web server + * and the scrpt is terminated. + */ +function http_cached($cache, $cache_ok) { + global $conf; + + // check cache age & handle conditional request + // since the resource files are timestamped, we can use a long max age: 1 year + header('Cache-Control: public, max-age=31536000'); + header('Pragma: public'); + if($cache_ok){ + http_conditionalRequest(filemtime($cache)); + if($conf['allowdebug']) header("X-CacheUsed: $cache"); + + // finally send output + if ($conf['gzip_output'] && http_gzip_valid($cache)) { + header('Vary: Accept-Encoding'); + header('Content-Encoding: gzip'); + readfile($cache.".gz"); + } else { + if (!http_sendfile($cache)) readfile($cache); + } + exit; + } + + http_conditionalRequest(time()); +} + +/** + * Cache content and print it + */ +function http_cached_finish($file, $content) { + global $conf; + + // save cache file + io_saveFile($file, $content); + if(function_exists('gzopen')) io_saveFile("$file.gz",$content); + + // finally send output + if ($conf['gzip_output']) { + header('Vary: Accept-Encoding'); + header('Content-Encoding: gzip'); + print gzencode($content,9,FORCE_GZIP); + } else { + print $content; + } +} -- cgit v1.2.3 From 881f2ee268e95e0cdd02bf593d89ca9b42d03060 Mon Sep 17 00:00:00 2001 From: Andreas Haerter Date: Fri, 17 Jun 2011 02:41:10 +0200 Subject: updated doc for tpl_indexerWebBug() --- inc/template.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/template.php b/inc/template.php index b9b3951ff..a476e78ab 100644 --- a/inc/template.php +++ b/inc/template.php @@ -972,8 +972,7 @@ function _tpl_img_action($data, $param=NULL) { } /** - * This function inserts a 1x1 pixel gif which in reality - * is the indexer function. + * This function inserts a small gif which in reality is the indexer function. * * Should be called somewhere at the very end of the main.php * template @@ -986,7 +985,7 @@ function tpl_indexerWebBug(){ $p = array(); $p['src'] = DOKU_BASE.'lib/exe/indexer.php?id='.rawurlencode($ID). '&'.time(); - $p['width'] = 2; + $p['width'] = 2; //no more 1x1 px image because we live in times of ad blockers... $p['height'] = 1; $p['alt'] = ''; $att = buildAttributes($p); -- cgit v1.2.3 From 0cacf91f96aa51a4c66082fe6c9b034fe61a1290 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sun, 10 Jul 2011 12:49:51 +0200 Subject: Add check for existing renderer class --- inc/parserutils.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/parserutils.php b/inc/parserutils.php index 9ae835893..9384929bf 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -677,12 +677,16 @@ function & p_get_renderer($mode) { global $conf, $plugin_controller; $rname = !empty($conf['renderer_'.$mode]) ? $conf['renderer_'.$mode] : $mode; + $rclass = "Doku_Renderer_$rname"; + + if( class_exists($rclass) ) { + return new $rclass(); + } // try default renderer first: $file = DOKU_INC."inc/parser/$rname.php"; if(@file_exists($file)){ require_once $file; - $rclass = "Doku_Renderer_$rname"; if ( !class_exists($rclass) ) { trigger_error("Unable to resolve render class $rclass",E_USER_WARNING); -- cgit v1.2.3 From a1dee2b998bc3dc8436bb076435d405ec412e054 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 11 Jul 2011 22:17:27 +0200 Subject: Fix some bugs and glitches in (mediamanager) tree * Fix selector in subtree loading callback * Remove HTML inconsistencies between AJAX and plain PHP lists * Unify icon and CSS class switching in dw_tree and dw_mediamanager --- inc/html.php | 16 +++++++++++++--- inc/media.php | 9 ++------- 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'inc') diff --git a/inc/html.php b/inc/html.php index 6e187ebe1..de860a0fe 100644 --- a/inc/html.php +++ b/inc/html.php @@ -737,7 +737,7 @@ function html_list_index($item){ /** * Index List item * - * This user function is used in html_build_lidt to build the + * This user function is used in html_buildlist to build the *
  • tags for namespaces when displaying the page index * it gives different classes to opened or closed "folders" * @@ -778,10 +778,20 @@ function html_li_default($item){ * @author Andreas Gohr */ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){ - $level = 0; + if (count($data) === 0) { + return ''; + } + + $level = $data[0]['level']; $opens = 0; $ret = ''; + if ($level < 2) { + // Trigger building a wrapper ul if the first level is + // 0 (we have a root object) or 1 (just the root content) + --$level; + } + foreach ($data as $item){ if( $item['level'] > $level ){ @@ -797,7 +807,7 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){ //close higher lists $ret .= "\n
  • \n"; } - }else{ + } elseif ($ret !== '') { //close last item $ret .= "\n"; } diff --git a/inc/media.php b/inc/media.php index 10da501b0..731ba1668 100644 --- a/inc/media.php +++ b/inc/media.php @@ -767,15 +767,10 @@ function media_nstree($ns){ search($data,$conf['mediadir'],'search_index',array('ns' => $ns, 'nofiles' => true)); // wrap a list with the root level around the other namespaces - $item = array( 'level' => 0, 'id' => '', - 'open' =>'true', 'label' => '['.$lang['mediaroot'].']'); + array_unshift($data, array('level' => 0, 'id' => '', 'open' =>'true', + 'label' => '['.$lang['mediaroot'].']')); - echo '
      '; - echo media_nstree_li($item); - echo media_nstree_item($item); echo html_buildlist($data,'idx','media_nstree_item','media_nstree_li'); - echo ''; - echo '
    '; } /** -- cgit v1.2.3