PluginProbe
TWIPLA – Website Intelligence / trunk
TWIPLA – Website Intelligence vtrunk
trunk 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.1.0 1.2.0 1.3.0
visitor-analytics-io / visitor-analytics-io.php

visitor-analytics-io.php in TWIPLA – Website Intelligence trunk, at visitor-analytics-io.php

160 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: TWIPLA
4 * Description: The Website Intelligence Platform. - Unlock Your Website’s True Potential! Goodbye Awkward Analytics. Welcome Website Intelligence.
5
6 URL: https://www.twipla.com.io/en/ © TWIPLA
7 * Author: TWIPLA
8 * Author URI: https://www.twipla.com/
9 * Version: 1.3.0
10 * License: GPLv3
11 * License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
12 * Text Domain: visitor-analytics
13 *
14 */
15
16 if(!defined('ABSPATH')) {
17 exit;
18 }
19
20 // add initialization action
21 add_action('plugins_loaded', 'VisitorAnalytics_plugin_init');
22
23 //
24 register_activation_hook(__FILE__, 'visitor_analytics_activation');
25 function visitor_analytics_activation() {
26 // exit(wp_redirect(admin_url('/wp-admin/options-general.php?page=visitor_analytics_settings')));
27 // exit(wp_redirect('options-general.php?page=visitor_analytics_settings'));
28 }
29
30 // do not auto-update user on updates
31 add_filter('auto_plugin_update_send_email', '__return_false');
32
33 /**
34 */
35 function VisitorAnalytics_plugin_init() {
36
37 if (!class_exists('WP_VisitorAnalytics')):
38
39 class WP_VisitorAnalytics {
40 /**
41 * @var Const Plugin Version Number
42 */
43 const VERSION = '1.1.0';
44
45 /**
46 * @var Singleton The reference the *Singleton* instance of this class
47 */
48 private static $instance;
49
50 /**
51 * Returns the *Singleton* instance of this class.
52 *
53 * @return Singleton The *Singleton* instance.
54 */
55 public static function get_instance() {
56 if ( null === self::$instance ) {
57 self::$instance = new self();
58 }
59 return self::$instance;
60 }
61
62 private function __clone() {}
63
64 public function __wakeup() {}
65
66 /**
67 * Protected constructor to prevent creating a new instance of the
68 * *Singleton* via the `new` operator from outside of this class.
69 */
70 private function __construct() {
71 add_action('admin_init', array($this, 'install'));
72 $this->init();
73 // redirect now
74 //$this->redirectToTheSettingsPage();
75 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ $this, 'add_action_links' ] );
76 add_filter( 'plugin_row_meta', [ $this, 'add_row_meta' ], 10, 4 );
77 }
78
79 /**
80 * Init the plugin after plugins_loaded so environment variables are set.
81 *
82 * @since 1.0.0
83 */
84 public function init() {
85 require_once( dirname( __FILE__ ) . '/includes/class-visitoranalytics.php' );
86 // derive class
87 $VisitorAnalytics = new VisitorAnalytics();
88 $VisitorAnalytics->init();
89 // redirect to the settings page
90 // wp_redirect('options-general.php?page=visitor_analytics_settings');
91 // exit; // wp_redirect does not exit()
92 }
93
94 /**
95 */
96 public function redirectToTheSettingsPage() {
97 //
98 exit(wp_redirect('options-general.php?page=visitor_analytics_settings'));
99 }
100
101 /**
102 * Updates the plugin version in db
103 *
104 * @since 1.0.0
105 */
106 public function update_plugin_version() {
107 delete_option('visitor_analytics_version');
108 update_option('visitor_analytics_version', self::VERSION);
109 }
110
111 /**
112 * Handles upgrade routines.
113 *
114 * @since 1.0.0
115 */
116 public function install() {
117 if(!is_plugin_active(plugin_basename( __FILE__ ))) {
118 return;
119 }
120
121 if(( self::VERSION !== get_option('visitor_analytics_version'))) {
122 $this->update_plugin_version();
123 }
124 }
125
126 /**
127 * Adds plugin action links.
128 *
129 * @since 1.2.0
130 */
131 public function add_action_links( $links ) {
132 $plugin_links = array(
133 '<a href="https://www.twipla.com/en/pricing">Get Premium TWIPLA</a>',
134 '<a href="' . admin_url( "options-general.php?page=visitor_analytics_settings" ) . '">Settings</a>',
135 '<a href="https://www.twipla.com/en/support/all-about-features">Support</a>',
136 );
137 return array_merge( $links, $plugin_links );
138 }
139
140 /**
141 * Adds plugin row meta.
142 *
143 * @since 1.2.0
144 */
145 public function add_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
146 $plugin_links = [];
147 if ( strpos( $plugin_file, basename(__FILE__) ) ) {
148 $plugin_links = array(
149 '<a target="_blank" href="https://app.twipla.com/register?voucher=WP_UNLIMITED30">Get 30 Days of FREE Premium TWIPLA Now!</a>',
150 );
151 }
152
153 return array_merge( $plugin_meta, $plugin_links );
154 }
155 }
156
157 WP_VisitorAnalytics::get_instance();
158 endif;
159 }
160