Skip to content

Commit

Permalink
Tabs to spaces cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andyst committed Aug 31, 2009
1 parent 00c73ec commit df38a89
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 228 deletions.
32 changes: 16 additions & 16 deletions modules/gallery/controllers/admin_languages.php
Expand Up @@ -21,10 +21,10 @@ class Admin_Languages_Controller extends Admin_Controller {
public function index($share_translations_form=null) {
$v = new Admin_View("admin.html");
$v->content = new View("admin_languages.html");
$v->content->available_locales = locales::available();
$v->content->available_locales = locales::available();
$v->content->installed_locales = locales::installed();
$v->content->default_locale = module::get_var("gallery", "default_locale");
if (empty($share_translations_form)) {
$share_translations_form = $this->_share_translations_form();
}
Expand All @@ -35,21 +35,21 @@ public function index($share_translations_form=null) {

public function save() {
access::verify_csrf();
locales::update_installed($this->input->post("installed_locales"));
$installed_locales = array_keys(locales::installed());
locales::update_installed($this->input->post("installed_locales"));
$installed_locales = array_keys(locales::installed());
$new_default_locale = $this->input->post("default_locale");
if (!in_array($new_default_locale, $installed_locales)) {
if (!empty($installed_locales)) {
$new_default_locale = $installed_locales[0];
} else {
$new_default_locale = "en_US";
}
}
module::set_var("gallery", "default_locale", $new_default_locale);
print json_encode(array("result" => "success"));
if (!in_array($new_default_locale, $installed_locales)) {
if (!empty($installed_locales)) {
$new_default_locale = $installed_locales[0];
} else {
$new_default_locale = "en_US";
}
}
module::set_var("gallery", "default_locale", $new_default_locale);
print json_encode(array("result" => "success"));
}

public function share() {
Expand Down
8 changes: 4 additions & 4 deletions modules/gallery/controllers/l10n_client.php
Expand Up @@ -90,13 +90,13 @@ public function toggle_l10n_mode() {
}

$session = Session::instance();
$l10n_mode = $session->get("l10n_mode", false);
$l10n_mode = $session->get("l10n_mode", false);
$session->set("l10n_mode", !$l10n_mode);

$redirect_url = "admin/languages";
if (!$l10n_mode) {
$redirect_url .= "#l10n-client";
}
if (!$l10n_mode) {
$redirect_url .= "#l10n-client";
}

url::redirect($redirect_url);
}
Expand Down
6 changes: 3 additions & 3 deletions modules/gallery/helpers/gallery.php
Expand Up @@ -92,19 +92,19 @@ static function site_menu($menu, $theme) {
$can_add = $item && access::can("add", $item);

if ($can_add) {
$menu->append($add_menu = Menu::factory("submenu")
$menu->append($add_menu = Menu::factory("submenu")
->id("add_menu")
->label(t("Add")));
$add_menu->append(Menu::factory("dialog")
->id("add_photos_item")
->label(t("Add photos"))
->url(url::site("simple_uploader/app/$item->id")));
if ($item->is_album()) {
$add_menu->append(Menu::factory("dialog")
$add_menu->append(Menu::factory("dialog")
->id("add_album_item")
->label(t("Add an album"))
->url(url::site("form/add/albums/$item->id?type=album")));
}
}
}

$menu->append($options_menu = Menu::factory("submenu")
Expand Down
4 changes: 2 additions & 2 deletions modules/gallery/libraries/SafeString.php
Expand Up @@ -120,8 +120,8 @@ function for_js() {
function for_html_attr() {
$string = (string) $this->for_html();
return strtr($string,
array("'"=>"'",
'"'=>'"'));
array("'"=>"'",
'"'=>'"'));
}

/**
Expand Down
10 changes: 5 additions & 5 deletions modules/gallery/tests/Html_Helper_Test.php
Expand Up @@ -21,14 +21,14 @@ class Html_Helper_Test extends Unit_Test_Case {
public function clean_test() {
$safe_string = html::clean("hello <p >world</p>");
$this->assert_equal("hello &lt;p &gt;world&lt;/p&gt;",
$safe_string);
$safe_string);
$this->assert_true($safe_string instanceof SafeString);
}

public function purify_test() {
$safe_string = html::purify("hello <p >world</p>");
$this->assert_equal("hello <p>world</p>",
$safe_string);
$safe_string);
$this->assert_true($safe_string instanceof SafeString);
}

Expand All @@ -37,19 +37,19 @@ public function mark_safe_test() {
$this->assert_true($safe_string instanceof SafeString);
$safe_string_2 = html::clean($safe_string);
$this->assert_equal("hello <p >world</p>",
$safe_string_2);
$safe_string_2);
}

public function js_string_test() {
$string = html::js_string("hello's <p >world</p>");
$this->assert_equal('"hello\'s <p >world<\\/p>"',
$string);
$string);
}

public function clean_attribute_test() {
$safe_string = SafeString::of_safe_html("hello's <p >world</p>");
$safe_string = html::clean_attribute($safe_string);
$this->assert_equal("hello&#039;s <p >world</p>",
$safe_string);
$safe_string);
}
}
14 changes: 7 additions & 7 deletions modules/gallery/tests/SafeString_Test.php
Expand Up @@ -21,19 +21,19 @@ class SafeString_Test extends Unit_Test_Case {
public function toString_escapes_for_html_test() {
$safe_string = new SafeString("hello <p>world</p>");
$this->assert_equal("hello &lt;p&gt;world&lt;/p&gt;",
$safe_string);
$safe_string);
}

public function toString_for_safe_string_test() {
$safe_string = SafeString::of_safe_html("hello <p>world</p>");
$this->assert_equal("hello <p>world</p>",
$safe_string);
$safe_string);
}

public function for_html_test() {
$safe_string = new SafeString("hello <p>world</p>");
$this->assert_equal("hello &lt;p&gt;world&lt;/p&gt;",
$safe_string->for_html());
$safe_string->for_html());
}

public function safestring_of_safestring_test() {
Expand All @@ -50,27 +50,27 @@ public function for_js_test() {
$safe_string = new SafeString('"<em>Foo</em>\'s bar"');
$js_string = $safe_string->for_js();
$this->assert_equal('"\\"<em>Foo<\\/em>\'s bar\\""',
$js_string);
$js_string);
}

public function for_html_attr_test() {
$safe_string = new SafeString('"<em>Foo</em>\'s bar"');
$attr_string = $safe_string->for_html_attr();
$this->assert_equal('&quot;&lt;em&gt;Foo&lt;/em&gt;&#039;s bar&quot;',
$attr_string);
$attr_string);
}

public function for_html_attr_with_safe_html_test() {
$safe_string = SafeString::of_safe_html('"<em>Foo</em>\'s bar"');
$attr_string = $safe_string->for_html_attr();
$this->assert_equal('&quot;<em>Foo</em>&#039;s bar&quot;',
$attr_string);
$attr_string);
}

public function string_safestring_equality_test() {
$safe_string = new SafeString("hello <p>world</p>");
$this->assert_equal("hello <p>world</p>",
$safe_string->unescaped());
$safe_string->unescaped());
$escaped_string = "hello &lt;p&gt;world&lt;/p&gt;";
$this->assert_equal($escaped_string, $safe_string);

Expand Down

0 comments on commit df38a89

Please sign in to comment.