Passed
Push — master ( 262b3f...86674d )
by Yannick
09:44
created

TemplateManager::getEmptyTemplate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 11
rs 10
1
<?php
2
/**
3
 * (c) Copyright Ascensio System SIA 2025.
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
require_once __DIR__.'/../../../main/inc/global.inc.php';
18
19
class TemplateManager
20
{
21
    /**
22
     * Return path to template new file.
23
     */
24
    public static function getEmptyTemplate($fileExtension): string
25
    {
26
        $langInfo = LangManager::getLangUser();
27
        $lang = $langInfo['isocode'];
28
        $templateFolder = api_get_path(SYS_PLUGIN_PATH).'onlyoffice/assets/';
29
        if (!is_dir($templateFolder.$lang)) {
30
            $lang = 'default';
31
        }
32
        $templateFolder = $templateFolder.$lang;
33
34
        return $templateFolder.'/'.ltrim($fileExtension, '.').'.zip';
35
    }
36
}
37