Sessions

WysiwygPro uses sessions to re-create an editor's configuration within dialog windows.

WysiwygPro includes two session engines, by default it uses PHP's built in session engine but alternatively it can be configured to use its own custom engine.

You can configure which engine the editor should use by changing the WPRO_SESSION_ENGINE define in the config file (wysiwygPro/config.inc.php)

Accepted values are:

PHP - Uses the PHP session engine
WP - Uses the custom engine

Lets take a closer look at each option:

Using the PHP session engine:

The WPRO_SESSION_ENGINE define must be set to 'PHP'

For this engine to work you should start a session by calling session_start(). The call to session_start() must be placed before any HTML content and before any editors have been constructed. If you are integrating WysiwygPro into an existing application then your application probably already includes this line somewhere. If this is the case then you will not need to add it again yourself. Calling session_start twice should be avoided.

For more information on session_start please see http://www.php.net/manual/en/function.session-start.php

If you forget this step WysiwygPro will attempt to start a session for you. This should work most of the time but may result in an error under some circumstances. For this reason we consider it best practice to start the session yourself.

If you are integrating WysiwygPro into an application that uses a custom session name (different to the one set in php.ini) or that uses a custom session save handler then you will need to set up the session configuration file located at wysiwygPro/conf/customSessHandlers.inc.php.

If you receive an error message about expired sessions every time you open a dialog window then you have probably forgotten to call session_start OR (more likely) you need to set up the session configuration file located at wysiwygPro/conf/customSessHandlers.inc.php

In version 3.0.2 we introduced an alternative to setting up the  customSessHandlers.inc.php config file. You can now route WysiwygPro through an existing page in your application that already has session handling. Please see route

Using the WP session engine:

The WPRO_SESSION_ENGINE define must be set to 'WP'

This engine is intended for situations where the PHP engine cannot be made to work.

There is no need to call session_start when using this engine because it works independently of PHP sessions.

WysiwygPro will store session data in the wysiwygPro/temp/ directory. You should ensure that this directory is writable by setting its permissions to 777. If the directory is not writable WysiwygPro will attempt to store it's data in your server's temporary files folder.

You can change the location of the WysiwygPro temp directory by setting the WPRO_TEMP_DIR define in the config file.

We recommend that you prevent access to the WysiwygPro temp directory using a .htaccess file (by default there should already be one in there) or by rules in your Apache configuration file or by placing the folder outside of your web site's folder.

Reduced Session Mode 

With either session engine you may run the editor in reduced session mode. In reduced session mode WysiwygPro will not store any configuration data in the session (but it will store a small amount of data used for security purposes such as nonce keys for the file manager). This means that your editor configuration will not be propagated to the dialog windows. However you can recreate your editor configuration in the dialog windows by editing the dialog config file located at wysiwygPro/conf/dialogConfig.php. A reference to the editor object is available in this file through the $EDITOR global variable. You may use this object to apply your required configuration. This configuration will affect all editor dialog windows in all editors, by using reduced session mode you loose the flexibility of being able to configure each editor individually.

In normal session mode WysiwygPro stores approximately 10 KB of session data per editor. In reduced session mode it stores approximately 1 KB. 10 KB is not a large amount of data however using reduced session mode may result in better server performance under some circumstances.

To enable reduced session mode set the WPRO_REDUCED_SESSION define in the config file to true.