/** * Hide note action * * @return void */ function action_default_hide_note() { $note = W3_Request::get_string('note'); $admin = W3_Request::get_boolean('admin'); $setting = sprintf('notes.%s', $note); if ($admin) { $this->_config_admin->set($setting, false); $this->_config_admin->save(); } else { $this->_config->set($setting, false); $this->_config->save(); } w3_admin_redirect(array(), true); }
/** * Handle minify error * * @param string $error * @return void */ function _handle_error($error) { $notification = $this->_config_admin->get_string('minify.error.notification'); if ($notification) { $file = W3_Request::get_string('file'); if ($file) { $this->_config_admin->set('minify.error.file', $file); } if (stristr($notification, 'admin') !== false) { $this->_config_admin->set('minify.error.last', $error); $this->_config_admin->set('notes.minify_error', true); } if (stristr($notification, 'email') !== false) { $last = $this->_config_admin->get_integer('minify.error.notification.last'); /** * Prevent email flood: send email every 5 min */ if (time() - $last > 300) { $this->_config_admin->set('minify.error.notification.last', time()); $this->_send_notification(); } } $this->_config_admin->save(); } }
/** * Save preview option * * @return void */ function action_config_preview_disable() { $this->_config->preview_production_copy(1, true); $this->_config_admin->set('previewmode.enabled', false); $this->_config_admin->save(); w3_admin_redirect(array('w3tc_note' => 'preview_disable')); }
/** * Edge Mode popup notification */ public function edge_nag() { $edge_reminder = $this->_config_admin->get_integer('evaluation.reminder') != 0 && $this->_config_admin->get_integer('evaluation.reminder') < time() && !w3tc_edge_mode(); if ($edge_reminder || w3tc_show_notification('edge_mode_popup')) { ?> <script type="text/javascript">/*<![CDATA[*/ jQuery(function() { w3tc_lightbox_use_edge_mode('<?php echo wp_create_nonce('w3tc'); ?> '); }); /*]]>*/</script> <?php $delay = get_option('w3tc_edge_remainder_period'); if ($delay <= 7 * 24 * 60 * 60) { $delay = 30 * 24 * 60 * 60; } else { if ($delay <= 30 * 24 * 60 * 60) { $delay = 60 * 24 * 60 * 60; } else { $delay = 90 * 24 * 60 * 60; } } update_option('w3tc_edge_remainder_period', $delay); try { $this->_config_admin->set('evaluation.reminder', time() + $delay); $this->_config_admin->save(); } catch (Exception $ex) { } } }
/** * */ public function action_edge_mode_enable() { w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/activation.php'); $config_path = w3_get_wp_config_path(); $config_data = @file_get_contents($config_path); if ($config_data === false) { return; } $new_config_data = $this->wp_config_evaluation_mode_remove_from_content($config_data); $new_config_data = preg_replace('~<\\?(php)?~', "\\0\r\n" . $this->wp_config_evaluation_mode(), $new_config_data, 1); if ($new_config_data != $config_data) { try { w3_wp_write_to_file($config_path, $new_config_data); } catch (FilesystemOperationException $ex) { throw new FilesystemModifyException($ex->getMessage(), $ex->credentials_form(), 'Edit file <strong>' . $config_path . '</strong> and add the next lines:', $config_path, $this->wp_config_evaluation_mode()); } try { $this->_config_admin->set('notes.edge_mode', false); $this->_config_admin->save(); } catch (Exception $ex) { } } w3_admin_redirect(array('w3tc_note' => 'enabled_edge')); }