コード例 #1
0
	/**
	 * Runs when the plugin is activated. Checks WP verison, and prepares the DB
	 *
	 * @since 1.0
	 */
	public function on_activation() {
		/* Prevents activation of plugin if compatible version of WordPress not found */
		if ( version_compare( get_bloginfo( 'version' ),  self::WP_MIN_VERSION, '<' ) ) {
			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
			deactivate_plugins ( basename( __FILE__ ));
			wp_die(  self::wp_dependancy_msg() , 'WP RSS Aggregator Feed-to-Post', array( 'back_link' => true ) );
		}

		// Add the database version setting.
		update_option( 'wprss_ftp_db_version', WPRSS_FTP_DB_VERSION );
		// Trash all imported feed items
		$this->remove_imported_feed_items();

		WPRSS_FTP_Meta::multisite_fix();

		// force_full_content fix for 2.0 update
		$ftp_settings = $this->settings();
		$ftp_settings['force_full_content'] = 'false';
		update_option( WPRSS_FTP_Settings::OPTIONS_NAME, $ftp_settings );

		// Close append/prepend metaboxes for user
		WPRSS_FTP_Utils::close_ftp_metabox_for_user_by_default( get_current_user_id(), 'wprss-ftp-prepend-metabox' );
		WPRSS_FTP_Utils::close_ftp_metabox_for_user_by_default( get_current_user_id(), 'wprss-ftp-append-metabox' );
		WPRSS_FTP_Utils::close_ftp_metabox_for_user_by_default( get_current_user_id(), 'wprss-ftp-extraction-metabox' );
		WPRSS_FTP_Utils::close_ftp_metabox_for_user_by_default( get_current_user_id(), 'wprss-ftp-custom-fields-metabox' );

		// Source link conversion update
		WPRSS_FTP_Utils::source_link_update();
	}