示例#1
0
/**
 * Renvoie l'objet edite depuis l'URL courant
 */
function tinymce_trouverobjet()
{
    $tiny_config = tinymce_config();
    $exec = _request('exec');
    if (1 === preg_match('~^([a-z_]+)_(edit)$~', $exec, $match)) {
        if (true === in_array($match[1], $tiny_config['objets'])) {
            return $match[1];
        }
        $singulier = substr($match[1], 0, strlen($match[1]) - 1);
        if (true === in_array($singulier, $tiny_config['objets'])) {
            return $singulier;
        }
    }
    return '';
}
function formulaires_configurer_tinymce_charger_dist()
{
    $cfg_actuelle = tinymce_config();
    $tinymce_themes = $GLOBALS['tinymce_habillages'];
    //var_export($cfg_actuelle);
    $valeurs = $cfg_actuelle;
    $valeurs['content_css_str'] = join(', ', $valeurs['content_css']);
    $valeurs['habillages'] = $GLOBALS['tinymce_habillages'];
    $valeurs['habillage_variants'] = array();
    if (true === isset($cfg_actuelle['skin'])) {
        if (true === isset($tinymce_themes[$cfg_actuelle['skin']]) && 1 < count($tinymce_themes[$cfg_actuelle['skin']])) {
            $valeurs['habillage_variants'] = $tinymce_themes[$cfg_actuelle['skin']];
        }
    }
    // liste des objets : trouver fonction ?
    $valeurs['objets_spip'] = tinymce_listerobjetsspip();
    // liste des modeles de config : faire fonction ?
    $valeurs['fonds_config'] = tinymce_listerfondsconfig();
    //var_export($valeurs);
    return $valeurs;
}
示例#3
0
/**
 * Instantiates the editor(s) on the textarea(s) given by $element_classes.
 * $config is exactly the same as for EDITOR_replace().
 *
 * @param string $element_classes  The classes of the textarea(s) that should become an editor instance. An empty array means .xh-editor.
 * @param string $config  The configuration string.
 * @global string $onload
 * @return void
 */
function init_tinymce($classes = array(), $config = false)
{
    global $hjs, $onload;
    static $run = 0;
    include_tinymce();
    $initClasses = 'xh-editor';
    if (is_array($classes) && (bool) $classes) {
        $initClasses = implode('|', $classes);
    }
    $temp = tinymce_config($initClasses == 'xh-editor', $config);
    $hjs .= '
	<script language="javascript" type="text/javascript">
	/* <![CDATA[ */
	function tinyMCE_initialize' . $run . '() {
	    tinyMCE_instantiateByClasses(\'' . $initClasses . '\', ' . $temp . ');
	}
	/* ]]> */
	</script>
	';
    $onload .= 'tinyMCE_initialize' . $run . '();';
    $run++;
    return;
}
?>
';
    document.cms_controller = '<?php 
echo $this->router->class;
?>
';
    document.cms_method = '<?php 
echo $this->router->method;
?>
';
    document.cms_tinymce_minimal = <?php 
echo tinymce_config('minimal');
?>
;
    document.cms_tinymce_full = <?php 
echo tinymce_config('full');
?>
;

    <?php 
foreach ($javascript_params as $key => $value) {
    ?>
    document.cms_<?php 
    echo $key;
    ?>
 = <?php 
    echo $value;
    ?>
;
    <?php 
}