110 lines
2.7 KiB
PHP
110 lines
2.7 KiB
PHP
<?php
|
|
|
|
|
|
|
|
//https://github.com/YahnisElsts/plugin-update-checker
|
|
// Use zip file from gitea downlaod link
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @link https://design519.com
|
|
* @since 1.0.0
|
|
* @package D5_Admin_WP
|
|
*
|
|
* @wordpress-plugin
|
|
* Plugin Name: D5 Admin WP
|
|
* Plugin URI: TODO: Git link
|
|
* Description: Common admin functions
|
|
* Version: 1.0.6
|
|
* Author: Dee Five
|
|
* Author URI: https://design519.com/
|
|
* License: GPL-2.0+
|
|
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
|
* Text Domain: d5-admin-wp
|
|
* Domain Path: /languages
|
|
*/
|
|
|
|
// Prevent execution outside of WP environment
|
|
defined('ABSPATH') or die("No direct access");
|
|
|
|
|
|
// For easy retrieval of plugin URL and path throughout the plugin files
|
|
if ( ! defined( 'D5AW_BASE_FILE' ) )
|
|
define( 'D5AW_BASE_FILE', __FILE__ );
|
|
if ( ! defined( 'D5AW_BASE_DIR' ) )
|
|
define( 'D5AW_BASE_DIR', dirname( D5AW_BASE_FILE ) );
|
|
if ( ! defined( 'D5AW_PLUGIN_URL' ) )
|
|
define( 'D5AW_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
|
|
|
|
|
// Includes
|
|
|
|
//require_once( 'inc/functions.php' );
|
|
|
|
|
|
|
|
|
|
|
|
add_action(
|
|
'admin_notices',
|
|
function() {
|
|
?>
|
|
<div class="notice notice-error">
|
|
<p>
|
|
<?php
|
|
printf(
|
|
/* translators: 1: is a link to a support document. 2: closing link */
|
|
esc_html__( 'Your installation of D5 Admin WP is working, %1$splease refer to this document%2$s to set up your development environment.', 'd5-admin-wp' ),
|
|
'<a href="' . esc_url( 'https://link.com/thing' ) . '" target="_blank" rel="noopener noreferrer">',
|
|
'</a>'
|
|
);
|
|
?>
|
|
</p>
|
|
</div>
|
|
<?php
|
|
}
|
|
);
|
|
|
|
|
|
|
|
|
|
// Styles and Scripts
|
|
function register_d5aw_scripts() {
|
|
|
|
$scriptversion = filemtime( plugin_dir_path( __FILE__ ) . 'js/d5aw-scripts.js');
|
|
$styleversion = filemtime( plugin_dir_path( __FILE__ ) . 'css/d5aw-style.css');
|
|
|
|
wp_enqueue_style( 'd5aw-main-style', plugins_url( '/css/d5aw-style.css' , __FILE__ ), array(), $styleversion );
|
|
wp_register_script( 'd5aw-main-scripts', plugins_url( '/js/d5aw-scripts.js' , __FILE__ ), array(),$scriptversion, true );
|
|
wp_enqueue_script( 'jquery' );
|
|
wp_localize_script( 'd5aw-main-scripts', 'd5aw', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
|
|
}
|
|
|
|
//add_action( 'wp_enqueue_scripts', 'register_d5aw_scripts' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Updater Functions
|
|
*
|
|
* Uses: https://github.com/YahnisElsts/plugin-update-checker
|
|
*
|
|
* Requires PuC folder and vendor folder as well as
|
|
* plugin-update-checker.php file
|
|
*
|
|
*/
|
|
require 'plugin-update-checker-5.4/plugin-update-checker.php';
|
|
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
|
|
|
|
$myUpdateChecker = PucFactory::buildUpdateChecker(
|
|
'http://24.57.69.148/d5-admin-wp.json',
|
|
__FILE__, //Full path to the main plugin file or functions.php.
|
|
'd5-admin-wp'
|
|
);
|
|
|