plugin_name = $this->app->plugin_name; $this->plugin_file = $this->app->plugin_file; $this->plugin_dir = $this->app->plugin_dir; $this->plugin_namespace = ucwords( strtolower( $this->plugin_name ), '_' ); $this->plugin_dir_name = basename( $this->plugin_dir ); $this->plugin_base_name = $this->app->is_theme ? 'theme/' . $this->plugin_dir : plugin_basename( $this->plugin_file ); $this->plugin_assets_dir = $this->plugin_dir . DS . 'assets'; $this->plugin_src_dir = $this->plugin_dir . DS . 'src'; $this->plugin_configs_dir = $this->plugin_dir . DS . 'configs'; $this->plugin_views_dir = $this->plugin_src_dir . DS . 'views'; $domain_path = trim( $this->app->get_plugin_data( 'DomainPath' ), '/' . DS ); if ( empty( $domain_path ) || ! is_dir( $this->plugin_dir . DS . $domain_path ) ) { $this->plugin_textdomain = false; $this->plugin_languages_dir = false; } else { $this->plugin_textdomain = $this->app->get_plugin_data( 'TextDomain' ); $this->plugin_languages_dir = $this->plugin_dir . DS . $domain_path; } if ( $this->app->is_theme ) { $this->plugin_url = get_template_directory_uri(); if ( get_template_directory() !== get_stylesheet_directory() ) { $this->child_theme_dir = get_stylesheet_directory(); $this->child_theme_url = get_stylesheet_directory_uri(); $this->child_theme_assets_dir = $this->child_theme_dir . DS . 'assets'; $this->child_theme_assets_url = $this->child_theme_url . '/assets'; $this->child_theme_views_dir = $this->child_theme_dir . DS . 'src' . DS . 'views'; } } else { $this->plugin_url = plugins_url( '', $this->plugin_file ); } $this->plugin_assets_url = $this->plugin_url . '/assets'; $this->blog_id = get_current_blog_id(); if ( is_multisite() && defined( 'BLOG_ID_CURRENT_SITE' ) && $this->blog_id != BLOG_ID_CURRENT_SITE ) { $this->upload_dir = WP_CONTENT_DIR . DS . 'uploads' . DS . $this->plugin_name . $this->blog_id; $this->upload_url = WP_CONTENT_URL . '/uploads/' . $this->plugin_name . $this->blog_id; } else { $this->upload_dir = WP_CONTENT_DIR . DS . 'uploads' . DS . $this->plugin_name; $this->upload_url = WP_CONTENT_URL . '/uploads/' . $this->plugin_name; } } /** * @param int $new_blog */ /** @noinspection PhpUnusedPrivateMethodInspection */ private function switch_blog( $new_blog ) { if ( $new_blog === $this->blog_id ) { return; } $this->set_allowed_access( true ); $this->blog_id = $new_blog; if ( is_multisite() && defined( 'BLOG_ID_CURRENT_SITE' ) && $this->blog_id != BLOG_ID_CURRENT_SITE ) { $this->upload_dir = WP_CONTENT_DIR . DS . 'uploads' . DS . $this->plugin_name . $this->blog_id; $this->upload_url = WP_CONTENT_URL . '/uploads/' . $this->plugin_name . $this->blog_id; } else { $this->upload_dir = WP_CONTENT_DIR . DS . 'uploads' . DS . $this->plugin_name; $this->upload_url = WP_CONTENT_URL . '/uploads/' . $this->plugin_name; } $this->set_allowed_access( false ); } }