plugin-info
10 years ago
account.php
10 years ago
add-ons.php
10 years ago
admin-notice.php
10 years ago
all-admin-notice.php
10 years ago
checkout.php
10 years ago
connect.php
10 years ago
contact.php
10 years ago
deactivation-feedback-modal.php
10 years ago
debug.php
10 years ago
email.php
10 years ago
firewall-issues-js.php
10 years ago
pending-activation.php
10 years ago
plugin-icon.php
10 years ago
powered-by.php
10 years ago
pricing.php
10 years ago
sticky-admin-notice-js.php
10 years ago
connect.php
176 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package Freemius |
| 4 | * @copyright Copyright (c) 2015, Freemius, Inc. |
| 5 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 6 | * @since 1.0.7 |
| 7 | */ |
| 8 | |
| 9 | wp_enqueue_script( 'jquery' ); |
| 10 | wp_enqueue_script( 'json2' ); |
| 11 | fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' ); |
| 12 | fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' ); |
| 13 | |
| 14 | fs_enqueue_local_style( 'fs_connect', '/admin/connect.css' ); |
| 15 | |
| 16 | $slug = $VARS['slug']; |
| 17 | $fs = freemius( $slug ); |
| 18 | $current_user = wp_get_current_user(); |
| 19 | |
| 20 | $first_name = $current_user->user_firstname; |
| 21 | if ( empty( $first_name ) ) { |
| 22 | $first_name = $current_user->nickname; |
| 23 | } |
| 24 | |
| 25 | $site_url = get_site_url(); |
| 26 | $protocol_pos = strpos( $site_url, '://' ); |
| 27 | if ( false !== $protocol_pos ) { |
| 28 | $site_url = substr( $site_url, $protocol_pos + 3 ); |
| 29 | } |
| 30 | ?> |
| 31 | <div id="fs_connect" class="wrap<?php if ( ! $fs->enable_anonymous() ) { |
| 32 | echo ' fs-anonymous-disabled'; |
| 33 | } ?>"> |
| 34 | <div class="fs-visual"> |
| 35 | <b class="fs-site-icon"><i class="dashicons dashicons-wordpress"></i></b> |
| 36 | <i class="dashicons dashicons-plus fs-first"></i> |
| 37 | <?php |
| 38 | $vars = array( 'slug' => $slug ); |
| 39 | fs_require_once_template( 'plugin-icon.php', $vars ); |
| 40 | ?> |
| 41 | <i class="dashicons dashicons-plus fs-second"></i> |
| 42 | <img class="fs-connect-logo" width="80" height="80" src="//img.freemius.com/connect-logo.png"/> |
| 43 | </div> |
| 44 | <div class="fs-content"> |
| 45 | <p><?php |
| 46 | echo $fs->apply_filters( 'connect_message', sprintf( |
| 47 | __fs( 'hey-x' ) . '<br>' . |
| 48 | __fs( 'connect-message' ), |
| 49 | $first_name, |
| 50 | '<b>' . $fs->get_plugin_name() . '</b>', |
| 51 | '<b>' . $current_user->user_login . '</b>', |
| 52 | '<a href="' . get_site_url() . '" target="_blank">' . $site_url . '</a>', |
| 53 | '<a href="https://freemius.com/wordpress/" target="_blank">freemius.com</a>' |
| 54 | ) ); |
| 55 | ?></p> |
| 56 | </div> |
| 57 | <div class="fs-actions"> |
| 58 | <?php if ( $fs->enable_anonymous() ) : ?> |
| 59 | <a href="<?php echo wp_nonce_url( $fs->_get_admin_page_url( '', array( 'fs_action' => $slug . '_skip_activation' ) ), $slug . '_skip_activation' ) ?>" |
| 60 | class="button button-secondary" tabindex="2"><?php _efs( 'skip' ) ?></a> |
| 61 | <?php endif ?> |
| 62 | <?php $fs_user = Freemius::_get_user_by_email( $current_user->user_email ) ?> |
| 63 | <?php if ( is_object( $fs_user ) ) : ?> |
| 64 | <form action="" method="POST"> |
| 65 | <input type="hidden" name="fs_action" value="<?php echo $slug ?>_activate_existing"> |
| 66 | <?php wp_nonce_field( 'activate_existing_' . $fs->get_public_key() ) ?> |
| 67 | <button class="button button-primary" tabindex="1" |
| 68 | type="submit"><?php _efs( 'opt-in-connect' ) ?> |
| 69 | ➜</button> |
| 70 | </form> |
| 71 | <?php else : ?> |
| 72 | <form method="post" action="<?php echo WP_FS__ADDRESS ?>/action/service/user/install/"> |
| 73 | <?php |
| 74 | $params = array( |
| 75 | 'user_firstname' => $current_user->user_firstname, |
| 76 | 'user_lastname' => $current_user->user_lastname, |
| 77 | 'user_nickname' => $current_user->user_nicename, |
| 78 | 'user_email' => $current_user->user_email, |
| 79 | 'user_ip' => fs_get_ip(), |
| 80 | 'plugin_slug' => $slug, |
| 81 | 'plugin_id' => $fs->get_id(), |
| 82 | 'plugin_public_key' => $fs->get_public_key(), |
| 83 | 'plugin_version' => $fs->get_plugin_version(), |
| 84 | 'return_url' => wp_nonce_url( $fs->_get_admin_page_url( |
| 85 | '', |
| 86 | array( 'fs_action' => $slug . '_activate_new' ) |
| 87 | ), $slug . '_activate_new' ), |
| 88 | 'account_url' => wp_nonce_url( $fs->_get_admin_page_url( |
| 89 | 'account', |
| 90 | array( 'fs_action' => 'sync_user' ) |
| 91 | ), 'sync_user' ), |
| 92 | 'site_uid' => $fs->get_anonymous_id(), |
| 93 | 'site_url' => get_site_url(), |
| 94 | 'site_name' => get_bloginfo( 'name' ), |
| 95 | 'platform_version' => get_bloginfo( 'version' ), |
| 96 | 'php_version' => phpversion(), |
| 97 | 'language' => get_bloginfo( 'language' ), |
| 98 | 'charset' => get_bloginfo( 'charset' ), |
| 99 | ); |
| 100 | |
| 101 | if ( WP_FS__SKIP_EMAIL_ACTIVATION && $fs->has_secret_key() ) { |
| 102 | // Even though rand() is known for its security issues, |
| 103 | // the timestamp adds another layer of protection. |
| 104 | // It would be very hard for an attacker to get the secret key form here. |
| 105 | // Plus, this should never run in production since the secret should never |
| 106 | // be included in the production version. |
| 107 | $params['ts'] = WP_FS__SCRIPT_START_TIME; |
| 108 | $params['salt'] = md5( uniqid( rand() ) ); |
| 109 | $params['secure'] = md5( |
| 110 | $params['ts'] . |
| 111 | $params['salt'] . |
| 112 | $fs->get_secret_key() |
| 113 | ); |
| 114 | } |
| 115 | ?> |
| 116 | <?php foreach ( $params as $name => $value ) : ?> |
| 117 | <input type="hidden" name="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>"> |
| 118 | <?php endforeach ?> |
| 119 | <button class="button button-primary" tabindex="1" |
| 120 | type="submit"><?php _efs( 'opt-in-connect' ) ?> |
| 121 | ➜</button> |
| 122 | </form> |
| 123 | <?php endif ?> |
| 124 | </div> |
| 125 | <div class="fs-permissions"> |
| 126 | <a class="fs-trigger" href="#"><?php _efs( 'what-permissions' ) ?></a> |
| 127 | <ul> |
| 128 | <li> |
| 129 | <i class="dashicons dashicons-admin-users"></i> |
| 130 | |
| 131 | <div> |
| 132 | <span><?php _efs( 'permissions-profile' ) ?></span> |
| 133 | |
| 134 | <p><?php _efs( 'permissions-profile_desc' ) ?></p> |
| 135 | </div> |
| 136 | </li> |
| 137 | <li> |
| 138 | <i class="dashicons dashicons-wordpress"></i> |
| 139 | |
| 140 | <div> |
| 141 | <span><?php _efs( 'permissions-site' ) ?></span> |
| 142 | |
| 143 | <p><?php _efs( 'permissions-site_desc' ) ?></p> |
| 144 | </div> |
| 145 | </li> |
| 146 | <li> |
| 147 | <i class="dashicons dashicons-admin-plugins"></i> |
| 148 | |
| 149 | <div> |
| 150 | <span><?php _efs( 'permissions-events' ) ?></span> |
| 151 | |
| 152 | <p><?php _efs( 'permissions-events_desc' ) ?></p> |
| 153 | </div> |
| 154 | </li> |
| 155 | </ul> |
| 156 | </div> |
| 157 | <div class="fs-terms"> |
| 158 | <a href="https://freemius.com/privacy/" target="_blank"><?php _efs( 'privacy-policy' ) ?></a> |
| 159 | - |
| 160 | <a href="https://freemius.com/terms/" target="_blank"><?php _efs( 'tos' ) ?></a> |
| 161 | </div> |
| 162 | </div> |
| 163 | <script type="text/javascript"> |
| 164 | (function ($) { |
| 165 | $('.button').on('click', function () { |
| 166 | // Set loading mode. |
| 167 | $(document.body).css({'cursor': 'wait'}); |
| 168 | }); |
| 169 | $('.button.button-primary').on('click', function () { |
| 170 | $(this).html('<?php _efs( 'activating' ) ?>...').css({'cursor': 'wait'}); |
| 171 | }); |
| 172 | $('.fs-permissions .fs-trigger').on('click', function () { |
| 173 | $('.fs-permissions').toggleClass('fs-open'); |
| 174 | }); |
| 175 | })(jQuery); |
| 176 | </script> |