itinerisltd/socialus

为您的WordPress主题提供的直接简洁的社会分享链接

0.1.0 2021-06-10 09:25 UTC

This package is auto-updated.

Last update: 2024-09-10 17:14:26 UTC


README

Packagist Version PHP from Packagist Packagist Downloads GitHub License Hire Itineris

目标

Socialus让将页面分享到社交网络变得无比简单。

安装

传统WordPress主题

使用Composer将此包引入您的主题中

$ composer require itinerisltd/socialus

渲染输出!

<?php
$socialus = new \Itineris\Socialus\Socialus();
echo $socialus->render();

Sage

将包引入Sage中

$ composer require itineris/socialus -o

将其添加到控制器中

# sage/app/Controllers/App.php
<?php
namespace App\Controllers;

use Sober\Controller\Controller;
use Itineris\Socialus\Socialus;

class App extends Controller
{
    public function socialus()
    {
        return new Socialus();
    }
}

最后,将输出渲染到您的Blade模板中

{!! $socialus->render() !!}

用法

删除站点

<?php
$socialus = new Socialus();
$socialus->removeSite('facebook');

添加站点

<?php
$socialus = new Socialus();
$data = [
    'link' => 'https://reddit.com/submit',
    'params' => [ // these are to tell Socialus how to share
        'url' => 'url',
        'title' => 'title',
    ],
    'label' => 'Reddit',
    'icon' => 'fa fa-reddit',
    'image' => '', // optional if icon is set
];
$socialus->addSite('reddit', $data);

更改元素和类

$socialus = new Socialus([
    'container_element' => 'div',
    'container_class' => 'socials',
    'item_element' => 'span',
    'item_class' => 'social-item',
    'link_class' => 'social-item-link',
]);

使用图标或图像

$socialus = new Socialus([
    'type' => 'icon',
    'screen_reader_class' => 'screen-reader',
]);
$socialus_2 = new Socialus([
    'type' => 'image',
]);

常见问题解答

您会添加对旧版PHP版本的支持吗?

永远不要!此插件仅在积极支持的PHP版本上工作。

不要在已停用或仅提供安全更新的PHP版本上使用它。

看起来很棒。在哪里可以找到更多类似的宝贝?

这不在wp.org上。我可以在哪里给⭐️⭐️⭐️⭐️⭐️评论?

谢谢!很高兴你喜欢它。让我的老板知道有人在用这个项目很重要。与其在wp.org上评论,考虑

反馈

请提供反馈!我们希望尽可能多地将此库用于各种项目。请提交一个问题并指出你喜欢和不喜欢什么,或者fork项目并提出建议。没有问题太小。

变更日志

有关最近更改的更多信息,请参阅CHANGELOG

安全

如果您发现任何与安全相关的问题,请通过电子邮件hello@itineris.co.uk而不是使用问题跟踪器。

致谢

Socialus是由Itineris Limited创建的Lee Hanbury-Pickett的项目。

贡献者完整列表可以在这里找到。

许可证

Socialus 采用 MIT 许可证。请参阅 许可文件 获取更多信息。