Skip to content

Commit

Permalink
Merge pull request #33 from kasparsd/release/1.0.6
Browse files Browse the repository at this point in the history
Version 1.0.6
  • Loading branch information
kasparsd authored Jan 20, 2018
2 parents 95f5c43 + b892f4d commit b453c65
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
31 changes: 20 additions & 11 deletions class/class-widget-context.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static function instance() {
* Use widget_context::instance() instead.
*/
private function __construct() {
// Not used.
$this->plugin_path = dirname( dirname( __FILE__ ) );
}

/**
Expand Down Expand Up @@ -92,11 +92,8 @@ function define_widget_contexts() {
)
);

// Initialize core modules
$include_path = plugin_dir_path( __FILE__ );

foreach ( $this->core_modules as $module ) {
$module_file = sprintf( '%smodules/%s/module.php', $include_path, $module );
$module_file = sprintf( '%s/class/modules/%s/module.php', $this->plugin_path, $module );

if ( file_exists( $module_file ) ) {
include $module_file;
Expand Down Expand Up @@ -201,27 +198,28 @@ function set_widget_contexts_frontend() {

function init_l10n() {

load_plugin_textdomain( 'widget-context', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
load_plugin_textdomain( 'widget-context', false, basename( $this->plugin_path ) . '/languages' );

}


function admin_scripts( $page ) {

// Enqueue only on widgets and customizer view
if ( ! in_array( $page, array( 'widgets.php', 'settings_page_widget_context_settings' ) ) )
if ( ! in_array( $page, array( 'widgets.php', 'settings_page_widget_context_settings' ), true ) ) {
return;
}

wp_enqueue_style(
'widget-context-css',
plugins_url( '../css/admin.css', plugin_basename( __FILE__ ) ),
$this->asset_url( '/css/admin.css' ),
null,
$this->asset_version
);

wp_enqueue_script(
'widget-context-js',
plugins_url( '../js/widget-context.js', plugin_basename( __FILE__ ) ),
$this->asset_url( '/js/widget-context.js' ),
array( 'jquery' ),
$this->asset_version
);
Expand Down Expand Up @@ -1013,7 +1011,7 @@ public function get_sidebars_widgets_copy() {

function widget_context_debug_bar_init( $panels ) {

include plugin_dir_path( __FILE__ ) . 'debug/debug-bar.php';
include $this->plugin_path . '/debug/debug-bar.php';

if ( class_exists( 'Debug_Widget_Context' ) )
$panels[] = new Debug_Widget_Context();
Expand All @@ -1027,11 +1025,22 @@ function widget_context_debug_bar_scripts() {

wp_enqueue_script(
'widget-context-debug-js',
plugins_url( 'debug/debug.js', plugin_basename( __FILE__ ) ),
$this->asset_url( '/debug/debug.js' ),
array( 'jquery' )
);

}

/**
* Return the public URL of a plugin asset file.
*
* @param string $asset_relative_path Relative path to the asset file.
*
* @return string
*/
function asset_url( $asset_relative_path ) {
return plugins_url( plugin_basename( $this->plugin_path ) . $asset_relative_path );
}


}
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Contributors: kasparsd, jamescollins
Tags: widget, widget context, context, logic, widget logic, cms
Requires at least: 3.0
Tested up to: 4.9.1
Tested up to: 4.9.2
Stable tag: trunk
License: GPLv2 or later

Expand All @@ -29,6 +29,10 @@ Widget Context allows you to show or hide widgets on certain sections of your si

## Changelog

### 1.0.6 (January 20, 2018)
* Fix path to admin scripts and styles, props [@tedgeving](https://github.com/kasparsd/widget-context-wporg/pull/32).
* Mark as tested with WordPress 4.9.2.

### 1.0.5 (May 8, 2017)
* Confirm the plugin works with the latest version of WordPress.
* Add support for continuous testing via [wp-dev-lib](https://github.com/xwp/wp-dev-lib).
Expand Down
2 changes: 1 addition & 1 deletion widget-context.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Widget Context
* Plugin URI: https://widgetcontext.com
* Description: Show or hide widgets depending on the section of the site that is being viewed.
* Version: 1.0.5
* Version: 1.0.6
* Author: Kaspars Dambis
* Author URI: https://kaspars.net
* Text Domain: widget-context
Expand Down

0 comments on commit b453c65

Please sign in to comment.