コード例 #1
0
 /**
  * Sends an affiliate application to affiliate@rating-widget.com
  *
  * @author Leo Fajardo (@leorw)
  * @since 2.4.4
  *
  */
 public function send_affiliate_application()
 {
     // Continue only if the nonce is correct
     check_admin_referer('rw_send_affiliate_application_nonce', '_n');
     $admin_email = get_option('admin_email');
     $user = $this->fs->get_user();
     $posts_count = wp_count_posts('post');
     $pages_count = wp_count_posts('page');
     $total_posts = $posts_count->publish + $pages_count->publish;
     $blog_address = site_url();
     $domain = $_SERVER['HTTP_HOST'];
     $comments_count = wp_count_comments();
     $total_approved_comments = $comments_count->approved;
     $subject = "{$domain} wants to be an affiliate";
     $email_details = array('aff_admin_email' => $admin_email, 'aff_user_id' => $user->id, 'aff_site_id' => $this->account->site_id, 'aff_site_address' => $blog_address, 'aff_total_posts' => $total_posts, 'aff_total_comments' => $total_approved_comments);
     // Retrieve the HTML email content
     ob_start();
     rw_require_view('emails/affiliation_email.php', $email_details);
     $message = ob_get_contents();
     ob_end_clean();
     $header = 'Content-type: text/html';
     wp_mail('*****@*****.**', $subject, $message, $header);
     echo 1;
     die;
 }
コード例 #2
0
 /**
  * Tries to activate add-on account based on parent plugin info.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.6
  *
  * @param Freemius $parent_fs
  */
 private function _activate_addon_account(Freemius $parent_fs)
 {
     if ($this->is_registered()) {
         // Already activated.
         return;
     }
     // Activate add-on with parent plugin credentials.
     $addon_install = $parent_fs->get_api_site_scope()->call("/addons/{$this->_plugin->id}/installs.json", 'post', $this->get_install_data_for_api(array('uid' => $this->get_anonymous_id()), false, false));
     if (isset($addon_install->error)) {
         $this->_admin_notices->add(sprintf(__fs('could-not-activate-x', $this->_slug), $this->get_plugin_name()) . ' ' . __fs('contact-us-with-error-message', $this->_slug) . ' ' . '<b>' . $addon_install->error->message . '</b>', __fs('oops', $this->_slug) . '...', 'error');
         return;
     }
     // First of all, set site info - otherwise we won't
     // be able to invoke API calls.
     $this->_site = new FS_Site($addon_install);
     // Sync add-on plans.
     $this->_sync_plans();
     // Get site's current plan.
     $this->_site->plan = $this->_get_plan_by_id($this->_site->plan->id);
     // Get user information based on parent's plugin.
     $user = $parent_fs->get_user();
     $this->_set_account($user, $this->_site);
     // Sync licenses.
     $this->_sync_licenses();
     // Try to activate premium license.
     $this->_activate_license(true);
 }
コード例 #3
0
ファイル: class-freemius.php プロジェクト: kitchenseeker/www
 /**
  * Tries to activate add-on account based on parent plugin info.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.6
  *
  * @param Freemius $parent_fs
  */
 private function _activate_addon_account(Freemius $parent_fs)
 {
     if ($this->is_registered()) {
         // Already activated.
         return;
     }
     // Activate add-on with parent plugin credentials.
     $addon_install = $parent_fs->get_api_site_scope()->call("/addons/{$this->_plugin->id}/installs.json", 'post', array('title' => get_bloginfo('name'), 'version' => $this->get_plugin_version(), 'language' => get_bloginfo('language'), 'charset' => get_bloginfo('charset'), 'platform_version' => get_bloginfo('version')));
     if (isset($addon_install->error)) {
         $this->_admin_notices->add(sprintf(__('Couldn\'t activate %s. Please contact us with the following message: %s', WP_FS__SLUG), $this->get_plugin_name(), '<b>' . $addon_install->error->message . '</b>'), 'Oops...', 'error');
         return;
     }
     // First of all, set site info - otherwise we won't
     // be able to invoke API calls.
     $this->_site = new FS_Site($addon_install);
     // Sync add-on plans.
     $this->_sync_plans();
     // Get site's current plan.
     $this->_site->plan = $this->_get_plan_by_id($this->_site->plan->id);
     // Get user information based on parent's plugin.
     $user = $parent_fs->get_user();
     $this->_set_account($user, $this->_site);
     // Sync licenses.
     $this->_sync_licenses();
     // Try to activate premium license.
     $this->_activate_license(true);
 }