See Release Notes
Long Term Support Release
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 defined('MOODLE_INTERNAL') || die(); 18 19 global $CFG; 20 require_once($CFG->dirroot . '/repository/googledocs/tests/repository_googledocs_testcase.php'); 21 22 /** 23 * Base class for the googledoc repository unit tests related to content browsing and searching. 24 * 25 * @package repository_googledocs 26 * @copyright 2021 Mihail Geshoski <mihail@moodle.com> 27 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 28 */ 29 abstract class googledocs_content_testcase extends repository_googledocs_testcase { 30 31 /** @var array The array which contains the disallowed file extensions. */ 32 protected $disallowedextensions = []; 33 34 /** 35 * Method used for filtering repository file nodes based on the current disallowed file extensions list. 36 * 37 * @param array $content The repository content node 38 * @return bool If returns false, the repository content node should be filtered, otherwise do not filter. 39 */ 40 public function filter(array $content): bool { 41 // If the disallowed file extensions list is empty, do not filter the content node. 42 if (empty($this->disallowedextensions)) { 43 return true; 44 } 45 foreach ($this->disallowedextensions as $extension) { 46 // If the disallowed file extension matches the extension of the repository file node, 47 // than filter this node. 48 if (preg_match("#.{$extension}#i", $content['title'])) { 49 return false; 50 } 51 } 52 return true; 53 } 54 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body