/** * render * * @return string */ public function render() { $editor_handler = \XoopsEditorHandler::getInstance(); $editor_handler->allowed_editors = $this->allowed_editors; $option_select = new Select("", $this->name, $this->value); $onchangeCode = '"if(this.options[this.selectedIndex].value.length > 0 ){window.document.forms.' . $this->form->getName() . '.submit();}"'; $option_select->set('onchange', $onchangeCode); $option_select->addOptionArray($editor_handler->getList($this->nohtml)); $this->addElement($option_select); return parent::render(); }
/** * Constructor * @param object $object reference to targetobject (@link IcmsPersistableObject) * @param string $key the form name */ function __construct($title, $key, $value, $width = '100%', $height = '400px', $editor_name = null, $language = 'php') { parent::__construct($title, $key, $value); if ($editor_name == null) { global $xoopsConfig; $editor_name = $xoopsConfig['sourceeditor_default']; } require_once XOOPS_ROOT_PATH . '/class/xoopseditor.php'; $editor_handler = XoopsEditorHandler::getInstance('source'); $this->editor =& $editor_handler->get($editor_name, array('name' => $key, 'value' => $value, 'language' => $language, 'width' => $width, 'height' => $height)); }
function render() { xoops_load('XoopsEditorHandler'); $editor_handler = XoopsEditorHandler::getInstance(); $editor_handler->allowed_editors = $this->allowed_editors; $option_select = new XoopsFormSelect("", $this->name, $this->value); $extra = 'onchange="if(this.options[this.selectedIndex].value.length > 0 ){ window.document.forms.' . $this->form->getName() . '.submit(); }"'; $option_select->setExtra($extra); $option_select->addOptionArray($editor_handler->getList($this->nohtml)); $this->addElement($option_select); return parent::render(); }
/** * Constructor * * @param string $caption Caption * @param string $name Name for textarea field * @param string $value Initial text * @param array $configs configures: editor - editor identifier; name - textarea field name; width, height - dimensions for textarea; value - text content * @param bool $noHtml use non-WYSIWYG eitor onfailure * @param string $OnFailure editor to be used if current one failed */ function XoopsFormEditor($caption, $name, $configs = null, $nohtml = false, $OnFailure = "") { // Backward compatibility: $name -> editor name; $configs["name"] -> textarea field name if (!isset($configs["editor"])) { $configs["editor"] = $name; $name = $configs["name"]; // New: $name -> textarea field name; $configs["editor"] -> editor name; $configs["name"] -> textarea field name } else { $configs["name"] = $name; } $this->XoopsFormTextArea($caption, $name); xoops_load('XoopsEditorHandler'); $editor_handler = XoopsEditorHandler::getInstance(); $this->editor = $editor_handler->get($configs["editor"], $configs, $nohtml, $OnFailure); }
/** * Constructor * * @param string $caption Caption * @param string $name Name for textarea field * @param array $configs configures: editor - editor identifier; name - textarea field name; width, height - dimensions for textarea; value - text content * @param bool $nohtml use non-WYSIWYG editor onfailure * @param string $OnFailure editor to be used if current one failed * */ public function __construct($caption, $name, $configs = null, $nohtml = false, $OnFailure = '') { // Backward compatibility: $name -> editor name; $configs['name'] -> textarea field name if (!isset($configs['editor'])) { $configs['editor'] = $name; $name = $configs['name']; // New: $name -> textarea field name; $configs['editor'] -> editor name; $configs['name'] -> textarea field name } else { $configs['name'] = $name; } parent::__construct($caption, $name); xoops_load('XoopsEditorHandler'); $editor_handler = XoopsEditorHandler::getInstance(); $this->editor = $editor_handler->get($configs['editor'], $configs, $nohtml, $OnFailure); }
$crit_teams = new CriteriaCompo(); $crit_teams->add(new Criteria('team_online', '1')); $crit_teams->setSort('team_weight'); $crit_teams->setOrder('ASC'); $teamsAll = $teamsHandler->getAll($crit_teams); foreach (array_keys($teamsAll) as $i) { $s++; $modversion['sub'][$s]['name'] = $teamsAll[$i]->getVar('team_name'); $modversion['sub'][$s]['url'] = 'index.php?team_id=' . $teamsAll[$i]->getVar('team_id'); } } // ------------------- Blocks ------------------- // $modversion['blocks'][] = array('file' => 'b_teamsmembers.php', 'name' => _MI_WGTEAMS_TEAMSMEMBERS_BLOCK, 'description' => _MI_WGTEAMS_TEAMSMEMBERS_BLOCK_DESC, 'show_func' => 'b_wgteams_teamsmembers_show', 'edit_func' => 'b_wgteams_teamsmembers_edit', 'options' => 'showsingleteam|0', 'template' => 'wgteams_block_teamsmembers.tpl'); $modversion['blocks'][] = array('file' => 'b_teams.php', 'name' => _MI_WGTEAMS_TEAMS_BLOCK, 'description' => _MI_WGTEAMS_TEAMS_BLOCK_DESC, 'show_func' => 'b_wgteams_teams_show', 'edit_func' => '', 'options' => 'showlistofteams|0', 'template' => 'wgteams_block_teams.tpl'); // ------------------- Config ------------------- // $modversion['config'][] = array('name' => 'keywords', 'title' => '_MI_WGTEAMS_KEYWORDS', 'description' => '_MI_WGTEAMS_KEYWORDS_DESC', 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => 'wgteams, teams, members, relations, infofields'); $modversion['config'][] = array('name' => 'adminpager', 'title' => '_MI_WGTEAMS_ADMIN_PAGER', 'description' => '_MI_WGTEAMS_ADMIN_PAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10); $modversion['config'][] = array('name' => 'userpager', 'title' => '_MI_WGTEAMS_USER_PAGER', 'description' => '_MI_WGTEAMS_USER_PAGER_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10); // start page for module $modversion['config'][] = array('name' => 'startpage', 'title' => '_MI_WGTEAMS_STARTPAGE', 'description' => '_MI_WGTEAMS_STARTPAGE_DESC', 'formtype' => 'select', 'valuetype' => 'array', 'default' => 1, 'options' => array(_MI_WGTEAMS_STARTPAGE_LIST => 1, _MI_WGTEAMS_STARTPAGE_ALL => 2, _MI_WGTEAMS_STARTPAGE_FIRST => 3)); // Editor xoops_load('xoopseditorhandler'); $editorHandler = XoopsEditorHandler::getInstance(); $modversion['config'][] = array('name' => 'wgteams_editor', 'title' => '_MI_WGTEAMS_EDITOR', 'description' => '_MI_WGTEAMS_EDITOR_DESC', 'formtype' => 'select', 'valuetype' => 'text', 'options' => array_flip($editorHandler->getList()), 'default' => 'dhtmltextarea'); //Uploads : max size for image upload $modversion['config'][] = array('name' => 'wgteams_img_maxsize', 'title' => '_MI_WGTEAMS_IMG_MAXSIZE', 'description' => '_MI_WGTEAMS_IMG_MAXSIZE_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 10485760); // 1 MB //Uploads : mimetypes of images $modversion['config'][] = array('name' => 'wgteams_img_mimetypes', 'title' => '_MI_WGTEAMS_IMG_MIMETYPES', 'description' => '_MI_WGTEAMS_IMG_MIMETYPES_DESC', 'formtype' => 'select_multi', 'valuetype' => 'array', 'default' => array('image/gif', 'image/jpeg', 'image/png', 'image/jpg'), 'options' => array('bmp' => 'image/bmp', 'gif' => 'image/gif', 'pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpg', 'jpe' => 'image/jpe', 'png' => 'image/png')); $modversion['config'][] = array('name' => 'wgteams_labels', 'title' => '_MI_WGTEAMS_LABELS', 'description' => '_MI_WGTEAMS_LABELS_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1); $modversion['config'][] = array('name' => 'wgteams_showbreadcrumbs', 'title' => '_MI_WGTEAMS_SHOWBREADCRUMBS', 'description' => '_MI_WGTEAMS_SHOWBREADCRUMBS_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1);
function smart_getEditors() { $filename = XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php'; if (!file_exists($filename)) { return false; } include_once $filename; $xoopseditor_handler = XoopsEditorHandler::getInstance(); $aList = $xoopseditor_handler->getList(); $ret = array(); foreach ($aList as $k => $v) { $ret[$v] = $k; } return $ret; }
/** * @param array $allowedEditors * @return array */ function publisherGetEditors($allowedEditors = null) { $ret = array(); $nohtml = false; xoops_load('XoopsEditorHandler'); $editorHandler =& XoopsEditorHandler::getInstance(); $editors = $editorHandler->getList($nohtml); foreach ($editors as $name => $title) { $key = publisherStringToInt($name); if (is_array($allowedEditors)) { //for submit page if (in_array($key, $allowedEditors)) { $ret[] = $name; } } else { //for admin permissions page $ret[$key]['name'] = $name; $ret[$key]['title'] = $title; } } return $ret; }
/** * Constructor * * @param string $caption Caption * @param string $name "name" attribute * @param string $value Initial text * @param int $rows Number of rows * @param int $cols Number of columns * @param string $hiddentext Identifier for hidden Text * @param array $options Extra options */ function XoopsFormDhtmlTextArea($caption, $name, $value = "", $rows = 5, $cols = 50, $hiddentext = "xoopsHiddenText", $options = array()) { global $xoopsConfig; static $inLoop = 0; $inLoop++; // Second loop, invalid, return directly if ($inLoop > 2) { return; } // Else, initialize $this->XoopsFormTextArea($caption, $name, $value, $rows, $cols); $this->_hiddenText = $hiddentext; if ($inLoop > 1) { return; } if (!isset($options['editor'])) { if (isset($xoopsConfig['editor'])) { $options['editor'] = $xoopsConfig['editor']; } } if (!empty($this->htmlEditor) || !empty($options['editor'])) { $options['name'] = $this->getName(); $options['value'] = $this->getValue(); if (!empty($options['editor'])) { $this->htmlEditor = is_array($options['editor']) ? $options['editor'] : array($options['editor']); } if (count($this->htmlEditor) == 1) { xoops_load('XoopsEditorHandler'); $editor_handler =& XoopsEditorHandler::getInstance(); $this->htmlEditor = $editor_handler->get($this->htmlEditor[0], $options); if ($inLoop > 1) { $this->htmlEditor = null; } } else { list($class, $path) = $this->htmlEditor; include_once XOOPS_ROOT_PATH . $path; if (class_exists($class)) { $this->htmlEditor = new $class($options); } if ($inLoop > 1) { $this->htmlEditor = null; } } } $inLoop = 0; }
$modversion['config'][$config_count]['name'] = 'maxuploadsize'; $modversion['config'][$config_count]['title'] = '_AMS_MI_UPLOADFILESIZE'; $modversion['config'][$config_count]['description'] = '_AMS_MI_UPLOADFILESIZE_DESC'; $modversion['config'][$config_count]['formtype'] = 'texbox'; $modversion['config'][$config_count]['valuetype'] = 'int'; $modversion['config'][$config_count]['default'] = 1048576; $config_count++; //Workaround for XOOPS Cube Legacy 2.2. XC not support XOOPS Editor by default if (file_exists(XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php')) { //To be compatible with XOOPS 2.2.x if (file_exists(XOOPS_ROOT_PATH . '/class/xoopslists.php')) { include_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; } include_once XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php'; //$editor_handler = XoopsEditorHandler::getInstance(); $editor_handler = new XoopsEditorHandler(); $editor_list = array_flip($editor_handler->getList()); } else { $editor_list = array('_AMS_MI_EDITOR_DEFAULT' => 'textarea', '_AMS_MI_EDITOR_DHTML' => 'dhtmlext'); } $modversion['config'][$config_count]['name'] = 'editor'; $modversion['config'][$config_count]['title'] = '_AMS_MI_EDITOR'; $modversion['config'][$config_count]['description'] = '_AMS_MI_EDITOR_DESC'; $modversion['config'][$config_count]['formtype'] = 'select'; $modversion['config'][$config_count]['valuetype'] = 'text'; $modversion['config'][$config_count]['default'] = 0; $modversion['config'][$config_count]['options'] = $editor_list; $config_count++; $modversion['config'][$config_count]['name'] = 'editor_userchoice'; $modversion['config'][$config_count]['title'] = '_AMS_MI_EDITOR_USER_CHOICE'; $modversion['config'][$config_count]['description'] = '_AMS_MI_EDITOR_USER_CHOICE_DESC';
$moduleDirName = basename(__DIR__); $modversion = array('name' => _MI_PRESENTER_NAME, 'version' => 1.0, 'description' => _MI_PRESENTER_DESC, 'author' => "Michael Beck (aka Mamba)", 'author_mail' => "*****@*****.**", 'author_website_url' => "http://xoops.org", 'author_website_name' => "XOOPS Project", 'credits' => 'XOOPS Development Team', 'license' => 'GPL 2.0 or later', 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', 'help' => 'page=help', 'release_info' => "release_info", 'release_file' => XOOPS_URL . "/modules/{$moduleDirName}/docs/release_info file", 'manual' => 'link to manual file', 'manual_file' => XOOPS_URL . "/modules/{$moduleDirName}/docs/install.txt", 'min_php' => '5.5', 'min_xoops' => '2.5.7.2', 'min_admin' => '1.1', 'min_db' => array('mysql' => '5.0.7', 'mysqli' => '5.0.7'), 'image' => "assets/images/module_logo.png", 'dirname' => $moduleDirName, 'dirmoduleadmin' => 'Frameworks/moduleclasses/moduleadmin', 'sysicons16' => 'Frameworks/moduleclasses/icons/16', 'sysicons32' => 'Frameworks/moduleclasses/icons/32', 'modicons16' => 'assets/images/icons/16', 'modicons32' => 'assets/images/icons/32', 'demo_site_url' => "http://xoops.org", 'demo_site_name' => "XOOPS Demo Site", 'support_url' => "http://xoops.org/modules/newbb", 'support_name' => "Support Forum", 'module_website_url' => "www.xoops.org", 'module_website_name' => "XOOPS Project", 'release_date' => '2015/04/03', 'module_status' => "Beta 1", 'system_menu' => 1, 'hasAdmin' => 1, 'adminindex' => "admin/index.php", 'adminmenu' => "admin/menu.php", 'hasMain' => 1, 'onInstall' => "include/oninstall.php"); // Mysql file $modversion['sqlfile']['mysql'] = "sql/mysql.sql"; // Tables $modversion['tables'][1] = "presenter_categories"; $modversion['tables'][2] = "presenter_slides"; // Templates $modversion['templates'][] = array('file' => 'presenter_header.tpl', 'description' => ''); $modversion['templates'][] = array('file' => 'presenter_index.tpl', 'description' => ''); $modversion['templates'][] = array('file' => 'presenter_categories.tpl', 'description' => ''); $modversion['templates'][] = array('file' => 'presenter_slides.tpl', 'description' => ''); $modversion['templates'][] = array('file' => 'presenter_footer.tpl', 'description' => ''); $modversion['templates'][] = array('file' => 'presenter_iframe.tpl', 'description' => ''); $modversion['templates'][] = array('file' => 'presenter_iframeslides.tpl', 'description' => ''); //Blocks $modversion['blocks'][] = array('file' => "slides.php", 'name' => _MI_PRESENTER_SLIDES_BLOCK, 'description' => "", 'show_func' => "b_presenter_slides_show", 'edit_func' => "b_presenter_slides_edit", 'options' => "slides|5|25|0", 'template' => "slides_block.tpl"); // Config xoops_load('xoopseditorhandler'); $editor_handler =& XoopsEditorHandler::getInstance(); $modversion['config'][] = array('name' => "presenter_editor", 'title' => "_MI_PRESENTER_EDITOR", 'description' => "_MI_PRESENTER_EDITOR_DESC", 'formtype' => "select", 'valuetype' => "text", 'options' => array_flip($editor_handler->getList()), 'default' => "dhtml"); $modversion['config'][] = array('name' => "keywords", 'title' => "_MI_PRESENTER_KEYWORDS", 'description' => "_MI_PRESENTER_KEYWORDS_DESC", 'formtype' => "textbox", 'valuetype' => "text", 'default' => "presenter, slides"); //Uploads : filesize of slides_mp3 $modversion['config'][] = array('name' => "filesize", 'title' => "_MI_PRESENTER_SIZE", 'description' => "_MI_PRESENTER_SIZE_DESC", 'formtype' => "textbox", 'valuetype' => "int", 'default' => 10485760); //Uploads : filemimetypes of slides_mp3 $modversion['config'][] = array('name' => "filemimetypes", 'title' => "_MI_PRESENTER_MIMETYPES", 'description' => "_MI_PRESENTER_MIMETYPES_DESC", 'formtype' => "select_multi", 'valuetype' => "array", 'default' => array("image/gif", "image/jpeg", "image/png"), 'options' => array("bmp" => "image/bmp", "gif" => "image/gif", "pjpeg" => "image/pjpeg", "jpeg" => "image/jpeg", "jpg" => "image/jpg", "jpe" => "image/jpe", "png" => "image/png")); $modversion['config'][] = array('name' => "adminpager", 'title' => "_MI_PRESENTER_ADMINPAGER", 'description' => "_MI_PRESENTER_ADMINPAGER_DESC", 'formtype' => "textbox", 'valuetype' => "int", 'default' => 10); $modversion['config'][] = array('name' => "userpager", 'title' => "_MI_PRESENTER_USERPAGER", 'description' => "_MI_PRESENTER_USERPAGER_DESC", 'formtype' => "textbox", 'valuetype' => "int", 'default' => 10); $modversion['config'][] = array('name' => "advertise", 'title' => "_MI_PRESENTER_ADVERTISE", 'description' => "_MI_PRESENTER_ADVERTISE_DESC", 'formtype' => "textarea", 'valuetype' => "text", 'default' => ""); $modversion['config'][] = array('name' => "bookmarks", 'title' => "_MI_PRESENTER_BOOKMARKS", 'description' => "_MI_PRESENTER_BOOKMARKS_DESC", 'formtype' => "yesno", 'valuetype' => "int", 'default' => 0); $modversion['config'][] = array('name' => "fbcomments", 'title' => "_MI_PRESENTER_FBCOMMENTS", 'description' => "_MI_PRESENTER_FBCOMMENTS_DESC", 'formtype' => "yesno", 'valuetype' => "int", 'default' => 0);
/** * Constructor * * @param string $caption Caption * @param string $name "name" attribute * @param string $value Initial text * @param int $rows Number of rows * @param int $cols Number of columns * @param string $hiddentext Identifier for hidden Text * @param array $options Extra options */ function __construct($caption, $name, $value = "", $rows = 5, $cols = 50, $hiddentext = "xoopsHiddenText", $options = array()) { static $inLoop = 0; $inLoop++; // Second loop, invalid, return directly if ($inLoop > 2) { return; } // Else, initialize parent::__construct($caption, $name, $value, $rows, $cols); $this->_hiddenText = $hiddentext; if ($inLoop > 1) { return; } if (!isset($options['editor'])) { $configs = @(include $GLOBALS['xoops']->path("var/configs/xoopsconfig.php")); if (!empty($configs['editor'])) { $options['editor'] = $configs['editor']; } } if (!empty($this->htmlEditor) || !empty($options['editor'])) { $options['name'] = $this->getName(); $options['value'] = $this->getValue(); if (!empty($options['editor'])) { $this->htmlEditor = is_array($options['editor']) ? $options['editor'] : array($options['editor']); } if (count($this->htmlEditor) == 1) { xoops_load('XoopsEditorHandler'); $editor_handler =& XoopsEditorHandler::getInstance(); $this->htmlEditor = $editor_handler->get($this->htmlEditor[0], $options); if ($inLoop > 1) { $this->htmlEditor = null; } } else { list($class, $path) = $this->htmlEditor; include_once XOOPS_ROOT_PATH . $path; if (class_exists($class)) { $this->htmlEditor = new $class($options); } if ($inLoop > 1) { $this->htmlEditor = null; } } } $inLoop = 0; }
/** * @param array $allowed_editors * * @return array */ public static function getEditors($allowed_editors = null) { $ret = array(); $nohtml = false; $editor_handler = XoopsEditorHandler::getInstance(); $editors = $editor_handler->getList($nohtml); foreach ($editors as $name => $title) { $key = self::stringToInt($name); if (is_array($allowed_editors)) { //for submit page if (in_array($key, $allowed_editors)) { $ret[] = $name; } } else { //for admin permissions page $ret[$key]['name'] = $name; $ret[$key]['title'] = $title; } } return $ret; }
/** * Constructor * * @param string $caption Caption * @param string $name name attribute * @param string $value Initial text * @param integer $rows Number of rows * @param integer $cols Number of columns * @param string $hiddentext Identifier for hidden Text * @param array $options Extra options */ public function __construct($caption, $name, $value = "", $rows = 5, $cols = 50, $hiddentext = "xoopsHiddenText", $options = array()) { static $inLoop = 0; ++$inLoop; // Second loop, invalid, return directly if ($inLoop > 2) { return; } // Else, initialize parent::__construct($caption, $name, $value, $rows, $cols); $this->hiddenText = $hiddentext; if ($inLoop > 1) { return; } $xoops = \Xoops::getInstance(); if (!isset($options['editor'])) { if ($editor = $xoops->getConfig('editor')) { $options['editor'] = $editor; } } if (!empty($this->htmlEditor) || !empty($options['editor'])) { $options['name'] = $this->getName(); $options['value'] = $this->getValue(); if (!empty($options['editor'])) { $this->htmlEditor = is_array($options['editor']) ? $options['editor'] : array($options['editor']); } if (count($this->htmlEditor) == 1) { $editor_handler = \XoopsEditorHandler::getInstance(); $this->htmlEditor = $editor_handler->get($this->htmlEditor[0], $options); if ($inLoop > 1) { $this->htmlEditor = null; } } else { list($class, $path) = $this->htmlEditor; include_once \XoopsBaseConfig::get('root-path') . $path; if (class_exists($class)) { $this->htmlEditor = new $class($options); } if ($inLoop > 1) { $this->htmlEditor = null; } } } $inLoop = 0; }
function xmf_getEditors() { $filename = XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php'; if (!file_exists($filename)) { return false; } include_once $filename; $xoopseditor_handler = XoopsEditorHandler::getInstance(); return array_flip($xoopseditor_handler->getList()); }