Move widget, templates, libraries and functions into includes directory
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
function sportspress_after_setup_theme() {
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'sportspress_after_setup_theme' );
|
||||
@@ -1,4 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* EOS v2.0
|
||||
* https://github.com/jlawrence11/Classes
|
||||
*
|
||||
* Equation Operating System Classes
|
||||
*
|
||||
* Copyright 2005-2013, Jon Lawrence <jlawrence11@gmail.com>
|
||||
* Licensed under LGPL 2.1 License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Equation Operating System Classes.
|
||||
*
|
||||
@@ -51,12 +61,6 @@ define('EQEOS_E_NO_VAR', 5503);
|
||||
if(!defined('DEBUG'))
|
||||
define('DEBUG', false);
|
||||
|
||||
//We use a stack class so we don't have to keep track of indices for an array
|
||||
// May eventually update to use `array_pop()` `end()` and `array_push()` instead
|
||||
// of this class.
|
||||
require_once "stack.class.php";
|
||||
|
||||
|
||||
/**
|
||||
* Equation Operating System (EOS) Parser
|
||||
*
|
||||
@@ -73,7 +77,7 @@ require_once "stack.class.php";
|
||||
* @subpackage EOS
|
||||
* @version 2.0
|
||||
*/
|
||||
class SP_eqEOS {
|
||||
class eqEOS {
|
||||
/**#@+
|
||||
*Private variables
|
||||
*/
|
||||
@@ -1496,7 +1496,12 @@ if ( !function_exists( 'sp_solve' ) ) {
|
||||
|
||||
if ( $clearance ):
|
||||
// Equation Operating System
|
||||
$eos = new SP_eqEOS();
|
||||
if ( ! class_exists( 'phpStack' ) )
|
||||
include_once( SP()->plugin_path() . '/includes/libraries/class-phpstack.php' );
|
||||
if ( ! class_exists( 'eqEOS' ) )
|
||||
include_once( SP()->plugin_path() . '/includes/libraries/class-eqeos.php' );
|
||||
|
||||
$eos = new eqEOS();
|
||||
|
||||
// Solve using EOS
|
||||
return round( $eos->solveIF( str_replace( ' ', '', $equation ), $vars ), $precision );
|
||||
1
includes/sp-template-functions.php
Normal file
1
includes/sp-template-functions.php
Normal file
@@ -0,0 +1 @@
|
||||
sp-template-functions.php
|
||||
@@ -1,142 +0,0 @@
|
||||
# Classes
|
||||
---
|
||||
|
||||
## eos.class.php
|
||||
|
||||
### Equation Operating System
|
||||
|
||||
This class makes it incredibly easy to use and parse/solve equations in
|
||||
your own applications. It includes a graph generator to turn an equation
|
||||
with a variable in to a `y=x` graph, with the capability to calculate
|
||||
the upper and lower `y-bounds`. __NOTE__ NONE of the functions within
|
||||
these two classes are static, any example that looks like a static function
|
||||
call is representational of the class being used, but should be initialized
|
||||
and assigned to a variable first. It is also important to note that these
|
||||
classes throw exceptions if running in to errors, please read the beginning
|
||||
of the `eos.class.php` file for the defines of the exceptions thrown. Exceptions
|
||||
includes a descriptive message of the error encountered and within `eqEOS` will
|
||||
also typically include the full equation used.
|
||||
|
||||
#### eqEOS
|
||||
|
||||
This class has one important function, `eqEOS::solveIF()` which does all the legwork,
|
||||
so we'll start there and end with examples.
|
||||
To initialize this class, use:
|
||||
|
||||
$eos = new eqEOS();
|
||||
|
||||
##### solveIF($infix, $variables)
|
||||
|
||||
To use this function:
|
||||
|
||||
$value = $eos->solveIF($eq, $vars);
|
||||
|
||||
###### _$infix_
|
||||
|
||||
Is simply a standard equation with variable support. Variables
|
||||
have two forms, one is native to PHP programmers already, prefixed with '$'.
|
||||
The other way to declare a variable is with '&' and is included for
|
||||
backward compatibility for with the initial version from 2005.
|
||||
Example Equations:
|
||||
|
||||
2(4$x)
|
||||
2(4&x)
|
||||
5+ ((1+2)*4) +3
|
||||
5+4(1+2)+3
|
||||
10*sin($x)
|
||||
10*cos($x)
|
||||
|
||||
The first two pairs shown are exactly the same. The parser has good implied
|
||||
multiplication, for everything but allowed functions. Allowed functions require
|
||||
an implicit operator on either/both sides to work properly, I hope to change
|
||||
that in the next revision; but for now, note that it will not work as you would
|
||||
expect.
|
||||
For example:
|
||||
|
||||
5sin(1.5707963267) = 51
|
||||
5*sin(1.5707963267) = 5
|
||||
sin(1.5707963267)5 = 15
|
||||
|
||||
The reason is because there is no implied multiplication being applied, the result
|
||||
of `sin(1.5707963267) = 1` is being concatenated with the number 5, giving
|
||||
incredibly odd results if you are not expecting it.
|
||||
|
||||
###### _$variables_
|
||||
|
||||
The variables are fairly simple to understand. If it contains a scalar (ie
|
||||
a non-array value) _every_ variable within the equation will be replaced with
|
||||
that number. If it contains an array, there will be a by-variable replacement -
|
||||
note that the array MUST be in the format of `'variable' => value`
|
||||
Such as:
|
||||
|
||||
array(
|
||||
'x' => 2,
|
||||
'y' => 3
|
||||
)
|
||||
|
||||
Given the equation:
|
||||
|
||||
5$x^$y
|
||||
|
||||
If this is called by:
|
||||
|
||||
eqEOS::solveIF('5$x^$y', 2)
|
||||
|
||||
It will equal '20', as every variable is replaced by 2. However, if called like:
|
||||
|
||||
eqEOS::solveIF('5$x^$y', array(
|
||||
'x' => 2,
|
||||
'y' => 3);
|
||||
|
||||
You will get the result of '40' as it would equate to '5*2^3', as expected.
|
||||
|
||||
#### eqGraph
|
||||
|
||||
This is the fun class that can create graphs. It extends `eqEOS`.
|
||||
To initialize use:
|
||||
|
||||
$graph = new eqGraph($width, $height);
|
||||
|
||||
The `$width` and `$height` are the values used for the image size, defaulting to
|
||||
a `640x480` image size if initialized with `$graph = new eqGraph();`
|
||||
|
||||
##### graph($eq, $xLow, $xHigh, $xStep, [$xyGrid, $yGuess, ...])
|
||||
|
||||
This method will generate the graph for the equation (`$eq`) with a min and max
|
||||
`x` range that it will parse through. All Variables explained:
|
||||
* `$eq`
|
||||
The Standard Equation to use. _Must_ have a variable in it. (ie `$x`)
|
||||
* `$xLow`
|
||||
The starting point for the calculations - the left side of the graph.
|
||||
* `$xHigh`
|
||||
The last point calculated for the variable - the right side of the graph.
|
||||
* `$xStep`
|
||||
Stepping point for the variable. Suggested not to use a value less than
|
||||
`.01`. This is the precision of the graph.
|
||||
* `$xyGrid = false`
|
||||
Show `x/y` gridlines on the graph. Defaults to false. Each grid line
|
||||
is set at every integer (ie `1,2,3,...100`). If working with small ranges,
|
||||
it is suggested to turn this on.
|
||||
* `$yGuess = true`
|
||||
Guess the Lower and Upper `y-bounds` (The bottom and top of the image
|
||||
respectively.) This will set the the bounds to the lowest `y` value
|
||||
encountered for the `$yLow`, and the largest `y` value for `$yHight`.
|
||||
* `$yLow = false`
|
||||
Lower bound for `y`, will be reset if a lower value for `y` is found.
|
||||
* `$yHigh = false`
|
||||
Upper bound for `y`, will be reset if a larger `y` value is found.
|
||||
|
||||
TODO:
|
||||
* Add `x` and `y` labels
|
||||
* Smart `grid spacing` calculations so can be effective with large ranges.
|
||||
* Smart (default) `$xStep` calcuations based on image size and ranges.
|
||||
|
||||
To set up a graph with a `21x21` window (ie `-10 to 10`) for the equation
|
||||
`sin($x)` and output as PNG, would use as:
|
||||
|
||||
$graph->graph('sin($x)', -10, 10, 0.01, true, false, -10, 10);
|
||||
$graph->outPNG();
|
||||
|
||||
It would look like:
|
||||

|
||||
---
|
||||
164
sportspress.php
164
sportspress.php
@@ -117,106 +117,101 @@ final class SportsPress {
|
||||
* Include required core files used in admin and on the frontend.
|
||||
*/
|
||||
private function includes() {
|
||||
|
||||
// Libraries
|
||||
require_once dirname( __FILE__ ) . '/lib/eos/eos.class.php' ;
|
||||
|
||||
// Globals
|
||||
require_once dirname( __FILE__ ) . '/admin/includes/globals.php';
|
||||
include_once( 'admin/includes/globals.php' );
|
||||
|
||||
// Functions
|
||||
require_once dirname( __FILE__ ) . '/functions.php';
|
||||
require_once dirname( __FILE__ ) . '/includes/sp-deprecated-functions.php';
|
||||
include_once( 'includes/sp-core-functions.php' );
|
||||
include_once( 'includes/sp-deprecated-functions.php' );
|
||||
|
||||
// Templates
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/countdown.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/event-details.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/event-performance.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/event-results.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/event-staff.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/event-venue.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/event-calendar.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/event-list.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/league-table.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/player-league-performance.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/player-list.php';
|
||||
//require_once dirname( __FILE__ ) . '/admin/templates/player-roster.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/player-gallery.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/player-metrics.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/player-performance.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/templates/team-columns.php';
|
||||
include_once( 'includes/templates/countdown.php' );
|
||||
include_once( 'includes/templates/event-details.php' );
|
||||
include_once( 'includes/templates/event-performance.php' );
|
||||
include_once( 'includes/templates/event-results.php' );
|
||||
include_once( 'includes/templates/event-staff.php' );
|
||||
include_once( 'includes/templates/event-venue.php' );
|
||||
include_once( 'includes/templates/event-calendar.php' );
|
||||
include_once( 'includes/templates/event-list.php' );
|
||||
include_once( 'includes/templates/league-table.php' );
|
||||
include_once( 'includes/templates/player-league-performance.php' );
|
||||
include_once( 'includes/templates/player-list.php' );
|
||||
//include_once( 'includes/templates/player-roster.php' );
|
||||
include_once( 'includes/templates/player-gallery.php' );
|
||||
include_once( 'includes/templates/player-metrics.php' );
|
||||
include_once( 'includes/templates/player-performance.php' );
|
||||
include_once( 'includes/templates/team-columns.php' );
|
||||
|
||||
// Options
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/settings.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-general.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-event.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-team.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-player.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-text.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/settings/options-permalink.php';
|
||||
include_once( 'admin/settings/settings.php' );
|
||||
include_once( 'admin/settings/options-general.php' );
|
||||
include_once( 'admin/settings/options-event.php' );
|
||||
include_once( 'admin/settings/options-team.php' );
|
||||
include_once( 'admin/settings/options-player.php' );
|
||||
include_once( 'admin/settings/options-text.php' );
|
||||
include_once( 'admin/settings/options-permalink.php' );
|
||||
|
||||
// Custom post types
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/separator.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/column.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/performance.php';
|
||||
//require_once dirname( __FILE__ ) . '/admin/post-types/statistic.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/metric.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/result.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/outcome.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/event.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/calendar.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/team.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/table.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/player.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/list.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/post-types/staff.php';
|
||||
//require_once dirname( __FILE__ ) . '/admin/post-types/directory.php';
|
||||
include_once( 'admin/post-types/separator.php' );
|
||||
include_once( 'admin/post-types/column.php' );
|
||||
include_once( 'admin/post-types/performance.php' );
|
||||
//include_once( 'admin/post-types/statistic.php' );
|
||||
include_once( 'admin/post-types/metric.php' );
|
||||
include_once( 'admin/post-types/result.php' );
|
||||
include_once( 'admin/post-types/outcome.php' );
|
||||
include_once( 'admin/post-types/event.php' );
|
||||
include_once( 'admin/post-types/calendar.php' );
|
||||
include_once( 'admin/post-types/team.php' );
|
||||
include_once( 'admin/post-types/table.php' );
|
||||
include_once( 'admin/post-types/player.php' );
|
||||
include_once( 'admin/post-types/list.php' );
|
||||
include_once( 'admin/post-types/staff.php' );
|
||||
//include_once( 'admin/post-types/directory.php' );
|
||||
|
||||
// Terms
|
||||
require_once dirname( __FILE__ ) . '/admin/terms/league.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/terms/season.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/terms/venue.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/terms/position.php';
|
||||
include_once( 'admin/terms/league.php' );
|
||||
include_once( 'admin/terms/season.php' );
|
||||
include_once( 'admin/terms/venue.php' );
|
||||
include_once( 'admin/terms/position.php' );
|
||||
|
||||
// Tools
|
||||
require_once dirname( __FILE__ ) . '/admin/tools/importers.php';
|
||||
include_once( 'admin/tools/importers.php' );
|
||||
|
||||
// Typical request actions
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/plugins-loaded.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/after-setup-theme.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/wp-enqueue-scripts.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/loop-start.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/the-title.php';
|
||||
include_once( 'admin/hooks/plugins-loaded.php' );
|
||||
include_once( 'admin/hooks/wp-enqueue-scripts.php' );
|
||||
include_once( 'admin/hooks/loop-start.php' );
|
||||
include_once( 'admin/hooks/the-title.php' );
|
||||
|
||||
// Admin request actions
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/admin-init.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/admin-menu.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/admin-enqueue-scripts.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/admin-print-styles.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/admin-head.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/current-screen.php';
|
||||
include_once( 'admin/hooks/admin-init.php' );
|
||||
include_once( 'admin/hooks/admin-menu.php' );
|
||||
include_once( 'admin/hooks/admin-enqueue-scripts.php' );
|
||||
include_once( 'admin/hooks/admin-print-styles.php' );
|
||||
include_once( 'admin/hooks/admin-head.php' );
|
||||
include_once( 'admin/hooks/current-screen.php' );
|
||||
|
||||
// Administrative actions
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/manage-posts-columns.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/post-thumbnail-html.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/restrict-manage-posts.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/parse-query.php';;
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/save-post.php';
|
||||
include_once( 'admin/hooks/manage-posts-columns.php' );
|
||||
include_once( 'admin/hooks/post-thumbnail-html.php' );
|
||||
include_once( 'admin/hooks/restrict-manage-posts.php' );
|
||||
include_once( 'admin/hooks/parse-query.php' );
|
||||
include_once( 'admin/hooks/save-post.php' );
|
||||
|
||||
// Filters
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/admin-post-thumbnail-html.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/gettext.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/pre-get-posts.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/the-posts.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/sanitize-title.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/the-content.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/widget-text.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/wp-insert-post-data.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/plugin-action-links.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/post-updated-messages.php';
|
||||
include_once( 'admin/hooks/admin-post-thumbnail-html.php' );
|
||||
include_once( 'admin/hooks/gettext.php' );
|
||||
include_once( 'admin/hooks/pre-get-posts.php' );
|
||||
include_once( 'admin/hooks/the-posts.php' );
|
||||
include_once( 'admin/hooks/sanitize-title.php' );
|
||||
include_once( 'admin/hooks/the-content.php' );
|
||||
include_once( 'admin/hooks/widget-text.php' );
|
||||
include_once( 'admin/hooks/wp-insert-post-data.php' );
|
||||
include_once( 'admin/hooks/plugin-action-links.php' );
|
||||
include_once( 'admin/hooks/post-updated-messages.php' );
|
||||
|
||||
// Register activation hook
|
||||
require_once dirname( __FILE__ ) . '/admin/hooks/register-activation-hook.php';
|
||||
include_once( 'admin/hooks/register-activation-hook.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,12 +230,12 @@ final class SportsPress {
|
||||
* Include core widgets
|
||||
*/
|
||||
public function include_widgets() {
|
||||
require_once dirname( __FILE__ ) . '/admin/widgets/countdown.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/widgets/event-calendar.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/widgets/event-list.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/widgets/league-table.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/widgets/player-list.php';
|
||||
require_once dirname( __FILE__ ) . '/admin/widgets/player-gallery.php';
|
||||
include_once( 'includes/widgets/class-sp-widget-countdown.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-event-calendar.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-event-list.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-league-table.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-player-list.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-player-gallery.php' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,13 +262,14 @@ final class SportsPress {
|
||||
|
||||
// Global + Frontend Locale
|
||||
load_textdomain( 'sportspress', WP_LANG_DIR . "/sportspress/sportspress-$locale.mo" );
|
||||
load_plugin_textdomain( 'sportspress', false, plugin_basename( dirname( __FILE__ ) ) . "/languages" );
|
||||
load_plugin_textdomain( 'sportspress', false, plugin_basename( dirname( __FILE__ ) . "/languages" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure theme and server variable compatibility and setup image sizes..
|
||||
*/
|
||||
public function setup_environment() {
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
}
|
||||
|
||||
/** Helper functions ******************************************************/
|
||||
|
||||
Reference in New Issue
Block a user