-
Notifications
You must be signed in to change notification settings - Fork 0
/
idx-broker-featured-properties.php
65 lines (50 loc) · 1.79 KB
/
idx-broker-featured-properties.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
<?php
/*
* Plugin Name: IDX Broker Featured Properties
* Plugin URI: https://github.com/statenweb/idx-broker-featured-properties
* Description: API for curating featured properties from IDX Broker
* Author: StatenWeb, Mat Gargano
* Version: 1.0.7
* Text Domain: idx-broker-featured-properties
* Author URI: https://statenweb.com
*/
use IDX_Broker_Featured_Properties\Notice\Notice;
use IDX_Broker_Featured_Properties\Properties\Featured;
use IDX_Broker_Featured_Properties\Settings\Global_Settings;
use IDX_Broker_Featured_Properties\Settings\Posts;
use IDX_Broker_Featured_Properties\Widget\Featured_Properties;
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/wp-api-libraries/wp-idxbroker-api/wp-idxbroker-api.php';
$namespace = 'IDX_Broker_Featured_Properties';
spl_autoload_register( function ( $class ) use ( $namespace ) {
$base = explode( '\\', $class );
if ( $namespace === $base[0] ) {
$file = __DIR__ . DIRECTORY_SEPARATOR . strtolower( str_replace( [ '\\', '_' ], [
DIRECTORY_SEPARATOR,
'-'
], $class ) . '.php' );
if ( file_exists( $file ) ) {
require $file;
} else {
die( sprintf( 'File %s not found', $file ) );
}
}
} );
$global_settings = new Global_Settings();
$global_settings->init();
$notice = new Notice();
$notice->init();
$posts = new Posts();
$posts->init();
$widget = new Featured_Properties();
$widget->init();
function ibfp_get_featured_properties( $what = [], $return_all_if_empty = false ) {
return Featured::get( $what, $return_all_if_empty );
}
add_action( 'admin_enqueue_scripts', 'ibfp_admin_enqueues' );
function ibfp_admin_enqueues() {
wp_enqueue_script( 'ibfp-admin', plugin_dir_url( __FILE__ ) . '/js/admin.js',
[ 'jquery-ui-sortable' ] );
wp_enqueue_style( 'ibfp-admin',
plugin_dir_url( __FILE__ ) . '/css/admin.css' );
}