diff --git a/wp-content/plugins/menu-icons/CHANGELOG.md b/wp-content/plugins/menu-icons/CHANGELOG.md index f249106b..254a79ee 100644 --- a/wp-content/plugins/menu-icons/CHANGELOG.md +++ b/wp-content/plugins/menu-icons/CHANGELOG.md @@ -1,5 +1,16 @@ +##### [Version 0.12.8](https://github.com/codeinwp/wp-menu-icons/compare/v0.12.7...v0.12.8) (2021-05-12) - ### v0.12.5 - 2020-08-18 +* Fix issue when the image is not accessible to fetch the width/height metadata. + +##### [Version 0.12.7](https://github.com/codeinwp/wp-menu-icons/compare/v0.12.6...v0.12.7) (2021-05-07) + +Fix PHP fatal error when uploading SVG with the image uploader + +##### [Version 0.12.6](https://github.com/codeinwp/wp-menu-icons/compare/v0.12.5...v0.12.6) (2021-05-05) + +* Adds explicit width/height to icons to prevent layout shifts issues + +### v0.12.5 - 2020-08-18 **Changes:** ### v0.12.4 - 2020-07-13 @@ -46,4 +57,3 @@ **Changes:** * Change ownership to ThemeIsle. * Improves compatibility with various ThemeIsle products. - diff --git a/wp-content/plugins/menu-icons/CONTRIBUTING.md b/wp-content/plugins/menu-icons/CONTRIBUTING.md new file mode 100644 index 00000000..36b5b5b1 --- /dev/null +++ b/wp-content/plugins/menu-icons/CONTRIBUTING.md @@ -0,0 +1,13 @@ +## Releasing + +This repository uses conventional [changelog commit](https://github.com/Codeinwp/conventional-changelog-simple-preset) messages to trigger release + +How to release a new version: + +- Clone the master branch +- Do your changes +- Send a PR to master and merge it using the following subject message + - `release: ` - for patch release + - `release(minor): ` - for minor release + - `release(major): ` - for major release + The release notes will inherit the body of the commit message which triggered the release. For more details check the [simple-preset](https://github.com/Codeinwp/conventional-changelog-simple-preset) that we use. \ No newline at end of file diff --git a/wp-content/plugins/menu-icons/assets/banner-1544x500.jpg b/wp-content/plugins/menu-icons/assets/banner-1544x500.jpg deleted file mode 100644 index 3a10b5c2..00000000 Binary files a/wp-content/plugins/menu-icons/assets/banner-1544x500.jpg and /dev/null differ diff --git a/wp-content/plugins/menu-icons/assets/banner-772x250.jpg b/wp-content/plugins/menu-icons/assets/banner-772x250.jpg deleted file mode 100644 index 3a10b5c2..00000000 Binary files a/wp-content/plugins/menu-icons/assets/banner-772x250.jpg and /dev/null differ diff --git a/wp-content/plugins/menu-icons/assets/screenshot-1.png b/wp-content/plugins/menu-icons/assets/screenshot-1.png deleted file mode 100644 index 94c255d1..00000000 Binary files a/wp-content/plugins/menu-icons/assets/screenshot-1.png and /dev/null differ diff --git a/wp-content/plugins/menu-icons/assets/screenshot-2.png b/wp-content/plugins/menu-icons/assets/screenshot-2.png deleted file mode 100644 index 9e1d6b7f..00000000 Binary files a/wp-content/plugins/menu-icons/assets/screenshot-2.png and /dev/null differ diff --git a/wp-content/plugins/menu-icons/assets/screenshot-3.png b/wp-content/plugins/menu-icons/assets/screenshot-3.png deleted file mode 100644 index 0adbd96c..00000000 Binary files a/wp-content/plugins/menu-icons/assets/screenshot-3.png and /dev/null differ diff --git a/wp-content/plugins/menu-icons/assets/screenshot-4.png b/wp-content/plugins/menu-icons/assets/screenshot-4.png deleted file mode 100644 index e3baa44f..00000000 Binary files a/wp-content/plugins/menu-icons/assets/screenshot-4.png and /dev/null differ diff --git a/wp-content/plugins/menu-icons/assets/screenshot-5.png b/wp-content/plugins/menu-icons/assets/screenshot-5.png deleted file mode 100644 index 2c899acb..00000000 Binary files a/wp-content/plugins/menu-icons/assets/screenshot-5.png and /dev/null differ diff --git a/wp-content/plugins/menu-icons/assets/screenshot-6.png b/wp-content/plugins/menu-icons/assets/screenshot-6.png deleted file mode 100644 index 1dc1760b..00000000 Binary files a/wp-content/plugins/menu-icons/assets/screenshot-6.png and /dev/null differ diff --git a/wp-content/plugins/menu-icons/assets/screenshot-7.png b/wp-content/plugins/menu-icons/assets/screenshot-7.png deleted file mode 100644 index 2e4565dd..00000000 Binary files a/wp-content/plugins/menu-icons/assets/screenshot-7.png and /dev/null differ diff --git a/wp-content/plugins/menu-icons/assets/screenshot-8.png b/wp-content/plugins/menu-icons/assets/screenshot-8.png deleted file mode 100644 index 165b1a17..00000000 Binary files a/wp-content/plugins/menu-icons/assets/screenshot-8.png and /dev/null differ diff --git a/wp-content/plugins/menu-icons/includes/front.php b/wp-content/plugins/menu-icons/includes/front.php index 8667ba2c..39d4da2d 100644 --- a/wp-content/plugins/menu-icons/includes/front.php +++ b/wp-content/plugins/menu-icons/includes/front.php @@ -420,10 +420,45 @@ final class Menu_Icons_Front_End { $classes = sprintf( '%s _svg', self::get_icon_classes( $meta ) ); $style = self::get_icon_style( $meta, array( 'svg_width', 'vertical_align' ) ); + $svg_icon = esc_url( wp_get_attachment_url( $meta['icon'] ) ); + $width = ''; + $height = ''; + if ( 'image/svg+xml' === get_post_mime_type( $meta['icon'] ) ) { + + // Check `WP_Filesystem` function exists OR not. + require_once ABSPATH . '/wp-admin/includes/file.php'; + \WP_Filesystem(); + global $wp_filesystem; + + $svg_icon = get_attached_file( $meta['icon'] ); + $svg_icon_content = $wp_filesystem->get_contents( $svg_icon ); + if ( $svg_icon_content ) { + $xmlget = simplexml_load_string( $svg_icon_content ); + $xmlattributes = $xmlget->attributes(); + $width = (string) $xmlattributes->width; + $width = (int) filter_var( $xmlattributes->width, FILTER_SANITIZE_NUMBER_INT ); + $height = (string) $xmlattributes->height; + $height = (int) filter_var( $xmlattributes->height, FILTER_SANITIZE_NUMBER_INT ); + } + } else { + $attachment_meta = wp_get_attachment_metadata( $meta['icon'] ); + if ( $attachment_meta ) { + $width = isset( $attachment_meta['width'] ) ? $attachment_meta['width'] : $width; + $height = isset( $attachment_meta['height'] ) ? $attachment_meta['height'] : $height; + } + } + if ( ! empty( $width ) ) { + $width = sprintf( ' width="%dpx"', $width ); + } + if ( ! empty( $height ) ) { + $height = sprintf( ' height="%dpx"', $height ); + } return sprintf( - '', + '', esc_url( wp_get_attachment_url( $meta['icon'] ) ), esc_attr( $classes ), + $width, + $height, $style ); } diff --git a/wp-content/plugins/menu-icons/includes/picker.php b/wp-content/plugins/menu-icons/includes/picker.php index a995c1e3..30fde468 100644 --- a/wp-content/plugins/menu-icons/includes/picker.php +++ b/wp-content/plugins/menu-icons/includes/picker.php @@ -186,9 +186,9 @@ final class Menu_Icons_Picker { return; } - if( ! function_exists( 'get_current_screen' ) ) { - return; - } + if ( ! function_exists( 'get_current_screen' ) ) { + return; + } $screen = get_current_screen(); if ( ! $screen instanceof WP_Screen || 'nav-menus' !== $screen->id ) { diff --git a/wp-content/plugins/menu-icons/menu-icons.php b/wp-content/plugins/menu-icons/menu-icons.php index 2a4fed76..8496ac2a 100644 --- a/wp-content/plugins/menu-icons/menu-icons.php +++ b/wp-content/plugins/menu-icons/menu-icons.php @@ -11,7 +11,7 @@ * Plugin name: Menu Icons * Plugin URI: https://github.com/Codeinwp/wp-menu-icons * Description: Spice up your navigation menus with pretty icons, easily. - * Version: 0.12.5 + * Version: 0.12.8 * Author: ThemeIsle * Author URI: https://themeisle.com * License: GPLv2 @@ -27,7 +27,7 @@ */ final class Menu_Icons { - const VERSION = '0.12.5'; + const VERSION = '0.12.8'; /** * Holds plugin data diff --git a/wp-content/plugins/menu-icons/readme.txt b/wp-content/plugins/menu-icons/readme.txt index 11954581..7fa0401b 100644 --- a/wp-content/plugins/menu-icons/readme.txt +++ b/wp-content/plugins/menu-icons/readme.txt @@ -2,7 +2,7 @@ Contributors: codeinwp, themeisle Tags: menu, nav-menu, icons, navigation Requires at least: 4.3 -Tested up to: 5.4 +Tested up to: 5.7 Stable tag: trunk License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -224,31 +224,47 @@ add_filter( 'menu_icons_menu_settings', 'my_menu_icons_menu_settings', 10, 2 ); Read [this blog post](http://kucrut.org/add-custom-image-sizes-right-way/). == Changelog == -= 0.12.5 - 2020-08-18 = + +##### [Version 0.12.8](https://github.com/codeinwp/wp-menu-icons/compare/v0.12.7...v0.12.8) (2021-05-12) + +* Fix issue when the image is not accessible to fetch the width/height metadata. -= 0.12.4 - 2020-07-13 = + +##### [Version 0.12.7](https://github.com/codeinwp/wp-menu-icons/compare/v0.12.6...v0.12.7) (2021-05-07) + +Fix PHP fatal error when uploading SVG with the image uploader + + + + +##### [Version 0.12.6](https://github.com/codeinwp/wp-menu-icons/compare/v0.12.5...v0.12.6) (2021-05-05) + +* Adds explicit width/height to icons to prevent layout shifts issues + + += 0.12.4 - 2020-07-13 = * Fix Font Awesome not loading -= 0.12.3 - 2020-07-13 = += 0.12.3 - 2020-07-13 = * Fixed Menu Icons in Block Editor not working * Fixed CWP links. -= 0.12.2 - 2019-11-15 = += 0.12.2 - 2019-11-15 = -= 0.12.1 - 2019-11-15 = += 0.12.1 - 2019-11-15 = * Improve legacy compatibility -= 0.12.0 - 2019-11-15 = += 0.12.0 - 2019-11-15 = * Fix issues with WordPress 5.3. diff --git a/wp-content/plugins/menu-icons/vendor/autoload.php b/wp-content/plugins/menu-icons/vendor/autoload.php index 5607b84d..a5bed4e0 100644 --- a/wp-content/plugins/menu-icons/vendor/autoload.php +++ b/wp-content/plugins/menu-icons/vendor/autoload.php @@ -2,6 +2,6 @@ // autoload.php @generated by Composer -require_once __DIR__ . '/composer' . '/autoload_real.php'; +require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitabef56b0da707c7e3eaebd0d256cca29::getLoader(); +return ComposerAutoloaderInit45b19aab4a02085424168fe90bd9d9df::getLoader(); diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/assets/screenshot-1.png b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/assets/screenshot-1.png deleted file mode 100644 index 8d70875f..00000000 Binary files a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/assets/screenshot-1.png and /dev/null differ diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/assets/screenshot-2.png b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/assets/screenshot-2.png deleted file mode 100644 index 9aa80110..00000000 Binary files a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/assets/screenshot-2.png and /dev/null differ diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/icon-picker.php b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/icon-picker.php index e414ce8b..8196de94 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/icon-picker.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/icon-picker.php @@ -337,4 +337,6 @@ final class Icon_Picker { $this->is_admin_loaded = true; } } -add_action( 'plugins_loaded', array( 'Icon_Picker', 'instance' ), 7 ); +if ( function_exists( 'add_action' ) ) { + add_action( 'plugins_loaded', array( 'Icon_Picker', 'instance' ), 7 ); +} diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/icon-picker.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/icon-picker.js deleted file mode 100644 index bb74b492..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/icon-picker.js +++ /dev/null @@ -1,101 +0,0 @@ -require( './media/manifest' ); - -( function( $ ) { - var l10n = wp.media.view.l10n.iconPicker, - templates = {}, - frame, selectIcon, removeIcon, getFrame, updateField, updatePreview, $field; - - getFrame = function() { - if ( ! frame ) { - frame = new wp.media.view.MediaFrame.IconPicker(); - - frame.target.on( 'change', updateField ); - } - - return frame; - }; - - updateField = function( model ) { - _.each( model.get( 'inputs' ), function( $input, key ) { - $input.val( model.get( key ) ); - }); - - model.clear({ silent: true }); - $field.trigger( 'ipf:update' ); - }; - - updatePreview = function( e ) { - var $el = $( e.currentTarget ), - $select = $el.find( 'a.ipf-select' ), - $remove = $el.find( 'a.ipf-remove' ), - type = $el.find( 'input.ipf-type' ).val(), - icon = $el.find( 'input.ipf-icon' ).val(), - url = $el.find( 'input.url' ).val(), - template; - - if ( type === '' || icon === '' || ! _.has( iconPicker.types, type ) ) { - $remove.addClass( 'hidden' ); - $select - .removeClass( 'has-icon' ) - .addClass( 'button' ) - .text( l10n.selectIcon ) - .attr( 'title', '' ); - - return; - } - - if ( templates[ type ]) { - template = templates[ type ]; - } else { - template = templates[ type ] = wp.template( 'iconpicker-' + iconPicker.types[ type ].templateId + '-icon' ); - } - - $remove.removeClass( 'hidden' ); - $select - .attr( 'title', l10n.selectIcon ) - .addClass( 'has-icon' ) - .removeClass( 'button' ) - .html( template({ - type: type, - icon: icon, - url: url - }) ); - }; - - selectIcon = function( e ) { - var frame = getFrame(), - model = { inputs: {} }; - - e.preventDefault(); - - $field = $( e.currentTarget ).closest( '.ipf' ); - model.id = $field.attr( 'id' ); - - // Collect input fields and use them as the model's attributes. - $field.find( 'input' ).each( function() { - var $input = $( this ), - key = $input.attr( 'class' ).replace( 'ipf-', '' ), - value = $input.val(); - - model[ key ] = value; - model.inputs[ key ] = $input; - }); - - frame.target.set( model, { silent: true }); - frame.open(); - }; - - removeIcon = function( e ) { - var $el = $( e.currentTarget ).closest( 'div.ipf' ); - - $el.find( 'input' ).val( '' ); - $el.trigger( 'ipf:update' ); - }; - - $( document ) - .on( 'click', 'a.ipf-select', selectIcon ) - .on( 'click', 'a.ipf-remove', removeIcon ) - .on( 'ipf:update', 'div.ipf', updatePreview ); - - $( 'div.ipf' ).trigger( 'ipf:update' ); -}( jQuery ) ); diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/controllers/font.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/controllers/font.js deleted file mode 100644 index 418d3559..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/controllers/font.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * wp.media.controller.IconPickerFont - * - * @class - * @augments wp.media.controller.State - * @augments Backbone.Model - * @mixes wp.media.controller.iconPickerMixin - */ -var IconPickerFont = wp.media.controller.State.extend( _.extend({}, wp.media.controller.iconPickerMixin, { - defaults: { - multiple: false, - menu: 'default', - toolbar: 'select', - baseType: 'font' - }, - - initialize: function() { - var data = this.get( 'data' ); - - this.set( 'groups', new Backbone.Collection( data.groups ) ); - this.set( 'library', new wp.media.model.IconPickerFonts( data.items ) ); - this.set( 'selection', new wp.media.model.Selection( null, { - multiple: this.get( 'multiple' ) - }) ); - }, - - activate: function() { - this.frame.on( 'open', this.updateSelection, this ); - this.resetFilter(); - this.updateSelection(); - }, - - deactivate: function() { - this.frame.off( 'open', this.updateSelection, this ); - }, - - resetFilter: function() { - this.get( 'library' ).props.set( 'group', 'all' ); - }, - - updateSelection: function() { - var selection = this.get( 'selection' ), - library = this.get( 'library' ), - target = this.frame.target, - icon = target.get( 'icon' ), - type = target.get( 'type' ), - selected; - - if ( this.id === type ) { - selected = library.findWhere({ id: icon }); - } - - selection.reset( selected ? selected : null ); - }, - - getContentView: function() { - return new wp.media.view.IconPickerFontBrowser( _.extend({ - controller: this.frame, - model: this, - groups: this.get( 'groups' ), - collection: this.get( 'library' ), - selection: this.get( 'selection' ), - baseType: this.get( 'baseType' ), - type: this.get( 'id' ) - }, this.ipGetSidebarOptions() ) ); - } -}) ); - -module.exports = IconPickerFont; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/controllers/img.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/controllers/img.js deleted file mode 100644 index 20ba81d1..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/controllers/img.js +++ /dev/null @@ -1,148 +0,0 @@ -var Library = wp.media.controller.Library, - l10n = wp.media.view.l10n, - models = wp.media.model, - views = wp.media.view, - IconPickerImg; - -/** - * wp.media.controller.IconPickerImg - * - * @augments wp.media.controller.Library - * @augments wp.media.controller.State - * @augments Backbone.Model - * @mixes media.selectionSync - * @mixes wp.media.controller.iconPickerMixin - */ -IconPickerImg = Library.extend( _.extend({}, wp.media.controller.iconPickerMixin, { - defaults: _.defaults({ - id: 'image', - baseType: 'image', - syncSelection: false - }, Library.prototype.defaults ), - - initialize: function( options ) { - var selection = this.get( 'selection' ); - - this.options = options; - - this.set( 'library', wp.media.query({ type: options.data.mimeTypes }) ); - - this.routers = { - upload: { - text: l10n.uploadFilesTitle, - priority: 20 - }, - browse: { - text: l10n.mediaLibraryTitle, - priority: 40 - } - }; - - if ( ! ( selection instanceof models.Selection ) ) { - this.set( 'selection', new models.Selection( selection, { - multiple: false - }) ); - } - - Library.prototype.initialize.apply( this, arguments ); - }, - - activate: function() { - Library.prototype.activate.apply( this, arguments ); - this.get( 'library' ).observe( wp.Uploader.queue ); - this.frame.on( 'open', this.updateSelection, this ); - this.updateSelection(); - }, - - deactivate: function() { - Library.prototype.deactivate.apply( this, arguments ); - this.get( 'library' ).unobserve( wp.Uploader.queue ); - this.frame.off( 'open', this.updateSelection, this ); - }, - - getContentView: function( mode ) { - var content = ( mode === 'upload' ) ? this.uploadContent() : this.browseContent(); - - this.frame.$el.removeClass( 'hide-toolbar' ); - - return content; - }, - - /** - * Media library content - * - * @returns {wp.media.view.IconPickerImgBrowser} "Browse" content view. - */ - browseContent: function() { - var options = _.extend({ - model: this, - controller: this.frame, - collection: this.get( 'library' ), - selection: this.get( 'selection' ), - sortable: this.get( 'sortable' ), - search: this.get( 'searchable' ), - filters: this.get( 'filterable' ), - dragInfo: this.get( 'dragInfo' ), - idealColumnWidth: this.get( 'idealColumnWidth' ), - suggestedWidth: this.get( 'suggestedWidth' ), - suggestedHeight: this.get( 'suggestedHeight' ) - }, this.ipGetSidebarOptions() ); - - if ( this.id === 'svg' ) { - options.AttachmentView = views.IconPickerSvgItem; - } - - return new views.IconPickerImgBrowser( options ); - }, - - /** - * Render callback for the content region in the `upload` mode. - * - * @returns {wp.media.view.UploaderInline} "Upload" content view. - */ - uploadContent: function() { - return new wp.media.view.UploaderInline({ - controller: this.frame - }); - }, - - updateSelection: function() { - var selection = this.get( 'selection' ), - target = this.frame.target, - icon = target.get( 'icon' ), - type = target.get( 'type' ), - selected; - - if ( this.id === type ) { - selected = models.Attachment.get( icon ); - this.dfd = selected.fetch(); - } - - selection.reset( selected ? selected : null ); - }, - - /** - * Get image icon URL - * - * @param {object} model - Selected icon model. - * @param {string} size - Image size. - * - * @returns {string} Icon URL. - */ - ipGetIconUrl: function( model, size ) { - var url = model.get( 'url' ), - sizes = model.get( 'sizes' ); - - if ( undefined === size ) { - size = 'thumbnail'; - } - - if ( sizes && sizes[ size ]) { - url = sizes[ size ].url; - } - - return url; - } -}) ); - -module.exports = IconPickerImg; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/controllers/mixin.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/controllers/mixin.js deleted file mode 100644 index 0f5f2b1e..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/controllers/mixin.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Methods for the state - * - * @mixin - */ -var iconPickerMixin = { - - /** - * @returns {object} - */ - ipGetSidebarOptions: function() { - var frameOptions = this.frame.options, - options = {}; - - if ( frameOptions.SidebarView && frameOptions.SidebarView.prototype instanceof wp.media.view.IconPickerSidebar ) { - options.sidebar = true; - options.SidebarView = frameOptions.SidebarView; - } else { - options.sidebar = false; - } - - return options; - }, - - /** - * Get image icon URL - * - * @returns {string} - */ - ipGetIconUrl: function() { - return ''; - } -}; - -module.exports = iconPickerMixin; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/manifest.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/manifest.js deleted file mode 100644 index 8997deb2..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/manifest.js +++ /dev/null @@ -1,16 +0,0 @@ -wp.media.model.IconPickerTarget = require( './models/target.js' ); -wp.media.model.IconPickerFonts = require( './models/fonts.js' ); - -wp.media.controller.iconPickerMixin = require( './controllers/mixin.js' ); -wp.media.controller.IconPickerFont = require( './controllers/font.js' ); -wp.media.controller.IconPickerImg = require( './controllers/img.js' ); - -wp.media.view.IconPickerBrowser = require( './views/browser.js' ); -wp.media.view.IconPickerSidebar = require( './views/sidebar.js' ); -wp.media.view.IconPickerFontItem = require( './views/font-item.js' ); -wp.media.view.IconPickerFontLibrary = require( './views/font-library.js' ); -wp.media.view.IconPickerFontFilter = require( './views/font-filter.js' ); -wp.media.view.IconPickerFontBrowser = require( './views/font-browser.js' ); -wp.media.view.IconPickerImgBrowser = require( './views/img-browser.js' ); -wp.media.view.IconPickerSvgItem = require( './views/svg-item.js' ); -wp.media.view.MediaFrame.IconPicker = require( './views/frame.js' ); diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/models/fonts.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/models/fonts.js deleted file mode 100644 index 8dcd52eb..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/models/fonts.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * wp.media.model.IconPickerFonts - */ -var IconPickerFonts = Backbone.Collection.extend({ - constructor: function() { - Backbone.Collection.prototype.constructor.apply( this, arguments ); - - this.items = new Backbone.Collection( this.models ); - this.props = new Backbone.Model({ - group: 'all', - search: '' - }); - - this.props.on( 'change', this.refresh, this ); - }, - - /** - * Refresh library when props is changed - * - * @param {Backbone.Model} props - */ - refresh: function( props ) { - let items = _.clone( this.items.models ); - - _.each( props.toJSON(), ( value, filter ) => { - const method = this.filters[ filter ]; - - if ( method ) { - items = items.filter( item => { - return method( item, value ); - }); - } - }); - - this.reset( items ); - }, - - filters: { - /** - * @static - * - * @param {Backbone.Model} item Item model. - * @param {string} group Group ID. - * - * @returns {Boolean} - */ - group: function( item, group ) { - return ( group === 'all' || item.get( 'group' ) === group || item.get( 'group' ) === '' ); - }, - - /** - * @static - * - * @param {Backbone.Model} item Item model. - * @param {string} term Search term. - * - * @returns {Boolean} - */ - search: function( item, term ) { - let result; - - if ( term === '' ) { - result = true; - } else { - result = _.any([ 'id', 'name' ], attribute => { - const value = item.get( attribute ); - - return value && value.search( term ) >= 0; - }, term ); - } - - return result; - } - } -}); - -module.exports = IconPickerFonts; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/models/target.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/models/target.js deleted file mode 100644 index 3d552948..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/models/target.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * wp.media.model.IconPickerTarget - * - * A target where the picked icon should be sent to - * - * @augments Backbone.Model - */ -var IconPickerTarget = Backbone.Model.extend({ - defaults: { - type: '', - group: 'all', - icon: '', - url: '', - sizes: [] - } -}); - -module.exports = IconPickerTarget; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/browser.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/browser.js deleted file mode 100644 index 4383d0ab..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/browser.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Methods for the browser views - */ -var IconPickerBrowser = { - createSidebar: function() { - this.sidebar = new this.options.SidebarView({ - controller: this.controller, - selection: this.options.selection - }); - - this.views.add( this.sidebar ); - } -}; - -module.exports = IconPickerBrowser; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-browser.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-browser.js deleted file mode 100644 index c1f6a987..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-browser.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * wp.media.view.IconPickerFontBrowser - */ -var IconPickerFontBrowser = wp.media.View.extend( _.extend({ - className: function() { - var className = 'attachments-browser iconpicker-fonts-browser'; - - if ( ! this.options.sidebar ) { - className += ' hide-sidebar'; - } - - return className; - }, - - initialize: function() { - this.groups = this.options.groups; - - this.createToolbar(); - this.createLibrary(); - - if ( this.options.sidebar ) { - this.createSidebar(); - } - }, - - createLibrary: function() { - this.items = new wp.media.view.IconPickerFontLibrary({ - controller: this.controller, - collection: this.collection, - selection: this.options.selection, - baseType: this.options.baseType, - type: this.options.type - }); - - // Add keydown listener to the instance of the library view - - this.views.add( this.items ); - }, - - createToolbar: function() { - this.toolbar = new wp.media.view.Toolbar({ - controller: this.controller - }); - - this.views.add( this.toolbar ); - - // Dropdown filter - this.toolbar.set( 'filters', new wp.media.view.IconPickerFontFilter({ - controller: this.controller, - model: this.collection.props, - priority: - 80 - }).render() ); - - // Search field - this.toolbar.set( 'search', new wp.media.view.Search({ - controller: this.controller, - model: this.collection.props, - priority: 60 - }).render() ); - } -}, wp.media.view.IconPickerBrowser ) ); - -module.exports = IconPickerFontBrowser; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-filter.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-filter.js deleted file mode 100644 index cd3f322b..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-filter.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * wp.media.view.IconPickerFontFilter - */ -var IconPickerFontFilter = wp.media.view.AttachmentFilters.extend({ - createFilters: function() { - var groups = this.controller.state().get( 'groups' ), - filters = {}; - - filters.all = { - text: wp.media.view.l10n.iconPicker.allFilter, - props: { group: 'all' } - }; - - groups.each( function( group ) { - filters[ group.id ] = { - text: group.get( 'name' ), - props: { group: group.id } - }; - }); - - this.filters = filters; - }, - - change: function() { - var filter = this.filters[ this.el.value ]; - - if ( filter ) { - this.model.set( 'group', filter.props.group ); - } - } -}); - -module.exports = IconPickerFontFilter; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-item.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-item.js deleted file mode 100644 index 8688cd95..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-item.js +++ /dev/null @@ -1,30 +0,0 @@ -var Attachment = wp.media.view.Attachment.Library, - IconPickerFontItem; - -/** - * wp.media.view.IconPickerFontItem - */ -IconPickerFontItem = Attachment.extend({ - className: 'attachment iconpicker-item', - - initialize: function() { - this.template = wp.media.template( 'iconpicker-' + this.options.baseType + '-item' ); - Attachment.prototype.initialize.apply( this, arguments ); - }, - - render: function() { - var options = _.defaults( this.model.toJSON(), { - baseType: this.options.baseType, - type: this.options.type - }); - - this.views.detach(); - this.$el.html( this.template( options ) ); - this.updateSelect(); - this.views.render(); - - return this; - } -}); - -module.exports = IconPickerFontItem; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-library.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-library.js deleted file mode 100644 index c8c79f6d..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/font-library.js +++ /dev/null @@ -1,100 +0,0 @@ -var $ = jQuery, - Attachments = wp.media.view.Attachments, - IconPickerFontLibrary; - -/** - * wp.media.view.IconPickerFontLibrary - */ -IconPickerFontLibrary = Attachments.extend({ - className: 'attachments iconpicker-items clearfix', - - initialize: function() { - Attachments.prototype.initialize.apply( this, arguments ); - - _.bindAll( this, 'scrollToSelected' ); - _.defer( this.scrollToSelected, this ); - this.controller.on( 'open', this.scrollToSelected, this ); - $( this.options.scrollElement ).off( 'scroll', this.scroll ); - }, - - _addItem: function( model ) { - this.views.add( this.createAttachmentView( model ), { - at: this.collection.indexOf( model ) - }); - }, - - _removeItem: function( model ) { - var view = this._viewsByCid[ model.cid ]; - delete this._viewsByCid[ model.cid ]; - - if ( view ) { - view.remove(); - } - }, - - render: function() { - _.each( this._viewsByCid, this._removeItem, this ); - this.collection.each( this._addItem, this ); - - return this; - }, - - createAttachmentView: function( model ) { - var view = new wp.media.view.IconPickerFontItem({ - controller: this.controller, - model: model, - collection: this.collection, - selection: this.options.selection, - baseType: this.options.baseType, - type: this.options.type - }); - - return this._viewsByCid[ view.cid ] = view; - }, - - /** - * Scroll to selected item - */ - scrollToSelected: function() { - var selected = this.options.selection.single(), - singleView, distance; - - if ( ! selected ) { - return; - } - - singleView = this.getView( selected ); - - if ( singleView && ! this.isInView( singleView.$el ) ) { - distance = ( - singleView.$el.offset().top - - parseInt( singleView.$el.css( 'paddingTop' ), 10 ) - - this.$el.offset().top + - this.$el.scrollTop() - - parseInt( this.$el.css( 'paddingTop' ), 10 ) - ); - - this.$el.scrollTop( distance ); - } - }, - - getView: function( model ) { - return _.findWhere( this._viewsByCid, { model: model }); - }, - - isInView: function( $elem ) { - var docViewTop = this.$window.scrollTop(), - docViewBottom = docViewTop + this.$window.height(), - elemTop = $elem.offset().top, - elemBottom = elemTop + $elem.height(); - - return ( ( elemBottom <= docViewBottom ) && ( elemTop >= docViewTop ) ); - }, - - prepare: function() {}, - ready: function() {}, - initSortable: function() {}, - scroll: function() {} -}); - -module.exports = IconPickerFontLibrary; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/frame.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/frame.js deleted file mode 100644 index 900c9148..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/frame.js +++ /dev/null @@ -1,118 +0,0 @@ -/** - * wp.media.view.MediaFrame.IconPicker - * - * A frame for selecting an icon. - * - * @class - * @augments wp.media.view.MediaFrame.Select - * @augments wp.media.view.MediaFrame - * @augments wp.media.view.Frame - * @augments wp.media.View - * @augments wp.Backbone.View - * @augments Backbone.View - * @mixes wp.media.controller.StateMachine - */ - -var l10n = wp.media.view.l10n, - Select = wp.media.view.MediaFrame.Select, - IconPicker; - -IconPicker = Select.extend({ - initialize: function() { - _.defaults( this.options, { - title: l10n.iconPicker.frameTitle, - multiple: false, - ipTypes: iconPicker.types, - target: null, - SidebarView: null - }); - - if ( this.options.target instanceof wp.media.model.IconPickerTarget ) { - this.target = this.options.target; - } else { - this.target = new wp.media.model.IconPickerTarget(); - } - - Select.prototype.initialize.apply( this, arguments ); - }, - - createStates: function() { - var Controller; - - _.each( this.options.ipTypes, function( props ) { - if ( ! wp.media.controller.hasOwnProperty( 'IconPicker' + props.controller ) ) { - return; - } - - Controller = wp.media.controller[ 'IconPicker' + props.controller ]; - - this.states.add( new Controller({ - id: props.id, - content: props.id, - title: props.name, - data: props.data - }) ); - }, this ); - }, - - /** - * Bind region mode event callbacks. - */ - bindHandlers: function() { - this.on( 'router:create:browse', this.createRouter, this ); - this.on( 'router:render:browse', this.browseRouter, this ); - this.on( 'content:render', this.ipRenderContent, this ); - this.on( 'toolbar:create:select', this.createSelectToolbar, this ); - this.on( 'open', this._ipSetState, this ); - this.on( 'select', this._ipUpdateTarget, this ); - }, - - /** - * Set state based on the target's icon type - */ - _ipSetState: function() { - var stateId = this.target.get( 'type' ); - - if ( ! stateId || ! this.states.findWhere({ id: stateId }) ) { - stateId = this.states.at( 0 ).id; - } - - this.setState( stateId ); - }, - - /** - * Update target's attributes after selecting an icon - */ - _ipUpdateTarget: function() { - var state = this.state(), - selected = state.get( 'selection' ).single(), - props; - - props = { - type: state.id, - icon: selected.get( 'id' ), - sizes: selected.get( 'sizes' ), - url: state.ipGetIconUrl( selected ) - }; - - this.target.set( props ); - }, - - browseRouter: function( routerView ) { - var routers = this.state().routers; - - if ( routers ) { - routerView.set( routers ); - } - }, - - ipRenderContent: function() { - var state = this.state(), - mode = this.content.mode(), - content = state.getContentView( mode ); - - this.content.set( content ); - } -}); - -module.exports = IconPicker; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/img-browser.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/img-browser.js deleted file mode 100644 index 51d880e4..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/img-browser.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * wp.media.view.IconPickerImgBrowser - */ -var IconPickerImgBrowser = wp.media.view.AttachmentsBrowser.extend( wp.media.view.IconPickerBrowser ); - -module.exports = IconPickerImgBrowser; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/sidebar.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/sidebar.js deleted file mode 100644 index 91396d1a..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/sidebar.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * wp.media.view.IconPickerSidebar - */ -var IconPickerSidebar = wp.media.view.Sidebar.extend({ - initialize: function() { - var selection = this.options.selection; - - wp.media.view.Sidebar.prototype.initialize.apply( this, arguments ); - - selection.on( 'selection:single', this.createSingle, this ); - selection.on( 'selection:unsingle', this.disposeSingle, this ); - - if ( selection.single() ) { - this.createSingle(); - } - }, - - /** - * @abstract - */ - createSingle: function() {}, - - /** - * @abstract - */ - disposeSingle: function() {} -}); - -module.exports = IconPickerSidebar; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/svg-item.js b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/svg-item.js deleted file mode 100644 index 77915f8d..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/src/media/views/svg-item.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * wp.media.view.IconPickerSvgItem - */ -var IconPickerSvgItem = wp.media.view.Attachment.Library.extend({ - template: wp.template( 'iconpicker-svg-item' ) -}); - -module.exports = IconPickerSvgItem; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/phpcs.ruleset.xml b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/phpcs.ruleset.xml deleted file mode 100644 index 4b6499ad..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/phpcs.ruleset.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - */node_modules/* - */vendor/* - - - - - - - - - - - diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/readme.md b/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/readme.md deleted file mode 100644 index 1d8520ed..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/readme.md +++ /dev/null @@ -1,85 +0,0 @@ - -# Icon Picker - -Pick an icon of your choice. - -**Contributors:** [kucrut](https://profiles.wordpress.org/kucrut) -**Tags:** [icons](https://wordpress.org/plugins/tags/icons), [image](https://wordpress.org/plugins/tags/image), [svg](https://wordpress.org/plugins/tags/svg) -**Requires at least:** 4.3 -**Tested up to:** 4.7.2 -**Stable tag:** 0.5.0 -**License:** [GPLv2](http://www.gnu.org/licenses/gpl-2.0.html) -**Donate Link:** http://kucrut.org/#coffee - -[![Build Status](https://travis-ci.org/kucrut/wp-icon-picker.svg?branch=master)](https://travis-ci.org/kucrut/wp-icon-picker) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](http://gruntjs.com) - -## Description ## - -An icon picker library plugin. - -## Screenshots ## - -### Icon selector - -![Icon selector](assets/screenshot-1.png) - -### Icon fields in a post meta box using [CMB](https://github.com/humanmade/Custom-Meta-Boxes/) - -![Icon fields in a post meta box using [CMB](https://github.com/humanmade/Custom-Meta-Boxes/)](assets/screenshot-2.png) - -## Frequently Asked Questions ## - -### How do I use css file from CDN? ### -You can use the `icon_picker_icon_type_stylesheet_uri` filter, eg: -```php -/** - * Load Font Awesome's CSS from CDN - * - * @param string $stylesheet_uri Icon type's stylesheet URI. - * @param string $icon_type_id Icon type's ID. - * @param Icon_Picker_Type_Font $icon_type Icon type's instance. - * - * @return string - */ -function myprefix_font_awesome_css_from_cdn( $stylesheet_uri, $icon_type_id, $icon_type ) { - if ( 'fa' === $icon_type_id ) { - $stylesheet_uri = sprintf( - 'https://maxcdn.bootstrapcdn.com/font-awesome/%s/css/font-awesome.min.css', - $icon_type->version - ); - } - - return $stylesheet_uri; -} -add_filter( 'icon_picker_icon_type_stylesheet_uri', 'myprefix_font_awesome_css_from_cdn', 10, 3 ); -``` - - -## Changelog ## - -### 0.5.0 ### -* Update Font Awesome to 4.7.0. -* Switch to Webpack. -* Various [bug fixes and enhancements](https://github.com/kucrut/wp-icon-picker/issues?q=is%3Aissue+milestone%3A0.5.0+is%3Aclosed). - -### 0.4.1 ### -* Improve support for CMB: Make the field usable in a repeatable field. - -### 0.4.0 ### -* Introduce `icon_picker_icon_type_stylesheet_uri` filter hook. -* Font Awesome 4.6.1 - -### 0.3.0 ### -* Fix CSS classname conflicts. - -### 0.2.0 ### -* Introduce `icon_picker_field()`. -* Add support for [CMB](https://github.com/humanmade/Custom-Meta-Boxes/). - -### 0.1.1 ### -* Load translation, props [Eduardo Larequi](https://wordpress.org/support/profile/elarequi). - -### 0.1.0 ### -* Initial - - diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/menu-item-custom-fields/menu-item-custom-fields.php b/wp-content/plugins/menu-icons/vendor/codeinwp/menu-item-custom-fields/menu-item-custom-fields.php index 29ff5401..8a51fbae 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/menu-item-custom-fields/menu-item-custom-fields.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/menu-item-custom-fields/menu-item-custom-fields.php @@ -17,7 +17,7 @@ * Text Domain: menu-item-custom-fields */ -if ( ! class_exists( 'Menu_Item_Custom_Fields' ) && ! version_compare( get_bloginfo( 'version' ), '5.4', '>=' ) ) : +if ( ! class_exists( 'Menu_Item_Custom_Fields' ) && ( function_exists('get_bloginfo') && ! version_compare( get_bloginfo( 'version' ), '5.4', '>=' ) ) ) : /** * Menu Item Custom Fields Loader */ diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/menu-item-custom-fields/phpcs.ruleset.xml b/wp-content/plugins/menu-icons/vendor/codeinwp/menu-item-custom-fields/phpcs.ruleset.xml deleted file mode 100644 index 197518ba..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/menu-item-custom-fields/phpcs.ruleset.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - */node_modules/* - */vendor/* - - - - - - - - - - - - diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/menu-item-custom-fields/readme.md b/wp-content/plugins/menu-icons/vendor/codeinwp/menu-item-custom-fields/readme.md deleted file mode 100644 index d2d6e7ce..00000000 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/menu-item-custom-fields/readme.md +++ /dev/null @@ -1,66 +0,0 @@ - -# Menu Item Custom Fields - -Easily add custom fields to nav menu items. - -**Contributors:** [kucrut](https://profiles.wordpress.org/kucrut) -**Tags:** [menu](https://wordpress.org/plugins/tags/menu), [nav-menu](https://wordpress.org/plugins/tags/nav-menu), [custom-fields](https://wordpress.org/plugins/tags/custom-fields), [metadata](https://wordpress.org/plugins/tags/metadata) -**Requires at least:** 3.8 -**Tested up to:** 4.7.2 -**Stable tag:** 1.0.0 -**License:** [GPLv2](http://www.gnu.org/licenses/gpl-2.0.html) -**Donate Link:** https://www.paypal.me/kucrut - -[![Build Status](https://travis-ci.org/kucrut/wp-menu-item-custom-fields.svg?branch=master)](https://travis-ci.org/kucrut/wp-menu-item-custom-fields) - -## Description ## - -### Breaking Change ### -Since version `1.0.0`, the first parameter passed to the `wp_nav_menu_item_custom_fields` is the menu item ID, instead of the nav menu ID. This should not have a big impact, since the nav menu ID passed was always `0` (not used by core). - -This is a *library* plugin. It doesn't do anything visible on its own. It was written to allow other plugins/themes to add custom fields to menu items *easily*. See **Installation**. - -Development of this plugin is done on [GitHub](https://github.com/kucrut/wp-menu-item-custom-fields). **Pull requests welcome**. Please see [issues reported](https://github.com/kucrut/wp-menu-item-custom-fields/issues) there before going to the plugin forum. - - -## Installation ## - -### As regular plugin ### -1. Upload `menu-item-custom-fields` to the `/wp-content/plugins/` directory -1. Activate the plugin through the 'Plugins' menu in WordPress - -### As library in your plugin/theme ### -Simply copy `menu-item-custom-fields` to your plugin directory and require the main plugin file, eg: -` -require_once dirname( __FILE__ ) . '/menu-item-custom-fields/menu-item-custom-fields.php'; -` - -### Usage ### -Copy (and customize) and include the `menu-item-custom-fields-example.php` file found in the `doc/` directory of this plugin into your plugin/theme. - - -## Changelog ## - -### 1.0.0 ### -* Pass correct parameters to the `wp_nav_menu_item_custom_fields` hook, props [@helgatheviking](https://github.com/helgatheviking). - -### 0.4.0 ### -* Support WordPress 4.7, props [rahulnever2far](https://github.com/rahulnever2far). - -### 0.3.0 ### -* Use `wp_nav_menu_item_custom_fields` as walker hook. See this [blog post](http://shazdeh.me/2014/06/25/custom-fields-nav-menu-items/). -* Update example plugin - -### 0.2.1 ### -* Update compatibility info - -### 0.2.0 ### -* Improve walker class loader - -### 0.1.1 ### -* Move custom fields up (before ``) - -### 0.1.0 ### -* Initial public release - - diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/CHANGELOG.md b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/CHANGELOG.md index 4d674517..44cc82ae 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/CHANGELOG.md +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/CHANGELOG.md @@ -1,3 +1,25 @@ +##### [Version 3.2.20](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.19...v3.2.20) (2021-03-30) + +add wp-config support + +##### [Version 3.2.19](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.18...v3.2.19) (2021-03-12) + +* Adds compatibility with latest PHPCS coding standards. +* Adds compatibility with core auto-update. + +##### [Version 3.2.18](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.17...v3.2.18) (2021-03-04) + +* Fix regression on rollback order + +##### [Version 3.2.17](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.16...v3.2.17) (2021-03-04) + +* Fix compatibility with PHP 8 due to usort + +##### [Version 3.2.16](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.15...v3.2.16) (2020-11-17) + +* Fix long texts on rollback. +* Fix RTL mode for uninstall feedback. + ##### [Version 3.2.15](https://github.com/Codeinwp/themeisle-sdk/compare/v3.2.14...v3.2.15) (2020-07-23) * remove no redundant module diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/load.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/load.php index 218a28fb..2d02e3d1 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/load.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/load.php @@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) { return; } // Current SDK version and path. -$themeisle_sdk_version = '3.2.15'; +$themeisle_sdk_version = '3.2.20'; $themeisle_sdk_path = dirname( __FILE__ ); global $themeisle_sdk_max_version; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Common/Abstract_module.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Common/Abstract_module.php index d1b0bfac..51ba9cf1 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Common/Abstract_module.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Common/Abstract_module.php @@ -37,14 +37,14 @@ abstract class Abstract_Module { * * @return bool Should load module? */ - public abstract function can_load( $product ); + abstract public function can_load( $product ); /** * Bootstrap the module. * * @param Product $product Product object. */ - public abstract function load( $product ); + abstract public function load( $product ); /** * Check if the product is from partner. @@ -63,4 +63,21 @@ abstract class Abstract_Module { return array_key_exists( $product->get_slug(), Module_Factory::$slugs ); } + + /** + * Wrapper for wp_remote_get on VIP environments. + * + * @param string $url Url to check. + * @param array $args Option params. + * + * @return array|\WP_Error + */ + public function safe_get( $url, $args = array() ) { + return function_exists( 'vip_safe_wp_remote_get' ) + ? vip_safe_wp_remote_get( $url ) + : wp_remote_get( //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get, Already used. + $url, + $args + ); + } } diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Common/Module_factory.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Common/Module_factory.php index d41e80f1..29313e9f 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Common/Module_factory.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Common/Module_factory.php @@ -88,7 +88,7 @@ class Module_Factory { * * @var Abstract_Module $module_object Module instance. */ - $module_object = new $class( $product ); + $module_object = new $class( $product ); if ( ! $module_object->can_load( $product ) ) { continue; diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php index 9b778204..efca2719 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php @@ -96,7 +96,7 @@ class Dashboard_Widget extends Abstract_Module { * * @return string|void */ - function add_widget() { + public function add_widget() { global $wp_meta_boxes; if ( isset( $wp_meta_boxes['dashboard']['normal']['core']['themeisle'] ) ) { return; @@ -114,7 +114,7 @@ class Dashboard_Widget extends Abstract_Module { /** * Render widget content */ - function render_dashboard_widget() { + public function render_dashboard_widget() { $this->setup_feeds(); if ( empty( $this->items ) || ! is_array( $this->items ) ) { return; @@ -220,19 +220,21 @@ class Dashboard_Widget extends Abstract_Module {
  • + class="ti-dw-day-container">
  • feeds ); // TODO report error when is an error loading the feed. @@ -353,7 +357,7 @@ class Dashboard_Widget extends Abstract_Module { /** * Contact the API and fetch the recommended plugins/themes */ - function recommend_plugin_or_theme() { + public function recommend_plugin_or_theme() { $products = $this->get_product_from_api(); if ( ! is_array( $products ) ) { $products = array(); @@ -374,8 +378,8 @@ class Dashboard_Widget extends Abstract_Module { * * @return array|mixed The list of products to use in recomended section. */ - function get_product_from_api() { - if ( false === ( $products = get_transient( 'themeisle_sdk_products' ) ) ) { + public function get_product_from_api() { + if ( false === ( $products = get_transient( 'themeisle_sdk_products' ) ) ) { //phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure $products = array(); $all_themes = $this->get_themes_from_wporg( 'themeisle' ); $all_plugins = $this->get_plugins_from_wporg( 'themeisle' ); @@ -429,8 +433,8 @@ class Dashboard_Widget extends Abstract_Module { * * @return array The list of themes. */ - function get_themes_from_wporg( $author ) { - $products = wp_remote_get( + public function get_themes_from_wporg( $author ) { + $products = $this->safe_get( 'https://api.wordpress.org/themes/info/1.1/?action=query_themes&request[author]=' . $author . '&request[per_page]=30&request[fields][active_installs]=true' ); $products = json_decode( wp_remote_retrieve_body( $products ) ); @@ -450,8 +454,8 @@ class Dashboard_Widget extends Abstract_Module { * * @return array The list of plugins for the selected author. */ - function get_plugins_from_wporg( $author ) { - $products = wp_remote_get( + public function get_plugins_from_wporg( $author ) { + $products = $this->safe_get( 'https://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[author]=' . $author . '&request[per_page]=40&request[fields][active_installs]=true' ); $products = json_decode( wp_remote_retrieve_body( $products ) ); diff --git a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php index 5ec8d964..f24bd2cb 100644 --- a/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php +++ b/wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Licenser.php @@ -62,6 +62,12 @@ class Licenser extends Abstract_Module { * @var null Local license object. */ private $license_local = null; + /** + * Product namespace, used for fixed name filters/cli commands. + * + * @var string $namespace Product namespace. + */ + private $namespace = null; /** * Disable wporg updates for premium products. @@ -71,7 +77,7 @@ class Licenser extends Abstract_Module { * * @return mixed List of themes to check for update. */ - function disable_wporg_update( $r, $url ) { + public function disable_wporg_update( $r, $url ) { if ( 0 !== strpos( $url, 'https://api.wordpress.org/themes/update-check/' ) ) { return $r; @@ -83,7 +89,7 @@ class Licenser extends Abstract_Module { unset( $themes->themes->{$this->product->get_slug()} ); // Encode the updated JSON response. - $r['body']['themes'] = json_encode( $themes ); + $r['body']['themes'] = wp_json_encode( $themes ); return $r; } @@ -172,18 +178,18 @@ class Licenser extends Abstract_Module { %s%s   

    %s

    %s', - ( ( 'valid' === $status ) ? sprintf( '', $value, $this->product->get_key() ) : '' ), + ( ( 'valid' === $status ) ? sprintf( '', esc_attr( $value ), esc_attr( $this->product->get_key() ) ) : '' ), ( ( 'valid' === $status ) ? 'themeisle-sdk-text-input-valid' : '' ), - $this->product->get_key(), - ( ( 'valid' === $status ) ? $this->product->get_key() . '_mask' : $this->product->get_key() ), - ( ( 'valid' === $status ) ? ( str_repeat( '*', 30 ) . substr( $value, - 5 ) ) : $value ), - ( 'valid' === $status ? 'themeisle-sdk-license-deactivate-cta' : 'themeisle-sdk-license-activate-cta' ), - ( 'valid' === $status ? $valid_string : $invalid_string ), - $this->product->get_key(), - ( 'valid' === $status ? $deactivate_string : $activate_string ), - sprintf( $license_message, '' . $this->get_distributor_name() . ' ', $this->product->get_type() ), - empty( $error_message ) ? '' : sprintf( '

    %s

    ', $error_message ) - ); + esc_attr( $this->product->get_key() ), + esc_attr( ( ( 'valid' === $status ) ? $this->product->get_key() . '_mask' : $this->product->get_key() ) ), + esc_attr( ( ( 'valid' === $status ) ? ( str_repeat( '*', 30 ) . substr( $value, - 5 ) ) : $value ) ), + esc_attr( ( 'valid' === $status ? 'themeisle-sdk-license-deactivate-cta' : 'themeisle-sdk-license-activate-cta' ) ), + esc_attr( 'valid' === $status ? $valid_string : $invalid_string ), + esc_attr( $this->product->get_key() ), + esc_attr( 'valid' === $status ? $deactivate_string : $activate_string ), + sprintf( wp_kses_data( $license_message ), '' . esc_attr( $this->get_distributor_name() ) . ' ', esc_attr( $this->product->get_type() ) ), + wp_kses_data( empty( $error_message ) ? '' : sprintf( '

    %s

    ', ( $error_message ) ) ) + ) . wp_nonce_field( $this->product->get_key() . 'nonce', $this->product->get_key() . 'nonce_field', false, false );//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } @@ -210,17 +216,12 @@ class Licenser extends Abstract_Module { } /** - * License price id. + * Return the last error message. * - * @return int License plan. + * @return mixed Error message. */ - public function get_plan() { - $license_data = get_option( $this->product->get_key() . '_license_data', '' ); - if ( ! isset( $license_data->price_id ) ) { - return -1; - } - - return (int) $license_data->price_id; + public function get_error() { + return get_transient( $this->product->get_key() . 'act_err' ); } /** @@ -249,12 +250,26 @@ class Licenser extends Abstract_Module { return $this->product->get_store_name(); } + /** + * License price id. + * + * @return int License plan. + */ + public function get_plan() { + $license_data = get_option( $this->product->get_key() . '_license_data', '' ); + if ( ! isset( $license_data->price_id ) ) { + return - 1; + } + + return (int) $license_data->price_id; + } + /** * Show the admin notice regarding the license status. * * @return bool Should we show the notice ? */ - function show_notice() { + public function show_notice() { if ( ! is_admin() ) { return false; } @@ -274,10 +289,10 @@ class Licenser extends Abstract_Module {

    product->get_name(), - $this->product->get_name(), - '' . $this->get_distributor_name() . '' + wp_kses_data( $no_activations_string ), + esc_attr( $this->product->get_name() ), + esc_attr( $this->product->get_name() ), + '' . esc_attr( $this->get_distributor_name() ) . '' ); ?> @@ -292,7 +307,7 @@ class Licenser extends Abstract_Module { ?>

    - product->get_name() . ' ' . $this->product->get_type(), $this->get_api_url() . '?license=' . $this->license_key ); ?> + product->get_name() . ' ' . $this->product->get_type() ), esc_url( $this->get_api_url() . '?license=' . $this->license_key ) ); ?>

    - product->get_name() . ' ' . $this->product->get_type(), $this->get_api_url(), admin_url( 'options-general.php' ) . '#' . $this->product->get_key() . '_license' ); ?> + product->get_name() . ' ' . $this->product->get_type() ), esc_url( $this->get_api_url() ), esc_url( admin_url( 'options-general.php' ) . '#' . $this->product->get_key() . '_license' ) ); ?>

    product->get_key() . '_license_data', '' ); if ( '' === $license_data ) { return false; @@ -355,7 +370,7 @@ class Licenser extends Abstract_Module { * * @return string The renew url. */ - function renew_url() { + public function renew_url() { $license_data = get_option( $this->product->get_key() . '_license_data', '' ); if ( '' === $license_data ) { return $this->get_api_url(); @@ -371,7 +386,7 @@ class Licenser extends Abstract_Module { * Run the license check call. */ public function product_valid() { - if ( false !== ( $license = get_transient( $this->product->get_key() . '_license_data' ) ) ) { + if ( false !== ( $license = get_transient( $this->product->get_key() . '_license_data' ) ) ) { //phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure return; } $license = $this->check_license(); @@ -423,42 +438,6 @@ class Licenser extends Abstract_Module { } - /** - * Increment the failed checks. - */ - private function increment_failed_checks() { - $this->failed_checks ++; - update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks ); - } - - /** - * Reset the failed checks - */ - private function reset_failed_checks() { - $this->failed_checks = 1; - update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks ); - } - - /** - * Set license validation error message. - * - * @param string $message Error message. - */ - public function set_error( $message = '' ) { - set_transient( $this->product->get_key() . 'act_err', $message, MINUTE_IN_SECONDS ); - - return; - } - - /** - * Return the last error message. - * - * @return mixed Error message. - */ - public function get_error() { - return get_transient( $this->product->get_key() . 'act_err' ); - } - /** * Do license activation/deactivation. * @@ -486,7 +465,7 @@ class Licenser extends Abstract_Module { // Call the custom API. if ( 'check' === $action ) { - $response = wp_remote_get( sprintf( '%slicense/check/%s/%s/%s/%s', Product::API_URL, rawurlencode( $this->product->get_name() ), $license, rawurlencode( home_url() ), Loader::get_cache_token() ) ); + $response = $this->safe_get( sprintf( '%slicense/check/%s/%s/%s/%s', Product::API_URL, rawurlencode( $this->product->get_name() ), $license, rawurlencode( home_url() ), Loader::get_cache_token() ) ); } else { $response = wp_remote_post( sprintf( '%slicense/%s/%s/%s', Product::API_URL, $action, rawurlencode( $this->product->get_name() ), $license ), @@ -550,15 +529,42 @@ class Licenser extends Abstract_Module { return true; } + /** + * Reset the failed checks + */ + private function reset_failed_checks() { + $this->failed_checks = 1; + update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks ); + } + + /** + * Increment the failed checks. + */ + private function increment_failed_checks() { + $this->failed_checks ++; + update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks ); + } + /** * Activate the license remotely. */ - function process_license() { + public function process_license() { // listen for our activate button to be clicked. if ( ! isset( $_POST[ $this->product->get_key() . '_btn_trigger' ] ) ) { return; } - $license = $_POST[ $this->product->get_key() . '_license' ]; + if ( ! isset( $_POST[ $this->product->get_key() . 'nonce_field' ] ) + || ! wp_verify_nonce( $_POST[ $this->product->get_key() . 'nonce_field' ], $this->product->get_key() . 'nonce' ) //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized + ) { + return; + } + if ( ! current_user_can( 'manage_options' ) ) { + return; + } + $license = isset( $_POST[ $this->product->get_key() . '_license' ] ) + ? sanitize_text_field( $_POST[ $this->product->get_key() . '_license' ] ) + : ''; + $response = $this->do_license_process( $license, 'toggle' ); if ( is_wp_error( $response ) ) { $this->set_error( $response->get_error_message() ); @@ -568,14 +574,22 @@ class Licenser extends Abstract_Module { if ( true === $response ) { $this->set_error( '' ); } + } + + /** + * Set license validation error message. + * + * @param string $message Error message. + */ + public function set_error( $message = '' ) { + set_transient( $this->product->get_key() . 'act_err', $message, MINUTE_IN_SECONDS ); - return; } /** * Load the Themes screen. */ - function load_themes_screen() { + public function load_themes_screen() { add_thickbox(); add_action( 'admin_notices', array( &$this, 'update_nag' ) ); } @@ -583,7 +597,7 @@ class Licenser extends Abstract_Module { /** * Alter the nag for themes update. */ - function update_nag() { + public function update_nag() { $theme = wp_get_theme( $this->product->get_slug() ); $api_response = get_transient( $this->product_key ); if ( false === $api_response || ! isset( $api_response->new_version ) ) { @@ -596,16 +610,16 @@ class Licenser extends Abstract_Module { echo '
    '; printf( '%1$s %2$s is available. Check out what\'s new or update now.', - $theme->get( 'Name' ), - $api_response->new_version, - sprintf( '%s&TB_iframe=true&width=1024&height=800', $this->product->get_changelog() ), - $theme->get( 'Name' ), - $update_url, - $update_onclick + esc_attr( $theme->get( 'Name' ) ), + esc_attr( $api_response->new_version ), + esc_url( sprintf( '%s&TB_iframe=true&width=1024&height=800', $this->product->get_changelog() ) ), + esc_attr( $theme->get( 'Name' ) ), + esc_url( $update_url ), + $update_onclick // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, Already escaped. ); echo '
    '; - echo '