/** * @param Captcha $captcha The captcha to use. If not given, a default captcha will be used. */ public function __construct($id = 'captcha') { global $LANG; $this->captcha = AppContext::get_captcha_service()->get_default_factory(); $field_options = $this->is_enabled() ? array('required' => true) : array(); parent::__construct($id, LangLoader::get_message('form.captcha', 'common'), false, $field_options); }
$title = retrieve(POST, 'title', ''); $encoded_title = retrieve(GET, 'title', ''); $contents = wiki_parse(retrieve(POST, 'contents', '', TSTRING_AS_RECEIVED)); $contents_preview = retrieve(POST, 'contents', '', TSTRING_UNCHANGE); $id_cat = retrieve(GET, 'id_parent', 0); $new_id_cat = retrieve(POST, 'id_cat', 0); $id_cat = $id_cat > 0 ? $id_cat : $new_id_cat; $preview = retrieve(POST, 'preview', false); $id_edit_get = retrieve(GET, 'id', 0); $id_edit = $id_edit > 0 ? $id_edit : $id_edit_get; require_once '../kernel/header.php'; $categories = WikiCategoriesCache::load()->get_categories(); //Variable d'erreur $error = ''; $tpl = new FileTemplate('wiki/post.tpl'); $captcha = AppContext::get_captcha_service()->get_default_factory(); if (!empty($contents)) { include_once '../wiki/wiki_functions.php'; //On crée le menu des paragraphes et on enregistre le menu $menu = ''; //Si on détecte la syntaxe des menus alors on lance les fonctions, sinon le menu sera vide et non affiché if (preg_match('`[\\-]{2,6}`isU', $contents)) { $menu_list = wiki_explode_menu($contents); //On éclate le menu en tableaux $menu = wiki_display_menu($menu_list); //On affiche le menu } if ($preview) { $tpl->assign_block_vars('preview', array('CONTENTS' => FormatingHelper::second_parse(wiki_no_rewrite(stripslashes($contents))), 'TITLE' => stripslashes($title))); if (!empty($menu)) { $tpl->assign_block_vars('preview.menu', array('MENU' => $menu));
public function uninstall() { ConfigManager::delete('question-captcha', 'config'); return AppContext::get_captcha_service()->uninstall_captcha('QuestionCaptcha'); }
private function generate_captcha_available_option() { $options = array(); $captchas = AppContext::get_captcha_service()->get_available_captchas(); foreach ($captchas as $identifier => $name) { $options[] = new FormFieldSelectChoiceOption($name, $identifier); } return $options; }
public function uninstall() { return AppContext::get_captcha_service()->uninstall_captcha('ReCaptcha'); }