Move enqueue_scripts

parent f9e57953
...@@ -27,16 +27,9 @@ if(!class_exists('SexhackHlsPlayer')) { ...@@ -27,16 +27,9 @@ if(!class_exists('SexhackHlsPlayer')) {
public function __construct() public function __construct()
{ {
sexhack_log('SexhackHlsPlayer() Instanced'); sexhack_log('SexhackHlsPlayer() Instanced');
add_action('wp_enqueue_scripts', array( $this, 'add_js' ));
add_shortcode("sexhls", array( $this, "sexhls_shortcode")); add_shortcode("sexhls", array( $this, "sexhls_shortcode"));
} }
public function add_js()
{
wp_enqueue_script('sexhls_baseplayer', plugin_dir_url(__DIR__).'js/hls.js');
wp_enqueue_script('sexhls_player_controls', plugin_dir_url(__DIR__).'js/sexhls.js');
wp_enqueue_script('sexhls_mousetrap', plugin_dir_url(__DIR__).'js/mousetrap.min.js');
}
public function addPlayer($vurl, $posters="") public function addPlayer($vurl, $posters="")
{ {
......
...@@ -27,30 +27,9 @@ if(!class_exists('SexhackVideoJSPlayer')) { ...@@ -27,30 +27,9 @@ if(!class_exists('SexhackVideoJSPlayer')) {
public function __construct() public function __construct()
{ {
sexhack_log('SexhackVideoJSPlayer() Instanced'); sexhack_log('SexhackVideoJSPlayer() Instanced');
add_action('wp_enqueue_scripts', array( $this, 'add_js' ));
add_action('wp_enqueue_scripts', array( $this, 'add_css' ));
add_shortcode("sexvideo", array( $this, "sexvideo_shortcode")); add_shortcode("sexvideo", array( $this, "sexvideo_shortcode"));
} }
public function add_js()
{
wp_enqueue_script('sexvideo_baseplayer', plugin_dir_url(__DIR__).'js/video.min.js');
//wp_enqueue_script('sexvideo_vrplayer', plugin_dir_url(__DIR__).'js/videojs-vr.js');
wp_enqueue_script('sexvideo_xrplayer', plugin_dir_url(__DIR__).'js/videojs-xr.min.js');
//wp_enqueue_script('sexvideo_player_controls', plugin_dir_url(__DIR__).'js/sexvideo.js');
//wp_enqueue_script('sexvideo_vrplayer', plugin_dir_url(__DIR__).'js/deovr.js');
}
public function add_css()
{
wp_enqueue_style ('videojs', plugin_dir_url(__DIR__).'css/video-js.min.css');
wp_enqueue_style ('sexhack_videojs', plugin_dir_url(__DIR__).'css/sexhackme_videojs.css');
//wp_enqueue_style ('videojs-vr', plugin_dir_url(__DIR__).'css/videojs-vr.css');
wp_enqueue_style ('videojs-xr', plugin_dir_url(__DIR__).'css/videojs-xr.css');
//wp_enqueue_style ('videojs_forest', plugin_dir_url(__DIR__).'css/videojs_forest.css');
//wp_enqueue_style ('videojs', plugin_dir_url(__DIR__).'css/deovr.css');
}
public function addPlayer($vurl, $posters="", $projection="180_LR") public function addPlayer($vurl, $posters="", $projection="180_LR")
{ {
$uid = uniqid('sexvideo_'); $uid = uniqid('sexvideo_');
......
...@@ -125,7 +125,6 @@ if(!class_exists('SexHackVideoGallery')) { ...@@ -125,7 +125,6 @@ if(!class_exists('SexHackVideoGallery')) {
// Register Query Vars // Register Query Vars
add_filter("query_vars", array($this, "query_vars")); add_filter("query_vars", array($this, "query_vars"));
add_action('wp_enqueue_scripts', array( $this, 'add_css' ), 200);
add_shortcode("sexgallery", array($this, "sexgallery_shortcode")); add_shortcode("sexgallery", array($this, "sexgallery_shortcode"));
add_action('init', array($this, "register_sexhack_video_post_type")); add_action('init', array($this, "register_sexhack_video_post_type"));
//add_action('add_meta_boxes', array($this, "sexhack_video_metaboxes")); //add_action('add_meta_boxes', array($this, "sexhack_video_metaboxes"));
...@@ -169,11 +168,6 @@ if(!class_exists('SexHackVideoGallery')) { ...@@ -169,11 +168,6 @@ if(!class_exists('SexHackVideoGallery')) {
return $rules; return $rules;
} }
public function add_css()
{
wp_enqueue_style ('sexhackme_gallery', plugin_dir_url(__DIR__).'css/sexhackme_gallery.css');
}
public function query_vars($vars) public function query_vars($vars)
{ {
$vars[] = 'wooprod'; $vars[] = 'wooprod';
......
...@@ -29,7 +29,6 @@ if(!class_exists('StorefrontMoveHeaderCart')) { ...@@ -29,7 +29,6 @@ if(!class_exists('StorefrontMoveHeaderCart')) {
sexhack_log('StorefrontMoveHeaderCart() Instanced'); sexhack_log('StorefrontMoveHeaderCart() Instanced');
add_action( 'init', array($this, 'remove_header_cart' )); add_action( 'init', array($this, 'remove_header_cart' ));
add_filter('storefront_credit_link', false); add_filter('storefront_credit_link', false);
add_action('wp_enqueue_scripts', array( $this, 'add_css' ), 200);
//add_action('storefront_footer', array($this, 'disclaimer')); // XXX I don't like positioning this way. Fix in CSS or sobstitute footer theme file? //add_action('storefront_footer', array($this, 'disclaimer')); // XXX I don't like positioning this way. Fix in CSS or sobstitute footer theme file?
add_action( 'storefront_header', array($this, 'add_header_cart'), 40); add_action( 'storefront_header', array($this, 'add_header_cart'), 40);
} }
...@@ -42,12 +41,6 @@ if(!class_exists('StorefrontMoveHeaderCart')) { ...@@ -42,12 +41,6 @@ if(!class_exists('StorefrontMoveHeaderCart')) {
<?php <?php
} }
public function add_css()
{
wp_enqueue_style ('sexhackme_header', plugin_dir_url(__DIR__).'css/sexhackme_header.css');
}
public function remove_header_cart() public function remove_header_cart()
{ {
remove_action( 'storefront_header', 'storefront_header_cart', 60 ); remove_action( 'storefront_header', 'storefront_header_cart', 60 );
......
...@@ -28,15 +28,9 @@ if(!class_exists('WoocommerceAccountRemoveNameSurname')) { ...@@ -28,15 +28,9 @@ if(!class_exists('WoocommerceAccountRemoveNameSurname')) {
{ {
add_filter('woocommerce_save_account_details_required_fields', array($this, 'ts_hide_first_last_name')); add_filter('woocommerce_save_account_details_required_fields', array($this, 'ts_hide_first_last_name'));
add_action( 'woocommerce_edit_account_form_start', array($this, 'add_username_to_edit_account_form')); add_action( 'woocommerce_edit_account_form_start', array($this, 'add_username_to_edit_account_form'));
add_action('wp_enqueue_scripts', array( $this, 'add_css' ), 200);
sexhack_log('WoocommerceAccountRemoveNameSurname() Instanced'); sexhack_log('WoocommerceAccountRemoveNameSurname() Instanced');
} }
public function add_css()
{
wp_enqueue_style ('sexhackme_checkout', plugin_dir_url(__DIR__).'css/sexhackme_checkout.css');
}
// Add the custom field "username" // Add the custom field "username"
public function add_username_to_edit_account_form() public function add_username_to_edit_account_form()
{ {
......
...@@ -28,13 +28,6 @@ if(!class_exists('XFrameByPass')) { ...@@ -28,13 +28,6 @@ if(!class_exists('XFrameByPass')) {
{ {
sexhack_log('XFrameByPass() Instanced'); sexhack_log('XFrameByPass() Instanced');
add_shortcode( 'xfbp', array( $this, 'xfbp_shortcode_fn' )); add_shortcode( 'xfbp', array( $this, 'xfbp_shortcode_fn' ));
add_action('wp_enqueue_scripts', array( $this, 'xfbp_js' ));
}
public function xfbp_js()
{
wp_enqueue_script('xfbp_poly', plugin_dir_url(__DIR__).'js/custom-elements-builtin.js');
wp_enqueue_script('xfbp_js', plugin_dir_url(__DIR__).'js/x-frame-bypass.js');
} }
public function xfbp_shortcode_fn($attributes, $content) public function xfbp_shortcode_fn($attributes, $content)
......
...@@ -79,7 +79,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -79,7 +79,8 @@ if(!class_exists('SexHackMe_Plugin')) {
* Method that gets executed on plugin activation * Method that gets executed on plugin activation
* *
*/ */
public function install( $network_activate = false ) { public function install( $network_activate = false )
{
// Handle multi-site installation // Handle multi-site installation
if( function_exists( 'is_multisite' ) && is_multisite() && $network_activate ) { if( function_exists( 'is_multisite' ) && is_multisite() && $network_activate ) {
...@@ -122,7 +123,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -122,7 +123,8 @@ if(!class_exists('SexHackMe_Plugin')) {
* Method that gets executed on plugin deactivation * Method that gets executed on plugin deactivation
* *
*/ */
public function uninstall() { public function uninstall()
{
// Clear cron job // Clear cron job
//$this->clear_cron_job(); //$this->clear_cron_job();
...@@ -134,7 +136,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -134,7 +136,8 @@ if(!class_exists('SexHackMe_Plugin')) {
* Method that checks if the current version differs from the one saved in the db * Method that checks if the current version differs from the one saved in the db
* *
*/ */
public function update_check() { public function update_check()
{
$db_version = get_option( 'sh_version', '' ); $db_version = get_option( 'sh_version', '' );
...@@ -153,7 +156,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -153,7 +156,8 @@ if(!class_exists('SexHackMe_Plugin')) {
* Function that schedules a hook to be executed daily (cron job) * Function that schedules a hook to be executed daily (cron job)
* *
*/ */
public function cron_job() { public function cron_job()
{
// Process payments for custom member subscriptions // Process payments for custom member subscriptions
//if( !wp_next_scheduled( 'sh_cron_process_member_subscriptions_payments' ) ) //if( !wp_next_scheduled( 'sh_cron_process_member_subscriptions_payments' ) )
...@@ -165,7 +169,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -165,7 +169,8 @@ if(!class_exists('SexHackMe_Plugin')) {
* Function that cleans the scheduler on plugin deactivation: * Function that cleans the scheduler on plugin deactivation:
* *
*/ */
public function clear_cron_job() { public function clear_cron_job()
{
//wp_clear_scheduled_hook( 'pms_cron_process_member_subscriptions_payments' ); //wp_clear_scheduled_hook( 'pms_cron_process_member_subscriptions_payments' );
...@@ -176,7 +181,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -176,7 +181,8 @@ if(!class_exists('SexHackMe_Plugin')) {
* Add the default settings if they do not exist * Add the default settings if they do not exist
* *
*/ */
public function add_default_settings() { public function add_default_settings()
{
$already_installed = get_option( 'sh_already_installed' ); $already_installed = get_option( 'sh_already_installed' );
...@@ -191,7 +197,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -191,7 +197,8 @@ if(!class_exists('SexHackMe_Plugin')) {
* Function to include the files needed * Function to include the files needed
* *
*/ */
public function include_dependencies() { public function include_dependencies()
{
/* /*
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/' ) )
...@@ -233,7 +240,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -233,7 +240,8 @@ if(!class_exists('SexHackMe_Plugin')) {
* Registers custom meta tables with WP's $wpdb object * Registers custom meta tables with WP's $wpdb object
* *
*/ */
public function register_custom_meta_tables() { public function register_custom_meta_tables()
{
global $wpdb; global $wpdb;
...@@ -247,7 +255,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -247,7 +255,8 @@ if(!class_exists('SexHackMe_Plugin')) {
* Initialize the plugin * Initialize the plugin
* *
*/ */
public function init() { public function init()
{
// Check plugin dependencies // Check plugin dependencies
add_action( 'tgmpa_register', array($this, 'plugin_dependencies' )); add_action( 'tgmpa_register', array($this, 'plugin_dependencies' ));
...@@ -257,12 +266,14 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -257,12 +266,14 @@ if(!class_exists('SexHackMe_Plugin')) {
add_action('admin_init', array($this, 'initialize_plugin')); add_action('admin_init', array($this, 'initialize_plugin'));
// Check if we need to flush rewrite rules
add_action('init', array($this, 'register_flush'), 10); add_action('init', array($this, 'register_flush'), 10);
add_action('init', array($this, 'flush_rewrite'), 900); add_action('init', array($this, 'flush_rewrite'), 900);
// Enqueue scripts on the front end side // Enqueue scripts on the front end side. Priority 200 because of WooCommerce.
//add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_front_end_scripts' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_front_end_scripts' ), 200 );
// Enqueue scripts on the admin side // Enqueue scripts on the admin side
//if( is_admin() ) //if( is_admin() )
...@@ -293,7 +304,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -293,7 +304,8 @@ if(!class_exists('SexHackMe_Plugin')) {
} }
public function plugin_dependencies() { public function plugin_dependencies()
{
$plugins = array( $plugins = array(
array( array(
'name' => 'WooCommerce', 'name' => 'WooCommerce',
...@@ -317,7 +329,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -317,7 +329,8 @@ if(!class_exists('SexHackMe_Plugin')) {
} }
public function register_flush() { public function register_flush()
{
register_setting('sexhackme-settings', 'need_rewrite_flush'); register_setting('sexhackme-settings', 'need_rewrite_flush');
} }
...@@ -332,7 +345,37 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -332,7 +345,37 @@ if(!class_exists('SexHackMe_Plugin')) {
} }
public function enqueue_front_end_scripts()
{
// HLS Player
wp_enqueue_script('sexhls_baseplayer', SH_PLUGIN_DIR_URL.'js/hls.js');
wp_enqueue_script('sexhls_player_controls', SH_PLUGIN_DIR_URL.'js/sexhls.js');
wp_enqueue_script('sexhls_mousetrap', SH_PLUGIN_DIR_URL.'js/mousetrap.min.js');
// VideoJS Player (for 3D)
wp_enqueue_script('sexvideo_baseplayer', SH_PLUGIN_DIR_URL.'js/video.min.js');
wp_enqueue_script('sexvideo_xrplayer', SH_PLUGIN_DIR_URL.'js/videojs-xr.min.js');
wp_enqueue_style ('videojs', SH_PLUGIN_DIR_URL.'css/video-js.min.css');
wp_enqueue_style ('sexhack_videojs', SH_PLUGIN_DIR_URL.'css/sexhackme_videojs.css');
wp_enqueue_style ('videojs-xr', SH_PLUGIN_DIR_URL.'css/videojs-xr.css');
// Sexhack Video Gallery
wp_enqueue_style ('sexhackme_gallery', SH_PLUGIN_DIR_URL.'css/sexhackme_gallery.css');
// Sexhack Fix Header
wp_enqueue_style ('sexhackme_header', SH_PLUGIN_DIR_URL.'css/sexhackme_header.css');
// Fix Woocommerce Checkout
wp_enqueue_style ('sexhackme_checkout', SH_PLUGIN_DIR_URL.'css/sexhackme_checkout.css');
// XFrame Bypass
wp_enqueue_script('xfbp_poly', SH_PLUGIN_DIR_URL.'js/custom-elements-builtin.js');
wp_enqueue_script('xfbp_js', SH_PLUGIN_DIR_URL.'js/x-frame-bypass.js');
}
/* FROM HERE IS THE DEPRECATED PART */ /* FROM HERE IS THE DEPRECATED PART */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment