/**
 * Calculate the document root where comics are stored.
 */
function cpm_calculate_document_root()
{
    global $wpmu_version;
    $document_root = "";
    if (cpm_option('cpm-use-old-subdirectory-method')) {
        $parsed_url = parse_url(get_option('home'));
        $translated_script_filename = str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']);
        foreach (array('SCRIPT_NAME', 'SCRIPT_URL') as $var_to_try) {
            $root_to_try = substr($translated_script_filename, 0, -strlen($_SERVER[$var_to_try])) . $parsed_url['path'];
            if (file_exists($root_to_try . '/index.php')) {
                $document_root = $root_to_try;
                break;
            }
        }
        if (is_null($document_root)) {
            $document_root = $_SERVER['DOCUMENT_ROOT'] . $parsed_url['path'];
        }
    } else {
        // a base document root to try and use
        if (isset($_SERVER['SCRIPT_FILENAME'])) {
            $document_root = dirname($_SERVER['SCRIPT_FILENAME']);
        }
        $cwd = getcwd();
        if ($cwd !== false) {
            // Strip the wp-admin part and just get to the root.
            $document_root = preg_replace('#[\\\\/]wp-(admin|content).*#', '', $cwd);
        }
        if (isset($wpmu_version)) {
            $document_root = cpm_wpmu_modify_path($document_root);
        }
    }
    return untrailingslashit($document_root);
}
Example #2
0
 public function admin_plugin_dir()
 {
     if ($this->admin_plugin_dir) {
         return $this->admin_plugin_dir;
     }
     return $this->admin_plugin_dir = untrailingslashit(plugin_dir_path(__FILE__));
 }
Example #3
0
 /**
  * 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'));
 }
Example #4
0
 /**
  *
  */
 function __construct()
 {
     parent::__construct(array('plural' => 'logs', 'singular' => 'log', 'ajax' => TRUE));
     $this->log_folder = get_site_option('backwpup_cfg_logfolder');
     $this->log_folder = BackWPup_File::get_absolute_path($this->log_folder);
     $this->log_folder = untrailingslashit($this->log_folder);
 }
Example #5
0
 public static function get_vendor_store_url($user = false)
 {
     if (!is_object($user)) {
         if ($user === false) {
             $user = get_current_user_id();
         }
         $user = new WP_User($user);
     }
     if (!$user || !is_object($user)) {
         $user = new WP_User(get_current_user_id());
     }
     $archive_page = EDD_FES()->vendors->use_author_archives();
     $name = get_userdata($user->ID);
     $user_nicename = apply_filters('fes_user_nicename_to_lower', strtolower($name->user_nicename), $user);
     if (empty($archive_page)) {
         $vendor_url = get_permalink(EDD_FES()->helper->get_option('fes-vendor-page', ''));
         $permalink = apply_filters('fes_adjust_vendor_url', untrailingslashit('vendor/'));
         $vendor_url = str_replace('fes-vendor/', $permalink, $vendor_url);
         $vendor_url = str_replace('vendor/', $permalink, $vendor_url);
         if (get_option('permalink_structure')) {
             $vendor_url = trailingslashit($vendor_url) . $user_nicename;
         } else {
             $vendor_url = add_query_arg('vendor', $user_nicename, $vendor_url);
         }
     } else {
         $vendor_url = get_author_posts_url($user->ID, $user_nicename);
     }
     return $vendor_url;
 }
Example #6
0
 function plugin_url()
 {
     if ($this->plugin_url) {
         return $this->plugin_url;
     }
     return $this->plugin_url = untrailingslashit(plugins_url('/', __FILE__));
 }
/**
 * @wp-hook wp_loaded
 */
