Plugin Directory

Changeset 2164856


Ignore:
Timestamp:
09/28/2019 12:22:11 PM (6 years ago)
Author:
maxmelzer
Message:

Version 1.2.0: Add Quran toggle, prepare for new API format

Location:
devotionalium/trunk
Files:
6 added
12 edited

Legend:

Unmodified
Added
Removed
  • devotionalium/trunk/devotionalium.php

    r2080189 r2164856  
    33Plugin Name:  Devotionalium
    44Plugin URI:   https://devotionalium.com/wordpress/
    5 Description:  Include today's bible verses from devotionalium.com, with rich support for original languages.
    6 Version:      1.1.0
     5Description:  Include today's verses from devotionalium.com, with rich support for original languages.
     6Version:      1.2.0
    77Author:       Max Melzer
    88Author URI:   http://moehrenzahn.de/en/about
  • devotionalium/trunk/readme.txt

    r2080189 r2164856  
    1 === Devotionalium for Wordpress ===
     1=== Devotionalium Daily Verses for Wordpress ===
    22Contributors: maxmelzer
    3 Tags: bible, devotion, watchword, losung, theology
     3Tags: bible, quran, torah, devotion, watchword, losung, theology
    44Requires at least: 4.9
    55Tested up to: 5.1.1
     
    1111License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1212
    13 Include today's bible verses from devotionalium.com, with rich support for original languages.
     13Include today's verses from devotionalium.com, with rich support for original languages.
    1414
    1515== Description ==
    1616
    17 Devotionalium for Wordpress is a plugin that utilises the [Devotionalium.com](https://devotionalium.com/api/docs) API to display today's featured bible verses from [Devotionalium.com](https://devotionalium.com) on your Wordpress page.
     17Devotionalium Daily Verses for Wordpress is a plugin that uses the [Devotionalium.com](https://devotionalium.com/api/docs) API to display today's featured verses from [Devotionalium.com](https://devotionalium.com) on your Wordpress page.
    1818
    1919You can use it as
     
    3737= What is Devotionalium? =
    3838
    39 Devotionalium is a free service for reading daily verses from the bible. Check out devotionalium.com for more.
     39Devotionalium is a free service for reading daily verses from the Torah, the New Testament, and the Quran. Check out devotionalium.com for more.
    4040
    4141== Screenshots ==
     
    4545
    4646== Changelog ==
     47= 1.2.0 =
     48* Add setting to toggle Quran display
     49* Fixes and updates for new API format
    4750= 1.1.0 =
    4851* Add ability to choose an API endpoint url
  • devotionalium/trunk/src/ConfigAccessor.php

    r2080189 r2164856  
    2727    const KEY_ENDPOINT_URL = self::CONFIG_PREFIX.'endpointUrl';
    2828
     29    const KEY_SHOW_QURAN = self::CONFIG_PREFIX.'showQuran';
     30
    2931    const DEFAULTS = [
    3032        self::KEY_IS_ORIGINAL_LANGUAGE => false,
     
    3234        self::KEY_DAY_OFFSET => 0,
    3335        self::KEY_CUSTOM_CSS => '.devotionalium {}',
    34         self::KEY_ENDPOINT_URL => Communicator::DEFAULT_API_URL
     36        self::KEY_ENDPOINT_URL => Communicator::DEFAULT_API_URL,
     37        self::KEY_SHOW_QURAN => false,
    3538    ];
    3639
     
    8992    {
    9093        return $this->getConfigValue(self::KEY_ENDPOINT_URL);
     94    }
     95
     96    /**
     97     * @return bool
     98     */
     99    public function isShowQuran()
     100    {
     101        return (bool)$this->getConfigValue(self::KEY_SHOW_QURAN);
    91102    }
    92103
  • devotionalium/trunk/src/Devotionalium/Devotionalium.php

    r2080189 r2164856  
    9494            $this->config->getVersion(),
    9595            $this->config->getLanguage(),
    96             $date
     96            $date,
     97            $this->config->isShowQuran()
    9798        );
    9899        $this->setDate($devotionalium->getDate());
  • devotionalium/trunk/src/Model/Api/Communicator.php

    r2080189 r2164856  
    5050     * @param string[] $parameters
    5151     * @param string $action
    52      * @return string[]
     52     * @return mixed[]
    5353     * @throws \Exception
    5454     */
  • devotionalium/trunk/src/Model/Api/DevotionaliumApi.php

    r2080189 r2164856  
    3737     * @param string $language
    3838     * @param string $date
     39     * @param bool $showQuran
    3940     * @return Devotionalium
    4041     */
     
    4243        $version,
    4344        $language,
    44         $date
     45        $date,
     46        $showQuran
    4547    ) {
    4648        $index = implode(
     
    4951        );
    5052        if ($cached = $this->transient->load($index)) {
    51             return $cached;
     53            //return $cached;
    5254        }
    5355
     
    6062        $verses = [];
    6163        foreach ($response as $key => $item) {
    62             if (isset($item['text'])) {
    63                 $verses[] = new Verse(
    64                     $item['biblePart'],
    65                     $item['book'],
    66                     $item['bookNumber'],
    67                     $item['chapter'],
    68                     $item['text'],
    69                     $item['textOriginal'],
    70                     $item['verses'],
    71                     $item['version']['name'],
    72                     $item['reference'],
    73                     $item['readingUrl']
    74                 );
     64            if (!isset($item['text'])) {
     65                continue;
    7566            }
     67            if (isset($item['collection'])) {
     68                $collection = $item['collection'];
     69            } elseif (isset($item['biblePart'])) {
     70                $collection = $item['biblePart'];
     71            } else {
     72                $collection = null;
     73            }
     74            if (!$showQuran && $collection === 2) {
     75                continue;
     76            }
     77
     78            $verses[] = new Verse(
     79                $collection,
     80                $item['book'],
     81                $item['bookNumber'],
     82                $item['chapter'],
     83                $item['text'],
     84                $item['textOriginal'],
     85                $item['verses'],
     86                $item['version']['name'],
     87                $item['reference'],
     88                $item['readingUrl']
     89            );
    7690        }
    7791        $date = \DateTime::createFromFormat('Y-m-d', $response['date']);
  • devotionalium/trunk/src/Model/Api/Verse.php

    r1816706 r2164856  
    66{
    77    /**
    8      * @var int (0|1)
     8     * @var int (0|1|2)
    99     */
    10     private $biblePart;
     10    private $collection;
    1111
    1212    /**
     
    5858     * Verse constructor.
    5959     *
    60      * @param $biblePart
    61      * @param $book
    62      * @param $bookNumber
    63      * @param $chapter
    64      * @param $text
    65      * @param $textOriginal
    66      * @param array $verses
    67      * @param $versionName
    68      * @param $reference
    69      * @param $readingUrl
     60     * @param int $collection
     61     * @param string $book
     62     * @param int $bookNumber
     63     * @param int $chapter
     64     * @param string $text
     65     * @param string $textOriginal
     66     * @param string[] $verses
     67     * @param string $versionName
     68     * @param string $reference
     69     * @param string $readingUrl
    7070     */
    7171    public function __construct(
    72         $biblePart,
     72        $collection,
    7373        $book,
    7474        $bookNumber,
     
    8181        $readingUrl
    8282    ) {
    83         $this->biblePart = $biblePart;
     83        $this->collection = $collection;
    8484        $this->book = $book;
    8585        $this->bookNumber = $bookNumber;
     
    9696     * @return int
    9797     */
    98     public function getBiblePart()
     98    public function getCollection()
    9999    {
    100         return $this->biblePart;
     100        return $this->collection;
    101101    }
    102102
  • devotionalium/trunk/src/Model/Widget.php

    r1857973 r2164856  
    3434        parent::__construct(
    3535            'devotionalium',
    36             'Devotionalium',
    37             ['description' => __('Displays daily bible verses from devotionalium.com', Plugin::WP_TEXTDOMAIN)]
     36            'Devotionalium Daily Verses',
     37            ['description' => __(
     38                'Displays daily verses from the Torah, the New Testament, and the Quran from devotionalium.com',
     39                Plugin::WP_TEXTDOMAIN
     40            )]
    3841        );
    3942    }
  • devotionalium/trunk/src/Plugin.php

    r2080189 r2164856  
    8282                ConfigAccessor::KEY_IS_ORIGINAL_LANGUAGE,
    8383                __('Original languages', Plugin::WP_TEXTDOMAIN),
    84                 __('Display bible verses in original languages greek and hebrew as well.', Plugin::WP_TEXTDOMAIN),
     84                __('Display verses from the Torah, the New Testament, and the Quran in original languages greek, hebrew, and arabic as well.', Plugin::WP_TEXTDOMAIN),
     85                new \Devotionalium\Block\Setting('/View/config/setting/boolean.phtml')
     86            ),
     87            new Setting(
     88                ConfigAccessor::KEY_SHOW_QURAN,
     89                __('Display Quran verse', Plugin::WP_TEXTDOMAIN),
     90                __('Display verses from the Quran.', Plugin::WP_TEXTDOMAIN),
    8591                new \Devotionalium\Block\Setting('/View/config/setting/boolean.phtml')
    8692            ),
     
    8894                ConfigAccessor::KEY_VERSION,
    8995                __('Bible Version', Plugin::WP_TEXTDOMAIN),
    90                 __('Choose a bible version to display the bible verses in.', Plugin::WP_TEXTDOMAIN),
     96                __('Choose a bible version to display Torah and New Testament verses in.', Plugin::WP_TEXTDOMAIN),
    9197                $versionsArray,
    9298                new \Devotionalium\Block\Setting('/View/config/setting/select.phtml')
     
    95101                ConfigAccessor::KEY_OUTGOING_LINKS,
    96102                __('Outgoing links', Plugin::WP_TEXTDOMAIN),
    97                 __('Include hyperlinks to the full readings on devotionalium.com (recommended).', Plugin::WP_TEXTDOMAIN),
     103                __(
     104                    'Include hyperlinks to the full readings on devotionalium.com (recommended).',
     105                    Plugin::WP_TEXTDOMAIN
     106                ),
    98107                new \Devotionalium\Block\Setting('/View/config/setting/boolean.phtml')
    99108            ),
     
    103112                ConfigAccessor::KEY_ENDPOINT_URL,
    104113                __('Endpoint URL', Plugin::WP_TEXTDOMAIN),
    105                 __('Choose the API endpoint URL to request Devotionalium from. Default: "https://devotionalium.com/api"', Plugin::WP_TEXTDOMAIN),
     114                __(
     115                    'Choose the API endpoint URL to use. Default: "https://devotionalium.com/api"',
     116                   Plugin::WP_TEXTDOMAIN
     117                ),
    106118                new \Devotionalium\Block\Setting('/View/config/setting/text-wide.phtml')
    107119            ),
  • devotionalium/trunk/src/View/devotionalium-widget.phtml

    r1875729 r2164856  
    99<div class="devotionalium">
    1010    <?php foreach ($block->getDevotionalium()->getVerses() as $verse) : ?>
    11         <div class='<?php echo $verse->getBiblePart() === 0 ? 'ot' : 'nt' ?>'>
     11        <?php if ($verse->getCollection() === 0) {
     12            $collection = 'ot';
     13            $language = 'hebrew';
     14            $dir = 'rtl';
     15        } elseif ($verse->getCollection() === 1) {
     16            $collection = 'nt';
     17            $language = 'greek';
     18            $dir = 'ltr';
     19        } elseif ($verse->getCollection() === 2) {
     20            $collection = 'quran';
     21            $language = 'arabic';
     22            $dir = 'rtl';
     23        } ?>
     24        <div class='<?php echo $collection ?>'>
    1225            <?php if ($block->showOriginalLanguages()) : ?>
    13                 <p class="versetext original <?php echo $verse->getBiblePart() == 0 ? 'hebrew' : 'greek'; ?>"
    14                     <?php echo $verse->getBiblePart() === 0 ? 'dir="rtl"' : ''; ?>>
     26                <p class="versetext original <?php echo $language; ?>"
     27                   dir="<?php echo $dir; ?>">
    1528                    <?php echo $verse->getTextOriginal(); ?>
    1629                </p>
     
    1932                <?php echo $verse->getText(); ?>
    2033            </p>
    21             <div class="reference-link-container">
     34            <p class="reference-link-container">
    2235                <?php if ($block->useLinks()) : ?>
    2336                    <a class='reference-link'
     
    2538                        <?php echo $verse->getReferenceString(); ?></a>
    2639                <?php else : ?>
    27                     <p class='reference-link'><?php echo $verse->getReferenceString(); ?></p>
     40                    <span class='reference-link'><?php echo $verse->getReferenceString(); ?></span>
    2841                <?php endif; ?>
    29             </div>
     42            </p>
    3043        </div>
    3144    <?php endforeach; ?>
  • devotionalium/trunk/src/View/devotionalium.phtml

    r1875729 r2164856  
    88    </h2>
    99    <?php foreach ($block->getDevotionalium()->getVerses() as $verse) : ?>
    10         <div class='<?php echo $verse->getBiblePart() === 0 ? 'ot' : 'nt' ?>'>
     10        <?php if ($verse->getCollection() === 0) {
     11            $collection = 'ot';
     12            $language = 'hebrew';
     13            $dir = 'rtl';
     14        } elseif ($verse->getCollection() === 1) {
     15            $collection = 'nt';
     16            $language = 'greek';
     17            $dir = 'ltr';
     18        } elseif ($verse->getCollection() === 2) {
     19            $collection = 'quran';
     20            $language = 'arabic';
     21            $dir = 'rtl';
     22        } ?>
     23        <div class='<?php echo $collection ?>'>
    1124            <?php if ($block->showOriginalLanguages()) : ?>
    12                 <p class="versetext original <?php echo $verse->getBiblePart() == 0 ? 'hebrew' : 'greek'; ?>"
    13                     <?php echo $verse->getBiblePart() === 0 ? 'dir="rtl"' : ''; ?>>
     25                <p class="versetext original <?php echo $language; ?>"
     26                   dir="<?php echo $dir; ?>">
    1427                    <?php echo $verse->getTextOriginal(); ?>
    1528                </p>
     
    1831                <?php echo $verse->getText(); ?>
    1932            </p>
    20             <div class="reference-link-container">
     33            <p class="reference-link-container">
    2134                <?php if ($block->useLinks()) : ?>
    2235                    <a class='reference-link'
     
    2437                        <?php echo $verse->getReferenceString(); ?></a>
    2538                <?php else : ?>
    26                     <p class='reference-link'><?php echo $verse->getReferenceString(); ?></p>
     39                    <span class='reference-link'><?php echo $verse->getReferenceString(); ?></span>
    2740                <?php endif; ?>
    28             </div>
     41            </p>
    2942        </div>
    3043    <?php endforeach; ?>
  • devotionalium/trunk/src/css/devotionalium.css

    r1857973 r2164856  
    1 .devotionalium h2.title {
    2 
    3 }
    41.devotionalium .versetext
    52{
     
    1411  text-align: right;
    1512}
    16 .devotionalium .versetext.hebrew {
     13.devotionalium .versetext.hebrew, .devotionalium .versetext.arabic {
    1714  font-family: 'Times New Roman', Times, serif;
    1815  font-size: 150%;
     16}
     17.devotionalium .versetext.hebrew {
    1918  line-height: 1.2;
    2019}
Note: See TracChangeset for help on using the changeset viewer.