Plugin Directory

Changeset 932816


Ignore:
Timestamp:
06/16/2014 05:51:24 AM (12 years ago)
Author:
madpixels
Message:

Reworked plugin setup to work only when WooCommerce is activated. Updated translations and injected WCCM_VERSION contstant into scripts and styles enqueueing functions.

Location:
woocommerce-compare-list/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • woocommerce-compare-list/trunk/includes/catalog.php

    r909527 r932816  
    4141        if ( wccm_show_in_catalog() ) {
    4242            $base_path = plugins_url( '/', dirname( __FILE__ ) );
    43             wp_enqueue_style( 'wccm-catalog', $base_path . 'css/catalog.css', array( 'dashicons' ), '1.0.0' );
     43            wp_enqueue_style( 'wccm-catalog', $base_path . 'css/catalog.css', array( 'dashicons' ), WCCM_VERISON );
    4444        }
    4545    }
  • woocommerce-compare-list/trunk/includes/common.php

    r909527 r932816  
    2828
    2929// register action hooks
    30 add_action( 'plugins_loaded', 'wccm_load_textdomain' );
    3130add_action( 'init', 'wccm_register_endpoint' );
    32 
    3331// register filter hooks
    3432add_filter( 'query_vars', 'wccm_register_endpoint_var' );
    35 
    36 /**
    37  * Loads plugin text domain and translations.
    38  *
    39  * @since 1.0.0
    40  * @action plugins_loaded
    41  */
    42 function wccm_load_textdomain() {
    43     load_plugin_textdomain( 'wccm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
    44 }
    4533
    4634/**
  • woocommerce-compare-list/trunk/includes/compare-page.php

    r909527 r932816  
    4848    if ( is_page() && get_option( 'wccm_compare_page' ) == get_queried_object_id() ) {
    4949        $base_path = plugins_url( '/', dirname( __FILE__ ) );
    50         wp_enqueue_style( 'wccm-compare', $base_path . 'css/compare.css', array( 'dashicons' ), '1.0.0' );
     50        wp_enqueue_style( 'wccm-compare', $base_path . 'css/compare.css', array( 'dashicons' ), WCCM_VERISON );
    5151
    52         wp_enqueue_script( 'wccm-compare', $base_path . 'js/compare.js', array( 'jquery' ), '1.0.0' );
     52        wp_enqueue_script( 'wccm-compare', $base_path . 'js/compare.js', array( 'jquery' ), WCCM_VERISON );
    5353        wp_localize_script( 'wccm-compare', 'wccm', array(
    5454            'ie'      => $is_IE,
  • woocommerce-compare-list/trunk/index.php

    r909530 r932816  
    44Plugin URI: http://wordpress.org/plugins/woocommerce-compare-list/
    55Description: The plugin adds ability to compare some products of your WooCommerce driven shop.
    6 Version: 1.0.0
     6Version: 1.1
    77Author: Madpixels
    88Author URI: http://madpixels.net
     
    3737}
    3838
    39 // load appropriate files
    40 require_once 'includes/common.php';
    41 
    42 if ( is_admin() ) {
    43     require_once 'includes/settings.php';
    44 } elseif ( intval( get_option( 'wccm_compare_page' ) ) > 0 ) {
    45     require_once 'includes/buttons.php';
    46     require_once 'includes/compare-page.php';
    47     require_once 'includes/catalog.php';
    48 }
    49 
     39// add action hooks
     40add_action( 'plugins_loaded', 'wccm_launch' );
    5041// activation and deactivation stuff
    5142register_activation_hook( __FILE__, 'flush_rewrite_rules' );
    5243register_deactivation_hook( __FILE__, 'flush_rewrite_rules' );
     44
     45/**
     46 * Launches plugin if WooCommerce is active.
     47 *
     48 * @since 1.1
     49 * @action plugins_loaded
     50 *
     51 * @return boolean TRUE if launched successfully, otherwise FALSE.
     52 */
     53function wccm_launch() {
     54    if ( !class_exists( 'WooCommerce' ) || defined( 'WCCM_VERISON' ) ) {
     55        return false;
     56    }
     57
     58    define( 'WCCM_VERISON', '1.1' );
     59
     60    load_plugin_textdomain( 'wccm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
     61
     62    require_once 'includes/common.php';
     63    if ( is_admin() ) {
     64        require_once 'includes/settings.php';
     65    } elseif ( intval( get_option( 'wccm_compare_page' ) ) > 0 ) {
     66        require_once 'includes/buttons.php';
     67        require_once 'includes/compare-page.php';
     68        require_once 'includes/catalog.php';
     69    }
     70
     71    return true;
     72}
  • woocommerce-compare-list/trunk/languages/wccm-en_US.po

    r909527 r932816  
    33"Project-Id-Version: WooCommerce Compare List\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2014-04-25 14:05+0300\n"
    6 "PO-Revision-Date: 2014-04-25 14:05+0300\n"
     5"POT-Creation-Date: 2014-06-16 08:47+0300\n"
     6"PO-Revision-Date: 2014-06-16 08:47+0300\n"
    77"Last-Translator: Eugene Manuilov <eugene@manuilov.org>\n"
    88"Language-Team: MadPixels <contact@madpixels.net>\n"
     
    2121"X-Poedit-SearchPath-0: .\n"
    2222
    23 #: includes/buttons.php:71 includes/settings.php:90
     23#: includes/catalog.php:77 includes/buttons.php:78 includes/settings.php:90
     24msgid "Compare"
     25msgstr "Compare"
     26
     27#: includes/catalog.php:81
     28msgid "Cancel"
     29msgstr "Cancel"
     30
     31#: includes/buttons.php:71 includes/settings.php:98
    2432msgid "Remove compare"
    2533msgstr "Remove compare"
    2634
    27 #: includes/buttons.php:74 includes/settings.php:82
    28 msgid "Compare"
    29 msgstr "Compare"
     35#: includes/buttons.php:74
     36msgid "View compare"
     37msgstr "View compare"
    3038
    31 #: includes/compare-page.php:64
     39#: includes/compare-page.php:84
    3240msgid "No products found to compare."
    3341msgstr "No products found to compare."
     
    6270
    6371#: includes/settings.php:80
     72msgid "Endpoint Slug"
     73msgstr "Endpoint Slug"
     74
     75#: includes/settings.php:81
     76msgid "Enter text which will be used as endpoint for compare page."
     77msgstr "Enter text which will be used as endpoint for compare page."
     78
     79#: includes/settings.php:82 includes/common.php:42
     80msgid "products"
     81msgstr "products"
     82
     83#: includes/settings.php:88
    6484msgid "Compare button text"
    6585msgstr "Compare button text"
    6686
    67 #: includes/settings.php:81
     87#: includes/settings.php:89
    6888msgid "Enter text which will be displayed on the add to compare button."
    6989msgstr "Enter text which will be displayed on the add to compare button."
    7090
    71 #: includes/settings.php:88
     91#: includes/settings.php:96
    7292msgid "Remove button text"
    7393msgstr "Remove button text"
    7494
    75 #: includes/settings.php:89
     95#: includes/settings.php:97
    7696msgid "Enter text which will be displayed on the remove from compare button."
    7797msgstr "Enter text which will be displayed on the remove from compare button."
    7898
    79 #: includes/settings.php:120
     99#: includes/settings.php:128
    80100msgid "Compare List"
    81101msgstr "Compare List"
Note: See TracChangeset for help on using the changeset viewer.