_errors = array(); if (in_array("woocommerce/woocommerce.php", apply_filters("active_plugins", get_option("active_plugins")))) { include_once YOFLA_360_PLUGIN_PATH . 'includes/class-yofla360-woocommerce.php'; new YoFLA360Woocommerce(); self::$isWooCommerce = true; } //includes include_once YOFLA_360_PLUGIN_PATH . 'includes/class-yofla360-utils.php'; //in wordpress admin area if (is_admin()) { include_once YOFLA_360_PLUGIN_PATH . 'includes/class-yofla360-activation.php'; include_once YOFLA_360_PLUGIN_PATH . 'includes/class-yofla360-settings.php'; include_once YOFLA_360_PLUGIN_PATH . 'includes/class-yofla360-addmedia.php'; new YoFLA360Activation(); new YoFLA360Settings(); new YoFLA360Addmedia(); $this->checkUpgrading(); } //in wordpress frontend else { include_once YOFLA_360_PLUGIN_PATH . 'includes/class-yofla360-shortcodes.php'; include_once YOFLA_360_PLUGIN_PATH . 'includes/class-yofla360-frontend.php'; include_once YOFLA_360_PLUGIN_PATH . 'includes/class-yofla360-viewdata.php'; //init shortcodes new YoFLA360Shortcodes(); } add_action('init', array($this, 'addAdminJs')); //in wordpress admin or on wordpress frontend } public function addAdminJs() { if (current_user_can('administrator')) { $scriptUrl = YOFLA_360_PLUGIN_URL . 'js/y360-admin.js'; wp_register_script('yofla_360_admin_js', $scriptUrl, false, '1.0.0'); wp_enqueue_script('yofla_360_admin_js'); } } private function checkUpgrading() { //check if upgrading... if (get_option(YOFLA_360_VERSION_KEY) != YOFLA_360_VERSION_NUM) { // Execute your upgrade logic here // no action // Update version update_option(YOFLA_360_VERSION_KEY, YOFLA_360_VERSION_NUM); } } /** * Adds an error * * @param $msg */ public function add_error($msg) { $this->_errors[] = $msg; } /** * Return errors, if any */ public function get_errors() { if (sizeof($this->_errors) > 0) { return YoFLA360()->Frontend()->format_error(implode('
' . PHP_EOL, $this->_errors)); } else { return false; } } /** * Handle for Utils functions * * @return YoFLA360Frontend */ public function Utils() { return YoFLA360Utils::instance(); } /** * Handle for Frontend functions * * @return YoFLA360Frontend */ public function Frontend() { return YoFLA360Frontend::instance(); } } /** * Returns main instance of YoFLA360 class * * @return YoFLA360 */ function YoFLA360() { return YoFLA360::instance(); } //initialize YoFLA360();