some linting
This commit is contained in:
parent
fba9948b9d
commit
1f93f58760
2 changed files with 31 additions and 28 deletions
|
@ -1,8 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Class responsible for Event Plugin related admin notices.
|
* General settings class.
|
||||||
*
|
*
|
||||||
* Notices for guiding to proper configuration of ActivityPub with event plugins.
|
* This file contains the General class definition, which handles the "General" settings
|
||||||
|
* page for the ActivityPub Event Extension Plugin, providing options for configuring various general settings.
|
||||||
*
|
*
|
||||||
* @package Activitypub_Event_Extensions
|
* @package Activitypub_Event_Extensions
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
|
@ -10,7 +11,8 @@
|
||||||
|
|
||||||
namespace Activitypub_Event_Extensions\Admin;
|
namespace Activitypub_Event_Extensions\Admin;
|
||||||
|
|
||||||
use Activitypub_Event_Extensions\Setup;
|
// Exit if accessed directly.
|
||||||
|
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class responsible for Event Plugin related admin notices.
|
* Class responsible for Event Plugin related admin notices.
|
||||||
|
@ -21,7 +23,7 @@ use Activitypub_Event_Extensions\Setup;
|
||||||
*/
|
*/
|
||||||
class Settings_Page {
|
class Settings_Page {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* TODO:
|
* TODO:
|
||||||
* - [ ] create settings page
|
* - [ ] create settings page
|
||||||
* - [ ] skeleton
|
* - [ ] skeleton
|
||||||
|
@ -35,8 +37,9 @@ class Settings_Page {
|
||||||
* - [ ] advanced for mapping
|
* - [ ] advanced for mapping
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const static = 'Activitypub_Event_Extensions\Admin\Settings_Page';
|
const STATIC = 'Activitypub_Event_Extensions\Admin\Settings_Page';
|
||||||
const settings_slug = 'activitypub-events';
|
|
||||||
|
const SETTINGS_SLUG = 'activitypub-events';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Warning if the plugin is Active and the ActivityPub plugin is not.
|
* Warning if the plugin is Active and the ActivityPub plugin is not.
|
||||||
|
@ -46,8 +49,8 @@ class Settings_Page {
|
||||||
'Activitypub Event Extension',
|
'Activitypub Event Extension',
|
||||||
'Activitypub Events',
|
'Activitypub Events',
|
||||||
'manage_options',
|
'manage_options',
|
||||||
self::settings_slug,
|
self::SETTINGS_SLUG,
|
||||||
array( self::static, 'settings_page' )
|
array( self::STATIC, 'settings_page' )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,14 +58,14 @@ class Settings_Page {
|
||||||
* Adds Link to the settings page in the plugin page.
|
* Adds Link to the settings page in the plugin page.
|
||||||
* It's called via apply_filter('plugin_action_links_' . PLUGIN_NAME).
|
* It's called via apply_filter('plugin_action_links_' . PLUGIN_NAME).
|
||||||
*
|
*
|
||||||
* @param links already added links
|
* @param array $links Already added links.
|
||||||
* @return array original links but with link to setting page added
|
* @return array Original links but with link to setting page added.
|
||||||
*/
|
*/
|
||||||
public static function settings_link( $links ) {
|
public static function settings_link( $links ) {
|
||||||
return array_merge(
|
return array_merge(
|
||||||
$links,
|
$links,
|
||||||
array(
|
array(
|
||||||
'<a href="' . admin_url( 'options-general.php?page=' . self::settings_slug ) . '">Settings</a>',
|
'<a href="' . admin_url( 'options-general.php?page=' . self::SETTINGS_SLUG ) . '">Settings</a>',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -81,12 +84,12 @@ class Settings_Page {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// todo generate this somehow
|
// TODO: generate this somehow.
|
||||||
// maybe with filters, similar as with the settings
|
// Maybe with filters, similar as with the settings!
|
||||||
$submenu_options = array(
|
$submenu_options = array(
|
||||||
'general' => array(
|
'general' => array(
|
||||||
'name' => 'General',
|
'name' => 'General',
|
||||||
'active' => false
|
'active' => false,
|
||||||
),
|
),
|
||||||
'events_manager' => array(
|
'events_manager' => array(
|
||||||
'name' => 'Events Manager',
|
'name' => 'Events Manager',
|
||||||
|
@ -109,7 +112,7 @@ class Settings_Page {
|
||||||
$submenu_options[ $tab ]['active'] = true;
|
$submenu_options[ $tab ]['active'] = true;
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'slug' => settings_slug,
|
'slug' => self::SETTINGS_SLUG,
|
||||||
'options' => $submenu_options,
|
'options' => $submenu_options,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -121,7 +124,5 @@ class Settings_Page {
|
||||||
\load_template( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_DIR . 'templates/settings-extractor.php', true, $args );
|
\load_template( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_DIR . 'templates/settings-extractor.php', true, $args );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,10 +141,12 @@ class Setup {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'admin_menu', array( Settings_Page::static, 'admin_menu' ) );
|
add_action( 'admin_menu', array( Settings_Page::STATIC, 'admin_menu' ) );
|
||||||
add_filter( 'plugin_action_links_' . ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_BASENAME,
|
|
||||||
array( Settings_Page::static, 'settings_link' ) );
|
|
||||||
|
|
||||||
|
add_filter(
|
||||||
|
'plugin_action_links_' . ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_BASENAME,
|
||||||
|
array( Settings_Page::STATIC, 'settings_link' )
|
||||||
|
);
|
||||||
add_filter( 'activitypub_transformer', array( $this, 'register_activitypub_event_transformer' ), 10, 3 );
|
add_filter( 'activitypub_transformer', array( $this, 'register_activitypub_event_transformer' ), 10, 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue