Skip to content
This repository was archived by the owner on Feb 19, 2023. It is now read-only.

fix medialibrary error #72

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update wp-less plugin to make work https AND http access, see #62
  • Loading branch information
geraldo committed Oct 28, 2019
commit bcfb337cda65aed86803adafc38a79237222802a
Binary file added css-less/img/admin_icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css-less/img/gallery-menu-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css-less/img/grab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css-less/img/grabbing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css-less/img/load-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css-less/img/preloader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added css-less/img/touchfolio-sprite-default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions inc/plugins/wp-less/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
.svn
.idea

composer.lock
/vendor/
5 changes: 5 additions & 0 deletions inc/plugins/wp-less/.svnignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.idea
.git
*.lock
tests
test
13 changes: 13 additions & 0 deletions inc/plugins/wp-less/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# `wp-less` Contributors

These people have contributed code to improve the quality and features of the WordPress plugin.
They are listed in an alphabetical order.

* [Drew Geraets](https://github.com/drewgeraets)
* SSL URL issue
* [Mark Fabrizio](https://github.com/fabrizim)
* Caching and Garbage collection issues
* [Rix](https://github.com/RixTox)
* WordPress compatibility issue
* [Sebastian Schmid](https://github.com/sebastianschmid)
* URL resolving on old PHP version
25 changes: 16 additions & 9 deletions inc/plugins/wp-less/bootstrap-for-theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
/*
* This file tends to be included in any development.
* In a sentence, in every case where you don't want to use WP-LESS as a standalone.
*
*
* Once included, it's up to you to use the available toolkit for your needs.
*
*
* = How to use? =
*
*
* 1. In your theme, include the `wp-less` anywhere you want. (eg: `wp-content/themes/yourtheme/lib/wp-less`)
* 2. Include the required files in your functions.php file. (eg: `require dirname(__FILE__).'/lib/wp-less/bootstreap-theme.php`)
* 3. The `$WPLessPlugin` is available for your
*
*
* In case you need to access the $WPLessPlugin variable outside the include scope, simply do that:
* `$WPLessPlugin = WPLessPlugin::getInstance();`
*
*
* And to apply automatic building on page display:
* `add_action('wp_print_styles', array($WPLessPlugin, 'processStylesheets'));`
* Or apply all hooks with:
* `$WPLessPlugin->dispatch();`
*
*
* You can rebuild all stylesheets at any time with:
* `$WPLessPlugin->processStylesheets();`
*
*
* Or a specific stylesheet:
* `wp_enqueue_style('my_css', 'path/to/my/style.css');`
* `$WPLessPlugin->processStylesheet('my_css');`
*
*
* = Filters and hooks aren't enough =
*
*
* Build your own flavour and manage it the way you want. Simply extends WPLessPlugin and/or WPLessConfiguration.
* Dig in the code to see what to configure. I tried to make things customizable without extending classes!
*/
Expand All @@ -40,4 +40,11 @@
{
require dirname(__FILE__).'/lib/Plugin.class.php';
$WPLessPlugin = WPPluginToolkitPlugin::create('WPLess', __FILE__, 'WPLessPlugin');

//READY and WORKING
//add_action('after_setup_theme', array($WPLessPlugin, 'install'));

// NOT WORKING
//@see http://core.trac.wordpress.org/ticket/14955
//add_action('uninstall_theme', array($WPLessPlugin, 'uninstall'));
}
16 changes: 11 additions & 5 deletions inc/plugins/wp-less/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
Plugin Name: WP LESS
Description: LESS extends CSS with variables, mixins, operations and nested rules. This plugin magically parse all your <code>*.less</code> files queued with <code>wp_enqueue_style</code> in WordPress.
Author: Oncle Tom
Version: 1.4.2
Author URI: http://case.oncle-tom.net/
Version: 1.8.0
Author URI: https://oncletom.io/
Plugin URI: http://wordpress.org/extend/plugins/wp-less/

This plugin is released under version 3 of the GPL:
http://www.opensource.org/licenses/gpl-3.0.html
*/

require dirname(__FILE__).'/lib/Plugin.class.php';
$WPLessPlugin = WPPluginToolkitPlugin::create('WPLess', __FILE__);
if (!class_exists('WPLessPlugin'))
{
require dirname(__FILE__).'/lib/Plugin.class.php';
$WPLessPlugin = WPPluginToolkitPlugin::create('WPLess', __FILE__, 'WPLessPlugin');

$WPLessPlugin->dispatch();
register_activation_hook(__FILE__, array($WPLessPlugin, 'install'));
register_deactivation_hook(__FILE__, array($WPLessPlugin, 'uninstall'));

$WPLessPlugin->dispatch();
}
14 changes: 14 additions & 0 deletions inc/plugins/wp-less/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "oncletom/wp-less",
"require": {
"oyejorge/less.php": "~1.7",
"leafo/lessphp": "~0.5"
},
"license": "GPL-2.0",
"authors": [
{
"name": "oncletom",
"email": "[email protected]"
}
]
}
119 changes: 119 additions & 0 deletions inc/plugins/wp-less/doc/API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# API

## Processing Workflow

This is part of the [WordPress Action Refererence](http://codex.wordpress.org/Plugin_API/Action_Reference).

1. `wp-less_compiler_construct_pre` WP-LESS action
1. `wp-less_compiler_construct` WP-LESS filter
1. `wp-less_init` WP-LESS action
1. …
1. `plugin_loaded` WordPress action
1. `after_setup_theme` WordPress action
1. `init` WordPress action
1. …
1. `wp` WordPress event
1. …
1. `wp_head` WordPress action
1. `wp-less_plugin_process_stylesheets` WP-LESS action during `wp_enqueue_scripts`
1. Then, for each stylesheet:
1. `wp-less_stylesheet_construct` WP-LESS action
1. `wp-less_stylesheet_compute_target_path` WP-LESS filter
1. `wp-less_stylesheet_save_pre` WP-LESS action (if it has to compile)
1. `wp-less_stylesheet_save` WP-LESS filter (it it has to compile)
1. `wp-less_stylesheet_save_post` WP-LESS action (it it has to compile)
1. …
1. `wp_print_styles` WordPress action

This workflow means if you have to alter some configuration values, it has to be done before `wp` priority 999.

It also means if you register stylesheets **after** `wp` action, they won’t be handled by the plugin.

## Plugin Hooks

## `WPLessPlugin` Class

You can access to the known instance of `WPLessPlugin` at any time by doing the following:

```php
$less = WPLessPlugin::getInstance();

// do stuff with its API like:
$less->addVariable('red', '#f00');
```

### `addVariable`

TBD.

### `setVariables`

TBD.

### `registerFunction`

TBD.

### `unregisterFunction`

TBD.

### `addImportDir`

TBD.

### `setImportDir`

TBD.

### `getImportDir`

TBD.

### `install`

TBD.

### `uninstall`

TBD.

### `processStylesheet`

TBD.

### `processStylesheets`

TBD.

## `WPLessConfiguration` Class

You can access to the known instance of `WPLessConfiguration ` at any time by doing the following:

```php
$config = WPLessPlugin::getInstance()->getConfiguration();

// do stuff with its API like:
$config->setCompilationStrategy('legacy');
$config->getTtl(); // returns 432000 (5 days)
```

### `getConfigurationStrategy`

TBD.

### `alwaysRecompile`

TBD.

### `setConfigurationStrategy`

TBD.

### `getTtl`

TBD.

## Scheduled Tasks

TBD.
102 changes: 102 additions & 0 deletions inc/plugins/wp-less/doc/Advanced-Usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Advanced Usage

This part of the documentation will help you adapting `wp-less` plugin to your very own needs without breaking anything.

## Registering a LESS variable

You can inject [LESS variables](http://leafo.net/lessphp/docs/#variables) before the compilation process. You can then use **dynamic variables** defined upon WordPress settings or your own business logic.

This can be performed with 2 methods of the `WPLessPlugin` class:
* `addVariable($name string, $value string|number)`: sets 1 LESS variable value;
* `setVariables($variables array)`: sets several LESS variables value at one.

```php
// wp-content/themes/your-theme/functions.php

if (class_exists('WPLessPlugin')){
$less = WPLessPlugin::getInstance();

$less->addVariable('myColor', '#666');
// you can now use @myColor in your *.less files

$less->setVariables(array(
'myColor' => '#777',
'minSize' => '18px'
));
// you can now use @minSize in your *.less files
// @myColor value has been updated to #777
}
```

## Registering a LESS function

You can inject [custom LESS functions](http://leafo.net/lessphp/docs/#custom_functions) before the compilation process. You can now package LESS helpers for your theme in a very useable way (even as WordPress plugins).

This can be performed with 1 method of the `WPLessPlugin` class:
* `registerFunction($name string, $callback string)`: binds a PHP callback function to a LESS function.

```php
// wp-content/themes/your-theme/functions.php

if (class_exists('WPLessPlugin')){
$less = WPLessPlugin::getInstance();

function less_generate_random($max = 1000){
return rand(1, $max);
}

$less->registerFunction('random', 'less_generate_random');
// you can now use random() in your *.less files, like
// div.random-size{
// width: less_generate_random(666);
// }
}
```

**Notice**: don't forget the handy [native LESS functions](http://leafo.net/lessphp/docs/#built_in_functions).

## Changing compilation target directory

By default `wp-less` will outputs compiled CSS to your WordPress upload folder (by default: `wp-content/uploads/wp-less`).
It’s done this way because this folder is usually available in *write mode*, even with tricky filesystem permissions.

You can alter the compile path both for filesystem and URIs. It is usefull if you have a CDN for theme assets or if your browser path is different than the filesystem one.

This can be performed with 2 methods of the `WPLessConfiguration` class:
* `setUploadDir($dir string)`: sets the new compile filesystem directory;
* `setUploadUrl($url string)`: sets several LESS variables value at one.

```php
// wp-content/themes/your-theme/functions.php

if (class_exists('WPLessPlugin')){
$lessConfig = WPLessPlugin::getInstance()->getConfiguration();

// compiles in the active theme, in a ‘compiled-css’ subfolder
$lessConfig->setUploadDir(get_stylesheet_directory() . '/compiled-css');
$lessConfig->setUploadUrl(get_stylesheet_directory_uri() . '/compiled-css');
}
```
## Changing the less compiler

By default `wp-less` will use the compiler from the [leafo/lessphp](https://github.com/leafo/lessphp) library. wp-less also ships with the [oyejorge/less.php](https://github.com/oyejorge/less.php) library, which is more up-to-date and contains the ":extend" less language construct (which is needed for the compilation of certain frameworks including the latest Twitter Bootstrap).

__Note__ The `less.php` library does not support registering custom php functions.

If you would like to change the compiler, you can use the `wp_less_compiler` filter. The returned value can be either:
* "lessphp" (Default)
* "less.php"
* Path to a file containing a class named "lessc" (see the less.php [`lessc.inc.php`](https://github.com/oyejorge/less.php/blob/master/lessc.inc.php) for an example of what needs to be defined).

### Example using the less.php library
```php
// wp-content/themes/your-theme/functions.php

if (class_exists('WPLessPlugin')){
function my_theme_wp_less_compiler()
{
return 'less.php';
}
add_filter('wp_less_compiler', 'my_theme_wp_less_compiler');
}
```
Loading