From 36745b49da2bf9045c25f10376638e2f98a58120 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 31 Jul 2009 13:55:42 -0400 Subject: [PATCH] Rename Ansel's Form objects for autoloading --- ansel/edit_dates.php | 7 +------ ansel/image.php | 7 +++---- ansel/img/ecard.php | 4 +--- ansel/img/upload.php | 4 +--- ansel/lib/{Forms => Form}/Ecard.php | 6 +++--- ansel/lib/{Forms => Form}/Image.php | 10 +++++----- ansel/lib/{Forms => Form}/ImageDate.php | 8 ++++---- ansel/lib/{Forms => Form}/Upload.php | 10 +++++----- ansel/lib/{Forms => Form}/Watermark.php | 8 ++++---- 9 files changed, 27 insertions(+), 37 deletions(-) rename ansel/lib/{Forms => Form}/Ecard.php (89%) rename ansel/lib/{Forms => Form}/Image.php (91%) rename ansel/lib/{Forms => Form}/ImageDate.php (87%) rename ansel/lib/{Forms => Form}/Upload.php (94%) rename ansel/lib/{Forms => Form}/Watermark.php (93%) diff --git a/ansel/edit_dates.php b/ansel/edit_dates.php index 1c8ddf718..e3c5a2082 100644 --- a/ansel/edit_dates.php +++ b/ansel/edit_dates.php @@ -7,7 +7,6 @@ * * @author Michael J. Rubinsky */ - require_once dirname(__FILE__) . '/lib/base.php'; $images = Horde_Util::getFormData('image', array()); @@ -35,13 +34,9 @@ if (!count($images)) { exit; } -/* Includes */ -require_once ANSEL_BASE . '/lib/Forms/ImageDate.php'; -require_once 'Horde/Form/Renderer.php'; - /* Set up the form */ $vars = Horde_Variables::getDefaultVariables(); -$form = new ImageDateForm($vars, _("Edit Dates")); +$form = new Ansel_Form_ImageDate($vars, _("Edit Dates")); /* Are we doing the edit now? */ if ($actionID == 'edit_dates') { $count = 0; diff --git a/ansel/image.php b/ansel/image.php index db64b0f3e..4121bf9c4 100644 --- a/ansel/image.php +++ b/ansel/image.php @@ -13,7 +13,6 @@ */ require_once dirname(__FILE__) . '/lib/base.php'; -require_once 'Horde/Form/Renderer.php'; /* Get all the form data */ $actionID = Horde_Util::getFormData('actionID'); @@ -145,7 +144,7 @@ case 'modify': } else { $vars->set('actionID', 'savecloseimage'); } - $form = new ImageForm($vars, $title); + $form = new Ansel_Form_Image($vars, $title); $renderer = new Horde_Form_Renderer(); /* Set up the gallery attributes. */ @@ -185,7 +184,7 @@ case 'save': $vars = Horde_Variables::getDefaultVariables(); $vars->set('actionID', 'save'); $renderer = new Horde_Form_Renderer(); - $form = new ImageForm($vars, _("Edit a photo")); + $form = new Ansel_Form_Image($vars, _("Edit a photo")); /* Update existing image. */ if ($form->validate($vars)) { @@ -463,7 +462,7 @@ case 'setwatermark': require_once ANSEL_BASE . '/lib/Forms/Watermark.php'; $vars = Horde_Variables::getDefaultVariables(); $vars->set('actionID', 'previewcustomwatermark'); - $form = new WatermarkForm($vars, _("Watermark")); + $form = new Ansel_Form_Watermark($vars, _("Watermark")); $renderer = new Horde_Form_Renderer(); require ANSEL_TEMPLATES . '/common-header.inc'; diff --git a/ansel/img/ecard.php b/ansel/img/ecard.php index 4e344d1f2..9cbc58776 100644 --- a/ansel/img/ecard.php +++ b/ansel/img/ecard.php @@ -9,8 +9,6 @@ */ require_once dirname(__FILE__) . '/../lib/base.php'; -require_once ANSEL_BASE . '/lib/Forms/Ecard.php'; -require_once 'Horde/Form/Renderer.php'; /* Abort if ecard sending is disabled. */ if (empty($conf['ecard']['enable'])) { @@ -99,7 +97,7 @@ $title = sprintf(_("Send Ecard :: %s"), $image->filename); $vars = Horde_Variables::getDefaultVariables(); $vars->set('actionID', 'send'); $vars->set('image_desc', strlen($image->caption) ? $image->caption : $image->filename); -$form = new EcardForm($vars, $title); +$form = new Ansel_Form_Ecard($vars, $title); $renderer = new Horde_Form_Renderer(); if ($browser->hasFeature('rte')) { diff --git a/ansel/img/upload.php b/ansel/img/upload.php index 70e2c0bf5..c975cdb16 100644 --- a/ansel/img/upload.php +++ b/ansel/img/upload.php @@ -9,8 +9,6 @@ */ require_once dirname(__FILE__) . '/../lib/base.php'; -require_once ANSEL_BASE . '/lib/Forms/Upload.php'; -require_once 'Horde/Form/Renderer.php'; $gallery_id = Horde_Util::getFormData('gallery'); $gallery = &$ansel_storage->getGallery($gallery_id); @@ -23,7 +21,7 @@ if (is_a($gallery, 'PEAR_Error')) { $page = Horde_Util::getFormData('page', 0); $vars = Horde_Variables::getDefaultVariables(); -$form = new UploadForm($vars, _("Upload photos")); +$form = new Ansel_Form_Upload($vars, _("Upload photos")); if ($form->validate($vars)) { $valid = true; $uploaded = 0; diff --git a/ansel/lib/Forms/Ecard.php b/ansel/lib/Form/Ecard.php similarity index 89% rename from ansel/lib/Forms/Ecard.php rename to ansel/lib/Form/Ecard.php index 6fc69a373..bf50f3f2f 100644 --- a/ansel/lib/Forms/Ecard.php +++ b/ansel/lib/Form/Ecard.php @@ -5,11 +5,11 @@ * @package Ansel */ -class EcardForm extends Horde_Form { +class Ansel_Form_Ecard extends Horde_Form { - var $_useFormToken = false; + protected $_useFormToken = false; - function EcardForm(&$vars, $title) + public function __construct(&$vars, $title) { parent::Horde_Form($vars, $title); diff --git a/ansel/lib/Forms/Image.php b/ansel/lib/Form/Image.php similarity index 91% rename from ansel/lib/Forms/Image.php rename to ansel/lib/Form/Image.php index 416a16fd0..77d1d2989 100644 --- a/ansel/lib/Forms/Image.php +++ b/ansel/lib/Form/Image.php @@ -7,11 +7,11 @@ * * @author Chuck Hagenbuch */ -class ImageForm extends Horde_Form { +class Ansel_Form_Image extends Horde_Form +{ + protected $_useFormToken = false; - var $_useFormToken = false; - - function ImageForm(&$vars, $title) + public function __construct(&$vars, $title) { global $gallery; @@ -49,7 +49,7 @@ class ImageForm extends Horde_Form { /** * Format file size */ - function _get_size($size) + protected function _get_size($size) { $bytes = array('B', 'KB', 'MB', 'GB', 'TB'); diff --git a/ansel/lib/Forms/ImageDate.php b/ansel/lib/Form/ImageDate.php similarity index 87% rename from ansel/lib/Forms/ImageDate.php rename to ansel/lib/Form/ImageDate.php index a0944fd68..19e26dc8f 100644 --- a/ansel/lib/Forms/ImageDate.php +++ b/ansel/lib/Form/ImageDate.php @@ -7,11 +7,11 @@ * * @author Michael J. Rubinsky */ -class ImageDateForm extends Horde_Form { +class Ansel_Form_ImageDate extends Horde_Form +{ + protected $_useFormToken = false; - var $_useFormToken = false; - - function ImageDateForm(&$vars, $title) + public function __construct(&$vars, $title) { global $gallery; diff --git a/ansel/lib/Forms/Upload.php b/ansel/lib/Form/Upload.php similarity index 94% rename from ansel/lib/Forms/Upload.php rename to ansel/lib/Form/Upload.php index d165a300e..7f1ca2520 100644 --- a/ansel/lib/Forms/Upload.php +++ b/ansel/lib/Form/Upload.php @@ -5,11 +5,11 @@ * * @package Ansel */ -class UploadForm extends Horde_Form { +class Ansel_Form_Upload extends Horde_Form +{ + protected $_useFormToken = false; - var $_useFormToken = false; - - function UploadForm(&$vars, $title) + public function __construct(&$vars, $title) { global $gallery, $conf; @@ -75,7 +75,7 @@ class UploadForm extends Horde_Form { /** * Format file size */ - function _get_size($size) + protected function _get_size($size) { $bytes = array('B', 'KB', 'MB', 'GB', 'TB'); diff --git a/ansel/lib/Forms/Watermark.php b/ansel/lib/Form/Watermark.php similarity index 93% rename from ansel/lib/Forms/Watermark.php rename to ansel/lib/Form/Watermark.php index ae1f89e09..128ffde10 100644 --- a/ansel/lib/Forms/Watermark.php +++ b/ansel/lib/Form/Watermark.php @@ -7,11 +7,11 @@ * * @author Chuck Hagenbuch */ -class WatermarkForm extends Horde_Form { +class Ansel_Form_Watermark extends Horde_Form +{ + protected $_useFormToken = false; - var $_useFormToken = false; - - function WatermarkForm(&$vars, $title) + public function __construct(&$vars, $title) { global $gallery, $prefs; -- 2.11.0