87 lines
2.0 KiB
PHP
87 lines
2.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* The public-facing functionality of the plugin.
|
|
*
|
|
* @link https://github.com/Duskell
|
|
* @since 1.0.0
|
|
* @package Partnerexpo_Core
|
|
* @subpackage Partnerexpo_Core/public
|
|
* @author Juhász Levente <juhasz.levente@rendszerepito.hu>
|
|
*/
|
|
class Partnerexpo_Core_Public {
|
|
|
|
/**
|
|
* The ID of this plugin.
|
|
*
|
|
* @since 1.0.0
|
|
* @access private
|
|
* @var string $plugin_name The ID of this plugin.
|
|
*/
|
|
private $plugin_name;
|
|
|
|
/**
|
|
* The version of this plugin.
|
|
*
|
|
* @since 1.0.0
|
|
* @access private
|
|
* @var string $version The current version of this plugin.
|
|
*/
|
|
private $version;
|
|
|
|
/**
|
|
* Initialize the class and set its properties.
|
|
*
|
|
* @since 1.0.0
|
|
* @param string $plugin_name The name of the plugin.
|
|
* @param string $version The version of this plugin.
|
|
*/
|
|
public function __construct( $plugin_name, $version ) {
|
|
|
|
$this->plugin_name = $plugin_name;
|
|
$this->version = $version;
|
|
|
|
add_shortcode( 'partnerexpo_searchbox', [ $this, 'searchbox_shortcode' ] );
|
|
}
|
|
|
|
public function searchbox_shortcode() {
|
|
wp_enqueue_style( $this->plugin_name . '-searchbox-css' );
|
|
wp_enqueue_script( $this->plugin_name . '-searchbox-js' );
|
|
|
|
ob_start();
|
|
include plugin_dir_path( __FILE__ ) . 'partials/partnerexpo-core-public-searchbox.php';
|
|
return ob_get_clean();
|
|
}
|
|
|
|
/**
|
|
* Register the stylesheets for the public-facing side of the site.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function enqueue_styles() {
|
|
wp_register_style(
|
|
$this->plugin_name . '-searchbox-css',
|
|
plugin_dir_url( __FILE__ ) . 'css/searchbox.css',
|
|
[],
|
|
$this->version,
|
|
'all'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Register the JavaScript for the public-facing side of the site.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function enqueue_scripts() {
|
|
wp_register_script(
|
|
$this->plugin_name . '-searchbox-js',
|
|
plugin_dir_url( __FILE__ ) . 'js/searchbox.js',
|
|
[],
|
|
$this->version,
|
|
true
|
|
);
|
|
}
|
|
|
|
}
|