-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
64 lines (47 loc) · 2.02 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
use Claudye\Socialsharer\Sharer;
require __DIR__.'/vendor/autoload.php';
$title = 'Social Sharer';
$description = 'PHP package for generating social share links';
$image = 'screenshot.png';
$metabuilder = Sharer::url('hello-world.php');
/**
* Instanciate meta tags
*/
$metabuilder->title($title); // Create <meta name="og:title" content="The title content">
$metabuilder->description($description); // Create <meta name="og:description" content="The description content">
$metabuilder->image($image); // // Create <meta name="og:image" content="the-image-scr.extension">
$metabuilder->meta('og:type', "Website"); // Create <meta name="og:type" content="Website">
//Create meta tags and return them for display in the site header
//(optional) but highly recommended if tag tags were not shared
$headerMeta = Sharer::createMeta();
//Importe nos scripts
$sharerScripts = Sharer::scripts();
# Create a share button for sms, facebook etc sharing channels natively
$all = Sharer::all('<i fa fa-share></i> Share');
$all->addAttribute('class','btn btn-primary'); //Add classes to customize the button via css or js
// Create the share button for whatsapp
$whatsapp = Sharer::whatsapp('Whatsapp');
$whatsapp->addAttribute('class','btn whatsapp-btn');
$facebook = Sharer::facebook();
$facebook->addContent('Share onfacebook');
$facebook->addAttribute('class','btn btn-primary');
?>
<!doctype html>
<html lang="fr">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php echo $headerMeta ?>
<title>Socia sharer</title>
</head>
<body>
<?php echo $all->share() ?>
<?php echo $whatsapp->share() ?>
<?php echo $facebook->share() ?>
<?php echo $sharerScripts ?>
</body>
</html>