Skip to content

Commit b059d25

Browse files
authored
Merge pull request #301 from codepress/release/4.2.2
Release/4.2.2
2 parents d2a7f41 + 1719eee commit b059d25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+496
-104
lines changed

README.MD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Admin Columns [![WordPress](https://img.shields.io/wordpress/plugin/tested/codepress-admin-columns.svg?style=flat-square)](https://wordpress.org/plugins/codepress-admin-columns/) [![WordPress](https://img.shields.io/wordpress/plugin/r/codepress-admin-columns.svg?style=flat-square)](https://wordpress.org/plugins/codepress-admin-columns/) [![WordPress](https://img.shields.io/wordpress/plugin/v/codepress-admin-columns.svg?style=flat-square)](https://wordpress.org/plugins/codepress-admin-columns/) [![WordPress](https://img.shields.io/wordpress/plugin/dt/codepress-admin-columns.svg?style=flat-square)](https://wordpress.org/plugins/codepress-admin-columns/)
2+
13
## Contributing to this project
24

35
Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.

api.php

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use AC\ListScreen;
77
use AC\ListScreenCollection;
88
use AC\Type\ListScreenId;
9+
use AC\Type\Url;
910

1011
/**
1112
* @return AC\AdminColumns
@@ -24,56 +25,33 @@ function ac_is_pro_active() {
2425
}
2526

2627
/**
27-
* Get the url where the Admin Columns website is hosted
28-
*
2928
* @param string $path
3029
*
3130
* @return string
3231
*/
33-
function ac_get_site_url( $path = '' ) {
34-
$url = 'https://www.admincolumns.com';
35-
36-
if ( ! empty( $path ) ) {
37-
$url .= '/' . trim( $path, '/' ) . '/';
38-
}
39-
40-
return $url;
32+
function ac_get_site_url( $path = null ) {
33+
return ( new Url\Site( $path ) )->get_url();
4134
}
4235

4336
/**
44-
* Url with utm tags
37+
* @param string|null $path
4538
*
39+
* @return string
40+
*/
41+
function ac_get_site_documentation_url( $path = null ) {
42+
return ( new Url\Documentation( $path ) )->get_url();
43+
}
44+
45+
/**
4646
* @param string $path
4747
* @param string $utm_medium
4848
* @param string $utm_content
4949
* @param bool $utm_campaign
5050
*
5151
* @return string
5252
*/
53-
function ac_get_site_utm_url( $path, $utm_medium, $utm_content = null, $utm_campaign = false ) {
54-
$url = ac_get_site_url( $path );
55-
56-
if ( ! $utm_campaign ) {
57-
$utm_campaign = 'plugin-installation';
58-
}
59-
60-
$args = [
61-
// Referrer: plugin
62-
'utm_source' => 'plugin-installation',
63-
64-
// Specific promotions or sales
65-
'utm_campaign' => $utm_campaign,
66-
67-
// Marketing medium: banner, documentation or email
68-
'utm_medium' => $utm_medium,
69-
70-
// Used for differentiation of medium
71-
'utm_content' => $utm_content,
72-
];
73-
74-
$args = array_map( 'sanitize_key', array_filter( $args ) );
75-
76-
return add_query_arg( $args, $url );
53+
function ac_get_site_utm_url( $path, $utm_medium, $utm_content = null, $utm_campaign = null ) {
54+
return ( new Url\UtmTags( new Url\Site( $path ), $utm_medium, $utm_content, $utm_campaign ) )->get_url();
7755
}
7856

7957
/**

assets/css/admin-page-columns.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Admin/Page/Columns.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
use AC\DefaultColumnsRepository;
2020
use AC\ListScreen;
2121
use AC\Message;
22+
use AC\Type\Url\Documentation;
23+
use AC\Type\Url\Site;
24+
use AC\Type\Url\UtmTags;
2225
use AC\View;
2326

2427
class Columns extends Page implements Enqueueables, Helpable, Admin\ScreenOptions {
@@ -195,11 +198,22 @@ public function render() {
195198

196199
<?= new Banner(); ?>
197200

198-
<?= ( new View() )->set_template( 'admin/side-feedback' ); ?>
201+
<?php
202+
$view = new View( [
203+
'documentation_url' => ( new UtmTags( new Documentation(), 'feedback-docs-button' ) )->get_url(),
204+
'upgrade_url' => ( new UtmTags( new Site( Site::PAGE_ABOUT_PRO ), 'feedback-purchase-button' ) )->get_url(),
205+
] );
206+
echo $view->set_template( 'admin/side-feedback' );
207+
?>
199208

200209
<?php endif; ?>
201210

202-
<?= ( new View() )->set_template( 'admin/side-support' ); ?>
211+
<?php
212+
$view = new View( [
213+
'documentation_url' => ( new UtmTags( new Documentation(), 'support' ) )->get_url(),
214+
] );
215+
echo $view->set_template( 'admin/side-support' );
216+
?>
203217

204218
</div>
205219

@@ -257,7 +271,9 @@ public function render() {
257271

258272
<?php
259273

260-
$modal = new View();
274+
$modal = new View( [
275+
'upgrade_url' => ( new UtmTags( new Site( Site::PAGE_ABOUT_PRO ), 'upgrade' ) )->get_url(),
276+
] );
261277

262278
echo $modal->set_template( 'admin/modal-pro' );
263279

classes/Admin/Page/Help.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use AC\Asset\Location;
99
use AC\Asset\Style;
1010
use AC\Deprecated\Hooks;
11+
use AC\Type\Url;
1112

1213
class Help extends Page implements AC\Asset\Enqueueables {
1314

@@ -35,12 +36,14 @@ public function get_assets() {
3536
}
3637

3738
/**
38-
* @param string $page
39-
*
4039
* @return string
4140
*/
42-
private function get_documention_link( $page ) {
43-
return ac_helper()->html->link( ac_get_site_utm_url( 'documentation/' . $page, 'documentation' ), __( 'View documentation', 'codepress-admin-columns' ) . ' &raquo;', [ 'target' => '_blank' ] );
41+
private function get_documention_link() {
42+
return sprintf(
43+
'<a href="%s" target="_blank">%s &raquo;</a>',
44+
( new Url\Documentation( Url\Documentation::ARTICLE_UPGRADE_V3_TO_V4 ) )->get_url(),
45+
__( 'View documentation', 'codepress-admin-columns' )
46+
);
4447
}
4548

4649
/**
@@ -79,7 +82,7 @@ private function render_actions() {
7982
$message .= ' ' . $this->get_callback_message( $callbacks );
8083
}
8184

82-
$message .= ' ' . $this->get_documention_link( $hook->get_slug() ? 'action-reference/' . $hook->get_slug() : '#action-reference' );
85+
$message .= ' ' . $this->get_documention_link();
8386

8487
$this->render_message( $message );
8588
}
@@ -108,7 +111,7 @@ private function render_filters() {
108111
$message .= ' ' . $this->get_callback_message( $callbacks );
109112
}
110113

111-
$message .= ' ' . $this->get_documention_link( $hook->get_slug() ? 'filter-reference/' . $hook->get_slug() : '#filter-reference' );
114+
$message .= ' ' . $this->get_documention_link();
112115

113116
$this->render_message( $message );
114117
}
@@ -132,7 +135,15 @@ public function render() {
132135
<p>
133136
<?php _e( 'The Admin Columns plugin has undergone some major changes in version 4.', 'codepress-admin-columns' ); ?> <br/>
134137

135-
<?php printf( __( 'This site is using some actions or filters that have changed. Please read %s to resolve them.', 'codepress-admin-columns' ), ac_helper()->html->link( ac_get_site_utm_url( 'documentation/faq/upgrading-from-v3-to-v4', 'help' ), __( 'our documentation', 'codepress-admin-columns' ) ) ); ?>
138+
<?php
139+
printf(
140+
__( 'This site is using some actions or filters that have changed. Please read %s to resolve them.', 'codepress-admin-columns' ),
141+
sprintf(
142+
'<a href="%s" target="_blank">%s</a>', ( new Url\Documentation( Url\Documentation::ARTICLE_UPGRADE_V3_TO_V4 ) )->get_url(),
143+
__( 'our documentation', 'codepress-admin-columns' )
144+
)
145+
);
146+
?>
136147
</p>
137148

138149
<?php

classes/Check/Review.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use AC\Preferences;
99
use AC\Registrable;
1010
use AC\Screen;
11+
use AC\Type\Url\Documentation;
12+
use AC\Type\Url\Site;
13+
use AC\Type\Url\UtmTags;
1114
use Exception;
1215

1316
class Review
@@ -118,6 +121,24 @@ public function ajax_dismiss_notice() {
118121
$this->get_preferences()->set( 'dismiss-review', true );
119122
}
120123

124+
/**
125+
* @param string $utm_medium
126+
*
127+
* @return string
128+
*/
129+
private function get_forum_url( $utm_medium ) {
130+
return ( new UtmTags( new Site( Site::PAGE_FORUM ), $utm_medium ) )->get_url();
131+
}
132+
133+
/**
134+
* @param string $utm_medium
135+
*
136+
* @return string
137+
*/
138+
private function get_documentation_url( $utm_medium ) {
139+
return ( new UtmTags( new Documentation(), $utm_medium ) )->get_url();
140+
}
141+
121142
/**
122143
* @return string
123144
*/
@@ -152,13 +173,13 @@ protected function get_message() {
152173
printf(
153174
__( "We're sorry to hear that; maybe we can help! If you're having problems properly setting up %s or if you would like help with some more advanced features, please visit our %s.", 'codepress-admin-columns' ),
154175
$product,
155-
'<a href="' . esc_url( ac_get_site_utm_url( 'documentation', 'review-notice' ) ) . '" target="_blank">' . __( 'documentation page', 'codepress-admin-columns' ) . '</a>'
176+
'<a href="' . esc_url( $this->get_documentation_url( 'review-notice' ) ) . '" target="_blank">' . __( 'documentation page', 'codepress-admin-columns' ) . '</a>'
156177
);
157178

158179
if ( ac_is_pro_active() ) {
159180
printf(
160181
__( 'You can also use your admincolumns.com account to access support through %s!', 'codepress-admin-columns' ),
161-
'<a href="' . esc_url( ac_get_site_utm_url( 'topics', 'review-notice' ) ) . '" target="_blank">' . __( 'our forum', 'codepress-admin-columns' ) . '</a>'
182+
'<a href="' . esc_url( $this->get_forum_url( 'review-notice' ) ) . '" target="_blank">' . __( 'our forum', 'codepress-admin-columns' ) . '</a>'
162183
);
163184
} else {
164185
printf(

classes/Column/Post/Slug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function get_value( $post_id ) {
2525
}
2626

2727
function get_raw_value( $post_id ) {
28-
return get_post_field( 'post_name', $post_id, 'raw' );
28+
return urldecode( get_post_field( 'post_name', $post_id, 'raw' ) );
2929
}
3030

3131
}

classes/Integration.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace AC;
44

5+
use AC\Type\Url;
6+
57
abstract class Integration {
68

79
/** @var string */
@@ -13,8 +15,8 @@ abstract class Integration {
1315
/** @var string */
1416
private $logo;
1517

16-
/** @var string */
17-
private $page;
18+
/** @var Url */
19+
private $url;
1820

1921
/** @var string */
2022
private $plugin_link;
@@ -32,21 +34,21 @@ abstract class Integration {
3234
* @param string $plugin_link
3335
* @param string $page
3436
*/
35-
public function __construct( $basename, $title, $logo, $description, $plugin_link = null, $page = null ) {
37+
public function __construct( $basename, $title, $logo, $description, $plugin_link = null, Url $url = null ) {
3638
if ( null === $plugin_link ) {
3739
$plugin_link = $this->search_plugin( $title );
3840
}
3941

40-
if ( null === $page ) {
41-
$page = 'pricing-purchase';
42+
if ( null === $url ) {
43+
$url = new Url\Site( Url\Site::PAGE_PRICING );
4244
}
4345

4446
$this->basename = $basename;
4547
$this->title = $title;
4648
$this->logo = $logo;
4749
$this->description = $description;
4850
$this->plugin_link = $plugin_link;
49-
$this->page = $page;
51+
$this->url = $url;
5052
}
5153

5254
/**
@@ -116,7 +118,7 @@ public function get_description() {
116118
* @return string
117119
*/
118120
public function get_link() {
119-
return ac_get_site_utm_url( $this->page, 'addon', $this->get_slug() );
121+
return ( new Url\UtmTags( $this->url, 'addon', $this->get_slug() ) )->get_url();
120122
}
121123

122124
/**

classes/Integration/ACF.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use AC\Integration;
66
use AC\Screen;
7+
use AC\Type\Url\Site;
78

89
final class ACF extends Integration {
910

@@ -14,7 +15,7 @@ public function __construct() {
1415
'assets/images/addons/acf.png',
1516
__( 'Display and edit ACF fields in the posts overview in seconds!', 'codepress-admin-columns' ),
1617
'https://www.advancedcustomfields.com',
17-
'advanced-custom-fields'
18+
new Site( Site::PAGE_ADDON_ACF )
1819
);
1920
}
2021

classes/Integration/BuddyPress.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use AC\Integration;
66
use AC\ListScreen;
77
use AC\Screen;
8+
use AC\Type\Url\Site;
89

910
final class BuddyPress extends Integration {
1011

@@ -13,7 +14,9 @@ public function __construct() {
1314
'ac-addon-buddypress/ac-addon-buddypress.php',
1415
__( 'BuddyPress', 'codepress-admin-columns' ),
1516
'assets/images/addons/buddypress.png',
16-
__( 'Display any of your Profile Fields for BuddyPress on your users overview.', 'codepress-admin-columns' )
17+
__( 'Display any of your Profile Fields for BuddyPress on your users overview.', 'codepress-admin-columns' ),
18+
null,
19+
new Site( Site::PAGE_ADDON_BUDDYPRESS )
1720
);
1821
}
1922

0 commit comments

Comments
 (0)