Changeset 2017382
- Timestamp:
- 01/23/2019 06:14:26 AM (7 years ago)
- Location:
- marketpowerwp/trunk
- Files:
-
- 4 edited
-
leplugin.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
src/Multisoft/MPP/Replication/ReplicationController.php (modified) (5 diffs)
-
views/mpp_replication_general_settings_section.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
marketpowerwp/trunk/leplugin.php
r2017327 r2017382 4 4 * Plugin Name: Multisoft MarketPowerPRO Tools 5 5 * Description: Integration of MarketPowerPro to Wordpress 6 * Version: 2.2. 16 * Version: 2.2.2 7 7 * Author: Rodine Mark Paul L. Villar 8 8 * Author URI: mailto:dine@multisoft.com?subject=Multisoft+MarketPowerPRO+Tools -
marketpowerwp/trunk/readme.txt
r2017327 r2017382 3 3 Tags: marketpowerpro, multisoft 4 4 Requires at least: 3.4+ 5 Stable tag: 2.2. 16 Version: 2.2. 15 Stable tag: 2.2.2 6 Version: 2.2.2 7 7 Tested up to: 5.0.1 8 8 License: Commercial -
marketpowerwp/trunk/src/Multisoft/MPP/Replication/ReplicationController.php
r1957871 r2017382 75 75 76 76 $this->add_action('wp_enqueue_scripts', 'mppe_enqueue_autoprefix', 99999); 77 78 // Deprecated - Too Many Bugs79 // if (!is_admin()) {80 // ob_start();81 // add_action('shutdown', function () {82 // $final = '';83 // $levels = ob_get_level();84 85 // for ($i = 0; $i < $levels; $i++) {86 // $final .= ob_get_clean();87 // }88 // echo apply_filters('final_output', $final);89 // }, 0);90 // $this->add_filter('final_output', 'mppe_autoprefix_content');91 // }92 77 93 78 } … … 223 208 $settingsGateway = SettingsGateway::getInstance(); 224 209 $autoprefix = $settingsGateway->get(self::OPTION_AUTOPREFIX); 225 210 226 211 if($autoprefix){ 227 212 wp_enqueue_script('mppe-jurlp', $this->_js_dir_url . 'jurlp/jurlp.min.js', ['jquery']); … … 242 227 } 243 228 } 244 245 // @Deprecated - too many bugs246 // public function mppe_autoprefix_content($output)247 // {248 // require_once $this->_plugin_dir . '/src/Multisoft/MPP/Replication/simple_html_dom.php';249 // /* @var $replicationGateway ReplicationGateway */250 // /* @var $settingsGateway SettingsGateway */251 // $replicationGateway = $this->replicationGateway;252 // $settingsGateway = SettingsGateway::getInstance();253 // $autoprefix = $settingsGateway->get(self::OPTION_AUTOPREFIX);254 255 // $xxx = $replicationGateway->get_replication_site_name(true);256 // if($xxx === false){257 // return $output;258 // }259 // $host = Utils::get_domain(site_url());260 // $web_address_host = Utils::get_domain($settingsGateway->get(CoreController::OPTION_WEB_ADDRESS));261 // $html = str_get_html($output);262 // if ($html) {263 // foreach ($html->find('a') as $element) {264 // $href = parse_url($element->href);265 // $element_host = Utils::get_domain($href['host']);266 // if (strtolower($element_host) == strtolower($host) ||267 // strtolower($element_host) == strtolower($web_address_host)268 // ) {269 // $url_splice = explode('.', $href['host']);270 // $site_name = $url_splice[0];271 // if (strtolower($site_name) === 'www') {272 // $site_name = $url_splice[1];273 // }274 // if ($autoprefix && $site_name !== $xxx) {275 // $new_href = $href['scheme'] . '://' . $xxx . '.' .276 // Utils::str_replace_first($href['scheme'] . '://', '', $element->href);277 // $element->href = $new_href;278 // } else if (!$autoprefix && $site_name === $xxx) {279 // $new_href = Utils::str_replace_first($xxx . '.', '', $element->href);280 // $element->href = $new_href;281 // }282 // }283 // }284 // }285 // return $html;286 // }287 229 288 230 public function mppe_replication_info($atts, $content = null) … … 325 267 $settingsGateway = SettingsGateway::getInstance(); 326 268 $replicationGateway = $this->replicationGateway; 327 $site_name = $replicationGateway->get_replication_site_name(); 328 $valid = $replicationGateway->check_site_name($site_name); 329 $this->mpp_error_view = new View($this, ''); 330 if (is_wp_error($valid)) { 331 /* @var $valid \WP_Error */ 332 $this->mpp_error_view->addNotice( 333 'Multisoft MarketPowerPRO ' . 334 $valid->get_error_code() . ': ' . $valid->get_error_message(), 335 'notice-error', false 336 ); 337 } else if ($valid === false) { 338 $redirection_page = $settingsGateway->get(self::OPTION_NON_EXIST_REDIRECTION); 339 if ($redirection_page) { 340 wp_redirect(get_permalink($redirection_page)); 341 exit(); 342 } else { 269 $site_name = $replicationGateway->get_replication_site_name(true); 270 if ($site_name) { 271 $valid = $replicationGateway->check_site_name($site_name); 272 $this->mpp_error_view = new View($this, ''); 273 if (is_wp_error($valid)) { 274 /* @var $valid \WP_Error */ 275 $this->mpp_error_view->addNotice( 276 'Multisoft MarketPowerPRO ' . 277 $valid->get_error_code() . ': ' . $valid->get_error_message(), 278 'notice-error', false 279 ); 280 } else if ($valid === false) { 343 281 if (is_admin()) { 344 282 $this->mpp_error_view->addNotice( … … 348 286 ); 349 287 } else { 350 // No more redirect on non-existing subdomain. Just display the page 351 // wp_redirect(Utils::getMainDomain()); 352 // exit(); 288 add_action("template_redirect", [$this, "mppe_invalid_site_name_redirect"]); 353 289 } 354 290 } 355 291 } 292 } 293 294 public function mppe_invalid_site_name_redirect() { 295 $settingsGateway = SettingsGateway::getInstance(); 296 $redirection_page = $settingsGateway->get(self::OPTION_NON_EXIST_REDIRECTION); 297 global $wpdb; 298 $prefix = $wpdb->prefix; 299 $original_site_url = $wpdb->get_var("SELECT option_value FROM {$prefix}options WHERE option_name = 'siteurl'"); 300 if($redirection_page) { 301 $url = strtolower(get_permalink($redirection_page)); 302 $url = Utils::str_replace_first(strtolower(site_url()), $original_site_url, $url); 303 } else { 304 $url = strtolower($original_site_url); 305 } 306 wp_redirect($url); 307 exit(); 356 308 } 357 309 -
marketpowerwp/trunk/views/mpp_replication_general_settings_section.php
r1431993 r2017382 8 8 <?php wp_dropdown_pages($this->page_drop_down_args); ?> 9 9 10 <p class="description">Empty by default and plugin will just send 404page when a non-existent site10 <p class="description">Empty by default and plugin will just redirect to the home page when a non-existent site 11 11 name has been detected. You can optionally select a page to redirect to when this occurs.</p> 12 12 </td>
Note: See TracChangeset
for help on using the changeset viewer.