Plugin Directory

Changeset 1673045


Ignore:
Timestamp:
06/08/2017 06:56:30 AM (9 years ago)
Author:
nepirity
Message:

Adding version 1.0.3 files

Location:
nepirity-analytics/trunk
Files:
4 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • nepirity-analytics/trunk/modules/admin.php

    r1669999 r1673045  
    3737            wp_register_style( 'bootstrap_css', plugins_url()."/".NP_BASENAME.'/templates/css/bootstrap-nepirity.css' );
    3838            wp_enqueue_style( 'bootstrap_css' );
    39             wp_register_style( 'date_range_selector_css', plugins_url()."/".NP_BASENAME.'/templates/css/date_range_selector.css' );
    40             wp_enqueue_style( 'date_range_selector_css' );
     39            wp_register_style( 'jqcloud_css', plugins_url()."/".NP_BASENAME.'/templates/css/jqcloud.css' );
     40            wp_enqueue_style( 'jqcloud_css' );
    4141            wp_register_script( 'match_height_js', plugins_url()."/".NP_BASENAME.'/templates/js/jquery.matchHeight.js' );
    4242            wp_enqueue_script( 'match_height_js' );
    4343            wp_register_script( 'google_analytics_js', plugins_url()."/".NP_BASENAME.'/templates/js/google_analytics.js' );
    4444            wp_enqueue_script( 'google_analytics_js' );
     45            wp_register_script( 'jqcloud_js', plugins_url()."/".NP_BASENAME.'/templates/js/jqcloud.js' );
     46            wp_enqueue_script( 'jqcloud_js' );
    4547        }
    4648        return;
     
    5658
    5759        if (NP()->settings()->is_configured()) {
    58             add_submenu_page(self::MENU_SLUG_INDEX, 'Nepirity Analytics Dashboard', np_translate('Dashboard'),
    59                 'manage_options', self::MENU_SLUG_INDEX, array(__CLASS__, 'index_page'));
     60            $module_menus = NP()->settings()->get_nepirity_modules();
     61
     62            foreach ($module_menus as $module) {
     63                $slug = 'nepirity_admin_'. $module['name'];
     64
     65                if ($module['name'] == "dashboard") {
     66                    $slug = self::MENU_SLUG_INDEX;
     67                }
     68
     69                add_submenu_page(self::MENU_SLUG_INDEX, $module['title'] , $module['menu'],
     70                    'manage_options', $slug, array(__CLASS__, 'module_page'));
     71            }
    6072
    6173            add_submenu_page(self::MENU_SLUG_INDEX, 'Nepirity Analytics Settings', np_translate('Settings'),
    6274                'manage_options', 'nepirity_admin_settings', array(__CLASS__, 'settings_page'));
    6375        }
    64 
    6576    }
    6677
     
    6879        $tabs = array('summary' => np_translate('Summary'));
    6980        NP()->views()->print_tab_page("dashboard", $tabs);
     81    }
     82
     83    static function module_page() {
     84        $tabs = array();
     85        $group_name = "";
     86        $module_menus = NP()->settings()->get_nepirity_modules();
     87
     88        if (isset($_GET['page'])) {
     89            $e = explode("_", $_GET['page']);
     90
     91            if (count($e) == 3) {
     92                $group_name = $e[2];
     93            }
     94        }
     95
     96        foreach ($module_menus as $module) {
     97            if ($group_name == $module['name']) {
     98                foreach ($module['list'] as $tab_data) {
     99                    $tabs[$tab_data['name']] = $tab_data['menu'];
     100                }
     101                break;
     102            }
     103        }
     104
     105        NP()->views()->print_tab_page($group_name, $tabs);
    70106    }
    71107
  • nepirity-analytics/trunk/modules/analytics.php

    r1669999 r1673045  
    7070        $google = NP()->jsonrpc()->google();
    7171
    72         $encoded_token = base64_encode(json_encode(NP()->settings()->get_saved_google_token()));
     72        $encoded_token = base64_encode(json_encode($this->get_googleauth_oauth_access_token(null)));
    7373        return $google->get_profiles_using_token($encoded_token);
    7474    }
     
    113113
    114114  ga('create', '<?= $tracking_id ?>', 'auto');
     115  ga('require', 'displayfeatures');
    115116  ga('send', 'pageview');
    116117</script>
  • nepirity-analytics/trunk/modules/settings.php

    r1669999 r1673045  
    1414    const FIELD_NEPIRITY_VERSION = 'np_nepirity_version';
    1515    const FIELD_NEPIRITY_SERVER = 'np_nepirity_server';
     16    const FIELD_NEPIRITY_MODULES = 'np_nepirity_modules';
    1617
    1718    const FIELD_GOOGLE_ACCESS_TOKEN = 'np_google_access_token';
     
    3334        foreach ($options as $option) {
    3435            if (!$this->get_option_value($option['name'])) return false;
     36        }
     37
     38        if (!$this->get_option_value(self::FIELD_NEPIRITY_MODULES)) {
     39            return false;
    3540        }
    3641
     
    8287            }
    8388        }
     89
     90        $this->update_modules();
    8491    }
    8592
     
    103110    }
    104111
    105     public function print_setting_summary($profiles='') {
     112    public function print_nepirity_summary() {
    106113        echo '<h3 class="title">'.np_translate("Nepirity Settings").'</h3>';
    107114        echo '<p>'.np_translate("In order to use Nepirity Analysis Service, please enter your account information.").'</p>';
     
    117124        }
    118125        echo '</table>';
     126?>
     127        <div align='center'>
     128            <input type="hidden" name="update_setting_values" value="1" />
     129            <input type="submit" class="button button-primary" value="<?= np_translate("Update") ?>" />
     130        </div>
     131<?php
     132        echo '</form>';
    119133        echo '<hr />';
    120 
     134    }
     135
     136    public function print_google_summary($profiles='') {
     137        echo '<form  method="post" enctype="multipart/form-data">';
    121138        echo '<h3 class="title">'.np_translate("Google Account Setting").'</h3>';
    122139        $setup_link = $this->get_settings_setup_link();
     
    124141
    125142        echo ' ';
    126         echo np_translate("Click, if you want to bring up the Nepirity Setup Wizard.");
    127         echo " <a href='".$setup_link."'>".np_translate("[Here]")."</a> </p>";
     143        echo np_translate("Click");
     144        echo " <a href='".$setup_link."'>".np_translate("[Here]")."</a>";
     145        echo np_translate(", if you want to bring up the Nepirity Setup Wizard.</p>");
    128146        echo '<hr />';
    129147
     
    215233            array(
    216234                "name"=>self::FIELD_NEPIRITY_KEY,
    217                 "type"=>"text", "desc" => np_translate("Nepirity KEY")
     235                "type"=>"text", "desc" => np_translate("Nepirity Service Key")
    218236            )
    219237        );
     
    270288        $link = NP()->analytics()->get_google_auth_link();
    271289        $memo = np_translate("You can check Google OAuth code");
    272         $memo .= " [<a href='".$link."' target='_blank'>here</a>]";
     290        $memo .= " [<a href='".$link."' target = 'popup' onclick = window.open(this.href,'popup','width=500,height=600')>here</a>]";
    273291
    274292        return array(
     
    315333    public function get_nepirity_server_option_name() {
    316334        return self::FIELD_NEPIRITY_SERVER;
     335    }
     336
     337    public function get_nepirity_module_option_name() {
     338        return self::FIELD_NEPIRITY_MODULES;
    317339    }
    318340
     
    464486    }
    465487
     488    public function get_nepirity_modules() {
     489        $modules = $this->get_option_value(self::FIELD_NEPIRITY_MODULES);
     490
     491        if ($modules != "") {
     492            return unserialize($modules);
     493        }
     494
     495        return array();
     496    }
     497
     498    public function remove_cache_options() {
     499        $options = array(self::FIELD_GOOGLE_ACCESS_TOKEN, self::FIELD_NEPIRITY_MODULES);
     500
     501        for ($i=0; $i<sizeof($options); $i++) {
     502            delete_option($options[$i]);
     503        }
     504    }
     505
    466506    public function delete_all_options() {
    467507        $options = $this->get_all_option_fields();
     
    471511        }
    472512
    473         $options = array(self::FIELD_GOOGLE_ACCESS_TOKEN, self::FIELD_NEPIRITY_SERVER, self::FIELD_NEPIRITY_VERSION);
     513        $options = array(
     514            self::FIELD_GOOGLE_ACCESS_TOKEN,
     515            self::FIELD_NEPIRITY_SERVER,
     516            self::FIELD_NEPIRITY_VERSION,
     517            self::FIELD_NEPIRITY_MODULES
     518        );
    474519        for ($i=0; $i<sizeof($options); $i++) {
    475520            delete_option($options[$i]);
     
    500545        return "";
    501546    }
     547
     548    public function update_modules() {
     549        $npkey = $this->get_nepirity_key();
     550        $modules = NP()->jsonrpc()->account()->get_available_module_menus($npkey, get_locale());
     551
     552        $this->update_option_value(self::FIELD_NEPIRITY_MODULES, base64_decode($modules));
     553    }
    502554}
    503555
  • nepirity-analytics/trunk/modules/setup.php

    r1669213 r1673045  
    134134
    135135    private static function print_wizard_default_step() {
    136         self::print_wizard_pannel(np_translate("Nepirity Plugin Setup Wizard"),
    137             np_translate("Start Nepirity plugin setup wizard"), array(), 'welcome');
     136        self::print_wizard_pannel(np_translate("Nepirity Analytics (Setup Wizard)"),
     137            np_translate("Click Start to Configure"), array(), 'welcome');
    138138    }
    139139
     
    216216        self::update_settings(NP()->settings()->get_google_account_option_fields());
    217217
     218        NP()->settings()->remove_cache_options();
     219
    218220        $auth_type = NP()->settings()->get_google_authtype();
    219221        if ($auth_type == Setting::GOOGLE_AUTHTYPE_OAUTH) {
     
    260262        $values[$option_name] = NP()->get_plugin_version();
    261263
     264        NP()->settings()->update_modules();
     265
    262266        self::update_setting_values($options, $values);
    263267    }
  • nepirity-analytics/trunk/modules/views.php

    r1669213 r1673045  
    2323
    2424    public function print_admin_header() {
     25        echo '<div class="wrap">';
    2526        if (($jsonrpc = NP()->jsonrpc())) {
    2627            $msg = $jsonrpc->support()->get_notice();
     
    3334
    3435    public function print_admin_footer() {
     36        echo '</div>';
    3537    }
    3638
     
    5759        }
    5860
    59         echo '<br />';
    6061        echo '<ul class="nav nav-tabs">';
    6162        foreach( $tabs as $tab => $name ){
     
    133134        return $html;
    134135    }
     136
     137    public function get_date_string($unixtime) {
     138        return date_i18n(get_option('date_format'), $unixtime);
     139    }
     140
     141    public function print_board_data() {
     142        $npkey = NP()->settings()->get_nepirity_key();
     143        $data = NP()->jsonrpc()->support()->get_board_data($npkey, get_locale());
     144
     145        if (count($data) > 0) {
     146            $date_str = $this->get_date_string($data['reg_date']);
     147
     148            ?>
     149            <div class="card">
     150              <div class="card-block">
     151              <h4 class="card-title"><?=$data['subject']?></h4>
     152              <h6 class="card-subtitle mb-2 text-muted"><?= $date_str ?></h6>
     153                <p class="card-text"><?=$data['message']?></p>
     154                <!--<a href="#" class="card-link" target="_blank">link</a> -->
     155                <?= $data['link'] ?>
     156              </div>
     157            </div>
     158            <?php
     159        }
     160    }
    135161}
    136162
  • nepirity-analytics/trunk/readme.txt

    r1669999 r1673045  
    55Requires at least: 4.6.5
    66Tested up to: 4.7.5
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3333== Installation ==
    3434
    35 1. Start activating the plugin with a Nepirity Service key.
    36 
    37 2. Enter your Google Account Information in the plugin settings.
    38 
    39 3. Check [Read & Analyze] option in your Google Analytics settings.
     351. Copy the plug-in files to the wp-content/plugins directory.
     362. Activate Nepirity Analytics.
     373. Follow the instructions given by the Nepirity Setup Wizard.
    4038
    4139Please, visit the site below for more information.
     
    6260
    6361== Changelog ==
     62= 1.0.3 =
     63- Support Expansion modules.
     64- Fixed authentication bugs.
     65
    6466= 1.0.2 =
    65 Fixed Google authentication method.
     67- Fixed Google authentication method.
    6668
    6769= 1.0.1 =
    68 Added Google authentication method.
     70- Added Google authentication method.
    6971
    7072= 1.0.0 =
    71 first version.
     73- First version.
    7274
    7375== Upgrade Notice ==
    74 = 1.0.2 =
    75 OAuth authentication has been modified so that tokens can be updated if the token expires.
     76= 1.0.3 =
     77Authentication bugs have been fixed, and visitor and site analytics extensions have been added.
  • nepirity-analytics/trunk/templates/admin/settings/general.php

    r1666843 r1673045  
     1<?php
     2
     3$settings = NP()->settings();
     4
     5if ($settings->check_update_values()) {
     6    $settings->update_setting_values();
     7    $settings->print_updated_message();
     8}
     9
     10?>
     11
    112<div class = "panel panel-default">
    213    <div class= "panel-body">
    314<?php
    415
    5 $settings = NP()->settings();
     16if (isset($_GET['action']) && $_GET['action'] == "setup") {
     17    NP()->settings()->setup_wizard();
     18} else {
     19    $profiles = null;
    620
    7 if ($settings->is_configured()) {
    8     $analytics = NP()->analytics();
    9 
    10     if ($settings->check_update_values()) {
    11         $settings->update_setting_values();
    12         $settings->print_updated_message();
     21    try {
     22        $profiles = NP()->analytics()->get_google_profiles();
     23    }catch (Exception $e) {
     24        $profiles = $e->getMessage();
    1325    }
    1426
    15     if (isset($_GET['action']) && $_GET['action'] == "setup") {
    16         NP()->settings()->setup_wizard();
    17     } else {
    18         $profiles = null;
     27?>
     28<div class="container-fluid">
     29  <div class="row">
     30    <div class="col-sm-8">
     31        <?php
     32            NP()->settings()->print_nepirity_summary();
     33            if ($profiles && is_array($profiles) && count($profiles)) {
     34                NP()->settings()->print_google_summary($profiles);
     35            } else {
     36                $html  = "<div align='center'>";
     37                $html .= np_translate("Can't load google profile information. Please setup plugin again.");
     38                $html .= " [<a href='". NP()->settings()->get_settings_setup_link() . "'>Here</a>]";
     39                $html .= "</div>";
    1940
    20         try {
    21             $profiles = $analytics->get_google_profiles();
    22         }catch (Exception $e) {
    23             $profiles = $e->getMessage();
    24         }
     41                echo $html;
     42            }
     43        ?>
     44    </div>
     45    <div class="col-sm-4"><?php NP()->views()->print_board_data(); ?> </div>
     46  </div>
     47</div>
     48<?php
    2549
    26         if ($profiles && is_array($profiles) && count($profiles)) {
    27             $settings->print_setting_summary($profiles);
    28         } else {
    29             $html = np_translate("Can't load google profile information. Please setup plugin again.");
    30             $link = $settings->get_settings_setup_link();
    31             $html .= " [<a href='". $link. "'>Here</a>]";
    32 
    33             echo $html;
    34         }
    35     }
    3650}
    3751
  • nepirity-analytics/trunk/templates/css/bootstrap-nepirity.css

    r1666843 r1673045  
    32573257    width: 100px;
    32583258    height: 45px;
     3259}
     3260
     3261.compare {
     3262    padding: 0px 5px 5px 5px;
    32593263}
    32603264
     
    69056909.table-chart-title {
    69066910}
     6911
     6912ol {
     6913    counter-reset: li; /* Initiate a counter */
     6914    list-style: none; /* Remove default numbering */
     6915    *list-style: decimal; /* Keep using default numbering for IE6/7 */
     6916    font: 15px 'trebuchet MS', 'lucida sans';
     6917    padding: 0;
     6918    margin-bottom: 4em;
     6919    text-shadow: 0 1px 0 rgba(255,255,255,.5);
     6920}
     6921
     6922ol ol {
     6923    margin: 0 0 0 2em; /* Add some left margin for inner lists */
     6924}
     6925
     6926.rounded-list a {
     6927    position: relative;
     6928    display: block;
     6929    padding: 0.4em 0.4em 0.4em 0.7em;
     6930    *padding: .4em;
     6931    margin: .5em 0;
     6932    color: #444;
     6933    text-decoration: none;
     6934    border-radius: .3em;
     6935}
     6936
     6937.rounded-list a:before{
     6938    content: counter(li);
     6939    counter-increment: li;
     6940    position: absolute;
     6941    left: -1.3em;
     6942    top: 50%;
     6943    margin-top: -1.3em;
     6944    background: #87ceeb;
     6945    height: 2em;
     6946    width: 2em;
     6947    line-height: 2em;
     6948    border: .3em solid #fff;
     6949    text-align: center;
     6950    font-weight: bold;
     6951    border-radius: 2em;
     6952    transition: all .3s ease-out;
     6953}
     6954
     6955.match-height {
     6956    width:inherit;
     6957    height:300px;
     6958}
  • nepirity-analytics/trunk/templates/css/jqcloud.css

    r1669999 r1673045  
    4545  overflow: hidden;
    4646  position: relative;
     47  margin: 0 auto;
    4748}
    4849
Note: See TracChangeset for help on using the changeset viewer.