From: danix Date: Wed, 4 Jul 2018 15:57:25 +0000 (+0200) Subject: initial commit X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=8da42654c57573e7d241efadb0292b2ff6326537;p=danixland-countdown.git initial commit --- 8da42654c57573e7d241efadb0292b2ff6326537 diff --git a/danixland-countdown.php b/danixland-countdown.php new file mode 100644 index 0000000..c10f7a2 --- /dev/null +++ b/danixland-countdown.php @@ -0,0 +1,194 @@ + 400, 'height' => 350); + parent::__construct( + 'dnx-countdown', // id_base + __('danixland CountDown', 'dnxcd' ), // Name + array( 'description' => __('Use this widget to add a simple Count Down to your Sidebar', 'dnxcd') ), + $control_ops + ); + } + + /** + * How to display the widget on the public side of the site. + */ + public function widget( $args, $instance ) { + extract( $args ); + + /* Our variables from the widget settings. */ + $title = apply_filters('widget_title', $instance['title'] ); + + /* Before widget (defined by themes). */ + echo $before_widget; + + /* Display the widget title if one was input (before and after defined by themes). */ + if ( $title ) { + echo $before_title . $title . $after_title; + } + + if ( '' != get_option('dnxcd_future_date') ) { + echo '
'; + $date = gmdate('U', strtotime( get_option('dnxcd_future_date') )); + $diff = $date - gmdate('U'); + if ( '' != get_option('dnxcd_widget_link') ) { + echo ''; + echo '-' . floor($diff / (24 * 60 * 60)); + echo ''; + } else { + echo '-' . floor($diff / (24 * 60 * 60)); + } + echo '
'; + echo '
' . __('days to go', 'dnxcd') . '
'; + } else { + echo "
" . __('the date is missing
configure widget', 'dnxcd') . "
"; + } + + /* After widget (defined by themes). */ + echo $after_widget; + } + + //Update the widget + + public function update( $new_instance, $old_instance ) { + $instance = $old_instance; + + //Strip tags from title and name to remove HTML + $instance['title'] = sanitize_text_field( $new_instance['title'] ); + $instance['date'] = strip_tags( $new_instance['date'] ); + $instance['link'] = esc_url( $new_instance['link'], array('http', 'https') ); + $instance['style'] = (bool) $new_instance['style']; + + update_option( 'dnxcd_future_date', $instance['date'] ); + update_option( 'dnxcd_widget_link', $instance['link'] ); + update_option( 'dnxcd_use_style', $instance['style'] ); + + return $instance; + } + + /** + * Displays just a quick notice with a link to the Settings page + */ + public function form( $instance ) { + $defaults = array( + 'title' => __( 'Count Down', 'dnxcd' ), + 'date' => get_option( 'dnxcd_future_date' ), + 'link' => get_option( 'dnxcd_widget_link' ), + 'style' => get_option( 'dnxcd_use_style' ) + ); + $instance = wp_parse_args( (array) $instance, $defaults ); + extract( $instance, EXTR_SKIP ); + ?> + +

+ + +

+

+ + + + +

+

+ id="get_field_id( 'style' ); ?>" name="get_field_name( 'style' ); ?>" /> + +

+ diff --git a/i18n/danixland-countdown.pot b/i18n/danixland-countdown.pot new file mode 100644 index 0000000..ded775b --- /dev/null +++ b/i18n/danixland-countdown.pot @@ -0,0 +1,72 @@ +# Copyright (C) 2016 danixland CountDown +# This file is distributed under the same license as the danixland CountDown package. +msgid "" +msgstr "" +"Project-Id-Version: danixland CountDown 0.4\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/danixland-" +"countdown\n" +"POT-Creation-Date: 2016-01-22 11:15:01+00:00\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" + +#. #-#-#-#-# plugin.pot (danixland CountDown 0.4) #-#-#-#-# +#. Plugin Name of the plugin/theme +#: danixland-countdown.php:100 +msgid "danixland CountDown" +msgstr "" + +#: danixland-countdown.php:101 +msgid "Use this widget to add a simple Count Down to your Sidebar" +msgstr "" + +#: danixland-countdown.php:135 +msgid "days to go" +msgstr "" + +#: danixland-countdown.php:137 +msgid "configure widget" +msgstr "" + +#: danixland-countdown.php:137 +msgid "the date is missing
configure widget" +msgstr "" + +#: danixland-countdown.php:167 +msgid "Count Down" +msgstr "" + +#: danixland-countdown.php:177 +msgid "Title:" +msgstr "" + +#: danixland-countdown.php:181 +msgid "Future Date (dd-mm-yyyy):" +msgstr "" + +#: danixland-countdown.php:183 +msgid "Link (only http/https allowed):" +msgstr "" + +#: danixland-countdown.php:188 +msgid "Enable Widget Stylesheet?" +msgstr "" + +#. Plugin URI of the plugin/theme +msgid "http://danixland.net/?p=3330" +msgstr "" + +#. Description of the plugin/theme +msgid "A simple plugin that shows a widget with a countdown" +msgstr "" + +#. Author of the plugin/theme +msgid "Danilo 'danix' Macri" +msgstr "" + +#. Author URI of the plugin/theme +msgid "http://danixland.net" +msgstr "" diff --git a/inc/style/basic.css b/inc/style/basic.css new file mode 100644 index 0000000..f551ee9 --- /dev/null +++ b/inc/style/basic.css @@ -0,0 +1,67 @@ +@font-face { + + font-family: digit; + + src: local(digit), url('digital.ttf') format('opentype'); +} + +.dnx-countdown { + font: 400 6em 'digit', sans-serif; +} +.dnx-countdown a { + text-decoration: none; +} +.dnx-days { + font-size: 3em; + font-weight: 400; +} +.dnx-warning a { + text-decoration: none; + display: block; + margin: 4px auto 0; + text-align: center; + font-family: Arial, Helvetica, sans-serif; + font-size: 14px; + font-weight: 600; + color: #ffffff; + padding: 5px 7px; + background: -moz-linear-gradient( + top, + #ff5454 0%, + #960000); + background: -webkit-gradient( + linear, left top, left bottom, + from(#ff5454), + to(#960000)); + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + border: 1px solid #470000; + -moz-box-shadow: + 0px 2px 6px rgba(000,000,000,0.5), + inset 0px 1px 1px rgba(255,255,255,0.5); + -webkit-box-shadow: + 0px 2px 6px rgba(000,000,000,0.5), + inset 0px 1px 1px rgba(255,255,255,0.5); + box-shadow: + 0px 2px 6px rgba(000,000,000,0.5), + inset 0px 1px 1px rgba(255,255,255,0.5); + text-shadow: + 0px -1px 0px rgba(000,000,000,0.7), + 0px 1px 0px rgba(255,255,255,0.3); +} +.dnx-warning a:hover, +.dnx-warning a:active { + text-decoration: none; + background: -moz-linear-gradient( + bottom, + #ff5454 0%, + #960000); + background: -webkit-gradient( + linear, left bottom, left top, + from(#ff5454), + to(#960000)); + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; +} \ No newline at end of file diff --git a/inc/style/digital.ttf b/inc/style/digital.ttf new file mode 100644 index 0000000..a481b97 Binary files /dev/null and b/inc/style/digital.ttf differ diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..9534421 --- /dev/null +++ b/readme.txt @@ -0,0 +1,75 @@ +=== danixland-countdown === +Contributors: danixland +Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PEBBHUDM8YAF8 +Tags: widget, sidebar, countdown, +Requires at least: 3.4 +Tested up to: 4.4 +Stable tag: 0.4 + +This plugin adds a simple widget and shows a countdown to a future date. + +== Description == + +danixland-countdown is a simple plugin that adds a widget you can load on your sidebar which will show a simple countdown to a future date that you can set. +this plugin makes use of a simple css stylesheet that you can enable or disable at will. You can also link the countdown to whatever url you want. + +== Installation == + +Installing danixland-countdown is straightforward and requires just a few seconds: + +If you use the **"Add New Plugin"** pane from your dashboard just install it and activate it, then proceed to the last step and configure it. +Otherwise follow these steps: + +1. Download the latest version of the plugin. +1. If using the "Install Plugins->Upload" section on the WordPress admin area just upload the zip file, otherwise unpack the zip file and upload the **"danixland-countdown"** directory inside the "wp-content/plugins" directory of your WordPress installation using your favourite ftp client. +1. Activate the plugin through the 'Plugins' menu in WordPress. +1. Configure the widget from the Appearance->Widgets page in your Admin area and add it to your sidebar. + + +== Frequently Asked Questions == + += What can I do to customize even more the appearance of the widget? = + +You can disable the css stylesheet provided with the plugin, but it will also disable the use of the custom digital font shipped with it. +If you want to override the css without disabling it you can edit the style of the div with id **#dnx-countdown**, it contains all the output by this plugin. + += I like the font shipped with this plugin, can I use it somewhere else? = + +The font is free for home use, it was created for the shareware program Calculator-7 by http://www.styleseven.com/. +It can be used in other projects as long as they are free, just by giving credit to the author at the website http://www.styleseven.com/ + +== Screenshots == + +1. The widget as seen in the "Available Widgets" panel in your Widgets Admin page. +2. The widget settings, available once you put it in your sidebar. +3. The jQuery datepicker dialog visible once you click on the date input. +4. The widget as seen on a page using the twentythirteen theme. + + +== Changelog == + += 0.4 = + * Updated Plugin to the new Plugins API. Minimum WordPress requirement is now 3.4 + * Dropped use of external jQuery lib in favor of html5 date picker. + += 0.3 = + * Added various functions that take care of uninstalling all the data when the plugin is disabled. + += 0.1 = + * This is the first release. + + +== Upgrade Notice == + += 0.4 = +* It's highly recommended to upgrade since previous versions of the plugin made use of the old Plugins API and are deprecated with versions of WordPress starting from 3.4 + + +== ToDo list == + +List is actually empty, but I'm open to suggestions. + +== Translations == + +None as of now. This plugin ships with a .pot file that will allow you to create a translation in your language. +If you want it to be added to this plugin contact me and I'll add it and put a link to your WordPress profile here in this section.