Plugin Directory

Changeset 2188087


Ignore:
Timestamp:
11/07/2019 10:57:58 PM (6 years ago)
Author:
kerkenit
Message:

Added new calendar page

Location:
promissa/trunk
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • promissa/trunk/functions.php

    r2136288 r2188087  
    11<?php
    2     if (!function_exists('WithinNextWeek')) {
     2    if (!function_exists('WithinNextWeek'))
     3    {
    34        function WithinNextWeek($val)
    45        {
     
    1112    }
    1213
    13     if (!function_exists('IsTomorrow')) {
     14    if (!function_exists('IsTomorrow'))
     15    {
    1416        function IsTomorrow($val)
    1517        {
     
    2325        }
    2426    }
    25     if (!function_exists('ProMissaREST')) {
     27    if (!function_exists('ProMissaREST'))
     28    {
    2629        function ProMissaREST($page, $filter = '')
    2730        {
    2831            $promissa = get_option('promissa');
    29             $url = 'https://api.promissa.nl/v1.0/records/' . $page . $filter;
     32            $url = 'https://api.promissa.nl/v1.1/records/' . $page . $filter;
    3033
    3134            $args = array(
     
    4245    }
    4346
    44     if (!function_exists('kei_post_val')) {
     47    if (!function_exists('kei_post_val'))
     48    {
    4549        function kei_post_val($val)
    4650        {
     
    5256    }
    5357
    54     if (!function_exists('callback')) {
    55         function callback($buffer){
     58    if (!function_exists('callback'))
     59    {
     60        function callback($buffer)
     61        {
    5662            return $buffer;
    5763        }
    5864    }
    5965
    60     if (!function_exists('add_ob_start')) {
    61         function add_ob_start(){
     66    if (!function_exists('add_ob_start'))
     67    {
     68        function add_ob_start()
     69        {
    6270            ob_start("callback");
    6371        }
    6472    }
    6573
    66     if (!function_exists('flush_ob_end')) {
    67         function flush_ob_end(){
     74    if (!function_exists('flush_ob_end'))
     75    {
     76        function flush_ob_end()
     77        {
    6878            ob_end_flush();
    6979        }
    7080    }
    7181
    72     if (!function_exists('getDayOfWeek')) {
    73         function getDayOfWeek($i) {
     82    if (!function_exists('is_guid'))
     83    {
     84        function is_guid($guid)
     85        {
     86            return !empty($guid) && strlen($guid) == 36 && preg_match('/^\{?[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}\}?$/', $guid);
     87        }
     88    }
     89
     90    if (!function_exists('jsDateTime'))
     91    {
     92        function jsDateTime($datetime)
     93        {
     94            $DateTime = new DateTime($datetime);
     95            return $DateTime->format('Y-m-d') . 'T' . $DateTime->format('H:i:s');
     96        }
     97    }
     98
     99    if (!function_exists('jsEndDateTime'))
     100    {
     101        function jsEndDateTime($datetime, $duration)
     102        {
     103            if(empty($duration))
     104            {
     105                $duration = 60;
     106            }
     107            $DateTime = new DateTime($datetime);
     108            $DateTime->add(new DateInterval('PT' . $duration . 'M'));
     109            return $DateTime->format('Y-m-d') . 'T' . $DateTime->format('H:i:s');
     110        }
     111    }
     112
     113    if (!function_exists('HexTextColor'))
     114    {
     115        function HexTextColor($class)
     116        {
     117            switch($class)
     118            {
     119                case 'white':
     120                    return '#000';
     121                case 'yellow':
     122                case 'gray':
     123                    return '#666';
     124                case 'black':
     125                    return '#ccc';
     126                default:
     127                    return '#fff';
     128            }
     129        }
     130    }
     131
     132    if (!function_exists('HexBorderColor'))
     133    {
     134        function HexBorderColor($class)
     135        {
     136            switch($class)
     137            {
     138                case 'green':
     139                    return '#29b765';
     140                case 'yellow':
     141                    return '#deb200';
     142                case 'orange':
     143                    return '#d67520';
     144                case 'red':
     145                    return '#cf4436';
     146                case 'white':
     147                case 'gray':
     148                    return '#dfe8f1';
     149                case 'black':
     150                    return '#000';
     151                case 'blue':
     152                case 'blue-alt':
     153                    return '#5388d1';
     154                case 'purple':
     155                    return '#7a3ecc';
     156                default:
     157                    return '#00b19b';
     158            }
     159        }
     160    }
     161
     162    if (!function_exists('HexBackgroundColor'))
     163    {
     164        function HexBackgroundColor($class)
     165        {
     166            switch($class)
     167            {
     168                case 'green':
     169                    return '#2ecc71';
     170                case 'yellow':
     171                    return '#fc0';
     172                case 'orange':
     173                    return '#e67e22';
     174                case 'red':
     175                    return '#e74c3c';
     176                case 'white':
     177                    return '#fff';
     178                case 'gray':
     179                    return '#efefef';
     180                case 'black':
     181                    return '#2d2d2d';
     182                case 'blue':
     183                case 'blue-alt':
     184                    return '#65a6ff';
     185                case 'purple':
     186                    return '#984dff';
     187                case 'primary':
     188                default:
     189                    return '#00bca4';
     190            }
     191        }
     192    }
     193
     194    if (!function_exists('Trim'))
     195    {
     196        function Trim($s, $max_length = 300)
     197        {
     198            if (strlen($s) > $max_length) :
     199                $offset = ($max_length - 3) - strlen($s);
     200                $s = substr($s, 0, strrpos($s, ' ', $offset)) . '...';
     201            endif;
     202            return $s;
     203        }
     204    }
     205
     206    if (!function_exists('getDayOfWeek'))
     207    {
     208        function getDayOfWeek($i)
     209        {
    74210            switch($i) {
    75211                case 1:
     
    93229    }
    94230
    95     if (!function_exists('getDayOfWeekPlural')) {
    96         function getDayOfWeekPlural($i) {
     231    if (!function_exists('getDayOfWeekPlural'))
     232    {
     233        function getDayOfWeekPlural($i)
     234        {
    97235            switch($i) {
    98236                case 1:
     
    116254    }
    117255
    118     if (!function_exists('getTimeOfDayOfWeek')) {
    119         function getTimeOfDayOfWeek($hour, $minutes) {
     256    if (!function_exists('getTimeOfDayOfWeek'))
     257    {
     258        function getTimeOfDayOfWeek($hour, $minutes)
     259        {
    120260            return sprintf('%02d:%02d', $hour, $minutes);
    121261        }
Note: See TracChangeset for help on using the changeset viewer.