function update_footer($text) { $screen = get_current_screen(); if (strpos($screen->base, 'wysija') === false) { return $text; } $title = esc_attr(WYSIJA::is_beta() ? __('Revert to stable', WYSIJA) : __('Switch to beta', WYSIJA)); $warn_message = esc_attr(WYSIJA::is_beta() ? __('Confirm going back to the stable version?', WYSIJA) : __('Great! But the beta version might be buggy, and we expect you to report any bugs. Confirm to installing the Beta version?', WYSIJA)); $args = array('page' => 'wysija_config', 'action' => 'packager-switch', '_wpnonce' => wp_create_nonce('packager-switch')); if (WYSIJA::is_beta()) { $args["stable"] = 1; } $switch_link = esc_attr(add_query_arg($args, admin_url('admin.php'))); $switch_text = esc_attr(WYSIJA::is_beta() ? __('Revert to Stable', WYSIJA) : __('Switch to Beta', WYSIJA)); $version_link = esc_url(add_query_arg(array('page' => 'wysija_campaigns', 'action' => 'whats_new'), admin_url('admin.php'))); $premium = false; if (is_plugin_active('wysija-newsletters-premium/index.php')) { $premium = WYSIJA::get_version('wysija-newsletters-premium/index.php'); } return (is_multisite() && WYSIJA::current_user_can('manage_network') || !is_multisite() && WYSIJA::current_user_can('switch_themes') ? "<span class='wrap'>" . "<a id='switch_to_package' href='{$switch_link}' title='{$title}' data-warn='{$warn_message}' class='add-new-h2'>{$switch_text}</a>" . (WYSIJA::is_beta() ? "<a target='_blank' class='add-new-h2' href='http://support.mailpoet.com/feedback/?utm_source=wpadmin&utm_campaign=contact_beta'>" . __('Report Bugs', WYSIJA) . "</a>" : "") . "</span>" : "") . "</p>" . "<p class='alignright'>" . __("MailPoet Version", WYSIJA) . ": <a href='{$version_link}'>" . esc_attr(WYSIJA::get_version()) . "</a>" . ($premium ? " | " . __("Premium", WYSIJA) . ": " . esc_attr($premium) . "</a>" : ""); }
function fieldFormHTML_betamode($key,$value,$model){ // second part concerning the checkbox $formsHelp=WYSIJA::get('forms','helper'); $checked=false; if($this->model->getValue($key)) $checked=true; $field='<p>'; $field.=$formsHelp->radios(array('id'=>$key,'name'=>'wysija['.$model.']['.$key.']','class'=>'activateInput'),array(true=>__('Yes',WYSIJA),false=>__('No',WYSIJA)),$checked); $value=$this->model->getValue($key.'_linkname'); //the idea behind that code was to reinstall the package from WordPress repository if(!$this->model->getValue($key)){ if(WYSIJA::is_beta()){ $helper_package = WYSIJA::get('package','helper'); $result = $helper_package->_check_request_wp(); if($result!==false){ $field.= '<span style="margin-top: 2px; position: absolute; margin-left: 25px;"> '. sprintf( __('You appear to still be using a beta version on your site. Do you want to switch back to the stable version %1$s?',WYSIJA), $result['wysija-newsletters/index.php']->new_version); $field.=' <a target="_blank" id="switch_to_package" href="admin.php?page=wysija_campaigns&action=switch_to_package&plugin=wysija-newsletters&stable=1&_wpnonce='.$this->secure(array('controller'=>'wysija_campaigns', 'action'=>'switch_to_package'),true).'">'.__('Yes please!',WYSIJA).'</a></span>'; } } } return $field; }
public function pre_set_site_transient_update_plugins($update_data) { if (!function_exists('get_plugin_data')) { return (object) array(); } if (!is_object($update_data) && strlen(trim($update_data)) === 0) { return (object) array(); } if (!isset($update_data->last_checked)) { $update_data->last_checked = 0; } if (time() - 60 * 60 * 12 > $update_data->last_checked) { // Just check once every 12 hours return $update_data; } foreach (self::$plugins as $plugin) { if (!function_exists('is_plugin_active')) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; } if (!is_plugin_active($plugin)) { continue; } if (!WYSIJA::is_beta() && $plugin === 'wysija-newsletters/index.php') { continue; } $version = self::get_version($plugin, WYSIJA::is_beta()); $update_data->last_checked = time(); if (version_compare(WYSIJA::get_version($plugin), $version, '>=')) { continue; } $update_data->response[$plugin] = self::get_plugin_data($plugin, WYSIJA::is_beta(), $version); } return $update_data; }
/** * On any of the administration pages related to MailPoet, if the user * has the key and doesn't have the premium plugin active a warning will * be displayed. * * @return null */ public function warn_action_on_premium() { $mdl_config = WYSIJA::get('config', 'model'); if ($mdl_config->getValue('premium_key') && !WYSIJA::is_plugin_active(WJ_Upgrade::$plugins[1])) { if (file_exists(WPMU_PLUGIN_DIR . DIRECTORY_SEPARATOR . WJ_Upgrade::$plugins[1]) || file_exists(WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . WJ_Upgrade::$plugins[1])) { //send a message to the user so that he activates the premium plugin or try to fetch it directly. $this->notice('<p>' . __('You need to activate the MailPoet Premium plugin.', WYSIJA) . ' <a data-warn="' . esc_attr__("Confirm activating the MailPoet Premium Plugin?", WYSIJA) . '" class="button-primary" title="' . esc_attr__("Activate MailPoet Premium Version", WYSIJA) . '" href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . urlencode(WJ_Upgrade::$plugins[1]) . '&plugin_status=all', 'activate-plugin_' . WJ_Upgrade::$plugins[1]) . '">' . __('Activate now', WYSIJA) . '</a></p>'); } else { $args = array('page' => 'wysija_config', 'action' => 'packager-switch', '_mp_action' => 'install', '_wpnonce' => wp_create_nonce('packager-switch')); if (WYSIJA::is_beta()) { $args["stable"] = 1; } $link = esc_attr(add_query_arg($args, admin_url('admin.php'))); //send a message to the user so that he gets the premium plugin or try to fetch it directly. $this->notice('<p>' . __('Congrats, your Premium license is active. One last step...', WYSIJA) . ' <a data-warn="' . esc_attr__("Confirm installing the MailPoet Premium Plugin?", WYSIJA) . '" id="install-wjp" class="button-primary" title="' . esc_attr__("Installing MailPoet Premium Version", WYSIJA) . '" href="' . esc_url($link) . '">' . __('Download the Premium plugin.', WYSIJA) . '</a></p>'); } } return null; }
/** * */ function version() { $wysija_footer_links = '<div class="wysija-version">'; $wysija_footer_links .= '<div class="social-foot">'; $link_start = ' | <a target="_blank" id="switch_to_package" href="admin.php?page=wysija_campaigns&action=switch_to_package&plugin=wysija-newsletters&_wpnonce=' . WYSIJA_view::secure(array('controller' => 'wysija_campaigns', 'action' => 'switch_to_package'), true); if (WYSIJA::is_beta()) { $beta_link = $link_start . '&stable=1" title="' . __('Switch back to stable', WYSIJA) . '">' . __('Switch back to stable', WYSIJA) . '</a>'; } else { $beta_link = $link_start . '" title="' . __('Switch to beta', WYSIJA) . '">' . __('Switch to beta', WYSIJA) . '</a>'; } if (is_multisite() && !WYSIJA::current_user_can('manage_network') || !is_multisite() && !WYSIJA::current_user_can('switch_themes')) { $beta_link = ''; } $wysija_footer_links .= '<div id="upperfoot"><div class="support"><a target="_blank" href="http://support.mailpoet.com/?utm_source=wpadmin&utm_campaign=footer" >' . __('Support', WYSIJA) . '</a>' . $beta_link; add_filter('wysija_footer_add_stars', array($this, 'footer_add_stars'), 10); $wysija_footer_links .= apply_filters('wysija_footer_add_stars', ''); $wysija_footer_links .= '<div class="version">' . __('Wysija Version: ', WYSIJA) . '<a href="admin.php?page=wysija_campaigns&action=whats_new">' . WYSIJA::get_version() . '</a></div></div>'; /*$config=WYSIJA::get('config','model'); $msg=$config->getValue('ignore_msgs'); if(!isset($msg['socialfoot'])){ $wysijaversion .= $this->controller->__get_social_buttons(); }*/ $wysija_footer_links .= '</div></div>'; echo $wysija_footer_links; }