Browse Source

A new Licence

- Changed licence to BSD 3 Clause Clear
- Working on some fediverse content, accidentally on master.
master
dgold 3 years ago
parent
commit
4a491045cd
No known key found for this signature in database GPG Key ID: 6C960885EA9287AD
  1. 33
      LICENCE
  2. 4
      README.md
  3. 16
      configs.php
  4. 17
      helpers.php
  5. 26
      nanopub.php

33
LICENCE

@ -1,7 +1,32 @@
nanopub is licensed under Zero Clause BSD (0BSD):
The Clear BSD License
Copyright (C) 2017 by Daniel Goldsmith <dgold@ascraeus.org>
Copyright (c) 2017-2019 Daniel Goldsmith <dgold@ascraeus.org>
All rights reserved.
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the disclaimer
below) provided that the following conditions are met:
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

4
README.md

@ -54,7 +54,6 @@ TODO
----
* [ ] Make a `setup.php` script to complete the required configuration settings.
* [ ] Implement rsvp's, itineraries &c
* [ ] Trigger sitegen on succesful operation.
Author
---
@ -62,7 +61,7 @@ Author
Licences
--------
- **nanopub** is released under the [Zero Clause BSD Licence](https://opensource.org/licenses/FPL-1.0.0) (0BSD).
- **nanopub** is released under the [BSD 3-Clause Clear Licence](https://choosealicense.com/licenses/bsd-3-clause-clear/) (BSD-3-Clause-Clear).
Acknowledgments
---------------
@ -74,6 +73,7 @@ Changes
-------
Version | Date | Notes
-------:|:----:|:-----
2.0.1| 2019-01-04 | Changed licence to BSD 3-Clause Clear
2.0.0| 2018-08-09 | Removed support for syndication to twitter
1.5.1| 2018-04-12 | Clarified Installation & packaged vendor files
1.5 | 2018-02-01 | Added configurable frontmatter, currently json or yaml

16
configs.php

@ -1,5 +1,21 @@
<?php
/**
* nanopub - MicroPub support for Static Blog Engine
*
* PHP version 7
*
* @author Daniel Goldsmith <dgold@ascraeus.org>
* @copyright © 2017-2019 Daniel Goldsmith <dgold@ascraeus.org>
* @license BSD 3-Clause Clear Licence
* @link https://github.com/dg01d/nanopub
* @category Micropub
* @version 2.0.0
*
* SPDX-License-Identifier: BSD-3-Clause-Clear
*
*/
return (object) array(
// First some settings for the site
'siteUrl' => 'https://example.com/', // the URL for your site - note trailing slash

17
helpers.php

@ -1,5 +1,22 @@
<?php
/**
* nanopub - MicroPub support for Static Blog Engine
*
* PHP version 7
*
* @author Daniel Goldsmith <dgold@ascraeus.org>
* @copyright © 2017-2019 Daniel Goldsmith <dgold@ascraeus.org>
* @license BSD 3-Clause Clear Licence
* @link https://github.com/dg01d/nanopub
* @category Micropub
* @version 2.0.0
*
* SPDX-License-Identifier: BSD-3-Clause-Clear
*
*/
use GuzzleHttp\Client;
use Forecast\Forecast;

26
nanopub.php

@ -4,11 +4,15 @@
*
* PHP version 7
*
* @author Daniel Goldsmith <dgold@ascraeus.org>
* @license https://opensource.org/licenses/FPL-1.0.0 0BSD
* @link https://github.com/dg01d/nanopub
* @category Micropub
* @version 2.0.0
* @author Daniel Goldsmith <dgold@ascraeus.org>
* @copyright © 2017-2019 Daniel Goldsmith <dgold@ascraeus.org>
* @license BSD 3-Clause Clear Licence
* @link https://github.com/dg01d/nanopub
* @category Micropub
* @version 2.0.0
*
* SPDX-License-Identifier: BSD-3-Clause-Clear
*
*/
require 'vendor/autoload.php';
@ -612,7 +616,8 @@ if (!empty($data)) {
$frontmatter['summary'] = $props['summary']['0'] ?? null;
unset($props['summary']);
// server allows clients to set category, treats as tags
// server allows clients to set category, treats as tags
// Todo: need to link this to content/subject in Mastodon
$frontmatter['tags'] = $props['category'] ?? null;
unset($props['category']);
@ -678,6 +683,9 @@ if (!empty($data)) {
if (!empty($synds)) {
if (in_array("https://".$configs->mastodonInstance, $synds)) {
// this allows you to post to mastodon under a CW, using tags
$MastodonSubject = implode(", ", $frontmatter['tags']);
$MastodonText = str_replace("\'", "'", $synText);
$MastodonText = str_replace("\&quot;", "\"", $MastodonText);
$MastodonText = urlencode($MastodonText);
@ -685,9 +693,13 @@ if (!empty($data)) {
$mastodonToken = "bearer " . $configs->mastodonToken;
$mastodonUrl = "https://" . $configs->mastodonInstance . "/api/v1/statuses";
$mdata = array(
$postData = array(
"status" => $MastodonText,
"content-type" => "text/markdown",
"spoiler_text" => $MastodonSubject
);
// filters out an empty spoiler_text
$mdata = array_filter($postData);
// Calls the simple API from way back at the start
$result_mastodon = post_to_api($mastodonUrl, $mastodonToken, $mdata);
$array_mastodon = json_decode($result_mastodon, true);

Loading…
Cancel
Save