Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #199 from Codeinwp/development
Browse files Browse the repository at this point in the history
Updates for Travis
Prepare for retirement notice
  • Loading branch information
rodica-andronache authored Aug 6, 2019
2 parents 8197c3e + 34380b7 commit 381b121
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 7 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ php:
- '7.1'
- '7.0'
- '5.6'
- '5.5'
- '5.4'
matrix:
include:
- php: '5.3'
dist: precise
env: WP_VERSION=5.1.1
- php: '5.4'
dist: precise
env: WP_VERSION=5.1.1
- php: '5.5'
dist: precise
env: WP_VERSION=5.1.1
sudo: false
branches:
except:
Expand Down
200 changes: 197 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -987,10 +987,14 @@ function zillah_post_video() {
function zillah_neve_notice() {
global $current_user;
$user_id = $current_user->ID;
$ignored_notice = get_user_meta( $user_id, 'zillah_ignore_neve_notice' );
$ignored_notice = get_user_meta( $user_id, 'zillah_ignore_neve_notice_new' );
if ( ! empty( $ignored_notice ) ) {
return;
}
$should_display_notice = zillah_is_before_date( '2019-09-12' );
if ( ! $should_display_notice ) {
return;
}
$dismiss_button =
sprintf(
/* translators: Install Neve link */
Expand All @@ -1012,14 +1016,204 @@ function zillah_neve_notice() {
add_action( 'admin_notices', 'zillah_neve_notice' );

/**
* Update the zillah_ignore_neve_notice option to true, to dismiss the notice from the dashboard
* Update the zillah_ignore_neve_notice_new option to true, to dismiss the notice from the dashboard
*/
function zillah_nag_ignore_neve() {
global $current_user;
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add that to their user meta */
if ( isset( $_GET['zillah_nag_ignore_neve'] ) && '0' == $_GET['zillah_nag_ignore_neve'] ) {
add_user_meta( $user_id, 'zillah_ignore_neve_notice', 'true', true );
add_user_meta( $user_id, 'zillah_ignore_neve_notice_new', 'true', true );
}
}
add_action( 'admin_init', 'zillah_nag_ignore_neve' );

/**
* Function that decide if current date is before a certain date.
*
* @param string $date Date to compare.
* @return bool
*/
function zillah_is_before_date( $date ) {
$countdown_time = strtotime( $date );
$current_time = time();
return $current_time <= $countdown_time;
}

/**
* Retirement notice
*/
function zillah_retirement_notice() {
global $current_user;
$user_id = $current_user->ID;
$ignored_notice = get_user_meta( $user_id, 'zillah_ignore_retirement_notice' );
if ( ! empty( $ignored_notice ) ) {
return;
}
$should_display_notice = ! zillah_is_before_date( '2019-09-12' );
if ( ! $should_display_notice ) {
return;
}
$dismiss_button =
sprintf(
/* translators: Install Neve link */
'<a href="%s" class="notice-dismiss" style="text-decoration:none;"></a>',
'?zillah_nag_ignore_retirement=0'
);

$theme_args = wp_get_theme();
$name = $theme_args->__get( 'Name' );

$notice_template = '
<div class="nv-notice-wrapper">
%1$s
<hr/>
<div class="nv-notice-column-container">
<div class="nv-notice-column nv-notice-image">%2$s</div>
<div class="nv-notice-column nv-notice-starter-sites">%3$s</div>
<div class="nv-notice-column nv-notice-documentation">%4$s</div>
</div>
</div>
<style>%5$s</style>';

/* translators: 1 - notice title, 2 - notice message */
$notice_header = sprintf(
'<h2>%1$s</h2><p class="about-description">%2$s</p></hr>',
esc_html__( 'Your theme is no longer maintained. A New, Modern WordPress Theme is Here!', 'zillah' ),
sprintf(
/* translators: %s - theme name */
esc_html__( '%s is no longer maintained. Switch to Neve today and get more powerful features (for free).', 'zillah' ),
$name
)
);

$notice_picture = sprintf(
'<picture>
<source srcset="about:blank" media="(max-width: 1024px)">
<img src="%1$s">
</picture>',
esc_url( get_template_directory_uri() . '/images/neve.png' )
);

$notice_right_side_content = sprintf(
'<div><h3> %1$s</h3><p>%2$s</p></div>',
__( 'Switch to Neve today', 'zillah' ),
// translators: %s - theme name
esc_html__( 'With Neve you get a super fast, multi-purpose theme, fully AMP optimized and responsive, that works perfectly with Gutenberg and the most popular page builders like Elementor, Beaver Builder, and many more.', 'zillah' )
);

$notice_left_side_content = sprintf(
'<div><h3> %1$s</h3><p>%2$s</p><p class="nv-buttons-wrapper"><a class="button button-hero button-primary" href="%3$s" target="_blank">%4$s</a></p> </div>',
// translators: %s - theme name
sprintf( esc_html__( '%s is no longer maintained', 'zillah' ), $name ),
// translators: %s - theme name
sprintf( __( 'We\'re saying goodbye to Zillah in favor of our more powerful Neve free WordPress theme. This means that there will not be any new features added although we will continue to update the theme for major security issues.', 'zillah' ) ),
esc_url( admin_url( 'theme-install.php?theme=neve' ) ),
esc_html__( 'See Neve theme', 'zillah' )
);

$style = '
.nv-notice-wrapper p{
font-size: 14px;
}
.nv-buttons-wrapper {
padding-top: 20px !important;
}
.nv-notice-wrapper h2{
margin: 0;
font-size: 21px;
font-weight: 400;
line-height: 1.2;
}
.nv-notice-wrapper p.about-description{
color: #72777c;
font-size: 16px;
margin: 0;
padding:0px;
}
.nv-notice-wrapper{
padding: 23px 10px 0;
max-width: 1500px;
}
.nv-notice-wrapper hr {
margin: 20px -23px 0;
border-top: 1px solid #f3f4f5;
border-bottom: none;
}
.nv-notice-column-container h3{
margin: 17px 0 0;
font-size: 16px;
line-height: 1.4;
}
.nv-notice-text p.ti-return-dashboard {
margin-top: 30px;
}
.nv-notice-column-container .nv-notice-column{
padding-right: 60px;
}
.nv-notice-column-container img{
margin-top: 23px;
width: 100%;
border: 1px solid #f3f4f5;
}
.nv-notice-column-container {
display: -ms-grid;
display: grid;
-ms-grid-columns: 24% 32% 32%;
grid-template-columns: 24% 32% 32%;
margin-bottom: 13px;
}
.nv-notice-column-container a.button.button-hero.button-secondary,
.nv-notice-column-container a.button.button-hero.button-primary{
margin:0px;
}
@media screen and (max-width: 1280px) {
.nv-notice-wrapper .nv-notice-column-container {
-ms-grid-columns: 50% 50%;
grid-template-columns: 50% 50%;
}
.nv-notice-column-container a.button.button-hero.button-secondary,
.nv-notice-column-container a.button.button-hero.button-primary{
padding:6px 18px;
}
.nv-notice-wrapper .nv-notice-image {
display: none;
}
}
@media screen and (max-width: 870px) {
.nv-notice-wrapper .nv-notice-column-container {
-ms-grid-columns: 100%;
grid-template-columns: 100%;
}
.nv-notice-column-container a.button.button-hero.button-primary{
padding:12px 36px;
}
}
';

$message = sprintf(
$notice_template,
$notice_header,
$notice_picture,
$notice_left_side_content,
$notice_right_side_content,
$style
);// WPCS: XSS OK.

printf( '<div class="notice updated" style="position:relative; padding-right: 35px;">%1$s<p>%2$s</p></div>', $dismiss_button, $message );
}
add_action( 'admin_notices', 'zillah_retirement_notice' );

/**
* Update the zillah_ignore_retirement_notice option to true, to dismiss the notice from the dashboard
*/
function zillah_nag_ignore_retirement() {
global $current_user;
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add that to their user meta */
if ( isset( $_GET['zillah_nag_ignore_retirement'] ) && '0' == $_GET['zillah_nag_ignore_retirement'] ) {
add_user_meta( $user_id, 'zillah_ignore_retirement_notice', 'true', true );
}
}
add_action( 'admin_init', 'zillah_nag_ignore_retirement' );
Binary file added images/neve.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zillah",
"nicename": "Zillah",
"version": "1.1.8",
"version": "1.1.9",
"description": "Zillah theme",
"category": "themes",
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<exclude name="Squiz.PHP.CommentedOutCode.Found" />

<exclude name="WordPress.PHP.YodaConditions.NotYoda" />
<exclude name="WordPress.PHP.StrictInArray.MissingTrueStrict" />
<exclude name="WordPress.PHP.StrictComparisons.LooseComparison" />
<exclude name="WordPress.Files.FileName.UnderscoresNotAllowed" />
</rule>
<rule ref="WordPress-Docs">
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI: https://themeisle.com/themes/zillah/
Author: ThemeIsle
Author URI: http://themeisle.com
Description: Zillah is a free minimal blogging WordPress theme from ThemeIsle. Is responsive and compatible with a wide range of plugins like : Nivo Slider, Siteorigin Page Builder, WooCoomerce, Photo Gallery Grid and Contact Form 7.
Version: 1.1.8
Version: 1.1.9
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: zillah
Expand Down

0 comments on commit 381b121

Please sign in to comment.