source: trunk/examples/UsingPhpPlugins.php

Last change on this file was 1426, checked in by gogo, 17 months ago

Update UsingPhpPlugins?.php to work from within xinha-cdn examples.

File size: 5.5 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: 
34      [
35        'minimal', // Load the standard minimal set from Xinha's norma plugins
36       
37        // Since this example might be using Xinha from a CMS, we
38        //  make sure to load our PHP plugins from our local plugins
39        //  directory on our own server, not the CMS server (which wouldn't
40        //  support PHP).
41        {
42           from: '../plugins',      // From our local plugins directory
43           load:['MootoolsFileManager', 'Linker'] // Load these plugins
44        }
45      ],
46     
47      // The default toolbar can be one of the pre-defined toolbars,
48      //   'default', 'minimal', 'minimal+fonts', 'supermini'
49      //   xinha_toolbar: 'minimal+fonts'
50      //
51      // or you an specify a toolbar structure completely
52      //   xinha_toolbar: [ ["popupeditor"],["separator","bold","italic","underline","strikethrough","superscript"] ]
53      xinha_toolbar:  'minimal+fonts',
54     
55      // To specify a stylesheet to load inside the editor (to style the contents
56      //  the user is editing), simply specify the path to it here.
57      //
58      // Note as with all these options, it's optional, leave it out if you
59      //  don't want to load a stylesheet in the editor
60      xinha_stylesheet: null,
61     
62      // This is where you set the other default configuration globally
63      xinha_config:            function(xinha_config)
64      {
65       
66        // Configure the File Manager
67        with (xinha_config.MootoolsFileManager)
68        {
69          <?php
70            require_once('../contrib/php-xinha.php');
71            xinha_pass_to_php_backend
72            (       
73              array
74              (
75                'images_dir' => getcwd() . '/images',
76                'images_url' => preg_replace('/\/examples.*/', '', $_SERVER['REQUEST_URI']) . '/examples/images',
77                'images_allow_upload' => true,
78                'images_allow_delete' => true,
79                'images_allow_download' => true,
80                'images_use_hspace_vspace' => false,
81               
82                'files_dir' => getcwd() . '/images',
83                'files_url' => preg_replace('/\/examples.*/', '', $_SERVER['REQUEST_URI']) . '/examples/images',
84                'files_allow_upload' => true,
85                'max_files_upload_size' => '4M',
86              )
87            )
88          ?>
89        }
90     
91        // Configure the Linker
92        with (xinha_config.Linker)
93        {
94          <?php
95            require_once('../contrib/php-xinha.php');
96            xinha_pass_to_php_backend
97            (       
98              array
99              (
100                'dir' => getcwd(),
101                'url' => '/examples',               
102              )
103            )
104          ?>
105        }
106       
107      },
108     
109      // Here is where you can customise configs for each editor area
110      //  See the Newbie.html example for usage
111      xinha_config_specific:   function(xinha_config, textarea)
112      {
113
114      },
115     
116      // Here you can limit the plugins to certain editor areas
117      //  See the Newbie.html example for usage
118      xinha_plugins_specific:  function(xinha_plugins, textarea)
119      {
120
121      }
122    }
123
124  </script>
125 
126</head>
127
128<body>
129  <h1> Demonstration of MootoolsFileManager and Linker with Xinha integration </h1>
130  <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>
131 
132  <form action="javascript:void(0);" id="editors_here" onsubmit="alert(this.myTextArea.value);">
133     <div>
134    <textarea id="myTextArea" name="myTextArea" style="width:100%;height:320px;">
135&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
136Aliquam et tellus vitae justo varius placerat. Suspendisse iaculis
137velit semper dolor. Donec gravida tincidunt mi. Curabitur tristique
138ante elementum turpis. Aliquam nisl. Nulla posuere neque non
139tellus. Morbi vel nibh. Cum sociis natoque penatibus et magnis dis
140parturient montes, nascetur ridiculus mus. Nam nec wisi. In wisi.
141Curabitur pharetra bibendum lectus.&lt;/p&gt;
142</textarea>
143    <input type="submit" /> <input type="reset" />
144    </div>
145  </form>
146
147</body>
148</html>
Note: See TracBrowser for help on using the repository browser.