Plugin Directory

Changeset 1468746


Ignore:
Timestamp:
08/05/2016 04:08:39 PM (10 years ago)
Author:
k00ni
Message:

full rework of admin UI (made simpler and more clear)

  • added illustrations
  • reduced texts
  • removed obsolete information (e.g. plugin version)
Location:
fixed-menu-anchor/trunk
Files:
8 added
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • fixed-menu-anchor/trunk/admin/settings.php

    r1415651 r1468746  
    4949$twig = new \Twig_Environment($loader);
    5050
    51 if (false == $licenseHandler->isPluginUnlocked()) {
    52     echo $twig->render(
    53         'settings-locked.html',
    54         array(
    55             'cssClassesToBeIgnored' => $options['cssClassesToBeIgnored'],
    56             'curlEnabled' => extension_loaded('curl'),
    57             'unlockResponse' => $unlockResponse,
    58             'userDefinedDistance' => $options['userDefinedDistance'],
    59             'version' => FIXEDMENUANCHOR_VERSION,
    60         )
    61     );
    62 } else {
    63     echo $twig->render(
    64         'settings-unlocked.html',
    65         array(
    66             'cssClassesToBeIgnored' => $options['cssClassesToBeIgnored'],
    67             'freshlyUnlocked' => $freshlyUnlocked,
    68             'maximumViewportWidth' => $options['maximumViewportWidth'],
    69             'maximumViewportWidthDistance' => $options['maximumViewportWidthDistance'],
    70             'userDefinedDistance' => $options['userDefinedDistance'],
    71             'version' => FIXEDMENUANCHOR_VERSION,
    72         )
    73     );
    74 }
     51echo $twig->render(
     52    'settings.html',
     53    array(
     54        // settings
     55        'cssClassesToBeIgnored' => $options['cssClassesToBeIgnored'],
     56        'maximumViewportWidth' => $options['maximumViewportWidth'],
     57        'maximumViewportWidthDistance' => $options['maximumViewportWidthDistance'],
     58        'userDefinedDistance' => $options['userDefinedDistance'],
     59
     60        // system information
     61        'curlEnabled' => extension_loaded('curl'),
     62        'freshlyUnlocked' => $freshlyUnlocked,
     63        'image_dir_url' => plugin_dir_url( __FILE__ ) .'../img/',
     64        'pluginIsUnlocked' => $licenseHandler->isPluginUnlocked()
     65    )
     66);
  • fixed-menu-anchor/trunk/fixed-menu-anchor.php

    r1468739 r1468746  
    88 * Plugin Name: Fixed Menu Anchor
    99 * Plugin URI: https://wordpress.org/plugins/fixed-menu-anchor
    10  * Version: 2.2.1
     10 * Version: 2.3
    1111 * Description: Having problems with a fixed header/menu which overlaps the target of an anchor? Use this plugin to jump just before the target so that the fixed header/menu does not overlap anymore.
    1212 * Author: Konrad Abicht, Marc Sauerwald
     
    1616
    1717require_once 'vendor/autoload.php';
    18 
    19 if (!defined('FIXEDMENUANCHOR_VERSION')) {
    20     define('FIXEDMENUANCHOR_VERSION', '2.2.1');
    21 }
    2218
    2319// when not in admin area ...
     
    7874// when in admin area ...
    7975} else {
    80     function fixedMenuAnchor_adminInit()
    81     {
     76    add_action('admin_menu', function(){
    8277        // stop execution if user is not a super admin
    8378        if (false == is_super_admin()) {
     
    9287            'manage_options',
    9388            'fixedMenuAnchor',
    94             'fixedMenuAnchor_adminSettings'
     89            function() {
     90                require_once 'admin/settings.php';
     91            }
    9592        );
    96     }
     93    });
    9794
    98     function fixedMenuAnchor_adminSettings()
    99     {
    100         require_once 'admin/settings.php';
    101     }
    102 
    103     add_action('admin_menu', 'fixedMenuAnchor_adminInit');
     95    // add CSS to admin area
     96    add_action('admin_enqueue_scripts', function() {
     97        wp_enqueue_style('custom-admin-style', plugin_dir_url( __FILE__ ) . 'css/admin.css');
     98    });
    10499
    105100    /*
    106101     * add Settings link in plugin view
    107102     */
    108     add_filter('plugin_action_links', 'fixedMenuAnchor_plugin_action_links', 10, 2);
    109     function fixedMenuAnchor_plugin_action_links($links, $file)
    110     {
     103    add_filter('plugin_action_links', function($links, $file) {
    111104        static $this_plugin;
    112105
     
    125118
    126119        return $links;
    127     }
     120    }, 10, 2);
    128121}
Note: See TracChangeset for help on using the changeset viewer.