function Spaw($config) { $this->instance = $config['name']; $this->content = $config['content']; parent::SpawEditor($this->instance, $this->content); // load plugin configs $spaw_pgdir = SpawConfig::getStaticConfigValue('SPAW_ROOT') . 'plugins/'; if (is_dir($spaw_pgdir)) { if ($spaw_dh = opendir($spaw_pgdir)) { while (($spaw_pg = readdir($spaw_dh)) != false) { if ($spaw_pg != '.' && $spaw_pg != '..') { if (is_dir($spaw_pgdir . $spaw_pg . '/config')) { if ($spaw_pgdh = opendir($spaw_pgdir . $spaw_pg . '/config')) { while (($spaw_fn = readdir($spaw_pgdh)) !== false) { if ($spaw_fn != '.' && $spaw_fn != '..' && !is_dir($spaw_pgdir . $spaw_pg . '/config/' . $spaw_fn)) { include $spaw_pgdir . $spaw_pg . '/config/' . $spaw_fn; } } closedir($spaw_pgdh); } } } } closedir($spaw_dh); } } }
/** * Loads theme data * @access private */ function loadData() { $pgdir = SpawConfig::getStaticConfigValue("SPAW_ROOT") . 'plugins/'; if (is_dir($pgdir)) { // load theme settings if ($dh = opendir($pgdir)) { while (($pg = readdir($dh)) !== false) { if (file_exists($pgdir . $pg . '/lib/theme/' . $this->name . '/config/theme.config.php')) { // load theme config file for each plugin include $pgdir . $pg . '/lib/theme/' . $this->name . '/config/theme.config.php'; // load default styles for "core" only if ($pg == "core") { if (isset($default_tb_button_style)) { $this->default_tb_button_style = $default_tb_button_style; unset($default_tb_button_style); } if (isset($default_tb_image_style)) { $this->default_tb_image_style = $default_tb_image_style; unset($default_tb_image_style); } if (isset($default_tb_dropdown_style)) { $this->default_tb_dropdown_style = $default_tb_dropdown_style; unset($default_tb_dropdown_style); } if (isset($default_tb_button_css_class)) { $this->default_tb_button_css_class = $default_tb_button_css_class; unset($default_tb_button_css_class); } if (isset($default_tb_image_css_class)) { $this->default_tb_image_css_class = $default_tb_image_css_class; unset($default_tb_image_css_class); } if (isset($default_tb_dropdown_css_class)) { $this->default_tb_dropdown_css_class = $default_tb_dropdown_css_class; unset($default_tb_dropdown_css_class); } if (isset($default_tb_button_events)) { $this->default_tb_button_events = $default_tb_button_events; unset($default_tb_button_events); } } if (isset($custom_tbi_styles)) { $this->custom_tbi_styles = array_merge($this->custom_tbi_styles, $custom_tbi_styles); unset($custom_tbi_styles); } if (isset($custom_tbi_css_classes)) { $this->custom_tbi_css_classes = array_merge($this->custom_tbi_css_classes, $custom_tbi_css_classes); unset($custom_tbi_css_classes); } if (isset($custom_tbi_events)) { $this->custom_tbi_events = array_merge($this->custom_tbi_events, $custom_tbi_events); unset($custom_tbi_events); } } } closedir($dh); } // load template if (file_exists($pgdir . "core/lib/theme/" . $this->name . "/templates/editor.tpl")) { $fn = $pgdir . "core/lib/theme/" . $this->name . "/templates/editor.tpl"; $handle = fopen($fn, "r"); $this->template = fread($handle, filesize($fn)); fclose($handle); } // load editor template for floating toolbar mode if (file_exists($pgdir . "core/lib/theme/" . $this->name . "/templates/editor_floating.tpl")) { $fn = $pgdir . "core/lib/theme/" . $this->name . "/templates/editor_floating.tpl"; $handle = fopen($fn, "r"); $this->template_floating = fread($handle, filesize($fn)); fclose($handle); } // load toolbar template for floating toolbar mode if (file_exists($pgdir . "core/lib/theme/" . $this->name . "/templates/toolbar_floating.tpl")) { $fn = $pgdir . "core/lib/theme/" . $this->name . "/templates/toolbar_floating.tpl"; $handle = fopen($fn, "r"); $this->template_toolbar = fread($handle, filesize($fn)); fclose($handle); } // load template for standard dialog header if (file_exists($pgdir . "core/lib/theme/" . $this->name . "/templates/dialog_header.tpl")) { $fn = $pgdir . "core/lib/theme/" . $this->name . "/templates/dialog_header.tpl"; $handle = fopen($fn, "r"); $this->template_dialog_header = fread($handle, filesize($fn)); fclose($handle); } // load template for standard dialog footer if (file_exists($pgdir . "core/lib/theme/" . $this->name . "/templates/dialog_footer.tpl")) { $fn = $pgdir . "core/lib/theme/" . $this->name . "/templates/dialog_footer.tpl"; $handle = fopen($fn, "r"); $this->template_dialog_footer = fread($handle, filesize($fn)); fclose($handle); } } }
<?php /** * SPAW Editor v.2 Main include file * * Include this file in your script * * @package spaw2 * @author Alan Mendelevich <*****@*****.**> * @copyright UAB Solmetra */ require_once str_replace('\\\\', '/', dirname(__FILE__)) . '/config/config.php'; require_once str_replace('\\\\', '/', dirname(__FILE__)) . '/class/editor.class.php'; // load plugin configs $spaw_pgdir = SpawConfig::getStaticConfigValue('SPAW_ROOT') . 'plugins/'; if (is_dir($spaw_pgdir)) { if ($spaw_dh = opendir($spaw_pgdir)) { while (($spaw_pg = readdir($spaw_dh)) != false) { if ($spaw_pg != '.' && $spaw_pg != '..') { if (is_dir($spaw_pgdir . $spaw_pg . '/config')) { if ($spaw_pgdh = opendir($spaw_pgdir . $spaw_pg . '/config')) { while (($spaw_fn = readdir($spaw_pgdh)) !== false) { if ($spaw_fn != '.' && $spaw_fn != '..' && !is_dir($spaw_pgdir . $spaw_pg . '/config/' . $spaw_fn)) { include $spaw_pgdir . $spaw_pg . '/config/' . $spaw_fn; } } closedir($spaw_pgdh); } } } }
SpawConfig::setStaticConfigItem("table_styles", array('' => 'Normal', 'style1' => 'Style No.1', 'style2' => 'Style No.2')); // data for style (css class) dropdown in table cell properties dialog SpawConfig::setStaticConfigItem("table_cell_styles", array('' => 'Normal', 'style1' => 'Style No.1', 'style2' => 'Style No.2')); // data for style (css class) dropdown in image properties dialog SpawConfig::setStaticConfigItem("image_styles", array('' => 'Normal', 'style1' => 'Style No.1', 'style2' => 'Style No.2')); // data for fonts dropdown list SpawConfig::setStaticConfigItem("dropdown_data_core_fontname", array('' => 'Default', 'Arial' => 'Arial', 'Courier' => 'Courier', 'Tahoma' => 'Tahoma', 'Times New Roman' => 'Times', 'Verdana' => 'Verdana')); // data for fontsize dropdown list SpawConfig::setStaticConfigItem("dropdown_data_core_fontsize", array('' => 'Default', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6')); // data for paragraph dropdown list SpawConfig::setStaticConfigItem("dropdown_data_core_formatBlock", array('<p>' => 'Normal', '<H1>' => 'Heading 1', '<H2>' => 'Heading 2', '<H3>' => 'Heading 3', '<H4>' => 'Heading 4', '<H5>' => 'Heading 5', '<H6>' => 'Heading 6', '<pre>' => 'Preformatted', '<address>' => 'Address')); // data for link targets drodown list in hyperlink dialog SpawConfig::setStaticConfigItem("a_targets", array('_self' => 'Self', '_blank' => 'Blank', '_top' => 'Top', '_parent' => 'Parent')); // data for quick links dropdown (new in 2.0.6) SpawConfig::setStaticConfigItem("quick_links", array('http://spaweditor.com/' => 'SPAW Editor', 'http://forums.solmetra.com/' => 'SPAW Support Forums', 'http://blog.solmetra.com/' => 'Solmetra\'s Developer Blog'), SPAW_CFG_TRANSFER_SECURE); // toolbar sets (should start with "toolbarset_" // standard core toolbars SpawConfig::setStaticConfigItem('toolbarset_standard', array("format" => "format", "style" => "style", "edit" => "edit", "table" => "table", "plugins" => "plugins", "insert" => "insert", "tools" => "tools")); // all core toolbars SpawConfig::setStaticConfigItem('toolbarset_all', array("format" => "format", "style" => "style", "edit" => "edit", "table" => "table", "plugins" => "plugins", "insert" => "insert", "tools" => "tools", "font" => "font")); // mini core toolbars SpawConfig::setStaticConfigItem('toolbarset_mini', array("format" => "format_mini", "edit" => "edit", "tools" => "tools")); // colorpicker config SpawConfig::setStaticConfigItem('colorpicker_predefined_colors', array('black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', '#fedcba', 'aqua'), SPAW_CFG_TRANSFER_SECURE); // SpawFm plugin config: // global filemanager settings SpawConfig::setStaticConfigItem('PG_SPAWFM_SETTINGS', array('allowed_filetypes' => array('any'), 'allow_modify' => true, 'allow_upload' => true, 'max_upload_filesize' => 0, 'max_img_width' => 0, 'max_img_height' => 0, 'recursive' => false, 'allow_modify_subdirectories' => false, 'allow_create_subdirectories' => false, 'forbid_extensions' => array('php'), 'forbid_extensions_strict' => true), SPAW_CFG_TRANSFER_SECURE); //echo '/upload/img/'.'<br>'.SpawConfig::getStaticConfigValue('SPAW_DIR').'uploads/flash/'; // directories SpawConfig::setStaticConfigItem('PG_SPAWFM_DIRECTORIES', array(array('dir' => '/upload/img/', 'caption' => 'Images', 'params' => array('default_dir' => true, 'allowed_filetypes' => array('any'))), array('dir' => '/upload/files/', 'caption' => 'Files', 'params' => array('allowed_filetypes' => array('any')))), SPAW_CFG_TRANSFER_SECURE);
/** * Returns HTML and JavaScript code for the editor * @returns string */ function getHtml() { $res = ''; $this->setDefaults(); if (SpawAgent::getAgent() != SPAW_AGENT_UNSUPPORTED) { // supported browser $head_res = ''; $js_res = ''; $html_res = ''; $ssent =& SpawEditor::scriptSent(); if (!$ssent) { $head_res .= '<script type="text/javascript" src="' . SpawConfig::getStaticConfigValue("SPAW_DIR") . 'js/spaw.js.php" charset="utf-8"></script>'; $js_res .= 'SpawEngine.setSpawDir("' . SpawConfig::getStaticConfigValue("SPAW_DIR") . '");'; $ssent = true; } $objname = $this->name . '_obj'; $js_res .= 'var ' . $objname . ' = new SpawEditor("' . $this->name . '");'; $js_res .= 'SpawEngine.registerEditor(' . $objname . ');'; $js_res .= $objname . '.setTheme(SpawTheme' . $this->theme->name . ');'; $js_res .= $objname . '.setLang("' . $this->lang->lang . '");'; $js_res .= $objname . '.setOutputCharset("' . $this->lang->getOutputCharset() . '");'; $js_res .= $objname . '.stylesheet = "' . $this->stylesheet . '";'; $js_res .= $objname . '.scid = "' . $this->config->storeSecureConfig() . '";'; // add javascript or request uri config items $reqstr = ''; foreach ($this->config->config as $cfg) { if ($cfg->transfer_type & SPAW_CFG_TRANSFER_JS && is_scalar($cfg->value)) { if (is_numeric($cfg->value)) { $js_res .= $objname . '.setConfigValue("' . $cfg->name . '", ' . $cfg->value . ');'; } else { if (is_bool($cfg->value)) { $js_res .= $objname . '.setConfigValue("' . $cfg->name . '", ' . ($cfg->value ? 'true' : 'false') . ');'; } else { // string $js_res .= $objname . '.setConfigValue("' . $cfg->name . '", "' . $cfg->value . '");'; } } } if ($cfg->transfer_type & SPAW_CFG_TRANSFER_REQUEST && is_scalar($cfg->value)) { if (is_bool($cfg->value)) { $reqstr .= '&' . $cfg->name . '=' . ($cfg->value ? 'true' : 'false'); } else { // string, number $reqstr .= '&' . $cfg->name . '=' . $cfg->value; } } } if ($reqstr != '') { } $js_res .= $objname . '.setConfigValue("__request_uri", "' . $reqstr . '");'; $tpl = ''; // template $fedtpl = ''; // editor template in floating mode $other_present = false; $tbfrom = $this->getToolbarFrom(); // parse template if (!$this->getFloatingMode()) { // standard mode $tpl = $this->theme->getTemplate(); } else { // floating mode $tpl = '<span id="' . $this->name . '_toolbox" '; $tpl .= ' style="z-index: 10000; position: absolute; cursor: move;"'; $tpl .= ' onMouseDown="' . $objname . '.floatingMouseDown(event);"'; $tpl .= ' >'; $tpl .= $this->theme->getTemplateToolbar(); $tpl .= '</span>'; $tpl .= $this->theme->getTemplateFloating(); } // if this is the main toolbar instance, add toolbars if ($tbfrom->name == $this->name) { foreach ($this->toolbars as $key => $tb) { if (strpos($tpl, '{SPAW TB=' . strtoupper($key) . '}')) { // toolbar placeholder found $tpl = preg_replace('/(\\{SPAW TB=' . strtoupper($key) . '\\})(.*)(\\{SPAW TOOLBAR\\})(.*)(\\{\\/SPAW TB\\})/sU', '$2' . $tb->renderToolbar($this->name, $this->theme) . '$4', $tpl); } else { // add to other toolbar placeholder $tpl = preg_replace('/(\\{SPAW TB=_OTHER\\})(.*)(\\{SPAW TOOLBAR\\})(.*)(\\{\\/SPAW TB\\})/sU', '$1$2' . $tb->renderToolbar($this->name, $this->theme) . '{SPAW TOOLBAR}$4$5', $tpl); $other_present = true; } } } elseif ($this->getFloatingMode() && $this->toolbar_from->name != $this->name) { // editor template for floating mode slave $tpl = $this->theme->getTemplateFloating(); } // replace all spaw dir references $tpl = str_replace("{SPAW DIR}", SpawConfig::getStaticConfigValue("SPAW_DIR"), $tpl); if ($this->getFloatingMode()) { $js_res .= $objname . '.floating_mode = true;'; } // register this editor as controlled by other editors toolbar $js_res .= $tbfrom->name . '_obj.addControlledEditor(' . $objname . ');' . "\n"; $js_res .= $objname . '.controlled_by = ' . $tbfrom->name . '_obj;' . "\n"; // remove unused toolbars if ($other_present) { // remove other toolbar tags leaving inner content intact $tpl = preg_replace('/(\\{SPAW TB=_OTHER\\})(.*)(\\{SPAW TOOLBAR\\})(.*)(\\{\\/SPAW TB\\})/sU', '$2$4', $tpl); } // remove all toolbar tags and inner code $tpl = preg_replace('/(\\{SPAW TB=[^\\}]*\\})(.*)(\\{\\/SPAW TB\\})/sU', '', $tpl); // pages and tabs // setup tab templates $tabtpl = ''; $atabtpl = ''; if (sizeof($this->pages) > 1) { // tab template if (preg_match("/(\\{SPAW TABSTRIP\\})(.*)(\\{SPAW TAB\\})(.*)(\\{\\/SPAW TAB\\})(.*)(\\{\\/SPAW TABSTRIP\\})/sU", $tpl, $matches)) { $tabtpl = $matches[4]; } // active tab template if (preg_match("/(\\{SPAW TABSTRIP\\})(.*)(\\{SPAW TAB ACTIVE\\})(.*)(\\{\\/SPAW TAB\\})(.*)(\\{\\/SPAW TABSTRIP\\})/sU", $tpl, $matches)) { $atabtpl = $matches[4]; } // remove tabstrip markers and mark tab place $tpl = preg_replace('/(\\{SPAW TABSTRIP\\})(.*)(\\{\\/SPAW TABSTRIP\\})/sU', '$2', $tpl); $tpl = preg_replace('/(\\{SPAW TAB ACTIVE\\})(.*)(\\{\\/SPAW TAB\\})/sU', '{SPAW TABS}', $tpl); $tpl = preg_replace('/(\\{SPAW TAB\\})(.*)(\\{\\/SPAW TAB\\})/sU', '', $tpl); } else { // tabs not needed, remove tab strip $tpl = preg_replace('/(\\{SPAW TABSTRIP\\})(.*)(\\{\\/SPAW TABSTRIP\\})/sU', '', $tpl); } // mode strip if (strpos($tpl, '{SPAW MODESTRIP}')) { if ($this->isModeStripVisible()) { // modestrip placeholder found $mstrip = SpawToolbar::getToolbar("mode_strip"); $mstrip->editor =& $this; $tpl = preg_replace('/(\\{SPAW MODESTRIP\\})(.*)(\\{SPAW MODES\\})(.*)(\\{\\/SPAW MODESTRIP\\})/sU', '$2' . $mstrip->renderToolbar($this->name, $this->theme) . '$4', $tpl); } else { // just remove the placeholder $tpl = preg_replace('/(\\{SPAW MODESTRIP\\})(.*)(\\{\\/SPAW MODESTRIP\\})/sU', '', $tpl); } } // statusbar if (strpos($tpl, '{SPAW STATUSBAR}')) { if ($this->isStatusBarVisible()) { // modestrip placeholder found if ($this->isResizingGripVisible() && $this->config->getConfigValue('resizing_directions') != 'none') { $grip = '<img src="' . SpawConfig::getStaticConfigValue("SPAW_DIR") . 'plugins/core/lib/theme/' . $this->theme->name . '/img/sizing_grip.gif" border="0" style="cursor: se-resize;"'; $grip .= ' onmousedown="' . $objname . '.resizingGripMouseDown(event);"'; $grip .= ' unselectable="on"'; $grip .= ' alt="" />'; } else { $grip = ''; } $tpl = preg_replace('/(\\{SPAW STATUSBAR\\})(.*)(\\{SPAW STATUS\\})(.*)(\\{SPAW SIZINGGRIP\\})(.*)(\\{\\/SPAW STATUSBAR\\})/sU', '$2<span id="' . $this->name . '_status"></span>$4' . $grip . '$6', $tpl); } else { // remove status bar placeholder $tpl = preg_replace('/(\\{SPAW STATUSBAR\\})(.*)(\\{\\/SPAW STATUSBAR\\})/sU', '', $tpl); } } $pagetpl = ''; $tabstpl = ''; foreach ($this->pages as $pname => $page) { $pagetpl .= '<textarea name="' . $page->inputName . '" id="' . $pname . '" style="width: 100%; height: ' . $this->height . '; display: none; overflow: scroll;" rows="10" cols="10">' . htmlspecialchars($page->value) . '</textarea>'; $js_res .= 'var ' . $pname . '_page = new SpawEditorPage("' . $pname . '","' . htmlspecialchars($page->caption) . '","' . $page->direction . '");' . "\n"; //$js_res .= $pname.'_page.value = "'.htmlspecialchars($page->value).'";'."\n"; $js_res .= $objname . '.addPage(' . $pname . '_page);' . "\n"; $js_res .= $objname . '.getTab("' . $pname . '").template = "' . addslashes(str_replace("{SPAW TAB CAPTION}", $page->caption, $tabtpl)) . '";' . "\n"; $js_res .= $objname . '.getTab("' . $pname . '").active_template = "' . addslashes(str_replace("{SPAW TAB CAPTION}", $page->caption, $atabtpl)) . '";' . "\n"; if ($this->name == $pname) { $js_res .= $objname . '.active_page =' . $pname . '_page;' . "\n"; } $pagetpl .= '<iframe name="' . $pname . '_rEdit" id="' . $pname . '_rEdit" style="width: 100%; height: ' . $this->height . '; display: ' . ($this->name == $pname ? 'inline' : 'none') . ';" frameborder="no" src="' . SpawConfig::getStaticConfigValue("SPAW_DIR") . 'empty/empty.html?' . microtime() . '"></iframe>'; $tabstpl .= '<span id="' . $pname . '_tab" style="cursor: default;" onclick="' . $objname . '.setActivePage(\'' . $pname . '\');">' . str_replace("{SPAW TAB CAPTION}", $page->caption, $pname == $this->name ? $atabtpl : $tabtpl) . '</span>'; } $tpl = str_replace('{SPAW EDITOR}', $pagetpl, $tpl); $tpl = str_replace('{SPAW TABS}', $tabstpl, $tpl); $html_res .= '<table border="0" cellpadding="0" cellspacing="0" id="' . $this->name . '_enclosure" class="' . $this->theme->name . '" style="padding: 0px 0px 0px 0px; width: ' . $this->width . ';"><tr><td>' . $tpl . '</td></tr></table>'; $js_res .= $objname . '.onLoadHookup();' . "\n"; $res = $head_res . '<script type="text/javascript">' . "\n<!--\n" . $js_res . "\n//-->\n" . '</script>' . $html_res; } else { // standard textarea fallback foreach ($this->pages as $pname => $page) { if (sizeof($this->pages) > 1) { $res .= '<label for="' . $pname . '">' . $page->caption . '</label><br />'; } $res .= '<textarea name="' . $pname . '" id="' . $pname . '" width="' . $this->width . '" height="' . $this->height . '" style="width: ' . $this->width . '; height: ' . $this->height . ';" wrap="off">' . htmlspecialchars($page->value) . '</textarea><br />'; } } return $res; }
<?php /** * SPAW Editor v.2 Javascript file * * Outputs javascript code for the editor * @package spaw2 * @subpackage JavaScript * @author Alan Mendelevich <*****@*****.**> * @copyright UAB Solmetra */ header('Content-Type: application/x-javascript; charset=utf-8'); require_once str_replace('\\\\', '/', dirname(__FILE__)) . '/../config/config.php'; require_once str_replace('\\\\', '/', dirname(__FILE__)) . '/../class/util.class.php'; $spaw_root = SpawConfig::getStaticConfigValue("SPAW_ROOT"); $agent = SpawAgent::getAgentName(); // load main javascript for all browsers if (is_dir($spaw_root . 'js/common')) { if ($dh = opendir($spaw_root . 'js/common')) { while (($fn = readdir($dh)) !== false) { if ($fn != '.' && $fn != '..' && !is_dir($spaw_root . 'js/common/' . $fn)) { include $spaw_root . 'js/common/' . $fn; } } closedir($dh); } } // load main javascript specific for current browser if (is_dir($spaw_root . 'js/' . $agent)) { if ($dh = opendir($spaw_root . 'js/' . $agent)) { while (($fn = readdir($dh)) !== false) {
<?php // global filetypes definitions // warning: changing default filetypes may lead to unexpected behaviour SpawConfig::setStaticConfigItem('PG_SPAWFM_FILETYPES', array('any' => array('.*'), 'images' => array('.jpg', '.gif', '.png'), 'flash' => array('.swf'), 'documents' => array('.doc', '.xls', '.pdf', '.rtf', '.odt', '.ods', '.txt'), 'audio' => array('.wav', '.mp3', '.ogg', '.wma'), 'video' => array('.avi', '.mpg', '.mpeg', '.mov', '.wmv'), 'archives' => array('.zip', '.rar', '.gz')), SPAW_CFG_TRANSFER_SECURE); // filetypes icons: // default icons SpawConfig::setStaticConfigItem('PG_SPAWFM_FILETYPES_ICON_DEFAULT', array('icon' => 'ico_default.gif', 'icon_big' => 'ico_default_big.gif')); // icons for folders SpawConfig::setStaticConfigItem('PG_SPAWFM_FILETYPES_ICON_FOLDER', array('icon' => 'ico_folder.gif', 'icon_big' => 'ico_folder_big.gif')); // icons for specific filetypes (determined by their extensions) SpawConfig::setStaticConfigItem('PG_SPAWFM_FILETYPES_ICONS', array(array('extensions' => array('.jpg', '.gif', '.png'), 'icon' => 'ico_image.gif', 'icon_big' => 'ico_image_big.gif'), array('extensions' => array('.swf'), 'icon' => 'ico_flash.gif', 'icon_big' => 'ico_flash_big.gif'))); // character to separate base dir path and subdir (should be unused in filesystem names) SpawConfig::setStaticConfigItem('spawfm_path_separator', '|', SPAW_CFG_TRANSFER_JS);
/** * Gets global value for the element of config item provided item's value is an array * @param string $name Config item name * @param mixed $index Array index * @returns mixed Element value */ function getStaticConfigValueElement($name, $index) { $cfg_item = SpawConfig::getStaticConfigItem($name); if ($cfg_item && is_array($cfg_item->value) && !empty($cfg_item->value[$index])) { return $cfg_item->value[$index]; } else { return NULL; } }
/** * Returns message string * @param string $message Message id * @param string $block Block id * @param string $module Module name * @returns string */ function getMessage($message, $block = '', $module = '') { $_module = $module == '' ? $this->module : $module; $_block = $block == '' ? $this->block : $block; if (empty($this->lang_data[$_module])) { // load module data $this->loadData($_module); } $msg = ''; if (!empty($this->lang_data[$_module][$_block][$message])) { $msg = $this->lang_data[$_module][$_block][$message]; } else { if (!empty($this->en_lang_data[$_module][$_block][$message])) { $msg = $this->en_lang_data[$_module][$_block][$message]; } } if ($msg != '') { if (SpawConfig::getStaticConfigValue("USE_ICONV") && isset($this->output_charset) && $this->charset != $this->output_charset) { // convert charsets (ignore illegal characters) $msg = iconv($this->charset, $this->output_charset . '//IGNORE', $msg); } // return message return $msg; } else { // return empty string return ''; } }
die("illegal module name"); } $dialog = SpawVars::getGetVar("dialog"); if (strpos($dialog, '/') || strpos($dialog, "\\")) { die("illegal dialog name"); } $lang = new SpawLang(SpawVars::getGetVar("lang")); $charset = $lang->getCharset(); if (SpawVars::getGetVar('charset') != '') { $charset = SpawVars::getGetVar('charset'); $lang->setOutputCharset($charset); } if (SpawVars::getGetVar("scid") != '' && session_id() == '') { session_start(); } $config = new SpawConfig(); $config->restoreSecureConfig(SpawVars::getGetVar("scid")); $theme = SpawTheme::getTheme(SpawVars::getGetVar("theme")); $htpl = $theme->getTemplateDialogHeader(); $htpl = str_replace('{SPAW DIALOG TITLE}', $lang->m('title', $dialog, $module), $htpl); $htpl = str_replace('{SPAW DIR}', SpawConfig::getStaticConfigValue('SPAW_DIR'), $htpl); $ftpl = $theme->getTemplateDialogFooter(); $ftpl = str_replace('{SPAW DIR}', SpawConfig::getStaticConfigValue('SPAW_DIR'), $ftpl); ob_start(); ?> <html> <head> <title><?php echo $lang->m('title', $dialog, $module); ?>
// data for fonts dropdown list SpawConfig::setStaticConfigItem("dropdown_data_core_fontname", array('' => 'Default', 'Arial' => 'Arial', 'Courier' => 'Courier', 'Tahoma' => 'Tahoma', 'Times New Roman' => 'Times', 'Verdana' => 'Verdana')); // data for fontsize dropdown list SpawConfig::setStaticConfigItem("dropdown_data_core_fontsize", array('' => 'Сбросить настройки', '1' => '1', '2' => '2', '3' => 'Стандартный', '4' => '4', '5' => '5', '6' => '6')); // data for paragraph dropdown list SpawConfig::setStaticConfigItem("dropdown_data_core_formatBlock", array('<p>' => 'Normal', '<H1>' => 'Heading 1', '<H2>' => 'Heading 2', '<H3>' => 'Heading 3', '<H4>' => 'Heading 4', '<H5>' => 'Heading 5', '<H6>' => 'Heading 6', '<pre>' => 'Preformatted', '<a href=javascript:void(0)>' => 'прозрачность', '<address>' => 'Address')); // data for link targets drodown list in hyperlink dialog SpawConfig::setStaticConfigItem("a_targets", array('_self' => 'Self', '_blank' => 'Blank', '_top' => 'Top', '_parent' => 'Parent')); // data for quick links dropdown (new in 2.0.6) SpawConfig::setStaticConfigItem("quick_links", array('http://sinergi.ru/' => 'Сайт Южного Окружного Управления Образованием г.Москвы.', 'http://www.educom.ru/' => 'официальный интернет-сайт Департамента образования г.Москвы', 'http://www.uao.mos.ru/' => 'официальный сайт префектуры Южного административного округа'), SPAW_CFG_TRANSFER_SECURE); // toolbar sets (should start with "toolbarset_" // standard core toolbars SpawConfig::setStaticConfigItem('toolbarset_standard', array("format" => "format", "style" => "style", "edit" => "edit", "table" => "table", "plugins" => "plugins", "insert" => "insert", "tools" => "tools", "font" => "font")); // all core toolbars SpawConfig::setStaticConfigItem('toolbarset_all', array("format" => "format", "style" => "style", "edit" => "edit", "table" => "table", "plugins" => "plugins", "insert" => "insert", "tools" => "tools", "font" => "font")); // mini core toolbars SpawConfig::setStaticConfigItem('toolbarset_mini', array("format" => "format_mini", "edit" => "edit", "tools" => "tools")); // img core toolbars SpawConfig::setStaticConfigItem('toolbarset_img', array("insert" => "insert_img")); // mini + img core toolbars SpawConfig::setStaticConfigItem('toolbarset_mini_img', array("format" => "format_mini", "edit" => "edit", "tools" => "tools", "insert" => "insert_img")); // mini + img + color core toolbars SpawConfig::setStaticConfigItem('toolbarset_mini_font', array("format" => "format", "edit" => "edit", "tools" => "tools", "insert" => "insert_img")); // colorpicker config SpawConfig::setStaticConfigItem('colorpicker_predefined_colors', array('black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', '#fedcba', 'aqua'), SPAW_CFG_TRANSFER_SECURE); // SpawFm plugin config: // global filemanager settings SpawConfig::setStaticConfigItem('PG_SPAWFM_SETTINGS', array('allowed_filetypes' => array('any'), 'allow_modify' => true, 'allow_upload' => true, 'chmod_to' => 0777, 'max_upload_filesize' => 5000000, 'max_img_width' => 0, 'max_img_height' => 0, 'recursive' => true, 'allow_modify_subdirectories' => true, 'allow_create_subdirectories' => true, 'forbid_extensions' => array('php'), 'forbid_extensions_strict' => true), SPAW_CFG_TRANSFER_SECURE); // directories SpawConfig::setStaticConfigItem('PG_SPAWFM_DIRECTORIES', array(array('dir' => '/uploads/flash/', 'caption' => 'Flash movies', 'params' => array('allowed_filetypes' => array('flash', 'video'))), array('dir' => '/uploads/images/', 'caption' => 'Images', 'params' => array('default_dir' => true, 'allowed_filetypes' => array('images'))), array('dir' => '/uploads/files/', 'caption' => 'Files', 'params' => array('allowed_filetypes' => array('documents', 'archives')))), SPAW_CFG_TRANSFER_SECURE);
/** * Renders code for specified toolbar * @param string $prefix prefix to use for id's (editor name) * @param SpawTheme $theme theme/skin to use * @returns string */ function renderToolbar($prefix, $theme) { $js_res = ''; $html_res = '<span style="white-space: nowrap;">'; $pgdir = SpawConfig::getStaticConfigValue("SPAW_DIR") . 'plugins/'; $i = 0; if ($this->items) { foreach ($this->items as $obj) { if (is_object($obj) && $obj->agent & SpawAgent::getAgent()) { $id = $prefix . '_' . $this->name . '_' . $i; switch (strtolower(get_class($obj))) { case "spawtbimage": $js_res .= $prefix . '_obj.addToolbarItem(new SpawTbImage("' . $obj->module . '","' . $obj->name . '","' . $id . '"),"' . $this->name . '");'; $html_res .= '<img id="' . $id . '" src="' . $pgdir . $obj->module . '/lib/theme/' . $theme->name . '/img/tb_' . $obj->name . '.gif"'; if ($theme->isCustomStyleTbi($obj->name)) { $html_res .= ' style="' . $theme->getCustomTbiStyle($obj->name) . '"'; } elseif ($theme->getDefaultTbImageStyle()) { $html_res .= ' style="' . $theme->getDefaultTbImageStyle() . '"'; } if ($theme->isCustomCssClassTbi($obj->name)) { $html_res .= ' class="' . $theme->getCustomTbiCssClass($obj->name) . '"'; } elseif ($theme->getDefaultTbImageCssClass()) { $html_res .= ' class="' . $theme->getDefaultTbImageCssClass() . '"'; } $html_res .= ' alt="" />'; break; case "spawtbbutton": $img_src = $obj->module . '/lib/theme/' . $theme->name . '/img/tb_' . $obj->name . '.gif'; if (!file_exists(SpawConfig::getStaticConfigValue("SPAW_ROOT") . 'plugins/' . $img_src)) { // use default plugin button $img_src = 'core/lib/theme/' . $theme->name . '/img/tb__plugin.gif'; } $js_res .= $prefix . '_obj.addToolbarItem(new SpawTbButton("' . $obj->module . '","' . $obj->name . '","' . $id . '","' . $obj->on_enabled_check . '","' . $obj->on_pushed_check . '","' . $obj->on_click . '","' . $pgdir . $img_src . '",' . ($obj->show_in_context_menu ? "true" : "false") . '),"' . $this->name . '");'; $html_res .= '<img id="' . $id . '" src="' . $pgdir . $img_src . '"'; if ($theme->isCustomStyleTbi($obj->name)) { $html_res .= ' style="' . $theme->getCustomTbiStyle($obj->name) . ' cursor: default;"'; } elseif ($theme->getDefaultTbButtonStyle()) { $html_res .= ' style="' . $theme->getDefaultTbButtonStyle() . ' cursor: default;"'; } else { $html_res .= ' style="cursor: default;"'; } if ($theme->isCustomCssClassTbi($obj->name)) { $html_res .= ' class="' . $theme->getCustomTbiCssClass($obj->name) . '"'; } elseif ($theme->getDefaultTbButtonCssClass()) { $html_res .= ' class="' . $theme->getDefaultTbButtonCssClass() . '"'; } $html_res .= ' onclick="SpawPG' . $obj->module . '.' . $obj->on_click . '(' . $prefix . '_obj.getTargetEditor(),' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"'; $html_res .= ' onmouseover="' . $prefix . '_obj.theme.buttonOver(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"'; $html_res .= ' onmouseout="' . $prefix . '_obj.theme.buttonOut(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"'; $html_res .= ' onmousedown="' . $prefix . '_obj.theme.buttonDown(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"'; $html_res .= ' onmouseup="' . $prefix . '_obj.theme.buttonUp(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"'; $html_res .= ' alt="' . $this->editor->lang->m('title', $obj->name, $obj->module) . '"'; $html_res .= ' title="' . $this->editor->lang->m('title', $obj->name, $obj->module) . '"'; $html_res .= ' unselectable="on"'; $html_res .= ' />'; break; case "spawtbdropdown": if (empty($obj->data)) { // try getting data from config $obj->data = $this->editor->config->getConfigValue('dropdown_data_' . $obj->module . '_' . $obj->name); } if (is_array($obj->data)) { $js_res .= $prefix . '_obj.addToolbarItem(new SpawTbDropdown("' . $obj->module . '","' . $obj->name . '","' . $id . '","' . $obj->on_enabled_check . '","' . $obj->on_status_check . '","' . $obj->on_change . '"),"' . $this->name . '");'; $html_res .= '<select size="1" id="' . $id . '" '; if ($theme->isCustomStyleTbi($obj->name)) { $html_res .= ' style="' . $theme->getCustomTbiStyle($obj->name) . '"'; } elseif ($theme->getDefaultTbDropdownStyle()) { $html_res .= ' style="' . $theme->getDefaultTbDropdownStyle() . '"'; } if ($theme->isCustomCssClassTbi($obj->name)) { $html_res .= ' class="' . $theme->getCustomTbiCssClass($obj->name) . '"'; } elseif ($theme->getDefaultTbDropdownCssClass()) { $html_res .= ' class="' . $theme->getDefaultTbDropdownCssClass() . '"'; } $html_res .= ' onchange="SpawPG' . $obj->module . '.' . $obj->on_change . '(' . $prefix . '_obj.getTargetEditor(),' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"'; $html_res .= ' onmouseover="' . $prefix . '_obj.theme.dropdownOver(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"'; $html_res .= ' onmouseout="' . $prefix . '_obj.theme.dropdownOut(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"'; $html_res .= ' onmousedown="' . $prefix . '_obj.theme.dropdownDown(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"'; $html_res .= ' onmouseup="' . $prefix . '_obj.theme.dropdownUp(' . $prefix . '_obj.getToolbarItem(\'' . $id . '\'), this);"'; $html_res .= '>'; $html_res .= '<option>' . $this->editor->lang->m('title', $obj->name, $obj->module) . '</option>'; foreach ($obj->data as $key => $value) { $html_res .= '<option value="' . $key . '">' . $value . '</option>'; } $html_res .= '</select>'; } } } $i++; } $html_res .= '</span>'; $res = '<script type="text/javascript">' . "\n<!--\n" . $js_res . "\n//-->\n" . '</script>' . $html_res; return $res; } }
<?php /* This script is written for use with PHPMailer-ML when using the SPAW Editor v.2. It is designed to add a menu option for variable substitution within an email message body. To use it you will require the file "inc.campaigns.php" for PHPMailer-ML version 1.8.1a. Author: Andy Prevost License: GPL (see docs/license.txt) */ if (isset($this)) { $site = $this->config->item('site'); if (isset($site)) { $array_list = array("{cfg name='num_tel'}" => 'Номер телефона: ' . $site['num_tel'], "{cfg name='num_tel2'}" => 'Номер телефона 2: ' . $site['num_tel2'], "{cfg name='num_fax'}" => 'Номер факса: ' . $site['num_fax'], "{cfg name='address'}" => 'Адрес: ' . $site['address'], "{cfg name='postal_code'}" => 'Почтовый индекс: ' . $site['postal_code'], "{cfg name='city'}" => 'Город: ' . $site['city'], "{cfg name='email'}" => 'E-mail: ' . $site['email'], "{cfg name='email2'}" => 'E-mail2: ' . $site['email2'], "{cfg name='www'}" => 'Адрес сайта: ' . $site['www'], "{cfg name='name'}" => 'Название сайта: ' . $site['name'], "{cfg name='short_name'}" => 'Краткое название сайта: ' . $site['short_name']); } else { $array_list = array(); } } else { $array_list = array(); } SpawConfig::setStaticConfigItem("dropdown_data_varinsert_varinsert", $array_list);
// specifies in which directions resizing is allowed (values: none, horizontal, vertical, both) SpawConfig::setStaticConfigItem('resizing_directions', 'vertical', SPAW_CFG_TRANSFER_JS); // specifies that special characters should be converted to the respective html entities SpawConfig::setStaticConfigItem('convert_html_entities', false, SPAW_CFG_TRANSFER_JS); // data for style (css class) dropdown list SpawConfig::setStaticConfigItem("dropdown_data_core_style", array('' => 'Normal', 'style1' => 'Style No.1', 'style2' => 'Style No.2')); // data for style (css class) dropdown in table properties dialog SpawConfig::setStaticConfigItem("table_styles", array('' => 'Normal', 'style1' => 'Style No.1', 'style2' => 'Style No.2')); // data for fonts dropdown list SpawConfig::setStaticConfigItem("dropdown_data_core_fontname", array('Arial' => 'Arial', 'Courier' => 'Courier', 'Tahoma' => 'Tahoma', 'Times New Roman' => 'Times', 'Verdana' => 'Verdana')); // data for fontsize dropdown list SpawConfig::setStaticConfigItem("dropdown_data_core_fontsize", array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6')); // data for paragraph dropdown list SpawConfig::setStaticConfigItem("dropdown_data_core_formatBlock", array('Normal' => 'Normal', '<H1>' => 'Heading 1', '<H2>' => 'Heading 2', '<H3>' => 'Heading 3', '<H4>' => 'Heading 4', '<H5>' => 'Heading 5', '<H6>' => 'Heading 6', '<pre>' => 'Preformatted', '<address>' => 'Address', '<p>' => 'Paragraph')); // data for link targets drodown list in hyperlink dialog SpawConfig::setStaticConfigItem("a_targets", array('_self' => 'Self', '_blank' => 'Blank', '_top' => 'Top', '_parent' => 'Parent')); // toolbar sets (should start with "toolbarset_" // standard core toolbars SpawConfig::setStaticConfigItem('toolbarset_standard', array("format" => "format", "style" => "style", "edit" => "edit", "table" => "table", "plugins" => "plugins", "insert" => "insert", "tools" => "tools")); // all core toolbars SpawConfig::setStaticConfigItem('toolbarset_all', array("format" => "format", "style" => "style", "edit" => "edit", "table" => "table", "plugins" => "plugins", "insert" => "insert", "tools" => "tools", "font" => "font")); // mini core toolbars SpawConfig::setStaticConfigItem('toolbarset_mini', array("format" => "format_mini", "edit" => "edit", "tools" => "tools")); // colorpicker config SpawConfig::setStaticConfigItem('colorpicker_predefined_colors', array('black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', '#fedcba', 'aqua'), SPAW_CFG_TRANSFER_SECURE); // SpawFm plugin config: // global filemanager settings SpawConfig::setStaticConfigItem('PG_SPAWFM_SETTINGS', array('allowed_filetypes' => array('any'), 'allow_modify' => false, 'allow_upload' => false, 'max_upload_filesize' => 0, 'max_img_width' => 0, 'max_img_height' => 0, 'recursive' => false, 'allow_modify_subdirectories' => false, 'allow_create_subdirectories' => false), SPAW_CFG_TRANSFER_SECURE); // directories SpawConfig::setStaticConfigItem('PG_SPAWFM_DIRECTORIES', array(array('dir' => SpawConfig::getStaticConfigValue('SPAW_DIR') . 'uploads/flash/', 'caption' => 'Flash movies', 'params' => array('allowed_filetypes' => array('flash'))), array('dir' => SpawConfig::getStaticConfigValue('SPAW_DIR') . 'uploads/images/', 'caption' => 'Images', 'params' => array('default_dir' => true, 'allowed_filetypes' => array('images'))), array('dir' => SpawConfig::getStaticConfigValue('SPAW_DIR') . 'uploads/files/', 'fsdir' => SpawConfig::getStaticConfigValue('SPAW_ROOT') . 'uploads/files/', 'caption' => 'Files', 'params' => array('allowed_filetypes' => array('any')))), SPAW_CFG_TRANSFER_SECURE);
<?php SpawConfig::setStaticConfigItem("dropdown_data_zoom_zoom", array('25%' => '25%', '50%' => '50%', '75%' => '75%', '100%' => '100%', '125%' => '125%', '150%' => '150%', '200%' => '200%', '400%' => '400%'));
<?php $lang->setModule("core"); $lang->setBlock("table_prop"); $spaw_table_styles = $config->getConfigValue("table_styles"); ?> <script type="text/javascript" src="<?php echo SpawConfig::getStaticConfigValue('SPAW_DIR'); ?> plugins/core/dialogs/table_prop.js"></script> <script type="text/javascript"> <!-- var spawErrorMessages = new Array(); <?php echo 'spawErrorMessages["error_rows_nan"] = "' . $lang->m('error_rows_nan') . '";' . "\n"; echo 'spawErrorMessages["error_columns_nan"] = "' . $lang->m('error_columns_nan') . '";' . "\n"; echo 'spawErrorMessages["error_width_nan"] = "' . $lang->m('error_width_nan') . '";' . "\n"; echo 'spawErrorMessages["error_height_nan"] = "' . $lang->m('error_height_nan') . '";' . "\n"; echo 'spawErrorMessages["error_border_nan"] = "' . $lang->m('error_border_nan') . '";' . "\n"; echo 'spawErrorMessages["error_cellpadding_nan"] = "' . $lang->m('error_cellpadding_nan') . '";' . "\n"; echo 'spawErrorMessages["error_cellspacing_nan"] = "' . $lang->m('error_cellspacing_nan') . '";' . "\n"; ?> //--> </script> <table border="0" cellspacing="0" cellpadding="2" width="336"> <form name="table_prop" id="table_prop" onsubmit="return false;"> <tr> <td><?php echo $lang->m('rows');
<?php // Clean paste config // When to apply cleaning to the pasted content // "selective" - when content matches (javascript) regular expression // pattern specified in the cofiguration // "always" // "never" SpawConfig::setStaticConfigItem("PG_CLEANPASTE_CLEAN", 'selective', SPAW_CFG_TRANSFER_JS); // pattern to determine that content should be cleaned in "selective" mode SpawConfig::setStaticConfigItem("PG_CLEANPASTE_PATTERN", '(urn:schemas-microsoft-com:office)' . '|(<([^>]*)style([\\s]*)=([\\s]*)([\\"]*)mso)' . '|(<([^>]*)class([\\s]*)=([\\s]*)([\\"]*)mso)' . '|(<o:)', SPAW_CFG_TRANSFER_JS);