| 1 |
<?php |
| 2 |
/* |
| 3 |
This program is free software; you can redistribute it and/or |
| 4 |
modify it under the terms of the GNU General Public License |
| 5 |
as published by the Free Software Foundation; either version 2 |
| 6 |
of the License, or (at your option) any later version. |
| 7 |
|
| 8 |
This program is distributed in the hope that it will be useful, |
| 9 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
GNU General Public License for more details. |
| 12 |
|
| 13 |
You should have received a copy of the GNU General Public License |
| 14 |
along with this program; if not, write to the Free Software |
| 15 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 16 |
|
| 17 |
Copyright 2017 Buttonizer |
| 18 |
*/ |
| 19 |
|
| 20 |
namespace Buttonizer\Admin; |
| 21 |
|
| 22 |
# No script kiddies |
| 23 |
defined( 'ABSPATH' ) or die('No script kiddies please!'); |
| 24 |
|
| 25 |
class ResetButtonizer { |
| 26 |
|
| 27 |
public function __construct() { |
| 28 |
|
| 29 |
$data = (array) get_option('buttonizer_page_categories'); |
| 30 |
|
| 31 |
|
| 32 |
if(isset($_GET['realReset']) && $_GET['realReset'] == md5(BUTTONIZER_DIR)) { |
| 33 |
$this->reset(); |
| 34 |
|
| 35 |
echo '<h1>Bibbidi Bobbidi Boo! <!-- We make mistakes too! --></h1>'; |
| 36 |
|
| 37 |
echo '<h2>The magic happened! Have fun with a clean Buttonizer!</h2>'; |
| 38 |
}else{ |
| 39 |
echo '<p><b>What happens when I click the red button at the right side?</b><br /> |
| 40 |
What will happen is that the plugin will get a \'reset\'. All changes to Buttonizer will get reversed. From then you can start all-over again.</p>'; |
| 41 |
|
| 42 |
echo '<p> </p>'; |
| 43 |
|
| 44 |
echo '<p><b>Why would I do that?</b><br /> |
| 45 |
There can be many reasons to reset <b>Buttonizer</b>. One could be, you ruined the Buttonizer buttons, the settings, categories. Or maybe you want to try it out?</p>'; |
| 46 |
|
| 47 |
echo '<p> </p>'; |
| 48 |
|
| 49 |
echo '<p><b>What about my license?</b><br /> |
| 50 |
Your license won\'t be touched by this button. It only resets & remove: <ul> |
| 51 |
<li>- the Buttonizer buttons</li> |
| 52 |
<li>- the opening hours</li> |
| 53 |
<li>- general settings</li> |
| 54 |
<li>- page categories</li> |
| 55 |
</ul></p>'; |
| 56 |
|
| 57 |
echo '<p> </p>'; |
| 58 |
|
| 59 |
echo '<p><b>Okay, and then?</b><br /> |
| 60 |
Then Buttonizer will get to the default values again. Like you just installed Buttonizer. Nothing more, nothing less. Everything back to normal.</p>'; |
| 61 |
|
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
// Reset |
| 66 |
private function reset() { |
| 67 |
global $oButtonizerMaintain; |
| 68 |
|
| 69 |
update_option('buttonizer_buttons', ''); |
| 70 |
update_option('buttonizer_opening_settings', ''); |
| 71 |
update_option('buttonizer_general_settings', ''); |
| 72 |
update_option('buttonizer_page_categories', ''); |
| 73 |
|
| 74 |
$oButtonizerMaintain->pluginActivate(); |
| 75 |
} |
| 76 |
} |
| 77 |
|