Skip to content

Commit

Permalink
Plug-in classes structure has been prepared
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandrew committed Jul 27, 2017
1 parent 9e22be3 commit 99c12d9
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 2 deletions.
19 changes: 19 additions & 0 deletions includes/admin/class-woo2yml-yandex-market-admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

if ( !class_exists('Woo2YML_YandexMarket_Admin') ) {
/**
* Class Woo2YML_YandexMarket_Admin
*
* Main Admin Class.
*
* @author Andrey Mishchenko
* @since 1.0.0
* @package woo2yml-yandex-market
*/
class Woo2YML_YandexMarket_Admin {

}
}
45 changes: 45 additions & 0 deletions includes/common/class-woo2yml-yandex-market-core.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

if ( !class_exists('Woo2YML_YandexMarket_Core') ) {
/**
* Class Woo2YML_YandexMarket_Core
*
* Plugin Core Class.
*
* @author Andrey Mishchenko
* @since 1.0.0
* @package woo2yml-yandex-market
*/
class Woo2YML_YandexMarket_Core {

/**
* Current Class Instance.
*
* @var Woo2YML_YandexMarket_Core
*/
private static $INSTANCE = null;


/**
* Return current class instance.
*
* @since 1.0.0
*
* @return Woo2YML_YandexMarket_Core
*/
public static function get_instance() {

if ( self::$INSTANCE == null ) {
self::$INSTANCE = new Woo2YML_YandexMarket_Core();
}

return self::$INSTANCE;

// get_instance
}

}
}
19 changes: 19 additions & 0 deletions includes/helpers/class-woo2yml-yandex-market-i18n.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

if ( !class_exists('Woo2YML_YandexMarket_i18n') ) {
/**
* Class Woo2YML_YandexMarket_i18n
*
* Internationalization functionality helper class.
*
* @author Andrey Mishchenko
* @since 1.0.0
* @package woo2yml-yandex-market
*/
class Woo2YML_YandexMarket_i18n {

}
}
11 changes: 11 additions & 0 deletions includes/plugin-hooks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
/**
* Registers the processing of the plugin hooks
*
* @author Andrey Mishchenko
* @since 1.0.0
* @package woo2yml-yandex-market
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
60 changes: 58 additions & 2 deletions woo2yml-yandex-market.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Plugin Name: WooCommerce items export to YML format Yandex Market
* Plugin Name: WooCommerce items export to YML
* Plugin URI: https://github.com/mvandrew/woo2yml-yandex-market
* Version: 1.0.0
* Description: WordPress plugin for WooCommerce items export to YML format Yandex Market.
Expand All @@ -16,4 +16,60 @@
* @author Andrey Mishchenko
*/

if ( ! defined( 'ABSPATH' ) ) { exit; }
if ( ! defined( 'ABSPATH' ) ) { exit; }


/**
* Check if WooCommerce is active
**/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) {

// ------------------------------------------
// Define Plugin Text Domain
// ------------------------------------------
define( 'WOO2YML_YM__TEXT_DOMAIN', 'woo2yml-yandex-market' );


// ------------------------------------------
// Determining the plugin version.
// ------------------------------------------
$plugin_data = get_plugin_data( __FILE__ );
define( 'WOO2YML_YM__VERSION', $plugin_data['Version']);


// ------------------------------------------
// Plugin Paths
// ------------------------------------------
define( 'WOO2YML_YM__PLUGIN_DIR', dirname( __FILE__ ) );
define( 'WOO2YML_YM__INCLUDES_DIR', WOO2YML_YM__PLUGIN_DIR . '/includes' );
define( 'WOO2YML_YM__ADMIN_DIR', WOO2YML_YM__INCLUDES_DIR . '/admin' );
define( 'WOO2YML_YM__COMMON_DIR', WOO2YML_YM__INCLUDES_DIR . '/common' );
define( 'WOO2YML_YM__HELPERS_DIR', WOO2YML_YM__INCLUDES_DIR . '/helpers' );


// ------------------------------------------
// Include library files
// ------------------------------------------
require_once ( WOO2YML_YM__INCLUDES_DIR . '/plugin-hooks.php' );


// ------------------------------------------
// Include helper classes
// ------------------------------------------
require_once ( WOO2YML_YM__HELPERS_DIR . '/class-woo2yml-yandex-market-i18n.php' );


// ------------------------------------------
// Include common classes
// ------------------------------------------
require_once ( WOO2YML_YM__COMMON_DIR . '/class-woo2yml-yandex-market-core.php' );


// ------------------------------------------
// Include admin classes
// ------------------------------------------
if ( is_admin() ) {
require_once ( WOO2YML_YM__ADMIN_DIR . '/class-woo2yml-yandex-market-admin.php' );
}

}

0 comments on commit 99c12d9

Please sign in to comment.