Add About tab with markdown support
This commit is contained in:
@ -847,4 +847,58 @@ input:checked + .wp-toggle-slider:before {
|
|||||||
.wpa-pro-plugin .button {
|
.wpa-pro-plugin .button {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Markdown Content Styles for About Tab */
|
||||||
|
.wp-allstars-markdown-content {
|
||||||
|
line-height: 1.6;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-allstars-markdown-content h1 {
|
||||||
|
font-size: 2em;
|
||||||
|
margin: 0.67em 0;
|
||||||
|
border-bottom: 1px solid #eaecef;
|
||||||
|
padding-bottom: 0.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-allstars-markdown-content h2 {
|
||||||
|
font-size: 1.5em;
|
||||||
|
margin: 0.83em 0;
|
||||||
|
border-bottom: 1px solid #eaecef;
|
||||||
|
padding-bottom: 0.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-allstars-markdown-content h3 {
|
||||||
|
font-size: 1.25em;
|
||||||
|
margin: 1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-allstars-markdown-content ul {
|
||||||
|
padding-left: 2em;
|
||||||
|
margin: 1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-allstars-markdown-content li {
|
||||||
|
margin: 0.5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-allstars-markdown-content a {
|
||||||
|
color: #0073aa;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-allstars-markdown-content a:hover {
|
||||||
|
color: #00a0d2;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-allstars-markdown-content p {
|
||||||
|
margin: 1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* About Tab Panel */
|
||||||
|
#about .wpa-pro-plugin {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
}
|
}
|
47
admin/data/about.php
Normal file
47
admin/data/about.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* About page data for WP ALLSTARS plugin
|
||||||
|
* Content supports markdown formatting
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define about page content
|
||||||
|
function wp_allstars_get_about_content() {
|
||||||
|
return [
|
||||||
|
'title' => 'About WP ALLSTARS',
|
||||||
|
'content' => <<<MARKDOWN
|
||||||
|
## Welcome to WP ALLSTARS
|
||||||
|
|
||||||
|
WP ALLSTARS is a powerful all-in-one WordPress toolkit designed to help you build, manage, and optimize your WordPress websites more efficiently.
|
||||||
|
|
||||||
|
### Our Mission
|
||||||
|
|
||||||
|
Our mission is to simplify WordPress development and management by providing a comprehensive suite of tools that work seamlessly together.
|
||||||
|
|
||||||
|
### Key Features
|
||||||
|
|
||||||
|
* **Theme Management**: Easily install and manage professional WordPress themes
|
||||||
|
* **Plugin Recommendations**: Curated lists of the best free and premium plugins
|
||||||
|
* **Workflow Optimization**: Tools to streamline your development process
|
||||||
|
* **Hosting Recommendations**: Find the perfect hosting provider for your needs
|
||||||
|
* **Advanced Settings**: Fine-tune your WordPress installation
|
||||||
|
|
||||||
|
### Get in Touch
|
||||||
|
|
||||||
|
Have questions or suggestions? We'd love to hear from you!
|
||||||
|
|
||||||
|
* **Website**: [wpallstars.com](https://wpallstars.com)
|
||||||
|
* **Documentation**: [docs.wpallstars.com](https://docs.wpallstars.com)
|
||||||
|
* **Support**: [support@wpallstars.com](mailto:support@wpallstars.com)
|
||||||
|
|
||||||
|
### Credits
|
||||||
|
|
||||||
|
WP ALLSTARS is developed and maintained by a team of WordPress enthusiasts dedicated to creating the best possible WordPress experience.
|
||||||
|
|
||||||
|
Version: {WP_ALLSTARS_VERSION}
|
||||||
|
MARKDOWN
|
||||||
|
];
|
||||||
|
}
|
114
admin/includes/class-about-manager.php
Normal file
114
admin/includes/class-about-manager.php
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* About Page Manager Class
|
||||||
|
*
|
||||||
|
* @package WP_ALLSTARS
|
||||||
|
* @since 0.2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
class WP_Allstars_About_Manager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the class
|
||||||
|
*/
|
||||||
|
public static function init() {
|
||||||
|
add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue_styles'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue styles for the about tab
|
||||||
|
*
|
||||||
|
* @param string $hook Current admin page hook
|
||||||
|
*/
|
||||||
|
public static function enqueue_styles($hook) {
|
||||||
|
if ('settings_page_wp-allstars' !== $hook) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_enqueue_style(
|
||||||
|
'wp-allstars-admin',
|
||||||
|
plugins_url('css/wp-allstars-admin.css', dirname(__FILE__)),
|
||||||
|
array(),
|
||||||
|
WP_ALLSTARS_VERSION
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the about page content
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function get_about_content() {
|
||||||
|
return wp_allstars_get_about_content();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the about tab content
|
||||||
|
*/
|
||||||
|
public static function display_tab_content() {
|
||||||
|
$about = self::get_about_content();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="wp-allstars-settings-content tab-content" id="about">
|
||||||
|
<div class="wpa-pro-plugins">
|
||||||
|
<div class="wpa-pro-plugin">
|
||||||
|
<h3><?php echo esc_html($about['title']); ?></h3>
|
||||||
|
|
||||||
|
<div class="wp-allstars-markdown-content">
|
||||||
|
<?php echo self::parse_markdown($about['content']); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse markdown content to HTML
|
||||||
|
*
|
||||||
|
* A simple markdown parser for basic formatting
|
||||||
|
*
|
||||||
|
* @param string $markdown The markdown content
|
||||||
|
* @return string The HTML content
|
||||||
|
*/
|
||||||
|
private static function parse_markdown($markdown) {
|
||||||
|
// Replace version placeholder with actual version
|
||||||
|
$markdown = str_replace('{WP_ALLSTARS_VERSION}', WP_ALLSTARS_VERSION, $markdown);
|
||||||
|
|
||||||
|
// Headers
|
||||||
|
$markdown = preg_replace('/^### (.*?)$/m', '<h3>$1</h3>', $markdown);
|
||||||
|
$markdown = preg_replace('/^## (.*?)$/m', '<h2>$1</h2>', $markdown);
|
||||||
|
$markdown = preg_replace('/^# (.*?)$/m', '<h1>$1</h1>', $markdown);
|
||||||
|
|
||||||
|
// Bold and Italic
|
||||||
|
$markdown = preg_replace('/\*\*(.*?)\*\*/s', '<strong>$1</strong>', $markdown);
|
||||||
|
$markdown = preg_replace('/\*(.*?)\*/s', '<em>$1</em>', $markdown);
|
||||||
|
|
||||||
|
// Lists
|
||||||
|
$markdown = preg_replace('/^\* (.*?)$/m', '<li>$1</li>', $markdown);
|
||||||
|
$markdown = preg_replace('/(<li>.*?<\/li>\n)+/s', '<ul>$0</ul>', $markdown);
|
||||||
|
|
||||||
|
// Links
|
||||||
|
$markdown = preg_replace('/\[(.*?)\]\((.*?)\)/s', '<a href="$2" target="_blank">$1</a>', $markdown);
|
||||||
|
|
||||||
|
// Paragraphs
|
||||||
|
$markdown = preg_replace('/^(?!<[a-z]).+$/m', '<p>$0</p>', $markdown);
|
||||||
|
|
||||||
|
// Fix multiple paragraph tags
|
||||||
|
$markdown = str_replace('<p><p>', '<p>', $markdown);
|
||||||
|
$markdown = str_replace('</p></p>', '</p>', $markdown);
|
||||||
|
|
||||||
|
// Fix lists within paragraphs
|
||||||
|
$markdown = str_replace('<p><ul>', '<ul>', $markdown);
|
||||||
|
$markdown = str_replace('</ul></p>', '</ul>', $markdown);
|
||||||
|
|
||||||
|
return $markdown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize the class
|
||||||
|
WP_Allstars_About_Manager::init();
|
@ -250,6 +250,9 @@ class WP_Allstars_Admin_Manager {
|
|||||||
<a href="?page=wp-allstars&tab=tools" class="nav-tab <?php echo $active_tab === 'tools' ? 'nav-tab-active' : ''; ?>">
|
<a href="?page=wp-allstars&tab=tools" class="nav-tab <?php echo $active_tab === 'tools' ? 'nav-tab-active' : ''; ?>">
|
||||||
<?php esc_html_e('Tools', 'wp-allstars'); ?>
|
<?php esc_html_e('Tools', 'wp-allstars'); ?>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="?page=wp-allstars&tab=about" class="nav-tab <?php echo $active_tab === 'about' ? 'nav-tab-active' : ''; ?>">
|
||||||
|
<?php esc_html_e('About', 'wp-allstars'); ?>
|
||||||
|
</a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div class="wp-allstars-tab-content">
|
<div class="wp-allstars-tab-content">
|
||||||
@ -287,6 +290,10 @@ class WP_Allstars_Admin_Manager {
|
|||||||
case 'tools':
|
case 'tools':
|
||||||
WP_Allstars_Tools_Manager::display_tab_content();
|
WP_Allstars_Tools_Manager::display_tab_content();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'about':
|
||||||
|
WP_Allstars_About_Manager::display_tab_content();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,12 +59,16 @@ if (is_admin()) {
|
|||||||
require_once plugin_dir_path(__FILE__) . 'admin/includes/class-pro-plugins-manager.php';
|
require_once plugin_dir_path(__FILE__) . 'admin/includes/class-pro-plugins-manager.php';
|
||||||
require_once plugin_dir_path(__FILE__) . 'admin/includes/class-plugin-manager.php';
|
require_once plugin_dir_path(__FILE__) . 'admin/includes/class-plugin-manager.php';
|
||||||
require_once plugin_dir_path(__FILE__) . 'admin/includes/class-free-plugins-manager.php';
|
require_once plugin_dir_path(__FILE__) . 'admin/includes/class-free-plugins-manager.php';
|
||||||
|
require_once plugin_dir_path(__FILE__) . 'admin/includes/class-about-manager.php';
|
||||||
|
|
||||||
// Initialize the admin manager
|
// Initialize the admin manager
|
||||||
add_action('plugins_loaded', array('WP_Allstars_Admin_Manager', 'init'));
|
add_action('plugins_loaded', array('WP_Allstars_Admin_Manager', 'init'));
|
||||||
|
|
||||||
// Legacy files (for backward compatibility)
|
// Data files
|
||||||
require_once plugin_dir_path(__FILE__) . 'admin/data/pro-plugins.php';
|
require_once plugin_dir_path(__FILE__) . 'admin/data/pro-plugins.php';
|
||||||
|
require_once plugin_dir_path(__FILE__) . 'admin/data/about.php';
|
||||||
|
|
||||||
|
// Legacy files (for backward compatibility)
|
||||||
require_once plugin_dir_path(__FILE__) . 'admin/settings.php';
|
require_once plugin_dir_path(__FILE__) . 'admin/settings.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user