Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit b5a3f59

Browse files
Merge pull request #105 from technote-space/feature/#102
#102
2 parents 178aae3 + 8a02f4f commit b5a3f59

File tree

5 files changed

+73
-2
lines changed

5 files changed

+73
-2
lines changed

configs/filter.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@
8383
* @since 1.4.0
8484
*/
8585
'\Marker_Animation\Classes\Models\Custom_Post\Setting' => [
86-
'load-edit.php' => [
86+
/**
87+
* @since 1.7.1
88+
*/
89+
'${prefix}app_activated' => [
90+
'insert_presets',
91+
],
92+
'load-edit.php' => [
8793
'setup_assets',
8894
],
8995
],

configs/preset.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* @version 1.7.1
4+
* @author Technote
5+
* @since 1.7.1
6+
* @copyright Technote All Rights Reserved
7+
* @license http://www.opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2
8+
* @link https://technote.space/
9+
*/
10+
11+
if ( ! defined( 'MARKER_ANIMATION' ) ) {
12+
exit;
13+
}
14+
15+
return [
16+
17+
[
18+
'name' => 'Red',
19+
'color' => '#f69',
20+
'priority' => 50,
21+
],
22+
23+
[
24+
'name' => 'Green',
25+
'color' => '#6f6',
26+
'priority' => 50,
27+
],
28+
29+
[
30+
'name' => 'Blue',
31+
'color' => '#6cf',
32+
'priority' => 50,
33+
],
34+
35+
];

languages/marker-animation-ja.mo

75 Bytes
Binary file not shown.

languages/marker-animation-ja.po

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ msgid ""
22
msgstr ""
33
"Project-Id-Version: marker-animation\n"
44
"POT-Creation-Date: 2018-07-01 17:47+0900\n"
5-
"PO-Revision-Date: 2019-03-08 13:33+0900\n"
5+
"PO-Revision-Date: 2019-03-18 02:26+0900\n"
66
"Last-Translator: \n"
77
"Language-Team: \n"
88
"MIME-Version: 1.0\n"
@@ -150,3 +150,12 @@ msgstr "表示させる"
150150

151151
msgid "others"
152152
msgstr "その他"
153+
154+
msgid "Red"
155+
msgstr "赤"
156+
157+
msgid "Green"
158+
msgstr "緑"
159+
160+
msgid "Blue"
161+
msgstr "青"

src/classes/models/custom_post/setting.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,27 @@ class Setting implements \Marker_Animation\Interfaces\Models\Custom_Post, \WP_Fr
2727

2828
use \Marker_Animation\Traits\Models\Custom_Post, \WP_Framework_Upgrade\Traits\Upgrade;
2929

30+
/**
31+
* insert presets
32+
*/
33+
/** @noinspection PhpUnusedPrivateMethodInspection */
34+
private function insert_presets() {
35+
if ( $this->app->get_option( 'has_inserted_presets' ) ) {
36+
return;
37+
}
38+
$this->app->option->set( 'has_inserted_presets', true );
39+
40+
if ( ! $this->is_empty() ) {
41+
return;
42+
}
43+
44+
foreach ( $this->apply_filters( 'get_setting_presets', $this->app->get_config( 'preset' ) ) as $item ) {
45+
$item['post_title'] = $this->translate( $this->app->array->get( $item, 'name', '' ) );
46+
unset( $item['name'] );
47+
$this->insert( $item );
48+
}
49+
}
50+
3051
/**
3152
* setup assets
3253
*/

0 commit comments

Comments
 (0)