diff --git a/plugins/google-adsense/LICENSE b/plugins/google-adsense/LICENSE new file mode 100644 index 00000000..afbcc1f6 --- /dev/null +++ b/plugins/google-adsense/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Big_Cake + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/plugins/google-adsense/README.md b/plugins/google-adsense/README.md new file mode 100644 index 00000000..e614838f --- /dev/null +++ b/plugins/google-adsense/README.md @@ -0,0 +1,35 @@ +# google-adsense + +A plugin for Blessing Skin Server that can let you display Google Ads with Google AdSense in the website. + +## Usage + +Enable this plugin. + +Copy your client-id (ca-pub-xxxxxxxxxxxxxx) and save it in the settings of the plugin. + +## License + +MIT License + +Copyright ©️ Big_Cake, All Rights Reserved. + +[Google AdSense](https://www.google.com/adsense) is a registered trademark of Google LLC. + +# Google AdSense(谷歌广告) + +这个插件能让你在你的皮肤站内投放谷歌广告。 + +## 用法 + +启用该插件,并将你在 AdSense 页面获取的 client-id 填入配置页面。 + +保存,这时查看页面源代码,就可以看到谷歌广告的 script 标签了。 + +## 开源协议 + +MIT License + +Copyright ©️ Big_Cake, All Rights Reserved. + +[Google AdSense](https://www.google.com/adsense) 是 Google LLC 的注册商标。 diff --git a/plugins/google-adsense/bootstrap.php b/plugins/google-adsense/bootstrap.php new file mode 100644 index 00000000..4650315c --- /dev/null +++ b/plugins/google-adsense/bootstrap.php @@ -0,0 +1,13 @@ +listen(RenderingHeader::class, function ($event) { + $html = view('BigCake\googleadsense::snippet', [ + 'client_id' => option('client_id'), + ])->render(); + $event->addContent($html); + }); +}; diff --git a/plugins/google-adsense/lang/en/config.yml b/plugins/google-adsense/lang/en/config.yml new file mode 100644 index 00000000..6b0970be --- /dev/null +++ b/plugins/google-adsense/lang/en/config.yml @@ -0,0 +1 @@ +client_id: ID of the Google AdSense diff --git a/plugins/google-adsense/lang/en/general.yml b/plugins/google-adsense/lang/en/general.yml new file mode 100644 index 00000000..80af748a --- /dev/null +++ b/plugins/google-adsense/lang/en/general.yml @@ -0,0 +1 @@ +description: Insert your Google AdSense ID to the site. diff --git a/plugins/google-adsense/lang/zh_CN/config.yml b/plugins/google-adsense/lang/zh_CN/config.yml new file mode 100644 index 00000000..da2af23b --- /dev/null +++ b/plugins/google-adsense/lang/zh_CN/config.yml @@ -0,0 +1 @@ +client_id: Google Adsense ID(ca-pub-xxxxxxxxxx) diff --git a/plugins/google-adsense/lang/zh_CN/general.yml b/plugins/google-adsense/lang/zh_CN/general.yml new file mode 100644 index 00000000..8e9d0708 --- /dev/null +++ b/plugins/google-adsense/lang/zh_CN/general.yml @@ -0,0 +1 @@ +description: 为站点加入 Google Adsense 代码来投放广告。 diff --git a/plugins/google-adsense/package.json b/plugins/google-adsense/package.json new file mode 100644 index 00000000..42b5cf10 --- /dev/null +++ b/plugins/google-adsense/package.json @@ -0,0 +1,20 @@ +{ + "name": "google-adsense", + "title": "Google Adsense", + "version": "0.0.1", + "description": "BigCake\\googleadsense::general.description", + "author": "Big_Cake", + "url": "https://bigcake.cakemc.top/", + "namespace": "BigCake\\googleadsense", + "require": { + "blessing-skin-server": "^5|^6" + }, + "enchants": { + "config": "Configuration", + "icon": { + "fa": "google", + "faType": "fab", + "bg": "success" + } + } +} diff --git a/plugins/google-adsense/src/Configuration.php b/plugins/google-adsense/src/Configuration.php new file mode 100644 index 00000000..e15917ea --- /dev/null +++ b/plugins/google-adsense/src/Configuration.php @@ -0,0 +1,18 @@ +text('client_id', trans('BigCake\googleadsense::config.client_id')); + })->handle(); + + return view('BigCake\googleadsense::config', ['form' => $form]); + } +} diff --git a/plugins/google-adsense/views/config.twig b/plugins/google-adsense/views/config.twig new file mode 100644 index 00000000..69dd0d4d --- /dev/null +++ b/plugins/google-adsense/views/config.twig @@ -0,0 +1,11 @@ +{% extends 'admin.base' %} + +{% block title %}Google Adsense{% endblock %} + +{% block content %} +