diff options
| author | Andy Staudacher <andy.st@gmail.com> | 2009-08-29 12:48:40 -0700 | 
|---|---|---|
| committer | Andy Staudacher <andy.st@gmail.com> | 2009-08-29 12:48:40 -0700 | 
| commit | c01ac42c4604b3b129e8089e0dc683ebd418b380 (patch) | |
| tree | 87c688c638733e7d8a8215bc5f4ee89d0f598c62 /modules/gallery | |
| parent | a10063ff68cf5988297dcad889384ab2080c3850 (diff) | |
Refactor all calls of p::clean() to SafeString::of() and p::purify() to SafeString::purify().
Removing any p::clean() calls for arguments to t() and t2() since their args are wrapped in a SafeString anyway.
Diffstat (limited to 'modules/gallery')
| -rw-r--r-- | modules/gallery/controllers/admin_advanced_settings.php | 2 | ||||
| -rw-r--r-- | modules/gallery/controllers/movies.php | 2 | ||||
| -rw-r--r-- | modules/gallery/controllers/photos.php | 2 | ||||
| -rw-r--r-- | modules/gallery/controllers/quick.php | 10 | ||||
| -rw-r--r-- | modules/gallery/helpers/gallery_rss.php | 4 | ||||
| -rw-r--r-- | modules/gallery/helpers/gallery_task.php | 4 | ||||
| -rw-r--r-- | modules/gallery/helpers/p.php | 29 | ||||
| -rw-r--r-- | modules/gallery/views/admin_advanced_settings.html.php | 8 | ||||
| -rw-r--r-- | modules/gallery/views/admin_block_log_entries.html.php | 2 | ||||
| -rw-r--r-- | modules/gallery/views/admin_block_photo_stream.html.php | 4 | ||||
| -rw-r--r-- | modules/gallery/views/admin_maintenance.html.php | 2 | ||||
| -rw-r--r-- | modules/gallery/views/admin_maintenance_show_log.html.php | 2 | ||||
| -rw-r--r-- | modules/gallery/views/after_install.html.php | 2 | ||||
| -rw-r--r-- | modules/gallery/views/move_tree.html.php | 8 | ||||
| -rw-r--r-- | modules/gallery/views/permissions_browse.html.php | 4 | ||||
| -rw-r--r-- | modules/gallery/views/permissions_form.html.php | 2 | ||||
| -rw-r--r-- | modules/gallery/views/simple_uploader.html.php | 6 | 
17 files changed, 32 insertions, 61 deletions
diff --git a/modules/gallery/controllers/admin_advanced_settings.php b/modules/gallery/controllers/admin_advanced_settings.php index 64007fdb..d727b654 100644 --- a/modules/gallery/controllers/admin_advanced_settings.php +++ b/modules/gallery/controllers/admin_advanced_settings.php @@ -46,7 +46,7 @@ class Admin_Advanced_Settings_Controller extends Admin_Controller {      module::set_var($module_name, $var_name, Input::instance()->post("value"));      message::success(        t("Saved value for %var (%module_name)", -        array("var" => p::clean($var_name), "module_name" => $module_name))); +        array("var" => SafeString::of($var_name), "module_name" => $module_name)));      print json_encode(array("result" => "success"));    } diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index c8227d74..09b16759 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -93,7 +93,7 @@ class Movies_Controller extends Items_Controller {        log::success("content", "Updated photo", "<a href=\"photos/$photo->id\">view</a>");        message::success( -        t("Saved photo %photo_title", array("photo_title" => p::clean($photo->title)))); +        t("Saved photo %photo_title", array("photo_title" => $photo->title)));        print json_encode(          array("result" => "success", diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index 8ee24da8..3447b4c6 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -86,7 +86,7 @@ class Photos_Controller extends Items_Controller {        log::success("content", "Updated photo", "<a href=\"photos/$photo->id\">view</a>");        message::success( -        t("Saved photo %photo_title", array("photo_title" => p::clean($photo->title)))); +        t("Saved photo %photo_title", array("photo_title" => $photo->title)));        print json_encode(          array("result" => "success", diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php index de027c1b..98a5bf9f 100644 --- a/modules/gallery/controllers/quick.php +++ b/modules/gallery/controllers/quick.php @@ -89,7 +89,7 @@ class Quick_Controller extends Controller {      access::required("view", $item->parent());      access::required("edit", $item->parent()); -    $msg = t("Made <b>%title</b> this album's cover", array("title" => p::purify($item->title))); +    $msg = t("Made <b>%title</b> this album's cover", array("title" => SafeString::purify($item->title)));      item::make_album_cover($item);      message::success($msg); @@ -105,10 +105,10 @@ class Quick_Controller extends Controller {      if ($item->is_album()) {        print t(          "Delete the album <b>%title</b>? All photos and movies in the album will also be deleted.", -        array("title" => p::purify($item->title))); +        array("title" => SafeString::purify($item->title)));      } else {        print t("Are you sure you want to delete <b>%title</b>?", -              array("title" => p::purify($item->title))); +              array("title" => SafeString::purify($item->title)));      }      $form = item::get_delete_form($item); @@ -122,9 +122,9 @@ class Quick_Controller extends Controller {      access::required("edit", $item);      if ($item->is_album()) { -      $msg = t("Deleted album <b>%title</b>", array("title" => p::purify($item->title))); +      $msg = t("Deleted album <b>%title</b>", array("title" => SafeString::purify($item->title)));      } else { -      $msg = t("Deleted photo <b>%title</b>", array("title" => p::purify($item->title))); +      $msg = t("Deleted photo <b>%title</b>", array("title" => SafeString::purify($item->title)));      }      $parent = $item->parent(); diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php index 7daf6170..be555296 100644 --- a/modules/gallery/helpers/gallery_rss.php +++ b/modules/gallery/helpers/gallery_rss.php @@ -52,9 +52,9 @@ class gallery_rss_Core {          ->viewable()          ->descendants($limit, $offset, "photo");        $feed->max_pages = ceil($item->viewable()->descendants_count("photo") / $limit); -      $feed->title = p::purify($item->title); +      $feed->title = SafeString::purify($item->title);        $feed->link = url::abs_site("albums/{$item->id}"); -      $feed->description = nl2br(p::purify($item->description)); +      $feed->description = nl2br(SafeString::purify($item->description));        return $feed;      } diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php index 9edc3acd..8c0e8aa8 100644 --- a/modules/gallery/helpers/gallery_task.php +++ b/modules/gallery/helpers/gallery_task.php @@ -64,10 +64,10 @@ class gallery_task_Core {            if (!$success) {              $ignored[$item->id] = 1;              $errors[] = t("Unable to rebuild images for '%title'", -                          array("title" => p::purify($item->title))); +                          array("title" => SafeString::purify($item->title)));            } else {              $errors[] = t("Successfully rebuilt images for '%title'", -                          array("title" => p::purify($item->title))); +                          array("title" => SafeString::purify($item->title)));            }          } diff --git a/modules/gallery/helpers/p.php b/modules/gallery/helpers/p.php deleted file mode 100644 index e852c086..00000000 --- a/modules/gallery/helpers/p.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access."); -/** - * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2009 Bharat Mediratta - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA. - */ -class p_Core { -  static function clean($dirty_html) { -    return new SafeString($dirty_html); -  } - -  // Deprecated: Please use p::clean($var).purified_html() -  static function purify($dirty_html) { -    return SafeString::of($dirty_html)->purified_html(); -  } -} diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php index b37c1c73..adc15b91 100644 --- a/modules/gallery/views/admin_advanced_settings.html.php +++ b/modules/gallery/views/admin_advanced_settings.html.php @@ -20,13 +20,13 @@      <? if ($var->module_name == "gallery" && $var->name == "_cache") continue ?>      <tr class="setting">        <td> <?= $var->module_name ?> </td> -      <td> <?= p::clean($var->name) ?> </td> +      <td> <?= SafeString::of($var->name) ?> </td>        <td> -        <a href="<?= url::site("admin/advanced_settings/edit/$var->module_name/" . p::clean($var->name)) ?>" +        <a href="<?= url::site("admin/advanced_settings/edit/$var->module_name/" . SafeString::of($var->name)) ?>"            class="gDialogLink" -          title="<?= t("Edit %var (%module_name)", array("var" => p::clean($var->name), "module_name" => $var->module_name)) ?>"> +          title="<?= t("Edit %var (%module_name)", array("var" => $var->name, "module_name" => $var->module_name)) ?>">            <? if ($var->value): ?> -          <?= p::clean($var->value) ?> +          <?= SafeString::of($var->value) ?>            <? else: ?>            <i> <?= t("empty") ?> </i>            <? endif ?> diff --git a/modules/gallery/views/admin_block_log_entries.html.php b/modules/gallery/views/admin_block_log_entries.html.php index 44c1657f..b7afb22d 100644 --- a/modules/gallery/views/admin_block_log_entries.html.php +++ b/modules/gallery/views/admin_block_log_entries.html.php @@ -2,7 +2,7 @@  <ul>    <? foreach ($entries as $entry): ?>    <li class="<?= log::severity_class($entry->severity) ?>" style="direction: ltr"> -    <a href="<?= url::site("user/$entry->user_id") ?>"><?= p::clean($entry->user->name) ?></a> +    <a href="<?= url::site("user/$entry->user_id") ?>"><?= SafeString::of($entry->user->name) ?></a>      <?= gallery::date_time($entry->timestamp) ?>      <?= $entry->message ?>      <?= $entry->html ?> diff --git a/modules/gallery/views/admin_block_photo_stream.html.php b/modules/gallery/views/admin_block_photo_stream.html.php index 1e1329d1..732bdc38 100644 --- a/modules/gallery/views/admin_block_photo_stream.html.php +++ b/modules/gallery/views/admin_block_photo_stream.html.php @@ -2,9 +2,9 @@  <ul>  <? foreach ($photos as $photo): ?>    <li class="gItem gPhoto"> -    <a href="<?= url::site("photos/$photo->id") ?>" title="<?= p::clean($photo->title) ?>"> +    <a href="<?= url::site("photos/$photo->id") ?>" title="<?= SafeString::of($photo->title) ?>">        <img <?= photo::img_dimensions($photo->width, $photo->height, 72) ?> -        src="<?= $photo->thumb_url() ?>" alt="<?= p::clean($photo->title) ?>" /> +        src="<?= $photo->thumb_url() ?>" alt="<?= SafeString::of($photo->title) ?>" />      </a>    </li>  <? endforeach ?> diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php index 450eb754..a4db38ce 100644 --- a/modules/gallery/views/admin_maintenance.html.php +++ b/modules/gallery/views/admin_maintenance.html.php @@ -90,7 +90,7 @@            <?= $task->status ?>          </td>          <td> -          <?= p::clean($task->owner()->name) ?> +          <?= SafeString::of($task->owner()->name) ?>          </td>          <td>            <? if ($task->state == "stalled"): ?> diff --git a/modules/gallery/views/admin_maintenance_show_log.html.php b/modules/gallery/views/admin_maintenance_show_log.html.php index 9d850986..209aef03 100644 --- a/modules/gallery/views/admin_maintenance_show_log.html.php +++ b/modules/gallery/views/admin_maintenance_show_log.html.php @@ -12,7 +12,7 @@ appendTo('body').submit().remove();  <div id="gTaskLogDialog">    <h1> <?= $task->name ?> </h1>    <div class="gTaskLog"> -    <pre><?= p::purify($task->get_log()) ?></pre> +    <pre><?= SafeString::purify($task->get_log()) ?></pre>    </div>    <button id="gCloseButton" class="ui-state-default ui-corner-all" onclick="dismiss()"><?= t("Close") ?></button>    <button id="gSaveButton" class="ui-state-default ui-corner-all" onclick="download()"><?= t("Save") ?></button> diff --git a/modules/gallery/views/after_install.html.php b/modules/gallery/views/after_install.html.php index e4842163..2cf8ec8f 100644 --- a/modules/gallery/views/after_install.html.php +++ b/modules/gallery/views/after_install.html.php @@ -8,7 +8,7 @@  </p>  <p> -  <?= t("You're logged in to the <b>%user_name</b> account.  The very first thing you should do is to change your password to something that you'll remember.", array("user_name" => p::clean($user->name))) ?> +  <?= t("You're logged in to the <b>%user_name</b> account.  The very first thing you should do is to change your password to something that you'll remember.", array("user_name" => $user->name)) ?>  </p>  <p> diff --git a/modules/gallery/views/move_tree.html.php b/modules/gallery/views/move_tree.html.php index 5f70cf67..7818a42a 100644 --- a/modules/gallery/views/move_tree.html.php +++ b/modules/gallery/views/move_tree.html.php @@ -1,18 +1,18 @@  <?php defined("SYSPATH") or die("No direct script access.") ?>  <?= $parent->thumb_img(array(), 25); ?>  <? if (!access::can("edit", $parent) || $source->is_descendant($parent)): ?> -<a href="javascript:load_tree('<?= $parent->id ?>',1)"> <?= p::clean($parent->title) ?> <?= t("(locked)") ?> </a> +<a href="javascript:load_tree('<?= $parent->id ?>',1)"> <?= SafeString::of($parent->title) ?> <?= t("(locked)") ?> </a>  <? else: ?> -<a href="javascript:load_tree('<?= $parent->id ?>',0)"> <?= p::clean($parent->title) ?></a> +<a href="javascript:load_tree('<?= $parent->id ?>',0)"> <?= SafeString::of($parent->title) ?></a>  <? endif ?>  <ul id="tree_<?= $parent->id ?>">    <? foreach ($children as $child): ?>    <li id="node_<?= $child->id ?>" class="node">      <?= $child->thumb_img(array(), 25); ?>      <? if (!access::can("edit", $child) || $source->is_descendant($child)): ?> -    <a href="javascript:load_tree('<?= $child->id ?>',1)"> <?= p::clean($child->title) ?> <?= t("(locked)") ?></a> +    <a href="javascript:load_tree('<?= $child->id ?>',1)"> <?= SafeString::of($child->title) ?> <?= t("(locked)") ?></a>      <? else: ?> -    <a href="javascript:load_tree('<?= $child->id ?>',0)"> <?= p::clean($child->title) ?> </a> +    <a href="javascript:load_tree('<?= $child->id ?>',0)"> <?= SafeString::of($child->title) ?> </a>      <? endif ?>    </li>    <? endforeach ?> diff --git a/modules/gallery/views/permissions_browse.html.php b/modules/gallery/views/permissions_browse.html.php index 888a27f7..9ea0da25 100644 --- a/modules/gallery/views/permissions_browse.html.php +++ b/modules/gallery/views/permissions_browse.html.php @@ -35,14 +35,14 @@      <? foreach ($parents as $parent): ?>      <li>        <a href="javascript:show(<?= $parent->id ?>)"> -        <?= p::clean($parent->title) ?> +        <?= SafeString::of($parent->title) ?>        </a>        <div class="form" id="edit-<?= $parent->id ?>"></div>        <ul>          <? endforeach ?>          <li>            <a href="javascript:show(<?= $item->id ?>)"> -            <?= p::purify($item->title) ?> +            <?= SafeString::purify($item->title) ?>            </a>            <div class="form" id="edit-<?= $item->id ?>">              <?= $form ?> diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php index ee5e3a24..adc0496f 100644 --- a/modules/gallery/views/permissions_form.html.php +++ b/modules/gallery/views/permissions_form.html.php @@ -6,7 +6,7 @@      <tr>        <th> </th>        <? foreach ($groups as $group): ?> -      <th> <?= p::clean($group->name) ?> </th> +      <th> <?= SafeString::of($group->name) ?> </th>        <? endforeach ?>      </tr> diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php index 38ac518c..56e568f6 100644 --- a/modules/gallery/views/simple_uploader.html.php +++ b/modules/gallery/views/simple_uploader.html.php @@ -6,7 +6,7 @@  <!-- hack to set the title for the dialog -->  <form id="gAddPhotosForm" action="<?= url::site("simple_uploader/finish?csrf=$csrf") ?>">    <fieldset> -    <legend> <?= t("Add photos to %album_title", array("album_title" => p::purify($item->title))) ?> </legend> +    <legend> <?= t("Add photos to %album_title", array("album_title" => SafeString::purify($item->title))) ?> </legend>    </fieldset>  </form> @@ -26,9 +26,9 @@    </p>    <ul class="gBreadcrumbs">      <? foreach ($item->parents() as $parent): ?> -    <li> <?= p::clean($parent->title) ?> </li> +    <li> <?= SafeString::of($parent->title) ?> </li>      <? endforeach ?> -    <li class="active"> <?= p::purify($item->title) ?> </li> +    <li class="active"> <?= SafeString::purify($item->title) ?> </li>    </ul>    <p>  | 
