public function testRemoveBorderTemplateAndCat() { $ct = new CropTool(); $txt = $ct->removeBorderTemplateAndCat('abc [[Category:Images with borders]] def'); $this->assertEquals('abc def', $txt); $txt = $ct->removeBorderTemplateAndCat('abc [[Category:Images_with_borders]] def'); $this->assertEquals('abc def', $txt); $txt = $ct->removeBorderTemplateAndCat('abc {{Crop}} def'); $this->assertEquals('abc def', $txt); $txt = $ct->removeBorderTemplateAndCat('abc {{Remove border}} def'); $this->assertEquals('abc def', $txt); }
<?php require 'common.php'; $apiClient = new MwApiClient($site, $oauth, null, $log, $config); $ct = new CropTool($apiClient, null, $log); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $input = json_decode(file_get_contents("php://input")); header('Content-type: application/json'); if (isset($input->store)) { echo json_encode($ct->upload($input)); } else { if (isset($_GET['action']) && $_GET['action'] == 'logout') { echo json_encode($ct->logout()); } else { echo json_encode($ct->doCrop($input)); } } exit; } if (isset($_GET['checkLogin'])) { header('Content-type: application/json'); echo json_encode($ct->checkLogin()); exit; } if (!isset($_GET['action']) || !isset($_GET['title'])) { die('Invalid request'); } $action = $_GET['action']; $title = $_GET['title']; header('Content-type: application/json'); switch ($action) {