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
1
 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
1
/**
 * 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
0
 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();
     }
 }
 /**
  * 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
0
/**
 * 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
0
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);
    }
}
 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
0
 /**
  * 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
0
 /**
  * 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);
     }
 }
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');
}
 /**
  * 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
0
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
0
 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();
     }
 }
 /**
  * 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/');
 }
예제 #16
0
 function __construct()
 {
     $this->load_default_options();
     // register text domain
     load_plugin_textdomain('yarpp', false, dirname(plugin_basename(__FILE__)) . '/lang');
     // load cache object
     require_once YARPP_DIR . '/class-cache.php';
     require_once YARPP_DIR . '/cache-' . YARPP_CACHE_TYPE . '.php';
     $this->storage_class = $yarpp_storage_class;
     $this->cache = new $this->storage_class($this);
     $this->cache_bypass = new YARPP_Cache_Bypass($this);
     register_activation_hook(__FILE__, array($this, 'activate'));
     // update cache on save
     add_action('save_post', array($this->cache, 'save_post'));
     // new in 3.2: update cache on delete
     add_action('delete_post', array($this->cache, 'delete_post'));
     // new in 3.2.1: handle post_status transitions
     add_action('transition_post_status', array($this->cache, 'transition_post_status'), 10, 3);
     // automatic display hooks:
     add_filter('the_content', array($this, 'the_content'), 1200);
     add_filter('the_content_rss', array($this, 'the_content_rss'), 600);
     add_filter('the_excerpt_rss', array($this, 'the_excerpt_rss'), 600);
     if (isset($_REQUEST['yarpp_debug'])) {
         $this->debug = true;
     }
     // new in 3.4: only load UI if we're in the admin
     if (is_admin()) {
         require_once YARPP_DIR . '/class-admin.php';
         $this->admin = new YARPP_Admin($this);
     }
 }
 function piwiktracking_plugin_action_links($links, $file)
 {
     if ($file == plugin_basename(dirname(__FILE__) . '/piwiktracking.php')) {
         $links[] = '<a href="options-general.php?page=piwiktracking-settings-page">' . __('Settings') . '</a>';
     }
     return $links;
 }
예제 #18
0
 function save_postdata()
 {
     $post_id = $_POST['post_ID'];
     foreach ($this->options as $option) {
         if (!wp_verify_nonce($_POST[$this->boxinfo['id'] . '_noncename'], plugin_basename(__FILE__))) {
             return $post_id;
         }
         //判断权限
         if ('page' == $_POST['post_type']) {
             if (!current_user_can('edit_page', $post_id)) {
                 return $post_id;
             }
         } else {
             if (!current_user_can('edit_post', $post_id)) {
                 return $post_id;
             }
         }
         //将预定义字符转换为html实体
         $data = htmlspecialchars($_POST[$option['id']], ENT_QUOTES, "UTF-8");
         if (get_post_meta($post_id, $option['id']) == "") {
             add_post_meta($post_id, $option['id'], $data, true);
         } elseif ($data != get_post_meta($post_id, $option['id'], true)) {
             update_post_meta($post_id, $option['id'], $data);
         } elseif ($data == "") {
             delete_post_meta($post_id, $option['id'], get_post_meta($post_id, $option['id'], true));
         }
     }
 }
예제 #19
0
 private function __construct($slug)
 {
     $this->_slug = $slug;
     $this->_logger = FS_Logger::get_logger(WP_FS__SLUG . '_' . $slug, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK);
     $bt = debug_backtrace();
     $i = 1;
     while ($i < count($bt) - 1 && false !== strpos($bt[$i]['file'], DIRECTORY_SEPARATOR . 'freemius' . DIRECTORY_SEPARATOR)) {
         $i++;
     }
     $this->_plugin_main_file_path = $bt[$i]['file'];
     $this->_plugin_dir_path = plugin_dir_path($this->_plugin_main_file_path);
     $this->_plugin_basename = plugin_basename($this->_plugin_main_file_path);
     $this->_plugin_data = get_plugin_data($this->_plugin_main_file_path);
     $base_name_split = explode('/', $this->_plugin_basename);
     $this->_plugin_dir_name = $base_name_split[0];
     if ($this->_logger->is_on()) {
         $this->_logger->info('plugin_main_file_path = ' . $this->_plugin_main_file_path);
         $this->_logger->info('plugin_dir_path = ' . $this->_plugin_dir_path);
         $this->_logger->info('plugin_basename = ' . $this->_plugin_basename);
         $this->_logger->info('plugin_dir_name = ' . $this->_plugin_dir_name);
     }
     // Hook to plugin activation
     register_activation_hook($this->_plugin_main_file_path, array(&$this, '_activate_plugin_event'));
     // Hook to plugin uninstall.
     register_uninstall_hook($this->_plugin_main_file_path, array('Freemius', '_uninstall_plugin'));
     $this->_load_account();
 }
 private function __construct()
 {
     $this->plugin_settings = get_option('wpmm_settings');
     $this->plugin_basename = plugin_basename(WPMM_PATH . $this->plugin_slug . '.php');
     // Load plugin text domain
     add_action('init', array($this, 'load_plugin_textdomain'));
     // Add shortcodes
     add_action('init', array('WP_Maintenance_Mode_Shortcodes', 'init'));
     // Activate plugin when new blog is added
     add_action('wpmu_new_blog', array($this, 'activate_new_site'));
     // Check update
     add_action('admin_init', array($this, 'check_update'));
     if (!empty($this->plugin_settings['general']['status']) && $this->plugin_settings['general']['status'] == 1) {
         // INIT
         add_action('init', array($this, 'init'));
         // Add ajax methods
         add_action('wp_ajax_nopriv_wpmm_add_subscriber', array($this, 'add_subscriber'));
         add_action('wp_ajax_wpmm_add_subscriber', array($this, 'add_subscriber'));
         add_action('wp_ajax_nopriv_wpmm_send_contact', array($this, 'send_contact'));
         add_action('wp_ajax_wpmm_send_contact', array($this, 'send_contact'));
         // Redirect
         add_action('admin_init', array($this, 'redirect'));
         // Google Analytics tracking script
         if (!empty($this->plugin_settings['modules']['ga_status']) && $this->plugin_settings['modules']['ga_status'] == 1 && !empty($this->plugin_settings['modules']['ga_code'])) {
             add_action('wpmm_head', create_function('', 'echo "' . stripslashes($this->plugin_settings['modules']['ga_code']) . '";'));
         }
     }
 }
예제 #21
0
파일: premise.php 프로젝트: juslee/e27
 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/');
 }
 /**
  * Internationalization setup
  *
  * @return void
  */
 public function i18n()
 {
     $domain = 'better-blockquotes';
     $locale = apply_filters('plugin_locale', get_locale(), $domain);
     load_textdomain($domain, WP_LANG_DIR . "/tinymce-email-button/{$domain}-{$locale}.mo");
     load_plugin_textdomain($domain, false, dirname(plugin_basename(__FILE__)) . '/languages/');
 }
