/** * Load action * * @return void */ function load() { $this->add_help_tabs(); $this->_page = Util_Admin::get_current_page(); // run plugin action $action = false; foreach ($_REQUEST as $key => $value) { if (substr($key, 0, 5) == 'w3tc_') { $action = $key; break; } } $executor = new Root_AdminActions(); if ($action && $executor->exists($action)) { if (!wp_verify_nonce(Util_Request::get_string('_wpnonce'), 'w3tc')) { wp_nonce_ays('w3tc'); } try { $executor->execute($action); } catch (\Exception $e) { $key = 'admin_action_failed_' . $action; Util_Admin::redirect_with_custom_messages(array(), array($key => $e->getMessage())); } exit; } }
/** * Save dbcluster config action * * @return void */ function w3tc_config_dbcluster_config_save() { $params = array('page' => 'w3tc_general'); if (!file_put_contents(W3TC_FILE_DB_CLUSTER_CONFIG, stripslashes($_REQUEST['newcontent']))) { try { Util_Activation::throw_on_write_error(W3TC_FILE_DB_CLUSTER_CONFIG); } catch (\Exception $e) { $error = $e->getMessage(); Util_Admin::redirect_with_custom_messages($params, array('dbcluster_save_failed' => $error)); } } Util_Admin::redirect_with_custom_messages($params, null, array('dbcluster_save' => __('Database Cluster configuration file has been successfully saved', 'w3-total-cache'))); }