AnsPress_Init()
Description #
AnsPress initialization class.
Source #
File: anspress-question-answer.php
class AnsPress_Init { // phpcs:ignore /** * Load anspress. * * @access public * @static */ public static function load_anspress() { /* * Action before loading AnsPress. * @since 2.4.7 */ do_action( 'before_loading_anspress' ); anspress()->setup_hooks(); } /** * Load translations. * * @since 2.0.1 * @access public * @static */ public static function load_textdomain() { $locale = apply_filters( 'plugin_locale', get_locale(), 'anspress-question-answer' ); $loaded = load_textdomain( 'anspress-question-answer', trailingslashit( WP_LANG_DIR ) . "anspress-question-answer/anspress-question-answer-{$locale}.mo" ); if ( $loaded ) { return $loaded; } else { load_plugin_textdomain( 'anspress-question-answer', false, basename( __DIR__ ) . '/languages/' ); } } /** * Creating table whenever a new blog is created * * @access public * @static * * @param integer $blog_id Blog id. */ public static function create_blog( $blog_id ) { if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) { switch_to_blog( $blog_id ); // @codingStandardsIgnoreLine require_once __DIR__ . '/activate.php'; AP_Activate::get_instance( true ); restore_current_blog(); } } /** * Deleting the table whenever a blog is deleted * * @access public * @static * * @param array $tables Table names. * @param int $blog_id Blog ID. * * @return array */ public static function drop_blog_tables( $tables, $blog_id ) { if ( empty( $blog_id ) || 1 === (int) $blog_id || $blog_id !== $GLOBALS['blog_id'] ) { return $tables; } global $wpdb; $tables[] = $wpdb->prefix . 'ap_views'; $tables[] = $wpdb->prefix . 'ap_qameta'; $tables[] = $wpdb->prefix . 'ap_activity'; $tables[] = $wpdb->prefix . 'ap_votes'; return $tables; } }
Expand full source code Collapse full source code View on GitHub: anspress-question-answer.php:566
Add your comment