本文整理汇总了PHP中plugin_dir_path函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin_dir_path函数的具体用法?PHP plugin_dir_path怎么用?PHP plugin_dir_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plugin_dir_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
define('job_bm_plugin_url', WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/');
define('job_bm_plugin_dir', plugin_dir_path(__FILE__));
define('job_bm_wp_url', 'https://wordpress.org/plugins/job-board-manager/');
define('job_bm_wp_reviews', 'http://wordpress.org/support/view/plugin-reviews/job-board-manager');
define('job_bm_pro_url', 'http://www.pickplugins.com/item/job-board-manager-create-job-site-for-wordpress/');
define('job_bm_demo_url', 'www.pickplugins.com/demo/job-board-manager/');
define('job_bm_conatct_url', 'http://www.pickplugins.com/contact/');
define('job_bm_qa_url', 'http://www.pickplugins.com/questions/');
define('job_bm_plugin_name', 'Job Board Manager');
define('job_bm_plugin_version', '1.0.11');
define('job_bm_customer_type', 'free');
// pro & free
define('job_bm_share_url', 'https://wordpress.org/plugins/job-board-manager/');
define('job_bm_tutorial_video_url', '//www.youtube.com/embed/Z-ZzJiyVNJ4?rel=0');
// Class
require_once plugin_dir_path(__FILE__) . 'includes/class-post-types.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-post-meta.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-shortcodes.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-functions.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-settings.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-emails.php';
//Front-end Forms Input Class
require_once plugin_dir_path(__FILE__) . 'includes/class-frontend-forms-input.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-frontend-form-edit-job.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-frontend-form-new-job.php';
require_once plugin_dir_path(__FILE__) . 'includes/ajax-upload.php';
// Function's
require_once plugin_dir_path(__FILE__) . 'includes/functions.php';
add_action('admin_enqueue_scripts', 'wp_enqueue_media');
add_action('wp_enqueue_scripts', array($this, 'job_bm_front_scripts'));
add_action('admin_enqueue_scripts', array($this, 'job_bm_admin_scripts'));
}
示例2: cherry_plugin_settings
function cherry_plugin_settings()
{
global $wpdb;
if (!function_exists('get_plugin_data')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$upload_dir = wp_upload_dir();
$plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . 'cherry-plugin.php');
//Cherry plugin constant variables
define('CHERRY_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('CHERRY_PLUGIN_URL', plugin_dir_url(__FILE__));
define('CHERRY_PLUGIN_DOMAIN', $plugin_data['TextDomain']);
define('CHERRY_PLUGIN_DOMAIN_DIR', $plugin_data['DomainPath']);
define('CHERRY_PLUGIN_VERSION', $plugin_data['Version']);
define('CHERRY_PLUGIN_NAME', $plugin_data['Name']);
define('CHERRY_PLUGIN_SLUG', plugin_basename(__FILE__));
define('CHERRY_PLUGIN_DB', $wpdb->prefix . CHERRY_PLUGIN_DOMAIN);
define('CHERRY_PLUGIN_REMOTE_SERVER', esc_url('http://tmbhtest.com/cherryframework.com/components_update/'));
//Other constant variables
define('CURRENT_THEME_DIR', get_stylesheet_directory());
define('CURRENT_THEME_URI', get_stylesheet_directory_uri());
define('UPLOAD_BASE_DIR', str_replace("\\", "/", $upload_dir['basedir']));
define('UPLOAD_DIR', str_replace("\\", "/", $upload_dir['path'] . '/'));
// if ( !defined('API_URL') ) {
// define( 'API_URL', esc_url( 'http://updates.cherry.template-help.com/cherrymoto/v3/api/' ) );
// }
load_plugin_textdomain(CHERRY_PLUGIN_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/' . CHERRY_PLUGIN_DOMAIN_DIR);
do_action('cherry_plugin_settings');
}
示例3: __construct
/**
* Constructor for the Anthologize class
*
* This constructor does the following:
* - Checks minimum PHP and WP version, and bails if they're not met
* - Includes Anthologize's main files
* - Sets up the basic hooks that initialize Anthologize's post types and UI
*
* @since 0.7
*/
public function __construct()
{
// Bail if PHP version is not at least 5.0
if (!self::check_minimum_php()) {
add_action('admin_notices', array('Anthologize', 'phpversion_nag'));
return;
}
// Bail if WP version is not at least 3.3
if (!self::check_minimum_wp()) {
add_action('admin_notices', array('Anthologize', 'wpversion_nag'));
}
// If we've made it this far, start initializing Anthologize
register_activation_hook(__FILE__, array($this, 'activation'));
register_deactivation_hook(__FILE__, array($this, 'deactivation'));
// @todo WP's functions plugin_basename() etc don't work
// correctly on symlinked setups, so I'm implementing my own
$bn = explode(DIRECTORY_SEPARATOR, dirname(__FILE__));
$this->basename = array_pop($bn);
$this->plugin_dir = plugin_dir_path(__FILE__);
$this->plugin_url = plugin_dir_url(__FILE__);
$this->includes_dir = trailingslashit($this->plugin_dir . 'includes');
$upload_dir = wp_upload_dir();
$this->cache_dir = trailingslashit($upload_dir['basedir'] . '/anthologize-cache');
$this->cache_url = trailingslashit($upload_dir['baseurl'] . '/anthologize-cache');
$this->setup_constants();
$this->includes();
$this->setup_hooks();
}
示例4: __construct
/**
* Constructor - get the plugin hooked in and ready
*/
public function __construct()
{
// Define constants
define('JOB_MANAGER_VERSION', '1.23.9');
define('JOB_MANAGER_PLUGIN_DIR', untrailingslashit(plugin_dir_path(__FILE__)));
define('JOB_MANAGER_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
// Includes
include 'includes/class-wp-job-manager-install.php';
include 'includes/class-wp-job-manager-post-types.php';
include 'includes/class-wp-job-manager-ajax.php';
include 'includes/class-wp-job-manager-shortcodes.php';
include 'includes/class-wp-job-manager-api.php';
include 'includes/class-wp-job-manager-forms.php';
include 'includes/class-wp-job-manager-geocode.php';
include 'includes/class-wp-job-manager-cache-helper.php';
if (is_admin()) {
include 'includes/admin/class-wp-job-manager-admin.php';
}
// Init classes
$this->forms = new WP_Job_Manager_Forms();
$this->post_types = new WP_Job_Manager_Post_Types();
// Activation - works with symlinks
register_activation_hook(basename(dirname(__FILE__)) . '/' . basename(__FILE__), array($this, 'activate'));
// Switch theme
add_action('after_switch_theme', array('WP_Job_Manager_Ajax', 'add_endpoint'), 10);
add_action('after_switch_theme', array($this->post_types, 'register_post_types'), 11);
add_action('after_switch_theme', 'flush_rewrite_rules', 15);
// Actions
add_action('after_setup_theme', array($this, 'load_plugin_textdomain'));
add_action('after_setup_theme', array($this, 'include_template_functions'), 11);
add_action('widgets_init', array($this, 'widgets_init'));
add_action('wp_enqueue_scripts', array($this, 'frontend_scripts'));
add_action('admin_init', array($this, 'updater'));
}
示例5: init
/**
* Init plugin after all plugins has been loaded
*/
function init()
{
// Load Divi 100 Setup
require_once plugin_dir_path(__FILE__) . 'divi-100-setup/divi-100-setup.php';
// Load Hamburger Menu
ET_Divi_100_Custom_Hamburger_Menu::instance();
}
示例6: constants
/**
* Bootstrap constants.
*
*/
private function constants()
{
// define plugin translation string
if (!defined('BP_API_PLUGIN_SLUG')) {
define('BP_API_PLUGIN_SLUG', 'bp_api');
}
// define api endpint prefix
if (!defined('BP_API_SLUG')) {
define('BP_API_SLUG', 'bp');
}
// Define a constant that can be checked to see if the component is installed or not.
if (!defined('BP_API_IS_INSTALLED')) {
define('BP_API_IS_INSTALLED', 1);
}
// Define a constant that will hold the current version number of the component
// This can be useful if you need to run update scripts or do compatibility checks in the future
if (!defined('BP_API_VERSION')) {
define('BP_API_VERSION', '0.1');
}
// Define a constant that we can use to construct file paths and url
if (!defined('BP_API_PLUGIN_DIR')) {
define('BP_API_PLUGIN_DIR', trailingslashit(plugin_dir_path(__FILE__)));
}
if (!defined('BP_API_PLUGIN_URL')) {
$plugin_url = plugin_dir_url(__FILE__);
// If we're using https, update the protocol. Workaround for WP13941, WP15928, WP19037.
if (is_ssl()) {
$plugin_url = str_replace('http://', 'https://', $plugin_url);
}
define('BP_API_PLUGIN_URL', $plugin_url);
}
}
示例7: plugin_path
function plugin_path()
{
if ($this->plugin_path) {
return $this->plugin_path;
}
return $this->plugin_path = untrailingslashit(plugin_dir_path(__FILE__));
}
示例8: filebrowser_options_load
function filebrowser_options_load()
{
global $filebrowser_message, $gotofolder;
$gotofolder = str_replace('\\', '/', ABSPATH);
if (!current_user_can(10)) {
wp_die('No rights');
}
//Css for Admin Section
wp_enqueue_style('FileBrowser', plugins_url('/css/options.css', __FILE__), '', FILEBROWSER_VERSION, 'screen');
if ($_GET['action'] == 'edit') {
wp_enqueue_script('CodeMirror', plugins_url('/codemirror/js/codemirror.js', __FILE__), '', '0.70', false);
}
if ($_POST['action2'] != '-1') {
$action = $_POST['action2'];
}
if ($_POST['action'] != '-1') {
$action = $_POST['action'];
}
if (!empty($_GET['action']) and empty($action)) {
$action = $_GET['action'];
}
//For change folder by hand
if ($_POST['doactiongo'] == __('Go', 'filebrowser')) {
if (@is_dir(str_replace('\\', '/', realpath($_POST['root'] . $_POST['newfolder'])))) {
$gotofolder = str_replace('\\', '/', realpath($_POST['root'] . $_POST['newfolder']));
} else {
$gotofolder = $_POST['oldusedfolder'];
$filebrowser_message = __('Could not jump to folder.', 'filebrowser');
}
}
//For save Options
require_once plugin_dir_path(__FILE__) . 'options-save.php';
}
示例9: init
/**
* Konstruktor der Klasse
*
* @since 0.1
* @change 0.1
*/
public static function init()
{
/* Optionen */
$options = get_option('toolbox');
/* Sicherheit */
if (!empty($options['secure'])) {
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE or defined('DOING_CRON') && DOING_CRON or defined('DOING_AJAX') && DOING_AJAX or defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) {
return;
}
}
/* Init */
self::$plugin_path = plugin_basename(__FILE__);
self::$modules_path = plugin_dir_path(__FILE__) . 'modules/';
/* Module einbinden */
self::_require_modules($options);
/* Backend */
if (is_admin()) {
add_action('wpmu_new_blog', array(__CLASS__, 'install_later'));
add_action('delete_blog', array(__CLASS__, 'uninstall_later'));
add_action('admin_init', array(__CLASS__, 'register_settings'));
add_action('admin_menu', array(__CLASS__, 'add_page'));
add_filter('plugin_row_meta', array(__CLASS__, 'row_meta'), 10, 2);
add_filter('plugin_action_links_' . self::$plugin_path, array(__CLASS__, 'action_links'));
}
}
示例10: __construct
function __construct()
{
if (!defined('PREMISE_VERSION')) {
define('PREMISE_VERSION', '2.2.1');
define('PREMISE_SETTINGS_FIELD', $this->_metakey_Settings);
define('PREMISE_DIR', plugin_dir_path(__FILE__));
define('PREMISE_URL', plugin_dir_url(__FILE__));
define('PREMISE_BASENAME', plugin_basename(__FILE__));
define('PREMISE_LIB_DIR', PREMISE_DIR . 'lib/');
define('PREMISE_THEMES_DIR', PREMISE_DIR . 'themes/');
define('PREMISE_THEMES_URL', PREMISE_URL . 'themes/');
define('PREMISE_VIEWS_DIR', PREMISE_DIR . 'views/');
define('PREMISE_RESOURCES_URL', PREMISE_URL . 'resources/');
define('PREMISE_POST_TYPE', 'landing_page');
define('PREMISE_MEMBER_DIR', PREMISE_DIR . 'member-access/');
define('PREMISE_MEMBER_INCLUDES_DIR', PREMISE_MEMBER_DIR . 'includes/');
}
$settings = $this->get_settings();
if (!empty($settings['main']['member-access']) && '1' == $settings['main']['member-access']) {
require_once PREMISE_LIB_DIR . 'functions.php';
require_once PREMISE_LIB_DIR . 'class-admin.php';
require_once PREMISE_MEMBER_DIR . 'member-access.php';
}
$this->_use_premise_theme = empty($settings['main']['theme-support']) || $settings['main']['theme-support'] != '1';
add_filter('generate_rewrite_rules', array($this, 'generate_rewrite_rules'));
add_action('setup_theme', array($this, 'register_post_type'));
if (!is_admin()) {
add_action('setup_theme', array($this, 'setup_theme'), 11);
}
add_action('init', array($this, 'init'));
add_action('update_option_' . $this->_option_DesignSettings, array($this, 'create_stylesheets'), 11, 2);
add_filter('post_type_link', array($this, 'post_type_link'), 10, 3);
load_plugin_textdomain('premise', false, '/premise/languages/');
}
示例11: easychangelog_require
function easychangelog_require()
{
$files = array('class-easychangelog', 'class-easychangelog-output', 'class-easychangelog-posttype', 'class-easychangelog-settings');
foreach ($files as $file) {
require plugin_dir_path(__FILE__) . 'includes/' . $file . '.php';
}
}
示例12: __construct
function __construct($plugin_file_path)
{
$this->load_settings();
$this->maybe_schema_update();
$this->plugin_file_path = $plugin_file_path;
$this->plugin_dir_path = plugin_dir_path($plugin_file_path);
$this->plugin_folder_name = basename($this->plugin_dir_path);
$this->plugin_basename = plugin_basename($plugin_file_path);
$this->template_dir = $this->plugin_dir_path . 'template' . DIRECTORY_SEPARATOR;
$this->plugin_title = ucwords(str_ireplace('-', ' ', basename($plugin_file_path)));
$this->plugin_title = str_ireplace(array('db', 'wp', '.php'), array('DB', 'WP', ''), $this->plugin_title);
// We need to set $this->plugin_slug here because it was set here
// in Media Files prior to version 1.1.2. If we remove it the customer
// cannot upgrade, view release notes, etc
// used almost exclusively as a identifier for plugin version checking (both core and addons)
$this->plugin_slug = basename($plugin_file_path, '.php');
// used to add admin menus and to identify the core version in the $GLOBALS['wpmdb_meta'] variable for delicious brains api calls, version checking etc
$this->core_slug = $this->is_pro || $this->is_addon ? 'wp-migrate-db-pro' : 'wp-migrate-db';
if (is_multisite()) {
$this->plugin_base = 'settings.php?page=' . $this->core_slug;
} else {
$this->plugin_base = 'tools.php?page=' . $this->core_slug;
}
if ($this->is_addon || $this->is_pro) {
$this->pro_addon_construct();
}
add_action('init', array($this, 'load_plugin_textdomain'));
}
示例13: __construct
/**
* Constructor
*/
function __construct()
{
$this->id = 'new_switch_order';
$this->title = __('Subscription Switched', 'woocommerce-subscriptions');
$this->description = __('Subscription switched emails are sent when a customer switches a subscription.', 'woocommerce-subscriptions');
$this->heading = __('Subscription Switched', 'woocommerce-subscriptions');
$this->subject = __('[{blogname}] Subscription Switched ({order_number}) - {order_date}', 'woocommerce-subscriptions');
$this->template_html = 'emails/admin-new-switch-order.php';
$this->template_plain = 'emails/plain/admin-new-switch-order.php';
$this->template_base = plugin_dir_path(WC_Subscriptions::$plugin_file) . 'templates/';
// Triggers for this email
add_action('woocommerce_order_status_pending_to_processing_switch_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_pending_to_completed_switch_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_pending_to_on-hold_switch_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_processing_switch_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_completed_switch_notification', array($this, 'trigger'));
add_action('woocommerce_order_status_failed_to_on-hold_switch_notification', array($this, 'trigger'));
// We want all the parent's methods, with none of its properties, so call its parent's constructor, rather than my parent constructor
WC_Email::__construct();
// Other settings
$this->recipient = $this->get_option('recipient');
if (!$this->recipient) {
$this->recipient = get_option('admin_email');
}
}
示例14: __construct
/**
* Initialize the plugin by loading admin scripts & styles and adding a
* settings page and menu.
*
* @since 1.0.0
*/
private function __construct()
{
/*
* Call $plugin_slug from public plugin class.
*
* TODO:
*
* - Rename "Really_Big_Files" to the name of your initial plugin class
*
*/
$plugin = Really_Big_Files::get_instance();
$this->plugin_slug = $plugin->get_plugin_slug();
// Load admin style sheet and JavaScript.
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
// Add the options page and menu item.
add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
add_action('admin_init', array($this, 'register_rbfsettings'));
// Add an action link pointing to the options page.
$plugin_basename = plugin_basename(plugin_dir_path(__FILE__) . $this->plugin_slug . '.php');
add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_action_links'));
/*
* Define custom functionality.
*
* Read more about actions and filters:
* http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
*/
add_action('TODO', array($this, 'action_method_name'));
add_filter('TODO', array($this, 'filter_method_name'));
}
示例15: cf_slack_register_processor
function cf_slack_register_processor($pr)
{
$pr['slack'] = array("name" => __('Slack: Message', 'cf-slack'), "description" => __("Post a message to slack on submission", 'cf-slack'), "author" => 'David Cramer', "author_url" => 'https://Calderawp.com', "icon" => plugin_dir_url(__FILE__) . "icon.png", "processor" => 'cf_send_slack_message', "template" => plugin_dir_path(__FILE__) . "config.php");
//@since 1.1.0
$pr['slack-invite'] = array("name" => __('Slack: Invite', 'cf-slack'), "description" => __("Send a Slack Invite", 'cf-slack'), "author" => 'Josh Pollock', "author_url" => 'https://Calderawp.com', "icon" => plugin_dir_url(__FILE__) . "icon.png", "processor" => 'cf_slack_send_invite', "template" => plugin_dir_path(__FILE__) . "config-invite.php");
return $pr;
}