Coder Social home page Coder Social logo

ucf / ucf-resource-search-plugin Goto Github PK

View Code? Open in Web Editor NEW
0.0 8.0 0.0 1.16 MB

Plugin for displaying a resource search and list of resources via a shortcode.

PHP 75.71% JavaScript 20.03% SCSS 4.26%
wordpress-plugin wordpress ucf-cm athena-framework

ucf-resource-search-plugin's Introduction

UCF Resource Search Plugin

Provides a custom post type, shortcode, functions, and default styles for displaying a resource search input and list of resources.

Description

The resource search and links are added to pages using a ucf-resource-search shortcode.

The ucf-resource-search shortcode has several options:

Classic Layout

  • column_width - col-md-4 col-sm-4
  • column_count - 3
  • default_sorting - term
  • layout - classic or card
  • meta_key
  • meta_value
  • non_alpha_section_name - Other
  • order_by - title
  • order - ASC, DESC
  • post_type_name - post, page, etc
  • show_empty_sections - true|false
  • show_sorting - true|false
  • show_sorting - true|false
  • show_uncategorized - true|false
  • uncategorized_term_name - Uncategorized
  • taxonomy - category

Card Layout

  • layout - classic or card
  • order_by - title
  • order - ASC, DESC
  • post_type_name - post, page, etc
  • resource_link_type_filter - filter results by resource_link_type
  • taxonomy - category

Installation

Manual Installation

  1. Upload the plugin files (unzipped) to the /wp-content/plugins directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the "Plugins" screen in WordPress
  3. Configure plugin settings from the WordPress admin under "Settings > UCF Resource Search".

WP CLI Installation

  1. $ wp plugin install --activate https://github.com/UCF/UCF-Resource-Search-Plugin/archive/master.zip. See WP-CLI Docs for more command options.
  2. Configure plugin settings from the WordPress admin under "Settings > UCF Resource Search".

Dependencies

  • Athena-Framework or Bootstrap 4
  • FontAwesome (if using the card layout)

Changelog

1.0.9

Enhancements:

  • Added composer file.

1.0.8

Enhancements:

  • Update packages and gulpfile in #35
  • Updated social links in the card layout to use differentiating sr-only text in #36
  • Added a card_layout_title_element shortcode attribute in #36
  • Adjusted default underline styles for the resource-links in #36

1.0.7

  • Moved resource search initialization JS to the document footer
  • Fixed enqueuing of ucf-resource_search_js to declare jQuery as a dependency
  • Fixed some missing variables and CSS class names and values

1.0.6

  • Added late JS enqueuing
  • Added plugin version cache-busting to enqueued assets
  • Updated constants for consistency with other plugins
  • Prepended plugin dir to required files in main plugin file
  • Added Github issue/PR templates and contributing doc; updated gitignore
  • Upgraded packages + re-ran gulp

1.0.5

  • Added setting to exclude the social media fields from the admin.

1.0.4

  • Added card layout option for ucf-resource-search shortcode
  • Added fields for social links

1.0.3

  • Updated plugin description

1.0.2

  • Fixed PHP notices
  • Removed Athena classes
  • Fixed search

1.0.0

  • Initial release

Upgrade Notice

n/a

Installation Requirements

None

Development & Contributing

NOTE: this plugin's readme.md file is automatically generated. Please only make modifications to the readme.txt file, and make sure the gulp readme command has been run before committing readme changes.

ucf-resource-search-plugin's People

Contributors

cadie avatar cjg89 avatar jmbarne3 avatar mcatech avatar rjucf avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ucf-resource-search-plugin's Issues

InfoSec flagged issue

</script> <script type='text/javascript' src='[Site URL Redacted]/wp-content/plugins/UCF-Resource-Search/static/js/ucf-resource-search.min.js'></script> `var t=window.location.hash;t&&-1!==t.indexOf("#filter-")&&("filter-all"===(t=t.replace("#",""))?$resourceLinkCards.show():$resourceLinkCards.show().not("."+t).hide(),isResourceFilterLeft&&scrollToElement($UcfResourceDirectoryItems),setSelected($("."+t)))`

Data is read from window.location.hash and passed to $() via the following statements:

var t=window.location.hash;
$("." + t)

https://cwe.mitre.org/data/definitions/79.html

Update layout styles for compatibility with Athena v1.1.1+

Description
See title.

