1
0

Clean up style

This commit is contained in:
Bharat Mediratta 2009-07-11 08:24:22 -07:00
parent 5153654060
commit 7665546022
5 changed files with 35 additions and 51 deletions

View File

@ -1,4 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.");/** <?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor * Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta * Copyright (C) 2000-2009 Bharat Mediratta
* *
@ -16,40 +17,33 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
class Admin_Google_Analytics_Controller extends Admin_Controller class Admin_Google_Analytics_Controller extends Admin_Controller {
{ public function index() {
public function index()
{
print $this->_get_view(); print $this->_get_view();
} }
public function handler() public function handler() {
{
access::verify_csrf(); access::verify_csrf();
$form = $this->_get_form(); $form = $this->_get_form();
if ($form->validate()) {
if ($form->validate()) module::set_var(
{ "google_analytics", "code", $form->google_analytics_code->analytics_code->value);
module::set_var("google_analytics", "code", $form->google_analytics_code->inputs["analytics_code"]->value);
url::redirect("admin/google_analytics"); url::redirect("admin/google_analytics");
} }
print $this->_get_view($form); print $this->_get_view($form);
} }
private function _get_view($form=null) private function _get_view($form=null) {
{
$v = new Admin_View("admin.html"); $v = new Admin_View("admin.html");
$v->content = new View("admin_google_analytics.html"); $v->content = new View("admin_google_analytics.html");
$v->content->form = empty($form) ? $this->_get_form() : $form; $v->content->form = empty($form) ? $this->_get_form() : $form;
return $v; return $v;
} }
private function _get_form() private function _get_form() {
{ $form = new Forge("admin/google_analytics/handler", "", "post", array("id" => "gAdminForm"));
$form = new Forge("admin/google_analytics/handler", "", "post",
array("id" => "gAdminForm"));
$group = $form->group("google_analytics_code"); $group = $form->group("google_analytics_code");
$group->input("analytics_code")->label(t('Enter the <a href="http://www.google.com/support/googleanalytics/bin/answer.py?answer=113500" target="_blank">Web-Property-ID</a> given by Google.'))->rules("required")->value(module::get_var("google_analytics", "code")); $group->input("analytics_code")->label(t('Enter the <a href="http://www.google.com/support/googleanalytics/bin/answer.py?answer=113500" target="_blank">Web-Property-ID</a> given by Google.'))->rules("required")->value(module::get_var("google_analytics", "code"));
$group->submit("submit")->value(t("Save")); $group->submit("submit")->value(t("Save"));

View File

@ -1,4 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.");/** <?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor * Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta * Copyright (C) 2000-2009 Bharat Mediratta
* *
@ -16,23 +17,13 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
class google_analytics_installer class google_analytics_installer {
{ static function install() {
static function install() module::set_var("google_analytics", "code", "");
{ module::set_version("google_analytics", 2);
$version = module::get_version("google_analytics");
module::set_var("google_analytics", "code", "");
module::set_version("google_analytics", $version);
} }
static function upgrade($version) static function uninstall() {
{ module::clear_var("google_analytics", "code");
module::set_version("google_analytics", $version);
}
static function uninstall()
{
module::clear_var("google_analytics", "code");
module::delete("google_analytics");
} }
} }

View File

@ -1,4 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.");/** <?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor * Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta * Copyright (C) 2000-2009 Bharat Mediratta
* *
@ -20,8 +21,8 @@ class google_analytics_menu {
static function admin($menu, $theme) { static function admin($menu, $theme) {
$menu->get("settings_menu") $menu->get("settings_menu")
->append(Menu::factory("link") ->append(Menu::factory("link")
->id("google_analytics_menu") ->id("google_analytics_menu")
->label(t("Google Analytics")) ->label(t("Google Analytics"))
->url(url::site("admin/google_analytics"))); ->url(url::site("admin/google_analytics")));
} }
} }

View File

@ -1,4 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.");/** <?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor * Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta * Copyright (C) 2000-2009 Bharat Mediratta
* *
@ -16,13 +17,11 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
class google_analytics_theme class google_analytics_theme {
{ static function page_bottom($theme) {
static function page_bottom($theme) $google_code = '
{
$google_code = '
<!-- Begin Google Analytics --> <!-- Begin Google Analytics -->
<script type="text/javascript"> <script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www."); "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E")); document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
@ -36,8 +35,7 @@ class google_analytics_theme
catch(err){} catch(err){}
</script> </script>
<!-- End Google Analytics -->'; <!-- End Google Analytics -->';
return $google_code; return $google_code;
} }
} }

View File

@ -1,3 +1,3 @@
name = Google Analytics name = Google Analytics
description = Renders the Google Analytics Code at the end of the page. description = Renders the Google Analytics Code at the end of the page. (by mcp)
version = 1.2 version = 1.2