Plugin Directory

Changeset 1968512


Ignore:
Timestamp:
11/04/2018 12:17:40 PM (7 years ago)
Author:
Levdbas
Message:

1.5.2

  • order activities on data at saving.
  • removed time transform function
  • removed public side of plugin for a smaller package
  • update to notices and errors if thrown.
Location:
support-hours
Files:
42 added
3 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • support-hours/trunk/README.txt

    r1964531 r1968512  
    44Requires at least: 3.0.1
    55Tested up to: 5.0
    6 Stable tag: 1.5.1
     6Stable tag: 1.5.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4747
    4848== Changelog ==
     49
     50= 1.5.2 =
     51
     52* order activities on data at saving.
     53* removed time transform function
     54* removed public side of plugin for a smaller package
     55* update to notices and errors if thrown.
    4956
    5057= 1.5.1 =
  • support-hours/trunk/admin/class-support-hours-admin.php

    r1960674 r1968512  
    159159    public function display_plugin_page() {
    160160        include_once( 'support-hours-admin-functions.php' );
    161         echo transform_fixed_time($static_time, $workFields, $name, $options);
    162161        include_once( 'support-hours-admin-overview.php' );
    163162    }
     
    168167    public function validate($input) {
    169168        $valid = array();
    170         if ($input['bought_hours'] == null) {
    171             $input['bought_hours'] = '00:00';
     169
     170
     171        $valid['email'] = sanitize_email($input['email']);
     172
     173        if(isset($input['users'])):
     174            $valid['users'] = $input['users'];
     175        else:
     176            $valid['users'] = array();
     177        endif;
     178
     179        if(!isset($input['workFields']) || $input['workFields'] == null){
     180            $input['workFields'] = null;
     181        } else{
     182            function date_compare($a, $b)
     183            {
     184                $t1 = strtotime($a['date']);
     185                $t2 = strtotime($b['date']);
     186                return $t1 - $t2;
     187            }
     188            usort($input['workFields'], 'date_compare');
    172189        }
    173         if($input['workFields'] == null){
    174             $input['workFields'] = null;
    175         }
    176         $valid['bought_hours'] = sanitize_text_field($input['bought_hours']);
    177         $valid['email'] = sanitize_email($input['email']);
    178         $valid['users'] = $input['users'];
     190
    179191        $valid['workFields'] = $input['workFields'];
    180192        return $valid;
  • support-hours/trunk/admin/partials/settings/work-table-form.php

    r1960674 r1968512  
    2929    </tbody>
    3030  </table>
     31  <p><em><?php _e('Activities will be sorted by date on save', $name); ?>.</em></p>
    3132  <a href="#" class="repeat button button-secondary">
    3233    <?php _e('Add activity', $name); ?>
  • support-hours/trunk/admin/support-hours-admin-functions.php

    r1960674 r1968512  
    55$users = $options['users'];
    66$email = $options['email'];
    7 $static_time = $options['bought_hours'];
     7//$static_time = $options['bought_hours'];
    88$current_color = get_user_option( 'admin_color' );
    99$workFields = $options['workFields'];
     
    1212$bought_minutes = AddTime($workFields, 'time-added', 'minutes');
    1313
     14/*
    1415// NOTE: temp function to transform first set of hours to new hour system.
    1516function transform_fixed_time($static_time, $workFields, $name, $options){
     
    2324    );
    2425    array_unshift($options['workFields'], $newdata);
    25     $options = array_diff_key($options, ['bought_hours' => "xy"]);
     26    //$options = array_diff_key($options, ['bought_hours' => "xy"]);
    2627
    2728    $options['workFields'] = array_map(function($arr){
     
    3334}
    3435echo transform_fixed_time($static_time, $workFields, $name, $options);
     36*/
    3537
    3638function minutestoTime($minutes){
  • support-hours/trunk/admin/support-hours-admin-overview.php

    r1960674 r1968512  
    1818  </p>
    1919  <?php
    20   if(!empty($users) && (!empty($bought_minutes) || $bought_minutes == '0' ) && !empty($email)):
     20  if(!empty($users) && $bought_minutes !== '0' && !empty($email)):
    2121    $user_ID = get_current_user_id();
    2222    $i = 0;
     
    2929
    3030    elseif(empty($users) || empty($email)):
     31      include_once( 'partials/common/notice-configure.php' );
    3132
    32       include_once( 'partials/common/configure-plugin-notice.php' );
     33    else:
     34      include_once( 'partials/common/notice-no-hours.php' );
    3335
    34     endif; ?>
    35 
     36    endif;
     37?>
    3638  </div>
  • support-hours/trunk/admin/support-hours-admin-widget.php

    r1960674 r1968512  
    1515$i = 0;
    1616global $pagenow;
    17 if(!empty($users) && !empty($email)):
     17if(!empty($users) && !empty($email) && !empty($workFields[0]['date'])):
    1818
    1919  include_once( 'partials/widgets/widget-clock.php' );
    20 
    21   if ( !empty($workFields[0]['date']) ) :
    22 
    23     include_once( 'partials/common/worktable.php' );
    24 
    25   endif;
    26 
     20  include_once( 'partials/common/worktable.php' );
    2721  include_once( 'partials/common/bottom-message.php' );
    2822
    29   elseif(empty($users) || empty($email) || $bought_minutes == '0'):
     23elseif(empty($users) || empty($email)):
    3024
    31     include_once( 'partials/common/configure-plugin-notice.php' );
     25  include_once( 'partials/common/notice-configure.php' );
    3226
    33   else: ?>
     27else:
    3428
    35   <div class="warning-message notice support-hours-notice inline notice-warning notice-alt">
    36     <p><?php _e( 'No Support Hours bought yet.', $this->plugin_name); ?></p>
    37   </div>
    38   <a class="button button-primary"  href="mailto:<?php echo $email; ?>'?SUBJECT=<?php  _e('Order Support Hours', $this->plugin_name); ?> - <?php echo bloginfo('name'); ?>">
    39     <?php _e('Order Support Hours', $this->plugin_name); ?>
    40   </a>
     29  include_once( 'partials/common/notice-no-hours.php' );
    4130
    42 <?php endif; ?>
     31endif;
     32?>
  • support-hours/trunk/includes/class-support-hours.php

    r1737711 r1968512  
    7575        $this->set_locale();
    7676        $this->define_admin_hooks();
    77         $this->define_public_hooks();
    7877
    7978    }
     
    118117         * side of the site.
    119118         */
    120         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-support-hours-public.php';
    121119
    122120        $this->loader = new Support_Hours_Loader();
     
    165163
    166164    /**
    167      * Register all of the hooks related to the public-facing functionality
    168      * of the plugin.
    169      *
    170      * @since    1.0.0
    171      * @access   private
    172      */
    173     private function define_public_hooks() {
    174         $plugin_public = new Support_Hours_Public( $this->get_plugin_name(), $this->get_version() );
    175         $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
    176         $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
    177     }
    178     /**
    179165     * Run the loader to execute all of the hooks with WordPress.
    180166     *
  • support-hours/trunk/languages/support-hours-nl_NL.po

    r1964531 r1968512  
    22msgstr ""
    33"Project-Id-Version: Support hours\n"
    4 "POT-Creation-Date: 2018-09-15 17:35+0200\n"
    5 "PO-Revision-Date: 2018-09-15 17:35+0200\n"
     4"POT-Creation-Date: 2018-10-29 09:31+0100\n"
     5"PO-Revision-Date: 2018-10-29 09:34+0100\n"
    66"Last-Translator: \n"
    77"Language-Team: Erik van der Bas <erik@basedonline.nl>\n"
     
    2424
    2525#: admin/class-support-hours-admin.php:114
    26 #: admin/class-support-hours-admin.php:188
     26#: admin/class-support-hours-admin.php:198
    2727msgid "Support Hours"
    2828msgstr "Support Hours"
     
    9898
    9999#: admin/partials/common/worktable.php:17
     100#: admin/partials/settings/work-table-fields.php:23
    100101#: admin/partials/settings/work-table-form.php:10
    101102msgid "Time"
     
    126127
    127128#: admin/partials/settings/work-table-fields.php:8
    128 #: admin/partials/settings/work-table-fields.php:23
    129129msgid "Time used"
    130130msgstr "Tijd verbruikt"
     
    142142msgstr "Type"
    143143
    144 #: admin/partials/settings/work-table-form.php:27
     144#: admin/partials/settings/work-table-form.php:31
     145msgid "Activities will be sorted by date on save"
     146msgstr "Activiteiten worden gesorteerd op datum tijdens het bijwerken"
     147
     148#: admin/partials/settings/work-table-form.php:33
    145149msgid "Add activity"
    146150msgstr "Voeg activiteit toe"
    147151
    148 #: admin/partials/settings/work-table-form.php:29
     152#: admin/partials/settings/work-table-form.php:35
    149153msgid "Save"
    150154msgstr "Bijwerken"
     
    170174msgstr "Een compleet overzicht van alle activiteiten."
    171175
    172 #: admin/support-hours-admin-settings.php:37
     176#: admin/support-hours-admin-settings.php:36
    173177msgid ""
    174178"You do not have access to this page because you are not a Support Hours "
  • support-hours/trunk/support-hours.php

    r1964531 r1968512  
    1717 * Plugin URI:        http://basedonline.nl
    1818 * Description:       Use Support hours to give yourself and your clients insights on the status of pre-paid work.
    19  * Version:           1.5.1
     19 * Version:           1.5.2
    2020 * Author:            Erik van der Bas
    2121 * Author URI:        https://basedonline.nl
Note: See TracChangeset for help on using the changeset viewer.