-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e1a3276
Showing
10 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/README.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
vendor/ | ||
composer.lock | ||
nbproject/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License | ||
|
||
Copyright (c) Amplilabs Ltd. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Share button element | ||
Element for Bear CMS |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
/* | ||
* Share button element addon for Bear CMS | ||
* https://github.com/bearcms/share-button-element-addon | ||
* Copyright (c) Amplilabs Ltd. | ||
* Free to use under the MIT license. | ||
*/ | ||
|
||
BearFramework\Addons::register('bearcms/share-button-element-addon', __DIR__, [ | ||
'require' => [ | ||
'bearcms/bearframework-addon' | ||
] | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"id": "bearcms/share-button-element-addon", | ||
"name": "Share button element", | ||
"description": "Enable support for share buttons in your website. Adding such elements to your website helps your visitors easily promote your content. A total share count (includes Facebook and LinkedIn) is available too.", | ||
"author": { | ||
"name": "Bear CMS", | ||
"email": "[email protected]", | ||
"url": "https://bearcms.com/" | ||
}, | ||
"media": [ | ||
{ | ||
"filename": "/assets/1.png", | ||
"width": 1890, | ||
"height": 1404 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
use BearFramework\App; | ||
|
||
$app = App::get(); | ||
$context = $app->context->get(__FILE__); | ||
|
||
$url = (string) $component->url; | ||
if ($url === 'home') { | ||
$url = $app->urls->get(); | ||
} elseif ($url === 'current') { | ||
$url = $app->urls->get($app->request->path); | ||
} | ||
echo '<component src="social-sharing-button" url="' . htmlentities($url) . '" class="bearcms-share-button-element"/>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "bearcms/share-button-element-addon", | ||
"description": "Share button element for Bear CMS", | ||
"keywords": ["share button", "element", "Bear CMS"], | ||
"homepage": "https://github.com/bearcms/share-button-element-addon", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Bear CMS", | ||
"email": "[email protected]", | ||
"homepage": "https://bearcms.com/" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.1", | ||
"bearcms/bearframework-addon": "^0.6.2", | ||
"ivopetkov/social-sharing-bearframework-addon": "0.1.*" | ||
}, | ||
"autoload": { | ||
"files": ["autoload.php"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/* | ||
* Share button element addon for Bear CMS | ||
* https://github.com/bearcms/share-button-element-addon | ||
* Copyright (c) Amplilabs Ltd. | ||
* Free to use under the MIT license. | ||
*/ | ||
|
||
use BearFramework\App; | ||
|
||
$app = App::get(); | ||
|
||
$app->bearCMS->addons | ||
->announce('bearcms/share-button-element-addon', function(\BearCMS\Addons\Addon $addon) use ($app) { | ||
$addon->initialize = function() use ($app) { | ||
$context = $app->context->get(__FILE__); | ||
|
||
$context->assets->addDir('assets'); | ||
|
||
\BearCMS\Internal\ElementsTypes::add('shareButton', [ | ||
'componentSrc' => 'bearcms-share-button-element', | ||
'componentFilename' => $context->dir . '/components/shareButtonElement.php', | ||
'fields' => [ | ||
[ | ||
'id' => 'url', | ||
'type' => 'textbox' | ||
] | ||
] | ||
]); | ||
|
||
\BearCMS\Internal\Themes::$elementsOptions['shareButton'] = function($context, $idPrefix, $parentSelector) { | ||
$group = $context->addGroup('Share button'); | ||
$group->addOption($idPrefix . "ShareButtonCSS", "css", '', [ | ||
"cssOutput" => [ | ||
["rule", $parentSelector . " .bearcms-share-button-element", "cursor:pointer;display:inline-block;"], | ||
["selector", $parentSelector . " .bearcms-share-button-element"] | ||
], | ||
"value" => '{"background-color":"#3374ce","border-top":"1px solid #3169c4","border-right":"1px solid #3169c4","border-bottom":"1px solid #3169c4","border-left":"1px solid #3169c4","font-size":"12px","font-family":"Arial","font-weight":"bold","height":"33px","line-height":"32px","padding-left":"10px","padding-right":"10px","color":"#ffffff","border-top-left-radius":"2px","border-top-right-radius":"2px","border-bottom-left-radius":"2px","border-bottom-right-radius":"2px"}' | ||
]); | ||
}; | ||
}; | ||
}); |