/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to classes/common.php

  • Committer: Suren A. Chilingaryan
  • Date: 2020-02-05 21:42:55 UTC
  • Revision ID: csa@suren.me-20200205214255-vxeq8wzwlg984isj
Enable loading default XSLT file for a subpath and drop XSLT symlinks for standard image-based (image.xsl) VIEWs

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 }
54
54
 
55
55
 static function GetXSLTFile($xslt) {
 
56
    global $ADEI_DEFAULT_XSLT;
56
57
    $root = self::GetRootDir();
57
58
    $setup = self::GetSetupDir();
58
59
 
59
60
    if (file_exists("$setup/xslt/$xslt.xsl")) return "$setup/xslt/$xslt.xsl";
60
61
    else if (file_exists("$root/xslt/$xslt.xsl")) return "$root/xslt/$xslt.xsl";
61
 
    else if (preg_match("/^(.*\\/)?([^\\/]+)_([\d\w]+)$/", $xslt, $m)) {
 
62
    else if (preg_match("/^(.*\\/)?([^\\/]+)_([\d\w]+)$/", $xslt, $m)) {                                // load options.xsl instead of correlation_options.xsl (defaults)
62
63
        $xslt = $m[1] . $m[3];
63
64
        if (file_exists("$setup/xslt/$xslt.xsl")) return "$setup/xslt/$xslt.xsl";
64
65
        else if (file_exists("$root/xslt/$xslt.xsl")) return "$root/xslt/$xslt.xsl";
65
66
        else throw new ADEIException(translate("Neither (%s.xsl) nor (%s.xsl) is found", $m[0], $xslt));
 
67
    } else if ((preg_match("/^(.*)\\/([\d\w]+)$/", $xslt, $m))&&($ADEI_DEFAULT_XSLT[$m[1]])) {          // load image.xsl instead of correlation.xsl (defaults)
 
68
        $xslt = $m[1] . "/" . $ADEI_DEFAULT_XSLT[$m[1]];
 
69
        if (file_exists("$setup/xslt/$xslt.xsl")) return "$setup/xslt/$xslt.xsl";
 
70
        else if (file_exists("$root/xslt/$xslt.xsl")) return "$root/xslt/$xslt.xsl";
 
71
        else throw new ADEIException(translate("Neither (%s.xsl) nor (%s.xsl) is found", $m[0], $xslt));
66
72
    }
67
73
    else throw new ADEIException(translate("XSL template (%s.xsl) is not found", $xslt));
68
74
 }