本文整理汇总了PHP中plugin_basename函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin_basename函数的具体用法?PHP plugin_basename怎么用?PHP plugin_basename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plugin_basename函数的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: _wprp_upgrade_plugin
/**
* Update a plugin
*
* @access private
* @param mixed $plugin
* @return array
*/
function _wprp_upgrade_plugin($plugin)
{
include_once ABSPATH . 'wp-admin/includes/admin.php';
if (!_wprp_supports_plugin_upgrade()) {
return array('status' => 'error', 'error' => 'WordPress version too old for plugin upgrades');
}
$skin = new WPRP_Plugin_Upgrader_Skin();
$upgrader = new Plugin_Upgrader($skin);
$is_active = is_plugin_active($plugin);
// Do the upgrade
ob_start();
$result = $upgrader->upgrade($plugin);
$data = ob_get_contents();
ob_clean();
if (!$result && !is_null($result) || $data) {
return array('status' => 'error', 'error' => 'file_permissions_error');
} elseif (is_wp_error($result)) {
return array('status' => 'error', 'error' => $result->get_error_code());
}
if ($skin->error) {
return array('status' => 'error', 'error' => $skin->error);
}
// If the plugin was activited, we have to re-activate it
// @todo Shouldn't this use activate_plugin?
if ($is_active) {
$current = get_option('active_plugins', array());
$current[] = plugin_basename(trim($plugin));
sort($current);
update_option('active_plugins', $current);
}
return array('status' => 'success');
}
示例4: page_metabox_save
function page_metabox_save($post_id)
{
if (isset($_POST['nonce_page_metabox'])) {
// Autosave, do nothing
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
// Ajax not used here
if (defined('DOING_AJAX') && DOING_AJAX) {
return;
}
// Check user permissions
if (!current_user_can('edit_post', $post_id)) {
return;
}
// Return if it's a post revision
if (false !== wp_is_post_revision($post_id)) {
return;
}
// verify this came from the our screen and with proper authorization
if (!wp_verify_nonce($_POST['nonce_page_metabox'], plugin_basename(__FILE__))) {
return;
}
// OK, we're authenticated
global $md_metabox;
$form_helper = new FORM_HELPER($post_id, $md_metabox);
$form_helper->metabox_save();
}
}
示例5: action_init
/**
* Load languages and a bit of paranoia
*/
function action_init()
{
load_plugin_textdomain('frontend-uploader', false, dirname(plugin_basename(__FILE__)) . '/languages/');
// Hooking to wp_ajax
add_action('wp_ajax_approve_ugc', array($this, 'approve_media'));
add_action('wp_ajax_approve_ugc_post', array($this, 'approve_post'));
add_action('wp_ajax_delete_ugc', array($this, 'delete_post'));
add_action('wp_ajax_upload_ugc', array($this, 'upload_content'));
add_action('wp_ajax_nopriv_upload_ugc', array($this, 'upload_content'));
// Adding media submenu
add_action('admin_menu', array($this, 'add_menu_items'));
// Currently supported shortcodes
add_shortcode('fu-upload-form', array($this, 'upload_form'));
add_shortcode('fu-upload-response', array($this, 'upload_response_shortcode'));
// Since 4.01 we need to explicitly disable texturizing of shortcode's inner content
add_filter('no_texturize_shortcodes', array($this, 'filter_no_texturize_shortcodes'));
// Static assets
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
// Unautop the shortcode
add_filter('the_content', 'shortcode_unautop', 100);
// Hiding not approved attachments from Media Gallery
// @since core 3.5-beta-1
add_filter('posts_where', array($this, 'filter_posts_where'));
$this->allowed_mime_types = $this->_get_mime_types();
// Configuration filter to change manage permissions
$this->manage_permissions = apply_filters('fu_manage_permissions', 'edit_posts');
// Debug mode filter
$this->is_debug = (bool) apply_filters('fu_is_debug', defined('WP_DEBUG') && WP_DEBUG);
add_filter('upload_mimes', array($this, '_get_mime_types'), 999);
// Maybe enable Akismet protection
$this->_enable_akismet_protection();
}
示例6: nktagcloud_init
/**
* Things to run during init hook
*
* @since 0.8.6
*/
function nktagcloud_init()
{
// http://codex.wordpress.org/Determining_Plugin_and_Content_Directories
// Pre-2.6 compatibility
if (!defined('WP_CONTENT_URL')) {
define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
}
if (!defined('WP_CONTENT_DIR')) {
define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
}
if (!defined('WP_PLUGIN_URL')) {
define('WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins');
}
if (!defined('WP_PLUGIN_DIR')) {
define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
}
global $nktagcloud;
$nktagcloud = array('path' => WP_PLUGIN_DIR . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)), 'url' => WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)));
// always needed for footer link
// TODO which footer link? we don't need this in admin, or do we?
require_once 'inc/page.php';
if (is_admin()) {
require_once 'inc/admin.php';
add_action('admin_menu', 'nktagcloud_add_pages');
register_widget_control(__('Better Tag Cloud', 'nktagcloud'), 'nktagcloud_control');
register_sidebar_widget(__('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud');
} else {
add_shortcode('nktagcloud', 'nktagcloud_shortcode');
add_shortcode('nktagcloud_single', 'nktagcloud_single_shortcode');
register_sidebar_widget(__('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud');
}
}
示例7: linkblog_save_post
function linkblog_save_post($post_id)
{
// Ignore if doing an autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
// verify data came from the linkblog meta box
if (!wp_verify_nonce($_POST['linkblog_noncename'], plugin_basename(__FILE__))) {
return;
}
// Check user permissions
if ('post' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id)) {
return;
}
} else {
if (!current_user_can('edit_post', $post_id)) {
return;
}
}
$linkblog_data = $_POST['linkblog_url'];
if ($linkblog_data == "") {
return;
} else {
update_post_meta($post_id, 'linkblog_url', $linkblog_data);
}
}
示例8: __construct
function __construct()
{
// If we're in the admin area, load the settings class
if (is_admin()) {
require dirname(__FILE__) . '/settings.php';
$settingsClass = new LazyLoadXTSettings();
// If this is the first time we've enabled the plugin, setup default settings
register_activation_hook(__FILE__, array($settingsClass, 'first_time_activation'));
add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($settingsClass, 'lazyloadxt_action_links'));
} else {
// Store our settings in memory to reduce mysql calls
$this->settings = $this->get_settings();
$this->dir = plugin_dir_url(__FILE__);
// The CDN has an older version
if ($this->settings['cdn']) {
$this->lazyloadxt_ver = '1.0.5';
}
// Enqueue Lazy Load XT scripts and styles
add_action('wp_enqueue_scripts', array($this, 'load_scripts'));
// Replace the 'src' attr with 'data-src' in the_content
add_filter('the_content', array($this, 'filter_html'));
// If enabled replace the 'src' attr with 'data-src' in text widgets
if ($this->settings['textwidgets']) {
add_filter('widget_text', array($this, 'filter_html'));
}
// If enabled replace the 'src' attr with 'data-src' in the_post_thumbnail
if ($this->settings['thumbnails']) {
add_filter('post_thumbnail_html', array($this, 'filter_html'));
}
// If enabled replace the 'src' attr with 'data-src' in the_post_thumbnail
if ($this->settings['avatars']) {
add_filter('get_avatar', array($this, 'filter_html'));
}
}
}
示例9: __construct
/**
* Class constructor.
*
* @param string $metadataUrl The URL of the plugin's metadata file.
* @param string $pluginFile Fully qualified path to the main plugin file.
* @param string $slug The plugin's 'slug'. If not specified, the filename part of $pluginFile sans '.php' will be used as the slug.
* @param integer $checkPeriod How often to check for updates (in hours). Defaults to checking every 12 hours. Set to 0 to disable automatic update checks.
* @param string $optionName Where to store book-keeping info about update checks. Defaults to 'external_updates-$slug'.
* @param string $muPluginFile Optional. The plugin filename relative to the mu-plugins directory.
*/
public function __construct($metadataUrl, $pluginFile, $slug = '', $checkPeriod = 12, $optionName = '', $muPluginFile = '')
{
$this->metadataUrl = $metadataUrl;
$this->pluginAbsolutePath = $pluginFile;
$this->pluginFile = plugin_basename($this->pluginAbsolutePath);
$this->muPluginFile = $muPluginFile;
$this->checkPeriod = $checkPeriod;
$this->slug = $slug;
$this->optionName = $optionName;
$this->debugMode = defined('WP_DEBUG') && WP_DEBUG;
//If no slug is specified, use the name of the main plugin file as the slug.
//For example, 'my-cool-plugin/cool-plugin.php' becomes 'cool-plugin'.
if (empty($this->slug)) {
$this->slug = basename($this->pluginFile, '.php');
}
if (empty($this->optionName)) {
$this->optionName = 'external_updates-' . $this->slug;
}
//Backwards compatibility: If the plugin is a mu-plugin but no $muPluginFile is specified, assume
//it's the same as $pluginFile given that it's not in a subdirectory (WP only looks in the base dir).
if (empty($this->muPluginFile) && strpbrk($this->pluginFile, '/\\') === false && $this->isMuPlugin()) {
$this->muPluginFile = $this->pluginFile;
}
$this->installHooks();
}
示例10: save
/**
* Save the custom Status, used when posting to an Fan Page's Timeline
*
* @since 1.0
* @param int $post_id post identifier
*/
public static function save($post_id)
{
// verify if this is an auto save routine.
// If it is our form has not been submitted, so we dont want to do anything
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
// verify this came from the our screen and with proper authorization,
// because save_post can be triggered at other times
if (!isset($_POST[self::FIELD_MESSAGE]) || empty($_POST[self::NONCE_NAME]) || !wp_verify_nonce($_POST[self::NONCE_NAME], plugin_basename(__FILE__))) {
return;
}
// Check permissions
$post_type = get_post_type($post_id);
if (!($post_type && post_type_supports($post_type, 'author'))) {
return;
}
if (!class_exists('Facebook_Social_Publisher')) {
require_once dirname(__FILE__) . '/social_publisher.php';
}
$capability_singular_base = Facebook_Social_Publisher::post_type_capability_base($post_type);
if (!current_user_can('edit_' . $capability_singular_base, $post_id)) {
return;
}
$message = trim(sanitize_text_field($_POST[self::FIELD_MESSAGE]));
if ($message) {
update_post_meta($post_id, self::POST_META_KEY, $message);
}
}
示例11: kebo_twitter_plugin_setup
function kebo_twitter_plugin_setup()
{
/**
* Include Plugin Options.
*/
require_once KEBO_TWITTER_PLUGIN_PATH . 'inc/options.php';
/**
* Include Menu Page.
*/
require_once KEBO_TWITTER_PLUGIN_PATH . 'inc/menu.php';
/**
* Include Custom Widget.
*/
require_once KEBO_TWITTER_PLUGIN_PATH . 'inc/widget.php';
/**
* Include Request for the Twitter Feed.
*/
require_once KEBO_TWITTER_PLUGIN_PATH . 'inc/get_tweets.php';
/**
* Include Shortcode.
*/
require_once KEBO_TWITTER_PLUGIN_PATH . 'inc/shortcode.php';
/**
* Include AJAX.
*/
require_once KEBO_TWITTER_PLUGIN_PATH . 'inc/ajax.php';
/**
* Load Text Domain for Translations.
*/
load_plugin_textdomain('kebo_twitter', false, dirname(plugin_basename(__FILE__)) . '/languages');
}
示例12: __construct
/**
* Initialize the plugin by loading admin scripts & styles and adding a
* settings page and menu.
*
* @since 1.0.0
*/
private function __construct()
{
$this->plugin_slug = PT_CV_DOMAIN;
// Redirect to "Add View" page when click "Add new" link in "All Views" page
add_action('admin_init', array($this, 'redirect_add_new'));
// 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_action('admin_enqueue_scripts', array($this, 'remove_unwanted_assets'), 1000);
add_action('admin_print_footer_scripts', array($this, 'print_footer_scripts'));
// Add the options page and menu item.
add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
// Ajax action
$action = 'preview_request';
add_action('wp_ajax_' . $action, array('PT_CV_Functions', 'ajax_callback_' . $action));
// Output assets content at footer of page
add_action(PT_CV_PREFIX_ . 'preview_footer', array('PT_CV_Html', 'assets_of_view_types'));
// Add an action link pointing to the options page.
$plugin_basename = plugin_basename(PT_CV_PATH . $this->plugin_slug . '.php');
add_filter('plugin_action_links_' . $plugin_basename, array($this, 'filter_add_action_links'));
// Filter link of actions in All Views page
add_filter('post_row_actions', array($this, 'filter_view_row_actions'), 10, 2);
// Add Shortcode column
add_filter('manage_pt_view_posts_columns', array($this, 'filter_view_custom_column_header'));
add_action('manage_pt_view_posts_custom_column', array($this, 'action_view_custom_column_content'), 10, 2);
// Filter link of Title in All Views page
add_filter('get_edit_post_link', array($this, 'filter_get_edit_post_link'), 10, 3);
// Filter Title of Edit View page
add_filter('admin_title', array($this, 'filter_admin_title'), 10, 2);
// Custom hooks for both preview & frontend
PT_CV_Hooks::init();
// Custom settings page
PT_CV_Plugin::init();
}
示例13: cli_plugin_action_links
function cli_plugin_action_links($links, $file)
{
if ($file == plugin_basename(dirname(__FILE__) . '/customize-login-image.php')) {
$links[] = '<a href="' . admin_url('options-general.php?page=customize-login-image/customize-login-image-options.php') . '">' . __('Settings') . '</a>';
}
return $links;
}
示例14: __construct
public function __construct()
{
// manages plugin activation and deactivation
register_activation_hook(__FILE__, array(&$this, 'activate'));
register_deactivation_hook(__FILE__, array(&$this, 'deactivate'));
// stopping here if we are going to deactivate the plugin (avoids breaking rewrite rules)
if (isset($_GET['action'], $_GET['plugin']) && 'deactivate' == $_GET['action'] && plugin_basename(__FILE__) == $_GET['plugin']) {
return;
}
// loads the admin side of Polylang for the dashboard
if (defined('DOING_AJAX') && DOING_AJAX && isset($_REQUEST['action']) && 'lingotek_language' == $_REQUEST['action']) {
define('PLL_AJAX_ON_FRONT', false);
add_filter('pll_model', create_function('$c', 'return "PLL_Admin_Model";'));
}
spl_autoload_register(array(&$this, 'autoload'));
// autoload classes
// init
add_filter('pll_model', array(&$this, 'pll_model'));
add_action('init', array(&$this, 'init'));
add_action('admin_init', array(&$this, 'admin_init'));
// add Lingotek locale to languages
add_filter('pll_languages_list', array(&$this, 'pre_set_languages_list'));
// flag title
add_filter('pll_flag_title', array(&$this, 'pll_flag_title'), 10, 3);
// adds a pointer upon plugin activation to draw attention to Lingotek
if (!get_option('lingotek_token')) {
add_action('init', array(&$this, 'lingotek_activation_pointer'));
}
// adds extra plugin compatibility - borrowed from Polylang
if (!defined('LINGOTEK_PLUGINS_COMPAT') || LINGOTEK_PLUGINS_COMPAT) {
Lingotek_Plugins_Compat::instance();
}
}
示例15: load_textdomain
/**
* Load textdomain
*/
function load_textdomain()
{
$domain = 'wp_jwt_auth';
$locale = apply_filters('plugin_locale', get_locale(), $domain);
load_textdomain($domain, WP_LANG_DIR . '/wp-jwt-authentication/' . $domain . '-' . $locale . '.mo');
load_plugin_textdomain($domain, FALSE, dirname(plugin_basename(__FILE__)) . '/languages/');
}