/** * Shows the initial panel with options to import */ public function panel() { require XOOPS_ROOT_PATH . '/modules/mywords/include/mw-lang.php'; RMTemplate::getInstance()->add_style('importer.min.css', 'mywords', ['id' => 'importer-css']); RMTemplate::getInstance()->add_script('importer.min.js', 'mywords', ['id' => 'importer-js', 'directory' => 'include', 'footer' => 1]); RMTemplate::getInstance()->header(); RMTemplate::getInstance()->display('admin/mywords-importer.php'); RMTemplate::getInstance()->footer(); }
public function header() { global $xoopsConfig, $xoopsUser, $xoopsModule, $xoTheme, $xoopsTpl; parent::header(); RMTemplate::getInstance()->add_jquery(false, true); if ($xoopsModule && !$xoopsModule->getInfo('rmnative')) { RMTemplate::get()->add_script(XOOPS_URL . '/include/xoops.js'); } }
function show_dashboard() { global $xoopsModule, $cuSettings, $cuIcons; //RMFunctions::create_toolbar(); $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = 'SELECT * FROM ' . $db->prefix('modules'); $result = $db->query($sql); $installed_mods = array(); while ($row = $db->fetchArray($result)) { $installed_mods[] = $row['dirname']; } require_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $dirlist = XoopsLists::getModulesList(); $available_mods = array(); $module_handler =& xoops_gethandler('module'); foreach ($dirlist as $file) { clearstatcache(); $file = trim($file); if (!in_array($file, $installed_mods)) { $module =& $module_handler->create(); if (!$module->loadInfo($file, false)) { continue; } $available_mods[] = $module; } } $installed_modules = get_modules_list(); // Modules counter $counterModules = new Common\Widgets\Counter(['id' => 'counter-modules', 'color' => 'red', 'icon' => 'svg-rmcommon-module', 'class' => 'animated bounceIn']); $counterModules->addCell(__('Modules', 'rmcommon'), count($available_mods) + count($installed_modules)); $counterModules->addCell(__('Installed', 'rmcommon'), count($installed_modules)); $counterModules->addCell(__('Available', 'rmcommon'), count($available_mods)); // Users counter $sql = "SELECT COUNT(*) FROM " . $db->prefix("users") . " WHERE level > 0"; list($active) = $db->fetchRow($db->query($sql)); $sql = "SELECT COUNT(*) FROM " . $db->prefix("users") . " WHERE level <= 0"; list($inactive) = $db->fetchRow($db->query($sql)); $counterUsers = new Common\Widgets\Counter(['id' => 'counter-users', 'color' => 'blue', 'icon' => 'svg-rmcommon-users2', 'class' => 'animated bounceIn']); $total = $active + $inactive; $counterUsers->addCell(__('Users', 'rmcommon'), $total); $counterUsers->addCell(__('Active', 'rmcommon'), $active); $counterUsers->addCell(__('Inactive', 'rmcommon'), $inactive); $ratio = $active / ($active + $inactive); if ($ratio < 1) { $ratio = number_format($ratio, 2); } $counterUsers->addCell(__('Ratio', 'rmcommon'), $ratio * 100 . '%'); // Comments counter $counterComments = new Common\Widgets\Counter(['id' => 'counter-comments', 'color' => 'green', 'icon' => 'svg-rmcommon-comments', 'class' => 'animated bounceIn']); list($approved) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix("mod_rmcommon_comments") . " WHERE status = 'approved'")); list($waiting) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix("mod_rmcommon_comments") . " WHERE status != 'approved'")); $counterComments->addCell(__('Comments', 'rmcommon'), $approved > 0 || $waiting > 0 ? $approved + $waiting : '0'); $counterComments->addCell(__('Approved', 'rmcommon'), $approved); $counterComments->addCell(__('Waiting', 'rmcommon'), $waiting); $ratio = $approved / ($approved + $waiting); if ($ratio < 1) { $ratio = number_format($ratio, 2); } $counterComments->addCell(__('Ratio', 'rmcommon'), $ratio * 100 . '%'); $counterSystem = new Common\Widgets\Counter(['id' => 'counter-system', 'color' => 'deep-orange', 'icon' => 'svg-rmcommon-rmcommon', 'class' => 'animated bounceIn']); $counterSystem->addCell(__('Current Version', 'rmcommon'), RMModules::get_module_version('rmcommon', false)); $counterSystem->addCell('XOOPS', str_replace('XOOPS ', '', XOOPS_VERSION)); $version = explode('-', phpversion()); $counterSystem->addCell('PHP', $version[0]); unset($version); if (method_exists($db, 'getServerVersion')) { $version = explode("-", $db->getServerVersion()); } else { $version = '--'; } $counterSystem->addCell('MySQL', $version[0]); // Management Tools $managementTools[] = (object) ['caption' => __('Modules', 'rmcommon'), 'link' => 'modules.php', 'icon' => 'svg-rmcommon-module', 'color' => 'pink']; $managementTools[] = (object) ['caption' => __('Blocks', 'rmcommon'), 'link' => 'blocks.php', 'icon' => 'svg-rmcommon-blocks', 'color' => 'blue']; $managementTools[] = (object) ['caption' => __('Users', 'rmcommon'), 'link' => 'users.php', 'icon' => 'svg-rmcommon-user2', 'color' => 'deep-orange']; $managementTools[] = (object) ['caption' => __('Groups', 'rmcommon'), 'link' => 'groups.php', 'icon' => 'svg-rmcommon-users2', 'color' => 'green']; $managementTools[] = (object) ['caption' => __('Images', 'rmcommon'), 'link' => 'images.php', 'icon' => 'svg-rmcommon-images', 'color' => 'purple']; $managementTools[] = (object) ['caption' => __('Comments', 'rmcommon'), 'link' => 'comments.php', 'icon' => 'svg-rmcommon-comments', 'color' => 'red']; $managementTools[] = (object) ['caption' => __('Plugins', 'rmcommon'), 'link' => 'plugins.php', 'icon' => 'svg-rmcommon-plug', 'color' => 'orange']; $managementTools[] = (object) ['caption' => __('Updates', 'rmcommon'), 'link' => 'updates.php', 'icon' => 'svg-rmcommon-update', 'color' => 'teal']; $managementTools[] = (object) ['caption' => __('Preferences', 'rmcommon'), 'link' => 'settings.php?action=configure&mod=rmcommon', 'icon' => 'svg-rmcommon-wrench', 'color' => 'light-blue']; $managementTools = RMEvents::get()->trigger('rmcommon.get.system.tools', $managementTools); // Load recent comments $sql = "SELECT * FROM " . $db->prefix("mod_rmcommon_comments") . " ORDER BY `posted` DESC LIMIT 0, 5"; $result = $db->query($sql); $comments = []; while ($row = $db->fetchArray($result)) { $com = new RMComment(); $com->assignVars($row); // Editor data if (!isset($ecache[$com->getVar('user')])) { $ecache[$com->getVar('user')] = new RMCommentUser($com->getVar('user')); } $editor = $ecache[$com->getVar('user')]; if ($editor->getVar('xuid') > 0) { if (!isset($ucache[$editor->getVar('xuid')])) { $ucache[$editor->getVar('xuid')] = new XoopsUser($editor->getVar('xuid')); } $user = $ucache[$editor->getVar('xuid')]; $poster = (object) array('id' => $user->getVar('uid'), 'name' => $user->getVar('uname'), 'email' => $user->getVar('email'), 'posts' => $user->getVar('posts'), 'avatar' => $user->getVar('image') != '' && $user->getVar('image') != 'blank.gif' ? XOOPS_UPLOAD_URL . '/' . $user->getVar('image') : RMCURL . '/images/avatar.gif', 'rank' => $user->rank()); } else { $poster = (object) array('id' => 0, 'name' => $editor->getVar('name'), 'email' => $editor->getVar('email'), 'posts' => 0, 'avatar' => RMCURL . '/images/avatar.gif', 'rank' => ''); } // Get item $cpath = XOOPS_ROOT_PATH . '/modules/' . $row['id_obj'] . '/class/' . $row['id_obj'] . 'controller.php'; if (is_file($cpath)) { if (!class_exists(ucfirst($row['id_obj']) . 'Controller')) { include_once $cpath; } $class = ucfirst($row['id_obj']) . 'Controller'; $controller = new $class(); $item = $controller->get_item($row['params'], $com); if (method_exists($controller, 'get_item_url')) { $item_url = $controller->get_item_url($row['params'], $com); } } else { $item = __('Unknow', 'rmcommon'); $item_url = ''; } $text = TextCleaner::getInstance()->clean_disabled_tags(TextCleaner::getInstance()->popuplinks(TextCleaner::getInstance()->nofollow(TextCleaner::getInstance()->truncate($com->getVar('content'), 100)))); $comments[] = (object) array('id' => $row['id_com'], 'text' => $text, 'poster' => $poster, 'date' => formatTimestamp($com->getVar('posted'), 'l'), 'ip' => $com->getVar('ip'), 'item' => $item, 'item_url' => $item_url, 'module' => $row['id_obj'], 'status' => $com->getVar('status')); } // Get dashboard widgets $dashboardPanels = []; $dashboardPanels = RMEvents::get()->trigger('rmcommon.dashboard.panels', $dashboardPanels); RMTemplate::getInstance()->add_body_class('dashboard'); xoops_cp_header(); //RMTemplate::get()->add_style('dashboard.min.css', 'rmcommon'); RMTemplate::get()->add_style('pagenav.css', 'rmcommon'); RMTemplate::get()->add_help(__('Dashboard Help', 'rmcommon'), 'http://www.xoopsmexico.net/docs/common-utilities/uso-de-common-utilities/standalone/1/#dashboard'); include RMTemplate::get()->path('rmc-dashboard.php', 'module', 'rmcommon'); xoops_cp_footer(); }
/** * HTML Editor * @since 1.5 */ private function renderHTML() { global $cuIcons; $this->renderAttributeString(); RMTemplate::get()->add_script("quicktags.min.js", 'rmcommon', array('footer' => 1)); RMTemplate::get()->add_style('html-editor.min.css', 'rmcommon'); RMTemplate::getInstance()->add_fontawesome(); RMTemplate::get()->add_inline_script('edToolbar("' . $this->get('id') . '");', 1); $rtn = "\n<div class='ed-container html_editor_container' style='width: " . $this->get('width') . ";' id='" . $this->get('id') . "-ed-container'>"; $plugins = array(); // Get external plugins $plugins = array(); $plugins = RMEvents::get()->run_event('rmcommon.editor.top.plugins', $plugins, 'html', $this->get('id')); if (!empty($plugins)) { $rtn .= '<div class="ed-plugins"> <span class="plugin">' . implode('</span><span class="plugin">', $plugins) . '</span> <button type="button" class="plugin full-screen" accesskey="s" title="' . __('Toggle full screen [S]', 'rmcommon') . '">' . $cuIcons->getIcon('svg-rmcommon-fullscreen') . $cuIcons->getIcon('svg-rmcommon-exit-fullscreen') . '</button> </div>'; } $plugins = array(); $plugins = RMEvents::get()->run_event('rmcommon.html.editor.plugins', $plugins, $this->get('id')); $rtn .= "<div class=\"quicktags\"><div id=\"ed_toolbar_" . $this->get('id') . "\"></div></div>" . (!empty($plugins) ? "<div class='ed-qt-plugins'><span class='plugin'>" . implode('</span><span class="plugin">', $plugins) . "</span></div>" : '') . "\n\t\t<div class='txtarea-container' style='height: " . $this->get('height') . ";'><textarea id='" . $this->get('id') . "' name='" . $this->get('name') . "' class='" . $this->get('class') . "'>" . $this->get('default') . "</textarea></div>\n\t\t</div>"; return $rtn; }
} // JS Language include RMCPATH . '/js/cu-js-language.php'; !defined('RMCLOCATION') ? define('RMCLOCATION', '') : true; !defined('RMCSUBLOCATION') ? define('RMCSUBLOCATION', '') : true; // Scripts $heliumScripts = \RMTemplate::get()->get_scripts(true); $heliumStyles = \RMTemplate::get()->get_styles(true); // User Rank $userRank = $xoopsUser->rank(); // Help $helpLinks = RMTemplate::getInstance()->help(); // Body classess if (!array_key_exists('sidebar', $_COOKIE) || $_COOKIE['sidebar'] == 'visible') { RMTemplate::getInstance()->add_body_class('sidebar'); } if (RMBreadCrumb::get()->count() > 0) { RMTemplate::getInstance()->add_body_class('with-breadcrumb'); } // The logo $logoHelium = trim($cuSettings->helium_logo); if ('' == $logoHelium) { $logoHelium = HELIUM_URL . '/images/logo-he.svg'; } if (substr($logoHelium, -4) == '.svg') { $logoHelium = file_get_contents($logoHelium); } else { $logoHelium = '<img src="' . $logoHelium . '">'; } // Display theme include_once HELIUM_PATH . '/theme.php';
<?php // $Id: blocks.php 952 2012-05-06 23:23:46Z i.bitcero $ // -------------------------------------------------------------- // Red México Common Utilities // A framework for Red México Modules // Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- define('RMCLOCATION', 'about'); include '../../include/cp_header.php'; RMTemplate::getInstance()->add_style('about.min.css', 'rmcommon', ['id' => 'about-css']); RMTemplate::get()->header(); ?> <div class="cu-box welcome-box"> <div class="panel-body"> <div class="media"> <div class="media-left"> <?php echo $cuIcons->getIcon('svg-rmcommon-rmcommon', ['class' => 'media-object rmcommon-logo']); ?> </div> <div class="media-body"> <h1 class="media-heading"> Welcome to Common Utilities </h1> <p class="lead"> Thanks for using <strong><?php echo RMModules::get_module_version('rmcommon');
/** * Render the editor * @return string */ public function render() { global $cuIcons; RMTemplate::get()->add_script('codemirror.js', 'rmcommon', array('footer' => 1, 'directory' => 'api/editors/markdown')); RMTemplate::get()->add_script('mode/overlay.js', 'rmcommon', array('footer' => 1, 'directory' => 'api/editors/markdown')); RMTemplate::get()->add_script('mode/xml.js', 'rmcommon', array('footer' => 1, 'directory' => 'api/editors/markdown')); RMTemplate::get()->add_script('mode/markdown.js', 'rmcommon', array('footer' => 1, 'directory' => 'api/editors/markdown')); RMTemplate::get()->add_script('mode/gfm.js', 'rmcommon', array('footer' => 1, 'directory' => 'api/editors/markdown')); RMTemplate::get()->add_script('mode/meta.js', 'rmcommon', array('footer' => 1, 'directory' => 'api/editors/markdown')); RMTemplate::get()->add_script('markdown-editor.min.js', 'rmcommon', array('footer' => 1, 'directory' => 'api/editors/markdown')); RMTemplate::get()->add_style('markdown-editor.min.css', 'rmcommon', array('directory' => 'api/editors/markdown')); RMTemplate::getInstance()->add_fontawesome(); RMTemplate::get()->add_inline_script($this->render_js(), 1); $plugins = array(); $plugins = RMEvents::get()->run_event('rmcommon.editor.top.plugins', $plugins, 'markdown', $this->id); $rtn = "<div class='ed-container' id='" . $this->id . "-ed-container'>"; $rtn .= " <div class='ed-plugins' id='" . $this->id . "-ed-plugins'>\n\t\t <span class='plugin'>" . implode('</span> <span class="plugin">', $plugins) . '</span> <button type="button" class="plugin full-screen" accesskey="s" title="' . __('Toggle full screen [S]', 'rmcommon') . '"> ' . $cuIcons->getIcon('svg-rmcommon-fullscreen') . $cuIcons->getIcon('svg-rmcommon-exit-fullscreen') . ' </button> </div>'; $rtn .= " <div class='ed-buttons' id='" . $this->id . "-buttons-container'>"; $rtn .= ' <div class="toolbar-1"></div>'; $rtn .= " </div>"; $rtn .= " <div class=\"txtarea-container\"" . $this->render_attributes() . "><textarea id='" . $this->id . "' name='" . $this->id . "'>" . $this->content . "</textarea></div>"; $rtn .= "</div>"; return $rtn; }
?> ', noData: '<?php _e('There are not data to import!', 'mywords'); ?> ', noArticles: '<?php _e('There are not articles to import!', 'mywords'); ?> ', categoriesDone: '<?php _e('Categories importing done! Starting articles importing...', 'mywords'); ?> ', importingCategory: '<?php _e('Importing category %s...', 'mywords'); ?> ', articlesDone: '<?php _e('Articles importing done!', 'mywords'); ?> ', importingArticle: '<?php _e('Importing article %s...', 'mywords'); ?> ', }; <?php $language = ob_get_clean(); RMTemplate::getInstance()->add_inline_script($language, 1);
public function render() { //$script = "<script type='text/javascript'>\n"; $script = "var lburl = '" . RMCURL . "/plugins/lightbox';\n"; $config = RMSettings::plugin_settings('lightbox', true); $params = ''; foreach ($this->options as $name => $value) { if ($value == 'true' || $value == 'false') { $value = $value; } elseif (is_string($value)) { $value = "'" . $value . "'"; } $params .= $params == '' ? "{$name}: {$value}" : ", {$name}: {$value}"; } if ($config->configs != '') { $params .= ", {$config->configs}"; } $script .= "var lb_params = {" . $params . "};\n"; if (!defined('RM_LB_PARAMS')) { define('RM_LB_PARAMS', 1); } $script .= "\$(function(){\n"; if (is_array($this->elements)) { foreach ($this->elements as $element) { $script .= "\$(\"{$element}\").colorbox(lb_params);\n"; } } else { $script .= "\$(\"{$this->elements}\").colorbox(lb_params);\n"; } $script .= "});\n"; RMTemplate::getInstance()->add_script('jquery.colorbox-min.js', 'rmcommon', array('directory' => 'plugins/lightbox')); RMTemplate::getInstance()->add_inline_script($script, 1); return $script; }
public static function write_rewrite_js() { $paths = self::cu_settings('modules_path'); $content = "var cu_modules = {\n"; foreach ($paths as $module => $path) { $content .= "{$module}: '" . rtrim($path, '/') . "',\n"; } $content .= "};\n"; RMTemplate::getInstance()->add_inline_script($content, 1); }