Skip to content

Commit fbd2578

Browse files
author
Cosmin
committed
#112 - #1 - there's nothing wrong in using abspath, it's a WordPress core define, nothing added by the theme/plugin. Changed it to incorporate MU
- #2 - removed from global scope - #3 - removed custom sanitize for hex - #4 - removed shapely_sanitize_strip_slashes - #5 - escaped variable - #6 - I don't think Colorlib and WordPress are translatable - #7 - escaped where needed - #8 - removed registration of menu from socialnav.php - #9 - removed theme support for post formats - #10 - escaped where needed - #11 - translated - #12 - escaped where needed
1 parent c65b80b commit fbd2578

18 files changed

+160
-153
lines changed

archive.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* The template for displaying archive pages.
44
*
5-
* @link https://codex.wordpress.org/Template_Hierarchy
5+
* @link https://codex.wordpress.org/Template_Hierarchy
66
*
77
* @package Shapely
88
*/
@@ -13,7 +13,7 @@
1313

1414
if ( is_home() && ! is_front_page() ) : ?>
1515
<header>
16-
<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
16+
<h1 class="page-title screen-reader-text"><?php esc_html( single_post_title() ); ?></h1>
1717
</header>
1818

1919
<?php

changelog.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
### 1.7.1
2+
<a href="https://github.com/puikinsh/shapely/issues">Issues</a>
3+
#112 - #1 - there's nothing wrong in using abspath, it's a WordPress core define, nothing added by the theme/plugin. Changed it to incorporate MU
4+
- #2 - removed from global scope
5+
- #3 - removed custom sanitize for hex
6+
- #4 - removed shapely_sanitize_strip_slashes
7+
- #5 - escaped variable
8+
- #6 - I don't think Colorlib and WordPress are translatable
9+
- #7 - escaped where needed
10+
- #8 - removed registration of menu from socialnav.php
11+
- #9 - removed theme support for post formats
12+
- #10 - escaped where needed
13+
- #11 - translated
14+
- #12 - escaped where needed
15+
116
### 1.7.0
217
<a href="https://github.com/puikinsh/shapely/issues">Issues</a>
318
#79 - restyled <q> a little bit ( added a bg, set font style to italic )

