Skip to content

Commit

Permalink
Rename mark_safe() to mark_clean()
Browse files Browse the repository at this point in the history
  • Loading branch information
andyst committed Aug 31, 2009
1 parent 6d26b0d commit ddb84c8
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion modules/akismet/helpers/akismet.php
Expand Up @@ -94,7 +94,7 @@ static function check_config() {
if (empty($api_key)) {
site_status::warning(
t("Akismet is not quite ready! Please provide an <a href=\"%url\">API Key</a>",
array("url" => html::mark_safe(url::site("admin/akismet")))),
array("url" => html::mark_clean(url::site("admin/akismet")))),
"akismet_config");
} else {
site_status::clear("akismet_config");
Expand Down
2 changes: 1 addition & 1 deletion modules/digibug/views/admin_digibug.html.php
Expand Up @@ -16,7 +16,7 @@
<p>
<?= t("You don't need an account with Digibug, but if you <a href=\"%signup_url\">register with Digibug</a> and enter your Digibug id in the <a href=\"%advanced_settings_url\">Advanced Settings</a> page you can make money off of your photos!",
array("signup_url" => "http://www.digibug.com/signup.php",
"advanced_settings_url" => html::mark_safe(url::site("admin/advanced_settings")))) ?>
"advanced_settings_url" => html::mark_clean(url::site("admin/advanced_settings")))) ?>
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion modules/exif/helpers/exif.php
Expand Up @@ -164,7 +164,7 @@ static function check_index() {
if ($remaining) {
site_status::warning(
t('Your Exif index needs to be updated. <a href="%url" class="gDialogLink">Fix this now</a>',
array("url" => html::mark_safe(url::site("admin/maintenance/start/exif_task::update_index?csrf=__CSRF__")))),
array("url" => html::mark_clean(url::site("admin/maintenance/start/exif_task::update_index?csrf=__CSRF__")))),
"exif_index_out_of_date");
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/g2_import/views/admin_g2_import.html.php
Expand Up @@ -39,7 +39,7 @@
<?= t("Your most common thumbnail size in Gallery 2 is %g2_pixels pixels, but your Gallery 3 thumbnail size is set to %g3_pixels pixels. <a href=\"%url\">Using the same value</a> will speed up your import.",
array("g2_pixels" => $g2_sizes["thumb"]["size"],
"g3_pixels" => $thumb_size,
"url" => html::mark_safe(url::site("admin/theme_options")))) ?>
"url" => html::mark_clean(url::site("admin/theme_options")))) ?>
</li>
<? endif ?>

