Initial Commit - Created Structure and Basic Settings Menu

This commit is contained in:
Paul Kirby 2018-08-20 18:39:57 -05:00
commit 0dac605bc6
22 changed files with 288 additions and 0 deletions

0
.gitignore vendored Normal file
View file

0
README.md Normal file
View file

0
admin/css/.gitkeep Normal file
View file

0
admin/js/.gitkeep Normal file
View file

View file

@ -0,0 +1,32 @@
<?php
/**
* Class for intializing and displaying all admin settings
*
* @package LBRYPress
*/
if (! class_exists('LBRY_Admin')) {
class LBRY_Admin
{
public function settings_init()
{
add_action('admin_menu', array($this, 'create_options_page'));
}
public function create_options_page()
{
add_options_page(
__('LBRYPress Settings', 'lbrypress'),
__('LBRYPress', 'lbrypress'),
'manage_options',
'LBRYPress',
array($this, 'options_page_html')
);
}
public function options_page_html()
{
require_once(LBRY_URI . '/templates/options_page.php');
}
}
}

View file

@ -0,0 +1,12 @@
<?php
/**
* Class for sending LBRYPress related admin notifications
*
* @package LBRYPress
*/
if (! class_exists('LBRY_Notifier')) {
class LBRY_Notifier
{
}
}

View file

@ -0,0 +1,12 @@
<?php
/**
* Main class for the Daemon setup
*
* @package LBRYPress
*/
if (! class_exists('LBRY_Daemon')) {
class LBRY_Daemon
{
}
}

View file

@ -0,0 +1,12 @@
<?php
/**
* A class for logging LBRY Daemon interactions
*
* @package LBRYPress
*/
if (! class_exists('LBRY_Daemon_Logger')) {
class LBRY_Daemon_Logger
{
}
}

View file

@ -0,0 +1,12 @@
<?php
/**
* Class for connecting with the LBRY Network
*
* @package LBRYPress
*/
if (! class_exists('LBRY_Network')) {
class LBRY_Network
{
}
}

View file

@ -0,0 +1,12 @@
<?php
/**
* Parses wordpress posts to be ready for the LBRY Network
*
* @package LBRYPress
*/
if (! class_exists('LBRY_Network_Parser')) {
class LBRY_Network_Parser
{
}
}

View file

@ -0,0 +1,12 @@
<?php
/**
* Class for publishing to the LBRY Network
*
* @package LBRYPress
*/
if (! class_exists('LBRY_Network_Publisher')) {
class LBRY_Network_Publisher
{
}
}

View file

@ -0,0 +1,13 @@
<?php
/**
* Handles post saves and updates, triggering proper plugin
* functions when necessary
*
* @package LBRYPress
*/
if (! class_exists('LBRY_Post_Handler')) {
class LBRY_Post_Handler
{
}
}

27
classes/lbrypress.php Normal file
View file

@ -0,0 +1,27 @@
<?php
/**
* Main LBRYPress class
*
* @package LBRYPress
*/
if (! class_exists('LBRYPress')) {
class LBRYPress
{
private $LBRY_Admin;
public function __construct()
{
$this->requireDependencies();
$this->LBRY_Admin = new LBRY_Admin();
$this->LBRY_Admin->settings_init();
}
private function requireDependencies()
{
require_once(LBRY_URI . '/classes/admin/lbry_admin.php');
}
}
}

View file

@ -0,0 +1,14 @@
<?php
/**
* Connects to an spee.ch style server to host assets via the LBRY Protocol
*
* Visit https://github.com/lbryio/spee.ch for more info
*
* @package LBRYPress
*/
if (! class_exists('LBRY_Speech')) {
class LBRY_Speech_Parser
{
}
}

View file

@ -0,0 +1,12 @@
<?php
/**
* Parses post markup in order to use specified spee.ch url for assets
*
* @package LBRYPress
*/
if (! class_exists('LBRY_Speech_Parser')) {
class LBRY_Speech_Parser
{
}
}

0
inc/.gitkeep Normal file
View file

2
index.php Normal file
View file

@ -0,0 +1,2 @@
<?php
// Silence is golden

79
lbrypress.php Normal file
View file

@ -0,0 +1,79 @@
<?php
/**
* @package LBRYPress
*/
/*
Plugin Name: LBRYPress
Plugin URI:
Description: Connect your wordpress posts to
Version: 0.0.1
Author: Underground Web Lab
Author URI: https://undergroundweblab.com
License: MIT License
Text Domain: lbrypress
Copyright 2018 Underground Web Lab
// TODO: Finalize License Verbage
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
defined('ABSPATH') || die('No Peeking!');
// Global Constants
define('LBRY_NAME', 'LBRYPress');
define('LBRY_URI', dirname(__FILE__));
define('LBRY_REQUIRED_PHP_VERSION', '5.3'); // TODO: Figure out what versions we actually need
define('LBRY_REQUIRED_WP_VERSION', '3.1');
/**
* Checks if the system requirements are met
*
* @return bool True if system requirements are met, false if not
*/
function lbry_requirements_met()
{
global $wp_version;
//require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); // to get is_plugin_active() early
if (version_compare(PHP_VERSION, LBRY_REQUIRED_PHP_VERSION, '<')) {
return false;
}
if (version_compare($wp_version, LBRY_REQUIRED_WP_VERSION, '<')) {
return false;
}
return true;
}
/**
* Prints an error that the system requirements weren't met.
*/
function lbry_requirements_error()
{
global $wp_version;
require_once(LBRY_URI . '/templates/requirements-error.php');
}
/*
* Check requirements and load main class
* The main program needs to be in a separate file that only gets loaded if the plugin requirements are met. Otherwise older PHP installations could crash when trying to parse it.
*/
if (lbry_requirements_met()) {
require_once(dirname(__FILE__) . '/classes/lbrypress.php');
if (class_exists('LBRYPress')) {
$lbryPress = new LBRYPress();
// register_activation_hook(__FILE__, array( $lbryPress, 'activate' ));
// register_deactivation_hook(__FILE__, array( $lbryPress, 'deactivate' ));
}
} else {
add_action('admin_notices', 'lbry_requirements_error');
}

View file

@ -0,0 +1,8 @@
<div class="wrap">
<h1><?= esc_html(get_admin_page_title()); ?></h1>
<form action="options.php" method="post">
<?php
submit_button('Save Settings');
?>
</form>
</div>

View file

@ -0,0 +1,18 @@
<div class="error">
<p><?php echo LBRY_NAME; ?> error: Your environment doesn't meet all of the system requirements listed below.</p>
<ul class="ul-disc">
<li>
<strong>PHP <?php echo LBRY_REQUIRED_PHP_VERSION; ?>+</strong>
<em>(You're running version <?php echo PHP_VERSION; ?>)</em>
</li>
<li>
<strong>WordPress <?php echo LBRY_REQUIRED_WP_VERSION; ?>+</strong>
<em>(You're running version <?php echo esc_html($wp_version); ?>)</em>
</li>
</ul>
<p>If you need to upgrade your version of PHP you can ask your hosting company for assistance, and if you need help upgrading WordPress you can refer to <a href="http://codex.wordpress.org/Upgrading_WordPress">the Codex</a>.</p>
</div>

0
tests/.gitkeep Normal file
View file

11
uninstall.php Normal file
View file

@ -0,0 +1,11 @@
<?php
/**
* Triggers during plugin uninstall
*
* @package LBRYPress
*/
// if uninstall.php is not called by WordPress, die
defined('WP_UNINSTALL_PLUGIN') || die();
// TODO: create uninstall procedures