예제 #23
0
 /**
  * Constructor for a new breadcrumb_navxt object
  * 
  * @param bcn_breadcrumb_trail $breadcrumb_trail An instance of a bcn_breadcrumb_trail object to use for everything
  */
 public function __construct(bcn_breadcrumb_trail $breadcrumb_trail)
 {
     //We get our breadcrumb trail object from our constructor
     $this->breadcrumb_trail = $breadcrumb_trail;
     //Grab defaults from the breadcrumb_trail object
     $this->opt = $this->breadcrumb_trail->opt;
     //We set the plugin basename here
     $this->plugin_basename = plugin_basename(__FILE__);
     //We need to add in the defaults for CPTs and custom taxonomies after all other plugins are loaded
     add_action('wp_loaded', array($this, 'wp_loaded'));
     add_action('init', array($this, 'init'));
     //Register the WordPress 2.8 Widget
     add_action('widgets_init', create_function('', 'return register_widget("' . $this->unique_prefix . '_widget");'));
     //Load our network admin if in the network dashboard (yes is_network_admin() doesn't exist)
     if (defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) {
         require_once dirname(__FILE__) . '/class.bcn_network_admin.php';
         //Instantiate our new admin object
         $this->admin = new bcn_network_admin($this->breadcrumb_trail, $this->plugin_basename);
     } else {
         if (is_admin()) {
             require_once dirname(__FILE__) . '/class.bcn_admin.php';
             //Instantiate our new admin object
             $this->admin = new bcn_admin($this->breadcrumb_trail, $this->plugin_basename);
         }
     }
 }
