Skip to content

Commit

Permalink
Merge branch 'release/1.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
gregpriday committed Jul 8, 2015
2 parents 0ae5f21 + c293506 commit 354fd63
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
14 changes: 13 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SiteOrigin CSS has a powerful CSS editor, the likes of which you'd usually only

= It's Free =

We're committed to keeping SiteOrigin CSS free. You can install it on as many sites as you like without ever worrying about licensing. All future updates and upgrades will be free, and we even offer free support over on our friendly support forums.
We're committed to keeping SiteOrigin CSS, free. You can install it on as many sites as you like without ever worrying about licensing. All future updates and upgrades will be free, and we even offer free support over on our friendly support forums.

= Works With Any Theme =

Expand All @@ -51,8 +51,20 @@ We're actively developing SiteOrigin CSS. Keep track of what's happening over on
3. A full CSS editor that works in real-time with a preview of your site.
4. Code completion for all your theme's selectors.

== Documentation ==

[Documentation](https://siteorigin.com/css/getting-started/) is available on SiteOrigin.

== Support ==

We offer free support on the [SiteOrigin support forums](https://siteorigin.com/thread/).

== Changelog ==

= 1.0.2 =
* Dequeue functionality that conflicted with WordPress color picker, if it's enqueued.
* Removed wp_styles for compatibility with older versions of WordPress

= 1.0.1 =
* Fixed conflicts with CSS editor in SiteOrigin themes.
* Force dequeue scripts that cause problems with main editing interface.
Expand Down
27 changes: 16 additions & 11 deletions so-css.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
Plugin Name: SiteOrigin CSS
Description: An advanced CSS editor from SiteOrigin.
Version: 1.0.1
Version: 1.0.2
Author: SiteOrigin
Author URI: https://siteorigin.com
Plugin URI: https://siteorigin.com/css/
Expand All @@ -13,7 +13,7 @@
// Handle the legacy CSS editor that came with SiteOrigin themes
include plugin_dir_path(__FILE__) . '/inc/legacy.php';

define('SOCSS_VERSION', '1.0.1');
define('SOCSS_VERSION', '1.0.2');
define('SOCSS_JS_SUFFIX', '');

/**
Expand All @@ -32,8 +32,8 @@ function __construct(){

// All the admin actions
add_action( 'admin_menu', array($this, 'action_admin_menu') );
add_action( 'admin_enqueue_scripts', array($this, 'enqueue_admin_scripts') );
add_action( 'admin_enqueue_scripts', array($this, 'dequeue_admin_scripts'), 100 );
add_action( 'admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20 );
add_action( 'admin_enqueue_scripts', array($this, 'dequeue_admin_scripts'), 19 );
add_action( 'load-appearance_page_so_custom_css', array($this, 'add_help_tab') );
add_action( 'admin_footer', array($this, 'action_admin_footer') );

Expand Down Expand Up @@ -142,10 +142,12 @@ function enqueue_admin_scripts( $page ){
wp_enqueue_script( 'codemirror', plugin_dir_url(__FILE__) . 'lib/codemirror/lib/codemirror' . SOCSS_JS_SUFFIX . '.js', array( 'underscore', 'backbone' ), '5.2.0' );
wp_enqueue_script( 'codemirror-mode-css', plugin_dir_url(__FILE__) . 'lib/codemirror/mode/css/css' . SOCSS_JS_SUFFIX . '.js', array(), '5.2.0' );

// Add in all the linting libs
wp_enqueue_script( 'codemirror-lint', plugin_dir_url(__FILE__) . 'lib/codemirror/addon/lint/lint' . SOCSS_JS_SUFFIX . '.js', array( 'codemirror' ), '5.2.0' );
wp_enqueue_script( 'codemirror-lint-css', plugin_dir_url(__FILE__) . 'lib/codemirror/addon/lint/css-lint' . SOCSS_JS_SUFFIX . '.js', array( 'codemirror', 'codemirror-lint-css-lib' ), '5.2.0' );
wp_enqueue_script( 'codemirror-lint-css-lib', plugin_dir_url(__FILE__) . 'js/csslint' . SOCSS_JS_SUFFIX . '.js', array(), '0.10.0' );
if( !wp_script_is( 'wp-color-picker' ) ) {
// Add in all the linting libs
wp_enqueue_script( 'codemirror-lint', plugin_dir_url(__FILE__) . 'lib/codemirror/addon/lint/lint' . SOCSS_JS_SUFFIX . '.js', array( 'codemirror' ), '5.2.0' );
wp_enqueue_script( 'codemirror-lint-css', plugin_dir_url(__FILE__) . 'lib/codemirror/addon/lint/css-lint' . SOCSS_JS_SUFFIX . '.js', array( 'codemirror', 'codemirror-lint-css-lib' ), '5.2.0' );
wp_enqueue_script( 'codemirror-lint-css-lib', plugin_dir_url(__FILE__) . 'js/csslint' . SOCSS_JS_SUFFIX . '.js', array(), '0.10.0' );
}

// The CodeMirror autocomplete library
wp_enqueue_script( 'codemirror-show-hint', plugin_dir_url(__FILE__) . 'lib/codemirror/addon/hint/show-hint' . SOCSS_JS_SUFFIX . '.js', array( 'codemirror' ), '5.2.0' );
Expand Down Expand Up @@ -383,10 +385,13 @@ function inline_inspector_scripts(){
"`(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+`ism"=>"\n"
);

$styles = wp_styles();
foreach( $styles->queue as $handle ) {
global $wp_styles;
if( empty($wp_styles->queue) ) return;

// Make each of the scripts inline
foreach( $wp_styles->queue as $handle ) {
if( $handle === 'siteorigin-css-inspector' || $handle === 'dashicons' ) continue;
$style = $styles->registered[$handle];
$style = $wp_styles->registered[$handle];
if( empty($style->src) || substr($style->src, 0, 4) !== 'http' ) continue;
$response = wp_remote_get( $style->src );
if( is_wp_error($response) || $response['response']['code'] !== 200 || empty($response['body']) ) continue;
Expand Down

0 comments on commit 354fd63

Please sign in to comment.