dvadf
File manager - Edit - /home/centroca/public_html/inc.zip
Back
PK �;0]p/ �/ core/tools.phpnu �[��� <?php /** * Resizes an image and returns an array containing the resized URL, width, height and file type. Uses native WordPress functionality. * * @author Matthew Ruddy (http://easinglider.com) * @return array An array containing the resized image URL, width, height and file type. */ function su_image_resize( $url, $width = null, $height = null, $crop = true, $retina = false ) { global $wp_version; //###################################################################### // First implementation //###################################################################### if ( isset( $wp_version ) && version_compare( $wp_version, '3.5' ) >= 0 ) { global $wpdb; if ( empty( $url ) ) { return new WP_Error( 'no_image_url', 'No image URL has been entered.', $url ); } // Get default size from database $width = ( $width ) ? $width : get_option( 'thumbnail_size_w' ); $height = ( $height ) ? $height : get_option( 'thumbnail_size_h' ); // Allow for different retina sizes $retina = $retina ? ( $retina === true ? 2 : $retina ) : 1; // Get the image file path $file_path = parse_url( $url ); $file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path']; // Check for Multisite if ( is_multisite() ) { global $blog_id; $blog_details = get_blog_details( $blog_id ); $file_path = str_replace( $blog_details->path . 'files/', '/wp-content/blogs.dir/' . $blog_id . '/files/', $file_path ); } // Destination width and height variables $dest_width = intval( $width ) * intval( $retina ); $dest_height = intval( $height ) * intval( $retina ); // File name suffix (appended to original file name) $suffix = "{$dest_width}x{$dest_height}"; // Some additional info about the image $info = pathinfo( $file_path ); $dir = $info['dirname']; $ext = $info['extension']; $name = wp_basename( $file_path, ".$ext" ); // Suffix applied to filename $suffix = "{$dest_width}x{$dest_height}"; // Get the destination file name $dest_file_name = "{$dir}/{$name}-{$suffix}.{$ext}"; if ( ! file_exists( $dest_file_name ) ) { $query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE guid='%s'", $url ); $get_attachment = $wpdb->get_results( $query ); if ( ! $get_attachment ) { return array( 'url' => $url, 'width' => $width, 'height' => $height, ); } // Load WordPress Image Editor $editor = wp_get_image_editor( $file_path ); if ( is_wp_error( $editor ) ) { return array( 'url' => $url, 'width' => $width, 'height' => $height, ); } // Get the original image size $size = $editor->get_size(); $orig_width = $size['width']; $orig_height = $size['height']; $src_x = $src_y = 0; $src_w = $orig_width; $src_h = $orig_height; if ( $crop ) { $cmp_x = $orig_width / $dest_width; $cmp_y = $orig_height / $dest_height; // Calculate x or y coordinate, and width or height of source if ( $cmp_x > $cmp_y ) { $src_w = round( $orig_width / $cmp_x * $cmp_y ); $src_x = round( ( $orig_width - ( $orig_width / $cmp_x * $cmp_y ) ) / 2 ); } elseif ( $cmp_y > $cmp_x ) { $src_h = round( $orig_height / $cmp_y * $cmp_x ); $src_y = round( ( $orig_height - ( $orig_height / $cmp_y * $cmp_x ) ) / 2 ); } } // Time to crop the image! $editor->crop( $src_x, $src_y, $src_w, $src_h, $dest_width, $dest_height ); // Now let's save the image $saved = $editor->save( $dest_file_name ); // Get resized image information $resized_url = str_replace( basename( $url ), basename( $saved['path'] ), $url ); $resized_width = $saved['width']; $resized_height = $saved['height']; $resized_type = $saved['mime-type']; // Add the resized dimensions to original image metadata (so we can delete our resized images when the original image is delete from the Media Library) $metadata = wp_get_attachment_metadata( $get_attachment[0]->ID ); if ( isset( $metadata['image_meta'] ) ) { $metadata['image_meta']['resized_images'][] = $resized_width . 'x' . $resized_height; wp_update_attachment_metadata( $get_attachment[0]->ID, $metadata ); } // Create the image array $image_array = array( 'url' => $resized_url, 'width' => $resized_width, 'height' => $resized_height, 'type' => $resized_type, ); } else { $image_array = array( 'url' => str_replace( basename( $url ), basename( $dest_file_name ), $url ), 'width' => $dest_width, 'height' => $dest_height, 'type' => $ext, ); } // Return image array return $image_array; } //###################################################################### // Second implementation //###################################################################### else { global $wpdb; if ( empty( $url ) ) { return new WP_Error( 'no_image_url', 'No image URL has been entered.', $url ); } // Bail if GD Library doesn't exist if ( ! extension_loaded( 'gd' ) || ! function_exists( 'gd_info' ) ) { return array( 'url' => $url, 'width' => $width, 'height' => $height, ); } // Get default size from database $width = ( $width ) ? $width : get_option( 'thumbnail_size_w' ); $height = ( $height ) ? $height : get_option( 'thumbnail_size_h' ); // Allow for different retina sizes $retina = $retina ? ( $retina === true ? 2 : $retina ) : 1; // Destination width and height variables $dest_width = $width * $retina; $dest_height = $height * $retina; // Get image file path $file_path = parse_url( $url ); $file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path']; // Check for Multisite if ( is_multisite() ) { global $blog_id; $blog_details = get_blog_details( $blog_id ); $file_path = str_replace( $blog_details->path . 'files/', '/wp-content/blogs.dir/' . $blog_id . '/files/', $file_path ); } // Some additional info about the image $info = pathinfo( $file_path ); $dir = $info['dirname']; $ext = $info['extension']; $name = wp_basename( $file_path, ".$ext" ); // Suffix applied to filename $suffix = "{$dest_width}x{$dest_height}"; // Get the destination file name $dest_file_name = "{$dir}/{$name}-{$suffix}.{$ext}"; // No need to resize & create a new image if it already exists! if ( ! file_exists( $dest_file_name ) ) { /* * Bail if this image isn't in the Media Library either. * We only want to resize Media Library images, so we can be sure they get deleted correctly when appropriate. */ $query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE guid='%s'", $url ); $get_attachment = $wpdb->get_results( $query ); if ( ! $get_attachment ) { return array( 'url' => $url, 'width' => $width, 'height' => $height, ); } $image = wp_load_image( $file_path ); if ( ! is_resource( $image ) ) { return new WP_Error( 'error_loading_image_as_resource', $image, $file_path ); } // Get the current image dimensions and type $size = @getimagesize( $file_path ); if ( ! $size ) { return new WP_Error( 'file_path_getimagesize_failed', 'Failed to get $file_path information using getimagesize.' ); } list( $orig_width, $orig_height, $orig_type ) = $size; // Create new image $new_image = wp_imagecreatetruecolor( $dest_width, $dest_height ); // Do some proportional cropping if enabled if ( $crop ) { $src_x = $src_y = 0; $src_w = $orig_width; $src_h = $orig_height; $cmp_x = $orig_width / $dest_width; $cmp_y = $orig_height / $dest_height; // Calculate x or y coordinate, and width or height of source if ( $cmp_x > $cmp_y ) { $src_w = round( $orig_width / $cmp_x * $cmp_y ); $src_x = round( ( $orig_width - ( $orig_width / $cmp_x * $cmp_y ) ) / 2 ); } elseif ( $cmp_y > $cmp_x ) { $src_h = round( $orig_height / $cmp_y * $cmp_x ); $src_y = round( ( $orig_height - ( $orig_height / $cmp_y * $cmp_x ) ) / 2 ); } // Create the resampled image imagecopyresampled( $new_image, $image, 0, 0, $src_x, $src_y, $dest_width, $dest_height, $src_w, $src_h ); } else { imagecopyresampled( $new_image, $image, 0, 0, 0, 0, $dest_width, $dest_height, $orig_width, $orig_height ); } // Convert from full colors to index colors, like original PNG. if ( IMAGETYPE_PNG == $orig_type && function_exists( 'imageistruecolor' ) && ! imageistruecolor( $image ) ) { imagetruecolortopalette( $new_image, false, imagecolorstotal( $image ) ); } // Remove the original image from memory (no longer needed) imagedestroy( $image ); // Check the image is the correct file type if ( IMAGETYPE_GIF == $orig_type ) { if ( ! imagegif( $new_image, $dest_file_name ) ) { return new WP_Error( 'resize_path_invalid', 'Resize path invalid (GIF)' ); } } elseif ( IMAGETYPE_PNG == $orig_type ) { if ( ! imagepng( $new_image, $dest_file_name ) ) { return new WP_Error( 'resize_path_invalid', 'Resize path invalid (PNG).' ); } } else { // All other formats are converted to jpg if ( 'jpg' != $ext && 'jpeg' != $ext ) { $dest_file_name = "{$dir}/{$name}-{$suffix}.jpg"; } if ( ! imagejpeg( $new_image, $dest_file_name, apply_filters( 'resize_jpeg_quality', 90 ) ) ) { return new WP_Error( 'resize_path_invalid', 'Resize path invalid (JPG).' ); } } // Remove new image from memory (no longer needed as well) imagedestroy( $new_image ); // Set correct file permissions $stat = stat( dirname( $dest_file_name ) ); $perms = $stat['mode'] & 0000666; @chmod( $dest_file_name, $perms ); // Get some information about the resized image $new_size = @getimagesize( $dest_file_name ); if ( ! $new_size ) { return new WP_Error( 'resize_path_getimagesize_failed', 'Failed to get $dest_file_name (resized image) info via @getimagesize', $dest_file_name ); } list( $resized_width, $resized_height, $resized_type ) = $new_size; // Get the new image URL $resized_url = str_replace( basename( $url ), basename( $dest_file_name ), $url ); // Add the resized dimensions to original image metadata (so we can delete our resized images when the original image is delete from the Media Library) $metadata = wp_get_attachment_metadata( $get_attachment[0]->ID ); if ( isset( $metadata['image_meta'] ) ) { $metadata['image_meta']['resized_images'][] = $resized_width . 'x' . $resized_height; wp_update_attachment_metadata( $get_attachment[0]->ID, $metadata ); } // Return array with resized image information $image_array = array( 'url' => $resized_url, 'width' => $resized_width, 'height' => $resized_height, 'type' => $resized_type, ); } else { $image_array = array( 'url' => str_replace( basename( $url ), basename( $dest_file_name ), $url ), 'width' => $dest_width, 'height' => $dest_height, 'type' => $ext, ); } return $image_array; } } /** * Deletes the resized images when the original image is deleted from the WordPress Media Library. * * @author Matthew Ruddy */ function su_delete_resized_images( $post_id ) { // Get attachment image metadata $metadata = wp_get_attachment_metadata( $post_id ); if ( ! $metadata ) { return; } // Do some bailing if we cannot continue if ( ! isset( $metadata['file'] ) || ! isset( $metadata['image_meta']['resized_images'] ) ) { return; } $pathinfo = pathinfo( $metadata['file'] ); $resized_images = $metadata['image_meta']['resized_images']; // Get WordPress uploads directory (and bail if it doesn't exist) $wp_upload_dir = wp_upload_dir(); $upload_dir = $wp_upload_dir['basedir']; if ( ! is_dir( $upload_dir ) ) { return; } // Delete the resized images foreach ( $resized_images as $dims ) { // Get the resized images filename $file = $upload_dir . '/' . $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-' . $dims . '.' . $pathinfo['extension']; // Delete the resized image @unlink( $file ); } } add_action( 'delete_attachment', 'su_delete_resized_images' ); PK �;0]�-%�u� u� core/generator.phpnu �[��� <?php // phpcs:ignoreFile /** * Shortcode Generator */ class Su_Generator { public function __construct() { add_action( 'media_buttons', array(__CLASS__, 'button_classic_editor'), 1000 ); add_action( 'enqueue_block_editor_assets', array(__CLASS__, 'button_block_editor') ); add_action('wp_footer', array(__CLASS__, 'popup')); add_action('admin_footer', array(__CLASS__, 'popup')); add_action('wp_ajax_su_generator_settings', array(__CLASS__, 'settings')); add_action('wp_ajax_su_generator_preview', array(__CLASS__, 'preview')); add_action('su/generator/actions', array(__CLASS__, 'presets')); add_action('wp_ajax_su_generator_get_icons', array(__CLASS__, 'ajax_get_icons')); add_action('wp_ajax_su_generator_get_terms', array(__CLASS__, 'ajax_get_terms')); add_action('wp_ajax_su_generator_get_taxonomies', array(__CLASS__, 'ajax_get_taxonomies')); add_action('wp_ajax_su_generator_search_posts', array(__CLASS__, 'ajax_search_posts')); add_action('wp_ajax_su_generator_search_users', array(__CLASS__, 'ajax_search_users')); add_action('wp_ajax_su_generator_add_preset', array(__CLASS__, 'ajax_add_preset')); add_action('wp_ajax_su_generator_remove_preset', array(__CLASS__, 'ajax_remove_preset')); add_action('wp_ajax_su_generator_get_preset', array(__CLASS__, 'ajax_get_preset')); } /** * @deprecated 5.1.0 Replaced with Su_Generator::classic_editor_button() */ public static function button($args = array()) { return self::button_html_editor($args); } public static function classic_editor_button($args = array()) { return self::button_html_editor($args); } public static function button_html_editor($args = array()) { if (!self::access_check()) { return; } self::enqueue_generator(); $args = wp_parse_args( $args, array( 'target' => '', 'tag' => 'button', 'text' => __('Insert shortcode', 'shortcodes-ultimate'), 'class' => 'button', 'icon' => true, 'echo' => true, 'shortcode' => '', ) ); if ($args['icon']) { $args['icon'] = '<svg style="vertical-align:middle;position:relative;top:-1px;opacity:.8;width:18px;height:18px" viewBox="0 0 20 20" width="18" height="18" aria-hidden="true"><path fill="currentcolor" d="M8.48 2.75v2.5H5.25v9.5h3.23v2.5H2.75V2.75h5.73zm9.27 14.5h-5.73v-2.5h3.23v-9.5h-3.23v-2.5h5.73v14.5z"/></svg>'; } $onclick = sprintf( "SUG.App.insert('html',{editorID:'%s',shortcode:'%s'});return false;", esc_attr($args['target']), esc_attr($args['shortcode']) ); $button = sprintf( '<%6$s type="button" href="javascript:;" class="su-generator-button %1$s" title="%2$s" onclick="%3$s" >%4$s %5$s</%6$s>', esc_attr($args['class']), esc_attr($args['text']), $onclick, $args['icon'], esc_html($args['text']), sanitize_key($args['tag']) ); if ($args['echo']) { echo $button; } return $button; } public static function button_classic_editor($target) { if (!self::access_check()) { return; } self::enqueue_generator(); $onclick = sprintf( "SUG.App.insert('classic',{editorID:'%s',shortcode:''});", esc_attr($target) ); $icon = '<svg style="vertical-align:middle;position:relative;top:-1px;opacity:.8;width:18px;height:18px" viewBox="0 0 20 20" width="18" height="18" aria-hidden="true"><path fill="currentcolor" d="M8.48 2.75v2.5H5.25v9.5h3.23v2.5H2.75V2.75h5.73zm9.27 14.5h-5.73v-2.5h3.23v-9.5h-3.23v-2.5h5.73v14.5z"/></svg>'; $button = sprintf( '<button type="button" class="su-generator-button button" title="%1$s" onclick="%2$s" > %3$s %1$s </button>', __('Insert shortcode', 'shortcodes-ultimate'), $onclick, $icon ); echo $button; } public static function button_block_editor() { if (!self::access_check()) { return; } self::enqueue_generator(); wp_enqueue_script( 'shortcodes-ultimate-block-editor', plugins_url('includes/js/block-editor/index.js', SU_PLUGIN_FILE), array('wp-element', 'wp-components', 'wp-edit-post', 'wp-plugins', 'wp-blocks', 'wp-data'), SU_PLUGIN_VERSION, true ); wp_enqueue_style( 'shortcodes-ultimate-block-editor', plugins_url('includes/css/block-editor.css', SU_PLUGIN_FILE), array(), SU_PLUGIN_VERSION ); wp_localize_script( 'shortcodes-ultimate-block-editor', 'SUBlockEditorL10n', array( 'insertShortcode' => __('Insert shortcode', 'shortcodes-ultimate'), 'livePreviewTitle' => __('Live Preview', 'shortcodes-ultimate'), 'livePreviewDescription' => __('This is a Live Preview. Click this button to open the shortcode generator and try the plugin.', 'shortcodes-ultimate'), ) ); wp_localize_script( 'shortcodes-ultimate-block-editor', 'SUBlockEditorSettings', array( 'supportedBlocks' => get_option('su_option_supported_blocks', array()), 'showToolbarButton' => get_option('su_option_show_toolbar_button', 'on'), 'showBlockControlsButton' => get_option('su_option_show_block_controls_button', 'on'), 'isLivePreview' => su_is_live_preview_request(), ) ); } public static function enqueue_generator() { do_action('su/generator/enqueue'); self::enqueue_assets(); } public static function enqueue_assets() { wp_enqueue_media(); su_query_asset( 'css', array( 'simpleslider', 'farbtastic', 'magnific-popup', 'su-icons', 'su-generator', ) ); su_query_asset( 'js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse', 'jquery-ui-sortable', 'simpleslider', 'farbtastic', 'magnific-popup', 'su-generator', ) ); } public static function get_choice_icon($shortcode_id, $shortcode) { if (!isset($shortcode['icon'])) { $shortcode['icon'] = 'puzzle-piece'; } $svg_icon_path = 'admin/images/shortcodes/svgs/' . $shortcode_id . '.svg'; $svg_file = su_get_plugin_path() . $svg_icon_path; $svg_url = su_get_plugin_url() . $svg_icon_path; if (file_exists($svg_file)) { $shortcode['icon'] = $svg_url . '?v=' . SU_PLUGIN_VERSION; } if (strpos($shortcode['icon'], '/') === false) { $shortcode['icon'] = 'icon:' . $shortcode['icon']; } $shortcode['name'] = (isset($shortcode['name'])) ? $shortcode['name'] : 'untitled-shortcode'; if (!isset($shortcode['desc'])) { $shortcode['desc'] = ''; } return su_html_icon($shortcode['icon']); } /** * Generator popup form */ public static function popup() { if (!did_action('su/generator/enqueue')) { return; } $tools = apply_filters('su/generator/tools', array( '<a href="' . admin_url('admin.php?page=shortcodes-ultimate-settings') . '" target="_blank" title="' . __('Settings', 'shortcodes-ultimate') . '">' . __('Plugin settings', 'shortcodes-ultimate') . '</a>', '<a href="https://getshortcodes.com/" target="_blank" title="' . __('Plugin homepage', 'shortcodes-ultimate') . '">' . __('Plugin homepage', 'shortcodes-ultimate') . '</a>', )); if (!su_fs()->can_use_premium_code() && !su_has_all_active_addons()) { $tools[] = '<a href="' . esc_attr(su_get_utm_link('https://getshortcodes.com/pricing/', 'wp-dashboard', 'generator', 'badge')) . '" target="_blank" title="' . __('Upgrade to PRO', 'shortcodes-ultimate') . '" class="su-add-ons">★ ' . __('Upgrade to PRO', 'shortcodes-ultimate') . '</a>'; } ?> <div id="su-generator-wrap" style="display:none"> <div id="su-generator"> <div class="su-generator-header"> <!-- <div id="su-generator-tools"><?php echo implode(' <span></span> ', $tools); ?></div> --> <div class="su-generator-header-title"> <?php _e('Insert Shortcode', 'shortcodes-ultimate'); ?> </div> <div id="su-generator-search-wrapper"> <input type="text" name="su_generator_search" id="su-generator-search" value="" placeholder="<?php _e('Search for shortcodes', 'shortcodes-ultimate'); ?>" /> <button type="button" id="su-generator-search-clear" title="<?php esc_attr_e('Clear search', 'shortcodes-ultimate'); ?>" aria-label="<?php esc_attr_e('Clear search', 'shortcodes-ultimate'); ?>"> <i class="sui sui-times" aria-hidden="true"></i> </button> </div> </div> <!-- <p id="su-generator-search-pro-tip"><?php printf('<strong>%s:</strong> %s', __('Pro Tip', 'shortcodes-ultimate'), __('Hit enter to select highlighted shortcode, while searching', 'shortcodes-ultimate')) ?></p> --> <?php if (!su_fs()->can_use_premium_code() && !su_has_all_active_addons()): ?> <div class="su-generator-pro-nag"> <?php // translators: %s is replaced with "Shortcodes Ultimate Pro link" printf( __('Unlock 15 additional shortcodes, 60+ styles, and create your own shortcodes with %s', 'shortcodes-ultimate'), sprintf( '<a href="%s" target="_blank">%s ›</a>', esc_attr(su_get_utm_link('https://getshortcodes.com/pricing/', 'wp-dashboard', 'generator', 'pro-nag')), __('Shortcodes Ultimate Pro', 'shortcodes-ultimate') ) ); ?> <a href="<?php echo esc_attr(su_get_utm_link('https://getshortcodes.com/pricing/', 'wp-dashboard', 'generator', 'pro-nag')) ?>" target="_blank" class="su-generator-pro-nag-block-link" tabindex="-1" aria-hidden="true"><?php _e('Shortcodes Ultimate Pro', 'shortcodes-ultimate') ?></a> </div> <?php endif; ?> <div id="su-generator-choices"> <?php foreach (self::get_shortcodes_grouped() as $group_id => $group): ?> <div class="su-generator-choices-group"> <div class="su-generator-choices-group-title"> <?php echo esc_html($group['title']); ?> </div> <div class="su-generator-choices-group-items"> <?php foreach ($group['shortcodes'] as $shortcode_id => $shortcode): ?> <?php $is_pro_choice = !su_fs()->can_use_premium_code() && isset($shortcode['is_pro']) && $shortcode['is_pro']; ?> <div class="su-generator-choice<?php echo $is_pro_choice ? ' su-generator-choice-is-pro' : ''; ?>" data-name="<?php echo esc_attr($shortcode['name']); ?>" data-shortcode="<?php echo esc_attr($shortcode_id); ?>" title="<?php echo esc_attr($shortcode['desc']); ?>" data-desc="<?php echo esc_attr($shortcode['desc']); ?>" data-group="<?php echo esc_attr($shortcode['group']); ?>"> <?php echo self::get_choice_icon($shortcode_id, $shortcode); ?> <span><?php echo esc_html($shortcode['name']); ?></span> <?php if ($is_pro_choice): ?> <span class="su-generator-choice-pro-icon" aria-hidden="true"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" focusable="false"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294zM5 21h14"/></svg> </span> <?php endif; ?> </div> <?php endforeach; ?> </div> </div> <?php endforeach; ?> </div> <div id="su-generator-settings"></div> <input type="hidden" name="su-generator-selected" id="su-generator-selected" value="<?php echo plugins_url('', SU_PLUGIN_FILE); ?>" /> <input type="hidden" name="su-generator-url" id="su-generator-url" value="<?php echo plugins_url('', SU_PLUGIN_FILE); ?>" /> <input type="hidden" name="su-compatibility-mode-prefix" id="su-compatibility-mode-prefix" value="<?php echo su_get_shortcode_prefix(); ?>" /> <input type="hidden" name="su-generator-option-skip" id="su-generator-option-skip" value="<?php echo esc_attr(get_option('su_option_skip', '')); ?>" /> <?php wp_nonce_field('su_generator_preset', 'su_generator_presets_nonce'); ?> <?php wp_nonce_field('su_generator_preview', 'su_generator_preview_nonce'); ?> <div id="su-generator-result" style="display:none"></div> </div> </div> <?php } /** * Normalize shortcode generator tabs. */ private static function get_generator_tabs($shortcode) { if ( empty($shortcode['tabs']) || !is_array($shortcode['tabs']) ) { return array(); } $tabs = array(); foreach ($shortcode['tabs'] as $tab_id => $tab_info) { $tab_id = sanitize_key($tab_id); if (!$tab_id) { continue; } if (is_string($tab_info)) { $tab_info = array( 'title' => $tab_info, ); } if (!is_array($tab_info)) { continue; } $tabs[$tab_id] = wp_parse_args( $tab_info, array( 'title' => $tab_id, 'icon' => '', ) ); } return $tabs; } private static function get_generator_tab_icon($tab) { if (empty($tab['icon'])) { return ''; } $icon = $tab['icon']; if (strpos($icon, '/') === false && strpos($icon, 'icon:') !== 0) { $icon = 'icon:' . $icon; } return su_html_icon($icon); } private static function render_generator_tabs($tabs) { if (empty($tabs)) { return ''; } $return = '<div class="su-generator-tabs" role="tablist">'; $count = 0; foreach ($tabs as $tab_id => $tab) { $active = $count === 0; $tab_dom_id = 'su-generator-tab-' . sanitize_html_class($tab_id); $panel_dom_id = 'su-generator-tab-panel-' . sanitize_html_class($tab_id); $icon = self::get_generator_tab_icon($tab); $return .= '<button type="button" class="su-generator-tab' . ($active ? ' su-generator-tab-active' : '') . '" data-tab="' . esc_attr($tab_id) . '" id="' . esc_attr($tab_dom_id) . '" role="tab" aria-selected="' . ($active ? 'true' : 'false') . '" aria-controls="' . esc_attr($panel_dom_id) . '">'; if ($icon) { $return .= '<span class="su-generator-tab-icon" aria-hidden="true">' . $icon . '</span>'; } $return .= '<span class="su-generator-tab-title">' . esc_html($tab['title']) . '</span>'; $return .= '</button>'; $count++; } $return .= '</div>'; return $return; } private static function render_generator_tab_panels($tabs, $panels) { if (empty($tabs)) { return ''; } $return = '<div class="su-generator-tab-panels">'; $count = 0; foreach ($tabs as $tab_id => $tab) { $active = $count === 0; $tab_dom_id = 'su-generator-tab-' . sanitize_html_class($tab_id); $panel_dom_id = 'su-generator-tab-panel-' . sanitize_html_class($tab_id); $content = isset($panels[$tab_id]) ? $panels[$tab_id] : ''; $return .= '<div class="su-generator-tab-panel' . ($active ? ' su-generator-tab-panel-active' : '') . '" data-tab="' . esc_attr($tab_id) . '" id="' . esc_attr($panel_dom_id) . '" role="tabpanel" aria-labelledby="' . esc_attr($tab_dom_id) . '" aria-hidden="' . ($active ? 'false' : 'true') . '">'; $return .= $content; $return .= '</div>'; $count++; } $return .= '</div>'; return $return; } private static function render_generator_attribute($attr_name, $attr_info, $skip) { if (isset($attr_info['hidden']) && $attr_info['hidden']) { return ''; } // Prepare default value $default = (string) (isset($attr_info['default'])) ? $attr_info['default'] : ''; $attr_info['name'] = (isset($attr_info['name'])) ? $attr_info['name'] : $attr_name; $return = '<div class="su-generator-attr-container' . $skip . '" data-default="' . esc_attr($default) . '">'; $return .= '<h5>' . $attr_info['name'] . '</h5>'; // Create field types if (!isset($attr_info['type']) && isset($attr_info['values']) && is_array($attr_info['values']) && count($attr_info['values'])) $attr_info['type'] = 'select'; elseif (!isset($attr_info['type'])) $attr_info['type'] = 'text'; if (is_callable(array('Su_Generator_Views', $attr_info['type']))) $return .= call_user_func(array('Su_Generator_Views', $attr_info['type']), $attr_name, $attr_info); elseif (isset($attr_info['callback']) && is_callable($attr_info['callback'])) $return .= call_user_func($attr_info['callback'], $attr_name, $attr_info); if (isset($attr_info['desc'])) $return .= '<div class="su-generator-attr-desc">' . str_replace(array('<b%value>', '<b_>'), '<b class="su-generator-set-value" title="' . __('Click to set this value', 'shortcodes-ultimate') . '">', $attr_info['desc']) . '</div>'; $return .= '</div>'; return $return; } private static function render_generator_content_field($shortcode) { if (!isset($shortcode['content'])) { $shortcode['content'] = ''; } if (is_array($shortcode['content'])) { $shortcode['content'] = self::get_shortcode_code($shortcode['content']); } return '<div class="su-generator-attr-container"><h5>' . __('Content', 'shortcodes-ultimate') . '</h5><textarea name="su-generator-content" id="su-generator-content" rows="5">' . esc_attr(str_replace(array('%prefix_', '__'), su_get_shortcode_prefix(), $shortcode['content'])) . '</textarea></div>'; } /** * Process AJAX request */ public static function settings() { self::access(); // Param check if (empty($_REQUEST['shortcode'])) wp_die(__('Shortcode not specified', 'shortcodes-ultimate')); // Request queried shortcode $shortcode = su_get_shortcode(sanitize_key($_REQUEST['shortcode'])); // Call custom callback if ( isset($shortcode['generator_callback']) && is_callable($shortcode['generator_callback']) ) { call_user_func($shortcode['generator_callback'], $shortcode); exit; } // Prepare skip-if-default option $skip = (get_option('su_option_skip') === 'on') ? ' su-generator-skip' : ''; // Prepare actions $actions = apply_filters('su/generator/actions', array( 'insert' => '<a href="javascript:void(0);" class="button button-primary button-large su-generator-insert"><i class="sui sui-check"></i> ' . __('Insert shortcode', 'shortcodes-ultimate') . '</a>', 'copy' => '<button type="button" class="button button-large su-generator-copy" data-label="' . esc_attr__( 'Copy shortcode', 'shortcodes-ultimate' ) . '" data-copied-label="' . esc_attr__( 'Copied', 'shortcodes-ultimate' ) . '" aria-label="' . esc_attr__( 'Copy shortcode', 'shortcodes-ultimate' ) . '"><i class="sui sui-copy" aria-hidden="true"></i><span class="su-generator-copy-label">' . esc_html__( 'Copy shortcode', 'shortcodes-ultimate' ) . '</span></button>', 'reset' => '<button type="button" class="button button-large su-generator-reset" aria-label="' . esc_attr__( 'Reset Settings', 'shortcodes-ultimate' ) . '"><i class="sui sui-undo" aria-hidden="true"></i>' . esc_html__( 'Reset Settings', 'shortcodes-ultimate' ) . '</button>', )); $return = '<div class="su-generator-settings-body">'; $return .= '<div class="su-generator-settings-fields">'; $tabs = self::get_generator_tabs($shortcode); $first_tab = empty($tabs) ? '' : key($tabs); $tab_panels = array(); foreach ($tabs as $tab_id => $tab) { $tab_panels[$tab_id] = ''; } // Shortcode header $return .= '<div id="su-generator-breadcrumbs">'; $return .= apply_filters('su/generator/breadcrumbs', '<a href="javascript:void(0);" class="su-generator-home" title="' . __('Click to return to the shortcodes list', 'shortcodes-ultimate') . '">' . __('All shortcodes', 'shortcodes-ultimate') . '</a> → <span>' . $shortcode['name'] . '</span> <small class="alignright">' . $shortcode['desc'] . '</small><div class="su-generator-clear"></div>'); $return .= '</div>'; // Shortcode note if (isset($shortcode['note'])) { $return .= '<div class="su-generator-note"><i class="sui sui-info-circle"></i><div class="su-generator-note-content">' . wpautop($shortcode['note']) . '</div></div>'; } // Shortcode CTA if (isset($shortcode['generator_cta'])) { $return .= '<div class="su-generator-cta"><div class="su-generator-cta-content">' . $shortcode['generator_cta'] . '</div></div>'; } // Shortcode has atts if (isset($shortcode['atts']) && count($shortcode['atts'])) { // Loop through shortcode parameters foreach ($shortcode['atts'] as $attr_name => $attr_info) { if (empty($tabs)) { $return .= self::render_generator_attribute($attr_name, $attr_info, $skip); continue; } $tab_id = isset($attr_info['tab']) ? sanitize_key($attr_info['tab']) : $first_tab; if (!isset($tab_panels[$tab_id])) { $tab_id = $first_tab; } $tab_panels[$tab_id] .= self::render_generator_attribute($attr_name, $attr_info, $skip); } } // Single shortcode (not closed) if ($shortcode['type'] == 'single') $return .= '<input type="hidden" name="su-generator-content" id="su-generator-content" value="false" />'; // Wrapping shortcode else { if (empty($tabs)) { $return .= self::render_generator_content_field($shortcode); } else { $tab_panels[$first_tab] .= self::render_generator_content_field($shortcode); } } $return .= self::render_generator_tabs($tabs); $return .= self::render_generator_tab_panels($tabs, $tab_panels); $return .= '</div>'; $return .= '<div class="su-generator-preview-panel"><div id="su-generator-preview"></div></div>'; $return .= '</div>'; $return .= '<div class="su-generator-actions su-generator-clearfix">' . implode(' ', array_values($actions)) . '</div>'; echo $return; exit; } /** * Process AJAX request and generate preview HTML */ public static function preview() { // Check nonce if ( empty($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'su_generator_preview') ) { return; } // Check authentication self::access(); // Output results do_action('su/generator/preview/before'); $shortcode = wp_unslash($_POST['shortcode']); echo '<h5>' . __('Preview', 'shortcodes-ultimate') . '</h5>'; echo apply_filters('su/generator/preview/output', do_shortcode($shortcode), $shortcode); echo '<div style="clear:both"></div>'; do_action('su/generator/preview/after'); die(); } public static function access() { if (!self::access_check()) wp_die(__('Access denied', 'shortcodes-ultimate')); } public static function access_check() { $required_capability = (string) get_option( 'su_option_generator_access', 'manage_options' ); return current_user_can($required_capability); } public static function ajax_get_icons() { self::access(); $icons = array(); foreach (su_get_config('icons') as $icon) { $icons[] = '<i class="sui sui-' . $icon . '" title="' . $icon . '"></i>'; } die(implode('', $icons)); } public static function ajax_get_terms() { self::access(); $args = array(); if (isset($_REQUEST['tax'])) $args['options'] = (array) self::get_terms(sanitize_key($_REQUEST['tax'])); if (isset($_REQUEST['class'])) $args['class'] = (string) sanitize_key($_REQUEST['class']); if (isset($_REQUEST['multiple'])) $args['multiple'] = (bool) sanitize_key($_REQUEST['multiple']); if (isset($_REQUEST['size'])) $args['size'] = (int) sanitize_key($_REQUEST['size']); if (isset($_REQUEST['noselect'])) $args['noselect'] = (bool) sanitize_key($_REQUEST['noselect']); die(su_html_dropdown($args)); } public static function ajax_get_taxonomies() { self::access(); $args = array(); $args['options'] = self::get_taxonomies(); die(su_html_dropdown($args)); } public static function ajax_search_posts() { self::access(); $ids = array(); if (isset($_REQUEST['ids'])) { $ids = is_array($_REQUEST['ids']) ? $_REQUEST['ids'] : explode(',', (string) wp_unslash($_REQUEST['ids'])); $ids = array_filter(array_map('absint', $ids)); } $args = array( 'no_found_rows' => true, 'post_status' => 'publish', 'post_type' => self::get_searchable_post_types(), 'posts_per_page' => 20, 'suppress_filters' => false, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, ); if (!empty($ids)) { $args['orderby'] = 'post__in'; $args['post__in'] = $ids; $args['posts_per_page'] = count($ids); } else { $search = isset($_REQUEST['search']) ? sanitize_text_field(wp_unslash($_REQUEST['search'])) : ''; if (strlen($search) < 2) { wp_send_json_success(array('results' => array())); } $args['s'] = $search; } $query = new WP_Query($args); $results = array(); foreach ($query->posts as $post) { $results[] = self::format_post_search_result($post); } wp_send_json_success(array('results' => $results)); } private static function get_searchable_post_types() { $post_types = array(); foreach (get_post_types(array(), 'objects') as $post_type) { if (true === $post_type->show_ui) { $post_types[] = $post_type->name; } } return array_values( (array) apply_filters( 'su/generator/search_posts/post_types', $post_types ) ); } private static function format_post_search_result($post) { $post_type = get_post_type_object($post->post_type); $post_type_label = $post_type ? $post_type->labels->singular_name : $post->post_type; $title = get_the_title($post); if ('' === $title) { $title = __('(no title)', 'shortcodes-ultimate'); } return array( 'value' => (string) $post->ID, 'label' => sprintf( '%1$s (#%2$d, %3$s)', $title, $post->ID, $post_type_label ), ); } public static function ajax_search_users() { self::access(); $ids = array(); if (isset($_REQUEST['ids'])) { $ids = is_array($_REQUEST['ids']) ? $_REQUEST['ids'] : explode(',', (string) wp_unslash($_REQUEST['ids'])); $ids = array_filter(array_map('absint', $ids)); } $args = array( 'fields' => 'all', 'number' => 20, ); if (!empty($ids)) { $args['include'] = $ids; $args['number'] = count($ids); $args['orderby'] = 'include'; } else { $search = isset($_REQUEST['search']) ? sanitize_text_field(wp_unslash($_REQUEST['search'])) : ''; if (strlen($search) < 2) { wp_send_json_success(array('results' => array())); } $args['search'] = '*' . $search . '*'; $args['search_columns'] = array( 'user_login', 'user_nicename', 'display_name', 'user_email', ); } $results = array(); foreach (get_users($args) as $user) { $results[] = self::format_user_search_result($user); } wp_send_json_success(array('results' => $results)); } private static function format_user_search_result($user) { $label = $user->display_name ? $user->display_name : $user->user_login; return array( 'value' => (string) $user->ID, 'label' => sprintf( '%1$s (%2$s, #%3$d)', $label, $user->user_login, $user->ID ), ); } public static function presets($actions) { ob_start(); ?> <div class="su-generator-presets alignright" data-shortcode="<?php echo sanitize_key($_REQUEST['shortcode']); ?>"> <a href="javascript:void(0);" class="button button-large su-gp-button"><i class="sui sui-bars"></i> <?php _e('Presets', 'shortcodes-ultimate'); ?></a> <div class="su-gp-popup"> <div class="su-gp-head"> <a href="javascript:void(0);" class="button button-small button-primary su-gp-new"><?php _e('Save current settings as preset', 'shortcodes-ultimate'); ?></a> </div> <div class="su-gp-list"> <?php self::presets_list(); ?> </div> </div> </div> <?php $actions['presets'] = ob_get_contents(); ob_end_clean(); return $actions; } public static function presets_list($shortcode = false) { // Shortcode isn't specified, try to get it from $_REQUEST if (!$shortcode) $shortcode = $_REQUEST['shortcode']; // Shortcode name is still doesn't exists, exit if (!$shortcode) return; // Shortcode has been specified, sanitize it $shortcode = sanitize_key($shortcode); // Get presets $presets = get_option('su_presets_' . $shortcode); // Presets has been found if (is_array($presets) && count($presets)) { // Print the presets foreach ($presets as $preset) { echo '<span data-id="' . $preset['id'] . '"><em>' . stripslashes($preset['name']) . '</em> <i class="sui sui-times"></i></span>'; } // Hide default text echo sprintf('<b style="display:none">%s</b>', __('Presets not found', 'shortcodes-ultimate')); } // Presets doesn't found else echo sprintf('<b>%s</b>', __('Presets not found', 'shortcodes-ultimate')); } public static function ajax_add_preset() { self::access(); // Check incoming data if (empty($_POST['id'])) return; if (empty($_POST['name'])) return; if (empty($_POST['settings'])) return; if (empty($_POST['shortcode'])) return; // Check Nonce if ( empty($_POST['nonce']) || !is_string($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'su_generator_preset') ) { return; } // Clean-up incoming data $id = sanitize_key($_POST['id']); $name = sanitize_text_field($_POST['name']); $shortcode = sanitize_key($_POST['shortcode']); // Validate and sanitize settings $settings = is_array($_POST['settings']) ? stripslashes_deep($_POST['settings']) : array(); $settings = array_map('wp_kses_post', $settings); // Prepare option name $option = 'su_presets_' . $shortcode; // Get the existing presets $current = get_option($option); // Create array with new preset $new = array( 'id' => $id, 'name' => $name, 'settings' => $settings, ); // Add new array to the option value if (!is_array($current)) $current = array(); $current[$id] = $new; // Save updated option update_option($option, $current); // Clear cache delete_transient('su/generator/settings/' . $shortcode); } public static function ajax_remove_preset() { self::access(); // Check incoming data if (empty($_POST['id'])) return; if (empty($_POST['shortcode'])) return; // Check Nonce if ( empty($_POST['nonce']) || !is_string($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'su_generator_preset') ) { return; } // Clean-up incoming data $id = sanitize_key($_POST['id']); $shortcode = sanitize_key($_POST['shortcode']); // Prepare option name $option = 'su_presets_' . $shortcode; // Get the existing presets $current = get_option($option); // Check that preset is exists if (!is_array($current) || empty($current[$id])) return; // Remove preset unset($current[$id]); // Save updated option update_option($option, $current); // Clear cache delete_transient('su/generator/settings/' . $shortcode); } public static function ajax_get_preset() { self::access(); // Check incoming data if (empty($_GET['id'])) return; if (empty($_GET['shortcode'])) return; // Check Nonce if ( empty($_GET['nonce']) || !is_string($_GET['nonce']) || !wp_verify_nonce($_GET['nonce'], 'su_generator_preset') ) { return; } // Clean-up incoming data $id = sanitize_key($_GET['id']); $shortcode = sanitize_key($_GET['shortcode']); // Default data $data = array(); // Get the existing presets $presets = get_option('su_presets_' . $shortcode); // Check that preset is exists if (is_array($presets) && isset($presets[$id]['settings'])) $data = $presets[$id]['settings']; // Print results die(json_encode($data)); } /** * Helper function to create shortcode code with default settings. * * Example output: "[su_button color="#ff0000" ... ] Click me [/su_button]". * * @param mixed $args Array with settings * @since 5.0.0 * @return string Shortcode code */ public static function get_shortcode_code($args) { $defaults = array( 'id' => '', 'number' => 1, 'nested' => false, ); // Accept shortcode ID as a string if (is_string($args)) { $args = array('id' => $args); } $args = wp_parse_args($args, $defaults); // Check shortcode ID if (empty($args['id'])) { return ''; } // Get shortcode data $shortcode = su_get_shortcode($args['id']); // Prepare shortcode prefix $prefix = get_option('su_option_prefix'); // Prepare attributes container $attributes = ''; // Loop through attributes foreach ($shortcode['atts'] as $attr_id => $attribute) { // Skip hidden attributes if (isset($attribute['hidden']) && $attribute['hidden']) { continue; } // Add attribute $attributes .= sprintf(' %s="%s"', esc_html($attr_id), esc_attr($attribute['default'])); } // Create opening tag with attributes $output = "[{$prefix}{$args['id']}{$attributes}]"; // Indent nested shortcodes if ($args['nested']) { $output = "\t" . $output; } // Insert shortcode content if (isset($shortcode['content'])) { if (is_string($shortcode['content'])) { $output .= $shortcode['content']; } // Create complex content else if (is_array($shortcode['content']) && $args['id'] !== $shortcode['content']['id']) { $shortcode['content']['nested'] = true; $output .= self::get_shortcode_code($shortcode['content']); } } // Add closing tag if (isset($shortcode['type']) && $shortcode['type'] === 'wrap') { $output .= "[/{$prefix}{$args['id']}]"; } // Repeat shortcode if ($args['number'] > 1) { $output = implode("\n", array_fill(0, $args['number'], $output)); } // Add line breaks around nested shortcodes if ($args['nested']) { $output = "\n{$output}\n"; } return $output; } /** * Helper function to check if all available addons were activated. * * @since 5.0.5 * @return boolean True if all addons active, False otherwise. */ public static function is_addons_active() { return false; } /** * Get available shortcodes, skipping deprecated ones. * * @since 5.0.5 * @return array Available shortcodes data. */ public static function get_shortcodes() { $shortcodes = su_get_all_shortcodes(); if (get_option('su_option_hide_deprecated')) { $shortcodes = array_filter( $shortcodes, array(__CLASS__, 'filter_deprecated_shortcodes') ); } return $shortcodes; } public static function get_shortcodes_grouped() { $result = []; $groups = su_get_groups(); $shortcodes = self::get_shortcodes(); foreach ($groups as $group => $group_title) { $group_shortcodes = array_filter($shortcodes, function ($shortcode) use ($group) { return $shortcode['group'] === $group; }); if (count($group_shortcodes)) { $result[$group] = [ 'id' => $group, 'title' => $group_title, 'shortcodes' => $group_shortcodes, ]; } } return $result; } /** * Filter shortcodes and skip deprecated ones. * * @since 5.0.5 * @param array $shortcode A single shortcode data. * @return boolean False if shortcode deprecated, True otherwise. */ public static function filter_deprecated_shortcodes($shortcode) { return !isset($shortcode['deprecated']); } /** * Get list of taxonomies as key-value pairs. * * @since 5.0.5 * @return array List of taxonomies. */ public static function get_taxonomies() { $taxes = array(); foreach ((array) get_taxonomies('', 'objects') as $tax) { $taxes[$tax->name] = $tax->label; } return $taxes; } /** * Get list of terms as key-value pairs. * * @since 5.0.5 * @return array List of terms. */ public static function get_terms($tax = 'category', $key = 'id') { $terms = array(); if ($key === 'id') { foreach ((array) get_terms($tax, array('hide_empty' => false)) as $term) { $terms[$term->term_id] = $term->name; } } elseif ($key === 'slug') { foreach ((array) get_terms($tax, array('hide_empty' => false)) as $term) { $terms[$term->slug] = $term->name; } } return $terms; } } new Su_Generator; class Shortcodes_Ultimate_Generator extends Su_Generator { function __construct() { parent::__construct(); } } PK �;0]��f�) �) core/assets.phpnu �[��� <?php /** * Class for managing plugin assets */ class Su_Assets { /** * Set of queried assets * * @var array */ static $assets = array( 'css' => array(), 'js' => array() ); /** * Constructor */ function __construct() { // Register add_action( 'wp_head', array( __CLASS__, 'register' ) ); add_action( 'admin_head', array( __CLASS__, 'register' ) ); add_action( 'su/generator/preview/before', array( __CLASS__, 'register' ) ); add_action( 'su/examples/preview/before', array( __CLASS__, 'register' ) ); // Enqueue add_action( 'wp_footer', array( __CLASS__, 'enqueue' ) ); add_action( 'admin_footer', array( __CLASS__, 'enqueue' ) ); // Print add_action( 'su/generator/preview/after', array( __CLASS__, 'prnt' ) ); add_action( 'su/examples/preview/after', array( __CLASS__, 'prnt' ) ); // Custom CSS add_action( 'wp_footer', array( __CLASS__, 'custom_css' ), 99 ); add_action( 'su/generator/preview/after', array( __CLASS__, 'custom_css' ), 99 ); add_action( 'su/examples/preview/after', array( __CLASS__, 'custom_css' ), 99 ); // RTL support add_action( 'su/assets/custom_css/after', array( __CLASS__, 'rtl_shortcodes' ) ); } /** * Register assets */ public static function register() { // Chart.js wp_register_script( 'chartjs', plugins_url( 'vendor/chartjs/chart.js', SU_PLUGIN_FILE ), false, '0.2', true ); // SimpleSlider wp_register_script( 'simpleslider', plugins_url( 'vendor/simpleslider/simpleslider.js', SU_PLUGIN_FILE ), array( 'jquery' ), '1.0.0', true ); wp_register_style( 'simpleslider', plugins_url( 'vendor/simpleslider/simpleslider.css', SU_PLUGIN_FILE ), false, '1.0.0', 'all' ); // Owl Carousel wp_register_script( 'owl-carousel', plugins_url( 'vendor/owl-carousel/owl-carousel.js', SU_PLUGIN_FILE ), array( 'jquery' ), '2.3.4', true ); wp_register_style( 'owl-carousel', plugins_url( 'vendor/owl-carousel/owl-carousel.css', SU_PLUGIN_FILE ), false, '2.3.4', 'all' ); // Animate.css wp_register_style( 'animate', plugins_url( 'vendor/animatecss/animate.css', SU_PLUGIN_FILE ), false, '3.1.1', 'all' ); // InView wp_register_script( 'jquery-inview', plugins_url( 'vendor/jquery-inview/jquery-inview.js', SU_PLUGIN_FILE ), array( 'jquery' ), '1.1.2', true ); // PopperJS wp_register_script( 'popper', plugins_url( 'vendor/popper/popper.min.js', SU_PLUGIN_FILE ), array(), '2.9.2', true ); // Magnific Popup wp_register_style( 'magnific-popup', plugins_url( 'vendor/magnific-popup/magnific-popup.css', SU_PLUGIN_FILE ), false, '1.2.0', 'all' ); wp_register_script( 'magnific-popup', plugins_url( 'vendor/magnific-popup/magnific-popup.js', SU_PLUGIN_FILE ), array( 'jquery' ), '1.2.0', true ); // Swiper if ( ! get_option( 'su_option_hide_deprecated' ) ) { wp_register_script( 'swiper', plugins_url( 'vendor/swiper/swiper.js', SU_PLUGIN_FILE ), array( 'jquery' ), '2.6.1', true ); } // Flickity wp_register_script( 'flickity', plugins_url( 'vendor/flickity/flickity.js', SU_PLUGIN_FILE ), array(), '2.2.1', true ); wp_register_style( 'flickity', plugins_url( 'vendor/flickity/flickity.css', SU_PLUGIN_FILE ), array(), '2.2.1', 'all' ); // jPlayer wp_register_script( 'jplayer', plugins_url( 'vendor/jplayer/jplayer.js', SU_PLUGIN_FILE ), array( 'jquery' ), '2.4.0', true ); // Generator wp_register_style( 'su-generator', plugins_url( 'admin/css/generator.css', SU_PLUGIN_FILE ), array( 'farbtastic', 'magnific-popup', 'simpleslider' ), SU_PLUGIN_VERSION, 'all' ); wp_register_script( 'su-generator', plugins_url( 'includes/js/generator/index.js', SU_PLUGIN_FILE ), array( 'farbtastic', 'magnific-popup', 'jquery-ui-sortable', 'simpleslider' ), SU_PLUGIN_VERSION, true ); wp_localize_script( 'su-generator', 'SUGL10n', array( 'upload_title' => __( 'Choose file', 'shortcodes-ultimate' ), 'upload_insert' => __( 'Insert', 'shortcodes-ultimate' ), 'isp_media_title' => __( 'Select images', 'shortcodes-ultimate' ), 'isp_media_insert' => __( 'Add selected images', 'shortcodes-ultimate' ), 'presets_prompt_msg' => __( 'Please enter a name for new preset', 'shortcodes-ultimate' ), 'presets_prompt_value' => __( 'New preset', 'shortcodes-ultimate' ), 'last_used' => __( 'Last used settings', 'shortcodes-ultimate' ), 'remove_selected' => __( 'Remove selected item', 'shortcodes-ultimate' ), ) ); // Shortcodes stylesheets wp_register_style( 'su-shortcodes', plugins_url( 'includes/css/shortcodes.css', SU_PLUGIN_FILE ), false, SU_PLUGIN_VERSION, 'all' ); // Plugin Icons (Fork Awesome) wp_register_style( 'su-icons', plugins_url( 'includes/css/icons.css', SU_PLUGIN_FILE ), false, '1.1.5', 'all' ); // DEPRECATED - Shortcodes stylesheets // wp_register_style( 'su-content-shortcodes', '', false, SU_PLUGIN_VERSION, 'all' ); // wp_register_style( 'su-box-shortcodes', '', false, SU_PLUGIN_VERSION, 'all' ); // wp_register_style( 'su-media-shortcodes', '', false, SU_PLUGIN_VERSION, 'all' ); // wp_register_style( 'su-other-shortcodes', '', false, SU_PLUGIN_VERSION, 'all' ); // wp_register_style( 'su-galleries-shortcodes', '', false, SU_PLUGIN_VERSION, 'all' ); // wp_register_style( 'su-players-shortcodes', '', false, SU_PLUGIN_VERSION, 'all' ); // RTL stylesheets wp_register_style( 'su-rtl-shortcodes', plugins_url( 'includes/css/rtl-shortcodes.css', SU_PLUGIN_FILE ), false, SU_PLUGIN_VERSION, 'all' ); wp_register_style( 'su-rtl-admin', plugins_url( 'admin/css/rtl-admin.css', SU_PLUGIN_FILE ), false, SU_PLUGIN_VERSION, 'all' ); // Shortcodes scripts wp_register_script( 'su-shortcodes', plugins_url( 'includes/js/shortcodes/index.js', SU_PLUGIN_FILE ), array( 'jquery' ), SU_PLUGIN_VERSION, true ); wp_localize_script( 'su-shortcodes', 'SUShortcodesL10n', array( 'noPreview' => __( 'This shortcode doesn\'t work in live preview. Please insert it into editor and preview on the site.', 'shortcodes-ultimate' ), 'magnificPopup' => array( 'close' => __( 'Close (Esc)', 'shortcodes-ultimate' ), 'loading' => __( 'Loading...', 'shortcodes-ultimate' ), 'prev' => __( 'Previous (Left arrow key)', 'shortcodes-ultimate' ), 'next' => __( 'Next (Right arrow key)', 'shortcodes-ultimate' ), // translators: %1$s of %2$s represents image counter in lightbox, will be replaced with "1 of 5" 'counter' => sprintf( __( '%1$s of %2$s', 'shortcodes-ultimate' ), '%curr%', '%total%' ), 'error' => sprintf( // translators: %1$s and %2$s will be replace <a> and </a> tags __( 'Failed to load content. %1$sOpen link%2$s' ), '<a href="%url%" target="_blank"><u>', '</u></a>' ), ), ) ); // Hook to deregister assets or add custom do_action( 'su/assets/register' ); } /** * Enqueue assets */ public static function enqueue() { // Get assets query and plugin object $assets = self::assets(); // Enqueue stylesheets foreach ( $assets['css'] as $style ) wp_enqueue_style( $style ); // Enqueue scripts foreach ( $assets['js'] as $script ) wp_enqueue_script( $script ); // Hook to dequeue assets or add custom do_action( 'su/assets/enqueue', $assets ); } /** * Print assets without enqueuing */ public static function prnt() { // Prepare assets set $assets = self::assets(); // Enqueue stylesheets wp_print_styles( $assets['css'] ); // Enqueue scripts wp_print_scripts( $assets['js'] ); // Hook do_action( 'su/assets/print', $assets ); } /** * Print custom CSS */ public static function custom_css() { // Get custom CSS and apply filters to it $custom_css = (string) apply_filters( 'su/assets/custom_css', get_option( 'su_option_custom-css' ) ); $template = '%1$s<!-- %2$s - %3$s -->%1$s<style type="text/css">%1$s%5$s%1$s</style>%1$s<!-- %2$s - %4$s -->%1$s'; $template = apply_filters( 'su/assets/custom_css/template', $template ); if ( ! empty( $custom_css ) ) { $custom_css = str_replace( array( '%theme_url%', '%home_url%', '%plugin_url%' ), array( trailingslashit( get_stylesheet_directory_uri() ), trailingslashit( get_option( 'home' ) ), trailingslashit( plugins_url( '', SU_PLUGIN_FILE ) ), ), $custom_css ); printf( $template, PHP_EOL, 'Shortcodes Ultimate custom CSS', 'start', 'end', strip_tags( $custom_css ) ); } // Hook do_action( 'su/assets/custom_css/after' ); } /** * RTL support for shortcodes */ public static function rtl_shortcodes( $assets ) { // Check RTL if ( !is_rtl() ) return; // Add RTL stylesheets wp_print_styles( array( 'su-rtl-shortcodes' ) ); } /** * RTL support for admin */ public static function rtl_admin( $assets ) { // Check RTL if ( !is_rtl() ) return; // Add RTL stylesheets self::add( 'css', 'su-rtl-admin' ); } /** * Add asset to the query */ public static function add( $type, $handle ) { // Array with handles if ( is_array( $handle ) ) { foreach ( $handle as $h ) self::$assets[$type][$h] = $h; } // Single handle else self::$assets[$type][$handle] = $handle; } /** * Get queried assets */ public static function assets() { // Get assets query $assets = self::$assets; // Apply filters to assets set $assets['css'] = array_unique( ( array ) apply_filters( 'su/assets/css', ( array ) array_unique( $assets['css'] ) ) ); $assets['js'] = array_unique( ( array ) apply_filters( 'su/assets/js', ( array ) array_unique( $assets['js'] ) ) ); // Return set return $assets; } /** * Helper to get full URL of a skin file */ public static function skin_url( $file = '' ) { $skin = get_option( 'su_option_skin' ); $uploads = wp_upload_dir(); $uploads = $uploads['baseurl']; // Prepare url to skin directory $url = ( !$skin || $skin === 'default' ) ? plugins_url( 'assets/css/', SU_PLUGIN_FILE ) : $uploads . '/shortcodes-ultimate-skins/' . $skin; return trailingslashit( apply_filters( 'su/assets/skin', $url ) ) . $file; } } new Su_Assets; /** * Helper function to add asset to the query * * @param string $type Asset type (css|js) * @param mixed $handle Asset handle or array with handles */ function su_query_asset( $type, $handle ) { Su_Assets::add( $type, $handle ); } /** * Helper function to get current skin url * * @param string $file Asset file name. Example value: box-shortcodes.css */ function su_skin_url( $file ) { return Su_Assets::skin_url( $file ); } PK �;0]A�-~ -~ core/generator-views.phpnu �[��� <?php /** * Shortcode Generator */ class Su_Generator_Views { /** * Constructor */ function __construct() {} public static function text( $id, $field ) { $field = wp_parse_args( $field, array( 'default' => '' ) ); $return = '<input type="text" name="' . $id . '" value="' . esc_attr( $field['default'] ) . '" id="su-generator-attr-' . $id . '" class="su-generator-attr" />'; return $return; } public static function textarea( $id, $field ) { $field = wp_parse_args( $field, array( 'rows' => 3, 'default' => '' ) ); $return = '<textarea name="' . $id . '" id="su-generator-attr-' . $id . '" rows="' . $field['rows'] . '" class="su-generator-attr">' . esc_textarea( $field['default'] ) . '</textarea>'; return $return; } public static function select( $id, $field ) { // Multiple selects $multiple = isset( $field['multiple'] ) && $field['multiple'] ? ' multiple' : ''; $return = '<select name="' . $id . '" id="su-generator-attr-' . $id . '" class="su-generator-attr"' . $multiple . '>'; // Create options foreach ( $field['values'] as $option_value => $option_title ) { // Is this option selected $selected = ( $field['default'] === $option_value ) ? ' selected="selected"' : ''; $is_pro = strpos($option_value, '_PRO-') === 0; $disabled = $is_pro ? ' disabled="disabled"' : ''; // Create option $return .= '<option value="' . $option_value . '"' . $selected . $disabled . '>' . $option_title . '</option>'; } $return .= '</select>'; return $return; } public static function radio( $id, $field ) { $field = wp_parse_args( $field, array( 'default' => '', 'layout' => 'vertical', 'values' => array(), ) ); $options = array(); foreach ( $field['values'] as $option_value => $option_label ) { $option_value = (string) $option_value; if ( is_array( $option_label ) ) { $option_label = isset( $option_label['label'] ) ? $option_label['label'] : $option_value; } $options[ $option_value ] = (string) $option_label; } if ( empty( $options ) ) { return ''; } $default = (string) $field['default']; if ( ! isset( $options[ $default ] ) ) { $default = (string) key( $options ); } $layout = sanitize_key( $field['layout'] ); if ( 'horizontal' !== $layout ) { $layout = 'vertical'; } $return = '<div class="su-generator-radio su-generator-radio-layout-' . esc_attr( $layout ) . '" role="radiogroup">'; $return .= '<input type="hidden" name="' . esc_attr( $id ) . '" value="' . esc_attr( $default ) . '" id="su-generator-attr-' . esc_attr( $id ) . '" class="su-generator-attr su-generator-radio-value" />'; foreach ( $options as $option_value => $option_label ) { $option_id = sanitize_html_class( $id . '-' . $option_value ); if ( '' === $option_id ) { $option_id = md5( $id . '-' . $option_value ); } $is_pro = strpos( $option_value, '_PRO-' ) === 0; $disabled = $is_pro ? ' disabled="disabled"' : ''; $return .= '<label class="su-generator-radio-option" for="su-generator-radio-' . esc_attr( $option_id ) . '">'; $return .= '<input type="radio" name="' . esc_attr( $id . '_radio' ) . '" value="' . esc_attr( $option_value ) . '" id="su-generator-radio-' . esc_attr( $option_id ) . '" class="su-generator-radio-input"' . checked( $default, $option_value, false ) . $disabled . ' />'; $return .= '<span class="su-generator-radio-label">' . esc_html( $option_label ) . '</span>'; $return .= '</label>'; } $return .= '</div>'; return $return; } public static function date_picker( $id, $field ) { return self::picker_input( $id, $field, 'date', 'su-generator-date-picker' ); } public static function datepicker( $id, $field ) { return self::date_picker( $id, $field ); } public static function time_picker( $id, $field ) { return self::picker_input( $id, $field, 'time', 'su-generator-time-picker' ); } public static function timepicker( $id, $field ) { return self::time_picker( $id, $field ); } public static function image_radio( $id, $field ) { $field = wp_parse_args( $field, array( 'default' => '', 'values' => array(), ) ); $options = array(); foreach ( $field['values'] as $option_value => $option ) { $option_value = (string) $option_value; if ( is_array( $option ) ) { $label = isset( $option['label'] ) ? $option['label'] : $option_value; $image = isset( $option['image'] ) ? $option['image'] : ''; $alt = isset( $option['alt'] ) ? $option['alt'] : $label; } else { $label = (string) $option; $image = ''; $alt = $label; } $options[ $option_value ] = array( 'label' => $label, 'image' => $image, 'alt' => $alt, ); } if ( empty( $options ) ) { return ''; } $default = (string) $field['default']; if ( ! isset( $options[ $default ] ) ) { $default = (string) key( $options ); } $return = '<div class="su-generator-image-radio">'; $return .= '<input type="hidden" name="' . esc_attr( $id ) . '" value="' . esc_attr( $default ) . '" id="su-generator-attr-' . esc_attr( $id ) . '" class="su-generator-attr su-generator-image-radio-value" />'; foreach ( $options as $option_value => $option ) { $option_id = sanitize_html_class( $id . '-' . $option_value ); if ( '' === $option_id ) { $option_id = md5( $id . '-' . $option_value ); } $return .= '<label class="su-generator-image-radio-option" for="su-generator-image-radio-' . esc_attr( $option_id ) . '">'; $return .= '<input type="radio" name="' . esc_attr( $id . '_image_radio' ) . '" value="' . esc_attr( $option_value ) . '" id="su-generator-image-radio-' . esc_attr( $option_id ) . '" class="su-generator-image-radio-input"' . checked( $default, $option_value, false ) . ' />'; $return .= '<span class="su-generator-image-radio-card">'; if ( '' !== $option['image'] ) { $return .= '<span class="su-generator-image-radio-image"><img src="' . esc_url( $option['image'] ) . '" alt="' . esc_attr( wp_strip_all_tags( $option['alt'] ) ) . '" /></span>'; } $return .= '<span class="su-generator-image-radio-label">' . esc_html( $option['label'] ) . '</span>'; $return .= '</span>'; $return .= '</label>'; } $return .= '</div>'; return $return; } public static function searchable_select( $id, $field ) { $field = wp_parse_args( $field, array( 'default' => '', 'values' => array(), 'multiple' => false, 'placeholder' => __( 'Search...', 'shortcodes-ultimate' ), 'empty' => __( 'No results found', 'shortcodes-ultimate' ), 'loading' => __( 'Loading...', 'shortcodes-ultimate' ), 'too_short' => '', 'taxonomy_field' => '', 'ajax_action' => '', 'ajax_min_length' => '', 'ajax_delay' => '', ) ); $default = is_array( $field['default'] ) ? implode( ',', $field['default'] ) : (string) $field['default']; $data = array( 'data-multiple="' . esc_attr( $field['multiple'] ? 'true' : 'false' ) . '"', 'data-placeholder="' . esc_attr( $field['placeholder'] ) . '"', 'data-empty="' . esc_attr( $field['empty'] ) . '"', 'data-loading="' . esc_attr( $field['loading'] ) . '"', ); if ( $field['taxonomy_field'] ) { $data[] = 'data-taxonomy-field="' . esc_attr( $field['taxonomy_field'] ) . '"'; } if ( $field['too_short'] ) { $data[] = 'data-too-short="' . esc_attr( $field['too_short'] ) . '"'; } if ( $field['ajax_action'] ) { $data[] = 'data-ajax-action="' . esc_attr( $field['ajax_action'] ) . '"'; } if ( '' !== $field['ajax_min_length'] ) { $data[] = 'data-ajax-min-length="' . esc_attr( $field['ajax_min_length'] ) . '"'; } if ( '' !== $field['ajax_delay'] ) { $data[] = 'data-ajax-delay="' . esc_attr( $field['ajax_delay'] ) . '"'; } $return = '<div class="su-generator-searchable-select" ' . implode( ' ', $data ) . '>'; $return .= '<input type="hidden" name="' . esc_attr( $id ) . '" value="' . esc_attr( $default ) . '" id="su-generator-attr-' . esc_attr( $id ) . '" class="su-generator-attr su-generator-searchable-select-value" />'; $return .= '<div class="su-generator-searchable-select-control">'; $return .= '<span class="su-generator-searchable-select-tokens"></span>'; $return .= '<input type="search" class="su-generator-searchable-select-input" autocomplete="off" spellcheck="false" placeholder="' . esc_attr( $field['placeholder'] ) . '" />'; $return .= '</div>'; $return .= '<div class="su-generator-searchable-select-dropdown" role="listbox">'; if ( is_array( $field['values'] ) ) { foreach ( $field['values'] as $option_value => $option_title ) { $return .= '<button type="button" class="su-generator-searchable-select-option" data-value="' . esc_attr( $option_value ) . '" data-label="' . esc_attr( wp_strip_all_tags( $option_title ) ) . '" role="option">' . esc_html( $option_title ) . '</button>'; } } $return .= '<div class="su-generator-searchable-select-empty">' . esc_html( $field['empty'] ) . '</div>'; $return .= '</div>'; $return .= '</div>'; return $return; } public static function searchable_post_type( $id, $field ) { $types = get_post_types( array(), 'objects', 'or' ); $field['values'] = array( 'any' => __( 'Any post type', 'shortcodes-ultimate' ), ); foreach( $types as $type ) { $field['values'][$type->name] = $type->label; } if ( ! isset( $field['placeholder'] ) ) { $field['placeholder'] = __( 'Search post types', 'shortcodes-ultimate' ); } return self::searchable_select( $id, $field ); } public static function searchable_taxonomy( $id, $field ) { $taxonomies = get_taxonomies( array(), 'objects', 'or' ); $field['values'] = array( 'any' => __( 'Any taxonomy', 'shortcodes-ultimate' ), ); foreach( $taxonomies as $taxonomy ) { $field['values'][$taxonomy->name] = $taxonomy->label; } if ( ! isset( $field['placeholder'] ) ) { $field['placeholder'] = __( 'Search taxonomies', 'shortcodes-ultimate' ); } return self::searchable_select( $id, $field ); } public static function searchable_term( $id, $field ) { if ( empty( $field['values'] ) && ! empty( $field['taxonomy'] ) ) { $field['values'] = Su_Generator::get_terms( $field['taxonomy'] ); } if ( ! isset( $field['placeholder'] ) ) { $field['placeholder'] = __( 'Search terms', 'shortcodes-ultimate' ); } return self::searchable_select( $id, $field ); } public static function searchable_posts( $id, $field ) { $field = wp_parse_args( $field, array( 'multiple' => true, 'ajax_action' => 'su_generator_search_posts', 'ajax_min_length' => 2, 'ajax_delay' => 250, 'placeholder' => __( 'Search content', 'shortcodes-ultimate' ), 'empty' => __( 'No content found', 'shortcodes-ultimate' ), 'too_short' => __( 'Type at least 2 characters to search content', 'shortcodes-ultimate' ), ) ); return self::searchable_select( $id, $field ); } public static function searchable_users( $id, $field ) { $field = wp_parse_args( $field, array( 'multiple' => true, 'ajax_action' => 'su_generator_search_users', 'ajax_min_length' => 2, 'ajax_delay' => 250, 'placeholder' => __( 'Search users', 'shortcodes-ultimate' ), 'empty' => __( 'No users found', 'shortcodes-ultimate' ), 'too_short' => __( 'Type at least 2 characters to search users', 'shortcodes-ultimate' ), ) ); return self::searchable_select( $id, $field ); } public static function sortable_checkboxes( $id, $field ) { $field = wp_parse_args( $field, array( 'default' => '', 'values' => array(), ) ); $default = is_array( $field['default'] ) ? implode( ', ', $field['default'] ) : (string) $field['default']; $selected = array_filter( array_map( 'trim', explode( ',', $default ) ) ); $selected = array_values( array_intersect( $selected, array_keys( $field['values'] ) ) ); $values = array(); foreach ( $selected as $value ) { $values[ $value ] = $field['values'][ $value ]; } foreach ( $field['values'] as $value => $label ) { if ( ! isset( $values[ $value ] ) ) { $values[ $value ] = $label; } } $return = '<div class="su-generator-sortable-checkboxes">'; $return .= '<input type="hidden" name="' . esc_attr( $id ) . '" value="' . esc_attr( $default ) . '" id="su-generator-attr-' . esc_attr( $id ) . '" class="su-generator-attr su-generator-sortable-checkboxes-value" />'; $return .= '<ul class="su-generator-sortable-checkboxes-list">'; foreach ( $values as $option_value => $option_label ) { $option_id = sanitize_html_class( $id . '-' . $option_value ); $checked = in_array( $option_value, $selected, true ) ? ' checked="checked"' : ''; $return .= '<li class="su-generator-sortable-checkboxes-item" data-value="' . esc_attr( $option_value ) . '">'; $return .= '<span class="su-generator-sortable-checkboxes-handle" aria-hidden="true"><i class="sui sui-bars"></i></span>'; $return .= '<label class="su-generator-sortable-checkboxes-label" for="su-generator-sortable-checkboxes-' . esc_attr( $option_id ) . '">'; $return .= '<input type="checkbox" id="su-generator-sortable-checkboxes-' . esc_attr( $option_id ) . '" class="su-generator-sortable-checkboxes-input" value="' . esc_attr( $option_value ) . '"' . $checked . ' />'; $return .= '<span class="su-generator-sortable-checkboxes-text">' . esc_html( $option_label ) . '</span>'; $return .= '</label>'; $return .= '</li>'; } $return .= '</ul>'; $return .= '</div>'; return $return; } public static function post_type( $id, $field ) { // Get post types $types = get_post_types( array(), 'objects', 'or' ); // Prepare empty array for values $field['values'] = array( 'any' => __( 'Any post type', 'shortcodes-ultimate' ), ); // Fill the array foreach( $types as $type ) { $field['values'][$type->name] = $type->label; } // Create select return self::select( $id, $field ); } public static function taxonomy( $id, $field ) { // Get taxonomies $taxonomies = get_taxonomies( array(), 'objects', 'or' ); // Prepare array for values $field['values'] = isset( $field['default'] ) && 'any' === $field['default'] ? array( 'any' => __( 'Any taxonomy', 'shortcodes-ultimate' ) ) : array(); // Fill the array foreach( $taxonomies as $taxonomy ) { $field['values'][$taxonomy->name] = $taxonomy->label; } // Create select return self::select( $id, $field ); } public static function term( $id, $field ) { // Get categories $field['values'] = Su_Generator::get_terms( 'category' ); // Create select return self::select( $id, $field ); } public static function bool( $id, $field ) { $value = ( 'yes' === $field['default'] ) ? 'yes' : 'no'; $checked = ( 'yes' === $value ) ? 'true' : 'false'; $return = '<button type="button" class="su-generator-switch su-generator-switch-' . esc_attr( $value ) . '" role="switch" aria-checked="' . esc_attr( $checked ) . '"><span class="su-generator-switch-track" aria-hidden="true"><span class="su-generator-switch-thumb"></span></span><span class="su-generator-switch-text su-generator-yes">' . __( 'Yes', 'shortcodes-ultimate' ) . '</span><span class="su-generator-switch-text su-generator-no">' . __( 'No', 'shortcodes-ultimate' ) . '</span></button><input type="hidden" name="' . esc_attr( $id ) . '" value="' . esc_attr( $value ) . '" id="su-generator-attr-' . esc_attr( $id ) . '" class="su-generator-attr su-generator-switch-value" />'; return $return; } public static function upload( $id, $field ) { $return = '<input type="text" name="' . $id . '" value="' . esc_attr( $field['default'] ) . '" id="su-generator-attr-' . $id . '" class="su-generator-attr su-generator-upload-value" /><div class="su-generator-field-actions"><a href="javascript:;" class="button su-generator-upload-button"><img src="' . admin_url( '/images/media-button.png' ) . '" alt="' . __( 'Open Media Library', 'shortcodes-ultimate' ) . '" />' . __( 'Open Media Library', 'shortcodes-ultimate' ) . '</a></div>'; return $return; } public static function icon( $id, $field ) { $return = '<input type="text" name="' . $id . '" value="' . esc_attr( $field['default'] ) . '" id="su-generator-attr-' . $id . '" class="su-generator-attr su-generator-icon-picker-value" /><div class="su-generator-field-actions"><a href="javascript:;" class="button su-generator-upload-button su-generator-field-action"><img src="' . admin_url( '/images/media-button.png' ) . '" alt="' . __( 'Open Media Library', 'shortcodes-ultimate' ) . '" />' . __( 'Open Media Library', 'shortcodes-ultimate' ) . '</a> <a href="javascript:;" class="button su-generator-icon-picker-button su-generator-field-action"><img src="' . admin_url( '/images/media-button-other.gif' ) . '" alt="' . __( 'Icon picker', 'shortcodes-ultimate' ) . '" />' . __( 'Icon picker', 'shortcodes-ultimate' ) . '</a></div><div class="su-generator-icon-picker su-generator-clearfix"><input type="text" class="widefat" placeholder="' . __( 'Filter icons', 'shortcodes-ultimate' ) . '" /></div>'; return $return; } public static function color( $id, $field ) { $field = wp_parse_args( $field, array( 'default' => '', 'allow_transparent' => false, ) ); $allow_transparent = ! empty( $field['allow_transparent'] ); $is_transparent = 'transparent' === strtolower( trim( (string) $field['default'] ) ); $classes = array( 'su-generator-select-color' ); if ( $allow_transparent ) { $classes[] = 'su-generator-select-color-allow-transparent'; } $return = '<span class="' . esc_attr( implode( ' ', $classes ) ) . '">'; $return .= '<span class="su-generator-select-color-wheel"></span>'; $return .= '<span class="su-generator-select-color-control">'; $return .= '<input type="text" name="' . esc_attr( $id ) . '" value="' . esc_attr( $field['default'] ) . '" id="su-generator-attr-' . esc_attr( $id ) . '" class="su-generator-attr su-generator-select-color-value" />'; if ( $allow_transparent ) { $return .= '<label class="su-generator-select-color-transparent">'; $return .= '<input type="checkbox" class="su-generator-select-color-transparent-input" aria-controls="su-generator-attr-' . esc_attr( $id ) . '" ' . checked( $is_transparent, true, false ) . ' />'; $return .= '<span class="su-generator-select-color-transparent-label">' . esc_html__( 'Transparent', 'shortcodes-ultimate' ) . '</span>'; $return .= '</label>'; } $return .= '</span>'; $return .= '</span>'; return $return; } public static function number( $id, $field ) { $return = '<input type="number" name="' . $id . '" value="' . esc_attr( $field['default'] ) . '" id="su-generator-attr-' . $id . '" min="' . $field['min'] . '" max="' . $field['max'] . '" step="' . $field['step'] . '" class="su-generator-attr" />'; return $return; } public static function slider( $id, $field ) { $return = '<div class="su-generator-range-picker su-generator-clearfix"><input type="number" name="' . $id . '" value="' . esc_attr( $field['default'] ) . '" id="su-generator-attr-' . $id . '" min="' . $field['min'] . '" max="' . $field['max'] . '" step="' . $field['step'] . '" class="su-generator-attr" /></div>'; return $return; } public static function shadow( $id, $field ) { $defaults = ( $field['default'] === 'none' ) ? array ( '0', '0', '0', '#000000' ) : explode( ' ', str_replace( 'px', '', $field['default'] ) ); $return = '<div class="su-generator-shadow-picker"><span class="su-generator-shadow-picker-field"><input type="number" min="-1000" max="1000" step="1" value="' . $defaults[0] . '" class="su-generator-sp-hoff" /><small>' . __( 'Horizontal offset', 'shortcodes-ultimate' ) . ' (px)</small></span><span class="su-generator-shadow-picker-field"><input type="number" min="-1000" max="1000" step="1" value="' . $defaults[1] . '" class="su-generator-sp-voff" /><small>' . __( 'Vertical offset', 'shortcodes-ultimate' ) . ' (px)</small></span><span class="su-generator-shadow-picker-field"><input type="number" min="-1000" max="1000" step="1" value="' . $defaults[2] . '" class="su-generator-sp-blur" /><small>' . __( 'Blur', 'shortcodes-ultimate' ) . ' (px)</small></span><span class="su-generator-shadow-picker-field su-generator-shadow-picker-color"><span class="su-generator-shadow-picker-color-wheel"></span><input type="text" value="' . $defaults[3] . '" class="su-generator-shadow-picker-color-value" /><small>' . __( 'Color', 'shortcodes-ultimate' ) . '</small></span><input type="hidden" name="' . $id . '" value="' . esc_attr( $field['default'] ) . '" id="su-generator-attr-' . $id . '" class="su-generator-attr" /></div>'; return $return; } public static function border( $id, $field ) { $defaults = ( $field['default'] === 'none' ) ? array ( '0', 'solid', '#000000' ) : explode( ' ', str_replace( 'px', '', $field['default'] ) ); $borders = su_html_dropdown( array( 'options' => su_get_config( 'borders' ), 'class' => 'su-generator-bp-style', 'selected' => $defaults[1] ) ); $return = '<div class="su-generator-border-picker"><span class="su-generator-border-picker-field"><input type="number" min="-1000" max="1000" step="1" value="' . $defaults[0] . '" class="su-generator-bp-width" /><small>' . __( 'Border width', 'shortcodes-ultimate' ) . ' (px)</small></span><span class="su-generator-border-picker-field">' . $borders . '<small>' . __( 'Border style', 'shortcodes-ultimate' ) . '</small></span><span class="su-generator-border-picker-field su-generator-border-picker-color"><span class="su-generator-border-picker-color-wheel"></span><input type="text" value="' . $defaults[2] . '" class="su-generator-border-picker-color-value" /><small>' . __( 'Border color', 'shortcodes-ultimate' ) . '</small></span><input type="hidden" name="' . $id . '" value="' . esc_attr( $field['default'] ) . '" id="su-generator-attr-' . $id . '" class="su-generator-attr" /></div>'; return $return; } public static function border_new( $id, $field ) { $field = wp_parse_args( $field, array( 'default' => '1px solid #000000', ) ); $defaults = self::parse_border_new_value( $field['default'] ); $styles = su_get_config( 'borders', array( 'solid' => __( 'Solid', 'shortcodes-ultimate' ), 'dotted' => __( 'Dotted', 'shortcodes-ultimate' ), 'dashed' => __( 'Dashed', 'shortcodes-ultimate' ), 'double' => __( 'Double', 'shortcodes-ultimate' ), 'groove' => __( 'Groove', 'shortcodes-ultimate' ), 'ridge' => __( 'Ridge', 'shortcodes-ultimate' ), ) ); unset( $styles['none'] ); if ( empty( $styles ) ) { $styles = array( 'solid' => __( 'Solid', 'shortcodes-ultimate' ), 'dotted' => __( 'Dotted', 'shortcodes-ultimate' ), 'dashed' => __( 'Dashed', 'shortcodes-ultimate' ), 'double' => __( 'Double', 'shortcodes-ultimate' ), 'groove' => __( 'Groove', 'shortcodes-ultimate' ), 'ridge' => __( 'Ridge', 'shortcodes-ultimate' ), ); } if ( ! isset( $styles[ $defaults['style'] ] ) ) { $defaults['style'] = 'solid'; } $width_options = ''; $style_options = ''; $popover_id = 'su-generator-border-new-popover-' . sanitize_html_class( $id ); foreach ( range( 0, 15 ) as $width ) { $value = $width . 'px'; $width_options .= '<option value="' . esc_attr( $value ) . '"' . selected( $defaults['width'], $value, false ) . '>' . esc_html( $value ) . '</option>'; } foreach ( $styles as $style_value => $style_label ) { $style_options .= '<option value="' . esc_attr( $style_value ) . '"' . selected( $defaults['style'], $style_value, false ) . '>' . esc_html( $style_label ) . '</option>'; } $return = '<div class="su-generator-border-new">'; $return .= '<select class="su-generator-border-new-width" aria-label="' . esc_attr__( 'Border width', 'shortcodes-ultimate' ) . '">' . $width_options . '</select>'; $return .= '<select class="su-generator-border-new-style" aria-label="' . esc_attr__( 'Border style', 'shortcodes-ultimate' ) . '">' . $style_options . '</select>'; $return .= '<div class="su-generator-border-new-color">'; $return .= '<button type="button" class="button su-generator-border-new-color-button" aria-expanded="false" aria-controls="' . esc_attr( $popover_id ) . '">'; $return .= '<span class="su-generator-border-new-color-swatch"><span class="su-generator-border-new-color-swatch-color" style="background-color:' . esc_attr( $defaults['css_color'] ) . '"></span></span>'; $return .= '<span class="su-generator-border-new-color-label">' . esc_html( $defaults['label'] ) . '</span>'; $return .= '</button>'; $return .= '<div id="' . esc_attr( $popover_id ) . '" class="su-generator-border-new-popover" hidden>'; $return .= '<div class="su-generator-border-new-color-wheel"></div>'; $return .= '<label class="su-generator-border-new-color-field"><span>' . esc_html__( 'Color', 'shortcodes-ultimate' ) . '</span><input type="text" class="su-generator-border-new-color-value" value="' . esc_attr( $defaults['hex'] ) . '" /></label>'; $return .= '<label class="su-generator-border-new-alpha-field"><span>' . esc_html__( 'Opacity', 'shortcodes-ultimate' ) . '</span><input type="range" min="0" max="100" step="1" class="su-generator-border-new-alpha-range" value="' . esc_attr( $defaults['alpha'] ) . '" /><input type="number" min="0" max="100" step="1" class="su-generator-border-new-alpha-value" value="' . esc_attr( $defaults['alpha'] ) . '" /></label>'; $return .= '</div>'; $return .= '</div>'; $return .= '<input type="hidden" name="' . esc_attr( $id ) . '" value="' . esc_attr( $field['default'] ) . '" id="su-generator-attr-' . esc_attr( $id ) . '" class="su-generator-attr su-generator-border-new-value" />'; $return .= '</div>'; return $return; } public static function image_source( $id, $field ) { $field = wp_parse_args( $field, array( 'default' => 'none' ) ); if ( ! isset( $field['media_sources'] ) ) { $field['media_sources'] = array( 'media' => __( 'Media library', 'shortcodes-ultimate' ), 'posts: recent' => __( 'Recent posts', 'shortcodes-ultimate' ), 'taxonomy' => __( 'Taxonomy', 'shortcodes-ultimate' ), ); } $sources = su_html_dropdown( array( 'options' => $field['media_sources'], 'selected' => '0', 'none' => __( 'Select images source', 'shortcodes-ultimate' ) . '…', 'class' => 'su-generator-isp-sources' ) ); $categories = su_html_dropdown( array( 'options' => Su_Generator::get_terms( 'category' ), 'multiple' => true, 'size' => 10, 'class' => 'su-generator-isp-categories' ) ); $taxonomies = su_html_dropdown( array( 'options' => Su_Generator::get_taxonomies(), 'none' => __( 'Select taxonomy', 'shortcodes-ultimate' ) . '…', 'selected' => '0', 'class' => 'su-generator-isp-taxonomies' ) ); $terms = su_html_dropdown( array( 'class' => 'su-generator-isp-terms', 'multiple' => true, 'size' => 10, 'disabled' => true, 'style' => 'display:none' ) ); $return = '<div class="su-generator-isp">' . $sources . '<div class="su-generator-isp-source su-generator-isp-source-media"><div class="su-generator-clearfix"><a href="javascript:;" class="button button-primary su-generator-isp-add-media"><i class="sui sui-plus"></i> ' . __( 'Add images', 'shortcodes-ultimate' ) . '</a></div><div class="su-generator-isp-images su-generator-clearfix"><em class="description">' . __( 'Click the button above and select images.<br>You can select multimple images with Ctrl (Cmd) key', 'shortcodes-ultimate' ) . '</em></div></div><div class="su-generator-isp-source su-generator-isp-source-category"><em class="description">' . __( 'Select categories to retrieve posts from.<br>You can select multiple categories with Ctrl (Cmd) key', 'shortcodes-ultimate' ) . '</em>' . $categories . '</div><div class="su-generator-isp-source su-generator-isp-source-taxonomy"><em class="description">' . __( 'Select taxonomy and it\'s terms.<br>You can select multiple terms with Ctrl (Cmd) key', 'shortcodes-ultimate' ) . '</em>' . $taxonomies . $terms . '</div><input type="hidden" name="' . $id . '" value="' . $field['default'] . '" id="su-generator-attr-' . $id . '" class="su-generator-attr" /></div>'; return $return; } public static function extra_css_class( $id, $field ) { $field = wp_parse_args( $field, array( 'default' => '' ) ); $return = '<input type="text" name="' . $id . '" value="' . esc_attr( $field['default'] ) . '" id="su-generator-attr-' . $id . '" class="su-generator-attr" />'; return $return; } private static function picker_input( $id, $field, $type, $class ) { $field = wp_parse_args( $field, array( 'default' => '', 'max' => '', 'min' => '', 'placeholder' => '', 'step' => '', ) ); $attributes = array( 'type="' . esc_attr( $type ) . '"', 'name="' . esc_attr( $id ) . '"', 'value="' . esc_attr( $field['default'] ) . '"', 'id="su-generator-attr-' . esc_attr( $id ) . '"', 'class="su-generator-attr ' . esc_attr( $class ) . '"', ); foreach ( array( 'min', 'max', 'step', 'placeholder' ) as $attribute ) { if ( '' !== (string) $field[ $attribute ] ) { $attributes[] = $attribute . '="' . esc_attr( $field[ $attribute ] ) . '"'; } } return '<input ' . implode( ' ', $attributes ) . ' />'; } private static function parse_border_new_value( $value ) { $parsed = array( 'width' => '1px', 'style' => 'solid', 'hex' => '#000000', 'alpha' => 100, 'css_color' => '#000000', 'label' => '#000000', ); $value = trim( (string) $value ); if ( 'none' === strtolower( $value ) ) { $parsed['width'] = '0px'; $parsed['alpha'] = 0; } elseif ( preg_match( '/^(\d+(?:\.\d+)?)px\s+([a-z-]+)\s+(.+)$/i', $value, $matches ) ) { $width = intval( $matches[1] ); if ( $width >= 0 && $width <= 15 ) { $parsed['width'] = $width . 'px'; } $parsed['style'] = sanitize_key( $matches[2] ); $color = self::parse_border_new_color( $matches[3] ); $parsed['hex'] = $color['hex']; $parsed['alpha'] = $color['alpha']; } $parsed['css_color'] = self::format_border_new_color( $parsed['hex'], $parsed['alpha'] ); $parsed['label'] = $parsed['css_color']; return $parsed; } private static function parse_border_new_color( $value ) { $value = trim( (string) $value ); if ( 'transparent' === strtolower( $value ) ) { return array( 'hex' => '#000000', 'alpha' => 0, ); } if ( preg_match( '/^#?([a-f0-9]{3}|[a-f0-9]{6})$/i', $value, $matches ) ) { $hex = strtolower( $matches[1] ); if ( 3 === strlen( $hex ) ) { $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; } return array( 'hex' => '#' . $hex, 'alpha' => 100, ); } if ( preg_match( '/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*([0-9.]+)\s*)?\)$/i', $value, $matches ) ) { $red = max( 0, min( 255, intval( $matches[1] ) ) ); $green = max( 0, min( 255, intval( $matches[2] ) ) ); $blue = max( 0, min( 255, intval( $matches[3] ) ) ); $alpha = isset( $matches[4] ) && '' !== $matches[4] ? max( 0, min( 1, floatval( $matches[4] ) ) ) : 1; return array( 'hex' => sprintf( '#%02x%02x%02x', $red, $green, $blue ), 'alpha' => (int) round( $alpha * 100 ), ); } return array( 'hex' => '#000000', 'alpha' => 100, ); } private static function format_border_new_color( $hex, $alpha ) { $alpha = max( 0, min( 100, intval( $alpha ) ) ); if ( $alpha >= 100 ) { return $hex; } $hex = ltrim( $hex, '#' ); $red = hexdec( substr( $hex, 0, 2 ) ); $green = hexdec( substr( $hex, 2, 2 ) ); $blue = hexdec( substr( $hex, 4, 2 ) ); $value = rtrim( rtrim( sprintf( '%.2F', $alpha / 100 ), '0' ), '.' ); return sprintf( 'rgba(%d,%d,%d,%s)', $red, $green, $blue, $value ); } } PK <0]��� � icon-functions.phpnu �[��� <?php /** * SVG icons related functions * * @package WordPress * @subpackage Twenty_Nineteen * @since Twenty Nineteen 1.0 */ /** * Gets the SVG code for a given icon. */ function twentynineteen_get_icon_svg( $icon, $size = 24 ) { return TwentyNineteen_SVG_Icons::get_svg( 'ui', $icon, $size ); } /** * Gets the SVG code for a given social icon. */ function twentynineteen_get_social_icon_svg( $icon, $size = 24 ) { return TwentyNineteen_SVG_Icons::get_svg( 'social', $icon, $size ); } /** * Detects the social network from a URL and returns the SVG code for its icon. */ function twentynineteen_get_social_link_svg( $uri, $size = 24 ) { return TwentyNineteen_SVG_Icons::get_social_link_svg( $uri, $size ); } /** * Display SVG icons in social links menu. * * @param string $item_output The menu item's starting HTML output. * @param WP_Post $item Menu item data object. * @param int $depth Depth of the menu. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. * @return string The menu item output with social icon. */ function twentynineteen_nav_menu_social_icons( $item_output, $item, $depth, $args ) { // Change SVG icon inside social links menu if there is supported URL. if ( 'social' === $args->theme_location ) { $svg = twentynineteen_get_social_link_svg( $item->url, 26 ); if ( empty( $svg ) ) { $svg = twentynineteen_get_icon_svg( 'link' ); } $item_output = str_replace( $args->link_after, '</span>' . $svg, $item_output ); } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'twentynineteen_nav_menu_social_icons', 10, 4 ); /** * Add a dropdown icon to top-level menu items. * * @param string $item_output The menu item's starting HTML output. * @param WP_Post $item Menu item data object. * @param int $depth Depth of the menu. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. * @return string Nav menu item start element. */ function twentynineteen_add_dropdown_icons( $item_output, $item, $depth, $args ) { // Only add class to 'top level' items on the 'primary' menu. if ( ! isset( $args->theme_location ) || 'menu-1' !== $args->theme_location ) { return $item_output; } if ( in_array( 'mobile-parent-nav-menu-item', $item->classes, true ) && isset( $item->original_id ) ) { // Inject the keyboard_arrow_left SVG inside the parent nav menu item, and let the item link to the parent item. // @todo Only do this for nested submenus? If on a first-level submenu, then really the link could be "#" since the desire is to remove the target entirely. $link = sprintf( '<button class="menu-item-link-return" tabindex="-1">%s', twentynineteen_get_icon_svg( 'chevron_left', 24 ) ); // Replace opening <a> with <button>. $item_output = preg_replace( '/<a\s.*?>/', $link, $item_output, 1 // Limit. ); // Replace closing </a> with </button>. $item_output = preg_replace( '#</a>#i', '</button>', $item_output, 1 // Limit. ); } elseif ( in_array( 'menu-item-has-children', $item->classes, true ) ) { // Add SVG icon to parent items. $icon = twentynineteen_get_icon_svg( 'keyboard_arrow_down', 24 ); $item_output .= sprintf( '<button class="submenu-expand" tabindex="-1">%s</button>', $icon ); } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'twentynineteen_add_dropdown_icons', 10, 4 ); PK <0]���W �W template-tags.phpnu �[��� <?php /** * Custom template tags for this theme. * * @package WordPress * @subpackage Twenty_Twenty * @since Twenty Twenty 1.0 */ /** * Table of Contents: * Logo & Description * Comments * Post Meta * Menus * Classes * Archives * Miscellaneous */ /** * Logo & Description */ /** * Displays the site logo, either text or image. * * @param array $args Arguments for displaying the site logo either as an image or text. * @param boolean $echo Echo or return the HTML. * @return string Compiled HTML based on our arguments. */ function twentytwenty_site_logo( $args = array(), $echo = true ) { $logo = get_custom_logo(); $site_title = get_bloginfo( 'name' ); $contents = ''; $classname = ''; $defaults = array( 'logo' => '%1$s<span class="screen-reader-text">%2$s</span>', 'logo_class' => 'site-logo', 'title' => '<a href="%1$s">%2$s</a>', 'title_class' => 'site-title', 'home_wrap' => '<h1 class="%1$s">%2$s</h1>', 'single_wrap' => '<div class="%1$s faux-heading">%2$s</div>', 'condition' => ( is_front_page() || is_home() ) && ! is_page(), ); $args = wp_parse_args( $args, $defaults ); /** * Filters the arguments for `twentytwenty_site_logo()`. * * @param array $args Parsed arguments. * @param array $defaults Function's default arguments. */ $args = apply_filters( 'twentytwenty_site_logo_args', $args, $defaults ); if ( has_custom_logo() ) { $contents = sprintf( $args['logo'], $logo, esc_html( $site_title ) ); $classname = $args['logo_class']; } else { $contents = sprintf( $args['title'], esc_url( get_home_url( null, '/' ) ), esc_html( $site_title ) ); $classname = $args['title_class']; } $wrap = $args['condition'] ? 'home_wrap' : 'single_wrap'; $html = sprintf( $args[ $wrap ], $classname, $contents ); /** * Filters the arguments for `twentytwenty_site_logo()`. * * @param string $html Compiled HTML based on our arguments. * @param array $args Parsed arguments. * @param string $classname Class name based on current view, home or single. * @param string $contents HTML for site title or logo. */ $html = apply_filters( 'twentytwenty_site_logo', $html, $args, $classname, $contents ); if ( ! $echo ) { return $html; } echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Displays the site description. * * @param boolean $echo Echo or return the html. * @return string The HTML to display. */ function twentytwenty_site_description( $echo = true ) { $description = get_bloginfo( 'description' ); if ( ! $description ) { return; } $wrapper = '<div class="site-description">%s</div><!-- .site-description -->'; $html = sprintf( $wrapper, esc_html( $description ) ); /** * Filters the HTML for the site description. * * @since Twenty Twenty 1.0 * * @param string $html The HTML to display. * @param string $description Site description via `bloginfo()`. * @param string $wrapper The format used in case you want to reuse it in a `sprintf()`. */ $html = apply_filters( 'twentytwenty_site_description', $html, $description, $wrapper ); if ( ! $echo ) { return $html; } echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Comments */ /** * Checks if the specified comment is written by the author of the post commented on. * * @param object $comment Comment data. * @return bool */ function twentytwenty_is_comment_by_post_author( $comment = null ) { if ( is_object( $comment ) && $comment->user_id > 0 ) { $user = get_userdata( $comment->user_id ); $post = get_post( $comment->comment_post_ID ); if ( ! empty( $user ) && ! empty( $post ) ) { return $comment->user_id === $post->post_author; } } return false; } /** * Filters comment reply link to not JS scroll. * * Filter the comment reply link to add a class indicating it should not use JS slow-scroll, as it * makes it scroll to the wrong position on the page. * * @param string $link Link to the top of the page. * @return string Link to the top of the page. */ function twentytwenty_filter_comment_reply_link( $link ) { $link = str_replace( 'class=\'', 'class=\'do-not-scroll ', $link ); return $link; } add_filter( 'comment_reply_link', 'twentytwenty_filter_comment_reply_link' ); /** * Post Meta */ /** * Retrieves and displays the post meta. * * If it's a single post, outputs the post meta values specified in the Customizer settings. * * @param int $post_id The ID of the post for which the post meta should be output. * @param string $location Which post meta location to output – single or preview. */ function twentytwenty_the_post_meta( $post_id = null, $location = 'single-top' ) { echo twentytwenty_get_post_meta( $post_id, $location ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in twentytwenty_get_post_meta(). } /** * Filters the edit post link to add an icon and use the post meta structure. * * @param string $link Anchor tag for the edit link. * @param int $post_id Post ID. * @param string $text Anchor text. */ function twentytwenty_edit_post_link( $link, $post_id, $text ) { if ( is_admin() ) { return $link; } $edit_url = get_edit_post_link( $post_id ); if ( ! $edit_url ) { return; } $text = sprintf( wp_kses( /* translators: %s: Post title. Only visible to screen readers. */ __( 'Edit <span class="screen-reader-text">%s</span>', 'twentytwenty' ), array( 'span' => array( 'class' => array(), ), ) ), get_the_title( $post_id ) ); return '<div class="post-meta-wrapper post-meta-edit-link-wrapper"><ul class="post-meta"><li class="post-edit meta-wrapper"><span class="meta-icon">' . twentytwenty_get_theme_svg( 'edit' ) . '</span><span class="meta-text"><a href="' . esc_url( $edit_url ) . '">' . $text . '</a></span></li></ul><!-- .post-meta --></div><!-- .post-meta-wrapper -->'; } add_filter( 'edit_post_link', 'twentytwenty_edit_post_link', 10, 3 ); /** * Retrieves the post meta. * * @param int $post_id The ID of the post. * @param string $location The location where the meta is shown. */ function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' ) { // Require post ID. if ( ! $post_id ) { return; } /** * Filters post types array. * * This filter can be used to hide post meta information of post, page or custom post type * registered by child themes or plugins. * * @since Twenty Twenty 1.0 * * @param array Array of post types */ $disallowed_post_types = apply_filters( 'twentytwenty_disallowed_post_types_for_meta_output', array( 'page' ) ); // Check whether the post type is allowed to output post meta. if ( in_array( get_post_type( $post_id ), $disallowed_post_types, true ) ) { return; } $post_meta_wrapper_classes = ''; $post_meta_classes = ''; // Get the post meta settings for the location specified. if ( 'single-top' === $location ) { /** * Filters post meta info visibility. * * Use this filter to hide post meta information like Author, Post date, Comments, Is sticky status. * * @since Twenty Twenty 1.0 * * @param array $args { * @type string 'author' * @type string 'post-date' * @type string 'comments' * @type string 'sticky' * } */ $post_meta = apply_filters( 'twentytwenty_post_meta_location_single_top', array( 'author', 'post-date', 'comments', 'sticky', ) ); $post_meta_wrapper_classes = ' post-meta-single post-meta-single-top'; } elseif ( 'single-bottom' === $location ) { /** * Filters post tags visibility. * * Use this filter to hide post tags. * * @since Twenty Twenty 1.0 * * @param array $args { * @type string 'tags' * } */ $post_meta = apply_filters( 'twentytwenty_post_meta_location_single_bottom', array( 'tags', ) ); $post_meta_wrapper_classes = ' post-meta-single post-meta-single-bottom'; } // If the post meta setting has the value 'empty', it's explicitly empty and the default post meta shouldn't be output. if ( $post_meta && ! in_array( 'empty', $post_meta, true ) ) { // Make sure we don't output an empty container. $has_meta = false; global $post; $the_post = get_post( $post_id ); setup_postdata( $the_post ); ob_start(); ?> <div class="post-meta-wrapper<?php echo esc_attr( $post_meta_wrapper_classes ); ?>"> <ul class="post-meta<?php echo esc_attr( $post_meta_classes ); ?>"> <?php /** * Fires before post meta HTML display. * * Allow output of additional post meta info to be added by child themes and plugins. * * @since Twenty Twenty 1.0 * @since Twenty Twenty 1.1 Added the `$post_meta` and `$location` parameters. * * @param int $post_id Post ID. * @param array $post_meta An array of post meta information. * @param string $location The location where the meta is shown. * Accepts 'single-top' or 'single-bottom'. */ do_action( 'twentytwenty_start_of_post_meta_list', $post_id, $post_meta, $location ); // Author. if ( post_type_supports( get_post_type( $post_id ), 'author' ) && in_array( 'author', $post_meta, true ) ) { $has_meta = true; ?> <li class="post-author meta-wrapper"> <span class="meta-icon"> <span class="screen-reader-text"><?php _e( 'Post author', 'twentytwenty' ); ?></span> <?php twentytwenty_the_theme_svg( 'user' ); ?> </span> <span class="meta-text"> <?php printf( /* translators: %s: Author name. */ __( 'By %s', 'twentytwenty' ), '<a href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author_meta( 'display_name' ) ) . '</a>' ); ?> </span> </li> <?php } // Post date. if ( in_array( 'post-date', $post_meta, true ) ) { $has_meta = true; ?> <li class="post-date meta-wrapper"> <span class="meta-icon"> <span class="screen-reader-text"><?php _e( 'Post date', 'twentytwenty' ); ?></span> <?php twentytwenty_the_theme_svg( 'calendar' ); ?> </span> <span class="meta-text"> <a href="<?php the_permalink(); ?>"><?php the_time( get_option( 'date_format' ) ); ?></a> </span> </li> <?php } // Categories. if ( in_array( 'categories', $post_meta, true ) && has_category() ) { $has_meta = true; ?> <li class="post-categories meta-wrapper"> <span class="meta-icon"> <span class="screen-reader-text"><?php _e( 'Categories', 'twentytwenty' ); ?></span> <?php twentytwenty_the_theme_svg( 'folder' ); ?> </span> <span class="meta-text"> <?php _ex( 'In', 'A string that is output before one or more categories', 'twentytwenty' ); ?> <?php the_category( ', ' ); ?> </span> </li> <?php } // Tags. if ( in_array( 'tags', $post_meta, true ) && has_tag() ) { $has_meta = true; ?> <li class="post-tags meta-wrapper"> <span class="meta-icon"> <span class="screen-reader-text"><?php _e( 'Tags', 'twentytwenty' ); ?></span> <?php twentytwenty_the_theme_svg( 'tag' ); ?> </span> <span class="meta-text"> <?php the_tags( '', ', ', '' ); ?> </span> </li> <?php } // Comments link. if ( in_array( 'comments', $post_meta, true ) && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { $has_meta = true; ?> <li class="post-comment-link meta-wrapper"> <span class="meta-icon"> <?php twentytwenty_the_theme_svg( 'comment' ); ?> </span> <span class="meta-text"> <?php comments_popup_link(); ?> </span> </li> <?php } // Sticky. if ( in_array( 'sticky', $post_meta, true ) && is_sticky() ) { $has_meta = true; ?> <li class="post-sticky meta-wrapper"> <span class="meta-icon"> <?php twentytwenty_the_theme_svg( 'bookmark' ); ?> </span> <span class="meta-text"> <?php _e( 'Sticky post', 'twentytwenty' ); ?> </span> </li> <?php } /** * Fires after post meta HTML display. * * Allow output of additional post meta info to be added by child themes and plugins. * * @since Twenty Twenty 1.0 * @since Twenty Twenty 1.1 Added the `$post_meta` and `$location` parameters. * * @param int $post_id Post ID. * @param array $post_meta An array of post meta information. * @param string $location The location where the meta is shown. * Accepts 'single-top' or 'single-bottom'. */ do_action( 'twentytwenty_end_of_post_meta_list', $post_id, $post_meta, $location ); ?> </ul><!-- .post-meta --> </div><!-- .post-meta-wrapper --> <?php wp_reset_postdata(); $meta_output = ob_get_clean(); // If there is meta to output, return it. if ( $has_meta && $meta_output ) { return $meta_output; } } } /** * Menus */ /** * Filters classes of wp_list_pages items to match menu items. * * Filter the class applied to wp_list_pages() items with children to match the menu class, to simplify. * styling of sub levels in the fallback. Only applied if the match_menu_classes argument is set. * * @param string[] $css_class An array of CSS classes to be applied to each list item. * @param WP_Post $page Page data object. * @param int $depth Depth of page, used for padding. * @param array $args An array of arguments. * @param int $current_page ID of the current page. * @return array CSS class names. */ function twentytwenty_filter_wp_list_pages_item_classes( $css_class, $page, $depth, $args, $current_page ) { // Only apply to wp_list_pages() calls with match_menu_classes set to true. $match_menu_classes = isset( $args['match_menu_classes'] ); if ( ! $match_menu_classes ) { return $css_class; } // Add current menu item class. if ( in_array( 'current_page_item', $css_class, true ) ) { $css_class[] = 'current-menu-item'; } // Add menu item has children class. if ( in_array( 'page_item_has_children', $css_class, true ) ) { $css_class[] = 'menu-item-has-children'; } return $css_class; } add_filter( 'page_css_class', 'twentytwenty_filter_wp_list_pages_item_classes', 10, 5 ); /** * Adds a Sub Nav Toggle to the Expanded Menu and Mobile Menu. * * @param stdClass $args An object of wp_nav_menu() arguments. * @param WP_Post $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @return stdClass An object of wp_nav_menu() arguments. */ function twentytwenty_add_sub_toggles_to_main_menu( $args, $item, $depth ) { // Add sub menu toggles to the Expanded Menu with toggles. if ( isset( $args->show_toggles ) && $args->show_toggles ) { // Wrap the menu item link contents in a div, used for positioning. $args->before = '<div class="ancestor-wrapper">'; $args->after = ''; // Add a toggle to items with children. if ( in_array( 'menu-item-has-children', $item->classes, true ) ) { $toggle_target_string = '.menu-modal .menu-item-' . $item->ID . ' > .sub-menu'; $toggle_duration = twentytwenty_toggle_duration(); // Add the sub menu toggle. $args->after .= '<button class="toggle sub-menu-toggle fill-children-current-color" data-toggle-target="' . $toggle_target_string . '" data-toggle-type="slidetoggle" data-toggle-duration="' . absint( $toggle_duration ) . '" aria-expanded="false"><span class="screen-reader-text">' . __( 'Show sub menu', 'twentytwenty' ) . '</span>' . twentytwenty_get_theme_svg( 'chevron-down' ) . '</button>'; } // Close the wrapper. $args->after .= '</div><!-- .ancestor-wrapper -->'; // Add sub menu icons to the primary menu without toggles. } elseif ( 'primary' === $args->theme_location ) { if ( in_array( 'menu-item-has-children', $item->classes, true ) ) { $args->after = '<span class="icon"></span>'; } else { $args->after = ''; } } return $args; } add_filter( 'nav_menu_item_args', 'twentytwenty_add_sub_toggles_to_main_menu', 10, 3 ); /** * Displays SVG icons in social links menu. * * @param string $item_output The menu item's starting HTML output. * @param WP_Post $item Menu item data object. * @param int $depth Depth of the menu. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. * @return string The menu item output with social icon. */ function twentytwenty_nav_menu_social_icons( $item_output, $item, $depth, $args ) { // Change SVG icon inside social links menu if there is supported URL. if ( 'social' === $args->theme_location ) { $svg = TwentyTwenty_SVG_Icons::get_social_link_svg( $item->url ); if ( empty( $svg ) ) { $svg = twentytwenty_get_theme_svg( 'link' ); } $item_output = str_replace( $args->link_after, '</span>' . $svg, $item_output ); } return $item_output; } add_filter( 'walker_nav_menu_start_el', 'twentytwenty_nav_menu_social_icons', 10, 4 ); /** * Classes */ /** * Adds 'no-js' class. * * If we're missing JavaScript support, the HTML element will have a 'no-js' class. */ function twentytwenty_no_js_class() { ?> <script>document.documentElement.className = document.documentElement.className.replace( 'no-js', 'js' );</script> <?php } add_action( 'wp_head', 'twentytwenty_no_js_class' ); /** * Adds conditional body classes. * * @param array $classes Classes added to the body tag. * @return array Classes added to the body tag. */ function twentytwenty_body_classes( $classes ) { global $post; $post_type = isset( $post ) ? $post->post_type : false; // Check whether we're singular. if ( is_singular() ) { $classes[] = 'singular'; } // Check whether the current page should have an overlay header. if ( is_page_template( array( 'templates/template-cover.php' ) ) ) { $classes[] = 'overlay-header'; } // Check whether the current page has full-width content. if ( is_page_template( array( 'templates/template-full-width.php' ) ) ) { $classes[] = 'has-full-width-content'; } // Check for enabled search. if ( true === get_theme_mod( 'enable_header_search', true ) ) { $classes[] = 'enable-search-modal'; } // Check for post thumbnail. if ( is_singular() && has_post_thumbnail() ) { $classes[] = 'has-post-thumbnail'; } elseif ( is_singular() ) { $classes[] = 'missing-post-thumbnail'; } // Check whether we're in the customizer preview. if ( is_customize_preview() ) { $classes[] = 'customizer-preview'; } // Check if posts have single pagination. if ( is_single() && ( get_next_post() || get_previous_post() ) ) { $classes[] = 'has-single-pagination'; } else { $classes[] = 'has-no-pagination'; } // Check if we're showing comments. if ( $post && ( ( 'post' === $post_type || comments_open() || get_comments_number() ) && ! post_password_required() ) ) { $classes[] = 'showing-comments'; } else { $classes[] = 'not-showing-comments'; } // Check if avatars are visible. $classes[] = get_option( 'show_avatars' ) ? 'show-avatars' : 'hide-avatars'; // Slim page template class names (class = name - file suffix). if ( is_page_template() ) { $classes[] = basename( get_page_template_slug(), '.php' ); } // Check for the elements output in the top part of the footer. $has_footer_menu = has_nav_menu( 'footer' ); $has_social_menu = has_nav_menu( 'social' ); $has_sidebar_1 = is_active_sidebar( 'sidebar-1' ); $has_sidebar_2 = is_active_sidebar( 'sidebar-2' ); // Add a class indicating whether those elements are output. if ( $has_footer_menu || $has_social_menu || $has_sidebar_1 || $has_sidebar_2 ) { $classes[] = 'footer-top-visible'; } else { $classes[] = 'footer-top-hidden'; } // Get header/footer background color. $header_footer_background = get_theme_mod( 'header_footer_background_color', '#ffffff' ); $header_footer_background = strtolower( '#' . ltrim( $header_footer_background, '#' ) ); // Get content background color. $background_color = get_theme_mod( 'background_color', 'f5efe0' ); $background_color = strtolower( '#' . ltrim( $background_color, '#' ) ); // Add extra class if main background and header/footer background are the same color. if ( $background_color === $header_footer_background ) { $classes[] = 'reduced-spacing'; } return $classes; } add_filter( 'body_class', 'twentytwenty_body_classes' ); /** * Archives */ /** * Filters the archive title and styles the word before the first colon. * * @param string $title Current archive title. * @return string Current archive title. */ function twentytwenty_get_the_archive_title( $title ) { $regex = apply_filters( 'twentytwenty_get_the_archive_title_regex', array( 'pattern' => '/(\A[^\:]+\:)/', 'replacement' => '<span class="color-accent">$1</span>', ) ); if ( empty( $regex ) ) { return $title; } return preg_replace( $regex['pattern'], $regex['replacement'], $title ); } add_filter( 'get_the_archive_title', 'twentytwenty_get_the_archive_title' ); /** * Miscellaneous */ /** * Toggles animation duration in milliseconds. * * @return int Duration in milliseconds */ function twentytwenty_toggle_duration() { /** * Filters the animation duration/speed used usually for submenu toggles. * * @since Twenty Twenty 1.0 * * @param int $duration Duration in milliseconds. */ $duration = apply_filters( 'twentytwenty_toggle_duration', 250 ); return $duration; } /** * Gets unique ID. * * This is a PHP implementation of Underscore's uniqueId method. A static variable * contains an integer that is incremented with each call. This number is returned * with the optional prefix. As such the returned value is not universally unique, * but it is unique across the life of the PHP process. * * @see wp_unique_id() Themes requiring WordPress 5.0.3 and greater should use this instead. * * @param string $prefix Prefix for the returned ID. * @return string Unique ID. */ function twentytwenty_unique_id( $prefix = '' ) { static $id_counter = 0; if ( function_exists( 'wp_unique_id' ) ) { return wp_unique_id( $prefix ); } return $prefix . (string) ++$id_counter; } PK <0]���� � customizer.phpnu �[��� <?php /** * Twenty Nineteen: Customizer * * @package WordPress * @subpackage Twenty_Nineteen * @since Twenty Nineteen 1.0 */ /** * Add postMessage support for site title and description for the Theme Customizer. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function twentynineteen_customize_register( $wp_customize ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'twentynineteen_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'twentynineteen_customize_partial_blogdescription', ) ); } /** * Primary color. */ $wp_customize->add_setting( 'primary_color', array( 'default' => 'default', 'transport' => 'postMessage', 'sanitize_callback' => 'twentynineteen_sanitize_color_option', ) ); $wp_customize->add_control( 'primary_color', array( 'type' => 'radio', 'label' => __( 'Primary Color', 'twentynineteen' ), 'choices' => array( 'default' => _x( 'Default', 'primary color', 'twentynineteen' ), 'custom' => _x( 'Custom', 'primary color', 'twentynineteen' ), ), 'section' => 'colors', 'priority' => 5, ) ); // Add primary color hue setting and control. $wp_customize->add_setting( 'primary_color_hue', array( 'default' => 199, 'transport' => 'postMessage', 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color_hue', array( 'description' => __( 'Apply a custom color for buttons, links, featured images, etc.', 'twentynineteen' ), 'section' => 'colors', 'mode' => 'hue', ) ) ); // Add image filter setting and control. $wp_customize->add_setting( 'image_filter', array( 'default' => 1, 'sanitize_callback' => 'absint', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'image_filter', array( 'label' => __( 'Apply a filter to featured images using the primary color', 'twentynineteen' ), 'section' => 'colors', 'type' => 'checkbox', ) ); } add_action( 'customize_register', 'twentynineteen_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function twentynineteen_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function twentynineteen_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Bind JS handlers to instantly live-preview changes. */ function twentynineteen_customize_preview_js() { wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20181214', true ); } add_action( 'customize_preview_init', 'twentynineteen_customize_preview_js' ); /** * Load dynamic logic for the customizer controls area. */ function twentynineteen_panels_js() { wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20181214', true ); } add_action( 'customize_controls_enqueue_scripts', 'twentynineteen_panels_js' ); /** * Sanitize custom color choice. * * @param string $choice Whether image filter is active. * @return string */ function twentynineteen_sanitize_color_option( $choice ) { $valid = array( 'default', 'custom', ); if ( in_array( $choice, $valid, true ) ) { return $choice; } return 'default'; } PK <0]9q9 + + color-patterns.phpnu �[��� <?php /** * Twenty Nineteen: Color Patterns * * @package WordPress * @subpackage TwentyNineteen * @since Twenty Nineteen 1.0 */ /** * Generate the CSS for the current primary color. */ function twentynineteen_custom_colors_css() { $primary_color = 199; if ( 'default' !== get_theme_mod( 'primary_color', 'default' ) ) { $primary_color = absint( get_theme_mod( 'primary_color_hue', 199 ) ); } /** * Filter Twenty Nineteen default saturation level. * * @since Twenty Nineteen 1.0 * * @param int $saturation Color saturation level. */ $saturation = apply_filters( 'twentynineteen_custom_colors_saturation', 100 ); $saturation = absint( $saturation ) . '%'; /** * Filter Twenty Nineteen default selection saturation level. * * @since Twenty Nineteen 1.0 * * @param int $saturation_selection Selection color saturation level. */ $saturation_selection = absint( apply_filters( 'twentynineteen_custom_colors_saturation_selection', 50 ) ); $saturation_selection = $saturation_selection . '%'; /** * Filter Twenty Nineteen default lightness level. * * @since Twenty Nineteen 1.0 * * @param int $lightness Color lightness level. */ $lightness = apply_filters( 'twentynineteen_custom_colors_lightness', 33 ); $lightness = absint( $lightness ) . '%'; /** * Filter Twenty Nineteen default hover lightness level. * * @since Twenty Nineteen 1.0 * * @param int $lightness_hover Hover color lightness level. */ $lightness_hover = apply_filters( 'twentynineteen_custom_colors_lightness_hover', 23 ); $lightness_hover = absint( $lightness_hover ) . '%'; /** * Filter Twenty Nineteen default selection lightness level. * * @since Twenty Nineteen 1.0 * * @param int $lightness_selection Selection color lightness level. */ $lightness_selection = apply_filters( 'twentynineteen_custom_colors_lightness_selection', 90 ); $lightness_selection = absint( $lightness_selection ) . '%'; $theme_css = ' /* * Set background for: * - featured image :before * - featured image :before * - post thumbmail :before * - post thumbmail :before * - Submenu * - Sticky Post * - buttons * - WP Block Button * - Blocks */ .image-filters-enabled .site-header.featured-image .site-featured-image:before, .image-filters-enabled .site-header.featured-image .site-featured-image:after, .image-filters-enabled .entry .post-thumbnail:before, .image-filters-enabled .entry .post-thumbnail:after, .main-navigation .sub-menu, .sticky-post, .entry .entry-content .wp-block-button .wp-block-button__link:not(.has-background), .entry .button, button, input[type="button"], input[type="reset"], input[type="submit"], .entry .entry-content > .has-primary-background-color, .entry .entry-content > *[class^="wp-block-"].has-primary-background-color, .entry .entry-content > *[class^="wp-block-"] .has-primary-background-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color.has-primary-background-color, .entry .entry-content .wp-block-file .wp-block-file__button { background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } /* * Set Color for: * - all links * - main navigation links * - Post navigation links * - Post entry meta hover * - Post entry header more-link hover * - main navigation svg * - comment navigation * - Comment edit link hover * - Site Footer Link hover * - Widget links */ a, a:visited, .main-navigation .main-menu > li, .main-navigation ul.main-menu > li > a, .post-navigation .post-title, .entry .entry-meta a:hover, .entry .entry-footer a:hover, .entry .entry-content .more-link:hover, .main-navigation .main-menu > li > a + svg, .comment .comment-metadata > a:hover, .comment .comment-metadata .comment-edit-link:hover, #colophon .site-info a:hover, .widget a, .entry .entry-content .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color), .entry .entry-content > .has-primary-color, .entry .entry-content > *[class^="wp-block-"] .has-primary-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color blockquote.has-primary-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color blockquote.has-primary-color p { color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } /* * Set border color for: * wp block quote * :focus */ blockquote, .entry .entry-content blockquote, .entry .entry-content .wp-block-quote:not(.is-large), .entry .entry-content .wp-block-quote:not(.is-style-large), input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="number"]:focus, input[type="tel"]:focus, input[type="range"]:focus, input[type="date"]:focus, input[type="month"]:focus, input[type="week"]:focus, input[type="time"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="color"]:focus, textarea:focus { border-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } .gallery-item > div > a:focus { box-shadow: 0 0 0 2px hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } /* Hover colors */ a:hover, a:active, .main-navigation .main-menu > li > a:hover, .main-navigation .main-menu > li > a:hover + svg, .post-navigation .nav-links a:hover, .post-navigation .nav-links a:hover .post-title, .author-bio .author-description .author-link:hover, .entry .entry-content > .has-secondary-color, .entry .entry-content > *[class^="wp-block-"] .has-secondary-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color blockquote.has-secondary-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color blockquote.has-secondary-color p, .comment .comment-author .fn a:hover, .comment-reply-link:hover, .comment-navigation .nav-previous a:hover, .comment-navigation .nav-next a:hover, #cancel-comment-reply-link:hover, .widget a:hover { color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness_hover . ' ); /* base: #005177; */ } .main-navigation .sub-menu > li > a:hover, .main-navigation .sub-menu > li > a:focus, .main-navigation .sub-menu > li > a:hover:after, .main-navigation .sub-menu > li > a:focus:after, .main-navigation .sub-menu > li > .menu-item-link-return:hover, .main-navigation .sub-menu > li > .menu-item-link-return:focus, .main-navigation .sub-menu > li > a:not(.submenu-expand):hover, .main-navigation .sub-menu > li > a:not(.submenu-expand):focus, .entry .entry-content > .has-secondary-background-color, .entry .entry-content > *[class^="wp-block-"].has-secondary-background-color, .entry .entry-content > *[class^="wp-block-"] .has-secondary-background-color, .entry .entry-content > *[class^="wp-block-"].is-style-solid-color.has-secondary-background-color { background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness_hover . ' ); /* base: #005177; */ } /* Text selection colors */ ::selection { background-color: hsl( ' . $primary_color . ', ' . $saturation_selection . ', ' . $lightness_selection . ' ); /* base: #005177; */ } ::-moz-selection { background-color: hsl( ' . $primary_color . ', ' . $saturation_selection . ', ' . $lightness_selection . ' ); /* base: #005177; */ }'; $editor_css = ' /* * Set colors for: * - links * - blockquote * - pullquote (solid color) * - buttons */ .editor-block-list__layout .editor-block-list__block a, .editor-block-list__layout .editor-block-list__block .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color), .editor-block-list__layout .editor-block-list__block .wp-block-button.is-style-outline:hover .wp-block-button__link:not(.has-text-color), .editor-block-list__layout .editor-block-list__block .wp-block-button.is-style-outline:focus .wp-block-button__link:not(.has-text-color), .editor-block-list__layout .editor-block-list__block .wp-block-button.is-style-outline:active .wp-block-button__link:not(.has-text-color), .editor-block-list__layout .editor-block-list__block .wp-block-file .wp-block-file__textlink { color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } .editor-block-list__layout .editor-block-list__block .wp-block-quote:not(.is-large):not(.is-style-large), .editor-styles-wrapper .editor-block-list__layout .wp-block-freeform blockquote { border-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } .editor-block-list__layout .editor-block-list__block .wp-block-pullquote.is-style-solid-color:not(.has-background-color) { background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } .editor-block-list__layout .editor-block-list__block .wp-block-file .wp-block-file__button, .editor-block-list__layout .editor-block-list__block .wp-block-button:not(.is-style-outline) .wp-block-button__link, .editor-block-list__layout .editor-block-list__block .wp-block-button:not(.is-style-outline) .wp-block-button__link:active, .editor-block-list__layout .editor-block-list__block .wp-block-button:not(.is-style-outline) .wp-block-button__link:focus, .editor-block-list__layout .editor-block-list__block .wp-block-button:not(.is-style-outline) .wp-block-button__link:hover { background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' ); /* base: #0073a8; */ } /* Hover colors */ .editor-block-list__layout .editor-block-list__block a:hover, .editor-block-list__layout .editor-block-list__block a:active, .editor-block-list__layout .editor-block-list__block .wp-block-file .wp-block-file__textlink:hover { color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness_hover . ' ); /* base: #005177; */ } /* Do not overwrite solid color pullquote or cover links */ .editor-block-list__layout .editor-block-list__block .wp-block-pullquote.is-style-solid-color a, .editor-block-list__layout .editor-block-list__block .wp-block-cover a { color: inherit; } '; if ( function_exists( 'register_block_type' ) && is_admin() ) { $theme_css = $editor_css; } /** * Filters Twenty Nineteen custom colors CSS. * * @since Twenty Nineteen 1.0 * * @param string $css Base theme colors CSS. * @param int $primary_color The user's selected color hue. * @param string $saturation Filtered theme color saturation level. */ return apply_filters( 'twentynineteen_custom_colors_css', $theme_css, $primary_color, $saturation ); } PK <0]�G helper-functions.phpnu �[��� <?php /** * Common theme functions * * @package WordPress * @subpackage Twenty_Nineteen * @since Twenty Nineteen 1.5 */ /** * Determines if post thumbnail can be displayed. */ function twentynineteen_can_show_post_thumbnail() { return apply_filters( 'twentynineteen_can_show_post_thumbnail', ! post_password_required() && ! is_attachment() && has_post_thumbnail() ); } /** * Returns true if image filters are enabled on the theme options. */ function twentynineteen_image_filters_enabled() { return 0 !== get_theme_mod( 'image_filter', 1 ); } /** * Returns the size for avatars used in the theme. */ function twentynineteen_get_avatar_size() { return 60; } /** * Returns true if comment is by author of the post. * * @see get_comment_class() */ function twentynineteen_is_comment_by_post_author( $comment = null ) { if ( is_object( $comment ) && $comment->user_id > 0 ) { $user = get_userdata( $comment->user_id ); $post = get_post( $comment->comment_post_ID ); if ( ! empty( $user ) && ! empty( $post ) ) { return $comment->user_id === $post->post_author; } } return false; } /** * Returns information about the current post's discussion, with cache support. */ function twentynineteen_get_discussion_data() { static $discussion, $post_id; $current_post_id = get_the_ID(); if ( $current_post_id === $post_id ) { return $discussion; /* If we have discussion information for post ID, return cached object */ } else { $post_id = $current_post_id; } $comments = get_comments( array( 'post_id' => $current_post_id, 'orderby' => 'comment_date_gmt', 'order' => get_option( 'comment_order', 'asc' ), /* Respect comment order from Settings » Discussion. */ 'status' => 'approve', 'number' => 20, /* Only retrieve the last 20 comments, as the end goal is just 6 unique authors */ ) ); $authors = array(); foreach ( $comments as $comment ) { $authors[] = ( (int) $comment->user_id > 0 ) ? (int) $comment->user_id : $comment->comment_author_email; } $authors = array_unique( $authors ); $discussion = (object) array( 'authors' => array_slice( $authors, 0, 6 ), /* Six unique authors commenting on the post. */ 'responses' => get_comments_number( $current_post_id ), /* Number of responses. */ ); return $discussion; } /** * Converts HSL to HEX colors. */ function twentynineteen_hsl_hex( $h, $s, $l, $to_hex = true ) { $h /= 360; $s /= 100; $l /= 100; $r = $l; $g = $l; $b = $l; $v = ( $l <= 0.5 ) ? ( $l * ( 1.0 + $s ) ) : ( $l + $s - $l * $s ); if ( $v > 0 ) { $m; $sv; $sextant; $fract; $vsf; $mid1; $mid2; $m = $l + $l - $v; $sv = ( $v - $m ) / $v; $h *= 6.0; $sextant = floor( $h ); $fract = $h - $sextant; $vsf = $v * $sv * $fract; $mid1 = $m + $vsf; $mid2 = $v - $vsf; switch ( $sextant ) { case 0: $r = $v; $g = $mid1; $b = $m; break; case 1: $r = $mid2; $g = $v; $b = $m; break; case 2: $r = $m; $g = $v; $b = $mid1; break; case 3: $r = $m; $g = $mid2; $b = $v; break; case 4: $r = $mid1; $g = $m; $b = $v; break; case 5: $r = $v; $g = $m; $b = $mid2; break; } } $r = round( $r * 255, 0 ); $g = round( $g * 255, 0 ); $b = round( $b * 255, 0 ); if ( $to_hex ) { $r = ( $r < 15 ) ? '0' . dechex( $r ) : dechex( $r ); $g = ( $g < 15 ) ? '0' . dechex( $g ) : dechex( $g ); $b = ( $b < 15 ) ? '0' . dechex( $b ) : dechex( $b ); return "#$r$g$b"; } return "rgb($r, $g, $b)"; } PK <0]\�s� � back-compat.phpnu �[��� <?php /** * Twenty Nineteen back compat functionality * * Prevents Twenty Nineteen from running on WordPress versions prior to 4.7, * since this theme is not meant to be backward compatible beyond that and * relies on many newer functions and markup changes introduced in 4.7. * * @package WordPress * @subpackage Twenty_Nineteen * @since Twenty Nineteen 1.0.0 */ /** * Prevent switching to Twenty Nineteen on old versions of WordPress. * * Switches to the default theme. * * @since Twenty Nineteen 1.0.0 */ function twentynineteen_switch_theme() { switch_theme( WP_DEFAULT_THEME ); unset( $_GET['activated'] ); add_action( 'admin_notices', 'twentynineteen_upgrade_notice' ); } add_action( 'after_switch_theme', 'twentynineteen_switch_theme' ); /** * Adds a message for unsuccessful theme switch. * * Prints an update nag after an unsuccessful attempt to switch to * Twenty Nineteen on WordPress versions prior to 4.7. * * @since Twenty Nineteen 1.0.0 * * @global string $wp_version WordPress version. */ function twentynineteen_upgrade_notice() { /* translators: %s: WordPress version. */ $message = sprintf( __( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ), $GLOBALS['wp_version'] ); printf( '<div class="error"><p>%s</p></div>', $message ); } /** * Prevents the Customizer from being loaded on WordPress versions prior to 4.7. * * @since Twenty Nineteen 1.0.0 * * @global string $wp_version WordPress version. */ function twentynineteen_customize() { wp_die( sprintf( /* translators: %s: WordPress version. */ __( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ), $GLOBALS['wp_version'] ), '', array( 'back_link' => true, ) ); } add_action( 'load-customize.php', 'twentynineteen_customize' ); /** * Prevents the Theme Preview from being loaded on WordPress versions prior to 4.7. * * @since Twenty Nineteen 1.0.0 * * @global string $wp_version WordPress version. */ function twentynineteen_preview() { if ( isset( $_GET['preview'] ) ) { /* translators: %s: WordPress version. */ wp_die( sprintf( __( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ), $GLOBALS['wp_version'] ) ); } } add_action( 'template_redirect', 'twentynineteen_preview' ); PK <0]�E��� � template-functions.phpnu �[��� <?php /** * Functions which enhance the theme by hooking into WordPress * * @package WordPress * @subpackage Twenty_Nineteen * @since Twenty Nineteen 1.0 */ /** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function twentynineteen_body_classes( $classes ) { if ( is_singular() ) { // Adds `singular` to singular pages. $classes[] = 'singular'; } else { // Adds `hfeed` to non-singular pages. $classes[] = 'hfeed'; } // Adds a class if image filters are enabled. if ( twentynineteen_image_filters_enabled() ) { $classes[] = 'image-filters-enabled'; } return $classes; } add_filter( 'body_class', 'twentynineteen_body_classes' ); /** * Adds custom class to the array of posts classes. */ function twentynineteen_post_classes( $classes, $class, $post_id ) { $classes[] = 'entry'; return $classes; } add_filter( 'post_class', 'twentynineteen_post_classes', 10, 3 ); /** * Add a pingback url auto-discovery header for single posts, pages, or attachments. */ function twentynineteen_pingback_header() { if ( is_singular() && pings_open() ) { echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">'; } } add_action( 'wp_head', 'twentynineteen_pingback_header' ); /** * Changes comment form default fields. */ function twentynineteen_comment_form_defaults( $defaults ) { $comment_field = $defaults['comment_field']; // Adjust height of comment form. $defaults['comment_field'] = preg_replace( '/rows="\d+"/', 'rows="5"', $comment_field ); return $defaults; } add_filter( 'comment_form_defaults', 'twentynineteen_comment_form_defaults' ); /** * Filters the default archive titles. */ function twentynineteen_get_the_archive_title() { if ( is_category() ) { $title = __( 'Category Archives: ', 'twentynineteen' ) . '<span class="page-description">' . single_term_title( '', false ) . '</span>'; } elseif ( is_tag() ) { $title = __( 'Tag Archives: ', 'twentynineteen' ) . '<span class="page-description">' . single_term_title( '', false ) . '</span>'; } elseif ( is_author() ) { $title = __( 'Author Archives: ', 'twentynineteen' ) . '<span class="page-description">' . get_the_author_meta( 'display_name' ) . '</span>'; } elseif ( is_year() ) { $title = __( 'Yearly Archives: ', 'twentynineteen' ) . '<span class="page-description">' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentynineteen' ) ) . '</span>'; } elseif ( is_month() ) { $title = __( 'Monthly Archives: ', 'twentynineteen' ) . '<span class="page-description">' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentynineteen' ) ) . '</span>'; } elseif ( is_day() ) { $title = __( 'Daily Archives: ', 'twentynineteen' ) . '<span class="page-description">' . get_the_date() . '</span>'; } elseif ( is_post_type_archive() ) { $title = __( 'Post Type Archives: ', 'twentynineteen' ) . '<span class="page-description">' . post_type_archive_title( '', false ) . '</span>'; } elseif ( is_tax() ) { $tax = get_taxonomy( get_queried_object()->taxonomy ); /* translators: %s: Taxonomy singular name. */ $title = sprintf( esc_html__( '%s Archives:', 'twentynineteen' ), $tax->labels->singular_name ); } else { $title = __( 'Archives:', 'twentynineteen' ); } return $title; } add_filter( 'get_the_archive_title', 'twentynineteen_get_the_archive_title' ); /** * Add custom sizes attribute to responsive image functionality for post thumbnails. * * @origin Twenty Nineteen 1.0 * * @param array $attr Attributes for the image markup. * @return string Value for use in post thumbnail 'sizes' attribute. */ function twentynineteen_post_thumbnail_sizes_attr( $attr ) { if ( is_admin() ) { return $attr; } if ( ! is_singular() ) { $attr['sizes'] = '(max-width: 34.9rem) calc(100vw - 2rem), (max-width: 53rem) calc(8 * (100vw / 12)), (min-width: 53rem) calc(6 * (100vw / 12)), 100vw'; } return $attr; } add_filter( 'wp_get_attachment_image_attributes', 'twentynineteen_post_thumbnail_sizes_attr', 10, 1 ); /** * Add an extra menu to our nav for our priority+ navigation to use * * @param object $nav_menu Nav menu. * @param object $args Nav menu args. * @return string More link for hidden menu items. */ function twentynineteen_add_ellipses_to_nav( $nav_menu, $args ) { if ( 'menu-1' === $args->theme_location ) : $nav_menu .= ' <div class="main-menu-more"> <ul class="main-menu"> <li class="menu-item menu-item-has-children"> <button class="submenu-expand main-menu-more-toggle is-empty" tabindex="-1" aria-label="' . esc_attr__( 'More', 'twentynineteen' ) . '" aria-haspopup="true" aria-expanded="false">' . twentynineteen_get_icon_svg( 'arrow_drop_down_ellipsis' ) . ' </button> <ul class="sub-menu hidden-links"> <li class="mobile-parent-nav-menu-item"> <button class="menu-item-link-return">' . twentynineteen_get_icon_svg( 'chevron_left' ) . esc_html__( 'Back', 'twentynineteen' ) . ' </button> </li> </ul> </li> </ul> </div>'; endif; return $nav_menu; } add_filter( 'wp_nav_menu', 'twentynineteen_add_ellipses_to_nav', 10, 2 ); /** * WCAG 2.0 Attributes for Dropdown Menus * * Adjustments to menu attributes tot support WCAG 2.0 recommendations * for flyout and dropdown menus. * * @ref https://www.w3.org/WAI/tutorials/menus/flyout/ */ function twentynineteen_nav_menu_link_attributes( $atts, $item, $args, $depth ) { // Add [aria-haspopup] and [aria-expanded] to menu items that have children. $item_has_children = in_array( 'menu-item-has-children', $item->classes, true ); if ( $item_has_children ) { $atts['aria-haspopup'] = 'true'; $atts['aria-expanded'] = 'false'; } return $atts; } add_filter( 'nav_menu_link_attributes', 'twentynineteen_nav_menu_link_attributes', 10, 4 ); /** * Create a nav menu item to be displayed on mobile to navigate from submenu back to the parent. * * This duplicates each parent nav menu item and makes it the first child of itself. * * @param array $sorted_menu_items Sorted nav menu items. * @param object $args Nav menu args. * @return array Amended nav menu items. */ function twentynineteen_add_mobile_parent_nav_menu_items( $sorted_menu_items, $args ) { static $pseudo_id = 0; if ( ! isset( $args->theme_location ) || 'menu-1' !== $args->theme_location ) { return $sorted_menu_items; } $amended_menu_items = array(); foreach ( $sorted_menu_items as $nav_menu_item ) { $amended_menu_items[] = $nav_menu_item; if ( in_array( 'menu-item-has-children', $nav_menu_item->classes, true ) ) { $parent_menu_item = clone $nav_menu_item; $parent_menu_item->original_id = $nav_menu_item->ID; $parent_menu_item->ID = --$pseudo_id; $parent_menu_item->db_id = $parent_menu_item->ID; $parent_menu_item->object_id = $parent_menu_item->ID; $parent_menu_item->classes = array( 'mobile-parent-nav-menu-item' ); $parent_menu_item->menu_item_parent = $nav_menu_item->ID; $amended_menu_items[] = $parent_menu_item; } } return $amended_menu_items; } add_filter( 'wp_nav_menu_objects', 'twentynineteen_add_mobile_parent_nav_menu_items', 10, 2 ); PK �@0]l�<i; ; svg-icons.phpnu �[��� <?php /** * Twenty Twenty SVG Icon helper functions * * @package WordPress * @subpackage Twenty_Twenty * @since Twenty Twenty 1.0 */ if ( ! function_exists( 'twentytwenty_the_theme_svg' ) ) { /** * Output and Get Theme SVG. * Output and get the SVG markup for an icon in the TwentyTwenty_SVG_Icons class. * * @param string $svg_name The name of the icon. * @param string $group The group the icon belongs to. * @param string $color Color code. */ function twentytwenty_the_theme_svg( $svg_name, $group = 'ui', $color = '' ) { echo twentytwenty_get_theme_svg( $svg_name, $group, $color ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in twentytwenty_get_theme_svg(). } } if ( ! function_exists( 'twentytwenty_get_theme_svg' ) ) { /** * Get information about the SVG icon. * * @param string $svg_name The name of the icon. * @param string $group The group the icon belongs to. * @param string $color Color code. */ function twentytwenty_get_theme_svg( $svg_name, $group = 'ui', $color = '' ) { // Make sure that only our allowed tags and attributes are included. $svg = wp_kses( TwentyTwenty_SVG_Icons::get_svg( $svg_name, $group, $color ), array( 'svg' => array( 'class' => true, 'xmlns' => true, 'width' => true, 'height' => true, 'viewbox' => true, 'aria-hidden' => true, 'role' => true, 'focusable' => true, ), 'path' => array( 'fill' => true, 'fill-rule' => true, 'd' => true, 'transform' => true, ), 'polygon' => array( 'fill' => true, 'fill-rule' => true, 'points' => true, 'transform' => true, 'focusable' => true, ), ) ); if ( ! $svg ) { return false; } return $svg; } } PK �@0]�J�cc. c. starter-content.phpnu �[��� <?php /** * Twenty Twenty Starter Content * * @link https://make.wordpress.org/core/2016/11/30/starter-content-for-themes-in-4-7/ * * @package WordPress * @subpackage Twenty_Twenty * @since Twenty Twenty 1.0 */ /** * Function to return the array of starter content for the theme. * * Passes it through the `twentytwenty_starter_content` filter before returning. * * @since Twenty Twenty 1.0 * * @return array A filtered array of args for the starter_content. */ function twentytwenty_get_starter_content() { // Define and register starter content to showcase the theme on new sites. $starter_content = array( 'widgets' => array( // Place one core-defined widgets in the first footer widget area. 'sidebar-1' => array( 'text_about', ), // Place one core-defined widgets in the second footer widget area. 'sidebar-2' => array( 'text_business_info', ), ), // Create the custom image attachments used as post thumbnails for pages. 'attachments' => array( 'image-opening' => array( 'post_title' => _x( 'The New UMoMA Opens its Doors', 'Theme starter content', 'twentytwenty' ), 'file' => 'assets/images/2020-landscape-1.png', // URL relative to the template directory. ), ), // Specify the core-defined pages to create and add custom thumbnails to some of them. 'posts' => array( 'front' => array( 'post_type' => 'page', 'post_title' => __( 'The New UMoMA Opens its Doors', 'twentytwenty' ), // Use the above featured image with the predefined about page. 'thumbnail' => '{{image-opening}}', 'post_content' => join( '', array( '<!-- wp:group {"align":"wide"} -->', '<div class="wp-block-group alignwide"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->', '<h2 class="has-text-align-center">' . __( 'The premier destination for modern art in Northern Sweden. Open from 10 AM to 6 PM every day during the summer months.', 'twentytwenty' ) . '</h2>', '<!-- /wp:heading --></div></div>', '<!-- /wp:group -->', '<!-- wp:columns {"align":"wide"} -->', '<div class="wp-block-columns alignwide"><!-- wp:column -->', '<div class="wp-block-column"><!-- wp:group -->', '<div class="wp-block-group"><div class="wp-block-group__inner-container">', '<!-- wp:image {"align":"full","id":37,"sizeSlug":"full"} -->', '<figure class="wp-block-image alignfull size-full"><img src="' . get_theme_file_uri() . '/assets/images/2020-three-quarters-1.png" alt="" class="wp-image-37"/></figure>', '<!-- /wp:image -->', '<!-- wp:heading {"level":3} -->', '<h3>' . __( 'Works and Days', 'twentytwenty' ) . '</h3>', '<!-- /wp:heading -->', '<!-- wp:paragraph -->', '<p>' . __( 'August 1 -- December 1', 'twentytwenty' ) . '</p>', '<!-- /wp:paragraph -->', '<!-- wp:button {"className":"is-style-outline"} -->', '<div class="wp-block-button is-style-outline"><a class="wp-block-button__link" href="https://make.wordpress.org/core/2019/09/27/block-editor-theme-related-updates-in-wordpress-5-3/">' . __( 'Read More', 'twentytwenty' ) . '</a></div>', '<!-- /wp:button --></div></div>', '<!-- /wp:group -->', '<!-- wp:group -->', '<div class="wp-block-group"><div class="wp-block-group__inner-container">', '<!-- wp:image {"align":"full","id":37,"sizeSlug":"full"} -->', '<figure class="wp-block-image alignfull size-full"><img src="' . get_theme_file_uri() . '/assets/images/2020-three-quarters-3.png" alt="" class="wp-image-37"/></figure>', '<!-- /wp:image -->', '<!-- wp:heading {"level":3} -->', '<h3>' . __( 'Theatre of Operations', 'twentytwenty' ) . '</h3>', '<!-- /wp:heading -->', '<!-- wp:paragraph -->', '<p>' . __( 'October 1 -- December 1', 'twentytwenty' ) . '</p>', '<!-- /wp:paragraph -->', '<!-- wp:button {"className":"is-style-outline"} -->', '<div class="wp-block-button is-style-outline"><a class="wp-block-button__link" href="https://make.wordpress.org/core/2019/09/27/block-editor-theme-related-updates-in-wordpress-5-3/">' . __( 'Read More', 'twentytwenty' ) . '</a></div>', '<!-- /wp:button --></div></div>', '<!-- /wp:group --></div>', '<!-- /wp:column -->', '<!-- wp:column -->', '<div class="wp-block-column"><!-- wp:group -->', '<div class="wp-block-group"><div class="wp-block-group__inner-container">', '<!-- wp:image {"align":"full","id":37,"sizeSlug":"full"} -->', '<figure class="wp-block-image alignfull size-full"><img src="' . get_theme_file_uri() . '/assets/images/2020-three-quarters-2.png" alt="" class="wp-image-37"/></figure>', '<!-- /wp:image -->', '<!-- wp:heading {"level":3} -->', '<h3>' . __( 'The Life I Deserve', 'twentytwenty' ) . '</h3>', '<!-- /wp:heading -->', '<!-- wp:paragraph -->', '<p>' . __( 'August 1 -- December 1', 'twentytwenty' ) . '</p>', '<!-- /wp:paragraph -->', '<!-- wp:button {"className":"is-style-outline"} -->', '<div class="wp-block-button is-style-outline"><a class="wp-block-button__link" href="https://make.wordpress.org/core/2019/09/27/block-editor-theme-related-updates-in-wordpress-5-3/">' . __( 'Read More', 'twentytwenty' ) . '</a></div>', '<!-- /wp:button --></div></div>', '<!-- /wp:group -->', '<!-- wp:group -->', '<div class="wp-block-group"><div class="wp-block-group__inner-container">', '<!-- wp:image {"align":"full","id":37,"sizeSlug":"full"} -->', '<figure class="wp-block-image alignfull size-full"><img src="' . get_theme_file_uri() . '/assets/images/2020-three-quarters-4.png" alt="" class="wp-image-37"/></figure>', '<!-- /wp:image -->', '<!-- wp:heading {"level":3} -->', '<h3>' . __( 'From Signac to Matisse', 'twentytwenty' ) . '</h3>', '<!-- /wp:heading -->', '<!-- wp:paragraph -->', '<p>' . __( 'October 1 -- December 1', 'twentytwenty' ) . '</p>', '<!-- /wp:paragraph -->', '<!-- wp:button {"className":"is-style-outline"} -->', '<div class="wp-block-button is-style-outline"><a class="wp-block-button__link" href="https://make.wordpress.org/core/2019/09/27/block-editor-theme-related-updates-in-wordpress-5-3/">' . __( 'Read More', 'twentytwenty' ) . '</a></div>', '<!-- /wp:button --></div></div>', '<!-- /wp:group --></div>', '<!-- /wp:column --></div>', '<!-- /wp:columns -->', '<!-- wp:image {"align":"full","id":37,"sizeSlug":"full"} -->', '<figure class="wp-block-image alignfull size-full"><img src="' . get_theme_file_uri() . '/assets/images/2020-landscape-2.png" alt="" class="wp-image-37"/></figure>', '<!-- /wp:image -->', '<!-- wp:group {"align":"wide"} -->', '<div class="wp-block-group alignwide"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center","textColor":"accent"} -->', '<h2 class="has-accent-color has-text-align-center">' . __( '“Cyborgs, as the philosopher Donna Haraway established, are not reverent. They do not remember the cosmos.”', 'twentytwenty' ) . '</h2>', '<!-- /wp:heading --></div></div>', '<!-- /wp:group -->', '<!-- wp:paragraph {"dropCap":true} -->', '<p class="has-drop-cap">' . __( 'With seven floors of striking architecture, UMoMA shows exhibitions of international contemporary art, sometimes along with art historical retrospectives. Existential, political and philosophical issues are intrinsic to our programme. As visitor you are invited to guided tours artist talks, lectures, film screenings and other events with free admission', 'twentytwenty' ) . '</p>', '<!-- /wp:paragraph -->', '<!-- wp:paragraph -->', '<p>' . __( 'The exhibitions are produced by UMoMA in collaboration with artists and museums around the world and they often attract international attention. UMoMA has received a Special Commendation from the European Museum of the Year, and was among the top candidates for the Swedish Museum of the Year Award as well as for the Council of Europe Museum Prize.', 'twentytwenty' ) . '</p>', '<!-- /wp:paragraph -->', '<!-- wp:paragraph -->', '<p></p>', '<!-- /wp:paragraph -->', '<!-- wp:group {"customBackgroundColor":"#ffffff","align":"wide"} -->', '<div class="wp-block-group alignwide has-background" style="background-color:#ffffff"><div class="wp-block-group__inner-container"><!-- wp:group -->', '<div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:heading {"align":"center"} -->', '<h2 class="has-text-align-center">' . __( 'Become a Member and Get Exclusive Offers!', 'twentytwenty' ) . '</h2>', '<!-- /wp:heading -->', '<!-- wp:paragraph {"align":"center"} -->', '<p class="has-text-align-center">' . __( 'Members get access to exclusive exhibits and sales. Our memberships cost $99.99 and are billed annually.', 'twentytwenty' ) . '</p>', '<!-- /wp:paragraph -->', '<!-- wp:button {"align":"center"} -->', '<div class="wp-block-button aligncenter"><a class="wp-block-button__link" href="https://make.wordpress.org/core/2019/09/27/block-editor-theme-related-updates-in-wordpress-5-3/">' . __( 'Join the Club', 'twentytwenty' ) . '</a></div>', '<!-- /wp:button --></div></div>', '<!-- /wp:group --></div></div>', '<!-- /wp:group -->', '<!-- wp:gallery {"ids":[39,38],"align":"wide"} -->', '<figure class="wp-block-gallery alignwide columns-2 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img src="' . get_theme_file_uri() . '/assets/images/2020-square-2.png" alt="" data-id="39" data-full-url="' . get_theme_file_uri() . '/assets/images/2020-square-2.png" data-link="assets/images/2020-square-2/" class="wp-image-39"/></figure></li><li class="blocks-gallery-item"><figure><img src="' . get_theme_file_uri() . '/assets/images/2020-square-1.png" alt="" data-id="38" data-full-url="' . get_theme_file_uri() . '/assets/images/2020-square-1.png" data-link="' . get_theme_file_uri() . '/assets/images/2020-square-1/" class="wp-image-38"/></figure></li></ul></figure>', '<!-- /wp:gallery -->', ) ), ), 'about', 'contact', 'blog', ), // Default to a static front page and assign the front and posts pages. 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{front}}', 'page_for_posts' => '{{blog}}', ), // Set up nav menus for each of the two areas registered in the theme. 'nav_menus' => array( // Assign a menu to the "primary" location. 'primary' => array( 'name' => __( 'Primary', 'twentytwenty' ), 'items' => array( 'link_home', // Note that the core "home" page is actually a link in case a static front page is not used. 'page_about', 'page_blog', 'page_contact', ), ), // This replicates primary just to demonstrate the expanded menu. 'expanded' => array( 'name' => __( 'Primary', 'twentytwenty' ), 'items' => array( 'link_home', // Note that the core "home" page is actually a link in case a static front page is not used. 'page_about', 'page_blog', 'page_contact', ), ), // Assign a menu to the "social" location. 'social' => array( 'name' => __( 'Social Links Menu', 'twentytwenty' ), 'items' => array( 'link_yelp', 'link_facebook', 'link_twitter', 'link_instagram', 'link_email', ), ), ), ); /** * Filters Twenty Twenty array of starter content. * * @since Twenty Twenty 1.0 * * @param array $starter_content Array of starter content. */ return apply_filters( 'twentytwenty_starter_content', $starter_content ); } PK �@0]^�m�$ $ custom-css.phpnu �[��� <?php /** * Twenty Twenty Custom CSS * * @package WordPress * @subpackage Twenty_Twenty * @since Twenty Twenty 1.0 */ if ( ! function_exists( 'twentytwenty_generate_css' ) ) { /** * Generate CSS. * * @param string $selector The CSS selector. * @param string $style The CSS style. * @param string $value The CSS value. * @param string $prefix The CSS prefix. * @param string $suffix The CSS suffix. * @param bool $echo Echo the styles. */ function twentytwenty_generate_css( $selector, $style, $value, $prefix = '', $suffix = '', $echo = true ) { $return = ''; /* * Bail early if we have no $selector elements or properties and $value. */ if ( ! $value || ! $selector ) { return; } $return = sprintf( '%s { %s: %s; }', $selector, $style, $prefix . $value . $suffix ); if ( $echo ) { echo $return; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We need to double check this, but for now, we want to pass PHPCS ;) } return $return; } } if ( ! function_exists( 'twentytwenty_get_customizer_css' ) ) { /** * Get CSS Built from Customizer Options. * Build CSS reflecting colors, fonts and other options set in the Customizer, and return them for output. * * @param string $type Whether to return CSS for the "front-end", "block-editor" or "classic-editor". */ function twentytwenty_get_customizer_css( $type = 'front-end' ) { // Get variables. $body = sanitize_hex_color( twentytwenty_get_color_for_area( 'content', 'text' ) ); $body_default = '#000000'; $secondary = sanitize_hex_color( twentytwenty_get_color_for_area( 'content', 'secondary' ) ); $secondary_default = '#6d6d6d'; $borders = sanitize_hex_color( twentytwenty_get_color_for_area( 'content', 'borders' ) ); $borders_default = '#dcd7ca'; $accent = sanitize_hex_color( twentytwenty_get_color_for_area( 'content', 'accent' ) ); $accent_default = '#cd2653'; // Header. $header_footer_background = sanitize_hex_color( twentytwenty_get_color_for_area( 'header-footer', 'background' ) ); $header_footer_background_default = '#ffffff'; // Cover. $cover = sanitize_hex_color( get_theme_mod( 'cover_template_overlay_text_color' ) ); $cover_default = '#ffffff'; // Background. $background = sanitize_hex_color_no_hash( get_theme_mod( 'background_color' ) ); $background_default = 'f5efe0'; ob_start(); /** * Note – Styles are applied in this order: * 1. Element specific * 2. Helper classes * * This enables all helper classes to overwrite base element styles, * meaning that any color classes applied in the block editor will * have a higher priority than the base element styles. */ // Front-End Styles. if ( 'front-end' === $type ) { // Auto-calculated colors. $elements_definitions = twentytwenty_get_elements_array(); foreach ( $elements_definitions as $context => $props ) { foreach ( $props as $key => $definitions ) { foreach ( $definitions as $property => $elements ) { /* * If we don't have an elements array or it is empty * then skip this iteration early; */ if ( ! is_array( $elements ) || empty( $elements ) ) { continue; } $val = twentytwenty_get_color_for_area( $context, $key ); if ( $val ) { twentytwenty_generate_css( implode( ',', $elements ), $property, $val ); } } } } if ( $cover && $cover !== $cover_default ) { twentytwenty_generate_css( '.overlay-header .header-inner', 'color', $cover ); twentytwenty_generate_css( '.cover-header .entry-header *', 'color', $cover ); } // Block Editor Styles. } elseif ( 'block-editor' === $type ) { // Colors. // Accent color. if ( $accent && $accent !== $accent_default ) { twentytwenty_generate_css( '.has-accent-color, .editor-styles-wrapper .editor-block-list__layout a, .editor-styles-wrapper .has-drop-cap:not(:focus)::first-letter, .editor-styles-wrapper .wp-block-button.is-style-outline .wp-block-button__link, .editor-styles-wrapper .wp-block-pullquote::before, .editor-styles-wrapper .wp-block-file .wp-block-file__textlink', 'color', $accent ); twentytwenty_generate_css( '.editor-styles-wrapper .wp-block-quote', 'border-color', $accent, '' ); twentytwenty_generate_css( '.has-accent-background-color, .editor-styles-wrapper .wp-block-button__link, .editor-styles-wrapper .wp-block-file__button', 'background-color', $accent ); } // Background color. if ( $background && $background !== $background_default ) { twentytwenty_generate_css( '.editor-styles-wrapper', 'background-color', '#' . $background ); twentytwenty_generate_css( '.has-background.has-primary-background-color:not(.has-text-color),.has-background.has-primary-background-color *:not(.has-text-color),.has-background.has-accent-background-color:not(.has-text-color),.has-background.has-accent-background-color *:not(.has-text-color)', 'color', '#' . $background ); } // Borders color. if ( $borders && $borders !== $borders_default ) { twentytwenty_generate_css( '.editor-styles-wrapper .wp-block-code, .editor-styles-wrapper pre, .editor-styles-wrapper .wp-block-preformatted pre, .editor-styles-wrapper .wp-block-verse pre, .editor-styles-wrapper fieldset, .editor-styles-wrapper .wp-block-table, .editor-styles-wrapper .wp-block-table *, .editor-styles-wrapper .wp-block-table.is-style-stripes, .editor-styles-wrapper .wp-block-latest-posts.is-grid li', 'border-color', $borders ); twentytwenty_generate_css( '.editor-styles-wrapper .wp-block-table caption, .editor-styles-wrapper .wp-block-table.is-style-stripes tbody tr:nth-child(odd)', 'background-color', $borders ); } // Text color. if ( $body && $body !== $body_default ) { twentytwenty_generate_css( 'body .editor-styles-wrapper, .editor-post-title__block .editor-post-title__input, .editor-post-title__block .editor-post-title__input:focus', 'color', $body ); } // Secondary color. if ( $secondary && $secondary !== $secondary_default ) { twentytwenty_generate_css( '.editor-styles-wrapper figcaption, .editor-styles-wrapper cite, .editor-styles-wrapper .wp-block-quote__citation, .editor-styles-wrapper .wp-block-quote cite, .editor-styles-wrapper .wp-block-quote footer, .editor-styles-wrapper .wp-block-pullquote__citation, .editor-styles-wrapper .wp-block-pullquote cite, .editor-styles-wrapper .wp-block-pullquote footer, .editor-styles-wrapper ul.wp-block-archives li, .editor-styles-wrapper ul.wp-block-categories li, .editor-styles-wrapper ul.wp-block-latest-posts li, .editor-styles-wrapper ul.wp-block-categories__list li, .editor-styles-wrapper .wp-block-latest-comments time, .editor-styles-wrapper .wp-block-latest-posts time', 'color', $secondary ); } // Header Footer Background Color. if ( $header_footer_background && $header_footer_background !== $header_footer_background_default ) { twentytwenty_generate_css( '.editor-styles-wrapper .wp-block-pullquote::before', 'background-color', $header_footer_background ); } } elseif ( 'classic-editor' === $type ) { // Colors. // Accent color. if ( $accent && $accent !== $accent_default ) { twentytwenty_generate_css( 'body#tinymce.wp-editor.content a, body#tinymce.wp-editor.content a:focus, body#tinymce.wp-editor.content a:hover', 'color', $accent ); twentytwenty_generate_css( 'body#tinymce.wp-editor.content blockquote, body#tinymce.wp-editor.content .wp-block-quote', 'border-color', $accent, '', ' !important' ); twentytwenty_generate_css( 'body#tinymce.wp-editor.content button, body#tinymce.wp-editor.content .faux-button, body#tinymce.wp-editor.content .wp-block-button__link, body#tinymce.wp-editor.content .wp-block-file__button, body#tinymce.wp-editor.content input[type=\'button\'], body#tinymce.wp-editor.content input[type=\'reset\'], body#tinymce.wp-editor.content input[type=\'submit\']', 'background-color', $accent ); } // Background color. if ( $background && $background !== $background_default ) { twentytwenty_generate_css( 'body#tinymce.wp-editor.content', 'background-color', '#' . $background ); } // Text color. if ( $body && $body !== $body_default ) { twentytwenty_generate_css( 'body#tinymce.wp-editor.content', 'color', $body ); } // Secondary color. if ( $secondary && $secondary !== $secondary_default ) { twentytwenty_generate_css( 'body#tinymce.wp-editor.content hr:not(.is-style-dots), body#tinymce.wp-editor.content cite, body#tinymce.wp-editor.content figcaption, body#tinymce.wp-editor.content .wp-caption-text, body#tinymce.wp-editor.content .wp-caption-dd, body#tinymce.wp-editor.content .gallery-caption', 'color', $secondary ); } // Borders color. if ( $borders && $borders !== $borders_default ) { twentytwenty_generate_css( 'body#tinymce.wp-editor.content pre, body#tinymce.wp-editor.content hr, body#tinymce.wp-editor.content fieldset,body#tinymce.wp-editor.content input, body#tinymce.wp-editor.content textarea', 'border-color', $borders ); } } // Return the results. return ob_get_clean(); } } PK �;0]p/ �/ core/tools.phpnu �[��� PK �;0]�-%�u� u� �/ core/generator.phpnu �[��� PK �;0]��f�) �) �� core/assets.phpnu �[��� PK �;0]A�-~ -~ v� core/generator-views.phpnu �[��� PK <0]��� � �c icon-functions.phpnu �[��� PK <0]���W �W �q template-tags.phpnu �[��� PK <0]���� � �� customizer.phpnu �[��� PK <0]9q9 + + �� color-patterns.phpnu �[��� PK <0]�G 1 helper-functions.phpnu �[��� PK <0]\�s� � y back-compat.phpnu �[��� PK <0]�E��� � s template-functions.phpnu �[��� PK �@0]l�<i; ; \: svg-icons.phpnu �[��� PK �@0]�J�cc. c. �A starter-content.phpnu �[��� PK �@0]^�m�$ $ zp custom-css.phpnu �[��� PK q Ĕ
dvadf
dvadf
| ver. 1.4 |
Github
|
.
| PHP 8.2.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings