Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
qstudio committed Mar 7, 2022
1 parent 0f6b7fd commit 25e1a8d
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 147 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.0.0 ###

* First submission to wordpress.org repo

### 0.0.2 ###

* New: Add editable message
Expand Down
6 changes: 0 additions & 6 deletions hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,13 @@ function __construct() {
* admin hooks
*/
public function admin(
\q\stand_with_ukraine\admin\api $api,
\q\stand_with_ukraine\admin\create $create,
\q\stand_with_ukraine\admin\read $read,
\q\stand_with_ukraine\admin\update $update,
\q\stand_with_ukraine\admin\delete $delete,
\q\stand_with_ukraine\admin\option $option
):void {

$api->hooks();
$create->hooks();
$read->hooks();
$update->hooks();
$delete->hooks();

if( \is_admin() ){

Expand Down
34 changes: 8 additions & 26 deletions library/admin/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,20 @@
*/
class api {

/**
* Class constructor to define object props
*
* @since 0.0.1
* @return void
*/
function __construct() {

}

/**
* WP Hooks
*
* @since 0.0.1
* @return __void
*/
public function hooks(){

// \add_action( 'wp_head', [ $this, 'javascript' ] );

}

/**
* Get download URL from API source
*
* @since 0.0.1
* @return mixed
* @since 0.0.1
*/
public function get_source_links(){}
public static function get_download_link():?string{}

/**
* Get list of download links from API source
*
* @since 0.0.1
* @return mixed
* @since 0.0.1
*/
public function get_donation_links(){}
public static function get_donation_links():?array{}

}
48 changes: 0 additions & 48 deletions library/admin/create.php

This file was deleted.

46 changes: 0 additions & 46 deletions library/admin/delete.php

This file was deleted.

19 changes: 17 additions & 2 deletions library/admin/option.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function render_screen(){
</td>
</tr>

<tr class="qswu_message_tr hidden">
<tr class="qswu_message_tr">
<th scope="row"><label for="qswu_message"><?php \_e("Message Text:", "q-stand-with-ukraine"); ?></label></th>
<td>
<input name="qswu_message" type="text" id="qswu_message" value="<?php echo \esc_html( $_array['message'] ); ?>" class="regular-text" maxlength="100" />
Expand Down Expand Up @@ -193,6 +193,21 @@ public function render_screen(){
</td>
</tr>

<tr>
<th scope="row"><?php \_e("Custom CSS", "q-stand-with-ukraine"); ?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<span><?php \_e("Custom CSS", "q-stand-with-ukraine"); ?></span>
</legend>
<p>
<textarea name="qswu_css" rows="4" cols="50" id="qswu_css" class="large-text code"><?php echo \wp_kses_post( $_array['css'] ); ?></textarea>
</p>
<p class="date-time-doc">Add Custom CSS rules</p>
</fieldset>
</td>
</tr>

</tbody>
</table>

Expand Down Expand Up @@ -240,7 +255,7 @@ private static function confirm():void{
if ( isset($_GET['qswu_status']) && $_GET['qswu_status']=='success') {

?>
<div id="message" class="updated notice is-dismissible">
<div id="message" class="updated notice notice-success is-dismissible">
<p><?php \_e("Settings updated", "q-stand-with-ukraine"); ?></p>
<button type="button" class="notice-dismiss">
<span class="screen-reader-text"><?php \_e("Dismiss this notice.", "q-stand-with-ukraine"); ?></span>
Expand Down
2 changes: 1 addition & 1 deletion library/admin/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function option(){
$_array['show_donate'] = isset( $_POST["qswu_show_donate"] ) ? (int) $_POST["qswu_show_donate"] : $_option['show_donate'];
$_array['show_download'] = isset( $_POST["qswu_show_download"] ) ? (int) $_POST["qswu_show_download"] : $_option['show_download'];
$_array['message'] = isset( $_POST["qswu_message"] ) ? \sanitize_text_field( $_POST["qswu_message"] ) : $_option['message'];
$_array['css'] = isset( $_POST["qswu_css"] ) ? \sanitize_text_field( $_POST["qswu_css"] ) : $_option['css'];
$_array['css'] = isset( $_POST["qswu_css"] ) ? \wp_kses_post( $_POST["qswu_css"] ) : $_option['css'];

// get all known donation urls ##
foreach( \q\stand_with_ukraine\admin\read::get_url_donate() as $_label => $_url ){
Expand Down
21 changes: 11 additions & 10 deletions library/theme/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,23 @@ public function hooks(){
*/
public function banner(){

// get stored values - returns defaults, if not edited ##
// get stored values - returns defaults, if not viewable ##
$_values = \q\stand_with_ukraine\admin\read::option();

// @todo - check if we can load all require ui options ##
if( ! $this->validate( $_values ) ){ return false; }
// check if banner is visible ##
if( ! $this->is_visible( $_values ) ){ return false; }

// get template markup ##
$_template = \q\stand_with_ukraine\theme\template::get();

// check visibillity settings ##
$_values['show_donate'] = $_values['show_donate'] === 1 ? 'visible' : 'hidden';
$_values['show_download'] = $_values['show_download'] === 1 ? 'visible' : 'hidden';
// define button visibillity settings ##
$_values['show_donate'] = isset( $_values['show_donate'] ) && $_values['show_donate'] === 1 ? 'visible' : 'hidden';
$_values['show_download'] = isset( $_values['show_download'] ) && $_values['show_download'] === 1 ? 'visible' : 'hidden';

// markup - array values are escaped ##
// @todo - use wp_kses ##
echo \q\stand_with_ukraine\theme\template::markup( $_template, $_values );
echo \wp_kses_post(
\q\stand_with_ukraine\theme\template::markup( $_template, $_values ),
);

}

Expand All @@ -74,9 +75,9 @@ public function banner(){
* @param array
* @since 0.0.1
*/
public function validate( $array ):bool{
public function is_visible( $array ):bool{

return $array['show_banner'] === 1 ? true : false ;
return isset( $array['show_banner'] ) && $array['show_banner'] === 1 ? true : false ;

}

Expand Down
2 changes: 1 addition & 1 deletion library/theme/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static function curvy_wrap( array $array = [], string $before = '{', stri

}

\__log( $_curvy_array );
// \__log( $_curvy_array );

return $_curvy_array;

Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class plugin {
private static

// current tag ##
$version = '0.0.2',
$version = '1.0.0',

// log ##
$log = null,
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Tags:** Banner, Plugin, Support, Ukraine
**Requires at least:** 5.0
**Tested up to:** 5.9.1
**Stable tag:** 0.0.2
**Stable tag:** 1.0.0
**License:** GPL-2.0+

Stand with Ukraine Banner Plugin for WordPress.org
Expand Down
36 changes: 36 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
=== Export User Data ===
Contributors: qlstudio
Tags: anner, Plugin, Support, Ukraine
Requires PHP: 7.0
Requires at least: 4.8
Tested up to: 5.9.1
Stable tag: 1.0.0
License: GPLv2

Stand with Ukraine Banner Plugin for WordPress.org

=== Description ===

Version 0.0.2 is a very basic POC, which needs fleshing out into something more dynamic, attractive and flexible.

Future plans:

- Translation .po/.mo files
- Admin screen option to control
- Select banner designs ( for example horizontal / corner triangle )
- Template editor
- Block option to include banner
- Central list of donation sources, managed from API call

== Screenshots ==

1. Example of Admin Export View
2. Example of front-end view

== Changelog ==

= 1.0.0 =
First submission to wordpress.org

= 0.0.2 =
First release.
Binary file added screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 2 additions & 5 deletions stand-with-ukraine.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Plugin Name: Stand with Ukraine Banner Plugin
* Plugin URI: https://github.com/qstudio/wordpress-plugin-stand-with-ukraine
* Description: Stand with Ukraine Banner Plugin for WordPress.org
* Version: 0.0.2
* Version: 1.0.0
* Author: Q Studio
* Author URI: https://qstudio.us
* License: GPL-2.0+
Expand Down Expand Up @@ -52,7 +52,7 @@
// validate instance ##
if( ! ( $plugin instanceof \q\stand_with_ukraine\plugin ) ) {

error_log( 'Error in stand_with_ukraine plugin instance' );
error_log( 'Error in q\stand_with_ukraine plugin instance' );

// nothing else to do here ##
return;
Expand All @@ -69,11 +69,8 @@

// admin hooks ##
$hooks->admin(
new \q\stand_with_ukraine\admin\api,
new \q\stand_with_ukraine\admin\create,
new \q\stand_with_ukraine\admin\read,
new \q\stand_with_ukraine\admin\update,
new \q\stand_with_ukraine\admin\delete,
new \q\stand_with_ukraine\admin\option,
);

Expand Down

0 comments on commit 25e1a8d

Please sign in to comment.