-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathscreenly-cast.php
More file actions
72 lines (64 loc) · 1.93 KB
/
screenly-cast.php
File metadata and controls
72 lines (64 loc) · 1.93 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
<?php
/**
* Plugin Name: Screenly Cast
* Plugin URI: https://www.screenly.io
* Description: A WordPress plugin to enable easy and beautiful casting of pages, posts and image media on Screenly digital signage devices.
* Version: 1.0.5
* Requires at least: 6.2.4
* Requires PHP: 7.4
* Author: Screenly, Inc
* Author URI: https://www.screenly.io
* License: GPLv2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: screenly-cast
*
* @package ScreenlyCast
*/
declare(strict_types=1);
namespace ScreenlyCast;
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'SRLY_VERSION', 'VERSION_PLACEHOLDER' );
define( 'SRLY_WP_VERSION', '4.4.0' );
define( 'SRLY_PLUGIN_URI', plugin_dir_url( __FILE__ ) );
define( 'SRLY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'SRLY_PLUGIN_NAME', plugin_basename( __FILE__ ) );
define( 'SRLY_INC_DIR', SRLY_PLUGIN_DIR . 'inc' );
define( 'SRLY_THEME', 'screenly-cast' );
define( 'SRLY_THEME_URI', SRLY_PLUGIN_URI . 'theme/screenly-cast' );
define( 'SRLY_THEME_DIR', SRLY_PLUGIN_DIR . 'theme/screenly-cast' );
define( 'SRLY_PREFIX', 'srly_' );
// Set up class autoloader.
spl_autoload_register(
function ( $class_name ) {
// Only handle our own namespace.
if ( strpos( $class_name, 'ScreenlyCast\\' ) !== 0 ) {
return;
}
// Convert namespace to file path.
$class_path = str_replace( 'ScreenlyCast\\', '', $class_name );
$class_path = str_replace( '\\', DIRECTORY_SEPARATOR, $class_path );
$file = __DIR__ . '/inc/' . $class_path . '.php';
if ( file_exists( $file ) ) {
require_once $file;
}
}
);
try {
$screenly_plugin = new Plugin();
$screenly_plugin->init();
} catch ( \Exception $e ) {
add_action(
'admin_notices', function () use ( $e ) {
$class = 'notice notice-error';
$message = $e->getMessage();
printf(
'<div class="%1$s"><p>%2$s</p></div>',
esc_attr( $class ),
esc_html( $message )
);
}
);
}