| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Ultimate Dashboard |
| 4 |
* Plugin URI: https://ultimatedashboard.io/ |
| 5 |
* Description: Ultimate Dashboard gives you full control over your WordPress Dashboard. Remove the default Dashboard Widgets and and create your own for a better user experience. |
| 6 |
* Version: 2.2 |
| 7 |
* Author: MapSteps |
| 8 |
* Author URI: https://mapsteps.com/ |
| 9 |
* Text Domain: ultimatedashboard |
| 10 |
*/ |
| 11 |
|
| 12 |
// exit if accessed directly |
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 14 |
|
| 15 |
// Plugin constants |
| 16 |
define( 'ULTIMATE_DASHBOARD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 17 |
define( 'ULTIMATE_DASHBOARD_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 18 |
|
| 19 |
// Textdomain |
| 20 |
add_action( 'plugins_loaded', 'udb_textdomain' ); |
| 21 |
function udb_textdomain() { |
| 22 |
load_plugin_textdomain( 'ultimatedashboard', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); |
| 23 |
} |
| 24 |
|
| 25 |
// Admin Scripts |
| 26 |
add_action( 'admin_enqueue_scripts', 'udb_admin_scripts' ); |
| 27 |
function udb_admin_scripts() { |
| 28 |
|
| 29 |
global $pagenow, $typenow; |
| 30 |
|
| 31 |
// Widget edit screen & create a new Widget screen |
| 32 |
if( ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) && $typenow == 'udb_widgets' ) { |
| 33 |
|
| 34 |
wp_register_style( 'font-awesome', ULTIMATE_DASHBOARD_PLUGIN_URL . 'assets/css/font-awesome.min.css', false, '4.7.0' ); |
| 35 |
wp_enqueue_style( 'font-awesome' ); |
| 36 |
|
| 37 |
wp_register_style( 'ultimate-dashboard-cpt', ULTIMATE_DASHBOARD_PLUGIN_URL . 'assets/css/ultimate-dashboard-cpt.css', false, '' ); |
| 38 |
wp_enqueue_style( 'ultimate-dashboard-cpt' ); |
| 39 |
|
| 40 |
wp_register_script( 'ultimate-dashboard-cpt', ULTIMATE_DASHBOARD_PLUGIN_URL . 'assets/js/ultimate-dashboard-cpt.js', array('jquery'), '', true ); |
| 41 |
wp_enqueue_script( 'ultimate-dashboard-cpt' ); |
| 42 |
} |
| 43 |
|
| 44 |
// Dashboard Widget Overview & Settings |
| 45 |
if( $pagenow == 'edit.php' && $typenow == 'udb_widgets' ) { |
| 46 |
|
| 47 |
wp_register_style( 'font-awesome', ULTIMATE_DASHBOARD_PLUGIN_URL . 'assets/css/font-awesome.min.css', false, '4.7.0' ); |
| 48 |
wp_enqueue_style( 'font-awesome' ); |
| 49 |
|
| 50 |
wp_register_style( 'ultimate-dashboard-settings', ULTIMATE_DASHBOARD_PLUGIN_URL . 'assets/css/ultimate-dashboard-settings.css', false, '' ); |
| 51 |
wp_enqueue_style( 'ultimate-dashboard-settings' ); |
| 52 |
|
| 53 |
} |
| 54 |
|
| 55 |
// WordPress Dashboard |
| 56 |
if( $pagenow == 'index.php' ) { |
| 57 |
|
| 58 |
wp_register_style( 'font-awesome', ULTIMATE_DASHBOARD_PLUGIN_URL . 'assets/css/font-awesome.min.css', false, '4.7.0' ); |
| 59 |
wp_enqueue_style( 'font-awesome' ); |
| 60 |
|
| 61 |
wp_register_style( 'ultimate-dashboard-index', ULTIMATE_DASHBOARD_PLUGIN_URL . 'assets/css/ultimate-dashboard-index.css', false, '' ); |
| 62 |
wp_enqueue_style( 'ultimate-dashboard-index' ); |
| 63 |
|
| 64 |
} |
| 65 |
|
| 66 |
} |
| 67 |
|
| 68 |
// Action Links |
| 69 |
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'udb_add_action_links' ); |
| 70 |
|
| 71 |
function udb_add_action_links( $links ) { |
| 72 |
|
| 73 |
$settings = array( '<a href="' . admin_url( 'edit.php?post_type=udb_widgets&page=settings' ) . '">'. __( 'Settings', 'ultimatedashboard' ) .'</a>' ); |
| 74 |
return array_merge( $links, $settings ); |
| 75 |
|
| 76 |
} |
| 77 |
|
| 78 |
// Required Files |
| 79 |
require_once ULTIMATE_DASHBOARD_PLUGIN_DIR . 'inc/ultimate-dashboard-init.php'; |