-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0a64534
Showing
23 changed files
with
713 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// JavaScript for admin area |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* Admin CSS styles */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
class AIAutoblogger_Admin { | ||
|
||
// Admin-related methods | ||
// ... | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
// Check user capabilities | ||
if (!current_user_can('manage_options')) { | ||
return; | ||
} | ||
|
||
// Fetch saved options | ||
$options = get_option('ai_autoblogger_options'); | ||
?> | ||
<div class="wrap"> | ||
<h1><?= esc_html(get_admin_page_title()); ?></h1> | ||
|
||
<!-- Settings form --> | ||
<form action="options.php" method="post"> | ||
<?php | ||
settings_fields('ai-autoblogger'); | ||
do_settings_sections('ai-autoblogger'); | ||
submit_button(); | ||
?> | ||
</form> | ||
|
||
<!-- Manual post generation form --> | ||
<form action="<?php echo esc_url(admin_url('admin.php?page=ai-autoblogger')); ?>" method="post"> | ||
<?php wp_nonce_field('ai_autoblogger_generate_post'); ?> | ||
<input type="hidden" name="action" value="generate_post"> | ||
<?php submit_button('Generate Post Now'); ?> | ||
</form> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
// Check user capabilities | ||
if (!current_user_can('manage_options')) { | ||
return; | ||
} | ||
|
||
// Fetch saved options | ||
$options = get_option('ai_autoblogger_options'); | ||
?> | ||
<div class="wrap"> | ||
<h1><?= esc_html(get_admin_page_title()); ?></h1> | ||
<form action="options.php" method="post"> | ||
<?php | ||
settings_fields('ai-autoblogger'); | ||
do_settings_sections('ai-autoblogger'); | ||
|
||
// Add your fields here | ||
?> | ||
<h2>General Settings</h2> | ||
<table class="form-table"> | ||
<tr> | ||
<th scope="row"><label for="ai_autoblogger_api_key">OpenAI API Key</label></th> | ||
<td> | ||
<input type="text" id="ai_autoblogger_api_key" name="ai_autoblogger_options[api_key]" value="<?php echo esc_attr($options['api_key'] ?? ''); ?>" class="regular-text"> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th scope="row"><label for="ai_autoblogger_post_frequency">Post Frequency</label></th> | ||
<td> | ||
<select id="ai_autoblogger_post_frequency" name="ai_autoblogger_options[post_frequency]"> | ||
<option value="30min" <?php selected($options['post_frequency'], '30min'); ?>>Every 30 minutes</option> | ||
<option value="1hour" <?php selected($options['post_frequency'], '1hour'); ?>>Every hour</option> | ||
<option value="3hours" <?php selected($options['post_frequency'], '3hours'); ?>>Every 3 hours</option> | ||
<!-- Add more options as needed --> | ||
</select> | ||
</td> | ||
</tr> | ||
<!-- Add more settings fields as needed --> | ||
</table> | ||
|
||
<?php submit_button('Save Settings'); ?> | ||
</form> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
/** | ||
* Plugin Name: AI Autoblogger | ||
* Description: Automatically generates blog posts using OpenAI. | ||
* Version: 1.0 | ||
* Author: Your Name | ||
* Text Domain: ai-autoblogger | ||
*/ | ||
|
||
// If this file is called directly, abort. | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
// Include the main AI Autoblogger class from the 'includes' folder. | ||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-ai-autoblogger.php'; | ||
|
||
// Begins execution of the plugin by instantiating the main class. | ||
$plugin = new AIAutoblogger(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* Styles for frontend display of AI-generated posts */ | ||
.ai-post { | ||
/* Style for AI post */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// JavaScript for frontend interactions | ||
document.addEventListener('DOMContentLoaded', function() { | ||
// Your code here | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Developer Guide for AI Autoblogger | ||
|
||
## Overview | ||
This document is for developers looking to understand or contribute to the AI Autoblogger plugin. | ||
|
||
## Plugin Architecture | ||
- Overview of the plugin structure | ||
- Description of key classes and functions | ||
|
||
## Extending the Plugin | ||
- How to add new features | ||
- Guidelines for contributing | ||
|
||
## API Reference | ||
- Detailed API documentation | ||
|
||
## Contact | ||
- How to get in touch for development-related queries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# AI Autoblogger Plugin File Structure | ||
|
||
This document outlines the file structure for the AI Autoblogger WordPress plugin. | ||
|
||
## Root Directory | ||
|
||
- `ai-autoblogger.php`: The main plugin file which initializes the plugin. | ||
|
||
## Includes | ||
|
||
- `class-ai-autoblogger.php`: Main class file for the plugin's functionality. | ||
- `class-openai-api.php`: Handles integration with the OpenAI API. | ||
- ... | ||
|
||
## Admin | ||
|
||
- `class-ai-autoblogger-admin.php`: Manages admin-specific functionality. | ||
- `views/`: Contains admin view templates. | ||
|
||
## Assets | ||
|
||
- `css/`: CSS files for styling. | ||
- `js/`: JavaScript files for interactive functionality. | ||
|
||
## Templates | ||
|
||
- `custom-post-type-template.php`: Template for custom post types. | ||
|
||
## Languages | ||
|
||
- Localization files for the plugin. | ||
|
||
## Docs | ||
|
||
- Documentation files including user guides and developer information. | ||
|
||
## Tests | ||
|
||
- `tests.php`: Unit tests for the plugin. | ||
|
||
## Vendor | ||
|
||
- External libraries used by the plugin. | ||
|
||
## Readme | ||
|
||
- `readme.txt`: Basic plugin information and instructions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# User Guide for AI Autoblogger | ||
|
||
## Introduction | ||
This guide provides instructions on how to use the AI Autoblogger plugin. | ||
|
||
## Getting Started | ||
- Installation steps | ||
- Setting up | ||
|
||
## Creating Posts | ||
- How to generate posts | ||
- Configuring post settings | ||
|
||
## FAQs | ||
- Frequently asked questions | ||
|
||
## Support | ||
- Contact info for support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
// Handle AJAX requests here | ||
add_action('wp_ajax_generate_post', 'handle_generate_post_ajax'); | ||
|
||
function handle_generate_post_ajax() { | ||
check_ajax_referer('ai_autoblogger_generate_post'); | ||
|
||
$openai_api = new OpenAI_API(); // Ensure this is correctly instantiated | ||
$post_generator = new Post_Generator($openai_api); | ||
$result = $post_generator->generate_and_publish_post(); | ||
|
||
if ($result === false) { | ||
wp_send_json_error('Failed to generate post'); | ||
} else { | ||
wp_send_json_success('Post generated successfully'); | ||
} | ||
|
||
wp_die(); // Terminate AJAX request | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* The admin-specific functionality of the plugin. | ||
*/ | ||
|
||
class AIAutoblogger_Admin { | ||
|
||
/** | ||
* Register the settings page for the plugin. | ||
*/ | ||
public function __construct() { | ||
add_action('admin_menu', array($this, 'add_settings_page')); | ||
} | ||
|
||
/** | ||
* Add settings page to the WordPress admin menu. | ||
*/ | ||
public function add_settings_page() { | ||
add_options_page( | ||
'AI Autoblogger Settings', | ||
'AI Autoblogger', | ||
'manage_options', | ||
'ai-autoblogger', | ||
array($this, 'display_settings_page') | ||
); | ||
} | ||
|
||
/** | ||
* Display the settings page content. | ||
*/ | ||
public function display_settings_page() { | ||
// Include the settings page view | ||
include_once plugin_dir_path(__FILE__) . 'views/settings-page.php'; | ||
} | ||
|
||
// Additional methods for handling settings... | ||
} |
Oops, something went wrong.