
內容簡介
使用 Cloudinary URL2PNG 外掛捕捉任何網站的快照。
使用方法
通過使用 [cloud2png] 短碼添加網站連結以創建快照,例如:
[cloud2png url="https://wordpress.org"]
自定義快照
使用 Cloud2PNG 自訂工具,可以更改快照的大小和邊框。
短碼參數
你可以使用這些短碼參數覆蓋 Cloud2PNG 自訂工具(包括預設值):
url=home_url('/')
width=430
height=225
border_width=0
border_radius=0
border_color=#000000
[cloud2png url="https://wordpress.org" width="300" height="400" border_width="5"]
在主題中添加 Cloud2PNG
使用 do_shortcode(),可以將 Cloud2PNG 添加到主題中:
echo do_shortcode( 'url="https://wordpress.org" width="300" height="400" border_width="5' );
或使用 shortcode_atts_{$shortcode} 過濾器:
add_filter ('shortcode_atts_cloud2png', 'add_url', 10, 3);
function add_url ($out, $pairs, $atts ) {
$out['url'] = 'https://soderlind.no';
return $out;
}
附註
我編寫插件是為了娛樂和學習。我盡力使用 OOP 實現了這個插件。可能存在一些耦合不是很松散和不是很乾燥的問題。我會在學到更多知識時更新插件並修復問題。
我遵循 WordPress 編程標準,但有一個例外,我使用PSR-4 自動加載器,並已禁用以下規則:
<rule ref="WordPress-Core">
<exclude name="Generic.Files.LowercasedFilename" />
<exclude name="WordPress.Files.FileName" />
<exclude name="WordPress.Files.FileName.UnderscoresNotAllowed" />
</rule>
鳴謝
Cloud2PNG 使用:
Plugin Customizer 程序框架。
WordPress 自訂工具 Range Value 控制器。
Cloudinary PHP 擴展
PSR-4 自動加載器
jQuery boxShadow cssHooks,版權所有(c)2010 Burin Asavesna (http://helloburin.com)
使用 CSS box-shadow 創建 更好的圓角邊框
版權和許可證
Cloud2PNG 版權所有 2017 Per Soderlind
Cloud2PNG 是自由軟體:你可以重新發佈和/或修改它根據 GNU 通用公共許可條款的條件,這些條件在大多數 Linux 發行版中都包含在其中。
外掛標籤
開發者團隊
原文外掛簡介
Capture snapshots of any website using the Cloudinary URL2PNG add-on.
Use
Add link to the site you’d like to create a snapshot of, by using the [cloud2png] shortcode, eg:
[cloud2png url="https://wordpress.org"]
Customize the snapshots
Using the Cloud2PNG Customizer you can change the size and border of the snapshots.
Shortcode parameters
You can override the Cloud2PNG Customizer using the shortcode parameters, they are (with defaults):
url=home_url( ‘/’ )
width=430
height=225
border_width=0
border_radius=0
border_color=#000000
[cloud2png url=”https://wordpress.org” width=”300″ height=”400″ border_width=”5″]
Adding Cloud2PNG to a theme
Using do_shortcode(), you can add Cloud2PNG to a theme:
echo do_shortcode( 'url="https://wordpress.org" width="300" height="400" border_width="5' );
or using the shortcode_atts_{$shortcode} filter:
add_filter ('shortcode_atts_cloud2png', 'add_url', 10, 3);
function add_url ($out, $pairs, $atts ) {
$out['url'] = 'https://soderlind.no';
return $out;
}
Sidenote
I code for fun, and I code to learn. I’ve tried to do this plugin using OOP at my best effort. There will be couplings that could be looser and not everything is DRY. I will update the plugin as I learn more and I will fix issues that are reported.
I’m following the WordPress Coding Standards with one exception, I’m using the PSR-4 autoloader and I’ve disabled the following rules:
Credits
Cloud2PNG is using:
The Plugin Customizer framework.
The WordPress Customizer Range Value Control.
The PHP extension for Cloudinary
The PSR-4 Autoloader
The jQuery boxShadow cssHooks, Copyright (c) 2010 Burin Asavesna (http://helloburin.com)
I use CSS box-shadow to create Better Rounded Borders
Copyright and License
Cloud2PNG is copyright 2017 Per Soderlind
Cloud2PNG is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
Cloud2PNG is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Extension. If not, see http://www.gnu.org/licenses/.
