Plugin Directory

Changeset 1692756


Ignore:
Timestamp:
07/07/2017 11:00:02 PM (9 years ago)
Author:
dangub86
Message:

Optimized the code, fixed dismiss button and tooltip

Location:
admin-notices-for-team
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • admin-notices-for-team/trunk/admin/class-ant_admin_notices_team-admin.php

    r1692007 r1692756  
    881881
    882882        }
    883 
    884         /*if ( $field_id == 'toggle-custom-style' ) {
    885             $id = "customStyle";
    886             } else if ($field_id == 'font-style') {
    887              $id = "fontStyle";
    888              } else {
    889             $id = '';
    890         }*/
    891883
    892884        ?>
     
    12881280    }
    12891281
    1290     public function set_transient() {
    1291         set_transient( "ant-admin-trans", "alive", 3 );
    1292     }
    1293 
    1294 
    12951282    public function notices_showing( ) {
    12961283        global $current_user;
     
    13791366            }
    13801367
    1381     function aad_process_ajax() {
     1368    function ant_process_ajax() {
    13821369
    13831370        if( !isset( $_POST['ant_nonce'] ) || !wp_verify_nonce($_POST['ant_nonce'], 'ant-nonce') )
     
    13851372
    13861373        $user_id = get_current_user_id();
    1387 
    1388         /*if(!isset($_REQUEST['notice']))
    1389             die('Notice ID expected as "notice" parameter.');
    1390 
    1391         check_ajax_referer('kjm_admin_notices_ajax', '_wpnonce');*/
    1392 
    13931374        $notice_id = $_REQUEST['notice'];
    13941375
     
    14101391            // Determine if current time is greater than the expiration date
    14111392            if( $current_time >= $expiration ) {
    1412 
    14131393                wp_trash_post($notice_id);
    1414 
    14151394            }
    1416 
    14171395        }
    14181396
     
    14231401
    14241402     public function custom_css() {
    1425         $options = get_option( $this->plugin_name . '-settings' );
    14261403         $options_design = get_option( $this->plugin_name . '-design-settings' );
    14271404
    14281405        $width = $options_design['notice-width'];
    14291406        $margin = $options_design['notice-position'];
    1430 
    1431         $font = $options_design['font-style'];
     1407        $font = $options_design['font-style'];
    14321408        $fontSize = $options_design['font-size'];
    14331409        $fontColor = $options_design['font-color'];
     
    14401416
    14411417
    1442           if ( $options_design['width-unit'] == 1 ) {
     1418            if ( $options_design['width-unit'] == 1 ) {
    14431419                $unit = '%';
    1444         } else {
     1420            } else {
    14451421            $unit = 'px';
    1446         }
    1447 
    1448         if ( $options_design['border-radius'] >= 50 ) {
     1422            }
     1423
     1424            if ( $options_design['border-radius'] >= 50 ) {
    14491425                $unitRadius = '%';
    1450         }
    1451 
    1452 
     1426            }
    14531427
    14541428
     
    14571431                .ant-notice {
    14581432                        width: {$width}{$unit};
    1459                         margin-left: {$margin}{$unit};
     1433                        margin-left: {$margin}% !important;
    14601434                       
    14611435                }";
     
    14741448         }*/
    14751449
     1450                     if ( $options_design['display-inline'] == 'enabled' ) {
     1451
     1452                         $custom_css .= "
     1453                                   .wrap div.ant-notice, div.ant-notice {
     1454                                          position: static;
     1455                                          display: inline-block;                         
     1456                            }";
     1457                     }
     1458
    14761459                         if ( $options_design['toggle-custom-style'] == 'enabled' ) {
    1477 
    1478                              $custom_css = "
    1479                              .ant-notice-wrap {
    1480                             display: flex;
    1481                          }
    1482                            .ant-notice {
    1483                         width: {$width}{$unit};
    1484                         margin-left: {$margin}{$unit};     
     1460                         $custom_css .= "
     1461                           .ant-notice {   
    14851462                        font-family: {$font}, Helvetica, sans-serif !important;
    14861463                        font-size: {$fontSize}px !important;
     
    14931470                         }
    14941471
    1495                           if ( $options_design['display-inline'] == 'enabled' ) {
    1496 
    1497                          $custom_css = "
    1498                          .ant-notice-wrap {
    1499                             display: flex;
     1472                         if ( $options_design['notice-type'] == 1 ) {
     1473                             $custom_css .= "
     1474                               div.ant-notice .notice-dismiss {
     1475                               position: absolute !important;
     1476                               top: -8px !important;
     1477                                }";
    15001478                         }
    1501                          .wrap div.ant-notice, div.ant-notice {
    1502                               position: static;
    1503                               display: inline-block;
    1504                                width: {$width}{$unit};
    1505                         margin-left: {$margin}{$unit};               
    1506                             }       
    1507                            div.ant-notice .notice-dismiss {
    1508                         position: relative !important;
    1509                         left: 5% !important
    1510                 }";
    1511                          }
    1512 
    1513                          if ($options_design['display-inline'] == 'enabled' && $options_design['toggle-custom-style'] == 'enabled') {
    1514                              $custom_css = "
    1515                              .ant-notice-wrap {
    1516                             display: flex;
    1517                          }
    1518                          .wrap div.ant-notice, div.ant-notice {
    1519                               position: static;
    1520                               display: inline-block;
    1521                                width: {$width}{$unit} !important;
    1522                         margin-left: {$margin}{$unit} !important;
    1523                        font-family: {$font}, Helvetica, sans-serif !important;
    1524                         font-size: {$fontSize}px !important;
    1525                         color: {$fontColor} !important;
    1526                         background-color: {$bgColor} !important;
    1527                         border: solid {$border}px {$borderColor} !important;
    1528                         border-radius: {$borderRadius}{$unitRadius} !important;
    1529                         {$customCss}
    1530                        
    1531                         }";
    1532                          }
    1533 
    1534         // if ( $authorOptions != $current_user->user_login ) {
    1535          /*$custom_css .= "
    1536                  div#notice{$notice_id}  {
    1537 
    1538                         display: none !important;
    1539 
    1540                 }";*/
    1541         // }
    15421479
    15431480        wp_add_inline_style( $this->plugin_name, $custom_css );
  • admin-notices-for-team/trunk/admin/css/ant_admin_notices_team-admin.css

    r1692007 r1692756  
    316316    background: #3E474F;
    317317    border-radius: .25em;
    318     top: 130%;
     318    top: 117%;
    319319    color: #EDEFF0;
    320320    --width: 13.5em;
     
    361361    display: none;
    362362}
    363 /*button.ant-notice-dismiss {
    364     display: none;
    365     position: absolute;
    366     right: 0;
    367     bottom: 15%;
    368 
    369 }
    370 .ant-notice:hover button.ant-notice-dismiss {
    371     display: block;
    372 }
    373 button.ant-notice-dismiss::after {
    374     display: none;
    375     background: 0 0;
    376     color: #72777c;
    377     text-decoration: none !important;
    378     content: "\f147";
    379     font: 400 16px/20px dashicons;
    380     speak: none;
    381     height: 20px;
    382     text-align: center;
    383     width: 20px;
    384     -webkit-font-smoothing: antialiased;
    385     -moz-osx-font-smoothing: grayscale;
    386     transform: scale(2);
    387     transition: all 1s;
    388 }*/
    389363
    390364.ant-notice:hover button.notice-dismiss::after,
    391365.ant-notice:focus button.notice-dismiss::after{
    392366    display: block !important;
    393 
    394 }
    395 
    396 
     367}
     368
     369.ant-notice-wrap {
     370    display: flex;
     371}
     372
  • admin-notices-for-team/trunk/ant_admin_notices_team.php

    r1692007 r1692756  
    1414 *
    1515 * @wordpress-plugin
    16  * Plugin Name:       Admin Notices for Team
     16 * Plugin Name:       Ant Admin Notices for Team
    1717 * Plugin URI:        http://plugwpress.com/ant-notice-documentation/
    1818 * Description:       It provides the capability for administrators and/or editors to create Notices and display it to all users, only to specific authors.
    19  * Version:           1.0.0
     19 * Version:           1.0.1
    2020 * Author:            PlugWPress
    2121 * Author URI:        http://plugwpress.com
  • admin-notices-for-team/trunk/includes/class-ant_admin_notices_team.php

    r1692007 r1692756  
    7070
    7171        $this->plugin_name = 'ant_admin_notices_team';
    72         $this->version = '1.0.0';
     72        $this->version = '1.0.1';
    7373
    7474        $this->load_dependencies();
     
    174174
    175175        //Action -> Add Ajax Dismiss Notice
    176         $this->loader->add_action( 'wp_ajax_ant_dismiss', $plugin_admin, 'aad_process_ajax' );
     176        $this->loader->add_action( 'wp_ajax_ant_dismiss', $plugin_admin, 'ant_process_ajax' );
    177177
    178178        //Action -> Check if Notice is Expired
Note: See TracChangeset for help on using the changeset viewer.