function init()
{
    $autoload = __DIR__ . '/vendor/autoload.php';
    if (file_exists($autoload) && is_readable($autoload)) {
        require_once $autoload;
    }
    $log_dir = defined('IAC_DEBUGGER_LOG_DIR') ? IAC_DEBUGGER_LOG_DIR : WP_CONTENT_DIR . '/log';
    /**
     * @param string $log_dir
     *
     * @return string (Log directory)
     */
    $log_dir = untrailingslashit(apply_filters('iac_debugger_log_dir', $log_dir));
    try {
        $log_env = new WpLogEnvironment();
        $log_env->create_log_directory($log_dir);
        $log_env->add_htaccess_file($log_dir);
        $logger = build_logger($log_dir . '/iac-debug.log');
        $recipient_filter = new WpFilterRecipientFilter();
        $email_recorder = new PsrEmailRecorder($logger, $recipient_filter);
        $queue_recorder = new PsrQueueRecorder($logger, $recipient_filter);
        add_filter('iac_comment_headers', [$email_recorder, 'add_header_flag'], 10, 3);
        add_filter('iac_post_headers', [$email_recorder, 'add_header_flag'], 10, 3);
        add_filter('wp_mail', [$email_recorder, 'record_send_mail']);
        add_action('wp_mail_failed', [$email_recorder, 'record_mail_error']);
        add_filter('iac_email_address_chunk', [$queue_recorder, 'record_email_chunk'], 10, 3);
        add_filter('schedule_event', [$queue_recorder, 'record_schedule_event']);
        add_action('iac_schedule_send_chunks', [$queue_recorder, 'record_scheduled_event_call'], 1, 3);
    } catch (Exception $e) {
        add_action('admin_notices', function () use($e) {
            echo "<div class='notice notice-error'><p>[Informer Debugger] {$e->getMessage()}</p>" . "<p style='display: none'>{$e->getTraceAsString()}</p></div>";
        });
    }
}
Example #8
0
 /**
  * @return string
  */
 public function get_link()
 {
     if (!$this->_link) {
         $this->_link = untrailingslashit(get_author_posts_url($this->ID));
     }
     return $this->_link;
 }
