admin
3 years ago
classes
3 years ago
actions.php
3 years ago
core.php
3 years ago
install.php
3 years ago
uninstall.php
3 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 ( 0 === $time ) { |
| 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 && TCMP_WHATSNEW_VERSION != $v ) { |
| 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 |