admin
6 years ago
classes
6 years ago
actions.php
6 years ago
core.php
6 years ago
install.php
6 years ago
uninstall.php
6 years ago
install.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | register_activation_hook(TCMP_PLUGIN_FILE, 'tcmp_install'); |
| 4 | function tcmp_install($networkwide=NULL) { |
| 5 | global $wpdb, $tcmp; |
| 6 | |
| 7 | $time=$tcmp->Options->getPluginInstallDate(); |
| 8 | if($time==0) { |
| 9 | $tcmp->Options->setPluginInstallDate(time()); |
| 10 | } |
| 11 | $tcmp->Options->setPluginUpdateDate(time()); |
| 12 | $tcmp->Options->setShowWhatsNew(TRUE); |
| 13 | $tcmp->Options->setPluginFirstInstall(TRUE); |
| 14 | } |
| 15 | |
| 16 | add_action('admin_init', 'tcmp_first_redirect'); |
| 17 | function tcmp_first_redirect() { |
| 18 | global $tcmp; |
| 19 | $v=$tcmp->Options->getShowWhatsNewSeenVersion(); |
| 20 | if($v>=0 && $v!=TCMP_WHATSNEW_VERSION) { |
| 21 | $tcmp->Options->setShowWhatsNewSeenVersion(-1); |
| 22 | tcmp_install(); |
| 23 | } |
| 24 | |
| 25 | if ($tcmp->Options->isPluginFirstInstall()) { |
| 26 | $tcmp->Options->setPluginFirstInstall(FALSE); |
| 27 | $tcmp->Options->setShowActivationNotice(TRUE); |
| 28 | $tcmp->Utils->redirect(TCMP_PAGE_MANAGER); |
| 29 | } |
| 30 | } |
| 31 |