Skip to content

Commit

Permalink
Merge pull request #15 from Codeinwp/development
Browse files Browse the repository at this point in the history
Fix loading tabs order
Fix recommended actions show/hide mechanism
Fixed for the white label module
  • Loading branch information
rodica-andronache committed Feb 11, 2019
2 parents f487a7b + a3a9740 commit bb26d3b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 13 deletions.
25 changes: 17 additions & 8 deletions class-ti-about-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ private function setup_config() {

$theme = wp_get_theme();

$this->theme_args['name'] = $theme->__get( 'Name' );
$this->theme_args['name'] = apply_filters( 'ti_wl_theme_name', $theme->__get( 'Name' ) );
$this->theme_args['template'] = $theme->get('Template');
$this->theme_args['version'] = $theme->__get( 'Version' );
$this->theme_args['description'] = $theme->__get( 'Description' );
$this->theme_args['description'] = apply_filters( 'ti_wl_theme_description', $theme->__get( 'Description' ) );
$this->theme_args['slug'] = $theme->__get( 'stylesheet' );
}

Expand Down Expand Up @@ -86,12 +87,15 @@ public function setup_actions() {
* Based on visibility flag the plugin should be shown/hidden in recommended_plugins tab
*/
public function set_recommended_plugins_visibility() {
$recommended_plugins = get_option('ti_about_recommended_plugins');
if( !empty($recommended_plugins) ){
return;
}
$required_plugins = $this->get_recommended_plugins();
$required_plugins_visbility = array();
foreach ( $required_plugins as $slug => $req_plugin ) {
$required_plugins_visbility[ $slug ] = 'visible';
}

update_option( 'ti_about_recommended_plugins', $required_plugins_visbility );
}

Expand Down Expand Up @@ -131,11 +135,12 @@ public function register() {
$menu_name .= '<span class="badge-action-count update-plugins">' . esc_html( $required_actions ) . '</span>';
}

$theme_page = !empty( $theme['template'] ) ? $theme['template'] . '-welcome' : $theme['slug'] . '-welcome';
add_theme_page(
$page_title,
$menu_name,
'activate_plugins',
$theme['slug'] . '-welcome',
$theme_page,
array(
$this,
'render',
Expand Down Expand Up @@ -182,12 +187,12 @@ public function render() {
*/
public function enqueue() {
$screen = get_current_screen();

if ( ! isset( $screen->id ) ) {
return;
}

if ( $screen->id !== 'appearance_page_' . $this->theme_args['slug'] . '-welcome' ) {
$theme = $this->theme_args;
$theme_page = !empty( $theme['template'] ) ? $theme['template'] . '-welcome' : $theme['slug'] . '-welcome';
if ( $screen->id !== 'appearance_page_' . $theme_page ) {
return;
}

Expand All @@ -210,6 +215,7 @@ public function enqueue() {
array(
'nr_actions_required' => $this->get_recommended_actions_left(),
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce('ti-about-nonce'),
'template_directory' => get_template_directory_uri(),
'activating_string' => esc_html__( 'Activating', 'textdomain' ),
)
Expand All @@ -223,7 +229,10 @@ public function enqueue() {
* Update recommended plugins visibility flag if the user dismiss one of them
*/
public function update_recommended_plugins_visibility() {

$nonce = $_POST['nonce'];
if ( ! wp_verify_nonce( $nonce, 'ti-about-nonce' ) ) {
return;
}
$recommended_plugins = get_option( 'ti_about_recommended_plugins' );

$plugin_to_update = $_POST['slug'];
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "codeinwp/ti-about-page",
"description": "The theme about page for themeisle themes.",
"version": "1.0.1",
"version": "1.0.2",
"type": "library",
"license": "GPL-3.0-or-later",
"minimum-stability": "dev",
Expand Down
5 changes: 5 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
overflow: hidden;
}

.about-wrap #about-tabs {
display: none;
}

.about-col i.dashicons {
position: relative;
top: 5px;
Expand Down Expand Up @@ -452,6 +456,7 @@
border-bottom: 1px solid #eeeeee;
padding: 8px 12px;
display: inline-table;
margin: 0 0 1.33em;
}

.about-footer-col .inside{
Expand Down
9 changes: 8 additions & 1 deletion includes/class-ti-about-render.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ private function render_header() {
<div class="info"><h1>Welcome to <?php echo esc_html( $this->theme['name'] ); ?>! - Version <span
class="version-container"><?php echo esc_html( $this->theme['version'] ); ?></span></h1>
</div>
<a href="https://themeisle.com/" class="wp-badge epsilon-welcome-logo"></a></div>
<?php
$white_label_options = get_option( 'ti_white_label_inputs' );
$white_label_options = json_decode( $white_label_options, true );
if( empty( $white_label_options['theme_name'] ) ) { ?>
<a href="https://themeisle.com/" class="wp-badge epsilon-welcome-logo"></a>
<?php
} ?>
</div>
<?php
}

Expand Down
4 changes: 2 additions & 2 deletions js/ti_about_page_scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

jQuery( document ).ready(
function () {
jQuery( '#about-tabs' ).tabs();
jQuery( '#about-tabs' ).tabs().show();
/**
* With a small height tab scroll is not working on WordPress menu
* That's why a windows resize is needed
Expand All @@ -29,7 +29,7 @@ jQuery( document ).ready(
jQuery.ajax(
{
type: 'POST',
data: { action: 'update_recommended_plugins_visibility', slug: plugin_slug },
data: { action: 'update_recommended_plugins_visibility', slug: plugin_slug, nonce: tiAboutPageObject.nonce },
url: tiAboutPageObject.ajaxurl,
beforeSend: function() {
jQuery(card).fadeOut();
Expand Down
2 changes: 1 addition & 1 deletion load.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
define( 'TI_ABOUT_PAGE_URL', get_template_directory_uri() . '/vendor/codeinwp/ti-about-page/' );
}
if ( ! defined( 'TI_ABOUT_PAGE_VERSION' ) ) {
define( 'TI_ABOUT_PAGE_VERSION', '1.0.1' );
define( 'TI_ABOUT_PAGE_VERSION', '1.0.2' );
}

0 comments on commit bb26d3b

Please sign in to comment.