source: trunk/examples/UsingPhpPlugins.php @ 1409

Last change on this file since 1409 was 1409, checked in by gogo, 21 months ago
File size: 5.0 KB
Line 
1<?php require_once('require-password.php'); ?>
2<!DOCTYPE html>
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5
6  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7  <title>Example of Xinha</title>
8  <link rel="stylesheet" href="files/full_example.css" />
9
10  <script src="../XinhaEasy.js" type="text/javascript">
11   
12    // The following options are, optional...
13    xinha_options =
14    {
15      // Specify language and skin
16      _editor_lang:   'en',         // Language to use
17      _editor_skin:   'silva',      // Name of the skin to use (see skins directory for available skins)
18     
19      // Simply a CSS selector to pick the textarea(s) you want, eg 'textarea'
20      //  converts all textarea, or textarea.my-xinha,textarea.your-xinha
21      //  would convert only those textareas with the my-xinha or your-xinha
22      //  classes on them
23      xinha_editors:  'textarea',   
24
25      // Plugins can be a default set - 'common', 'minimal', 'loaded'
26      //   xinha_plugins: 'minimal'
27      //
28      // or you can specify the plugins you want exactly
29      //   xinha_plugins: [ 'Linker', 'Stylist' ]
30      //
31      // or you can do both to add extras to the set
32      //   xinha_pass_to_php_backend: ['minimal', 'Linker' ]
33      xinha_plugins:  [ 'minimal', 'MootoolsFileManager', 'Linker' ],
34     
35      // The default toolbar can be one of the pre-defined toolbars,
36      //   'default', 'minimal', 'minimal+fonts', 'supermini'
37      //   xinha_toolbar: 'minimal+fonts'
38      //
39      // or you an specify a toolbar structure completely
40      //   xinha_toolbar: [ ["popupeditor"],["separator","bold","italic","underline","strikethrough","superscript"] ]
41      xinha_toolbar:  'minimal+fonts',
42     
43      // To specify a stylesheet to load inside the editor (to style the contents
44      //  the user is editing), simply specify the path to it here.
45      //
46      // Note as with all these options, it's optional, leave it out if you
47      //  don't want to load a stylesheet in the editor
48      xinha_stylesheet: null,
49     
50      // This is where you set the other default configuration globally
51      xinha_config:            function(xinha_config)
52      {
53       
54        // Configure the File Manager
55        with (xinha_config.MootoolsFileManager)
56        {
57          <?php
58            require_once('../contrib/php-xinha.php');
59            xinha_pass_to_php_backend
60            (       
61              array
62              (
63                'images_dir' => getcwd() . '/images',
64                'images_url' => preg_replace('/\/examples.*/', '', $_SERVER['REQUEST_URI']) . '/examples/images',
65                'images_allow_upload' => true,
66                'images_allow_delete' => true,
67                'images_allow_download' => true,
68                'images_use_hspace_vspace' => false,
69               
70                'files_dir' => getcwd() . '/images',
71                'files_url' => preg_replace('/\/examples.*/', '', $_SERVER['REQUEST_URI']) . '/examples/images',
72                'files_allow_upload' => true,
73                'max_files_upload_size' => '4M',
74              )
75            )
76          ?>
77        }
78     
79        // Configure the Linker
80        with (xinha_config.Linker)
81        {
82          <?php
83            require_once('../contrib/php-xinha.php');
84            xinha_pass_to_php_backend
85            (       
86              array
87              (
88                'dir' => getcwd(),
89                'url' => '/examples',               
90              )
91            )
92          ?>
93        }
94       
95      },
96     
97      // Here is where you can customise configs for each editor area
98      //  See the Newbie.html example for usage
99      xinha_config_specific:   function(xinha_config, textarea)
100      {
101
102      },
103     
104      // Here you can limit the plugins to certain editor areas
105      //  See the Newbie.html example for usage
106      xinha_plugins_specific:  function(xinha_plugins, textarea)
107      {
108
109      }
110    }
111
112  </script>
113 
114</head>
115
116<body>
117  <h1> Demonstration of MootoolsFileManager and Linker with Xinha integration </h1>
118  <p>  MootoolsFileManager (for uploading Images and Files) and Linker (for browsing files on the server and making a link to them) plugins require PHP configuration to be passed in a secure way, this example shows you how to do this!  View the source, all the code is in the head.</p>
119 
120  <form action="javascript:void(0);" id="editors_here" onsubmit="alert(this.myTextArea.value);">
121     <div>
122    <textarea id="myTextArea" name="myTextArea" style="width:100%;height:320px;">
123&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
124Aliquam et tellus vitae justo varius placerat. Suspendisse iaculis
125velit semper dolor. Donec gravida tincidunt mi. Curabitur tristique
126ante elementum turpis. Aliquam nisl. Nulla posuere neque non
127tellus. Morbi vel nibh. Cum sociis natoque penatibus et magnis dis
128parturient montes, nascetur ridiculus mus. Nam nec wisi. In wisi.
129Curabitur pharetra bibendum lectus.&lt;/p&gt;
130</textarea>
131    <input type="submit" /> <input type="reset" />
132    </div>
133  </form>
134
135</body>
136</html>
Note: See TracBrowser for help on using the repository browser.