PK!G .gitignorenu[.svn .DS_Store /.idea/PK! TJJ readme.txtnu[=== Image Widget === Contributors: theeventscalendar, aguseo, borkweb, bordoni, brianjessee, leahkoerper, lucatume, neillmcshea, vicskf, zbtirrell Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4BSPTNFFY6AL6 Tags: widget, image, ad, banner, sidebar Requires at least: 3.5 Tested up to: 6.7.1 Stable tag: 4.4.11 A simple image widget that uses the native WordPress media manager to add image widgets to your site. == Description == Image Widget is a simple plugin that uses the native WordPress media manager to add image widgets to your site. = Image Widget Features = * Responsive * MU Compatible * Handles image resizing and alignment * Link the image * Add title and description * Versatile - all fields are optional * Upload, link to external image, or select an image from your media collection * Customize the look & feel with filter hooks or theme overrides = Quality You Can Trust = Image Widget is developed and maintained by [The Events Calendar](https://evnt.is/1aor), the same folks behind [The Events Calendar, Event Tickets, and a full suite of premium plugins](https://evnt.is/19me). This plugin is actively supported by our team and contributions from community members. If you see a question in the forum you can help with or have a great idea and want to code it up or submit a patch, that would be awesome! Not only will we shower you with praise and thanks, it’s also a good way to get to know us and lead into options for paid work if you freelance. = Pull Requests & Translations = [Check us out on GitHub](https://github.com/the-events-calendar/image-widget) to pull request changes. Translations can be submitted [here on WordPress.org](https://translate.wordpress.org/projects/wp-plugins/image-widget). == Installation == = Install = Getting started with Image Widget is a breeze! 1. Download and install the Image Widget plugin 1. From your WordPress admin screen, select Plugins from the menu 1. Activate the Image Widget plugin 1. Go to Appearance > Widget to place the widget in your sidebar in the Design If you run into any questions or have suggestions, please visit the forum to post questions or comments. = Requirements = * PHP 5.2 or above * WordPress 3.5 or above == Screenshots == 1. Image Widget admin screen. 1. Media manager integration. 1. Image Widget on the front of a plain WordPress install. == Frequently Asked Questions == = How do I log into my site to install this plugin? = Visit [the WordPress codex](https://codex.wordpress.org/Login_Trouble) for help with login troubles. = Can I display Image Widget on only one page? = Yes you can, however, this is not controlled through the Image Widget plugin directly - it is usually managed through a page-specific sidebar display. There are several solutions available to accomplish this. A quick search for “WordPress page-specific sidebar display” can help you find the best option for your site. = Is there a demo available? = Though we do not have a demo available, we do have [screenshots available here](https://wordpress.org/plugins/image-widget/screenshots/). = How can I add lightbox, slider, or random image capabilities? = These features are part of our Image Widget Plus plugin. You can learn more about [Image Widget Plus](https://evnt.is/19mh) on our website. = Where do I go to file a bug or ask a question? = Please [visit the forum to post questions or comments](https://wordpress.org/support/plugin/image-widget/). = Found a security vulnerability? = Make sure you are reporting in a safe and responsible way. We take security very seriously. If you discover a security issue, please bring it to our attention right away! Below you will find all the methods to report security vulnerabilities: * [Report security bugs through the Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/image-widget) * Check our [Bug Bounty Program](https://www.liquidweb.com/policies/bug-bounty-program/) * Reach out directly to us on `security [at] stellarwp.com`. == Documentation == The built in template can be overridden by files within your template. = Default vs. Custom Templates = The Image Widget comes with a default template for the widget output. If you would like to alter the widget display code, create a new folder called "image-widget" in your template directory and copy over the "views/widget.php" file. Edit the new file to your hearts content. Please do not edit the one in the plugin folder as that will cause conflicts when you update the plugin to the latest release. New in 3.2: You may now also use the "sp_template_image-widget_widget.php" filter to override the default template behavior for .php template files. Eg: if you wanted widget.php to reside in a folder called my-custom-templates/ and wanted it to be called my-custom-name.php: `add_filter('sp_template_image-widget_widget.php', 'my_template_filter'); function my_template_filter($template) { return get_template_directory() . '/my-custom-templates/my-custom-name.php'; }` = Filters = There are a number of filters in the code that will allow you to override data as you see fit. The best way to learn what filters are available is always by simply searching the code for 'apply_filters'. But all the same, here are a few of the more essential filters: *widget_title* This is actually a pretty typical filter in widgets and is applied to the widget title. *widget_text* Another very typical widget filter that is applied to the description body text. This filter also takes 2 additional arguments for $args and $instance so that you can learn more about the specific widget instance in the process of filtering the content. *image_widget_image_attachment_id* Filters the attachment id of the image. Accepts additional $args and $instance arguments. *image_widget_image_url* Filters the url of the image displayed in the widget. Accepts additional $args and $instance arguments. THIS IS DEPRECATED AND WILL EVENTUALLY BE DELETED *image_widget_image_width* Filters the display width of the image. Accepts additional $args and $instance arguments. *image_widget_image_height* Filters the display height of the image. Accepts additional $args and $instance arguments. *image_widget_image_maxwidth* Filters the inline max-width style of the image. Hint: override this to use this in responsive designs :) Accepts additional $args and $instance arguments. Return null to remove this css from the image output (defaults to '100%'). *image_widget_image_maxheight* Filters the inline max-height style of the image. Accepts additional $args and $instance arguments. Return null to remove this css from the image output (defaults to null) *image_widget_image_size* Filters the selected image 'size' corresponding to WordPress registered sizes. If this is set to 'tribe_image_widget_custom' then the width and height are used instead. Accepts additional $args and $instance arguments. *image_widget_image_align* Filters the display alignment of the image. Accepts additional $args and $instance arguments. *image_widget_image_alt* Filters the alt text of the image. Accepts additional $args and $instance arguments. *image_widget_image_link* Filters the url that the image links to. Accepts additional $args and $instance arguments. *image_widget_image_link_target* Filters the link target of the image link. Accepts additional $args and $instance arguments. *image_widget_image_attributes* Filters a list of image attributes used in the image output. Similar to 'wp_get_attachment_image_attributes' Accepts $instance arguments *image_widget_link_attributes* Filters a list of attributes used in the image link. Similar to 'wp_get_attachment_image_attributes' Accepts $instance arguments = Have You Supported the Image Widget? = If so, then THANK YOU! Also, feel free to add this line to your wp-config.php file to prevent the image widget from displaying a message after upgrades. define( 'I_HAVE_SUPPORTED_THE_IMAGE_WIDGET', true ); For more info on the philosophy here, check out our [blog post](http://tri.be/define-i-have-donated-true/) == Changelog == = [4.4.11] 2024-11-20 = * Security - Prevent old Image URL from being misused for XSS attacks. = [4.4.10] 2022-06-05 = * Fix - Prevent weird bugs around `widget_title` not having all the expected arguments. * Tweak - Add documentation for a few filters. = [4.4.9] 2023-05-30 = * Tweak - Updating WordPress compatibility, tested up to 6.6.2. * Tweak - Remove references to Image Widget Plus and Notices. = [4.4.8] 2022-05-06 = * Tweak - Updating WordPress compatibility. = [4.4.7] 2017-11-02 = * Feature - Added new Link Title field and filter to improve tooltip (previously used alt text) (thanks @marklcm) [89993] * Tweak - Added new `image_widget_option_defaults` hook to improve customizability (props @svandragt) [#91225] = [4.4.6] 2017-09-12 = * New - Added new filter `tribe_image_widget_instance_description` for more control over how the description field is handled. * Fix - Prevent broken HTML in the "description" field that sometimes arose with certain user roles. Props to users @bridgetashley and @JoshRoy spotting this one! = [4.4.5] 2017-06-14 = * Fix issue with image URLs in the widget admin interface [80659] = [4.4.4] 2017-06-01 = * Tweak - Improve upsell notices display logic [78676] = 4.4.3 = * Fix - Fixed bug where selecting an image failed to trigger a Save & Publish in the Customizer (props to dsaric-dev for the fix) * Tweak - Roll-back to sidebar_admin_setup to enqueue resources for optimal plugin compatibility (props to megamenu for the heads up) = 4.4.2 = * Fix - fixed compatibility with WordPress versions prior to 4.4 * Fix - proportional scaling of image within the widget editor * Fix - fix validation by avoiding empty attributes and only specifying sizes with srcset (thanks Zodiak1978) = 4.4.1 = * Fix - fixed some broken links = 4.4 = * Feature - Add srcset and size attribute support (props @philwp) * Tweak - Readme adjustments * Tweak - Additional refinements to notice code. = 4.3.1 = * Tweak - Upgrade admin notice code = 4.3 = * Translations - fixed compatibility with translate.wordpress.org * Translations - restored the pot file for easier community translations * Tweak - fixed a typo * Tweak - Minor code cleanup = 4.2.2 = * Feature - Include registered image sizes in the list of selectable items (props to aaemnnosttv for the pull request!) = 4.2.1 = * Feature - Removing Freemius. Interesting experiment, but ultimately, not our cup of tea. Thanks for sticking with us! = 4.2 = * Security - Prevent direct access to directories (thank you @ramiy) * Translations - Remove po/mo files, migrate to translate.wordpress.org language packs * Feature - Add support for the rel attribute * Feature - Adding an opt-in integration with Freemius = 4.1.2 = * Tweak - Added support for an id attribute on links (Props to amyh for the work on this!) = 4.1.1 = * Tweak - Retiring the use of PHP 4 style constructors = 4.1 = * Remove accidentally deployed image size update. = 4.0.9 = * Fix image stretching bug in admin (Thanks @kyleunzicker) * Add polish translation (thank you @difreo) * Add hebrew translation (thank you Ariel Klikstein) * Add german translation (thank you Daniel Schmidt) * Fix "Alt" text in the widget source to use actual "Alt" text (thanks @adoliver and @Degas) = 4.0.8 = * Responsive support in honor of Josh Broton's WordCamp SF talk about responsive design. max-width now defaults to 100%; = 4.0.7 = * Add Spanish translation (thank you @mzaweb) = 4.0.6 = * Rename all language files and implement a couple more minor language bug fixes a la @understandard * Added support for the constant 'I_HAVE_SUPPORTED_THE_IMAGE_WIDGET' to turn off the message that appears after upgrading. (@crienoloog, i hope this puts a smile on your face.) = 4.0.5 = * Added Japanese (and fixed a minor language string bug - thank you @understandard) * Added Arabic (thank you @modmenpc) = 4.0.4 = Super minor fix to enable saving of a blank caption. (thanks @crdunst) = 4.0.3 = Fixed javascript bug caused by log message. = 4.0.2 = Fix oversized screenshot. = 4.0.1 = Language updates: * Brazilian Portuguese (Thank you @guhemama) * Spanish (Thank you @javiandgo) = 4.0 = * Significant upgrades to support the new WordPress media manager (Thank you @kyleunzicker, @dancameron, @dudekpj, @JakePT) * Significant improvements the administrative user interface. * Abstracted support for older versions of WordPress so that that we don't break old versions with this upgrade (Though there's no reason you should up grade this widget and NOT your WP install! You should always keep WordPress core up to date!) * Added 'image_widget_link_attributes' filter to easily process link attributes and to default to having the link 'title' be the 'alt' or 'title' content. (Thank you @ZeroGravity, @pixelyzed, and @javiandgo) * Updated Translations ** Swedish (Tomas Lindhoff ) ** Dutch (Presis ) ** Italian (@maxgx) = 3.3.8 = * Added italian translations courtesy of @maxgx = 3.3.7 = * Add filters so that people can more easily adjust the output of the widget as per @TCBarrett's request. = 3.3.6 = * Czech translation courtesy of Vladislav Musilek at blogísek (http://blog.musilda.cz). = 3.3.5 = * Fix filtered media library inserts thanks to @miraclemaker as well as @oxyc, @BjornW and innumerable others in the support forum (http://wordpress.org/support/topic/plugin-image-widget-add-image-upload-an-image-select-insert-into-widget-no-image-is-shown) * Adjusted HTTPS/SSL handling so that it's only applied in the view. ( thanks @TheFluffyDoneky and @aerobrent ) * Added a filter for the image url: 'image_widget_image_url' * Add Dutch language translation ( thank you Carsten Alsemgeest - presis.nl ) * Rename all language files to lowercase image_widget to match the localization string. = 3.3.4 = * Fix javascript bugs in the widget admin UI. ( thanks for filing this @joo-joo ) * Fix notices in php error log. * Add widget description filter $args and $instance ( thanks @jeffreyzinn ) * Fixed localization and renamed key to 'image-widget' = 3.3.3 = * Romanian translation courtesy of Alexander Ovsov at Web Geek Science (http://webhostinggeeks.com). = 3.3.2 = * Remove extra esc_attr() from the $title display. (Thank you @romaspit) = 3.3.1 = * Add minor security updates. * Update readme, thumbnails and other minor descriptors. = 3.3 = * Fix to allow the widget to work in the non-async (browser) uploader. Props Bjorn Wijers = 3.2.11 = * Yet another minor JS fix to hopefully address issues of lightbox not working = 3.2.10 = * Fix JS typo. = 3.2.9 = * Minor JS fix to hopefully address issues of lightbox not working * Use new the new [jQuery.fn.on](http://api.jquery.com/on/) method for forward compatibility. = 3.2.8 = * Minor bugfix courtesy of Takayuki Miyauchi (@miya0001) * Polish translation courtesy of Łukasz Kliś = 3.2.7 = * Update javascript to work with the new version of WordPress (thanks Matt Wiebe!!! @mattwiebe) * Added Japanese translation courtesy of Takayuki Miyauchi (@miya0001) = 3.2.6 = * Add HTTPS support courtesy of David Paul Ellenwood (DPE@SGS) = 3.2.5 = * Added Swedish translation courtesy of Tomas Lindhoff (@Tomas) = 3.2.4 = * Added javascript conflict prevention code thanks to @rcain. = 3.2.3 = * Added French translation courtesy of Dominique Corbex (@Domcox) = 3.2.2 = * Added Portuguese translation courtesy of Gustavo Machado = 3.2.1 = * Fix image widget public declaration bug. = 3.2 = * Abstract views for widget output and widget admin. * Support theme override of the widget output! Now you can layout the widget however you'd like. * Added filter to override template call. = 3.1.6 = * Fixed Wordpress 3.0 bugs. (Thanks @kenvunz) = 3.1.5 = Fixed PHP 5 bug. Removed 'public' declaration. http://wordpress.org/support/topic/362167 Thanks @mpwalsh8, @jleuze, @PoLaR5, @NancyA and @phoney36 = 3.1.4 = * Added support for ALT tags. If no alt tag is entered the title is used. = 3.1.3 = * Added German language support (Thank you Rüdiger Weiß!!!) = 3.1.2 = * Fix bug: XHTML Compliance (thanks HGU for offering a patch and thanks @webmasterlistingarts for filing the bug) * Replaced `

` with `

` in description to also improve XHTML compliance. = 3.1.1 = * Fix bug: php4 reported error: PHP Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' (thanks @natashaelaine and @massimopaolini) = 3.0.10 = * Fix bug: improve tab filters. = 3.0.9 = * Fix bug: update tabs filter to not kill tabs if upload window is for non widget uses. = 3.0.8 = * Remove the "From URL" tab since it isn't supported. * Replace "Insert into Post" with "Insert into Widget" in thickbox. = 3.0.7 = * Fix Dean's Fcuk editor conflict. (Thanks for the report Laurie @L_T_G) * Fix IE8 bug (Remove extra comma from line 66 of js - thanks for the report @reface) * Update functions and enqueued scripts to only trigger on widget page. = 3.0.6 = * Fix crash on insert into post. = 3.0.5 = Thank you @smurkas, @squigie and @laurie!!! Special thanks to Cameron Clark from http://prolifique.com a.k.a @capnhairdo for contributing invaluable javascript debugging skills and throwing together some great code. * PHP4 compatibility * Tighter integration with the thickbok uploader attributes including caption, description, alignment, and link * Tighter image resize preview * Add Image link becomes "Change Image" once image has been added = 3.0.4 = * Minor description changes = 3.0.3 = * Fixed the broken "Add Image" link (THANK YOU @SMURKAS!!!) = 3.0.2 = * Added PHPDoc comments * Temporarily fixed install bug where no image is saved if resize is not working. (thank you Paul Kaiser from Champaign, Il for your helpful QA support) = 3.0.1 = * Added 'sp_image_widget' domain for language support. = 3.0 = * Completely remodeled the plugin to use the native WordPress uploader and be compatible with Wordpress 2.8 plugin architecture. * Removed externalized widget admin. = 2.2.2 = * Update
  • to be $before_widget and $after_widget (Thanks again to Lois Turley) = 2.2.1 = * Update `
    ` to be `
  • ` (Thanks to Lois Turley) = 2.2 = * Fixed missing DIV close tag (Thank you Jesper Goos) * Updated all short tags to proper php tags (Thank you Jonathan Volks from Mannix Marketing) = 2.1 = * Link Target = 2.0 = * Multi widget support * WP 2.7.1 Compatibility * Class encapsulation == Upgrade Notice == = 4.0 = Please be advised that this is a significant upgrade. You should definitely back up your database before updating in case your existing image widgets have any problems. Also, several languages will no longer be supported until new translations are submitted. Currently, we have support for Italian, Dutch, and Swedish. If you would like to contribute your own language files, please post links here: http://wordpress.org/support/topic/image-widget-40-translations-needed-2 PK!views/widget-admin.phpnu[get_field_id( '' ); ?>
    get_image_html( $instance, false ); ?>

    style="display:none;">


    here.', 'image-widget' ); ?>




    style="display:none;">

    style="display:none;">

    PK!* views/index.phpnu[

    id; //NOTE #1: the widget id is added here to allow uploader to only return array if this is used with image widget so that all other uploads are not harmed. $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src"); $image_title = (!empty($instance['image'])) ? __('Change Image', 'image-widget') : __('Add Image', 'image-widget'); ?>
    <?php echo $image_title; ?>

    get_image_html($instance); ?>


    PK!o;;views/widget.phpnu[get_image_html( $instance, true ); if ( ! empty( $description ) ) { echo '
    '; echo wpautop( $description ); echo '
    '; } echo $after_widget; PK!΂QQresources/css/admin.cssnu[.uploader input.button { height: 34px; line-height: 1; margin-top: 15px; width: 100%; } .tribe_preview .aligncenter { display: block; margin-left: auto !important; margin-right: auto !important; } .tribe_preview { max-height: 300px; overflow: hidden; } .tribe_preview img { height: auto; margin: 10px 0; max-width: 100%; }PK!* resources/index.phpnu['; return img_html; }, // Hide or display the WordPress image size fields depending on if 'Custom' is selected. toggleSizes : function( widget_id, widget_id_string ) { if ( $( '#' + widget_id_string + 'size' ).val() == 'tribe_image_widget_custom' ) { $( '#' + widget_id_string + 'custom_size_fields').slideDown(); } else { $( '#' + widget_id_string + 'custom_size_fields').slideUp(); } }, // Update the image height based on the image width. changeImgWidth : function( widget_id, widget_id_string ) { var aspectRatio = $("#" + widget_id_string + 'aspect_ratio').val(); if ( aspectRatio ) { var width = $( '#' + widget_id_string + 'width' ).val(); var height = Math.round( width / aspectRatio ); $( '#' + widget_id_string + 'height' ).val(height); //imageWidget.changeImgSize( widget_id, widget_id_string, width, height ); } }, // Update the image width based on the image height. changeImgHeight : function( widget_id, widget_id_string ) { var aspectRatio = $("#" + widget_id_string + 'aspect_ratio').val(); if ( aspectRatio ) { var height = $( '#' + widget_id_string + 'height' ).val(); var width = Math.round( height * aspectRatio ); $( '#' + widget_id_string + 'width' ).val(width); //imageWidget.changeImgSize( widget_id, widget_id_string, width, height ); } } }; }); PK!* resources/js/index.phpnu[0) { //code for retrieving GET vars (we want the value of widget_id) var widget_id = ''; document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () { function decode(s) { return decodeURIComponent(s.split("+").join(" ")); } var key = decode(arguments[1]); if (key == 'widget_id') { widget_id = decode(arguments[2]); } }); if (widget_id.length > 0) {//do we have a value? //insert hidden field into form jQuery('form#filter').append( jQuery('') .attr('type', 'hidden') .attr('name', 'widget_id') .val(widget_id) ); } } }); /* * Thanks to http://github.com/kvz/phpjs/raw/master/functions/url/parse_url.js */ function parse_url (str, component) { // http://kevin.vanzonneveld.net // + original by: Steven Levithan (http://blog.stevenlevithan.com) // + reimplemented by: Brett Zamir (http://brett-zamir.me) // + input by: Lorenzo Pisani // + input by: Tony // + improved by: Brett Zamir (http://brett-zamir.me) // % note: Based on http://stevenlevithan.com/demo/parseuri/js/assets/parseuri.js // % note: blog post at http://blog.stevenlevithan.com/archives/parseuri // % note: demo at http://stevenlevithan.com/demo/parseuri/js/assets/parseuri.js // % note: Does not replace invalid characters with '_' as in PHP, nor does it return false with // % note: a seriously malformed URL. // % note: Besides function name, is essentially the same as parseUri as well as our allowing // % note: an extra slash after the scheme/protocol (to allow file:/// as in PHP) // * example 1: parse_url('http://username:password@hostname/path?arg=value#anchor'); // * returns 1: {scheme: 'http', host: 'hostname', user: 'username', pass: 'password', path: '/path', query: 'arg=value', fragment: 'anchor'} var key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment'], ini = (this.php_js && this.php_js.ini) || {}, mode = (ini['phpjs.parse_url.mode'] && ini['phpjs.parse_url.mode'].local_value) || 'php', parser = { php: /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // Added one optional slash to post-scheme to catch file:/// (should restrict this) }; var m = parser[mode].exec(str), uri = {}, i = 14; while (i--) { if (m[i]) { uri[key[i]] = m[i]; } } if (component) { return uri[component.replace('PHP_URL_', '').toLowerCase()]; } if (mode !== 'php') { var name = (ini['phpjs.parse_url.queryKey'] && ini['phpjs.parse_url.queryKey'].local_value) || 'queryKey'; parser = /(?:^|&)([^&=]*)=?([^&]*)/g; uri[name] = {}; uri[key[12]].replace(parser, function ($0, $1, $2) { if ($1) {uri[name][$1] = $2;} }); } delete uri.source; return uri; } /* /wp-admin/media-upload.php?type=image&widget_id=widget_sp_image-11& */PK!*  index.phpnu[Image Widget " "Plus - Add lightbox, slideshow, and random image widgets. " "Find out how!

    " msgstr "" #: image-widget.php:597 msgid "" "

    Image Widget " "Plus - Add lightbox, slideshow, and random image widgets. " "Find out how!

    " msgstr "" #: image-widget.php:613 msgid "Image Widget Plus" msgstr "" #: views/widget-admin.deprecated.php:10 views/widget-admin.php:23 msgid "Title" msgstr "" #: views/widget-admin.deprecated.php:13 msgid "Image" msgstr "" #: views/widget-admin.deprecated.php:17 msgid "Change Image" msgstr "" #: views/widget-admin.deprecated.php:17 msgid "Add Image" msgstr "" #: views/widget-admin.deprecated.php:25 views/widget-admin.php:33 msgid "Caption" msgstr "" #: views/widget-admin.deprecated.php:28 views/widget-admin.php:36 msgid "Link" msgstr "" #: views/widget-admin.deprecated.php:31 views/widget-admin.php:43 msgid "Stay in Window" msgstr "" #: views/widget-admin.deprecated.php:32 views/widget-admin.php:44 msgid "Open New Window" msgstr "" #: views/widget-admin.deprecated.php:35 views/widget-admin.php:63 msgid "Width" msgstr "" #: views/widget-admin.deprecated.php:38 views/widget-admin.php:66 msgid "Height" msgstr "" #: views/widget-admin.deprecated.php:41 views/widget-admin.php:71 msgid "Align" msgstr "" #: views/widget-admin.deprecated.php:43 views/widget-admin.php:73 msgid "none" msgstr "" #: views/widget-admin.deprecated.php:44 views/widget-admin.php:74 msgid "left" msgstr "" #: views/widget-admin.deprecated.php:45 views/widget-admin.php:75 msgid "center" msgstr "" #: views/widget-admin.deprecated.php:46 views/widget-admin.php:76 msgid "right" msgstr "" #: views/widget-admin.deprecated.php:49 views/widget-admin.php:26 msgid "Alternate Text" msgstr "" #: views/widget-admin.php:29 msgid "Related" msgstr "" #: views/widget-admin.php:31 msgid "" "A recommended HTML5 related terms list is available here." msgstr "" #: views/widget-admin.php:38 msgid "Link Title" msgstr "" #: views/widget-admin.php:40 msgid "Link ID" msgstr "" #: views/widget-admin.php:51 msgid "Size" msgstr "" #. Plugin URI of the plugin/theme msgid "http://wordpress.org/plugins/image-widget/" msgstr "" #. Description of the plugin/theme msgid "" "A simple image widget that uses the native WordPress media manager to add " "image widgets to your site. Image " "Widget Plus - Multiple images, slider and more." msgstr "" #. Author of the plugin/theme msgid "Modern Tribe, Inc." msgstr "" #. Author URI of the plugin/theme msgid "http://m.tri.be/iwpdoc" msgstr "" PK![CTCTimage-widget.phpnu[ 'widget_sp_image', 'description' => __( 'Showcase a single image with a Title, URL, and a Description', 'image-widget' ) ); $control_ops = array( 'id_base' => 'widget_sp_image' ); parent::__construct( 'widget_sp_image', __( 'Image Widget', 'image-widget' ), $widget_ops, $control_ops ); if ( $this->use_old_uploader() ) { require_once( 'lib/ImageWidgetDeprecated.php' ); new ImageWidgetDeprecated( $this ); } else { add_action( 'sidebar_admin_setup', array( $this, 'admin_setup' ) ); } // fire admin_setup if we are in the customizer add_action( 'admin_enqueue_scripts', array( $this, 'maybe_admin_setup' ) ); } /** * Test to see if this version of WordPress supports the new image manager. * * @return bool True if the current version of WordPress does NOT support the current image management tech. */ private function use_old_uploader() { if ( defined( 'IMAGE_WIDGET_COMPATIBILITY_TEST' ) ) { return true; } return ! function_exists( 'wp_enqueue_media' ); } /** * Enqueue all the javascript and CSS. */ public function admin_setup() { wp_enqueue_media(); wp_enqueue_style( 'tribe-image-widget', plugins_url( 'resources/css/admin.css', __FILE__ ), array(), self::VERSION ); wp_enqueue_script( 'tribe-image-widget', plugins_url( 'resources/js/image-widget.js', __FILE__ ), array( 'jquery', 'media-upload', 'media-views' ), self::VERSION ); wp_localize_script( 'tribe-image-widget', 'TribeImageWidget', array( 'frame_title' => __( 'Select an Image', 'image-widget' ), 'button_title' => __( 'Insert Into Widget', 'image-widget' ), ) ); } /** * Trigger the enqueueing of admin scripts and styles on widget admin page and in the "Customizer" view. */ public function maybe_admin_setup() { $screen = get_current_screen(); if ( 'customize' !== $screen->base ) { return; } $this->admin_setup(); } /** * Widget frontend output * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { extract( $args ); $instance = wp_parse_args( (array) $instance, self::get_defaults() ); if ( ! empty( $instance['imageurl'] ) || ! empty( $instance['attachment_id'] ) ) { /** * Filters the title of the widget. * * @link https://developer.wordpress.org/reference/hooks/widget_title/ * * @param string $title The widget title. * @param array $instance The array of widget options. * @param mixed $id_base The widget ID. */ $instance['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); /** * Filters the text of the widget. * * @link https://developer.wordpress.org/reference/hooks/widget_text/ * * @param string $description The widget description. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['description'] = apply_filters( 'widget_text', $instance['description'], $args, $instance ); /** * Filters the link of the image widget. * * @since 4.0.0 * * @param string $link The widget image link. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['link'] = apply_filters( 'image_widget_image_link', esc_url( $instance['link'] ), $args, $instance ); /** * Filters the link id of the image widget. * * @since 4.0.0 * * @param string $linkid The widget image link ID. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['linkid'] = apply_filters( 'image_widget_image_link_id', esc_attr( $instance['linkid'] ), $args, $instance ); /** * Filters the link title of the image widget. * * @since 4.0.0 * * @param string $linktitle The widget image link title. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['linktitle'] = apply_filters( 'image_widget_image_link_title', esc_attr( $instance['linktitle'] ), $args, $instance ); /** * Filters the link target of the image widget. * * @since 4.0.0 * * @param string $linktarget The widget image link target. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['linktarget'] = apply_filters( 'image_widget_image_link_target', esc_attr( $instance['linktarget'] ), $args, $instance ); /** * Filters the width of the image in the widget. * * @since 4.0.0 * * @param string $width The width of the widget image. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['width'] = apply_filters( 'image_widget_image_width', abs( $instance['width'] ), $args, $instance ); /** * Filters the height of the image in the widget. * * @since 4.0.0 * * @param string $height The height of the widget image. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['height'] = apply_filters( 'image_widget_image_height', abs( $instance['height'] ), $args, $instance ); /** * Filters the max width of the image in the widget. * * @since 4.0.0 * * @param string $maxwidth The max width of the widget image. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['maxwidth'] = apply_filters( 'image_widget_image_maxwidth', esc_attr( $instance['maxwidth'] ), $args, $instance ); /** * Filters the max height of the image in the widget. * * @since 4.0.0 * * @param string $maxheight The max height of the widget image. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['maxheight'] = apply_filters( 'image_widget_image_maxheight', esc_attr( $instance['maxheight'] ), $args, $instance ); /** * Filters the alignment of the image in the widget. * * @since 4.0.0 * * @param string $align The alignment of the widget image. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['align'] = apply_filters( 'image_widget_image_align', esc_attr( $instance['align'] ), $args, $instance ); /** * Filters the alt text of the image in the widget. * * @since 4.0.0 * * @param string $alt The alt text of the widget image. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['alt'] = apply_filters( 'image_widget_image_alt', esc_attr( $instance['alt'] ), $args, $instance ); /** * Filters the rel attribute of the image in the widget. * * @since 4.0.0 * * @param string $rel The rel attribute of the widget image. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['rel'] = apply_filters( 'image_widget_image_rel', esc_attr( $instance['rel'] ), $args, $instance ); /** * Checks if the IMAGE_WIDGET_COMPATIBILITY_TEST constant is defined. */ if ( ! defined( 'IMAGE_WIDGET_COMPATIBILITY_TEST' ) ) { /** * Assigns the attachment_id field in the instance array a value based on condition. */ $instance['attachment_id'] = ( $instance['attachment_id'] > 0 ) ? $instance['attachment_id'] : $instance['image']; /** * Filters the attachment ID of the image in the widget. * * @since 4.0.0 * * @param int $attachment_id The attachment ID of the widget image. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['attachment_id'] = apply_filters( 'image_widget_image_attachment_id', abs( $instance['attachment_id'] ), $args, $instance ); /** * Filters the size of the image in the widget. * * @since 4.0.0 * * @param string $size The size of the widget image. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['size'] = apply_filters( 'image_widget_image_size', esc_attr( $instance['size'] ), $args, $instance ); } /** * Filters the URL of the image in the widget. * * @since 4.0.0 * * @param string $imageurl The URL of the widget image. * @param array $args The array of widget arguments. * @param array $instance The array of widget options. */ $instance['imageurl'] = apply_filters( 'image_widget_image_url', esc_url( $instance['imageurl'] ), $args, $instance ); // No longer using extracted vars. This is here for backwards compatibility. extract( $instance ); include( $this->getTemplateHierarchy( 'widget' ) ); } } /** * Update widget options * * @param object $new_instance Widget Instance * @param object $old_instance Widget Instance * @return object */ public function update( $new_instance, $old_instance ) { $instance = $old_instance; $new_instance = wp_parse_args( (array) $new_instance, self::get_defaults() ); $instance['title'] = strip_tags( $new_instance['title'] ); if ( current_user_can( 'unfiltered_html' ) ) { $instance['description'] = $new_instance['description']; } else { $instance['description'] = wp_kses_post( $new_instance['description'] ); } /** * Make the description filterable; especially useful for working with allowing/disallowing HTML and other content. * * @since 4.4.6 * * @param $description The current value of $instance['description']. * @param $new_instance The new instance of the widget, i.e. the new values being saved for it. * @param $old_instance The pre-existing instance of the widget, i.e. the values that are potentially being updated. */ $instance['description'] = apply_filters( 'tribe_image_widget_instance_description', $instance['description'], $new_instance, $old_instance ); $instance['link'] = $new_instance['link']; $instance['linktitle'] = $new_instance['linktitle']; $instance['linkid'] = $new_instance['linkid']; $instance['linktarget'] = $new_instance['linktarget']; $instance['width'] = abs( $new_instance['width'] ); $instance['height'] = abs( $new_instance['height'] ); if ( ! defined( 'IMAGE_WIDGET_COMPATIBILITY_TEST' ) ) { $instance['size'] = $new_instance['size']; } $instance['align'] = $new_instance['align']; $instance['alt'] = $new_instance['alt']; $instance['rel'] = $new_instance['rel']; // Reverse compatibility with $image, now called $attachement_id if ( ! defined( 'IMAGE_WIDGET_COMPATIBILITY_TEST' ) && $new_instance['attachment_id'] > 0 ) { $instance['attachment_id'] = abs( $new_instance['attachment_id'] ); } elseif ( $new_instance['image'] > 0 ) { $instance['attachment_id'] = $instance['image'] = abs( $new_instance['image'] ); if ( class_exists( 'ImageWidgetDeprecated' ) ) { $instance['imageurl'] = ImageWidgetDeprecated::get_image_url( $instance['image'], $instance['width'], $instance['height'] ); // image resizing not working right now } } $instance['imageurl'] = $new_instance['imageurl']; // deprecated $instance['aspect_ratio'] = $this->get_image_aspect_ratio( $instance ); return $instance; } /** * Form UI * * @param object $instance Widget Instance */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, self::get_defaults() ); if ( $this->use_old_uploader() ) { include( $this->getTemplateHierarchy( 'widget-admin.deprecated' ) ); } else { include( $this->getTemplateHierarchy( 'widget-admin' ) ); } } /** * Render an array of default values. * * @return array default values */ private static function get_defaults() { $defaults = array( 'title' => '', 'description' => '', 'link' => '', 'linkid' => '', 'linktitle' => '', 'linktarget' => '', 'width' => 0, 'height' => 0, 'maxwidth' => '100%', 'maxheight' => '', 'image' => 0, // reverse compatible - now attachement_id 'imageurl' => '', // reverse compatible. 'align' => 'none', 'alt' => '', 'rel' => '', ); if ( ! defined( 'IMAGE_WIDGET_COMPATIBILITY_TEST' ) ) { $defaults['size'] = self::CUSTOM_IMAGE_SIZE_SLUG; $defaults['attachment_id'] = 0; } /** * Allow users to customize the default values of various Image Widget options. * * @since 4.4.7 * * @param array $defaults The array of default option values. */ return apply_filters( 'image_widget_option_defaults', $defaults ); } /** * Render the image html output. * * @param array $instance * @param bool $include_link will only render the link if this is set to true. Otherwise link is ignored. * @return string image html */ private function get_image_html( $instance, $include_link = true ) { // Backwards compatible image display. if ( $instance['attachment_id'] == 0 && $instance['image'] > 0 ) { $instance['attachment_id'] = $instance['image']; } $output = ''; if ( $include_link && ! empty( $instance['link'] ) ) { $attr = array( 'href' => $instance['link'], 'id' => $instance['linkid'], 'target' => $instance['linktarget'], 'class' => $this->widget_options['classname'] . '-image-link', 'title' => ( ! empty( $instance['linktitle'] ) ) ? $instance['linktitle'] : $instance['title'], 'rel' => $instance['rel'], ); $attr = apply_filters( 'image_widget_link_attributes', $attr, $instance ); $attr = array_map( 'esc_attr', $attr ); $output = ' $value ) { if ( ! empty( $value ) ) { $output .= sprintf( ' %s="%s"', $name, $value ); } } $output .= '>'; } $size = $this->get_image_size( $instance ); if ( is_array( $size ) ) { $instance['width'] = $size[0]; $instance['height'] = $size[1]; } elseif ( ! empty( $instance['attachment_id'] ) ) { //$instance['width'] = $instance['height'] = 0; $image_details = wp_get_attachment_image_src( $instance['attachment_id'], $size ); if ( $image_details ) { $instance['imageurl'] = $image_details[0]; $instance['width'] = $image_details[1]; $instance['height'] = $image_details[2]; } $image_srcset = function_exists( 'wp_get_attachment_image_srcset' ) ? wp_get_attachment_image_srcset( $instance['attachment_id'], $size ) : false; if ( $image_srcset ) { $instance['srcset'] = $image_srcset; $image_sizes = function_exists( 'wp_get_attachment_image_sizes' ) ? wp_get_attachment_image_sizes( $instance['attachment_id'], $size ) : false; if ( $image_sizes ) { $instance['sizes'] = $image_sizes; } } } $instance['width'] = abs( $instance['width'] ); $instance['height'] = abs( $instance['height'] ); $attr = array(); if ( ! empty( $instance['alt'] ) ) { $attr['alt'] = $instance['alt']; } elseif ( ! empty( $instance['title'] ) ) { $attr['alt'] = $instance['title']; } if ( is_array( $size ) ) { $attr['class'] = 'attachment-' . join( 'x', $size ); } else { $attr['class'] = 'attachment-' . $size; } $attr['style'] = ''; if ( ! empty( $instance['maxwidth'] ) ) { $attr['style'] .= "max-width: {$instance['maxwidth']};"; } if ( ! empty( $instance['maxheight'] ) ) { $attr['style'] .= "max-height: {$instance['maxheight']};"; } if ( ! empty( $instance['align'] ) && $instance['align'] != 'none' ) { $attr['class'] .= " align{$instance['align']}"; } if ( ! empty( $instance['srcset'] ) ) { $attr['srcset'] = $instance['srcset']; } if ( ! empty( $instance['sizes'] ) ) { $attr['sizes'] = $instance['sizes']; } /** * Allow filtering of the image attributes used on the front-end. * * @param array $attr Image attributes to be filtered. * @param array $instance The current widget instance. */ $attr = apply_filters( 'image_widget_image_attributes', $attr, $instance ); // If there is an imageurl, use it to render the image. Eventually we should kill this and simply rely on attachment_ids. if ( ! empty( $instance['imageurl'] ) ) { // If all we have is an image src url we can still render an image. $attr['src'] = esc_url( $instance['imageurl'] ); $attr = array_map( 'esc_attr', $attr ); $hwstring = image_hwstring( $instance['width'], $instance['height'] ); $output .= rtrim( " $value ) { $output .= sprintf( ' %s="%s"', $name, $value ); } $output .= ' />'; } elseif ( abs( $instance['attachment_id'] ) > 0 ) { $output .= wp_get_attachment_image( $instance['attachment_id'], $size, false, $attr ); } if ( $include_link && ! empty( $instance['link'] ) ) { $output .= ''; } return $output; } /** * Get all possible image sizes to choose from * * @return array */ private function possible_image_sizes() { $registered = get_intermediate_image_sizes(); // label other sizes with their image size "ID" $registered = array_combine( $registered, $registered ); $possible_sizes = array_merge( $registered, array( 'full' => __( 'Full Size', 'image-widget' ), 'thumbnail' => __( 'Thumbnail', 'image-widget' ), 'medium' => __( 'Medium', 'image-widget' ), 'large' => __( 'Large', 'image-widget' ), self::CUSTOM_IMAGE_SIZE_SLUG => __( 'Custom', 'image-widget' ), ) ); /** * Allow filtering the image sizes available for use in the Image Widget dropdown * * @param array $possible_sizes The array of available sizes. */ return (array) apply_filters( 'image_size_names_choose', $possible_sizes ); } /** * Assesses the image size in case it has not been set or in case there is a mismatch. * * @param $instance * @return array|string */ private function get_image_size( $instance ) { if ( ! empty( $instance['size'] ) && $instance['size'] != self::CUSTOM_IMAGE_SIZE_SLUG ) { $size = $instance['size']; } elseif ( isset( $instance['width'] ) && is_numeric( $instance['width'] ) && isset( $instance['height'] ) && is_numeric( $instance['height'] ) ) { //$size = array(abs($instance['width']),abs($instance['height'])); $size = array( $instance['width'], $instance['height'] ); } else { $size = 'full'; } return $size; } /** * Establish the aspect ratio of the image. * * @param $instance * @return float|number */ private function get_image_aspect_ratio( $instance ) { if ( ! empty( $instance['aspect_ratio'] ) ) { return abs( $instance['aspect_ratio'] ); } else { $attachment_id = ( ! empty( $instance['attachment_id'] ) ) ? $instance['attachment_id'] : $instance['image']; if ( ! empty( $attachment_id ) ) { $image_details = wp_get_attachment_image_src( $attachment_id, 'full' ); if ( $image_details ) { return ( $image_details[1] / $image_details[2] ); } } } } /** * Loads theme files in appropriate hierarchy: 1) child theme, * 2) parent template, 3) plugin resources. will look in the image-widget/ * directory in a theme and the views/ directory in the plugin * * @param string $template template file to search for * @return template path */ public function getTemplateHierarchy( $template ) { // whether or not .php was added $template_slug = rtrim( $template, '.php' ); $template = $template_slug . '.php'; if ( $theme_file = locate_template( array( 'image-widget/' . $template ) ) ) { $file = $theme_file; } else { $file = 'views/' . $template; } /** * Allow filtering of currently-retrieved Image Widget template file's path. * * @param string $file The retrieved template file's path. */ return apply_filters( 'sp_template_image-widget_' . $template, $file ); } } PK!*  lib/index.phpnu[id_base = $widget->id_base; } function admin_setup() { global $pagenow; if ( 'widgets.php' == $pagenow ) { wp_enqueue_style( 'thickbox' ); wp_enqueue_script( 'tribe-image-widget', plugins_url('resources/js/image-widget.deprecated.js', dirname(__FILE__)), array('thickbox'), Tribe_Image_Widget::VERSION, TRUE ); } elseif ( 'media-upload.php' == $pagenow || 'async-upload.php' == $pagenow ) { wp_enqueue_script( 'tribe-image-widget-fix-uploader', plugins_url('resources/js/image-widget.deprecated.upload-fixer.js', dirname(__FILE__)), array('jquery'), Tribe_Image_Widget::VERSION, TRUE ); add_filter( 'image_send_to_editor', array( $this,'image_send_to_editor'), 1, 8 ); add_filter( 'gettext', array( $this, 'replace_text_in_thickbox' ), 1, 3 ); add_filter( 'media_upload_tabs', array( $this, 'media_upload_tabs' ) ); add_filter( 'image_widget_image_url', array( $this, 'https_cleanup' ) ); } $this->fix_async_upload_image(); } function fix_async_upload_image() { if(isset($_REQUEST['attachment_id'])) { $id = (int) $_REQUEST['attachment_id']; $GLOBALS['post'] = get_post( $id ); } } /** * Test context to see if the uploader is being used for the image widget or for other regular uploads * * @author Modern Tribe, Inc. (Peter Chester) */ function is_sp_widget_context() { if ( isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'],$this->id_base) !== false ) { return true; } elseif ( isset($_REQUEST['_wp_http_referer']) && strpos($_REQUEST['_wp_http_referer'],$this->id_base) !== false ) { return true; } elseif ( isset($_REQUEST['widget_id']) && strpos($_REQUEST['widget_id'],$this->id_base) !== false ) { return true; } return false; } /** * Somewhat hacky way of replacing "Insert into Post" with "Insert into Widget" * * @param string $translated_text text that has already been translated (normally passed straight through) * @param string $source_text text as it is in the code * @param string $domain domain of the text * @author Modern Tribe, Inc. (Peter Chester) */ function replace_text_in_thickbox($translated_text, $source_text, $domain) { if ( $this->is_sp_widget_context() ) { if ('Insert into Post' == $source_text) { return __('Insert Into Widget', 'image-widget' ); } } return $translated_text; } /** * Filter image_end_to_editor results * * @param string $html * @param int $id * @param string $alt * @param string $title * @param string $align * @param string $url * @param array $size * @return string javascript array of attachment url and id or just the url * @author Modern Tribe, Inc. (Peter Chester) */ function image_send_to_editor( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) { // Normally, media uploader return an HTML string (in this case, typically a complete image tag surrounded by a caption). // Don't change that; instead, send custom javascript variables back to opener. // Check that this is for the widget. Shouldn't hurt anything if it runs, but let's do it needlessly. if ( $this->is_sp_widget_context() ) { if ($alt=='') $alt = $title; ?> is_sp_widget_context() ) { unset($tabs['type_url']); } return $tabs; } /** * Adjust the image url on output to account for SSL. * * @param string $imageurl * @return string $imageurl * @author Modern Tribe, Inc. (Peter Chester) */ function https_cleanup( $imageurl = '' ) { // TODO: 3.5: Document that this is deprecated??? if( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ) { $imageurl = str_replace('http://', 'https://', $imageurl); } else { $imageurl = str_replace('https://', 'http://', $imageurl); } return $imageurl; } /** * Retrieve resized image URL * * @param int $id Post ID or Attachment ID * @param int $width desired width of image (optional) * @param int $height desired height of image (optional) * @return string URL * @author Modern Tribe, Inc. (Peter Chester) */ public static function get_image_url( $id, $width=false, $height=false ) { /**/ // Get attachment and resize but return attachment path (needs to return url) $attachment = wp_get_attachment_metadata( $id ); $attachment_url = wp_get_attachment_url( $id ); if (isset($attachment_url)) { if ($width && $height) { $uploads = wp_upload_dir(); $imgpath = $uploads['basedir'].'/'.$attachment['file']; if (WP_DEBUG) { error_log(__CLASS__.'->'.__FUNCTION__.'() $imgpath = '.$imgpath); } $image = self::resize_image( $imgpath, $width, $height ); if ( $image && !is_wp_error( $image ) ) { $image = path_join( dirname($attachment_url), basename($image) ); } else { $image = $attachment_url; } } else { $image = $attachment_url; } if (isset($image)) { return $image; } } } public static function resize_image( $file, $max_w, $max_h ) { if ( function_exists('wp_get_image_editor') ) { $dest_file = $file; if ( function_exists('wp_get_image_editor') ) { $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) ) return $editor; $resized = $editor->resize( $max_w, $max_h ); if ( is_wp_error( $resized ) ) return $resized; $dest_file = $editor->generate_filename(); $saved = $editor->save( $dest_file ); if ( is_wp_error( $saved ) ) return $saved; } return $dest_file; } else { return image_resize( $file, $max_w, $max_h ); } } } PK!G .gitignorenu[PK! TJJ Preadme.txtnu[PK!pKviews/widget-admin.phpnu[PK!* gviews/index.phpnu[PK!-:!$hviews/widget-admin.deprecated.phpnu[PK!o;;zviews/widget.phpnu[PK!΂QQ}resources/css/admin.cssnu[PK!* ~resources/index.phpnu[PK!~/pp~resources/js/image-widget.jsnu[PK!* resources/js/index.phpnu[PK!-\#'resources/js/image-widget.deprecated.jsnu[PK!qll4resources/js/image-widget.deprecated.upload-fixer.jsnu[PK!*  ղindex.phpnu[PK!t(lang/image-widget.potnu[PK![CTCTimage-widget.phpnu[PK!*  lib/index.phpnu[PK!=Zlib/ImageWidgetDeprecated.phpnu[PKc2