Why it's Important
Underlines were added to all links by default in Athena v1.1.1 and can look a bit messy on certain components/layouts.

Alternatives
n/a

Possible Implementation
Remove underlines; test removal of underlines against accessibility scanners

Additional context
See the A-Z index on ucf.edu as an example.

Remove/replace <article> wrapper surrounding both layouts

<article> is probably not the most appropriate tag to surround the resource search + its contents, and it also conflicts with most of our themes that include a single wrapper <article> around page/post content and don't include a unique aria-label for it.

Search form accessibility improvements

The search form that gets generated for the main resource search feature doesn't include a submit button; we get flagged in Site Improve for every page/instance where this occurs.

We'll need to either:

  • Implement an actual submit button that forces results to be present on submit
  • Or, ensure we're meeting "change of context" requirements as necessary to meet WCAG 2.0 requirements

More info
https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/G13
https://www.w3.org/TR/WCAG20-TECHS/H32.html

Plugin stylesheet fails to enqueue when plugin options haven't been updated at least once

public static function enqueue_styles() {
if ( get_option( 'ucf_resource_search_include_css' ) ) {
wp_enqueue_style( 'ucf_resource_search_css', plugins_url( 'static/css/ucf-resource-search.min.css', UCF_Resource_Search__PLUGIN_FILE ), false, false, 'all' );
}
}

Need to enforce an expected default value of true when calling get_option() here; otherwise it'll return empty if the user hasn't force-saved the plugin options at least once.

UCF_Resource_Link_Type::register_meta_fields() doesn't register actions correctly

Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'UCF_Resource_Link_PostType' does not have a method 'add_resource_link_types_fields' in /wordpress/wp-includes/class-wp-hook.php on line 286

Looks like these actions are getting registered referencing the wrong class name (should be add_action( '...', array( 'UCF_Resource_Link_Type', '...' ) instead of add_action( '...', array( 'UCF_Resource_Link_PostType', '...' ):
https://github.com/UCF/UCF-Resource-Search-Plugin/blob/master/includes/ucf-resource-link-tax.php#L14-L17

Move inline resource search init JS to document footer

Description

See title; inline JS used to initialize PostTypeSearchDataManager should be moved to the document footer (currently it's printed in a <script> manually in the "classic" layout)

ob_start();
?>
<script type="text/javascript">
if (typeof jQuery !== 'undefined') {
jQuery(document).ready(function ($) {
PostTypeSearchDataManager.register(new PostTypeSearchData(
<?php echo json_encode( $args['column_count'] ); ?>,
<?php echo json_encode( $args['column_width'] ); ?>,
<?php echo json_encode( $items ); ?>
));
});
} else {
console.log('jQuery dependency failed to load');
}
</script>
<?php
$script = ob_get_clean();

Why it's Important

To allow jQuery to be loaded in the document footer, and better ensure it's available when the resource search JS needs to run.

Alternatives

n/a

Possible Implementation

  1. Use wp_add_inline_script( 'ucf-resource_search_js', $string ) instead of prepending $string to the rest of the layout markup.
  2. Update null to array( 'jquery' ) on the line below to ensure ucf-resource_search_js is registered with jquery as a dependency:

wp_register_script( 'ucf-resource_search_js', UCF_RESOURCE_SEARCH__SCRIPT_URL . '/ucf-resource-search.min.js', null, $version, true );

Additional context

n/a

Filter nav items end up linking to elements on the page that don't exist

We get flagged in SiteImprove on pages where a resource search is included on the page with nav filters, due to each nav filter link linking out to page anchors that don't actually exist on the page.

Local link destination does not exist
1.3.1 Info and Relationships
Description of this issue:
A local link (anchor link) occurs but the destination does not exist.
How to fix it:
When using local links they must refer to an existing element on the page.

We need to update how these filter links work in a way to resolve the issue above. Maybe using <button>s instead of <a>s for each filter link would be a good place to start?

Fix notices

Strict Standards: Non-static method UCF_Resource_Link_PostType::get_labels() should not be called statically in /wordpress/wp-content/plugins/UCF-Resource-Search/includes/ucf-resource-link-posttype.php on line 15

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UCF_Resource_Search_Common::enqueue_styles() should not be called statically in /wordpress/wp-includes/class-wp-hook.php on line 298

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UCF_Resource_Search_Common::enqueue_scripts() should not be called statically in /wordpress/wp-includes/class-wp-hook.php on line 298

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.