Shortcodes.php
5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
namespace Codemanas\VczApi;
use Codemanas\VczApi\Shortcodes\Embed;
use Codemanas\VczApi\Shortcodes\Meetings;
use Codemanas\VczApi\Shortcodes\Recordings;
use Codemanas\VczApi\Shortcodes\Webinars;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Shortcodes Controller
*
* @since 3.0.0
* @author Deepen
*/
class Shortcodes {
public static $_instance = null;
public static function get_instance() {
return is_null( self::$_instance ) ? self::$_instance = new self() : self::$_instance;
}
/**
* Shortcodes container
*
* @var array
*/
private array $shortcodes;
/**
* Zoom_Video_Conferencing_Shorcodes constructor.
*/
public function __construct() {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 100 );
$meetings = Meetings::get_instance();
$webinars = Webinars::get_instance();
$recordings = Recordings::get_instance();
$embedded = Embed::get_instance();
$this->shortcodes = array(
'zoom_api_link' => array( $meetings, 'show_meeting_by_ID' ),
'zoom_meeting_post' => array( $meetings, 'show_meeting_by_postTypeID' ),
'zoom_list_meetings' => array( $meetings, 'list_cpt_meetings' ),
'zoom_list_host_meetings' => array( $meetings, 'list_live_host_meetings' ),
//Embed Browser
'zoom_join_via_browser' => array( $embedded, 'join_via_browser' ),
//Webinars
'zoom_api_webinar' => array( $webinars, 'show_webinar_by_ID' ),
'zoom_list_webinars' => array( $webinars, 'list_cpt_webinars' ),
'zoom_list_host_webinars' => array( $webinars, 'list_live_host_webinars' ),
//Recordings
'zoom_recordings' => array( $recordings, 'recordings_by_user' ),
'zoom_recordings_by_meeting' => array( $recordings, 'recordings_by_meeting_id' )
);
$this->init_shortcodes();
}
/**
* Init the Shortcode adding function
*/
public function init_shortcodes() {
foreach ( $this->shortcodes as $shortcode => $callback ) {
add_shortcode( $shortcode, $callback );
}
}
/**
* Enqueuing Scripts
*/
public function enqueue_scripts() {
$minified = SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_style( 'video-conferencing-with-zoom-api' );
wp_register_style( 'video-conferencing-with-zoom-api-datable', ZVC_PLUGIN_VENDOR_ASSETS_URL . '/datatable/jquery.dataTables.min.css', false, ZVC_PLUGIN_VERSION );
wp_register_style( 'video-conferencing-with-zoom-api-datable-responsive', ZVC_PLUGIN_VENDOR_ASSETS_URL . '/datatable-responsive/responsive.dataTables.min.css', [ 'video-conferencing-with-zoom-api-datable' ], ZVC_PLUGIN_VERSION );
wp_register_script( 'video-conferencing-with-zoom-api-datable-js', ZVC_PLUGIN_VENDOR_ASSETS_URL . '/datatable/jquery.dataTables.min.js', [ 'jquery' ], ZVC_PLUGIN_VERSION, true );
wp_register_script( 'video-conferencing-with-zoom-api-datable-dt-responsive-js', ZVC_PLUGIN_VENDOR_ASSETS_URL . '/datatable-responsive/dataTables.responsive.min.js', [
'jquery',
'video-conferencing-with-zoom-api-datable-js'
], ZVC_PLUGIN_VERSION, true );
wp_register_script( 'video-conferencing-with-zoom-api-datable-responsive-js', ZVC_PLUGIN_VENDOR_ASSETS_URL . '/datatable-responsive/responsive.dataTables.min.js', [
'jquery',
'video-conferencing-with-zoom-api-datable-js'
], ZVC_PLUGIN_VERSION, true );
wp_register_script( 'video-conferncing-with-zoom-browser-js', ZVC_PLUGIN_PUBLIC_ASSETS_URL . '/js/join-via-browser' . $minified . '.js', array( 'jquery' ), ZVC_PLUGIN_VERSION, true );
wp_register_script( 'video-conferencing-with-zoom-api-shortcode-js', ZVC_PLUGIN_PUBLIC_ASSETS_URL . '/js/shortcode' . $minified . '.js', [
'jquery',
'video-conferencing-with-zoom-api-datable-js'
], ZVC_PLUGIN_VERSION, true );
wp_localize_script( 'video-conferencing-with-zoom-api-shortcode-js', 'vczapi_ajax', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
) );
wp_localize_script( 'video-conferencing-with-zoom-api-datable-js', 'vczapi_dt_i18n', array(
'emptyTable' => __( 'No data available in table', 'video-conferencing-with-zoom-api' ),
'info' => sprintf( __( 'Showing %s to %s of %s entries', 'video-conferencing-with-zoom-api' ), '_START_', '_END_', '_TOTAL_' ),
'infoEmpty' => __( '', 'video-conferencing-with-zoom-api' ),
'infoFiltered' => sprintf( __( 'filtered from %s total entries', 'video-conferencing-with-zoom-api' ), '_MAX_' ),
'lengthMenu' => sprintf( __( 'Show %s entries', 'video-conferencing-with-zoom-api' ), '_MENU_' ),
'loadingRecords' => __( 'Loading', 'video-conferencing-with-zoom-api' ),
'processing' => __( 'Processing', 'video-conferencing-with-zoom-api' ),
'search' => __( 'Search', 'video-conferencing-with-zoom-api' ),
'zeroRecords' => __( 'No matching records found', 'video-conferencing-with-zoom-api' ),
'paginate' => [
'first' => __( 'First', 'video-conferencing-with-zoom-api' ),
'last' => __( 'Last', 'video-conferencing-with-zoom-api' ),
'next' => __( 'Next', 'video-conferencing-with-zoom-api' ),
'previous' => __( 'Previous', 'video-conferencing-with-zoom-api' )
]
) );
}
}