Skip to content

Commit b8c70b9

Browse files
committed
Merge branch 'release/2.0.0'
2 parents 39bf2b2 + d7e67f3 commit b8c70b9

23 files changed

+11920
-1000
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# Deploy
22
/deploy/
33

4+
# PHPStorm
5+
/.idea/
6+
47
# Eclipse
58
/.buildpath
69
/.project
710
/.settings/
811

912
# Node.js
1013
/node_modules/
14+
15+
# Composer
16+
/vendor/
17+
18+
# WordPress
19+
/wordpress/

Gruntfile.js

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,7 @@ module.exports = function( grunt ) {
77

88
// PHPLint
99
phplint: {
10-
options: {
11-
phpArgs: {
12-
'-lf': null
13-
}
14-
},
15-
all: [ 'classes/**/*.php' ]
16-
},
17-
18-
// PHP Code Sniffer
19-
phpcs: {
20-
application: {
21-
src: [
22-
'**/*.php',
23-
'!deploy/**',
24-
'!node_modules/**'
25-
],
26-
},
27-
options: {
28-
standard: 'phpcs.ruleset.xml',
29-
showSniffCodes: true
30-
}
10+
all: [ 'src/**/*.php' ]
3111
},
3212

3313
// JSHint
@@ -71,7 +51,9 @@ module.exports = function( grunt ) {
7151
updatePoFiles: true,
7252
exclude: [
7353
'deploy/.*',
74-
'node_modules/.*'
54+
'node_modules/.*',
55+
'vendor/.*',
56+
'wordpress/.*'
7557
],
7658
}
7759
}
@@ -84,9 +66,10 @@ module.exports = function( grunt ) {
8466
'**',
8567
'!Gruntfile.js',
8668
'!package.json',
87-
'!phpcs.ruleset.xml',
69+
'!phpcs.xml.dist',
8870
'!deploy/**',
8971
'!node_modules/**',
72+
'!wordpress/**'
9073
],
9174
dest: 'deploy/latest',
9275
expand: true
@@ -117,7 +100,7 @@ module.exports = function( grunt ) {
117100
rt_wp_deploy: {
118101
app: {
119102
options: {
120-
svnUrl: 'http://plugins.svn.wordpress.org/pronamic-domain-mapping/',
103+
svnUrl: 'https://plugins.svn.wordpress.org/pronamic-domain-mapping/',
121104
svnDir: 'deploy/wp-svn',
122105
svnUsername: 'pronamic',
123106
deployDir: 'deploy/latest',
@@ -163,7 +146,7 @@ module.exports = function( grunt ) {
163146
} );
164147

165148
// Default task(s).
166-
grunt.registerTask( 'default', [ 'jshint', 'phplint', 'phpcs', 'checkwpversion' ] );
149+
grunt.registerTask( 'default', [ 'jshint', 'phplint', 'checkwpversion' ] );
167150
grunt.registerTask( 'pot', [ 'makepot' ] );
168151

169152
grunt.registerTask( 'deploy', [

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# [Pronamic Domain Mapping](http://www.pronamic.eu/plugins/pronamic-domain-mapping/)
1+
# [Pronamic Domain Mapping](https://www.pronamic.eu/plugins/pronamic-domain-mapping/)
22

33
**Pronamic Domain Mapping plugin allows you to map domains to custom domain name pages.**
44

5-
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)
5+
[![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](https://gruntjs.com/)
66

77
## Installation
88

@@ -24,6 +24,15 @@ Additionally, in order for `sunrise.php` to be loaded, you must add the followin
2424
define( 'SUNRISE', true );
2525
```
2626

27+
## Post type support
28+
29+
Aside from the custom post type included in this plugin, domain mapping support can also be added
30+
to other post types. For example, to add support to the `page` post type:
31+
32+
```php
33+
add_post_type_support( 'page', 'pronamic_domain_mapping' );
34+
```
35+
2736
# Links
2837

2938
* https://github.com/deniaz/wp-dms

admin/domain-names.php

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,82 @@
11
<?php
2+
/**
3+
* Domain names
4+
*
5+
* @author Pronamic <info@pronamic.eu>
6+
* @copyright 2005-2021 Pronamic
7+
* @license GPL-3.0-or-later
8+
* @package Pronamic\WordPress\DomainMapping
9+
*/
210

311
global $post;
412

5-
$query = new WP_Query( array(
6-
'post_type' => 'any',
7-
'nopaging' => true,
8-
'meta_query' => array(
9-
array(
10-
'key' => '_pronamic_domain_mapping_host',
11-
'compare' => 'EXISTS',
13+
$query = new \WP_Query(
14+
array(
15+
'post_type' => 'any',
16+
'nopaging' => true,
17+
'meta_query' => array(
18+
array(
19+
'key' => '_pronamic_domain_mapping_host',
20+
'compare' => 'EXISTS',
21+
),
1222
),
13-
),
14-
'order' => 'ASC',
15-
'orderby' => 'meta_value',
16-
'meta_key' => '_pronamic_domain_mapping_host',
17-
) );
23+
'order' => 'ASC',
24+
'orderby' => 'meta_value',
25+
'meta_key' => '_pronamic_domain_mapping_host',
26+
)
27+
);
1828

1929
?>
2030
<div class="wrap">
21-
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
31+
<h1><?php echo \esc_html( \get_admin_page_title() ); ?></h1>
2232

2333
<ul class="subsubsub">
2434
<li class="all">
2535
<a class="current" href="">
26-
<?php esc_html_e( 'All', 'pronamic_domain_mapping' ); ?> <span class="count">(<?php echo esc_html( $query->found_posts ); ?>)</span>
36+
<?php \esc_html_e( 'All', 'pronamic_domain_mapping' ); ?> <span class="count">(<?php echo \esc_html( $query->found_posts ); ?>)</span>
2737
</a>
2838
</li>
2939
</ul>
3040

3141
<table cellspacing="0" class="wp-list-table widefat fixed posts">
3242
<thead>
3343
<tr>
34-
<th scope="col"><?php esc_html_e( 'Domain Name', 'pronamic_domain_mapping' ); ?></th>
35-
<th scope="col"><?php esc_html_e( 'Title', 'pronamic_domain_mapping' ); ?></th>
44+
<th scope="col"><?php \esc_html_e( 'Domain Name', 'pronamic_domain_mapping' ); ?></th>
45+
<th scope="col"><?php \esc_html_e( 'Title', 'pronamic_domain_mapping' ); ?></th>
3646
</tr>
3747
</thead>
3848

3949
<tbody>
4050

41-
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
51+
<?php
52+
53+
while ( $query->have_posts() ) :
54+
55+
$query->the_post();
56+
57+
?>
4258

4359
<tr>
4460
<td>
4561
<strong>
46-
<a href="<?php the_permalink(); ?>">
47-
<?php echo esc_html( get_post_meta( $post->ID, '_pronamic_domain_mapping_host', true ) ); ?>
62+
<a href="<?php \the_permalink(); ?>">
63+
<?php echo \esc_html( \get_post_meta( $post->ID, '_pronamic_domain_mapping_host', true ) ); ?>
4864
</a>
4965
</strong>
5066

5167
<div class="row-actions">
5268
<span class="edit">
53-
<a href="<?php echo esc_attr( get_edit_post_link( $post->ID ) ); ?>"><?php esc_html_e( 'Edit', 'pronamic_domain_mapping' ); ?></a> |
69+
<a href="<?php echo \esc_attr( \get_edit_post_link( $post->ID ) ); ?>"><?php \esc_html_e( 'Edit', 'pronamic_domain_mapping' ); ?></a> |
5470
</span>
5571

5672
<span class="view">
57-
<a href="<?php the_permalink(); ?>"><?php esc_html_e( 'View', 'pronamic_domain_mapping' ); ?></a>
73+
<a href="<?php \the_permalink(); ?>"><?php \esc_html_e( 'View', 'pronamic_domain_mapping' ); ?></a>
5874
</span>
5975
</div>
6076
</td>
6177
<td>
62-
<a href="<?php the_permalink(); ?>">
63-
<?php the_title(); ?>
78+
<a href="<?php \the_permalink(); ?>">
79+
<?php \the_title(); ?>
6480
</a>
6581
</td>
6682
</tr>
@@ -70,9 +86,5 @@
7086
</tbody>
7187
</table>
7288

73-
<?php
74-
75-
wp_reset_postdata();
76-
77-
?>
89+
<?php \wp_reset_postdata(); ?>
7890
</div>

admin/meta-box-domain-mapping.php

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,60 @@
11
<?php
2+
/**
3+
* Meta box domain mapping
4+
*
5+
* @author Pronamic <info@pronamic.eu>
6+
* @copyright 2005-2021 Pronamic
7+
* @license GPL-3.0-or-later
8+
* @package Pronamic\WordPress\DomainMapping
9+
*/
210

311
global $post;
412

5-
wp_nonce_field( 'pronamic_domain_mapping_save', 'pronamic_domain_mapping_meta_box_nonce' );
13+
\wp_nonce_field( 'pronamic_domain_mapping_save', 'pronamic_domain_mapping_meta_box_nonce' );
614

715
$protocols = array(
816
'http',
917
'https',
1018
);
1119

12-
$protocol = get_post_meta( $post->ID, '_pronamic_domain_mapping_protocol', true );
20+
$protocol = \get_post_meta( $post->ID, '_pronamic_domain_mapping_protocol', true );
1321
$protocol = empty( $protocol ) ? 'http' : $protocol;
1422

15-
$host = get_post_meta( $post->ID, '_pronamic_domain_mapping_host', true );
16-
$ga = get_post_meta( $post->ID, '_pronamic_domain_mapping_ga_ua', true );
23+
$host = \get_post_meta( $post->ID, '_pronamic_domain_mapping_host', true );
24+
$ga = \get_post_meta( $post->ID, '_pronamic_domain_mapping_ga_ua', true );
1725

1826
?>
1927
<table class="form-table">
2028
<tr valign="top">
2129
<th scope="row">
22-
<label for="pronamic_domain_mapping_host"><?php esc_html_e( 'Domain Name', 'pronamic_domain_mapping' ); ?></label>
30+
<label for="pronamic_domain_mapping_host"><?php \esc_html_e( 'Domain Name', 'pronamic_domain_mapping' ); ?></label>
2331
</th>
2432
<td>
2533
<select id="pronamic_domain_mapping_protocol" name="_pronamic_domain_mapping_protocol" class="regular-text">
2634
<?php
2735

2836
foreach ( $protocols as $value ) {
29-
printf(
37+
\printf(
3038
'<option value="%s" %s>%s</option>',
31-
esc_attr( $value ),
32-
selected( $value, $protocol, false ),
33-
esc_html( $value )
39+
\esc_attr( $value ),
40+
\selected( $value, $protocol, false ),
41+
\esc_html( $value )
3442
);
3543
}
3644

3745
?>
3846
</select>
3947
://
40-
<input id="pronamic_domain_mapping_host" name="_pronamic_domain_mapping_host" value="<?php echo esc_attr( $host ); ?>" type="text" class="regular-text" />
48+
<input id="pronamic_domain_mapping_host" name="_pronamic_domain_mapping_host" value="<?php echo \esc_attr( $host ); ?>" type="text" class="regular-text" />
4149
/
4250
</td>
4351
</tr>
4452
<tr valign="top">
4553
<th scope="row">
46-
<label for="pronamic_domain_mapping_ga_ua"><?php esc_html_e( 'Google Analytics Tracking ID', 'pronamic_domain_mapping' ); ?></label>
54+
<label for="pronamic_domain_mapping_ga_ua"><?php \esc_html_e( 'Google Analytics Tracking ID', 'pronamic_domain_mapping' ); ?></label>
4755
</th>
4856
<td>
49-
<input id="pronamic_domain_mapping_ga_ua" name="_pronamic_domain_mapping_ga_ua" value="<?php echo esc_attr( $ga ); ?>" type="text" class="regular-text" />
57+
<input id="pronamic_domain_mapping_ga_ua" name="_pronamic_domain_mapping_ga_ua" value="<?php echo \esc_attr( $ga ); ?>" type="text" class="regular-text" />
5058
</td>
5159
</tr>
5260
</table>

0 commit comments

Comments
 (0)