Changeset 1124734
- Timestamp:
- 03/31/2015 06:49:43 PM (11 years ago)
- Location:
- shopp-seo/trunk
- Files:
-
- 1 deleted
- 2 edited
-
constants.php (deleted)
-
readme.txt (modified) (2 diffs)
-
sseo.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shopp-seo/trunk/readme.txt
r1122409 r1124734 4 4 Requires at least: 3.9 5 5 Tested up to: 4.1 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 44 44 == Changelog == 45 45 46 = 1.0.4 = 47 48 * **Tweak** 49 * The deactivation of Shopp SEO if WordPress SEO is deactivated has been removed and instead replaced with an admin notice. The problem was that when WordPress SEO was being upgraded it would in turn deactivate Shopp SEO. If you did not realize this then you may have had Shopp SEO deactivated for a while, maybe even now. 50 46 51 = 1.0.3 = 47 52 -
shopp-seo/trunk/sseo.php
r1122409 r1124734 7 7 Author: Maine Hosting Solutions 8 8 Author URI: http://mainehost.com/ 9 Version: 1.0. 39 Version: 1.0.4 10 10 */ 11 11 … … 69 69 */ 70 70 function __construct() { 71 require 'constants.php';71 // require 'constants.php'; 72 72 73 73 register_activation_hook( __FILE__, array($this,'activate')); 74 74 75 add_action('plugins_loaded', array($this,'maybe_deactivate'));76 add_action(' admin_init', array($this,'metabox'));77 add_action(' shopp_product_saved', array($this,'save_fields'));75 // add_action('plugins_loaded', array($this,'maybe_deactivate')); 76 add_action('plugins_loaded', array($this,'notice_check')); 77 add_action('admin_menu', array($this,'menu')); 78 78 add_action('admin_enqueue_scripts', array($this,'admin_scripts')); 79 add_action('admin_menu', array($this,'menu')); 80 81 add_action('wpseo_head', array($this,'the_robots'), 40); 82 83 add_filter('wpseo_title', array($this,'the_title'), 30); 84 add_filter('wpseo_metadesc', array($this,'the_description'), 30); 85 add_filter('shopp_meta_description', array($this,'remove_shopp_desc')); 86 } 79 80 DEFINE('SSEO_NAME','Shopp SEO'); 81 DEFINE('SSEO_MENU_NAME','Shopp SEO'); 82 83 DEFINE('SSEO_SHOPP_NAME','Shopp'); 84 DEFINE('SSEO_WP_SEO_NAME','WordPress SEO by Yoast'); 85 86 DEFINE('SSEO_SHOPP_PATH','shopp/Shopp.php'); 87 DEFINE('SSEO_WPSEO_PATH','wordpress-seo/wp-seo.php'); 88 DEFINE('SSEO_WPSEOP_PATH','wordpress-seo-premium/wp-seo-premium.php'); 89 90 // DEFINE('SSEO_DEP_ERROR','<p>%s must be installed and active.</p>'); 91 // DEFINE('SSEO_DEP_DEACT_ERROR','<div class="error"><p>' . SSEO_NAME . ' has been deactivated because %s was deactivated.</p></div>'); 92 DEFINE('SSEO_DEP_ERROR','<div class="error"><p>%s is not installed or active. ' . SSEO_NAME . ' will not function until %s is installed and activated.</p></div>'); 93 } 94 /** 95 * Run when this plugin is activated. 96 */ 97 function activate() { 98 $this->check_dependencies(); 99 } 100 /** 101 * Used to check if dependencies are active when a plugin is deactivated. 102 */ 103 function notice_check() { 104 // $this->dependencies('deactivate'); 105 $this->dependencies(); 106 107 if($this->dep_error) { 108 // require_once(ABSPATH . 'wp-admin/includes/plugin.php'); 109 // deactivate_plugins(plugin_basename( __FILE__ )); 110 add_action('admin_notices', array($this,'deactivate_notice')); 111 } 112 else { 113 add_action('admin_init', array($this,'metabox')); 114 add_action('shopp_product_saved', array($this,'save_fields')); 115 add_action('wpseo_head', array($this,'the_robots'), 40); 116 117 add_filter('wpseo_title', array($this,'the_title'), 30); 118 add_filter('wpseo_metadesc', array($this,'the_description'), 30); 119 add_filter('shopp_meta_description', array($this,'remove_shopp_desc')); 120 } 121 } 87 122 /** 88 123 * Gives an error if trying to activate the plugin without dependencies. … … 111 146 * @param type $stage Whether it's currently activating or deactivating a plugin. 112 147 */ 113 function dependencies($stage) { 148 // function dependencies($stage) { 149 function dependencies() { 114 150 if(!in_array(SSEO_SHOPP_PATH, apply_filters('active_plugins', get_option('active_plugins')))) { 115 if($stage == 'activate') $this->dep_error .= sprintf(SSEO_DEP_ERROR, SSEO_SHOPP_NAME); 116 else $this->dep_error .= sprintf(SSEO_DEP_DEACT_ERROR, SSEO_SHOPP_NAME); 151 // if($stage == 'activate') $this->dep_error .= sprintf(SSEO_DEP_ERROR, SSEO_SHOPP_NAME); 152 // else $this->dep_error .= sprintf(SSEO_DEP_DEACT_ERROR, SSEO_SHOPP_NAME); 153 $this->dep_error .= sprintf(SSEO_DEP_ERROR, SSEO_SHOPP_NAME, SSEO_SHOPP_NAME); 117 154 } 118 155 if((!in_array(SSEO_WPSEO_PATH, apply_filters('active_plugins', get_option('active_plugins')))) && ((!in_array(SSEO_WPSEOP_PATH, apply_filters('active_plugins', get_option('active_plugins')))))) { 119 if($stage == 'activate') $this->dep_error .= sprintf(SSEO_DEP_ERROR, SSEO_WP_SEO_NAME); 120 else $this->dep_error .= sprintf(SSEO_DEP_DEACT_ERROR, SSEO_WP_SEO_NAME); 156 // if($stage == 'activate') $this->dep_error .= sprintf(SSEO_DEP_ERROR, SSEO_WP_SEO_NAME); 157 // else $this->dep_error .= sprintf(SSEO_DEP_DEACT_ERROR, SSEO_WP_SEO_NAME); 158 $this->dep_error .= sprintf(SSEO_DEP_ERROR, SSEO_WP_SEO_NAME, SSEO_WP_SEO_NAME); 121 159 } 122 160 } … … 125 163 */ 126 164 function check_dependencies() { 127 $this->dependencies('activate'); 165 // $this->dependencies('activate'); 166 $this->dependencies(); 128 167 129 168 if($this->dep_error) $this->br_trigger_error($this->dep_error, E_USER_ERROR); 130 }131 /**132 * Run when this plugin is activated.133 */134 function activate() {135 $this->check_dependencies();136 }137 /**138 * Used to check if dependencies are active when a plugin is deactivated.139 */140 function maybe_deactivate() {141 $this->dependencies('deactivate');142 143 if($this->dep_error) {144 require_once(ABSPATH . 'wp-admin/includes/plugin.php');145 deactivate_plugins(plugin_basename( __FILE__ ));146 add_action('admin_notices', array($this,'deactivate_notice'));147 }148 169 } 149 170 /**
Note: See TracChangeset
for help on using the changeset viewer.