| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Fired during plugin activation |
| 5 |
* |
| 6 |
* @link http://wpstream.net |
| 7 |
* @since 3.0.1 |
| 8 |
* |
| 9 |
* @package Wpstream |
| 10 |
* @subpackage Wpstream/includes |
| 11 |
*/ |
| 12 |
|
| 13 |
|
| 14 |
// Exit if accessed directly. |
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
exit; |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Fired during plugin activation. |
| 21 |
* |
| 22 |
* This class defines all code necessary to run during the plugin's activation. |
| 23 |
* |
| 24 |
* @since 3.0.1 |
| 25 |
* @package Wpstream |
| 26 |
* @subpackage Wpstream/includes |
| 27 |
* @author wpstream <office@wpstream.net> |
| 28 |
*/ |
| 29 |
class Wpstream_Activator { |
| 30 |
|
| 31 |
/** |
| 32 |
* Run the one-time activation routine. |
| 33 |
* |
| 34 |
* Registers the plugin's custom post types and flushes the rewrite rules so |
| 35 |
* their permalinks work immediately after the plugin is switched on. |
| 36 |
* |
| 37 |
* @since 3.0.1 |
| 38 |
*/ |
| 39 |
public static function activate() { |
| 40 |
|
| 41 |
// Load the class that declares WpStream's custom post types. |
| 42 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-product.php'; |
| 43 |
// Instantiate the post-type registrar. |
| 44 |
$plugin_post_types = new Wpstream_Product(); |
| 45 |
// Register the custom post types (channels, VODs, etc.). |
| 46 |
$plugin_post_types->create_custom_post_type(); |
| 47 |
|
| 48 |
// Rebuild rewrite rules now that new post types exist, so their URLs resolve. |
| 49 |
flush_rewrite_rules(); |
| 50 |
|
| 51 |
// |
| 52 |
|
| 53 |
} |
| 54 |
|
| 55 |
} |
| 56 |
|