function dtheme_startup()
{
    global $dt_revealData, $krypton_Scripts, $krypton_config;
    $dt_revealData = array();
    $krypton_Scripts = array();
    $theme_name = get_template();
    $locale = get_locale();
    $localelanguage = get_template_directory() . '/languages';
    if (is_child_theme() && !load_textdomain('Krypton', untrailingslashit(get_stylesheet_directory()) . "/{$locale}.mo") || !is_child_theme() && !load_theme_textdomain('Krypton', get_template_directory())) {
        $aaa = load_theme_textdomain('Krypton', $localelanguage);
    }
    // Add post thumbnail supports. http://codex.wordpress.org/Post_Thumbnails
    add_theme_support('post-thumbnails');
    add_theme_support('automatic-feed-links');
    add_theme_support('menus');
    add_theme_support('woocommerce');
    add_theme_support('title-tag');
    register_nav_menus(array('primary' => __('Top Navigation', 'Krypton'), 'footer_navigation' => __('Footer Navigation', 'Krypton')));
    // sidebar widget
    register_sidebar(array('name' => 'Sidebar', 'id' => 'krypton-sidebar', 'description' => __('Sidebar Widget Area', 'Krypton'), 'before_widget' => '<div class="widget %s %s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget_title">', 'after_title' => '</h3>'));
    register_sidebar(array('name' => 'Bottom Widget', 'id' => 'krypton-bottom', 'description' => __('Bottom Widget Area. Recomended 3 widgets', 'Krypton'), 'before_widget' => '<div class="col-lg-4 col-md-4 col-sm-4 clearfix"><div class="widget %s %s">', 'after_widget' => '</div></div>', 'before_title' => '<div class="row"><div class="section-head"><header class="col col-sm-12 centered"><h2>', 'after_title' => '</h2><hr></header></div></div>'));
    register_sidebar(array('name' => 'Contact Page Sidebar', 'id' => 'krypton-contact-sidebar', 'description' => __('Widget area for contact page', 'Krypton'), 'before_widget' => '<div class="widget %s %s">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
    if (is_plugin_active('woocommerce/woocommerce.php')) {
        register_sidebar(array('name' => 'Shop Sidebar', 'id' => 'shop-sidebar', 'description' => __('Sidebar Widget Area', 'Krypton'), 'before_widget' => '<div class="widget %s %s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget_title">', 'after_title' => '</h3>'));
        register_sidebar(array('name' => 'Shop Bottom ', 'id' => 'shop-bottom', 'description' => __('Shop Bottom Widget Area. Displayed at shop pages', 'Krypton'), 'before_widget' => '<div class="col-md-3 col-sm-6"><div class="widget %s %s">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget_title">', 'after_title' => '</h3>'));
    }
    add_action('wp_enqueue_scripts', 'dt_enqueue_color_scheme');
    add_action('wp_enqueue_scripts', 'dtheme_scripts', 999);
    add_action('wp_print_scripts', 'dtheme_register_var', 998);
    add_action('wp_print_scripts', 'detheme_print_inline_style');
    add_action('wp_footer', 'dtheme_register_mainmenu', 997);
    add_action('wp_enqueue_scripts', 'dtheme_css_style', 999);
    add_action('wp_footer', create_function('', 'global $krypton_Scripts;if(count($krypton_Scripts)) print "<script type=\\"text/javascript\\">\\n".@implode("\\n",$krypton_Scripts)."\\n</script>\\n";'), 99998);
}
Example #10
0
 static function post_type_link($link, $post)
 {
     if ($post->post_type !== 'glossary') {
         return $link;
     }
     return untrailingslashit(str_replace('/glossary/', '/glossary/#', $link));
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     define('WC_BOOKINGS_VERSION', '1.7.12');
     define('WC_BOOKINGS_TEMPLATE_PATH', untrailingslashit(plugin_dir_path(__FILE__)) . '/templates/');
     define('WC_BOOKINGS_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
     define('WC_BOOKINGS_MAIN_FILE', __FILE__);
     add_action('init', array($this, 'load_plugin_textdomain'));
     add_action('woocommerce_loaded', array($this, 'includes'));
     add_action('plugins_loaded', array($this, 'init'));
     add_action('init', array($this, 'init_post_types'));
     add_action('wp_enqueue_scripts', array($this, 'booking_form_styles'));
     add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
     if (is_admin()) {
         $this->admin_includes();
     }
     // Install
     register_activation_hook(__FILE__, array($this, 'install'));
     if (get_option('wc_bookings_version') !== WC_BOOKINGS_VERSION) {
         add_action('shutdown', array($this, 'delayed_install'));
     }
     // Load payment gateway name.
     add_filter('woocommerce_payment_gateways', array($this, 'include_gateway'));
     // Load integration.
     add_filter('woocommerce_integrations', array($this, 'include_integration'));
 }
/**
 * Output the dashboard page, an empty div for React to initialise against
 *
 * @return void
 */
function vip_dashboard_page()
{
    $current_user = wp_get_current_user();
    $name = $current_user->display_name;
    $email = $current_user->user_email;
    $ajaxurl = add_query_arg(array('_wpnonce' => wp_create_nonce('vip-dashboard')), untrailingslashit(admin_url('admin-ajax.php')));
    ?>
	<div id="app"
		data-ajaxurl="<?php 
    echo esc_url($ajaxurl);
    ?>
"
		data-asseturl="<?php 
    echo esc_attr(plugins_url('/assets/', __FILE__));
    ?>
"
		data-email="<?php 
    echo esc_attr($email);
    ?>
"
		data-name="<?php 
    echo esc_attr($name);
    ?>
"
		data-adminurl="<?php 
    echo esc_url(admin_url('admin.php'));
    ?>
"
	></div>
	<?php 
}
 /**
  * Initialize the plugin and register hooks
  */
 public function init()
 {
     // Common strings
     define('GRFWP_TEXTDOMAIN', 'good-reviews-wp');
     // keep for back compat
     define('GRFWP_PLUGIN_DIR', untrailingslashit(plugin_dir_path(__FILE__)));
     define('GRFWP_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
     define('GRFWP_PLUGIN_FNAME', plugin_basename(__FILE__));
     define('GRFWP_REVIEW_POST_TYPE', 'grfwp-review');
     define('GRFWP_REVIEW_CATEGORY', 'grfwp-category');
     // Initialize the plugin
     add_action('init', array($this, 'load_textdomain'));
     // Load custom post types
     require_once GRFWP_PLUGIN_DIR . '/includes/CustomPostTypes.class.php';
     $this->cpts = new grfwpCustomPostTypes();
     // Load template functions
     require_once GRFWP_PLUGIN_DIR . '/includes/template-functions.php';
     // Load code to integrate with other plugins
     require_once GRFWP_PLUGIN_DIR . '/includes/Integrations.class.php';
     new grfwpIntegrations();
     // Register assets
     add_action('wp_enqueue_scripts', array($this, 'register_assets'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_assets'));
     // Reword the title placeholder text for a review post type
     add_filter('enter_title_here', array($this, 'rename_review_title'));
     // Order review posts in admin screen by menu order
     add_filter('pre_get_posts', array($this, 'admin_order_posts'));
     // Transform review $content variable to output review
     add_filter('the_content', array($this, 'append_to_content'));
     // Register the widget
     add_action('widgets_init', array($this, 'register_widgets'));
     // Add links to plugin listing
     add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
 }
Example #14
0
 function __construct()
 {
     $this->url = untrailingslashit(plugins_url('', dirname(__FILE__)));
     $this->dir = untrailingslashit(plugin_dir_path(dirname(__FILE__)));
     $this->cacheUrl = $this->url . '/cache';
     $this->cacheDir = $this->dir . '/cache';
 }
Example #15
0
/**
 * Get plugin dir URL
 *
 * @package 2ch
 * @param string $path
 * @return string
 */
function _2ch_plugin_dir_url($path = '')
{
    if ($path) {
        $path = '/' . ltrim($path, '/');
    }
    return untrailingslashit(plugin_dir_url(__FILE__)) . $path;
}
function wc_update_200_permalinks()
{
    // Setup default permalinks if shop page is defined
    $permalinks = get_option('woocommerce_permalinks');
    $shop_page_id = wc_get_page_id('shop');
    if (empty($permalinks) && $shop_page_id > 0) {
        $base_slug = $shop_page_id > 0 && get_post($shop_page_id) ? get_page_uri($shop_page_id) : 'shop';
        $category_base = get_option('woocommerce_prepend_shop_page_to_urls') == "yes" ? trailingslashit($base_slug) : '';
        $category_slug = get_option('woocommerce_product_category_slug') ? get_option('woocommerce_product_category_slug') : _x('product-category', 'slug', 'woocommerce');
        $tag_slug = get_option('woocommerce_product_tag_slug') ? get_option('woocommerce_product_tag_slug') : _x('product-tag', 'slug', 'woocommerce');
        if ('yes' == get_option('woocommerce_prepend_shop_page_to_products')) {
            $product_base = trailingslashit($base_slug);
        } else {
            if (($product_slug = get_option('woocommerce_product_slug')) !== false && !empty($product_slug)) {
                $product_base = trailingslashit($product_slug);
            } else {
                $product_base = trailingslashit(_x('product', 'slug', 'woocommerce'));
            }
        }
        if (get_option('woocommerce_prepend_category_to_products') == 'yes') {
            $product_base .= trailingslashit('%product_cat%');
        }
        $permalinks = array('product_base' => untrailingslashit($product_base), 'category_base' => untrailingslashit($category_base . $category_slug), 'attribute_base' => untrailingslashit($category_base), 'tag_base' => untrailingslashit($category_base . $tag_slug));
        update_option('woocommerce_permalinks', $permalinks);
    }
}
 static function processResponse($force = false)
 {
     // Response
     if (isset($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'ctct_oauth')) {
         # http://ctct.katz.co/?_wpnonce=13d09269c5&prefix=http&domain=localhost.local/wordpress/&action=ctct_oauth&error=access_denied&error_description=User+denied+authentication./
         if (isset($_REQUEST['error'])) {
             $error_array = array('error' => esc_html($_REQUEST['error']), 'error_description' => urlencode(untrailingslashit($_REQUEST['error_description'])));
             $url = add_query_arg($error_array, admin_url('admin.php?page=constant-contact-api'));
             wp_redirect($url);
             exit;
         }
         // Returned a OAuth code. Let's fetch the access token based on that code.
         if (isset($_REQUEST['code'])) {
             try {
                 $oauth_code = esc_attr($_REQUEST['code']);
                 $token = self::getInstance()->getAccessToken($oauth_code);
                 $token['_wpnonce'] = esc_attr($_REQUEST['_wpnonce']);
                 $token['time'] = time();
                 $token['username'] = esc_attr($_REQUEST['username']);
                 self::getInstance()->saveToken($token, true);
                 do_action('ctct_token_saved', $token);
                 $admin_url = admin_url('admin.php?page=constant-contact-api&oauth=new');
             } catch (Exception $e) {
                 $token = false;
                 // Delete configured setting, save error message
                 self::getInstance()->saveToken($e->getMessage(), false);
                 $admin_url = admin_url('admin.php?page=constant-contact-api');
             }
             do_action('ctct_token_updated', $token);
             // Go to the settings page
             wp_redirect($admin_url);
             exit;
         }
     }
 }
function jhp_template_redirect()
{
    global $wp_query;
    $portfolio_base = get_option('jhp_url_base', 'portfolio');
    if ($portfolio_base != '') {
        $portfolio_base .= '/';
    }
    $single_base = untrailingslashit(get_option('jhp_single_base', '%category%'));
    $single_base = str_ireplace('%category%', '[^\\/]*', $single_base);
    if ($single_base != '') {
        $single_base .= '/';
    }
    $portfolio_files = array();
    if ($file = get_option('jhp_template_home', 'portfolio-home.php')) {
        $portfolio_files[] = get_template_directory() . '/' . $file;
    }
    $portfolio_files[] = dirname(__FILE__) . '/template/portfolio.php';
    $portfolio_single_files = array();
    if ($file = get_option('jhp_template_single', 'portfolio-single.php')) {
        $portfolio_single_files[] = get_template_directory() . '/' . $file;
    }
    $portfolio_single_files[] = dirname(__FILE__) . '/template/portfolio.single.php';
    // add the rewrites
    tj_add_page_rule("^/{$portfolio_base}?", $portfolio_files, 'Portfolio', null, false, array('is_page' => '1', 'is_portfolio' => '1'), array('post_type' => 'jh-portfolio'));
    tj_add_page_rule("^/{$portfolio_base}({$single_base})([^\\/]*)/?", $portfolio_single_files, 'Portfolio Single', null, false, array('is_single' => '1', 'is_portfolio_single' => '1'), array('name' => 1, 'post_type' => 'jh-portfolio'));
}
 /**
  * Returns files from pattern
  * @param string $dir
  * @param string $pattern
  * @param bool $checkChildTheme
  * @see glob
  * @return array
  */
 public function getFilesByPattern($dir, $pattern = '*.php', $checkChildTheme = true)
 {
     $dir = untrailingslashit($dir);
     $r = glob($dir . '/' . $pattern);
     if ($r === false) {
         return array();
     }
     //we should merge it with child theme files
     if ($checkChildTheme && $this->isChildTheme) {
         $childDir = $this->changeDirFromParentToChild($dir);
         if ($dirs = glob($childDir . '/' . $pattern)) {
             $children = array_flip($dirs);
             foreach ($r as $key => $mainDir) {
                 $c = $this->changeDirFromParentToChild($mainDir);
                 //we have this file in child theme
                 if (isset($children[$c])) {
                     $r[$key] = $c;
                     unset($children[$c]);
                 }
             }
             //add additional child files
             foreach ($children as $path => $a) {
                 $r[] = $path;
             }
         }
     }
     return $r;
 }
 public function admin_uploader_url()
 {
     if ($this->admin_uploader_url) {
         return $this->admin_uploader_url;
     }
     return $this->admin_uploader_url = untrailingslashit(plugins_url('/', __FILE__));
 }
Example #21
0
function foogallery_album_remove_gallery_from_link()
{
    $gallery = foogallery_album_get_current_gallery();
    $slug = foogallery_album_gallery_url_slug();
    $url = untrailingslashit(remove_query_arg($slug));
    return str_replace($slug . '/' . $gallery, '', $url);
}
 /**
  * Initialize the plugin and register hooks
  */
 public function __construct()
 {
     // Common strings
     define('BPFWP_PLUGIN_DIR', untrailingslashit(plugin_dir_path(__FILE__)));
     define('BPFWP_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
     define('BPFWP_PLUGIN_FNAME', plugin_basename(__FILE__));
     define('BPFWP_VERSION', 1);
     // Load the textdomain
     add_action('init', array($this, 'load_textdomain'));
     // Load settings
     require_once BPFWP_PLUGIN_DIR . '/includes/Settings.class.php';
     $this->settings = new bpfwpSettings();
     // Load the template functions which print the contact cards
     require_once BPFWP_PLUGIN_DIR . '/includes/template-functions.php';
     // Load integrations with third-party plugins/apps
     require_once BPFWP_PLUGIN_DIR . '/includes/Integrations.class.php';
     // Load assets
     add_action('wp_enqueue_scripts', array($this, 'register_assets'));
     // Register the widget
     add_action('widgets_init', array($this, 'register_widgets'));
     // Add links to plugin listing
     add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
     // Load backwards compatibility functions
     require_once BPFWP_PLUGIN_DIR . '/includes/Compatibility.class.php';
     new bpfwpCompatibility();
 }
 /**
  * __construct function.
  */
 public function __construct()
 {
     // Define constants
     define('JOB_MANAGER_APPLICATIONS_VERSION', '1.7.2');
     define('JOB_MANAGER_APPLICATIONS_PLUGIN_DIR', untrailingslashit(plugin_dir_path(__FILE__)));
     define('JOB_MANAGER_APPLICATIONS_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
     // Includes
     include 'includes/class-wp-job-manager-applications-post-types.php';
     include 'includes/class-wp-job-manager-applications-apply.php';
     include 'includes/class-wp-job-manager-applications-dashboard.php';
     include 'includes/class-wp-job-manager-applications-past.php';
     include 'includes/wp-job-manager-applications-functions.php';
     // Init classes
     $this->post_types = new WP_Job_Manager_Applications_Post_Types();
     // Add actions
     add_action('admin_notices', array($this, 'version_check'));
     add_action('init', array($this, 'load_plugin_textdomain'), 12);
     add_action('plugins_loaded', array($this, 'integration'), 12);
     add_action('admin_init', array($this, 'load_admin'), 12);
     add_filter('job_manager_settings', array($this, 'settings'));
     add_action('after_setup_theme', array($this, 'template_functions'));
     add_action('admin_init', array($this, 'updater'));
     // Activate
     register_activation_hook(__FILE__, array($this, 'install'));
     // Init updates
     $this->init_updates(__FILE__);
 }
Example #24
0
 /**
  * Initialize component
  */
 public function __construct()
 {
     parent::start('buddyblog', __('BuddyBlog', 'buddyblog'), untrailingslashit(plugin_dir_path(__FILE__)));
     $this->includes();
     //load files
     buddypress()->active_components[$this->id] = 1;
 }
Example #25
0
 public function uploads($command = array(), $args = array())
 {
     if (count($command) == 1 && reset($command) == 'help') {
         return $this->uploads_help();
     }
     $dir = wp_upload_dir();
     $defaults = array('ssh_host' => defined('IMPORT_UPLOADS_SSH_HOST') ? IMPORT_UPLOADS_SSH_HOST : '', 'ssh_user' => defined('IMPORT_UPLOADS_SSH_USER') ? IMPORT_UPLOADS_SSH_USER : '', 'remote_path' => defined('IMPORT_UPLOADS_REMOTE_PATH') ? IMPORT_UPLOADS_REMOTE_PATH : '', 'uploads_dir' => '', 'local_path' => $dir['basedir']);
     $args = wp_parse_args($args, $defaults);
     if ($args['uploads_dir']) {
         $args['remote_path'] = $args['remote_path'] ? trailingslashit($args['remote_path']) . trailingslashit(ltrim($args['uploads_dir'], '/')) : '';
         $args['local_path'] = trailingslashit($args['local_path']) . untrailingslashit(ltrim($args['uploads_dir'], '/'));
     } else {
         $args['remote_path'] = $args['remote_path'] ? trailingslashit($args['remote_path']) : '';
         $args['local_path'] = untrailingslashit($args['local_path']);
     }
     if (empty($args['remote_path'])) {
         WP_CLI::error('You must specify a remote path. Use --remote_path=~/foo/bar');
         return;
     }
     if (empty($args['ssh_host'])) {
         WP_CLI::error('You must specify a ssh host. Use --ssh_host=example.com');
         return;
     }
     if (empty($args['ssh_user'])) {
         WP_CLI::error('You must specify a ssh user. Use --ssh_user=root');
         return;
     }
     WP_CLI::line(sprintf('Running rsync from %s:%s to %s', $args['ssh_host'], $args['remote_path'], $args['local_path']));
     WP_CLI::launch(sprintf("rsync -avz -e ssh %s@%s:%s %s --exclude 'cache' --exclude '*backup*'", $args['ssh_user'], $args['ssh_host'], $args['remote_path'], $args['local_path']));
 }
function custom_woocommerce_placeholder_img_src($src, $context = '')
{
    $upload_dir = wp_upload_dir();
    $uploads = untrailingslashit($upload_dir['baseurl']);
    $src = $uploads . '/2012/07/thumb1.jpg';
    return $src;
}
 function plugin_path()
 {
     if ($this->plugin_path) {
         return $this->plugin_path;
     }
     return $this->plugin_path = untrailingslashit(plugin_dir_path(__FILE__));
 }
 /**
  * @ticket 31417
  */
 public function test_go_to_should_go_to_home_page_when_passing_the_untrailingslashed_home_url()
 {
     $this->assertFalse(is_home());
     $home = untrailingslashit(get_option('home'));
     $this->go_to($home);
     $this->assertTrue(is_home());
 }
function um_access_global_settings()
{
    global $post, $ultimatemember;
    $access = um_get_option('accessible');
    if ($access == 2 && !is_user_logged_in()) {
        $redirect = um_get_option('access_redirect');
        if (!$redirect) {
            $redirect = um_get_core_page('login');
        }
        $redirects[] = untrailingslashit(um_get_core_page('login'));
        $redirects[] = untrailingslashit(um_get_option('access_redirect'));
        $exclude_uris = um_get_option('access_exclude_uris');
        if ($exclude_uris) {
            $redirects = array_merge($redirects, $exclude_uris);
        }
        $redirects = array_unique($redirects);
        $current_url = $ultimatemember->permalinks->get_current_url(get_option('permalink_structure'));
        $current_url = untrailingslashit($current_url);
        $current_url_slash = trailingslashit($current_url);
        if ((isset($post->ID) || is_home()) && (in_array($current_url, $redirects) || in_array($current_url_slash, $redirects))) {
            // allow
        } else {
            $ultimatemember->access->redirect_handler = $redirect;
        }
    }
}
Example #30
0
 /**
  * Look in this plugin for template files first.
  * This works for the top level templates (IE single.php, page.php etc). However, it doesn't work for
  * template parts yet (content.php, header.php etc).
  *
  * Relevant trac ticket; https://core.trac.wordpress.org/ticket/13239
  *
  * @param  string $template template string.
  * @return string $template new template string.
  */
 public function gremfront_customisations_template($template)
 {
     if (file_exists(untrailingslashit(plugin_dir_path(__FILE__)) . '/templates/' . basename($template))) {
         $template = untrailingslashit(plugin_dir_path(__FILE__)) . '/templates/' . basename($template);
     }
     return $template;
 }