Skip to content

Commit 498c3f0

Browse files
committed
Added admin for plugin
1 parent 73e6b0d commit 498c3f0

File tree

10 files changed

+230
-3
lines changed

10 files changed

+230
-3
lines changed

languages/d_vuefront-ru_RU.mo

2.42 KB
Binary file not shown.

languages/d_vuefront-ru_RU.po

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
msgid ""
2+
msgstr ""
3+
"Project-Id-Version: d_vuefront\n"
4+
"POT-Creation-Date: 2019-06-11 11:30+0300\n"
5+
"PO-Revision-Date: 2019-06-11 11:31+0300\n"
6+
"Last-Translator: \n"
7+
"Language-Team: \n"
8+
"Language: ru\n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"X-Generator: Poedit 2.2.3\n"
13+
"X-Poedit-Basepath: ..\n"
14+
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
15+
"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
16+
"X-Poedit-KeywordsList: __;_e\n"
17+
"X-Poedit-SearchPath-0: .\n"
18+
19+
#: plugin.php:19 plugin.php:57
20+
msgid "Settings"
21+
msgstr "Настройки"
22+
23+
#: plugin.php:37
24+
msgid "CMS Connect URL"
25+
msgstr "CMS Connect URL"
26+
27+
#: plugin.php:38
28+
msgid ""
29+
"This is your CMS Connect URL link that shares your Blog data via GraphQL. "
30+
"When installing VueFront via the command line, you will be prompted to enter "
31+
"this URL. Simply copy and paste it into the command line.\n"
32+
" <br><br>\n"
33+
" Read more about the <a href=\"https://vuefront.com/cms/wordpress.html\" "
34+
"target=\"_blank\">CMS Connect for Wordpress</a>"
35+
msgstr ""
36+
"Это URL-адрес вашей CMS Connect, который предоставляет доступ к данным "
37+
"вашего Блога через GraphQL. При установке VueFront через командную строку "
38+
"вам будет предложено ввести этот URL. Просто скопируйте и вставьте его в "
39+
"командную строку.\n"
40+
"     <br> <br>\n"
41+
"     Узнайте больше о <a href=\"https://vuefront.com/cms/wordpress.html\" "
42+
"target=\"_blank\"> CMS Connect для Wordpress </a>"
43+
44+
#: plugin.php:41
45+
msgid "WooCommerce"
46+
msgstr "WooCommerce"
47+
48+
#: plugin.php:42
49+
msgid "WooCommerce active"
50+
msgstr "WooCommerce активен"
51+
52+
#: plugin.php:43
53+
#, php-format
54+
msgid ""
55+
"VueFront relies on the free <a href=\"%s\" target=\"_blank\">WooCommerce</a> "
56+
"plugin to implement store. The store feature is optional and VueFront will "
57+
"work fine without it. You can install it via Wordpress."
58+
msgstr ""
59+
"VueFront использует бесплатный <a href=\"%s\"> WooCommerce </a> плагин для "
60+
"реализации магазина. Функция магазина является необязательной, и VueFront "
61+
"будет работать без нее. Вы можете установить его через Wordpress."
62+
63+
#: plugin.php:44
64+
msgid "WooCommerce missing. Click to download"
65+
msgstr "Плагин WooCommerce отсутствует. Нажмите, чтобы скачать"
66+
67+
#: plugin.php:45
68+
msgid "copy"
69+
msgstr "копировать"
70+
71+
#: plugin.php:46
72+
msgid "copied!"
73+
msgstr "скопировано!"
74+
75+
#~ msgid "Blog support"
76+
#~ msgstr "Поддержка блога"
77+
78+
#~ msgid "Blog enabled"
79+
#~ msgstr ""
80+
#~ "12/5000\n"
81+
#~ "Блог включен"

