3. Load page setting admin (ok)
wp-content/plugins/lionel-setup-content/admin/class-lionel_content-settings.php
<?php
class Lionel_Content_Settings
{
private $plugin_name;
private $version;
private $buffer;
public function __construct ()
{
}
public function load_page ()
{
?>
<div class="ecp-grid ecp-col-940 ecp-top-menu" ecp-registered="1">
<div class="ecp-header-wrapper">
<div class="ecp-grid ecp-col-700">
<div class="ecp-header-logo"></div>
<ul class="ecp-header-menu">
<li class="ecp-active-tab"><a class="ecp-tab-selector" href="#" data-link="ecp_settings"><span><?php _e('Settings', 'evergreen_content_poster'); ?></span></a></li>
<li class=""><a class="ecp-tab-selector" href="<?php echo get_bloginfo('wpurl'); ?>/wp-admin/admin.php?page=evergreen_content_library" data-link="ecp_content_library"><span><?php _e('Content Library', 'evergreen_content_poster'); ?></span></a></li>
</ul>
</div>
<div class="ecp-grid ecp-col-220 ecp-fit">
<?php
wp_nonce_field('evergreen-settings-save', 'evergreen-settings-save');
?>
<button id="save_settings" class="button ecp-navy-button ecp-save-settings" disabled><?php _e('Save Changes', 'evergreen_content_poster'); ?></button>
</div>
<div class="ecp-clearfix"></div>
</div>
<div class="ecp-wrapper">
<div class="ecp-container">
<div class="ecp-section">
<div class="ecp-grid ecp-col-700">
<form id="ecp_settings_form" method="post" action="<?php echo esc_html (admin_url ('admin-post.php')); ?>">
<div class="ecp-admin-tab ecp-grid ecp-col-940"
style="display: block;">
<div class="ecp-section ecp-grid ecp-col-940 ecp-fit ecp-option-container ecp-general-settings-title-wrapper">
<h2><?php _e('General Settings', 'evergreen_content_poster'); ?></h2>
</div>
<div class="ecp-grid ecp-col-940 ecp-option-container ecp-field-setting">
<div class="ecp-grid ecp-col-300">
<p class="ecp-input-label ecp-label-min-days"><?php _e('Minimum number of days not to repeat the same post', 'evergreen_content_poster'); ?></p>
<p class="description"><?php _e('If zero, this won\'t be taken into account and post can be potentially be posted twice on the same day.', 'evergreen_content_poster'); ?></p>
</div>
<div class="ecp-grid ecp-col-300">
<input type="number" name="eg_numberofdays" min="1" max="120" required="true" value="2" class="ecp-admin-input field-setting" data-ref="saved_numberofdays" aria-invalid="false" />
<input type="hidden" name="saved_numberofdays" value="1" />
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
}
}
wp-content/plugins/lionel-setup-content/admin/class-lionel_content-admin.php
<?php
class Lionel_Content_Admin
{
private $plugin_name;
private $version;
private $plugin_public_name;
private $service;
private $client_id;
private $settings;
private $buffer_service;
public function __construct ($plugin_name, $version)
{
$this->plugin_name = $plugin_name;
$this->version = $version;
$this->plugin_public_name = 'Lionel Content';
$this->service = 'Buffer';
$this->load_dependencies();
}
public function enqueue_styles ()
{
if (LIONEL_CONTENT_ENABLE_DEBUG == true) :
wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/lionel_content-admin.css', array(), time(), 'all');
else :
wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/lionel_content-admin.css', array(), $this->version, 'all');
endif;
}
public function enqueue_scripts ()
{
if (LIONEL_CONTENT_ENABLE_DEBUG == true) :
wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/lionel_content-admin.js', array('jquery'), time(), false);
// set variables for script
wp_localize_script($this->plugin_name, 'ajaxSettings', array('ajaxurl' => admin_url('admin-ajax.php')));
else :
wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/lionel_content-admin.js', array('jquery'), $this->version, false);
// set variables for script
wp_localize_script($this->plugin_name, 'ajaxSettings', array('ajaxurl' => admin_url('admin-ajax.php')));
endif;
}
public function load_dependencies ()
{
require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-lionel_content_buffer.php';
require_once plugin_dir_path(dirname(__FILE__))
. 'admin/class-lionel_content-settings.php';
$this->settings = new Lionel_Content_Settings();
}
public function lionel_content_admin_menu ()
{
if (!is_user_logged_in()) {
return;
}
add_menu_page(
__('Evergreen Content', 'evergreen_content_poster'),
'Evergreen Content',
'edit_posts',
'lionel_content_settings',
array($this, 'lionel_content_sett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3N0MyMjQuMjM2IDM1Mi40NyAyMjUuMDM4IDM0My4zMTcgMjI4LjU5NiAzMzUuNzI5QzIyOS40OTQgMzMzLjgxNiAyMjcuOTA3IDMzMy40MzMgMjI3LjA0OSAzMzMuMjg4QzIyMC41NzYgMzMyLjE5MSAyMTMuMTU3IDMzMi44ODUgMjA1Ljc4OCAzMzUuNjY1QzE4OS4xOTEgMzQxLjkyNiAxNzkuOTk0IDM1NC4yODMgMTgxLjIwNyAzNjkuMzAzQzE4MS41NDkgMzczLjY4NyAxODIuNTA5IDM3Ny4zMzkgMTgzLjkyIDM4MC4zNDdaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNMzQ5LjIxIDcuOTYzMzhMMjk0LjUyNiAxMjguNTQzTDM0MS42NjcgMTI4LjU0M0wzOTQuMjUzIDcuOTYzMzhMMzQ5LjIxIDcuOTYzMzhaIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjE1IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo='
);
}
public function lionel_content_settings_page()
{
$this->settings->load_page();
}
}
wp-content/plugins/lionel-setup-content/admin/class-lionel_content-admin.php
Full code
Last updated