1: <?php
2:
3: /**
4: *
5: * Supports files of the following types:
6: * <ul>
7: * <li><var>.txt</var></var>
8: * <li><var>.htm</var></li>
9: * <li><var>.html</var></var>
10: * </ul>
11: * The contents of these files are "dumpped" into a <var><span>...</span></var> sized to a 24x36 ratioed box based on your
12: * theme "image size" option. This has a class of "textobject" so it can be styled.
13: *
14: * What this plugin really is for is to serve as a model of how a plugin can be made to handle file types
15: * that zenphoto does not handle natively.
16: *
17: * Some key points to note:
18: * <ul>
19: * <li>The naming convention for these plugins is <i>class-<handler class>.php</i>.</li>
20: * <li>The statement setting the <i>plugin_is_filter</i> variable must be near the front of the file. This is important
21: * as it is the indicator to the Zenphoto plugin loader to load the script at the same point that other
22: * object modules are loaded.</li>
23: * <li>These objects are extension to the zenphoto "Image" class. This means they have all the properties of
24: * an image plus whatever you add. Of course you will need to override some of the image class functions to
25: * implement the functionality of your new class.</li>
26: * <li>There is one VERY IMPORTANT method that you must provide which is not part of the "Image" base class. The
27: * <i>getBody()</i> method. This method is called by <i>template-functions.php</i> in place of where it would normally put a URL
28: * to the image to show. This method must do everything needed to cause your image object to be viewable by the
29: * browser.</li>
30: * </ul>
31: *
32: * So, briefly, the first three lines of code below are the standard plugin interface to Admin.
33: * Then there are calls on <var>addPlginType(<file extension>, <Object Name>);</var> This function registers the plugin as the
34: * handler for files with the specified extension. If the plugin can handle more than one file extension, make a call
35: * to the registration function for each extension that it handles.
36: * The rest is the object class for handling these files.
37: *
38: * The code of the object instantiation function is mostly required. Plugin <i>images</i> follow the lead of <var>class-video</var> in that
39: * if there is a real image file with the same name save the suffix, it will be considered the thumb image of the object.
40: * This image is fetched by the call on <var>checkObjectsThumb()</var>. There is also code in the <var>getThumb()</var> method to deal with
41: * this property.
42: *
43: * Since text files have no natural height and width, we set them based on the image size option. This happens after the call
44: * <var>PersistentObject()</var>. The rest of the code there sets up the default title.
45: *
46: * <var>getThumb()</var> is responsible for generating the thumbnail image for the object. As above, if there is a similar named real
47: * image, it will be used. Otherwise [for this object implementation] we will use a thumbnail image provided with the plugin.
48: * The particular form of the file name used when there is no thumb stand-in image allows Zenphoto to choose an image in the
49: * plugin folder.
50: *
51: * @author Stephen Billard (sbillard)
52: * @package plugins
53: * @subpackage media
54: *
55: */
56: $plugin_is_filter = 990 | CLASS_PLUGIN;
57: $plugin_description = gettext('Provides a means for showing text type documents (.txt, .html, .htm).');
58: $plugin_author = "Stephen Billard (sbillard)";
59:
60:
61: Gallery::addImageHandler('htm', 'TextObject');
62: Gallery::addImageHandler('html', 'TextObject');
63: Gallery::addImageHandler('txt', 'TextObject');
64: $option_interface = 'textObject_Options';
65:
66: /**
67: * Option class for textobjects objects
68: *
69: */
70: class TextObject_Options {
71:
72: /**
73: * Standard option interface
74: *
75: * @return array
76: */
77: function getOptionsSupported() {
78: return array(gettext('Watermark default images') => array('key' => 'textobject_watermark_default_images', 'type' => OPTION_TYPE_CHECKBOX,
79: 'desc' => gettext('Check to place watermark image on default thumbnail images.')));
80: }
81:
82: }
83:
84: require_once(dirname(__FILE__) . '/class-textobject/class-textobject_core.php');
85: ?>