Version Description
Download this release
Release Info
Developer | kurudrive |
Plugin | VK All in One Expansion Unit |
Version | 9.68.0.1 |
Comparing to | |
See all releases |
Code changes from version 9.68.0.0 to 9.68.0.1
- inc/sns/function-sns-btns.php +3 -0
- inc/sns/sns_customizer.php +3 -5
- inc/wp-title/config.php +9 -0
- inc/wp-title/package/head-title.php +52 -0
- inc/{wp-title.php → wp-title/package/wp-title.php} +49 -41
- readme.txt +5 -1
- tests/test-head-title.php +148 -0
- veu-packages.php +1 -1
- vkExUnit.php +1 -1
inc/sns/function-sns-btns.php
CHANGED
@@ -39,6 +39,9 @@ function veu_is_sns_btns_display() {
|
|
39 |
$post_type = vk_get_post_type();
|
40 |
$post_type = $post_type['slug'];
|
41 |
|
|
|
|
|
|
|
42 |
if ( isset( $options['snsBtn_exclude_post_types'][ $post_type ] ) && $options['snsBtn_exclude_post_types'][ $post_type ] ) {
|
43 |
return false;
|
44 |
} elseif ( ! isset( $options['snsBtn_ignorePosts'] ) ) {
|
39 |
$post_type = vk_get_post_type();
|
40 |
$post_type = $post_type['slug'];
|
41 |
|
42 |
+
if ( empty( $options['enableSnsBtns'] ) ) {
|
43 |
+
return false;
|
44 |
+
}
|
45 |
if ( isset( $options['snsBtn_exclude_post_types'][ $post_type ] ) && $options['snsBtn_exclude_post_types'][ $post_type ] ) {
|
46 |
return false;
|
47 |
} elseif ( ! isset( $options['snsBtn_ignorePosts'] ) ) {
|
inc/sns/sns_customizer.php
CHANGED
@@ -550,7 +550,6 @@ function veu_customize_register_sns( $wp_customize ) {
|
|
550 |
'sanitize_callback' => 'veu_sanitize_boolean',
|
551 |
)
|
552 |
);
|
553 |
-
|
554 |
$wp_customize->add_control(
|
555 |
'useLine',
|
556 |
array(
|
@@ -561,8 +560,8 @@ function veu_customize_register_sns( $wp_customize ) {
|
|
561 |
)
|
562 |
);
|
563 |
|
564 |
-
|
565 |
-
|
566 |
'vkExUnit_sns_options[useCopy]',
|
567 |
array(
|
568 |
'default' => $default_options['useCopy'],
|
@@ -571,9 +570,8 @@ function veu_customize_register_sns( $wp_customize ) {
|
|
571 |
'sanitize_callback' => 'veu_sanitize_boolean',
|
572 |
)
|
573 |
);
|
574 |
-
|
575 |
$wp_customize->add_control(
|
576 |
-
'
|
577 |
array(
|
578 |
'label' => __( 'Copy', 'vk-all-in-one-expansion-unit' ),
|
579 |
'section' => 'veu_sns_setting',
|
550 |
'sanitize_callback' => 'veu_sanitize_boolean',
|
551 |
)
|
552 |
);
|
|
|
553 |
$wp_customize->add_control(
|
554 |
'useLine',
|
555 |
array(
|
560 |
)
|
561 |
);
|
562 |
|
563 |
+
// SNS Btn (Copy)
|
564 |
+
$wp_customize->add_setting(
|
565 |
'vkExUnit_sns_options[useCopy]',
|
566 |
array(
|
567 |
'default' => $default_options['useCopy'],
|
570 |
'sanitize_callback' => 'veu_sanitize_boolean',
|
571 |
)
|
572 |
);
|
|
|
573 |
$wp_customize->add_control(
|
574 |
+
'useCopy',
|
575 |
array(
|
576 |
'label' => __( 'Copy', 'vk-all-in-one-expansion-unit' ),
|
577 |
'section' => 'veu_sns_setting',
|
inc/wp-title/config.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WP Title の書き換え
|
4 |
+
*
|
5 |
+
* @package WP Title
|
6 |
+
*/
|
7 |
+
$package_path = dirname( __FILE__ ) . '/package/';
|
8 |
+
require $package_path . 'wp-title.php';
|
9 |
+
require $package_path . 'head-title.php';
|
inc/wp-title/package/head-title.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?
|
2 |
+
/**
|
3 |
+
* SEO Title
|
4 |
+
*
|
5 |
+
* @package VK All in One Expansion Unit
|
6 |
+
*/
|
7 |
+
if ( ! class_exists( 'VEU_Metabox' ) ) {
|
8 |
+
return;
|
9 |
+
}
|
10 |
+
|
11 |
+
class VEU_Metabox_Head_Title extends VEU_Metabox {
|
12 |
+
|
13 |
+
public function __construct( $args = array() ) {
|
14 |
+
|
15 |
+
$this->args = array(
|
16 |
+
'slug' => 'veu_head_title',
|
17 |
+
'cf_name' => 'veu_head_title',
|
18 |
+
'title' => __( 'Head Title', 'vk-all-in-one-expansion-unit' ),
|
19 |
+
'priority' => 50,
|
20 |
+
);
|
21 |
+
|
22 |
+
parent::__construct( $this->args );
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* metabox_body_form
|
28 |
+
* Form inner
|
29 |
+
*
|
30 |
+
* @return [type] [description]
|
31 |
+
*/
|
32 |
+
public function metabox_body_form( $cf_value ) {
|
33 |
+
global $post;
|
34 |
+
$post_meta = get_post_meta( $post->ID, $this->args['cf_name'], true );
|
35 |
+
$title = ! empty( $post_meta['title'] ) ? $post_meta['title'] : '';
|
36 |
+
$checked = checked( ! empty( $post_meta['add_site_title'] ), true, false );
|
37 |
+
|
38 |
+
$form = '';
|
39 |
+
$form .= '<input type="text" name="' . esc_attr( $this->args['cf_name'] ) . '[title]" value="' . esc_attr( $title ) . '" />';
|
40 |
+
$form .= '<p>' . __( 'If there is any input here, the input will be reflected in the title tag.', 'vk-all-in-one-expansion-unit' ) . '</p>';
|
41 |
+
$form .= '<p>' . __( 'Please note that the notation on the page will not be rewritten.', 'vk-all-in-one-expansion-unit' ) . '</p>';
|
42 |
+
$form .= '<label>';
|
43 |
+
$form .= '<input type="checkbox" name="' . esc_attr( $this->args['cf_name'] ) . '[add_site_title]" ' . $checked . ' />';
|
44 |
+
$form .= __( 'Add Separator and Site Title', 'vk-all-in-one-expansion-unit' );
|
45 |
+
$form .= '</label>';
|
46 |
+
|
47 |
+
return $form;
|
48 |
+
}
|
49 |
+
|
50 |
+
} // class VEU_Metabox_Head_Title {
|
51 |
+
|
52 |
+
$VEU_Metabox_Head_Title = new VEU_Metabox_Head_Title();
|
inc/{wp-title.php → wp-title/package/wp-title.php}
RENAMED
@@ -1,12 +1,13 @@
|
|
1 |
<?php
|
2 |
-
//WordPress -> 4.3
|
3 |
add_filter( 'wp_title', 'vkExUnit_get_wp_head_title', 11 );
|
4 |
-
//WordPress 4.4 ->
|
5 |
add_filter( 'pre_get_document_title', 'vkExUnit_get_wp_head_title', 11 );
|
6 |
|
7 |
/**
|
8 |
* ExUnitの機能管理パッケージに登録
|
9 |
-
*
|
|
|
10 |
*/
|
11 |
function vkExUnit_wp_title_init() {
|
12 |
$tab_label = __( '<title> tag of homepage', 'vk-all-in-one-expansion-unit' );
|
@@ -17,9 +18,11 @@ function vkExUnit_wp_title_init() {
|
|
17 |
}
|
18 |
add_action( 'veu_package_init', 'vkExUnit_wp_title_init' );
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
function vkExUnit_get_wp_head_title() {
|
24 |
global $wp_query;
|
25 |
$post = $wp_query->get_queried_object();
|
@@ -38,30 +41,37 @@ function vkExUnit_get_wp_head_title() {
|
|
38 |
} elseif ( is_archive() ) {
|
39 |
$title = vkExUnit_get_the_archive_title() . $sep . get_bloginfo( 'name' );
|
40 |
// Page
|
41 |
-
} elseif (
|
42 |
-
|
43 |
-
if ( $
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
|
|
|
|
48 |
} else {
|
49 |
-
$
|
50 |
}
|
51 |
-
$title = get_the_title() . $sep . get_the_title( $post_id ) . $sep . get_bloginfo( 'name' );
|
52 |
-
// Not Sub Pages
|
53 |
} else {
|
54 |
$title = get_the_title() . $sep . get_bloginfo( 'name' );
|
55 |
}
|
56 |
-
} elseif ( is_singular() ) {
|
57 |
-
$title = get_the_title() . $sep . get_bloginfo( 'name' );
|
58 |
-
|
59 |
// Search
|
60 |
} elseif ( is_search() ) {
|
61 |
-
if ( get_search_query() ){
|
62 |
$title = sprintf( __( 'Search Results for : %s', 'vk-all-in-one-expansion-unit' ), get_search_query() ) . $sep . get_bloginfo( 'name' );
|
63 |
} else {
|
64 |
-
$title = sprintf( __( 'Search Results', 'vk-all-in-one-expansion-unit' ), get_search_query() ) . $sep . get_bloginfo( 'name' );
|
65 |
}
|
66 |
// 404
|
67 |
} elseif ( is_404() ) {
|
@@ -84,7 +94,7 @@ function vkExUnit_get_wp_head_title() {
|
|
84 |
|
85 |
function vkExUnit_add_wp_title_page() {
|
86 |
$options = vkExUnit_get_wp_title_options();
|
87 |
-
?>
|
88 |
<div id="seoSetting" class="sectionBox">
|
89 |
<h3><?php _e( '<title> tag of homepage', 'vk-all-in-one-expansion-unit' ); ?></h3>
|
90 |
<table class="form-table">
|
@@ -93,36 +103,34 @@ function vkExUnit_add_wp_title_page() {
|
|
93 |
<th><?php _e( '<title> tag of homepage', 'vk-all-in-one-expansion-unit' ); ?></th>
|
94 |
<td>
|
95 |
<p>
|
96 |
-
<?php
|
97 |
-
$sitetitle_link = '<a href="' . get_admin_url() . 'options-general.php" target="_blank">' . __( 'title of the site', 'vk-all-in-one-expansion-unit' ) . '</a>';
|
98 |
-
printf( __( 'Normally "%1$s" is placed in the title tags of all the pages.', 'vk-all-in-one-expansion-unit' ), $sitetitle_link );
|
99 |
-
?>
|
100 |
<br />
|
101 |
-
<?php printf( __( 'For example, it appears in the form of <br /><title>page title | %1$s</title><br /> if using a static page.', 'vk-all-in-one-expansion-unit' ), $sitetitle_link ); ?><br />
|
102 |
-
<?php
|
103 |
-
printf( __( 'However, it might have negative impact on search engine rankings if the <title> is too long, <strong>therefore please include the most popular keywords in a summarized manner, keeping the %s as short as possible.</strong>', 'vk-all-in-one-expansion-unit' ), $sitetitle_link );
|
104 |
-
?>
|
105 |
<br />
|
106 |
-
<?php
|
107 |
-
$tagline_link = '<a href="' . get_admin_url() . 'options-general.php" target="_blank">' . __( 'Tagline', 'vk-all-in-one-expansion-unit' ) . '</a>';
|
108 |
-
printf( __( 'In the top page will be output usually in the form of <br /><title>%1$s | %2$s</title>', 'vk-all-in-one-expansion-unit' ), $sitetitle_link, $tagline_link );
|
109 |
-
?>
|
110 |
<br />
|
111 |
-
<?php _e( 'However, it may be too long in the above format. If the input to the input field of the following, its contents will be reflected.', 'vk-all-in-one-expansion-unit' ); ?>
|
112 |
-
<?php /*_e('However, in the home page, as described above, other title will not be added, it is possible to make the <title> little longer, which can be set separately here.', 'vk-all-in-one-expansion-unit' );*/ ?></p>
|
113 |
|
114 |
|
115 |
-
<input type="text" name="vkExUnit_wp_title[extend_frontTitle]" value="<?php echo
|
116 |
</td>
|
117 |
</tr>
|
118 |
</table>
|
119 |
-
<?php submit_button(); ?>
|
120 |
</div>
|
121 |
-
<?php
|
122 |
}
|
123 |
|
124 |
-
|
125 |
-
|
126 |
function vkExUnit_get_wp_title_options() {
|
127 |
$options = get_option( 'vkExUnit_wp_title', array() );
|
128 |
$options = wp_parse_args( $options, vkExUnit_get_wp_title_default() );
|
@@ -133,7 +141,7 @@ function vkExUnit_get_wp_title_default() {
|
|
133 |
$default_options = array(
|
134 |
'extend_frontTitle' => '',
|
135 |
);
|
136 |
-
return apply_filters( 'vkExUnit_wp_title_default', $default_options );
|
137 |
}
|
138 |
|
139 |
function vkExUnit_wp_title_validate( $input ) {
|
1 |
<?php
|
2 |
+
// WordPress -> 4.3
|
3 |
add_filter( 'wp_title', 'vkExUnit_get_wp_head_title', 11 );
|
4 |
+
// WordPress 4.4 ->
|
5 |
add_filter( 'pre_get_document_title', 'vkExUnit_get_wp_head_title', 11 );
|
6 |
|
7 |
/**
|
8 |
* ExUnitの機能管理パッケージに登録
|
9 |
+
*
|
10 |
+
* @return void
|
11 |
*/
|
12 |
function vkExUnit_wp_title_init() {
|
13 |
$tab_label = __( '<title> tag of homepage', 'vk-all-in-one-expansion-unit' );
|
18 |
}
|
19 |
add_action( 'veu_package_init', 'vkExUnit_wp_title_init' );
|
20 |
|
21 |
+
|
22 |
+
/*********************************************
|
23 |
+
* Head title
|
24 |
+
*/
|
25 |
+
|
26 |
function vkExUnit_get_wp_head_title() {
|
27 |
global $wp_query;
|
28 |
$post = $wp_query->get_queried_object();
|
41 |
} elseif ( is_archive() ) {
|
42 |
$title = vkExUnit_get_the_archive_title() . $sep . get_bloginfo( 'name' );
|
43 |
// Page
|
44 |
+
} elseif ( is_singular() ) {
|
45 |
+
$post_meta = get_post_meta( $post->ID, 'veu_head_title', true );
|
46 |
+
if ( ! empty( $post_meta['title'] ) ) {
|
47 |
+
$title = $post_meta['title'];
|
48 |
+
if ( ! empty( $post_meta['add_site_title'] ) ) {
|
49 |
+
$title .= $sep . get_bloginfo( 'name' );
|
50 |
+
}
|
51 |
+
} elseif ( is_page() ) {
|
52 |
+
// Sub Pages
|
53 |
+
if ( $post->post_parent ) {
|
54 |
+
if ( $post->ancestors ) {
|
55 |
+
foreach ( $post->ancestors as $post_anc_id ) {
|
56 |
+
$post_id = $post_anc_id;
|
57 |
+
}
|
58 |
+
} else {
|
59 |
+
$post_id = $post->ID;
|
60 |
}
|
61 |
+
$title = get_the_title() . $sep . get_the_title( $post_id ) . $sep . get_bloginfo( 'name' );
|
62 |
+
// Not Sub Pages
|
63 |
} else {
|
64 |
+
$title = get_the_title() . $sep . get_bloginfo( 'name' );
|
65 |
}
|
|
|
|
|
66 |
} else {
|
67 |
$title = get_the_title() . $sep . get_bloginfo( 'name' );
|
68 |
}
|
|
|
|
|
|
|
69 |
// Search
|
70 |
} elseif ( is_search() ) {
|
71 |
+
if ( get_search_query() ) {
|
72 |
$title = sprintf( __( 'Search Results for : %s', 'vk-all-in-one-expansion-unit' ), get_search_query() ) . $sep . get_bloginfo( 'name' );
|
73 |
} else {
|
74 |
+
$title = sprintf( __( 'Search Results', 'vk-all-in-one-expansion-unit' ), get_search_query() ) . $sep . get_bloginfo( 'name' );
|
75 |
}
|
76 |
// 404
|
77 |
} elseif ( is_404() ) {
|
94 |
|
95 |
function vkExUnit_add_wp_title_page() {
|
96 |
$options = vkExUnit_get_wp_title_options();
|
97 |
+
?>
|
98 |
<div id="seoSetting" class="sectionBox">
|
99 |
<h3><?php _e( '<title> tag of homepage', 'vk-all-in-one-expansion-unit' ); ?></h3>
|
100 |
<table class="form-table">
|
103 |
<th><?php _e( '<title> tag of homepage', 'vk-all-in-one-expansion-unit' ); ?></th>
|
104 |
<td>
|
105 |
<p>
|
106 |
+
<?php
|
107 |
+
$sitetitle_link = '<a href="' . get_admin_url() . 'options-general.php" target="_blank">' . __( 'title of the site', 'vk-all-in-one-expansion-unit' ) . '</a>';
|
108 |
+
printf( __( 'Normally "%1$s" is placed in the title tags of all the pages.', 'vk-all-in-one-expansion-unit' ), $sitetitle_link );
|
109 |
+
?>
|
110 |
<br />
|
111 |
+
<?php printf( __( 'For example, it appears in the form of <br /><title>page title | %1$s</title><br /> if using a static page.', 'vk-all-in-one-expansion-unit' ), $sitetitle_link ); ?><br />
|
112 |
+
<?php
|
113 |
+
printf( __( 'However, it might have negative impact on search engine rankings if the <title> is too long, <strong>therefore please include the most popular keywords in a summarized manner, keeping the %s as short as possible.</strong>', 'vk-all-in-one-expansion-unit' ), $sitetitle_link );
|
114 |
+
?>
|
115 |
<br />
|
116 |
+
<?php
|
117 |
+
$tagline_link = '<a href="' . get_admin_url() . 'options-general.php" target="_blank">' . __( 'Tagline', 'vk-all-in-one-expansion-unit' ) . '</a>';
|
118 |
+
printf( __( 'In the top page will be output usually in the form of <br /><title>%1$s | %2$s</title>', 'vk-all-in-one-expansion-unit' ), $sitetitle_link, $tagline_link );
|
119 |
+
?>
|
120 |
<br />
|
121 |
+
<?php _e( 'However, it may be too long in the above format. If the input to the input field of the following, its contents will be reflected.', 'vk-all-in-one-expansion-unit' ); ?>
|
122 |
+
<?php /*_e('However, in the home page, as described above, other title will not be added, it is possible to make the <title> little longer, which can be set separately here.', 'vk-all-in-one-expansion-unit' );*/ ?></p>
|
123 |
|
124 |
|
125 |
+
<input type="text" name="vkExUnit_wp_title[extend_frontTitle]" value="<?php echo $options['extend_frontTitle']; ?>" />
|
126 |
</td>
|
127 |
</tr>
|
128 |
</table>
|
129 |
+
<?php submit_button(); ?>
|
130 |
</div>
|
131 |
+
<?php
|
132 |
}
|
133 |
|
|
|
|
|
134 |
function vkExUnit_get_wp_title_options() {
|
135 |
$options = get_option( 'vkExUnit_wp_title', array() );
|
136 |
$options = wp_parse_args( $options, vkExUnit_get_wp_title_default() );
|
141 |
$default_options = array(
|
142 |
'extend_frontTitle' => '',
|
143 |
);
|
144 |
+
return apply_filters( 'vkExUnit_wp_title_default', $default_options ); // phpcs:ignore
|
145 |
}
|
146 |
|
147 |
function vkExUnit_wp_title_validate( $input ) {
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: Google Analytics, New posts, Related Posts, sitemap, sns, twitter card, Fa
|
|
5 |
Requires at least: 5.3.0
|
6 |
Tested up to: 5.8.1
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 9.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -82,6 +82,10 @@ e.g.
|
|
82 |
|
83 |
== Changelog ==
|
84 |
|
|
|
|
|
|
|
|
|
85 |
= 9.67.2.0 =
|
86 |
* [ Other ][ term color ] Fix php error
|
87 |
|
5 |
Requires at least: 5.3.0
|
6 |
Tested up to: 5.8.1
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 9.68.0.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= 9.68.0.0 =
|
86 |
+
* [ Add Function ][ head title ] Add change head title function
|
87 |
+
* [ Bug fix ][ SNS ] Fix share button on customize screen
|
88 |
+
|
89 |
= 9.67.2.0 =
|
90 |
* [ Other ][ term color ] Fix php error
|
91 |
|
tests/test-head-title.php
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class HeadTitleTest
|
4 |
+
*
|
5 |
+
* @package Vk_All_In_One_Expansion_Unit
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* SEO title test case.
|
10 |
+
*/
|
11 |
+
class HeadTitleTest extends WP_UnitTestCase {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* タイトル書き換えのテスト
|
15 |
+
*/
|
16 |
+
function test_veu_get_the_sns_title() {
|
17 |
+
|
18 |
+
$sep = ' | ';
|
19 |
+
|
20 |
+
print PHP_EOL;
|
21 |
+
print '------------------------------------' . PHP_EOL;
|
22 |
+
print 'test_head_title' . PHP_EOL;
|
23 |
+
print '------------------------------------' . PHP_EOL;
|
24 |
+
|
25 |
+
$test_array = array(
|
26 |
+
array(
|
27 |
+
'page_type' => 'is_singular',
|
28 |
+
'post_title' => 'Post Title',
|
29 |
+
'site_name' => 'Site name',
|
30 |
+
'veu_head_title' => array(
|
31 |
+
'title' => 'Custom Title',
|
32 |
+
'add_site_title' => false,
|
33 |
+
),
|
34 |
+
'correct' => 'Custom Title',
|
35 |
+
),
|
36 |
+
array(
|
37 |
+
'page_type' => 'is_singular',
|
38 |
+
'post_title' => 'Post Title',
|
39 |
+
'site_name' => 'Site name',
|
40 |
+
'veu_head_title' => array(
|
41 |
+
'title' => 'Custom Title',
|
42 |
+
'add_site_title' => true,
|
43 |
+
),
|
44 |
+
'correct' => 'Custom Title' . $sep . 'Site name',
|
45 |
+
),
|
46 |
+
array(
|
47 |
+
'page_type' => 'is_singular',
|
48 |
+
'post_title' => 'Post Title',
|
49 |
+
'site_name' => 'Site name',
|
50 |
+
'veu_head_title' => array(
|
51 |
+
'title' => '',
|
52 |
+
'add_site_title' => false,
|
53 |
+
),
|
54 |
+
'correct' => 'Post Title' . $sep . 'Site name',
|
55 |
+
),
|
56 |
+
array(
|
57 |
+
'page_type' => 'is_page',
|
58 |
+
'post_title' => 'Page Title',
|
59 |
+
'site_name' => 'Site name',
|
60 |
+
'veu_head_title' => array(
|
61 |
+
'title' => 'Custom Title',
|
62 |
+
'add_site_title' => false,
|
63 |
+
),
|
64 |
+
'correct' => 'Custom Title',
|
65 |
+
),
|
66 |
+
array(
|
67 |
+
'page_type' => 'is_page',
|
68 |
+
'post_title' => 'Page Title',
|
69 |
+
'site_name' => 'Site name',
|
70 |
+
'veu_head_title' => array(
|
71 |
+
'title' => 'Custom Title',
|
72 |
+
'add_site_title' => true,
|
73 |
+
),
|
74 |
+
'correct' => 'Custom Title' . $sep . 'Site name',
|
75 |
+
),
|
76 |
+
);
|
77 |
+
|
78 |
+
$before_blogname = get_option( 'blogname' );
|
79 |
+
$before_veu_wp_title = get_option( 'vkExUnit_wp_title' );
|
80 |
+
$before_veu_common_options = get_option( 'vkExUnit_common_options' );
|
81 |
+
|
82 |
+
foreach ( $test_array as $key => $test_value ) {
|
83 |
+
|
84 |
+
// Set site name.
|
85 |
+
update_option( 'blogname', $test_value['site_name'] );
|
86 |
+
|
87 |
+
// Add sns title.
|
88 |
+
if ( $test_value['veu_head_title'] !== null ) {
|
89 |
+
|
90 |
+
// Add test post.
|
91 |
+
$post = array(
|
92 |
+
'post_title' => $test_value['post_title'],
|
93 |
+
'post_status' => 'publish',
|
94 |
+
'post_content' => 'content',
|
95 |
+
);
|
96 |
+
$post_id = wp_insert_post( $post );
|
97 |
+
|
98 |
+
add_post_meta( $post_id, 'veu_head_title', $test_value['veu_head_title'] );
|
99 |
+
}
|
100 |
+
|
101 |
+
if ( 'is_singular' === $test_value['page_type'] || 'is_page' === $test_value['page_type'] ) {
|
102 |
+
global $wp_query;
|
103 |
+
$args = array( 'p' => $post_id );
|
104 |
+
// is_singular() の条件分岐を効かせるため
|
105 |
+
$wp_query = new WP_Query( $args );
|
106 |
+
$post = get_post( $post_id );
|
107 |
+
// setup_postdata() しないと wp_title() の書き換えの所で get_the_id() が拾えないため
|
108 |
+
setup_postdata( $post );
|
109 |
+
|
110 |
+
// } elseif ( $test_value['page_type'] == 'is_front_page' ) {
|
111 |
+
// Set Custom front title
|
112 |
+
// update_option( 'vkExUnit_wp_title', $test_value['vkExUnit_wp_title'] );
|
113 |
+
// タイトルの書き換え機能がオフの場合の確認
|
114 |
+
// if ( $test_value['package_wp_title'] === false ) {
|
115 |
+
// $options = get_option( 'vkExUnit_common_options' );
|
116 |
+
// 有効化設定の値をタイトル書き換え無効化に設定
|
117 |
+
// $options['active_wpTitle'] = false;
|
118 |
+
// update_option( 'vkExUnit_common_options', $options );
|
119 |
+
// }
|
120 |
+
// トップページの時の値を確認するためにトップに移動
|
121 |
+
// $this->go_to( home_url( '/' ) );
|
122 |
+
}
|
123 |
+
|
124 |
+
$return = vkExUnit_get_wp_head_title();
|
125 |
+
|
126 |
+
// 取得できたHTMLが、意図したHTMLと等しいかテスト
|
127 |
+
$this->assertEquals( $test_value['correct'], $return );
|
128 |
+
|
129 |
+
print PHP_EOL;
|
130 |
+
|
131 |
+
print 'correct ::::' . $test_value['correct'] . PHP_EOL;
|
132 |
+
print 'return ::::' . $return . PHP_EOL;
|
133 |
+
|
134 |
+
if ( 'is_singular' === $test_value['page_type'] || 'is_page' === $test_value['page_type'] ) {
|
135 |
+
delete_post_meta( $post_id, 'veu_head_title' );
|
136 |
+
wp_delete_post( $post_id );
|
137 |
+
wp_reset_postdata();
|
138 |
+
wp_reset_query();
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
// もとの値に戻す.
|
143 |
+
update_option( 'blogname', $before_blogname );
|
144 |
+
update_option( 'vkExUnit_wp_title', $before_veu_wp_title );
|
145 |
+
update_option( 'vkExUnit_common_options', $before_veu_common_options );
|
146 |
+
|
147 |
+
}
|
148 |
+
}
|
veu-packages.php
CHANGED
@@ -74,7 +74,7 @@ function veu_get_packages() {
|
|
74 |
),
|
75 |
),
|
76 |
'default' => true,
|
77 |
-
'include' => 'wp-title.php',
|
78 |
);
|
79 |
|
80 |
/*
|
74 |
),
|
75 |
),
|
76 |
'default' => true,
|
77 |
+
'include' => 'wp-title/config.php',
|
78 |
);
|
79 |
|
80 |
/*
|
vkExUnit.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: VK All in One Expansion Unit
|
4 |
* Plugin URI: https://ex-unit.nagoya
|
5 |
* Description: This plug-in is an integrated plug-in with a variety of features that make it powerful your web site. Many features can be stopped individually. Example Facebook Page Plugin,Social Bookmarks,Print OG Tags,Print Twitter Card Tags,Print Google Analytics tag,New post widget,Insert Related Posts and more!
|
6 |
-
* Version: 9.
|
7 |
* Requires PHP: 5.6
|
8 |
* Author: Vektor,Inc.
|
9 |
* Text Domain: vk-all-in-one-expansion-unit
|
3 |
* Plugin Name: VK All in One Expansion Unit
|
4 |
* Plugin URI: https://ex-unit.nagoya
|
5 |
* Description: This plug-in is an integrated plug-in with a variety of features that make it powerful your web site. Many features can be stopped individually. Example Facebook Page Plugin,Social Bookmarks,Print OG Tags,Print Twitter Card Tags,Print Google Analytics tag,New post widget,Insert Related Posts and more!
|
6 |
+
* Version: 9.68.0.1
|
7 |
* Requires PHP: 5.6
|
8 |
* Author: Vektor,Inc.
|
9 |
* Text Domain: vk-all-in-one-expansion-unit
|