File: nostats

package info (click to toggle)
movabletype-opensource 5.1.4%2Bdfsg-4%2Bdeb7u3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 32,996 kB
  • sloc: perl: 197,285; php: 62,405; sh: 166; xml: 117; makefile: 83; sql: 32
file content (95 lines) | stat: -rw-r--r-- 3,172 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Description: disable stats code which depended on non-free flash
Origin: upstream, https://github.com/movabletype/mt-plugin-NoStats
--- /dev/null
+++ movabletype-opensource-4.3.5+dfsg/plugins/NoStats/NoStats.pl
@@ -0,0 +1,90 @@
+##############################################################################
+# Copyright © 2010 Six Apart Ltd.
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation, 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
+# version 2 for more details.  You should have received a copy of the GNU
+# General Public License version 2 along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+package MT::Plugin::NoStats;
+
+use strict;
+use warnings;
+
+use base qw( MT::Plugin );
+use MT;
+
+use vars qw( $VERSION $PLUGIN_ID );
+$VERSION = '0.32';
+$PLUGIN_ID = 'no_stats';
+
+my $plugin = MT::Plugin::NoStats->new ({
+    id => $PLUGIN_ID,
+    name        => 'NoStats',
+    description => 'No stats!',
+    version     => $VERSION,
+
+    author_name => 'Six Apart',
+    author_link => 'http://www.sixapart.com/',
+});
+MT->add_plugin ($plugin);
+
+sub init_registry {
+    my $component = shift;
+    my $reg = {
+
+        author      => 'Six Apart',
+        init_app            => \&initialize,
+        callbacks => {
+            'MT::App::CMS::template_source.blog_stats'   => \&source_dashboard,
+        },
+    };
+    $component->registry($reg);
+}
+
+sub initialize {
+    my $plugin = shift;
+    my ($app) = @_;
+    eval { require MT::Community::CMS; };
+    if (!$@) {
+        my $mt_most_popular_entries_widget = \&MT::Community::CMS::most_popular_entries_widget;
+        {
+            local $SIG{__WARN__} = sub {  };
+            *MT::Community::CMS::most_popular_entries_widget = \&most_popular_entries_widget;
+        }
+    }
+    require MT::CMS::Dashboard;
+    my $mt_generate_dashboard_stats = \&MT::CMS::Dashboard::generate_dashboard_stats;
+    {
+        local $SIG{__WARN__} = sub {  };
+        *MT::CMS::Dashboard::generate_dashboard_stats = \&generate_dashboard_stats;
+    }
+}
+
+sub generate_dashboard_stats {
+    return 0;
+}
+
+sub most_popular_entries_widget {
+    1;
+}
+
+sub source_dashboard {
+    my ($cb, $app, $template) = @_;
+    my $old = q{<mt:setvarblock name="error"><__trans phrase="Movable Type was unable to locate your 'mt-static' directory. Please configure the 'StaticFilePath' configuration setting in your mt-config.cgi file, and create a writable 'support' directory underneath your 'mt-static' directory."></mt:setvarblock>};
+    $old = quotemeta($old);
+    $$template =~ s/$old//;
+    $old = q{<mtapp:statusmsg
+            id="generic-error"
+            class="error">
+            <mt:var name="error">
+        </mtapp:statusmsg>};
+    $old = quotemeta($old);
+    $$template =~ s/$old//;
+}
+
+1;