tra('CasperJS'), 'documentation' => 'CasperJS', 'description' => tra('Enable running CasperJS scripts from this Tiki site.'), 'prefs' => ['wikiplugin_casperjs'], 'packages_required' => ['jerome-breton/casperjs-installer' => 'CasperJsInstaller\Installer'], 'body' => tra('text'), 'introduced' => 17, 'iconname' => 'monitor', 'tags' => ['advanced'], 'validate' => 'arguments', 'params' => [], ]; } function wikiplugin_casperjs($data, $params) { $htmlResult = ''; $info = wikiplugin_casperjs_info(); foreach ($info['packages_required'] as $class) { if (! class_exists($class)) { return tra('CasperJS not available'); } } $actionKey = md5(serialize([$data, $params])); // Generate Link $label = tra('Execute CasperJS script'); $urlParts = parse_url($_SERVER['REQUEST_URI']); $path = isset($urlParts['path']) ? $urlParts['path'] : '/'; if (isset($urlParts['query'])) { parse_str($urlParts['query'], $requestParams); } else { $requestParams = []; } $requestParams[$actionKey] = $label; $requestParamStr = http_build_query($requestParams, null, '&'); $link = '' . $label . ''; $htmlResult .= $link; $executionResult = ''; // Process request if the action key is set if (isset($_REQUEST[$actionKey])) { $executionResult .= "