function wp_migrate_db_pro_media_files_init()
{
    if (!class_exists('WPMDBPro_Addon')) {
        return;
    }
    load_plugin_textdomain('wp-migrate-db-pro-media-files', false, dirname(plugin_basename(__FILE__)) . '/languages/');
}
예제 #25
0
파일: init.php 프로젝트: GolgoSoft/KeenerWP
function ywctm_premium_init()
{
    /* Load YWCTM text domain */
    load_plugin_textdomain('ywctm', false, dirname(plugin_basename(__FILE__)) . '/languages/');
    global $YITH_WC_Catalog_Mode;
    $YITH_WC_Catalog_Mode = new YITH_WC_Catalog_Mode_Premium();
}
 /**
  * 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'));
 }
예제 #27
0
 public function activate()
 {
     if (!in_array('woocommerce/woocommerce.php', get_option('active_plugins')) || !defined('WC_VERSION') || !version_compare(WC_VERSION, '2.6', '>=')) {
         deactivate_plugins(plugin_basename(__FILE__));
         wp_die(sprintf(__('Для работы плагина eDostavka нужно установить %s! не ниже 2.6 версии'), '<a href="http://wordpress.org/extend/plugins/woocommerce/">WooCommerce</a>'));
     }
 }
 function __construct($plugin_file_path)
 {
     $this->plugin_file_path = $plugin_file_path;
     $this->plugin_dir_path = rtrim(plugin_dir_path($plugin_file_path), '/');
     $this->plugin_basename = plugin_basename($plugin_file_path);
     $this->plugin_version = $GLOBALS['afro_meta'][$this->plugin_slug]['version'];
 }
예제 #29
0
 /**
  * Class contructor
  *
  * @since   0.2
  **/
 public function __construct()
 {
     // activation ##
     register_activation_hook(__FILE__, array($this, 'register_activation_hook'));
     // deactivation ##
     register_deactivation_hook(__FILE__, array($this, 'register_deactivation_hook'));
     // uninstall ##
     // TODO ##
     // load in mobile detect class ##
     if (!class_exists('Mobile_Detect')) {
         include Q_BROWSERS_PATH . '/library/mobile_detect.php';
     }
     // instatiate class ##
     $this->detect = new Mobile_Detect();
     $this->detect->setDetectionType('extended');
     // extended search ##
     // grab user agent ##
     $this->useragent = $_SERVER['HTTP_USER_AGENT'] ? $_SERVER['HTTP_USER_AGENT'] : false;
     if (is_admin()) {
         // text-domain ##
         add_action('plugins_loaded', array($this, 'load_plugin_textdomain'), 1);
         // plugin URL ##
         $this->plugin_URL = WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__));
         $this->plugin_dir_path = plugin_dir_url(__FILE__);
     } else {
         // conditional stylesheets for browser tweaks ##
         add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_conditional'), 10000000);
         // load them late ##
         // browser body_class ##
         add_filter('body_class', array($this, 'body_classes'), 1);
         // comments ##
         add_action('wp_footer', array($this, 'comments'), 1000);
     }
 }
예제 #30
0
 function postHighlights()
 {
     $pluginFolder = plugin_basename(dirname(__FILE__));
     load_plugin_textdomain('ph', "wp-content/plugins/{$pluginFolder}/languages", "{$pluginFolder}/languages");
     $this->basepath = WP_CONTENT_DIR . "/plugins/{$pluginFolder}/";
     $this->baseurl = WP_CONTENT_URL . "/plugins/{$pluginFolder}/";
     $this->optionsPrefix = 'post_highlights_';
     $this->custom_thumb_name = 'posthighlightscustomthumb';
     $this->checkForOldSettings();
     $this->loadTheme();
     register_deactivation_hook(__FILE__, array(&$this, 'ph_deactivate'));
     if (current_user_can('manage-post-highlights')) {
         add_action('admin_print_scripts-edit.php', array(&$this, 'addJS'));
         add_action('admin_print_styles-edit.php', array(&$this, 'addCSS'));
         add_action('admin_print_scripts-edit-pages.php', array(&$this, 'addJS'));
         add_action('admin_print_styles-edit-pages.php', array(&$this, 'addCSS'));
         add_action('manage_posts_custom_column', array(&$this, 'highlight_It'), 10, 2);
         add_filter('manage_posts_columns', array(&$this, 'add_column'));
         add_action('manage_pages_custom_column', array(&$this, 'highlight_It'), 10, 2);
         add_filter('manage_pages_columns', array(&$this, 'add_column'));
         add_action('restrict_manage_posts', array(&$this, 'posts_filter'));
         add_action('admin_print_scripts-toplevel_page_post-highlights', array(&$this, 'addJS'));
         add_action('admin_print_styles-toplevel_page_post-highlights', array(&$this, 'addCSS'));
         global $pagenow;
         if ($pagenow == 'edit.php' && isset($_GET['showhighlighted'])) {
             query_posts('meta_key=ph_order&orderby=meta_value&order=ASC&m=' . $_GET['m'] . '&cat=' . $_GET['cat'] . '&paged=' . $_GET['paged']);
         }
     }
     add_action('admin_menu', array(&$this, 'add_options_page'));
     add_action('admin_init', array(&$this, 'global_settings'));
     if ($this->get_option('custom_thumb')) {
         add_filter('intermediate_image_sizes', array(&$this, 'register_custom_thumb'));
     }
 }