functions.php

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ function shapely_setup() {
5353

5454
// This theme uses wp_nav_menu() in one location.
5555
register_nav_menus( array(
56-
'primary' => esc_html__( 'Primary', 'shapely' ),
56+
'primary' => esc_html__( 'Primary', 'shapely' ),
57+
'social-menu' => esc_html__( 'Social Menu', 'shapely' ),
5758
) );
5859

5960
/*
@@ -68,18 +69,6 @@ function shapely_setup() {
6869
'caption',
6970
) );
7071

71-
/*
72-
* Enable support for Post Formats.
73-
* See https://developer.wordpress.org/themes/functionality/post-formats/
74-
*/
75-
add_theme_support( 'post-formats', array(
76-
'aside',
77-
'image',
78-
'video',
79-
'quote',
80-
'link',
81-
) );
82-
8372
// Set up the WordPress core custom background feature.
8473
add_theme_support( 'custom-background', apply_filters( 'shapely_custom_background_args', array(
8574
'default-color' => 'ffffff',
@@ -101,7 +90,8 @@ function shapely_setup() {
10190
global $shapely_required_actions, $shapely_recommended_plugins;
10291

10392
$shapely_recommended_plugins = array(
104-
'fancybox-for-wordpress' => array( 'recommended' => false )
93+
'wordpress-seo' => array( 'recommended' => true ),
94+
'fancybox-for-wordpress' => array( 'recommended' => false ),
10595
);
10696

10797
/*
@@ -112,6 +102,14 @@ function shapely_setup() {
112102
* plugin_slug - the plugin's slug (used for installing the plugin)
113103
*
114104
*/
105+
$path = WPMU_PLUGIN_DIR . '/shapely-companion/inc/views/shapely-demo-content.php';
106+
if ( ! file_exists( $path ) ) {
107+
$path = WP_PLUGIN_DIR . '/shapely-companion/inc/views/shapely-demo-content.php';
108+
if ( ! file_exists( $path ) ) {
109+
$path = false;
110+
}
111+
}
112+
115113
$shapely_required_actions = array(
116114
array(
117115
"id" => 'shapely-req-ac-install-companion-plugin',
@@ -128,17 +126,10 @@ function shapely_setup() {
128126
"plugin_slug" => 'jetpack'
129127
),
130128
array(
131-
"id" => 'shapely-req-ac-install-wp-yoast-plugin',
132-
"title" => Shapely_Notify_System::shapely_yoast_title(),
133-
'description' => Shapely_Notify_System::shapely_yoast_description(),
134-
"check" => Shapely_Notify_System::shapely_has_plugin( 'wordpress-seo' ),
135-
"plugin_slug" => 'wordpress-seo'
136-
),
137-
array(
138-
"id" => 'shapely-req-import-content',
139-
"title" => esc_html__( 'Import content', 'shapely' ),
140-
"external" => ABSPATH . 'wp-content/plugins/shapely-companion/inc/views/shapely-demo-content.php',
141-
"check" => Shapely_Notify_System::shapely_check_import_req(),
129+
"id" => 'shapely-req-import-content',
130+
"title" => esc_html__( 'Import content', 'shapely' ),
131+
"external" => $path,
132+
"check" => Shapely_Notify_System::shapely_check_import_req(),
142133
),
143134

144135
);
@@ -287,16 +278,6 @@ function shapely_scripts() {
287278
*/
288279
require get_template_directory() . '/inc/metaboxes.php';
289280

290-
/* Globals */
291-
global $shapely_site_layout;
292-
$shapely_site_layout = array(
293-
'pull-right' => esc_html__( 'Left Sidebar', 'shapely' ),
294-
'side-right' => esc_html__( 'Right Sidebar', 'shapely' ),
295-
'no-sidebar' => esc_html__( 'No Sidebar', 'shapely' ),
296-
'full-width' => esc_html__( 'Full Width', 'shapely' )
297-
);
298-
299-
300281
/**
301282
* Load the system checks ( used for notifications )
302283
*/

inc/admin/welcome-screen/notify-system-checks.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,17 @@ public static function shapely_check_plugin_is_installed( $slug ) {
6464
if ( $slug === 'wordpress-seo' ) {
6565
$slug2 = 'wp-seo';
6666
}
67-
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $slug . '/' . $slug2 . '.php' ) ) {
67+
68+
$path = WPMU_PLUGIN_DIR . '/' . $slug . '/' . $slug2 . '.php';
69+
if ( ! file_exists( $path ) ) {
70+
$path = WP_PLUGIN_DIR . '/' . $slug . '/' . $slug2 . '.php';
71+
72+
if ( ! file_exists( $path ) ) {
73+
$path = false;
74+
}
75+
}
76+
77+
if ( file_exists( $path ) ) {
6878
return true;
6979
}
7080

@@ -79,8 +89,17 @@ public static function shapely_check_plugin_is_active( $slug ) {
7989
if ( $slug === 'wordpress-seo' ) {
8090
$slug2 = 'wp-seo';
8191
}
82-
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $slug . '/' . $slug2 . '.php' ) ) {
83-
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
92+
93+
$path = WPMU_PLUGIN_DIR . '/' . $slug . '/' . $slug2 . '.php';
94+
if ( ! file_exists( $path ) ) {
95+
$path = WP_PLUGIN_DIR . '/' . $slug . '/' . $slug2 . '.php';
96+
if ( ! file_exists( $path ) ) {
97+
$path = false;
98+
}
99+
}
100+
101+
if ( file_exists( $path ) ) {
102+
include_once( ABSPATH . WPINC . '/plugin.php' );
84103

85104
return is_plugin_active( $slug . '/' . $slug2 . '.php' );
86105
}

inc/admin/welcome-screen/sections/actions-required.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
?>
6868
<p class="plugin-card-<?php echo esc_attr( $shapely_required_action_value['plugin_slug'] ) ?> action_button <?php echo ( $active['needs'] !== 'install' && $active['status'] ) ? 'active' : '' ?>">
6969
<a data-slug="<?php echo esc_attr( $shapely_required_action_value['plugin_slug'] ) ?>"
70-
class="<?php echo $class; ?>"
71-
href="<?php echo esc_url( $url ) ?>"> <?php echo $label ?> </a>
70+
class="<?php echo esc_attr( $class ); ?>"
71+
href="<?php echo esc_url( $url ) ?>"> <?php echo esc_html( $label ) ?> </a>
7272
</p>
7373
<?php
7474
};

inc/admin/welcome-screen/sections/changelog.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
?>
99
<div class="featured-section changelog">
10-
10+
1111

1212
<?php
1313
WP_Filesystem();
@@ -16,9 +16,9 @@
1616
$shapely_changelog_lines = explode( PHP_EOL, $shapely_changelog );
1717
foreach ( $shapely_changelog_lines as $shapely_changelog_line ) {
1818
if ( substr( $shapely_changelog_line, 0, 3 ) === "###" ) {
19-
echo '<h4>' . substr( $shapely_changelog_line, 3 ) . '</h4>';
19+
echo '<h4>' . esc_html( substr( $shapely_changelog_line, 3 ) ) . '</h4>';
2020
} else {
21-
echo $shapely_changelog_line, '<br/>';
21+
echo esc_html( $shapely_changelog_line ), '<br/>';
2222
}
2323

2424

inc/admin/welcome-screen/sections/getting-started.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Getting started template
44
*/
55
$customizer_url = admin_url() . 'customize.php';
6-
$count = $this->count_actions();
6+
$count = $this->count_actions();
77
?>
88

99
<div class="feature-section three-col">
@@ -12,10 +12,11 @@
1212
<p><?php esc_html_e( 'We\'ve compiled a list of steps for you, to take make sure the experience you\'ll have using one of our products is very easy to follow.', 'shapely' ); ?></p>
1313
<?php if ( $count == 0 ) { ?>
1414
<p><span class="dashicons dashicons-yes"></span>
15-
<a href="<?php echo admin_url( 'themes.php?page=shapely-welcome&tab=recommended_actions' ); ?>"><?php esc_html_e( 'No recommended actions left to perform', 'shapely' ); ?></a>
15+
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=recommended_actions' ) ); ?>"><?php esc_html_e( 'No recommended actions left to perform', 'shapely' ); ?></a>
1616
</p>
1717
<?php } else { ?>
18-
<p><span class="dashicons dashicons-no-alt"></span> <a href="<?php echo admin_url( 'themes.php?page=shapely-welcome&tab=recommended_actions' ); ?>"><?php esc_html_e( 'Check recommended actions', 'shapely' ); ?></a>
18+
<p><span class="dashicons dashicons-no-alt"></span> <a
19+
href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=recommended_actions' ) ); ?>"><?php esc_html_e( 'Check recommended actions', 'shapely' ); ?></a>
1920
</p> <?php
2021
}; ?>
2122
</div><!--/.col-->

inc/admin/welcome-screen/sections/recommended-plugins.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,19 @@
3636
?>
3737
<div class="col plugin_box">
3838
<img src="<?php echo esc_attr( $icon ) ?>" alt="plugin box image">
39-
<span class="version"><?php echo __( 'Version:', 'shapely' ); ?><?php echo $info->version ?></span>
39+
<span
40+
class="version"><?php echo __( 'Version:', 'shapely' ); ?><?php echo esc_html( $info->version ) ?></span>
4041
<span
4142
class="separator">|</span> <?php echo wp_kses_post( $info->author ) ?>
4243
<div
4344
class="action_bar <?php echo ( $active['needs'] !== 'install' && $active['status'] ) ? 'active' : '' ?>">
4445
<span
45-
class="plugin_name"><?php echo ( $active['needs'] !== 'install' && $active['status'] ) ? 'Active: ' : '' ?><?php echo $info->name; ?></span>
46+
class="plugin_name"><?php echo ( $active['needs'] !== 'install' && $active['status'] ) ? 'Active: ' : '' ?><?php echo esc_html( $info->name ); ?></span>
4647
</div>
4748
<span
4849
class="plugin-card-<?php echo esc_attr( $plugin ) ?> action_button <?php echo ( $active['needs'] !== 'install' && $active['status'] ) ? 'active' : '' ?>">
49-
<a data-slug="<?php echo esc_attr( $plugin ) ?>" class="<?php echo $class; ?>"
50-
href="<?php echo esc_url( $url ) ?>"> <?php echo $label ?> </a>
50+
<a data-slug="<?php echo esc_attr( $plugin ) ?>" class="<?php echo esc_attr( $class ); ?>"
51+
href="<?php echo esc_url( $url ) ?>"> <?php echo esc_html( $label ) ?> </a>
5152
</span>
5253
</div>
5354
<?php } ?>

inc/admin/welcome-screen/welcome-screen.php

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct() {
4040
*/
4141
public function shapely_welcome_register_menu() {
4242
$action_count = $this->count_actions();
43-
$title = $action_count > 0 ? 'About shapely <span class="badge-action-count">' . esc_html( $action_count ) . '</span>' : 'About shapely';
43+
$title = $action_count > 0 ? __( 'About Shapely', 'shapely' ) . '<span class="badge-action-count">' . esc_html( $action_count ) . '</span>' : __( 'About Shapely', 'shapely' );
4444

4545
add_theme_page( 'About shapely', $title, 'edit_theme_options', 'shapely-welcome', array(
4646
$this,
@@ -87,9 +87,9 @@ public function shapely_welcome_style_and_scripts( $hook_suffix ) {
8787
wp_enqueue_script( 'shapely-welcome-screen-js', get_template_directory_uri() . '/inc/admin/welcome-screen/js/welcome.js', array( 'jquery' ) );
8888

8989
wp_localize_script( 'shapely-welcome-screen-js', 'shapelyWelcomeScreenObject', array(
90-
'nr_actions_required' => $this->count_actions(),
91-
'ajaxurl' => admin_url( 'admin-ajax.php' ),
92-
'template_directory' => get_template_directory_uri(),
90+
'nr_actions_required' => absint( $this->count_actions() ),
91+
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
92+
'template_directory' => esc_url( get_template_directory_uri() ),
9393
'no_required_actions_text' => __( 'Hooray! There are no required actions for you right now.', 'shapely' )
9494
) );
9595

@@ -106,7 +106,7 @@ public function shapely_welcome_scripts_for_customizer() {
106106
wp_enqueue_script( 'shapely-welcome-screen-customizer-js', get_template_directory_uri() . '/inc/admin/welcome-screen/js/welcome_customizer.js', array( 'jquery' ), '20120206', true );
107107

108108
wp_localize_script( 'shapely-welcome-screen-customizer-js', 'shapelyWelcomeScreenCustomizerObject', array(
109-
'nr_actions_required' => $this->count_actions(),
109+
'nr_actions_required' => absint( $this->count_actions() ),
110110
'aboutpage' => esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=recommended_actions' ) ),
111111
'customizerpage' => esc_url( admin_url( 'customize.php#recommended_actions' ) ),
112112
'themeinfo' => __( 'View Theme Info', 'shapely' ),
@@ -240,8 +240,17 @@ public function check_active( $slug ) {
240240
if ( $slug === 'wordpress-seo' ) {
241241
$slug2 = 'wp-seo';
242242
}
243-
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $slug . '/' . $slug2 . '.php' ) ) {
244-
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
243+
244+
$path = WPMU_PLUGIN_DIR . '/' . $slug . '/' . $slug2 . '.php';
245+
if ( ! file_exists( $path ) ) {
246+
$path = WP_PLUGIN_DIR . '/' . $slug . '/' . $slug2 . '.php';
247+
if ( ! file_exists( $path ) ) {
248+
$path = false;
249+
}
250+
}
251+
252+
if ( file_exists( $path ) ) {
253+
include_once( ABSPATH . WPINC . '/plugin.php' );
245254

246255
$needs = is_plugin_active( $slug . '/' . $slug2 . '.php' ) ? 'deactivate' : 'activate';
247256

@@ -331,16 +340,16 @@ class="about-text"><?php echo esc_html__( 'Shapely is now installed and ready to
331340

332341

333342
<h2 class="nav-tab-wrapper wp-clearfix">
334-
<a href="<?php echo admin_url( 'themes.php?page=shapely-welcome&tab=getting_started' ); ?>"
343+
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=getting_started' ) ); ?>"
335344
class="nav-tab <?php echo $active_tab == 'getting_started' ? 'nav-tab-active' : ''; ?>"><?php echo esc_html__( 'Getting Started', 'shapely' ); ?></a>
336-
<a href="<?php echo admin_url( 'themes.php?page=shapely-welcome&tab=recommended_actions' ); ?>"
345+
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=recommended_actions' ) ); ?>"
337346
class="nav-tab <?php echo $active_tab == 'recommended_actions' ? 'nav-tab-active' : ''; ?> "><?php echo esc_html__( 'Recommended Actions', 'shapely' ); ?>
338347
<?php echo $action_count > 0 ? '<span class="badge-action-count">' . esc_html( $action_count ) . '</span>' : '' ?></a>
339-
<a href="<?php echo admin_url( 'themes.php?page=shapely-welcome&tab=recommended_plugins' ); ?>"
348+
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=recommended_plugins' ) ); ?>"
340349
class="nav-tab <?php echo $active_tab == 'recommended_plugins' ? 'nav-tab-active' : ''; ?> "><?php echo esc_html__( 'Recommended Plugins', 'shapely' ); ?></a>
341-
<a href="<?php echo admin_url( 'themes.php?page=shapely-welcome&tab=support' ); ?>"
350+
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=support' ) ); ?>"
342351
class="nav-tab <?php echo $active_tab == 'support' ? 'nav-tab-active' : ''; ?> "><?php echo esc_html__( 'Support', 'shapely' ); ?></a>
343-
<a href="<?php echo admin_url( 'themes.php?page=shapely-welcome&tab=changelog' ); ?>"
352+
<a href="<?php echo esc_url( admin_url( 'themes.php?page=shapely-welcome&tab=changelog' ) ); ?>"
344353
class="nav-tab <?php echo $active_tab == 'changelog' ? 'nav-tab-active' : ''; ?> "><?php echo esc_html__( 'Changelog', 'shapely' ); ?></a>
345354
</h2>
346355

0 commit comments

Comments
 (0)