forked from ucsc/ucsc-gutenberg-blocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
74 lines (58 loc) · 2.58 KB
/
index.php
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
<?php
/**
* Plugin Name: UCSC Service Blocks
* Plugin URI: https://github.com/ucsc/ucsc-service-blocks
* Description: Service blocks for UCSC WordPress Websites.
* Requires at least: 6.1
* Requires PHP: 7.0
* Version: 2.0.2-beta
* Author: UC Santa Cruz
* Author URI: https://github.com/ucsc
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: ucscservice
* Domain Path: service-blocks
*
* @package ucsc-blocks
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
require_once plugin_dir_path( __FILE__ ) . 'classes/CourseCatalog.php';
require_once plugin_dir_path( __FILE__ ) . 'classes/CampusDirectory.php';
require_once plugin_dir_path( __FILE__ ) . 'classes/ClassSchedule.php';
// New option for using shortcode without Service blocks
require_once plugin_dir_path( __FILE__ ) . 'classes/CampusDirectoryShortcode.php';
// include_once(plugin_dir_path(__FILE__) . 'classes/Ucsc_Services_Blocks_Content_Sharer.php');
require_once plugin_dir_path( __FILE__ ) . 'classes/SiteSettings.php';
add_action( 'admin_enqueue_scripts', 'ucsc_service_blocks_register_js_build' );
function ucsc_service_blocks_register_js_build() {
wp_enqueue_script( 'ucscserviceblocks', plugin_dir_url( __FILE__ ) . 'build/index.js', array( 'wp-blocks', 'wp-element', 'wp-components', 'wp-block-editor' ) );
}
// $UCSCServiceDemoBlock1 = new UCSCServiceDemoBlock1();
// $UCSCServiceDemoBlock2 = new UCSCServiceDemoBlock2();
// $Ucsc_Services_Blocks_Content_Sharer = new Ucsc_Services_Blocks_Content_Sharer();
$CourseCatalog = new Ucsc_Services_Blocks_Course_Catalog();
$CampusDirectory = new Ucsc_Services_Blocks_Campus_Directory();
$ClassSchedule = new Ucsc_Services_Blocks_Class_Schedule();
$SiteSettings = new Ucsc_Services_Blocks_Site_Settings();
$CampusDirectoryShortcode = new Ucsc_Services_Blocks_Campus_Directory_Shortcode();
// $Ucsc_Services_Blocks_Content_Sharer = new Ucsc_Services_Blocks_Content_Sharer();
// Add link to Settings page
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'ucsc_service_blocks_plugin_action_links' );
function ucsc_service_blocks_plugin_action_links( $links ) {
// Build and escape the URL.
$url = esc_url( add_query_arg(
'page',
'ucsc-service-blocks-plugin-settings',
get_admin_url() . 'options-general.php'
) );
// Create the link.
$settings_link = "<a href='$url'>" . __( 'Settings' ) . '</a>';
// Adds the link to the end of the array.
array_push(
$links,
$settings_link
);
return $links;
}