Plugin Directory

Changeset 1255084


Ignore:
Timestamp:
09/28/2015 12:49:25 PM (11 years ago)
Author:
think201
Message:

Updated with minor bug fixes
Added List order feature

Location:
clients
Files:
49 added
5 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • clients/trunk/assets/js/ct-admin.js

    r1180269 r1255084  
    1 window.$=jQuery.noConflict();var CTForm={settings:{formObj:null},post:function(t,e){return CTForm.settings.formObj=$(t),0==Validator.check(CTForm.settings.formObj)?!1:void $.ajax({url:ajaxurl,type:"post",data:CTForm.settings.formObj.serialize(),success:function(s,o){1==s.status?($(".ct_success_msg p").html(s.msg),$(".ct_success_msg").fadeIn(1e3).siblings(".ct-msg").hide(),e||$(t)[0].reset()):($(".ct_error_msg p").html(s.msg),$(".ct_error_msg").fadeIn(1e3).siblings(".ct-msg").hide())},error:function(){$(".ct_error_msg p").html(data.msg),$(".ct_error_msg").fadeIn(1e3).siblings(".ct-msg").hide()}})}},Upload={init:function(t,e){var s;$("#upload_logo").click(function(t){return t.preventDefault(),s?void s.open():(s=wp.media.frames.file_frame=wp.media({title:"Choose Client's Logo",button:{text:"Choose Logo"},multiple:!1}),s.on("select",function(){attachment=s.state().get("selection").first().toJSON(),$("#logo").val(attachment.url)}),void s.open())})}},Validator={init:function(){},check:function(t){return t.validator("checkform",t)},set:function(t){$(t+" input").validator({events:"blur change"})}},CTCreateShortCode={settings:{shortcodeHolder:$("#shortcode-holder"),formObj:null},post:function(t){return CTCreateShortCode.settings.formObj=$(t),0==Validator.check(CTCreateShortCode.settings.formObj)?!1:void $.ajax({url:ajaxurl,type:"post",data:CTCreateShortCode.settings.formObj.serialize(),success:function(t,e){1==t.status?($(".ct_success_msg p").html(t.msg),$(".ct_success_msg").fadeIn(1e3).siblings(".ct-msg").hide(),CTCreateShortCode.settings.shortcodeHolder.html(t.shortcode)):($(".ct_error_msg p").html(t.msg),$(".ct_error_msg").fadeIn(1e3).siblings(".ct-msg").hide())},error:function(){$(".ct_error_msg p").html(data.msg),$(".ct_error_msg").fadeIn(1e3).siblings(".ct-msg").hide()}})}};$(function(){Upload.init(),Validator.set("#ct_add_form")});
     1/******* Jquery No Conflict Function *******/
     2window.$ = jQuery.noConflict();
     3
     4var CTForm = {
     5
     6  settings:
     7  {
     8    formObj  : null,
     9  },
     10
     11  post: function(FormId, isUpdate)
     12  {   
     13    CTForm.settings.formObj = $(FormId);
     14
     15    if(Validator.check(CTForm.settings.formObj) == false)
     16    {
     17        return false;
     18    }
     19
     20    $.ajax({
     21      url: ajaxurl,
     22      type: 'post',
     23      data: CTForm.settings.formObj.serialize(),
     24      success: function(data, status)
     25      {
     26        if (data.status == true)
     27        {
     28          $('.ct_success_msg p').html(data.msg);
     29          $('.ct_success_msg').fadeIn(1000).siblings('.ct-msg').hide();
     30         
     31          if(!isUpdate)
     32          {
     33            $(FormId)[0].reset(); 
     34          }
     35         
     36        }
     37        else
     38        {
     39          $('.ct_error_msg p').html(data.msg);
     40          $('.ct_error_msg').fadeIn(1000).siblings('.ct-msg').hide();
     41        }
     42      },
     43      error: function()
     44      {
     45        $('.ct_error_msg p').html(data.msg);
     46        $('.ct_error_msg').fadeIn(1000).siblings('.ct-msg').hide();
     47      }                       
     48    });
     49  }
     50};
     51
     52var Upload = {
     53 
     54    init: function(ButtonId, InputId) {
     55    var custom_uploader;
     56 
     57 
     58    $('#upload_logo').click(function(e) {
     59 
     60        e.preventDefault();
     61 
     62        //If the uploader object has already been created, reopen the dialog
     63        if (custom_uploader) {
     64            custom_uploader.open();
     65            return;
     66        }
     67 
     68        //Extend the wp.media object
     69        custom_uploader = wp.media.frames.file_frame = wp.media({
     70            title: "Choose Client's Logo",
     71            button: {
     72                text: 'Choose Logo'
     73            },
     74            multiple: false
     75        });
     76 
     77        //When a file is selected, grab the URL and set it as the text field's value
     78        custom_uploader.on('select', function() {
     79            attachment = custom_uploader.state().get('selection').first().toJSON();
     80            $('#logo').val(attachment.url);
     81        });
     82 
     83        //Open the uploader dialog
     84        custom_uploader.open();
     85 
     86    });
     87    }
     88};
     89 
     90var Validator = {
     91
     92    init: function()
     93    {
     94
     95    },
     96
     97    check: function(FormObj)
     98    {
     99        return FormObj.validator('checkform', FormObj);
     100    },
     101
     102    set: function(FormId)
     103    {
     104        $(FormId+' input').validator({events   : 'blur change'});
     105    },
     106
     107};
     108
     109var CTCreateShortCode = {
     110  settings:
     111  {
     112      shortcodeHolder : $('#shortcode-holder'),
     113      formObj : null
     114  },
     115
     116  post: function(FormId)
     117  {   
     118    CTCreateShortCode.settings.formObj = $(FormId);
     119
     120    if(Validator.check(CTCreateShortCode.settings.formObj) == false)
     121    {
     122        return false;
     123    }
     124
     125    $.ajax({
     126      url: ajaxurl,
     127      type: 'post',
     128      data: CTCreateShortCode.settings.formObj.serialize(),
     129      success: function(data, status)
     130      {
     131        if (data.status == true)
     132        {
     133          $('.ct_success_msg p').html(data.msg);
     134          $('.ct_success_msg').fadeIn(1000).siblings('.ct-msg').hide();
     135          CTCreateShortCode.settings.shortcodeHolder.html(data.shortcode)
     136        }
     137        else
     138        {
     139          $('.ct_error_msg p').html(data.msg);
     140          $('.ct_error_msg').fadeIn(1000).siblings('.ct-msg').hide();
     141        }
     142      },
     143      error: function()
     144      {
     145        $('.ct_error_msg p').html(data.msg);
     146        $('.ct_error_msg').fadeIn(1000).siblings('.ct-msg').hide();
     147      }                       
     148    });
     149  }
     150};
     151 
     152$(function() {
     153    Upload.init();
     154
     155    Validator.set('#ct_add_form');
     156
     157});
  • clients/trunk/assets/js/ct-user.js

    r1180269 r1255084  
    1 window.$=jQuery.noConflict(),jQuery(window).load(function(){var t=$(".ct-scroller div.ct-inner-scroll"),e=t.children("ul");e.children().clone().appendTo(e);var o=0;e.children().each(function(){var t=$(this);t.css("left",o),o+=t.outerWidth(!0)});var r=o/2,s=t.width(),n={curSpeed:0,fullSpeed:2},i=$(n),c=function(t,e){void 0===e&&(e=300),i.stop(!0).animate({curSpeed:t},e)};t.hover(function(){c(0)},function(){c(n.fullSpeed)});var a=function(){var e=t.scrollLeft(),o=e+n.curSpeed;o>2*r-s&&(o-=r),t.scrollLeft(o)};setInterval(a,40),c(n.fullSpeed)});
     1/******* Jquery No Conflict Function *******/
     2window.$ = jQuery.noConflict();
     3
     4jQuery(window).load(function() {
     5    var scroller = $('.ct-scroller div.ct-inner-scroll');
     6    var scrollerContent = scroller.children('ul');
     7
     8    if(scrollerContent.children().length < 3)
     9    {
     10        scrollerContent.children().clone().appendTo(scrollerContent);
     11    }
     12
     13    var curX = 0;
     14
     15    scrollerContent.children().each(function(){
     16        var $this = $(this);
     17        $this.css('left', curX);
     18        curX += $this.outerWidth(true);
     19    });
     20
     21    var fullW = curX / 2;
     22    var viewportW = scroller.width();
     23
     24    // Scrolling speed management
     25    var controller = {curSpeed:0, fullSpeed:2};
     26    var $controller = $(controller);
     27
     28    var tweenToNewSpeed = function(newSpeed, duration)
     29    {
     30        if (duration === undefined)
     31            duration = 300;
     32        $controller.stop(true).animate({curSpeed:newSpeed}, duration);
     33    };
     34
     35    // Pause on hover
     36    scroller.hover(function(){
     37        tweenToNewSpeed(0);
     38    }, function(){
     39        tweenToNewSpeed(controller.fullSpeed);
     40    });
     41
     42    // Scrolling management; start the automatical scrolling
     43    var doScroll = function()
     44    {
     45        var curX = scroller.scrollLeft();
     46        var newX = curX + controller.curSpeed;
     47        if (newX > fullW*2 - viewportW)
     48            newX -= fullW;
     49        scroller.scrollLeft(newX);
     50    };
     51    setInterval(doScroll, 40);
     52    tweenToNewSpeed(controller.fullSpeed);
     53});
  • clients/trunk/clients.php

    r1218377 r1255084  
    55Description: Clients provide you an easiest way to add and retrieve clients.
    66Author: Think201
    7 Version: 1.1.2
     7Version: 1.1.3
    88Author URI: http://labs.think201.com
    99License: GPL v1
     
    1212Copyright (C) 2015, Think201 - hello@think201.com
    1313
    14 This program is free software: you can redistribute it and/or modify
    15 it under the terms of the GNU General Public License as published by
    16 the Free Software Foundation, either version 3 of the License, or
    17 (at your option) any later version.
    18 See the GNU General Public License for more details.
    19 
    20 You should have received a copy of the GNU General Public License
    21 along with this program.  If not, see <http://www.gnu.org/licenses/>.
    2214*/
    23 /**
    24  * @package Main
    25  */
    2615
    2716if(version_compare(PHP_VERSION, '5.2', '<' ))
     
    4635
    4736if ( !defined( 'CT_VERSION' ) )
    48 define('CT_VERSION', '1.1.2' );
     37define('CT_VERSION', '1.1.3' );
    4938
    5039if ( !defined( 'CT_PLUGIN_DIR' ) )
  • clients/trunk/gulpfile.js

    r1180269 r1255084  
    44var uglify  = require('gulp-uglifyjs');
    55
    6 var cssDir  = 'scss';
    7 var jsDir   = 'js';
     6var cssDir  = 'assets/scss';
     7var jsDir   = 'assets/js';
    88
    99gulp.task('watch', function ()
     
    1616gulp.task('css', function ()
    1717{
    18    return sass(cssDir)
    19   .pipe(gulp.dest('./assets/css'));       
     18   return sass(cssDir, {'style': 'compressed'})
     19  .pipe(gulp.dest('./public/css'));       
    2020});
    2121
    2222gulp.task('js', function ()
    2323{
    24     gulp.src('js/ct-admin.js')
     24    gulp.src('assets/js/ct-admin.js')
    2525    .pipe(uglify('ct-admin.js'))
    26     .pipe(gulp.dest('./assets/js'));
     26    .pipe(gulp.dest('./public/js'));
    2727});
    2828
    2929gulp.task('jsuser', function ()
    3030{
    31     gulp.src('js/ct-user.js')
     31    gulp.src('assets/js/ct-user.js')
    3232    .pipe(uglify('ct-user.js'))
    33     .pipe(gulp.dest('./assets/js'));
     33    .pipe(gulp.dest('./public/js'));
    3434});
    3535
  • clients/trunk/includes/ct-admin.php

    r1192293 r1255084  
    3535    public function menuItems()
    3636    {
    37         add_menu_page('Clients', 'Clients', 'manage_options', 'clients', array($this, 'pageDashboard'));
     37        add_menu_page('Clients', 'Clients', 'manage_options', 'ct-all-clients', array($this, 'pageAllClients'), 'dashicons-slides');
    3838
    39         $PageA = add_submenu_page( 'clients', 'Dashboard', 'Dashboard', 'manage_options', 'clients', array($this, 'pageDashboard'));
    40         $PageB = add_submenu_page( 'clients', 'All Clients', 'All Clients', 'manage_options', 'ct-all-clients', array($this, 'pageAllClients') );
    41         $PageC = add_submenu_page( 'clients', 'Add New', 'Add New', 'manage_options', 'ct-add-new', array($this, 'pageAddNew') );         
    42         $PageD = add_submenu_page( null, 'Edit Client', 'Edit Client', 'manage_options', 'ct-edit-client', array($this, 'pageEdit') );
    43         $PageE = add_submenu_page( 'clients', 'Shortcodes', 'Shortcodes', 'manage_options', 'ct-shortcode', array($this, 'pageShortcodes') );                 
    44         $PageF = add_submenu_page( null, 'Catgories', 'Client Categories', 'manage_options', 'ct-categories', array($this, 'pageCategory') );         
     39        $PageA = add_submenu_page( 'ct-all-clients', 'All Clients', 'All Clients', 'manage_options', 'ct-all-clients', array($this, 'pageAllClients') );
     40        $PageB = add_submenu_page( 'ct-all-clients', 'Add New', 'Add New', 'manage_options', 'ct-add-new', array($this, 'pageAddNew') );         
     41        $PageC = add_submenu_page( null, 'Edit Client', 'Edit Client', 'manage_options', 'ct-edit-client', array($this, 'pageEdit') );
     42        $PageD = add_submenu_page( 'ct-all-clients', 'Shortcodes', 'Shortcodes', 'manage_options', 'ct-shortcode', array($this, 'pageShortcodes') );                 
     43        $PageE = add_submenu_page( null, 'Catgories', 'Client Categories', 'manage_options', 'ct-categories', array($this, 'pageCategory') );         
    4544       
    4645        add_action('admin_print_scripts-' . $PageA, array($this, 'adminScriptStyles'));
     
    4948        add_action('admin_print_scripts-' . $PageD, array($this, 'adminScriptStyles'));
    5049        add_action('admin_print_scripts-' . $PageE, array($this, 'adminScriptStyles'));
    51         add_action('admin_print_scripts-' . $PageF, array($this, 'adminScriptStyles'));
    5250    }
    5351
     
    6866    {
    6967        if (!is_admin())
    70         {           
    71             wp_enqueue_style( 'ct-css', plugins_url( 'assets/css/ct.css', dirname(__FILE__) ), array(), CT_VERSION, 'all' );
     68        { 
     69            $RedlofPluginConfig = get_option('wp_redlof_plugins_config', false);
     70
     71            if($RedlofPluginConfig !== false AND isset($RedlofPluginConfig['ct_css']) AND $RedlofPluginConfig['ct_css'])
     72            {
     73                $CssSet = true;
     74            }
     75            else
     76            {
     77                $CssSet = false;
     78            }           
     79
     80            if($CssSet == false)
     81            {
     82                wp_enqueue_style( 'ct-css', plugins_url( 'assets/css/ct.css', dirname(__FILE__) ), array(), CT_VERSION, 'all' );
     83            }
     84
    7285            wp_enqueue_script( 'ct-user', plugins_url( 'assets/js/ct-user.js', dirname(__FILE__) ), array( 'jquery' ), false, true );
    7386        }
    7487    }   
    75 
    76     public function pageDashboard()
    77     {
    78         require_once CT_PLUGIN_DIR .'/pages/admin-dashboard.php';     
    79     }
    8088
    8189    public function pageAddNew()
  • clients/trunk/includes/ct-data.php

    r1169581 r1255084  
    2222        if($Config['get'] == 'featured')
    2323        {
    24             $Query .= " AND isfeatured = 1";
     24            $Query .= " AND isfeatured = 1 ";
    2525        }
    2626
    2727        if($Config['category'] != CT_SHRT_CATEGORY)
    2828        {
    29             $Query .= " AND category = '".$Config['category']."'";
    30         }       
     29            $Query .= " AND category = '".$Config['category']."' ";
     30        }
     31
     32        $Query .= ' ORDER BY listorder ASC';
    3133
    3234        if($Config['numclients'] != CT_SHRT_NUMCLIENTS)
     
    8890        $CatSlug = sanitize_title($Cat);
    8991
    90         if(array_key_exists($CatSlug, $Categories))
     92        if($Categories != false AND array_key_exists($CatSlug, $Categories))
    9193        {
    9294            return false;
  • clients/trunk/includes/ct-install.php

    r1079578 r1255084  
    1010
    1111        $ct_clients = $wpdb->prefix.'ct_clients';
     12        $charset_collate = $wpdb->get_charset_collate();
    1213
    13         $ct_clients_query = "CREATE TABLE IF NOT EXISTS $ct_clients(
    14         id INT(9) NOT NULL AUTO_INCREMENT,
    15         name VARCHAR(100) NOT NULL,
    16         url VARCHAR(300),
    17         description VARCHAR(500),
    18         category VARCHAR(100),
    19         logo VARCHAR(500),
    20         isfeatured BOOLEAN DEFAULT 0,
    21         client_since DATETIME,   
    22         created_at DATETIME NOT NULL,
    23         updated_at DATETIME NOT NULL,
    24         misc VARCHAR(50),
    25         status TINYINT(5) DEFAULT 1,
    26         Primary Key id (id)
    27         )ENGINE=InnoDB DEFAULT CHARSET=utf8;";
     14        $ct_clients_query = "CREATE TABLE $ct_clients (
     15        id int(9) NOT NULL AUTO_INCREMENT,
     16        name varchar(100) NOT NULL,
     17        url varchar(300),
     18        description varchar(500),
     19        category varchar(100),
     20        logo varchar(550),
     21        isfeatured boolean DEFAULT 0,
     22        client_since datetime,   
     23        created_at datetime NOT NULL,
     24        updated_at datetime NOT NULL,
     25        misc varchar(50),
     26        status tinyint(5) DEFAULT 1,
     27        listorder tinyint(5) DEFAULT 0,
     28        PRIMARY KEY  (id)
     29        ) $charset_collate;";
    2830
    29         $wpdb->query($ct_clients_query);
     31        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     32
     33        dbDelta( $ct_clients_query );
    3034
    3135        require_once 'ct-data.php';
    3236
    3337        ct\CTData::addCategory('General');
     38       
    3439    }
    3540
  • clients/trunk/includes/ct-shortcodes.php

    r1180269 r1255084  
    4242           
    4343            case "slider":
    44                
    4544               // Slider Style
    4645                $StyledClients = CTShortCodes::_Slider($ClientList, $Config);
     
    6867    public static function _Slider($ClientList, $Config)
    6968    {       
    70        
    7169        require_once CT_PLUGIN_DIR .'/templates/ct-slider.php'; 
    7270    }
  • clients/trunk/includes/post-requests.php

    r1218377 r1255084  
    5050        $Data['url']                = isset($_POST['url']) ? sanitize_text_field($_POST['url'] ): '#';     
    5151        $Data['logo']               = isset($_POST['logo']) ? sanitize_text_field($_POST['logo']) : '';
     52        $Data['listorder']          = isset($_POST['listorder']) ? sanitize_text_field($_POST['listorder']) : 100;
     53
     54        $Data['listorder']          = $Data['listorder'] == 0 ? 100 : intval($Data['listorder']);
     55
    5256        $Data['description']        = isset($_POST['description']) ? sanitize_text_field($_POST['description']) : '';       
    5357
  • clients/trunk/pages/admin-add-new.php

    r1218377 r1255084  
    3030                    <tr valign="top">
    3131                        <th scope="row">
    32                             <label for="description">Description:</label>
    33                         </td>
    34                         <td>
    35                             <textarea rows="4" cols="50" id="description" name="description" placeholder="Client Description"></textarea>
    36                         </td>
    37                     </tr>                   
    38                     <tr valign="top">
    39                         <th scope="row">
    4032                            <label for="url">URL:</label>
    4133                        </td>
     
    4941                        </td>
    5042                        <td>
    51                             <input type="text" id="logo" name="logo" placeholder="Client Logo" class="regular-text">                               
     43                            <input type="text" id="logo" name="logo" placeholder="Client Logo" class="regular-text"  data-validations="required">                               
    5244                            <input id="upload_logo" class="button" type="button" value="Upload Logo" />                             
    5345                        </td>
    54                     </tr>                   
     46                    </tr>
     47                    <tr valign="top">
     48                        <th scope="row">
     49                            <label for="name">List Order</label>
     50                        </td>
     51                        <td>
     52                            <input type="text" id="listorder" name="listorder" placeholder="List Order 1-100" class="regular-text">
     53                        </td>
     54                    </tr>                                       
     55                    <tr valign="top">
     56                        <th scope="row">
     57                            <label for="description">Description:</label>
     58                        </td>
     59                        <td>
     60                            <textarea rows="4" cols="50" id="description" name="description" placeholder="Client Description"></textarea>
     61                        </td>
     62                    </tr>               
    5563                    <tr valign="top">
    5664                        <th scope="row">
  • clients/trunk/pages/admin-edit-client.php

    r1218377 r1255084  
    5959                    <tr valign="top">
    6060                        <th scope="row">
    61                             <label for="description">Description:</label>
    62                         </td>
    63                         <td>
    64                             <textarea rows="4" cols="50" id="description" name="description" placeholder="Client Description"><?php print $Client->description ?></textarea>
    65                         </td>
    66                     </tr>                   
    67                     <tr valign="top">
    68                         <th scope="row">
    6961                                <label for="url">URL:</label>
    7062                        </td>
     
    8274                            <input id="upload_logo" class="button" type="button" value="Upload Logo" />                             
    8375                        </td>
    84                     </tr>                   
     76                    </tr>
     77                    <tr valign="top">
     78                        <th scope="row">
     79                            <label for="name">List Order</label>
     80                        </td>
     81                        <td>
     82                            <input type="text" id="listorder" name="listorder" placeholder="List Order 1-100" class="regular-text" value="<?php print $Client->listorder ?>">
     83                        </td>
     84                    </tr>                                   
     85                    <tr valign="top">
     86                        <th scope="row">
     87                            <label for="description">Description:</label>
     88                        </td>
     89                        <td>
     90                            <textarea rows="4" cols="50" id="description" name="description" placeholder="Client Description"><?php print $Client->description ?></textarea>
     91                        </td>
     92                    </tr>
    8593                    <tr valign="top">
    8694                        <th scope="row">
  • clients/trunk/readme.txt

    r1218377 r1255084  
    55Donate link: http://www.think201.com/
    66Tested up to: 4.2.2
    7 Stable tag: 1.1.2
    8 Version: 1.1.2
     7Stable tag: 1.1.3
     8Version: 1.1.3
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2424- Also, you may choose the UI style you want to display client information on your site
    2525
    26 * Like the plugin or want features? Tweet to us @think201
     26* Like the plugin or want features? Tweet to us [@think201](https://twitter.com/think201)
     27* Also you can read more about the plugin & its development at [Think201 Labs](http://labs.think201.com/plugin/clients/)
    2728
    2829= Plugin Support =
    2930
    30 Dedicated Support: talk to us on Twitter @think201
     31Dedicated Support: talk to us on Twitter [@think201](https://twitter.com/think201) or [Think201 Labs](http://labs.think201.com)
    3132
    3233To raise issues or if you have a question for us, post to the support forum here https://wordpress.org/support/plugin/clients and we are happy to help.
     
    100101= 1.1.2 =
    101102- Client logo upload issue fixed.
     103
     104= 1.1.3 =
     105- Improvided interface
     106-
Note: See TracChangeset for help on using the changeset viewer.