plugin updates

This commit is contained in:
Tony Volpe
2024-11-20 22:40:39 -05:00
parent 0238f0c4ca
commit 3362947c6e
434 changed files with 13405 additions and 9202 deletions

View File

@@ -400,13 +400,21 @@ class WpmfDisplayGallery
)
);
/**
* Filter gallery query argument to get images.
*
* @param array Gallery query arguments
*
* @return array
*/
$args = apply_filters('wpmf_gallery_query_args', $args);
$query = new WP_Query($args);
$_attachments = $query->get_posts();
$gallery_items = array();
$last_folder_parent = $this->getFolderParent($wpmf_folder_id[0]);
foreach ($_attachments as $key => $val) {
if (($last_folder_parent->slug !== 'nextcloud' || !strpos($val->post_mime_type, 'avif')) && !strpos($val->post_mime_type, 'pdf')) { // hide file pdf and avif in nextcloud folder
if ($last_folder_parent->slug !== 'nextcloud' || !strpos($val->post_mime_type, 'avif')) { // hide avif in nextcloud folder
$gallery_items[$val->ID] = $_attachments[$key];
}
}

View File

@@ -210,6 +210,8 @@ class WpmfPdfEmbed
$plugin_dir_url = plugin_dir_url(__DIR__);
$viewer_base_url = $plugin_dir_url . 'class/templates/pdf-embed.php';
$remove_items = apply_filters('wpmf_pdf_embed_remove_button', false);
$response = wp_remote_head($url);
if (is_wp_error($response)) {
$url = $plugin_dir_url . 'assets/pdf-loading-error.pdf';
@@ -222,6 +224,11 @@ class WpmfPdfEmbed
$attachment_info = '?file=' . urlencode($url);
$final_url = $viewer_base_url . $attachment_info . '&plugins_url=' . urlencode($plugin_dir_url);
if (!empty($remove_items) && is_array($remove_items)) {
$remove_items = implode(',', $remove_items);
$remove_items = urlencode($remove_items);
$final_url .= '&remove_items='.$remove_items;
}
$return = '<div><iframe width="' . esc_attr($width) . '" height="' . esc_attr($height) . '" src="' . esc_url($final_url) . '" title="Embedded PDF" class="wpmf-pdfjs-iframe"></iframe></div>';
}
} else {

View File

@@ -1,6 +1,12 @@
<?php
/* PDF embed template */
$plugins_url = $_GET['plugins_url']; // phpcs:ignore
// phpcs:disable
$plugins_url = $_GET['plugins_url'];
if (isset($_GET['remove_items'])) {
$remove_items = $_GET['remove_items'];
$remove_items = explode(',', $remove_items);
}
// phpcs:enable
?>
<!DOCTYPE html>
<!--
@@ -41,6 +47,17 @@ See https://github.com/adobe-type-tools/cmap-resources
wpmf_pdf_embed_obj.errorLoadingPdf = "<?php echo $plugins_url . 'assets/pdf-loading-error.pdf'; // phpcs:ignore ?>";
</script>
<script src="<?php echo $plugins_url . 'assets/js/pdf-embed/viewer.js' ?>"></script><?php // phpcs:ignore ?>
<script>
document.addEventListener("DOMContentLoaded", function() {
var removeItems = <?php echo json_encode($remove_items); ?>;
removeItems.forEach(function(itemId) {
var element = document.getElementById(itemId);
if (element) {
element.remove();
}
});
});
</script>
</head>
<body tabindex="1">
@@ -176,9 +193,9 @@ See https://github.com/adobe-type-tools/cmap-resources
<div class="horizontalToolbarSeparator visibleLargeView"></div>
<button id="presentationMode" class="secondaryToolbarButton" title="Switch to Presentation Mode" tabindex="54" data-l10n-id="presentation_mode">
<!-- <button id="presentationMode" class="secondaryToolbarButton" title="Switch to Presentation Mode" tabindex="54" data-l10n-id="presentation_mode">
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>
</button> -->
<a href="#" id="viewBookmark" class="secondaryToolbarButton" title="Current Page (View URL from Current Page)" tabindex="55" data-l10n-id="bookmark1">
<span data-l10n-id="bookmark1_label">Current Page</span>
@@ -288,7 +305,9 @@ See https://github.com/adobe-type-tools/cmap-resources
<span data-l10n-id="save_label">Save</span>
</button>
<div class="verticalToolbarSeparator hiddenMediumView"></div>
<button id="presentationMode" class="toolbarButton hiddenMediumView" title="Switch to Presentation Mode" tabindex="54" data-l10n-id="presentation_mode">
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup">
<button id="editorFreeText" class="toolbarButton" disabled="disabled" title="Text" role="radio" aria-checked="false" aria-controls="editorFreeTextParamsToolbar" tabindex="34" data-l10n-id="editor_free_text2">
@@ -302,7 +321,6 @@ See https://github.com/adobe-type-tools/cmap-resources
</button>
</div>
<div id="editorModeSeparator" class="verticalToolbarSeparator"></div>
<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="48" data-l10n-id="tools" aria-expanded="false" aria-controls="secondaryToolbar">
<span data-l10n-id="tools_label">Tools</span>