Minor code style adjustments
This commit is contained in:
parent
bd92338d85
commit
d49336dee5
3
.stylelintrc.json
Normal file
3
.stylelintrc.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "stylelint-config-wordpress"
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "stklcode/wp-liveticker2",
|
"name": "stklcode/wp-liveticker2",
|
||||||
"version": "1.0.0-beta",
|
"version": "1.0.0-rc1",
|
||||||
"description": "A simple Liveticker for Wordpress.",
|
"description": "A simple Liveticker for Wordpress.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"wordpress",
|
"wordpress",
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Exit if accessed directly.
|
// Exit if accessed directly.
|
||||||
defined( 'ABSPATH' ) || exit;
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WP Liveticker 2 admin configuration.
|
* WP Liveticker 2 admin configuration.
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Exit if accessed directly.
|
// Exit if accessed directly.
|
||||||
defined( 'ABSPATH' ) || exit;
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WP Liveticker 2 system configuration.
|
* WP Liveticker 2 system configuration.
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
* @package WPLiveticker2
|
* @package WPLiveticker2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class WPLiveticker2_Widget.
|
* Class WPLiveticker2_Widget.
|
||||||
*/
|
*/
|
||||||
@ -32,6 +36,8 @@ class WPLiveticker2_Widget extends WP_Widget {
|
|||||||
* @param array $args Display arguments including 'before_title', 'after_title',
|
* @param array $args Display arguments including 'before_title', 'after_title',
|
||||||
* 'before_widget', and 'after_widget'.
|
* 'before_widget', and 'after_widget'.
|
||||||
* @param array $instance The settings for the particular instance of the widget.
|
* @param array $instance The settings for the particular instance of the widget.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function widget( $args, $instance ) {
|
public function widget( $args, $instance ) {
|
||||||
// Notify WPLT2 class that widget is present.
|
// Notify WPLT2 class that widget is present.
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Exit if accessed directly.
|
// Exit if accessed directly.
|
||||||
defined( 'ABSPATH' ) || exit;
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WP Liveticker 2.
|
* WP Liveticker 2.
|
||||||
@ -237,13 +239,15 @@ class WPLiveticker2 {
|
|||||||
}
|
}
|
||||||
$output .= '<a href="' . esc_attr( $feed_link ) . '">Feed</a>';
|
$output .= '<a href="' . esc_attr( $feed_link ) . '">Feed</a>';
|
||||||
}
|
}
|
||||||
}// End if().
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register frontend CSS.
|
* Register frontend CSS.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function enqueue_styles() {
|
public static function enqueue_styles() {
|
||||||
// Only add if shortcode is present.
|
// Only add if shortcode is present.
|
||||||
@ -259,6 +263,8 @@ class WPLiveticker2 {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Register frontend JS.
|
* Register frontend JS.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function enqueue_scripts() {
|
public static function enqueue_scripts() {
|
||||||
// Only add if shortcode is present.
|
// Only add if shortcode is present.
|
||||||
@ -294,7 +300,7 @@ class WPLiveticker2 {
|
|||||||
check_ajax_referer( 'wplt2_update-ticks' );
|
check_ajax_referer( 'wplt2_update-ticks' );
|
||||||
|
|
||||||
// Extract update requests.
|
// Extract update requests.
|
||||||
if ( isset( $_POST['update'] ) && is_array( $_POST['update'] ) ) {
|
if ( isset( $_POST['update'] ) && is_array( $_POST['update'] ) ) { // Input var okay.
|
||||||
$res = array();
|
$res = array();
|
||||||
// @codingStandardsIgnoreLine Sanitization of arrayhandled on field level.
|
// @codingStandardsIgnoreLine Sanitization of arrayhandled on field level.
|
||||||
foreach ( wp_unslash( $_POST['update'] ) as $update_req ) {
|
foreach ( wp_unslash( $_POST['update'] ) as $update_req ) {
|
||||||
@ -357,7 +363,7 @@ class WPLiveticker2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Echo JSON encoded result set.
|
// Echo JSON encoded result set.
|
||||||
echo json_encode( $res );
|
echo wp_json_encode( $res );
|
||||||
}
|
}
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
@ -376,6 +382,8 @@ class WPLiveticker2 {
|
|||||||
* Update options.
|
* Update options.
|
||||||
*
|
*
|
||||||
* @param array $options Optional. New options to save.
|
* @param array $options Optional. New options to save.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected static function update_options( $options = null ) {
|
protected static function update_options( $options = null ) {
|
||||||
self::$_options = wp_parse_args(
|
self::$_options = wp_parse_args(
|
||||||
|
88
package-lock.json
generated
Normal file
88
package-lock.json
generated
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"name": "wp-liveticker2",
|
||||||
|
"version": "1.0.0-beta",
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"requires": true,
|
||||||
|
"dependencies": {
|
||||||
|
"cssesc": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-S2hzrpWvE6G/rW7i7IxJfWBYn27QWfOIncUW++8Rbo1VB5zsJDSVPcnI+Q8z7rhxT6/yZeLOCja4cZnghJrNGA=="
|
||||||
|
},
|
||||||
|
"indexes-of": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc="
|
||||||
|
},
|
||||||
|
"lodash": {
|
||||||
|
"version": "4.17.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
|
||||||
|
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
|
||||||
|
},
|
||||||
|
"postcss-media-query-parser": {
|
||||||
|
"version": "0.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz",
|
||||||
|
"integrity": "sha1-J7Ocb02U+Bsac7j3Y1HGCeXO8kQ="
|
||||||
|
},
|
||||||
|
"postcss-resolve-nested-selector": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.1.tgz",
|
||||||
|
"integrity": "sha1-Kcy8fDfe36wwTp//C/FZaz9qDk4="
|
||||||
|
},
|
||||||
|
"postcss-selector-parser": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-5h+MvEjnzu1qy6MabjuoPatsGAjjDV9B24e7Cktjl+ClNtjVjmvAXjOFQr1u7RlWULKNGYaYVE4s+DIIQ4bOGA==",
|
||||||
|
"requires": {
|
||||||
|
"cssesc": "^1.0.1",
|
||||||
|
"indexes-of": "^1.0.1",
|
||||||
|
"uniq": "^1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"postcss-value-parser": {
|
||||||
|
"version": "3.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
|
||||||
|
"integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ=="
|
||||||
|
},
|
||||||
|
"stylelint-config-recommended": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-ajMbivOD7JxdsnlS5945KYhvt7L/HwN6YeYF2BH6kE4UCLJR0YvXMf+2j7nQpJyYLZx9uZzU5G1ZOSBiWAc6yA=="
|
||||||
|
},
|
||||||
|
"stylelint-config-recommended-scss": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-3.2.0.tgz",
|
||||||
|
"integrity": "sha512-M8BFHMRf8KNz5EQPKJd8nMCGmBd2o5coDEObfHVbEkyLDgjIf1V+U5dHjaGgvhm0zToUxshxN+Gc5wpbOOew4g==",
|
||||||
|
"requires": {
|
||||||
|
"stylelint-config-recommended": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"stylelint-config-wordpress": {
|
||||||
|
"version": "13.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/stylelint-config-wordpress/-/stylelint-config-wordpress-13.1.0.tgz",
|
||||||
|
"integrity": "sha512-dpKj2/d3/XjDVoOvQzd54GoM8Rj5zldluOZKkVhBCc4JYMc6r1VYL5hpcgIjqy/i2Hyqg4Rh7zTafE/2AWq//w==",
|
||||||
|
"requires": {
|
||||||
|
"stylelint-config-recommended": "^2.1.0",
|
||||||
|
"stylelint-config-recommended-scss": "^3.2.0",
|
||||||
|
"stylelint-scss": "^3.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"stylelint-scss": {
|
||||||
|
"version": "3.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-3.3.2.tgz",
|
||||||
|
"integrity": "sha512-0x+nD1heoMJYOfi3FfGcz3Hrwhcm+Qyq+BuvoBv5v9xrZZ1aziRXQauuhjwb87gWAa9MBzxhfUqBnvTUrHlLjA==",
|
||||||
|
"requires": {
|
||||||
|
"lodash": "^4.17.10",
|
||||||
|
"postcss-media-query-parser": "^0.2.3",
|
||||||
|
"postcss-resolve-nested-selector": "^0.1.1",
|
||||||
|
"postcss-selector-parser": "^4.0.0",
|
||||||
|
"postcss-value-parser": "^3.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uniq": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,5 +3,8 @@
|
|||||||
"version": "1.0.0-beta",
|
"version": "1.0.0-beta",
|
||||||
"description": "A simple Liveticker for Wordpress.",
|
"description": "A simple Liveticker for Wordpress.",
|
||||||
"author": "Stefan Kalscheuer",
|
"author": "Stefan Kalscheuer",
|
||||||
"license": "GPL-2.0+"
|
"license": "GPL-2.0+",
|
||||||
|
"dependencies": {
|
||||||
|
"stylelint-config-wordpress": "^13.1.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<description>Derived from WordPress Coding Standard</description>
|
<description>Derived from WordPress Coding Standard</description>
|
||||||
|
|
||||||
<!-- Config arguments -->
|
<!-- Config arguments -->
|
||||||
<arg value="psvn"/>
|
<arg value="psv"/>
|
||||||
<arg name="colors"/>
|
<arg name="colors"/>
|
||||||
|
|
||||||
<!-- Files to sniff -->
|
<!-- Files to sniff -->
|
||||||
@ -13,7 +13,9 @@
|
|||||||
|
|
||||||
<!-- Compliance with WordPress Coding Standard -->
|
<!-- Compliance with WordPress Coding Standard -->
|
||||||
<config name="minimum_supported_wp_version" value="4.0"/>
|
<config name="minimum_supported_wp_version" value="4.0"/>
|
||||||
<rule ref="WordPress"/>
|
<rule ref="WordPress">
|
||||||
|
<exclude name="WordPress.VIP.SlowDBQuery.slow_db_query_tax_query"/>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<!-- PHP compatibility level -->
|
<!-- PHP compatibility level -->
|
||||||
<config name="testVersion" value="5.2-"/>
|
<config name="testVersion" value="5.2-"/>
|
||||||
|
@ -3,7 +3,7 @@ ul.wplt2-ticker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ul.wplt2-ticker > li.wplt2-tick {
|
ul.wplt2-ticker > li.wplt2-tick {
|
||||||
background-color: #F5F5F5;
|
background-color: #f5f5f5;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
margin: 0.1em;
|
margin: 0.1em;
|
||||||
padding: 0.1em 0.3em;
|
padding: 0.1em 0.3em;
|
||||||
@ -14,14 +14,14 @@ li.wplt2-tick p {
|
|||||||
}
|
}
|
||||||
|
|
||||||
span.wplt2-tick-time {
|
span.wplt2-tick-time {
|
||||||
color: #002C58;
|
color: #002c58;
|
||||||
font-size: 0.7em;
|
font-size: 0.7em;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.wplt2-tick-title {
|
span.wplt2-tick-title {
|
||||||
color: #002C58;
|
color: #002c58;
|
||||||
font-weight: bold;
|
font-weight: 700;
|
||||||
margin-left: 0.5em;
|
margin-left: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ span.wplt2-widget-time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
span.wplt2-widget-content {
|
span.wplt2-widget-content {
|
||||||
color: #002C58;
|
color: #002c58;
|
||||||
text-indent: 0.2em;
|
text-indent: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ defined( 'ABSPATH' ) || exit;
|
|||||||
<div id="icon-options-general" class="icon32"><br></div>
|
<div id="icon-options-general" class="icon32"><br></div>
|
||||||
<h2>Liveticker <?php esc_html_e( 'Settings', 'wplt2' ); ?></h2>
|
<h2>Liveticker <?php esc_html_e( 'Settings', 'wplt2' ); ?></h2>
|
||||||
<?php
|
<?php
|
||||||
if ( isset( $_GET['settings-updated'] ) ) {
|
if ( isset( $_GET['settings-updated'] ) ) { // phpcs:ignore
|
||||||
echo '<div class="updated"><p>' . esc_html__( 'Settings updated successfully.', 'wplt2' ) . '</p></div>';
|
echo '<div class="updated"><p>' . esc_html__( 'Settings updated successfully.', 'wplt2' ) . '</p></div>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
*
|
*
|
||||||
* @wordpress-plugin
|
* @wordpress-plugin
|
||||||
* Plugin Name: WP Liveticker 2
|
* Plugin Name: WP Liveticker 2
|
||||||
* Description: A simple Liveticker for Wordpress.
|
* Description: A simple Liveticker for WordPress.
|
||||||
* Version: 1.0.0 alpha
|
* Version: 1.0.0-beta
|
||||||
* Author: Stefan Kalscheuer
|
* Author: Stefan Kalscheuer
|
||||||
* Author URI: https://www.stklcode.de
|
* Author URI: https://www.stklcode.de
|
||||||
* Text Domain: wplt2
|
* Text Domain: wplt2
|
||||||
@ -31,7 +31,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Exit if accessed directly.
|
// Exit if accessed directly.
|
||||||
defined( 'ABSPATH' ) || exit;
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Constants.
|
// Constants.
|
||||||
define( 'WPLT2_FILE', __FILE__ );
|
define( 'WPLT2_FILE', __FILE__ );
|
||||||
@ -61,7 +63,7 @@ spl_autoload_register( 'wplt2_autoload' );
|
|||||||
*
|
*
|
||||||
* @param string $class Name of the class to load.
|
* @param string $class Name of the class to load.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @return void
|
||||||
*/
|
*/
|
||||||
function wplt2_autoload( $class ) {
|
function wplt2_autoload( $class ) {
|
||||||
$plugin_classes = array(
|
$plugin_classes = array(
|
||||||
@ -71,12 +73,10 @@ function wplt2_autoload( $class ) {
|
|||||||
'WPLiveticker2_Widget',
|
'WPLiveticker2_Widget',
|
||||||
);
|
);
|
||||||
if ( in_array( $class, $plugin_classes, true ) ) {
|
if ( in_array( $class, $plugin_classes, true ) ) {
|
||||||
require_once(
|
require_once sprintf(
|
||||||
sprintf(
|
'%s/includes/class-%s.php',
|
||||||
'%s/includes/class-%s.php',
|
WPLT2_DIR,
|
||||||
WPLT2_DIR,
|
strtolower( str_replace( '_', '-', $class ) )
|
||||||
strtolower( str_replace( '_', '-', $class ) )
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user