Skip to content

Commit

Permalink
0.4.2 (#20)
Browse files Browse the repository at this point in the history
* Fix typo

* Add 'force enqueue style' option.

* Add filters

- nss_sharable_singular
- nss_sharable_shortcode_used
- nss_sharable_excluded

* Reorder settings fields

* Translation update

* Version, and changelog update

* Update version to 0.4.2
  • Loading branch information
chwnam authored Dec 17, 2021
1 parent addc9bb commit 646bde1
Show file tree
Hide file tree
Showing 18 changed files with 367 additions and 557 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
0.4.2
-----
2021-12-17

- Typo fix.
- Version bumped to 0.4.2.


0.4.2-rc.1
----------
2021-12-07

- Add 'force enqueue style' option.
- Add filters: nss_sharable_singular, nss_sharable_shortcode_used, nss_sharable_excluded.
- Arrange order of settings fields.
- Fix typos.


0.4.1
-----
2021-12-03
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,18 @@ function my_override_nss_icon_sets( $icons ) {

소셜 공유 페이지를 출력할지를 결정하는 필터입니다.

#### nss_sharable_singular

`NSS_Front::is_sharable()` 메소드 내부에서 싱글 타입인지 아닌지를 저장한 변수 `$singular`의 값을 필터합니다.

#### nss_sharable_shortcode_used

`NSS_Front::is_sharable()` 메소드 내부에서 숏코드를 사용했는지 아닌지를 저장한 변수 `$shortcode_used`의 값을 필터합니다.

#### nss_sharable_excluded

`NSS_Front::is_sharable()` 메소드 내부에서 출력 제외할 포스트인지 아닌지를 저장한 변수 `$excluded`의 값을 필터합니다.

#### nss_share_params

소셜 공유 페이지를 출력하기 위한 자바스크립트의 옵션 값을 필터합니다. 필터하는 대상은 연관 배열이며, 이 배열은 다음처럼 구성되어 있습니다.
Expand All @@ -295,7 +307,7 @@ function my_override_nss_icon_sets( $icons ) {

#### nss_buttons_context

'buttons' 템플릿을 출력하기 위한 콘텍스트 변수를 필터합니다. 빌터하는 대상은 연관 배열입니다. 이 배열의 키는 템플릿에서 변수로 사용됩니다.
'buttons' 템플릿을 출력하기 위한 콘텍스트 변수를 필터합니다. 필터하는 대상은 연관 배열입니다. 이 배열의 키는 템플릿에서 변수로 사용됩니다.

'buttons 템플릿 설명' 부분을 참고하세요.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"php": "^7.4",
"ext-json": "*"
},
"version": "0.4.1",
"version": "0.4.2",
"require-dev": {
"phpunit/phpunit": "^7"
},
Expand Down
110 changes: 69 additions & 41 deletions includes/modules/class-nss-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private function prepre_settings(): self {
'nss'
);

// Enable/disable.
add_settings_field(
'nss-enable',
__( 'Enable/Disable', 'nss' ),
Expand All @@ -72,6 +73,7 @@ private function prepre_settings(): self {
]
);

// Available services.
add_settings_field(
'nss-services',
__( 'Available Services', 'nss' ),
Expand All @@ -85,12 +87,67 @@ private function prepre_settings(): self {
]
);

// Post types.
add_settings_field(
'nss-display-post-type',
__( 'Post Types', 'nss' ),
[ $this, 'render_post_types' ],
'nss',
'nss-general',
[
'name' => $option_name,
'value' => $setup->get_post_types(),
]
);

// Exclude.
add_settings_field(
'nss-display-exclude',
__( 'Exclude', 'nss' ),
[ $this, 'render_textarea' ],
'nss',
'nss-general',
[
'id' => "$option_name-exclude",
'label_for' => "$option_name-exclude",
'name' => "{$option_name}[exclude]",
'value' => implode( "\r\n", $setup->get_exclude() ),
'attrs' => [ 'rows' => 3 ],
'description' => __( 'Social share buttons do not appear on posts in this list. Please enter post ID one by one row.', 'nss' ),
]
);



// Section: Display ////////////////////////////////////////////////////////////////////////////////////////
add_settings_section(
'nss-display',
__( 'Display', 'nss' ),
'__return_empty_string',
'nss'
);

add_settings_field(
'nss-display-force-enqueue-style',
__( 'Force enqueue style', 'nss' ),
[ $this, 'render_checkbox' ],
'nss',
'nss-display',
[
'id' => "$option_name-force-enqueue-style",
'name' => "{$option_name}[force_enqueue_style]",
'value' => $setup->is_force_enqueue_style(),
'instruction' => __( 'Force style.css to be enqueued in header tags.', 'nss' ),
'description' => __( 'If checked, style.css is always output in header tags. You may need this option if you are using [nss] shortcode in your custom builder.', 'nss' ),
]
);

add_settings_field(
'nss-popup-width',
__( 'Popup Width', 'nss' ),
[ $this, 'render_input' ],
'nss',
'nss-general',
'nss-display',
[
'id' => "$option_name-width",
'label_for' => "$option_name-width",
Expand All @@ -99,6 +156,7 @@ private function prepre_settings(): self {
'value' => $setup->get_width(),
'placeholder' => __( 'Popup width, in pixel', 'nss' ),
'attrs' => [ 'min' => '0' ],
'after' => __( 'px', 'nss' ),
]
);

Expand All @@ -107,7 +165,7 @@ private function prepre_settings(): self {
__( 'Popup Height', 'nss' ),
[ $this, 'render_input' ],
'nss',
'nss-general',
'nss-display',
[
'id' => "$option_name-height",
'label_for' => "$option_name-height",
Expand All @@ -116,6 +174,7 @@ private function prepre_settings(): self {
'value' => $setup->get_height(),
'placeholder' => __( 'Popup width, in pixel', 'nss' ),
'attrs' => [ 'min' => '0' ],
'after' => __( 'px', 'nss' ),
]
);

Expand All @@ -124,7 +183,7 @@ private function prepre_settings(): self {
__( 'Priority', 'nss' ),
[ $this, 'render_input' ],
'nss',
'nss-general',
'nss-display',
[
'id' => "$option_name-priority",
'label_for' => "$option_name-priority",
Expand All @@ -140,7 +199,7 @@ private function prepre_settings(): self {
__( 'Concatenation', 'nss' ),
[ $this, 'render_select' ],
'nss',
'nss-general',
'nss-display',
[
'id' => "$option_name-concat",
'label_for' => "$option_name-concat",
Expand All @@ -154,42 +213,6 @@ private function prepre_settings(): self {
]
);

// Section: Display ////////////////////////////////////////////////////////////////////////////////////////
add_settings_section(
'nss-display',
__( 'Display', 'nss' ),
'__return_empty_string',
'nss'
);

add_settings_field(
'nss-display-post-type',
__( 'Post Types', 'nss' ),
[ $this, 'render_post_types' ],
'nss',
'nss-display',
[
'name' => $option_name,
'value' => $setup->get_post_types(),
]
);

add_settings_field(
'nss-display-exclude',
__( 'Exclude', 'nss' ),
[ $this, 'render_textarea' ],
'nss',
'nss-display',
[
'id' => "$option_name-exclude",
'label_for' => "$option_name-exclude",
'name' => "{$option_name}[exclude]",
'value' => implode( "\r\n", $setup->get_exclude() ),
'attrs' => [ 'rows' => 3 ],
'description' => __( 'Social share buttons do not appear on posts in this list. Please enter post ID one by one row.', 'nss' ),
]
);

add_settings_field(
'nss-display-icon-set',
__( 'Icon Set', 'nss' ),
Expand Down Expand Up @@ -235,7 +258,7 @@ private function prepre_settings(): self {
'placeholder' => __( 'Kakao JavaScript API key.', 'nss' ),
'attrs' => [ 'autocomplete' => 'off' ],
'description' => sprintf(
/* translators: kakao developers URL. */
/* translators: kakao developers URL. */
__( 'Visit <a href="%1$s" target="_blank">Kakao developers</a> and get a JavaScript API key.', 'nss' ),
'https://developers.kakao.com/console/app'
)
Expand Down Expand Up @@ -340,6 +363,7 @@ public function render_input( array $args ) {
'placeholder' => '',
'attrs' => [],
'description' => '',
'after' => '',
]
);

Expand All @@ -354,6 +378,10 @@ public function render_input( array $args ) {
self::format_attrs( (array) $args['attrs'] )
);

if ( $args['after'] ) {
echo esc_html( $args['after'] );
}

self::render_description( $args['description'] );
}

Expand Down
Loading

0 comments on commit 646bde1

Please sign in to comment.