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
* Copyright (C) 2000-2009 Bharat Mediratta
*
@ -16,40 +17,33 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Admin_Google_Analytics_Controller extends Admin_Controller
{
public function index()
{
class Admin_Google_Analytics_Controller extends Admin_Controller {
public function index() {
print $this->_get_view();
}
public function handler()
{
public function handler() {
access::verify_csrf();
$form = $this->_get_form();
if ($form->validate())
{
module::set_var("google_analytics", "code", $form->google_analytics_code->inputs["analytics_code"]->value);
if ($form->validate()) {
module::set_var(
"google_analytics", "code", $form->google_analytics_code->analytics_code->value);
url::redirect("admin/google_analytics");
}
print $this->_get_view($form);
}
private function _get_view($form=null)
{
private function _get_view($form=null) {
$v = new Admin_View("admin.html");
$v->content = new View("admin_google_analytics.html");
$v->content->form = empty($form) ? $this->_get_form() : $form;
return $v;
}
private function _get_form()
{
$form = new Forge("admin/google_analytics/handler", "", "post",
array("id" => "gAdminForm"));
private function _get_form() {
$form = new Forge("admin/google_analytics/handler", "", "post", array("id" => "gAdminForm"));
$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->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
* Copyright (C) 2000-2009 Bharat Mediratta
*
@ -16,23 +17,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class google_analytics_installer
{
static function install()
{
$version = module::get_version("google_analytics");
module::set_var("google_analytics", "code", "");
module::set_version("google_analytics", $version);
class google_analytics_installer {
static function install() {
module::set_var("google_analytics", "code", "");
module::set_version("google_analytics", 2);
}
static function upgrade($version)
{
module::set_version("google_analytics", $version);
}
static function uninstall()
{
module::clear_var("google_analytics", "code");
module::delete("google_analytics");
static function uninstall() {
module::clear_var("google_analytics", "code");
}
}

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
* Copyright (C) 2000-2009 Bharat Mediratta
*
@ -20,8 +21,8 @@ class google_analytics_menu {
static function admin($menu, $theme) {
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("google_analytics_menu")
->label(t("Google Analytics"))
->url(url::site("admin/google_analytics")));
->id("google_analytics_menu")
->label(t("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
* Copyright (C) 2000-2009 Bharat Mediratta
*
@ -16,13 +17,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class google_analytics_theme
{
static function page_bottom($theme)
{
$google_code = '
class google_analytics_theme {
static function page_bottom($theme) {
$google_code = '
<!-- Begin Google Analytics -->
<script type="text/javascript">
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
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){}
</script>
<!-- End Google Analytics -->';
return $google_code;
return $google_code;
}
}

View File

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