plugin.php

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
/**
3+
* Plugin Name: Vuefront
4+
* Plugin URI: https://github.com/vuefront/wordpress
5+
* Description: VueFront CMS Connect App for Wordpress.
6+
* Version: 1.0
7+
* Author: Dreamvention
8+
* Author URI: http://dreamvention.com
9+
*/
10+
11+
/**
12+
* Создаем страницу настроек плагина
13+
*/
14+
15+
add_action('admin_menu', 'add_plugin_page');
16+
function add_plugin_page()
17+
{
18+
$codename = 'd_vuefront';
19+
$page_hook_suffix= add_options_page( __('Settings', $codename).' Vuefront', 'Vuefront', 'manage_options', 'd_vuefront', 'vuefront_options_page_output');
20+
add_action('admin_print_scripts-' . $page_hook_suffix, 'my_plugin_admin_scripts');
21+
}
22+
23+
function my_plugin_admin_scripts() {
24+
wp_enqueue_style( 'vuefront-style', plugins_url('d_vuefront/view/stylesheet/admin.css') );
25+
wp_enqueue_style( 'bootstrap-style', 'https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' );
26+
wp_enqueue_script( 'bootstrap-script', 'https://code.jquery.com/jquery-3.4.1.min.js' );
27+
wp_enqueue_script( 'clipboard-script', 'https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js' );
28+
wp_enqueue_script( 'bootstrap-script', 'https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js' );
29+
}
30+
31+
function vuefront_options_page_output()
32+
{
33+
$codename = 'd_vuefront';
34+
35+
$data = array();
36+
$data['text_title'] = __('CMS Connect URL', $codename);
37+
$data['text_description'] = __('This is your CMS Connect URL link that shares your Blog data via GraphQL. When installing VueFront via the command line, you will be prompted to enter this URL. Simply copy and paste it into the command line.
38+
<br><br>
39+
Read more about the <a href="https://vuefront.com/cms/wordpress.html" target="_blank">CMS Connect for Wordpress</a>', $codename);
40+
$data['text_woocommerce_plugin'] = __('WooCommerce', $codename);
41+
$data['text_woocommerce_enabled'] = __('WooCommerce active', $codename);
42+
$data['text_woocommerce_description'] = sprintf(__('VueFront relies on the free <a href="%s" target="_blank">WooCommerce</a> plugin to implement store. The store feature is optional and VueFront will work fine without it. You can install it via Wordpress.', $codename), 'https://ru.wordpress.org/plugins/woocommerce/');
43+
$data['text_woocommerce_disabled'] = __('WooCommerce missing. Click to download', $codename);
44+
$data['text_copy'] = __('copy', $codename);
45+
$data['text_copied'] = __('copied!', $codename);
46+
$data['catalog'] = plugins_url('d_vuefront/index.php');
47+
$data['woocommerce'] = is_plugin_active( 'woocommerce/woocommerce.php' );
48+
$data['logo'] = plugins_url('d_vuefront/view/image/logo.png');
49+
extract($data);
50+
require_once 'view/template/setting.tpl';
51+
}
52+
53+
function my_plugin_action_links($links)
54+
{
55+
$links = array_merge(array(
56+
'<a href="' . esc_url(admin_url('options-general.php?page=d_vuefront')) . '">' . __('Settings') . '</a>'
57+
), $links);
58+
return $links;
59+
}
60+
add_action('plugin_action_links_' . plugin_basename(__FILE__), 'my_plugin_action_links');
61+
62+
add_action( 'plugins_loaded', 'true_load_plugin_textdomain' );
63+
64+
function true_load_plugin_textdomain() {
65+
load_plugin_textdomain( 'd_vuefront', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
66+
}

resolver/blog/post.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public function get($args) {
2020

2121
return array(
2222
'id' => $post->ID,
23+
'name' => $post->title,
2324
'title' => $post->title,
2425
'shortDescription' => $post->shortDescription,
2526
'description' => $post->description,

resolver/common/page.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public function get($args) {
1313
return array(
1414
'id' => $page_info->ID,
1515
'title' => $page_info->title,
16+
'name' => $page_info->title,
1617
'description' => $page_info->description,
1718
'sort_order' => (int)$page_info->sort_order,
1819
'keyword' => $keyword

resolver/store/currency.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public function get()
1010
$this->load->model('store/product');
1111
$currencies[] = array(
1212
'title' => get_option( 'woocommerce_currency' ),
13+
'name' => get_option( 'woocommerce_currency' ),
1314
'code' => get_option( 'woocommerce_currency' ),
1415
'symbol_left' => $this->model_store_product->getCurrencySymbol(),
1516
'symbol_right' => '',

schema.graphql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ type CategoryResult {
7676
}
7777

7878
type Currency {
79-
title: String
79+
title: String @deprecated(reason: "Changed to name!")
80+
name: String
8081
code: String
8182
symbol_left: String
8283
symbol_right: String
@@ -120,7 +121,8 @@ type OptionValue {
120121

121122
type Page {
122123
id: ID
123-
title: String
124+
title: String @deprecated(reason: "Changed to name!")
125+
name: String
124126
description: String
125127
keyword: String
126128
sort_order: Int
@@ -139,7 +141,8 @@ type PageResult {
139141

140142
type Post {
141143
id: ID
142-
title: String
144+
title: String @deprecated(reason: "Changed to name!")
145+
name: String
143146
shortDescription: String
144147
description: String
145148
image: String

view/image/logo.png

13.1 KB
Loading

view/stylesheet/admin.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.module-content{
2+
padding:60px 0px;
3+
}
4+
.module-content__form {
5+
max-width: 45%;
6+
margin: 0 auto;
7+
}
8+
.module-content__row{
9+
padding-top:30px;
10+
padding-bottom:30px;
11+
}
12+
.mb-1 {
13+
margin-bottom: 15px;
14+
}
15+
.mb-2 {
16+
margin-bottom: 25px;
17+
}
18+
@media(max-width: 767px) {
19+
.module-content__form {
20+
max-width: 100%;
21+
}
22+
}
23+
.module-content__description{
24+
font-size:12px;
25+
color:#777;
26+
text-align:center;
27+
line-height:20px;
28+
padding-top:20px;
29+
}
30+
.module-content__image img{
31+
width:200px;
32+
}

view/template/setting.tpl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<div class="module-content">
2+
<div class="text-center module-content__image">
3+
<img src="<?php echo $logo; ?>"/>
4+
</div>
5+
<div class="module-content__form">
6+
<div class="module-content__row">
7+
<h3 class="text-center mb-3"><?php echo $text_title; ?></h3>
8+
<div class="input-group mb-2">
9+
<input id="connect_url" class="form-control" type="text" value="<?php echo $catalog; ?>" readonly>
10+
<div class="input-group-append">
11+
<span class="btn btn-primary clipboard" data-clipboard-target="#connect_url"><?php echo $text_copy; ?></span>
12+
</div>
13+
</div>
14+
<p class="module-content__description"><?php echo $text_description; ?></p>
15+
</div>
16+
<hr/>
17+
<div class="module-content__row">
18+
<h3 class="text-center mb-3"><?php echo $text_woocommerce_plugin; ?></h3>
19+
<div class="text-center">
20+
<?php if($woocommerce) { ?>
21+
<span class="btn btn-success"><?php echo $text_woocommerce_enabled; ?></span>
22+
<p class="module-content__description"><?php echo $text_woocommerce_description; ?></p>
23+
<?php } else { ?>
24+
<a class="btn btn-danger" href="https://ru.wordpress.org/plugins/woocommerce/" target="_blank"><?php echo $text_woocommerce_disabled; ?></a>
25+
<p class="module-content__description"><?php echo $text_woocommerce_description; ?></p>
26+
<?php } ?>
27+
</div>
28+
</div>
29+
</div>
30+
</div>
31+
<script lang="text/javascript">
32+
$(document).ready(function() {
33+
var clipboard = new ClipboardJS('.clipboard')
34+
35+
clipboard.on('success', function(e) {
36+
$(e.trigger).text('<?php echo $text_copied; ?>')
37+
$(e.trigger).addClass('btn-success')
38+
39+
e.clearSelection()
40+
})
41+
})
42+
</script>

0 commit comments

Comments
 (0)