Expand All @@ -48,7 +48,7 @@
<?= t("Your most common intermediate size in Gallery 2 is %g2_pixels pixels, but your Gallery 3 thumbnail size is set to %g3_pixels pixels. <a href=\"%url\">Using the same value</a> will speed up your import.",
array("g2_pixels" => $g2_sizes["resize"]["size"],
"g3_pixels" => $resize_size,
"url" => html::mark_safe(url::site("admin/theme_options")))) ?>
"url" => html::mark_clean(url::site("admin/theme_options")))) ?>
</li>
<? endif ?>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/controllers/admin_languages.php
Expand Up @@ -111,7 +111,7 @@ private function _share_translations_form() {
$group->input("api_key")
->label(empty($api_key)
? t("This is a unique key that will allow you to send translations to the remote server. To get your API key go to %server-link.",
array("server-link" => html::mark_safe(html::anchor($server_link))))
array("server-link" => html::mark_clean(html::anchor($server_link))))
: t("API Key"))
->value($api_key)
->error_messages("invalid", t("The API key you provided is invalid."));
Expand Down
6 changes: 3 additions & 3 deletions modules/gallery/helpers/MY_html.php
Expand Up @@ -51,12 +51,12 @@ static function purify($html) {
*
* Example:<pre>
* // Parameters to t() are automatically escaped by default.
* // If the parameter is marked as safe, it won't get escaped.
* // If the parameter is marked as clean, it won't get escaped.
* t('Go <a href="%url">there</a>',
* array("url" => html::mark_safe(url::current())))
* array("url" => html::mark_clean(url::current())))
* </pre>
*/
static function mark_safe($html) {
static function mark_clean($html) {
return SafeString::of_safe_html($html);
}

Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/helpers/graphics.php
Expand Up @@ -443,7 +443,7 @@ static function choose_default_toolkit() {
if (!module::get_var("gallery", "graphics_toolkit")) {
site_status::warning(
t("Graphics toolkit missing! Please <a href=\"%url\">choose a toolkit</a>",
array("url" => html::mark_safe(url::site("admin/graphics")))),
array("url" => html::mark_clean(url::site("admin/graphics")))),
"missing_graphics_toolkit");
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/gallery/tests/Html_Helper_Test.php
Expand Up @@ -32,8 +32,8 @@ public function purify_test() {
$this->assert_true($safe_string instanceof SafeString);
}

public function mark_safe_test() {
$safe_string = html::mark_safe("hello <p >world</p>");
public function mark_clean_test() {
$safe_string = html::mark_clean("hello <p >world</p>");
$this->assert_true($safe_string instanceof SafeString);
$safe_string_2 = html::clean($safe_string);
$this->assert_equal("hello <p >world</p>",
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/tests/Xss_Security_Test.php
Expand Up @@ -195,7 +195,7 @@ public function find_unescaped_variables_in_views_test() {
in_array($tokens[$token_number + 2][1],
array("clean", "purify", "js_string", "clean_attribute")) &&
self::_token_matches("(", $tokens, $token_number + 3)) {
// Not checking for mark_safe(). We want such calls to be marked dirty (thus reviewed).
// Not checking for mark_clean(). We want such calls to be marked dirty (thus reviewed).

$method = $tokens[$token_number + 2][1];
$frame->expr_append("::$method(");
Expand Down
10 changes: 5 additions & 5 deletions modules/gallery/views/admin_block_welcome.html.php
Expand Up @@ -5,16 +5,16 @@
<ul>
<li>
<?= t("General Settings - choose your <a href=\"%graphics_url\">graphics</a> and <a href=\"%language_url\">language</a> settings.",
array("graphics_url" => html::mark_safe(url::site("admin/graphics")),
"language_url" => html::mark_safe(url::site("admin/languages")))) ?>
array("graphics_url" => html::mark_clean(url::site("admin/graphics")),
"language_url" => html::mark_clean(url::site("admin/languages")))) ?>
</li>
<li>
<?= t("Appearance - <a href=\"%theme_url\">choose a theme</a>, or <a href=\"%theme_options_url\">customize the way it looks</a>.",
array("theme_url" => html::mark_safe(url::site("admin/themes")),
"theme_options_url" => html::mark_safe(url::site("admin/theme_options")))) ?>
array("theme_url" => html::mark_clean(url::site("admin/themes")),
"theme_options_url" => html::mark_clean(url::site("admin/theme_options")))) ?>
</li>
<li>
<?= t("Customize - <a href=\"%modules_url\">install modules</a> to add cool features!",
array("modules_url" => html::mark_safe(url::site("admin/modules")))) ?>
array("modules_url" => html::mark_clean(url::site("admin/modules")))) ?>
</li>
</ul>
2 changes: 1 addition & 1 deletion modules/gallery/views/permissions_browse.html.php
Expand Up @@ -29,7 +29,7 @@
<ul id="gMessage">
<li class="gError">
<?= t("Oh no! Your server needs a configuration change in order for you to hide photos! Ask your server administrator to enable <a %mod_rewrite_attrs>mod_rewrite</a> and set <a %apache_attrs><i>AllowOverride FileInfo Options</i></a> to fix this.",
array("mod_rewrite_attrs" => html::mark_safe("href=\"http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html\" target=\"_blank\"", "apache_attrs" => "href=\"http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride\" target=\"_blank\""))) ?>
array("mod_rewrite_attrs" => html::mark_clean("href=\"http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html\" target=\"_blank\"", "apache_attrs" => "href=\"http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride\" target=\"_blank\""))) ?>
</li>
</ul>
<? endif ?>
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/views/upgrader.html.php
Expand Up @@ -18,7 +18,7 @@
<h1> <?= t("That's it!") ?> </h1>
<p>
<?= t("Your <a href=\"%url\">Gallery</a> is up to date.",
array("url" => html::mark_safe(url::site("albums/1")))) ?>
array("url" => html::mark_clean(url::site("albums/1")))) ?>
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion modules/recaptcha/helpers/recaptcha.php
Expand Up @@ -43,7 +43,7 @@ static function check_config() {
if (empty($public_key) || empty($private_key)) {
site_status::warning(
t("reCAPTCHA is not quite ready! Please configure the <a href=\"%url\">reCAPTCHA Keys</a>",
array("url" => html::mark_safe(url::site("admin/recaptcha")))),
array("url" => html::mark_clean(url::site("admin/recaptcha")))),
"recaptcha_config");
} else {
site_status::clear("recaptcha_config");
Expand Down
2 changes: 1 addition & 1 deletion modules/search/helpers/search.php
Expand Up @@ -58,7 +58,7 @@ static function check_index() {
if ($remaining) {
site_status::warning(
t('Your search index needs to be updated. <a href="%url" class="gDialogLink">Fix this now</a>',
array("url" => html::mark_safe(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))),
array("url" => html::mark_clean(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))),
"search_index_out_of_date");
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/server_add/helpers/server_add.php
Expand Up @@ -25,7 +25,7 @@ static function check_config($paths=null) {
if (empty($paths)) {
site_status::warning(
t("Server Add needs configuration. <a href=\"%url\">Configure it now!</a>",
array("url" => html::mark_safe(url::site("admin/server_add")))),
array("url" => html::mark_clean(url::site("admin/server_add")))),
"server_add_configuration");
} else {
site_status::clear("server_add_configuration");
Expand Down
2 changes: 1 addition & 1 deletion modules/user/views/login.html.php
Expand Up @@ -8,7 +8,7 @@
</li>
<? else: ?>
<li class="first">
<?= t('Logged in as %name', array('name' => html::mark_safe(
<?= t('Logged in as %name', array('name' => html::mark_clean(
'<a href="' . url::site("form/edit/users/{$user->id}") .
'" title="' . t("Edit Your Profile")->for_html_attr() .
'" id="gUserProfileLink" class="gDialogLink">' .
Expand Down
2 changes: 1 addition & 1 deletion modules/user/views/reset_password.html.php
Expand Up @@ -10,7 +10,7 @@
</p>
<p>
<?= t("We received a request to reset your password for <a href=\"%site_url\">%site_url</a>. If you made this request, you can confirm it by <a href=\"%confirm_url\">clicking this link</a>. If you didn't request this password reset, it's ok to ignore this mail.",
array("site_url" => html::mark_safe(url::base(false, "http")),
array("site_url" => html::mark_clean(url::base(false, "http")),
"confirm_url" => $confirm_url)) ?>
</p>
</body>
Expand Down

0 comments on commit ddb84c8

Please sign in to comment.