-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfront-editor.php
49 lines (32 loc) · 943 Bytes
/
front-editor.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
<?php
/*
* Plugin Name: FrontEditor by uptimizt
* Description: Digest form, full editor
* Author: uptimizt
* Version: 0.2
*/
namespace U7\FrontEditor;
class Core {
public static function init(){
require_once __DIR__ . '/src/DigestSubmitShortcode.php';
}
public static function get_file_path($file_path = ''){
return trailingslashit(plugin_dir_path(__FILE__)) . $file_path;
}
public static function get_file_url($file_path = ''){
return plugins_url($file_path, __FILE__);
}
public static function render($path = '', $data = []){
if(empty($path)){
echo '';
}
if ( ! empty( $data ) && is_array( $data ) ) {
extract( $data );
}
$path = sprintf("templates/%s", $path);
$path = self::get_file_path($path);
$template = file_exists( $path ) ? $path : '';
include $template;
}
}
Core::init();