| 1 |
<?php |
| 2 |
|
| 3 |
namespace BlockEditorColors; |
| 4 |
|
| 5 |
class BlockEditorColors { |
| 6 |
|
| 7 |
private static $_instance = null; |
| 8 |
|
| 9 |
public static function getInstance() { |
| 10 |
if ( is_null( self::$_instance ) ) { |
| 11 |
self::$_instance = new self(); |
| 12 |
} |
| 13 |
|
| 14 |
return self::$_instance; |
| 15 |
} |
| 16 |
|
| 17 |
public function __construct() { |
| 18 |
add_action( 'init', array( $this, 'setup_color_service' ) ); |
| 19 |
add_action( 'plugin_action_links_' . plugin_basename( BEC_PLUGIN_FILE ), array( $this, 'action_links' ) ); |
| 20 |
} |
| 21 |
|
| 22 |
public function setup_color_service() { |
| 23 |
include_once dirname( __FILE__ ) . '/OptionsService.php'; |
| 24 |
include_once dirname( __FILE__ ) . '/DefaultColorsService.php'; |
| 25 |
include_once dirname( __FILE__ ) . '/CustomColorsService.php'; |
| 26 |
include_once dirname( __FILE__ ) . '/ColorsService.php'; |
| 27 |
include_once dirname( __FILE__ ) . '/admin/AdminPages.php'; |
| 28 |
} |
| 29 |
|
| 30 |
public function action_links( $links ) { |
| 31 |
|
| 32 |
$settings_page_url = SettingsPage::getAdminUrl(); |
| 33 |
|
| 34 |
$plugin_links = array( |
| 35 |
'<a href=' . esc_url( $settings_page_url ) . '>' . esc_html__( 'Settings', 'block-editor-colors' ) . '</a>' |
| 36 |
); |
| 37 |
|
| 38 |
return array_merge( $links, $plugin_links ); |
| 39 |
} |
| 40 |
|
| 41 |
} |