-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from ernilambar/update/packages
Update/packages
- Loading branch information
Showing
16 changed files
with
1,492 additions
and
5,292 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: 'Plugin Check' | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
pcp: | ||
name: PCP | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Build plugin | ||
run: pnpm run deploy | ||
|
||
- name: Run plugin check | ||
uses: wordpress/plugin-check-action@v1 | ||
with: | ||
build-dir: './deploy/ns-featured-posts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,4 +50,8 @@ build/ | |
deploy/ | ||
docs/ | ||
node_modules/ | ||
|
||
# Vendor | ||
vendor/ | ||
devtools/vendor/ | ||
devtools/composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="WordPress Coding Standards for plugin"> | ||
<description>Apply WordPress Coding Standards</description> | ||
|
||
<!-- | ||
Prevent errors caused by WordPress Coding Standards not supporting PHP 8.0+. | ||
See https://github.com/WordPress/WordPress-Coding-Standards/issues/2035 | ||
--> | ||
<ini name="error_reporting" value="E_ALL & ~E_DEPRECATED" /> | ||
|
||
<!-- What to scan --> | ||
<file>.</file> | ||
|
||
<!-- Exclude files and folders --> | ||
<exclude-pattern>*/build/*</exclude-pattern> | ||
<exclude-pattern>*/deploy/*</exclude-pattern> | ||
<exclude-pattern>*/languages/*</exclude-pattern> | ||
<exclude-pattern>*/node_modules/*</exclude-pattern> | ||
<exclude-pattern>*/tests/*</exclude-pattern> | ||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
<exclude-pattern>*\.(css|js)</exclude-pattern> | ||
|
||
<!-- How to scan --> | ||
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage --> | ||
<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> | ||
<arg value="sp"/> <!-- Show sniff and progress --> | ||
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit --> | ||
<arg name="colors"/> | ||
<arg name="extensions" value="php"/> | ||
<arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. --> | ||
|
||
<!-- Minimum support WP Version. --> | ||
<config name="minimum_supported_wp_version" value="4.9"/> | ||
|
||
<!-- Don't worry about files that don't contain any code --> | ||
<rule ref="Internal.NoCodeFound"> | ||
<severity>0</severity> | ||
</rule> | ||
|
||
<!-- For CI, don't fail on warnings --> | ||
<config name="ignore_warnings_on_exit" value="1"/> | ||
|
||
<!-- Include the WordPress rulesets. --> | ||
<rule ref="WordPress"> | ||
<exclude name="WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents"/> | ||
</rule> | ||
|
||
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing"> | ||
<properties> | ||
<property name="blank_line_check" value="true"/> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="WordPress-Extra"> | ||
<!-- Forget about file names --> | ||
<exclude name="WordPress.Files.FileName"/> | ||
|
||
<!-- Allow WP global modification --> | ||
<exclude name="WordPress.WP.GlobalVariablesOverride.Prohibited"/> | ||
|
||
<!-- This nonce sniff almost never works right --> | ||
<exclude name="WordPress.Security.NonceVerification.Missing"/> | ||
|
||
<!-- Remove nonce notice --> | ||
<exclude name="WordPress.Security.NonceVerification.Recommended"/> | ||
</rule> | ||
|
||
<!-- Make missing translator comment a warning. --> | ||
<rule ref="WordPress.WP.I18n.MissingTranslatorsComment"> | ||
<type>warning</type> | ||
</rule> | ||
|
||
<!-- Sometimes we need to override globals --> | ||
<rule ref="WordPress.WP.GlobalVariablesOverride.OverrideProhibited"> | ||
<type>warning</type> | ||
</rule> | ||
|
||
<rule ref="WordPress.WP.I18n"> | ||
<properties> | ||
<property name="text_domain" type="array" value="ns-featured-posts" /> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="WordPress.Utils.I18nTextDomainFixer"> | ||
<properties> | ||
<property name="old_text_domain" type="array"> | ||
<element value="" /> | ||
</property> | ||
<property name="new_text_domain" value="ns-featured-posts" /> | ||
</properties> | ||
</rule> | ||
|
||
<!-- Loads the PHP Compatibility ruleset. --> | ||
<rule ref="PHPCompatibilityWP" /> | ||
|
||
<!-- PHP version check. --> | ||
<config name="testVersion" value="5.6-"/> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
composer.json | ||
deploy | ||
node_modules | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"@wordpress/prettier-config" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
{ | ||
"$schema": "https://playground.wordpress.net/blueprint-schema.json", | ||
"landingPage": "\/wp-admin\/options-general.php?page=ns-featured-posts", | ||
"phpExtensionBundles": [ | ||
"kitchen-sink" | ||
], | ||
"steps": [ | ||
{ | ||
"step": "login", | ||
"username": "admin", | ||
"password": "password" | ||
}, | ||
{ | ||
"step": "installPlugin", | ||
"pluginZipFile": { | ||
"resource": "wordpress.org\/plugins", | ||
"slug": "ns-featured-posts" | ||
}, | ||
"options": { | ||
"activate": true | ||
} | ||
} | ||
] | ||
"$schema": "https://playground.wordpress.net/blueprint-schema.json", | ||
"landingPage": "/wp-admin/options-general.php?page=ns-featured-posts", | ||
"phpExtensionBundles": [ "kitchen-sink" ], | ||
"steps": [ | ||
{ | ||
"step": "login", | ||
"username": "admin", | ||
"password": "password" | ||
}, | ||
{ | ||
"step": "installPlugin", | ||
"pluginZipFile": { | ||
"resource": "wordpress.org/plugins", | ||
"slug": "ns-featured-posts" | ||
}, | ||
"options": { | ||
"activate": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,74 @@ | ||
'use strict'; | ||
|
||
(function ($) { | ||
$.fn.blogPosts = function (options) { | ||
const settings = $.extend({ | ||
api: '', | ||
action: 'blog_posts', | ||
loading_text: 'Loading', | ||
list_type: 'ul' | ||
}, options); | ||
( function ( $ ) { | ||
$.fn.blogPosts = function ( options ) { | ||
const settings = $.extend( | ||
{ | ||
api: '', | ||
action: 'blog_posts', | ||
loading_text: 'Loading', | ||
list_type: 'ul', | ||
}, | ||
options | ||
); | ||
|
||
if ('' === settings.api) { | ||
if ( '' === settings.api ) { | ||
return this; | ||
} | ||
|
||
function generateList(data) { | ||
function generateList( data ) { | ||
let output = ''; | ||
|
||
if (0 === data.length) { | ||
if ( 0 === data.length ) { | ||
return output; | ||
} | ||
|
||
data.forEach(function (item) { | ||
output += '<li><a href="' + item.url + '" target="_blank">' + item.title + '</a></li>'; | ||
}); | ||
return $('<' + settings.list_type + '/>').append(output); | ||
data.forEach( function ( item ) { | ||
output += | ||
'<li><a href="' + | ||
item.url + | ||
'" target="_blank">' + | ||
item.title + | ||
'</a></li>'; | ||
} ); | ||
return $( '<' + settings.list_type + '/>' ).append( output ); | ||
} | ||
|
||
return this.each(function () { | ||
if ($(this).length < 1) { | ||
return this.each( function () { | ||
if ( $( this ).length < 1 ) { | ||
return; | ||
} | ||
|
||
const $wrapper = $(this); | ||
$.ajax({ | ||
const $wrapper = $( this ); | ||
$.ajax( { | ||
url: settings.api, | ||
type: 'GET', | ||
dataType: 'json', | ||
data: { | ||
action: settings.action | ||
action: settings.action, | ||
}, | ||
|
||
beforeSend() { | ||
$wrapper.html(settings.loading_text); | ||
$wrapper.html( settings.loading_text ); | ||
}, | ||
|
||
complete(jqXHR) { | ||
const response = JSON.parse(jqXHR.responseText); | ||
$wrapper.html(''); | ||
complete( jqXHR ) { | ||
const response = JSON.parse( jqXHR.responseText ); | ||
$wrapper.html( '' ); | ||
|
||
if (true === response.success) { | ||
const listMarkup = generateList(response.data); | ||
$wrapper.append(listMarkup); | ||
if ( true === response.success ) { | ||
const listMarkup = generateList( response.data ); | ||
$wrapper.append( listMarkup ); | ||
} | ||
} | ||
|
||
}); | ||
}); | ||
}, | ||
} ); | ||
} ); | ||
}; | ||
|
||
$(document).ready(function () { | ||
$('.ns-blog-list').blogPosts({ | ||
$( document ).ready( function () { | ||
$( '.ns-blog-list' ).blogPosts( { | ||
api: ajaxurl, | ||
action: 'nsfp_nsbl_get_posts' | ||
}); | ||
}); | ||
})(jQuery); | ||
action: 'nsfp_nsbl_get_posts', | ||
} ); | ||
} ); | ||
} )( jQuery ); |
Oops, something went wrong.