/** * Display Current Configuration Settings * */ function DisplayCurrent() { includeFile('tool/editing.php'); $default_config = gp_edit::CKConfig(array(), 'array'); echo '<pre class="json">'; echo self::ReadableJson($default_config); echo '</pre>'; }
function ExtraJS() { header('Content-type: application/javascript'); includeFile('tool/editing.php'); trigger_error('Deprecated: special_extrajs'); $_GET += array('which' => array()); foreach ((array) $_GET['which'] as $which_code) { switch ($which_code) { case 'autocomplete2': $options['admin_vals'] = false; $options['var_name'] = 'gp_include_titles'; echo gp_edit::AutoCompleteValues(false, $options); break; case 'autocomplete': echo gp_edit::AutoCompleteValues(true); break; case 'gp_ckconfig': $options = array(); echo gp_edit::CKConfig($options, 'gp_ckconfig'); break; } } die; }
static function InlineEdit_Text($scripts) { includeFile('tool/editing.php'); // autocomplete echo gp_edit::AutoCompleteValues(true); // ckeditor basepath and configuration $options = array('extraPlugins' => 'sharedspace', 'sharedSpaces' => array('top' => 'ckeditor_top', 'bottom' => ' ckeditor_bottom')); $ckeditor_basepath = common::GetDir('/include/thirdparty/ckeditor_34/'); echo 'CKEDITOR_BASEPATH = ' . gpAjax::quote($ckeditor_basepath) . ';'; echo 'var gp_ckconfig = ' . gp_edit::CKConfig($options, 'json', $plugins) . ';'; // extra plugins echo 'var gp_add_plugins = ' . json_encode($plugins) . ';'; // scripts $scripts[] = '/include/thirdparty/ckeditor_34/ckeditor.js'; $scripts[] = '/include/js/ckeditor_config.js'; $scripts[] = '/include/js/inline_edit/inlineck.js'; return $scripts; }
/** * Use ckeditor for to edit content * * configuration options * - http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html */ static function UseCK($contents, $name = 'gpcontent', $options = array()) { global $page, $dataDir; $options += array('rows' => '20', 'cols' => '50'); echo "\n\n"; echo '<textarea name="' . $name . '" style="width:90%" rows="' . $options['rows'] . '" cols="' . $options['cols'] . '" class="CKEDITAREA">'; echo htmlspecialchars($contents); echo '</textarea><br/>'; $page->head .= "\n" . '<script type="text/javascript" src="' . common::GetDir('/include/thirdparty/ckeditor_34/ckeditor.js') . '?' . rawurlencode(gpversion) . '"></script>'; $page->head .= "\n" . '<script type="text/javascript" src="' . common::GetDir('/include/js/ckeditor_config.js') . '?' . rawurlencode(gpversion) . '"></script>'; common::LoadComponents('autocomplete'); $page->head_script .= gp_edit::AutoCompleteValues(true); ob_start(); echo "\n\n"; // extra plugins $config = gp_edit::CKConfig($options, 'json', $plugins); foreach ($plugins as $plugin => $plugin_path) { echo 'CKEDITOR.plugins.addExternal(' . json_encode($plugin) . ',' . json_encode($plugin_path) . ');'; echo "\n"; } echo '$(".CKEDITAREA").each(function(){'; echo 'CKEDITOR.replace( this, ' . $config . ' );'; echo '});'; echo "\n\n"; $page->jQueryCode .= ob_get_clean(); }
/** * Use ckeditor for to edit content * * configuration options * - http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html */ static function UseCK($contents, $name = 'gpcontent', $options = array()) { global $page; $options += array('rows' => '20', 'cols' => '50'); echo "\n\n"; echo '<textarea name="' . $name . '" style="width:90%" rows="' . $options['rows'] . '" cols="' . $options['cols'] . '" class="CKEDITAREA">'; echo htmlspecialchars($contents); echo '</textarea><br/>'; //$page->head_js[] = '/include/thirdparty/ckeditor_34/ckeditor.js'; //wasn't working quite right, and it's called seperately for inline editing $page->head .= "\n" . '<script type="text/javascript" src="' . common::GetDir('/include/thirdparty/ckeditor_34/ckeditor.js') . '?3.6.2"></script>'; gp_edit::PrepAutoComplete(false, true); ob_start(); echo 'CKEDITOR.replaceAll( function(tarea,config){'; echo 'if( tarea.className.indexOf("CKEDITAREA") == -1 ) return false;'; echo gp_edit::CKConfig($options); echo 'return true;'; echo '});'; echo "\n\n"; $page->jQueryCode .= ob_get_clean(); }
/** * @deprecated * Use gp_edit::CKConfig(); */ function CKConfig($options = array(), $config_name = 'config') { includeFile('tool/editing.php'); return gp_edit::CKConfig($options, $config_name); }
function InlineEdit_Text($scripts) { includeFile('tool/editing.php'); //autocomplete echo gp_edit::AutoCompleteValues(true); //ckeditor basepath and configuration $ckeditor_basepath = common::GetDir('/include/thirdparty/ckeditor_34/'); echo 'CKEDITOR_BASEPATH = ' . gpAjax::quote($ckeditor_basepath) . ';'; echo 'var gp_ckconfig = {};'; //gp_ckconfig options $options = array(); echo gp_edit::CKConfig($options, 'gp_ckconfig'); $scripts[] = '/include/thirdparty/ckeditor_34/ckeditor.js'; $scripts[] = '/include/js/inline_edit/inlineck.js'; return $scripts; }