Widgets added and PHP error fixed for version < 5.2
This commit is contained in:
@@ -10,8 +10,8 @@ function sportspress_admin_enqueue_scripts() {
|
||||
wp_enqueue_script( 'google-maps', 'http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places' );
|
||||
wp_enqueue_script( 'jquery-locationpicker', SPORTSPRESS_PLUGIN_URL .'/assets/js/locationpicker.jquery.js', array( 'jquery' ), '0.1.6', true );
|
||||
wp_enqueue_script( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL .'/assets/js/admin.js', array( 'jquery' ), time(), true );
|
||||
wp_localize_script( 'sportspress-admin', 'localized_strings', array(
|
||||
'remove_text' => __( 'Remove', 'sportspress' )
|
||||
) );
|
||||
|
||||
// Localize scripts.
|
||||
wp_localize_script( 'sportspress-admin', 'localized_strings', array( 'remove_text' => __( 'Remove', 'sportspress' ) ) );
|
||||
}
|
||||
add_action( 'admin_enqueue_scripts', 'sportspress_admin_enqueue_scripts' );
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
<?php
|
||||
function sportspress_admin_menu( $position ) {
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) )
|
||||
return;
|
||||
|
||||
global $menu, $submenu;
|
||||
|
||||
// Find where our placeholder is in the menu
|
||||
foreach( $menu as $key => $data ) {
|
||||
foreach( $menu as $key => $data ):
|
||||
if ( is_array( $data ) && array_key_exists( 2, $data ) && $data[2] == 'edit.php?post_type=sp_separator' )
|
||||
$position = $key;
|
||||
}
|
||||
$seperator_position = $key;
|
||||
endforeach;
|
||||
|
||||
// Swap our placeholder post type with a menu separator
|
||||
if ( $position ):
|
||||
$menu[ $position ] = array( '', 'read', 'separator-sportspress', '', 'wp-menu-separator sportspress' );
|
||||
if ( $seperator_position ):
|
||||
$menu[ $seperator_position ] = array( '', 'read', 'separator-sportspress', '', 'wp-menu-separator sportspress' );
|
||||
endif;
|
||||
|
||||
// Remove "Venues" and "Positions" links from Media submenu
|
||||
@@ -66,4 +63,4 @@ if ( ! function_exists( 'sportspress_admin_menu_remove_venues' ) ) {
|
||||
function sportspress_admin_menu_remove_venues( $arr = array() ) {
|
||||
return $arr[0] != __( 'Venues', 'sportspress' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
|
||||
global $post;
|
||||
switch ( $column ):
|
||||
case 'sp_icon':
|
||||
edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-icon' ), '', '', $post_id );
|
||||
edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-icon' ), '', '', $post_id );
|
||||
break;
|
||||
case 'sp_views':
|
||||
echo sportspress_get_post_views( $post_id );
|
||||
|
||||
75
admin/hooks/media-buttons.php
Normal file
75
admin/hooks/media-buttons.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
function sportspress_media_buttons() {
|
||||
|
||||
//if ( ! in_array( array('post.php', 'page.php', 'page-new.php', 'post-new.php')
|
||||
|
||||
?>
|
||||
<a href="#TB_inline?width=480&inlineId=select_sp_table" class="thickbox button sp-insert sp-insert-map" id="add_gform" title="<?php printf( __( 'Add %s', 'sportspress' ), __( 'Map', 'sportspress' ) ); ?>"><span class="sp-buttons-icon sp-map-buttons-icon "></span> <?php printf( __( 'Add %s', 'sportspress' ), __( 'Map', 'sportspress' ) ); ?></a>
|
||||
<a href="#TB_inline?width=480&inlineId=select_sp_table" class="thickbox button sp-insert sp-insert-table" id="add_gform" title="<?php printf( __( 'Add %s', 'sportspress' ), __( 'League Table', 'sportspress' ) ); ?>"><span class="sp-buttons-icon sp-table-buttons-icon "></span> <?php printf( __( 'Add %s', 'sportspress' ), __( 'League Table', 'sportspress' ) ); ?></a>
|
||||
<?php
|
||||
}
|
||||
add_action( 'media_buttons', 'sportspress_media_buttons', 20 );
|
||||
|
||||
/*
|
||||
//Action target that displays the popup to insert a form to a post/page
|
||||
public static function add_mce_popup(){
|
||||
?>
|
||||
<script>
|
||||
function InsertForm(){
|
||||
var form_id = jQuery("#add_form_id").val();
|
||||
if(form_id == ""){
|
||||
alert("<?php _e("Please select a form", "gravityforms") ?>");
|
||||
return;
|
||||
}
|
||||
|
||||
var form_name = jQuery("#add_form_id option[value='" + form_id + "']").text().replace(/[\[\]]/g, '');
|
||||
var display_title = jQuery("#display_title").is(":checked");
|
||||
var display_description = jQuery("#display_description").is(":checked");
|
||||
var ajax = jQuery("#gform_ajax").is(":checked");
|
||||
var title_qs = !display_title ? " title=\"false\"" : "";
|
||||
var description_qs = !display_description ? " description=\"false\"" : "";
|
||||
var ajax_qs = ajax ? " ajax=\"true\"" : "";
|
||||
|
||||
window.send_to_editor("[gravityform id=\"" + form_id + "\" name=\"" + form_name + "\"" + title_qs + description_qs + ajax_qs + "]");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="select_gravity_form" style="display:none;">
|
||||
<div class="wrap <?php echo GFCommon::get_browser_class() ?>">
|
||||
<div>
|
||||
<div style="padding:15px 15px 0 15px;">
|
||||
<h3 style="color:#5A5A5A!important; font-family:Georgia,Times New Roman,Times,serif!important; font-size:1.8em!important; font-weight:normal!important;"><?php _e("Insert A Form", "gravityforms"); ?></h3>
|
||||
<span>
|
||||
<?php _e("Select a form below to add it to your post or page.", "gravityforms"); ?>
|
||||
</span>
|
||||
</div>
|
||||
<div style="padding:15px 15px 0 15px;">
|
||||
<select id="add_form_id">
|
||||
<option value=""> <?php _e("Select a Form", "gravityforms"); ?> </option>
|
||||
<?php
|
||||
$forms = RGFormsModel::get_forms(1, "title");
|
||||
foreach($forms as $form){
|
||||
?>
|
||||
<option value="<?php echo absint($form->id) ?>"><?php echo esc_html($form->title) ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select> <br/>
|
||||
<div style="padding:8px 0 0 0; font-size:11px; font-style:italic; color:#5A5A5A"><?php _e("Can't find your form? Make sure it is active.", "gravityforms"); ?></div>
|
||||
</div>
|
||||
<div style="padding:15px 15px 0 15px;">
|
||||
<input type="checkbox" id="display_title" checked='checked' /> <label for="display_title"><?php _e("Display form title", "gravityforms"); ?></label>
|
||||
<input type="checkbox" id="display_description" checked='checked' /> <label for="display_description"><?php _e("Display form description", "gravityforms"); ?></label>
|
||||
<input type="checkbox" id="gform_ajax" /> <label for="gform_ajax"><?php _e("Enable AJAX", "gravityforms"); ?></label>
|
||||
</div>
|
||||
<div style="padding:15px;">
|
||||
<input type="button" class="button-primary" value="<?php _e("Insert Form", "gravityforms"); ?>" onclick="InsertForm();"/>
|
||||
<a class="button" style="color:#bbb;" href="#" onclick="tb_remove(); return false;"><?php _e("Cancel", "gravityforms"); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
*/
|
||||
@@ -15,14 +15,12 @@ function sportspress_plugins_loaded() {
|
||||
// Add image sizes
|
||||
if ( function_exists( 'add_image_size' ) ) {
|
||||
|
||||
// Header
|
||||
add_image_size( 'sportspress-header', 1600, 700, true );
|
||||
|
||||
// Standard (3:2)
|
||||
add_image_size( 'sportspress-standard', 637, 425, true );
|
||||
add_image_size( 'sportspress-standard-thumbnail', 303, 202, true );
|
||||
|
||||
// Wide (16:9)
|
||||
add_image_size( 'sportspress-wide-header', 1600, 900, true );
|
||||
add_image_size( 'sportspress-wide', 637, 358, true );
|
||||
add_image_size( 'sportspress-wide-thumbnail', 303, 170, true );
|
||||
|
||||
@@ -33,9 +31,7 @@ function sportspress_plugins_loaded() {
|
||||
// Fit (Proportional)
|
||||
add_image_size( 'sportspress-fit', 637, 637, false );
|
||||
add_image_size( 'sportspress-fit-thumbnail', 303, 303, false );
|
||||
|
||||
// Icon (Proportional)
|
||||
add_image_size( 'sportspress-icon', 32, 32, false );
|
||||
add_image_size( 'sportspress-fit-icon', 32, 32, false );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
<?php
|
||||
function sportspress_pre_get_posts( $query ) {
|
||||
if( !is_admin() )
|
||||
return $query;
|
||||
|
||||
$post_type = $query->query['post_type'];
|
||||
if ( is_admin() ):
|
||||
$post_type = $query->query['post_type'];
|
||||
|
||||
if ( in_array( $post_type, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic' ) ) ):
|
||||
$query->set( 'orderby', 'menu_order' );
|
||||
$query->set( 'order', 'ASC' );
|
||||
elseif ( $post_type == 'sp_event' ):
|
||||
$query->set( 'orderby', 'post_date' );
|
||||
$query->set( 'order', 'ASC' );
|
||||
if ( in_array( $post_type, array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic' ) ) ):
|
||||
$query->set( 'orderby', 'menu_order' );
|
||||
$query->set( 'order', 'ASC' );
|
||||
elseif ( $post_type == 'sp_event' ):
|
||||
$query->set( 'orderby', 'post_date' );
|
||||
$query->set( 'order', 'ASC' );
|
||||
endif;
|
||||
else:
|
||||
$post_type = $query->get( 'post_type' );
|
||||
if ( $query->is_post_type_archive && $post_type == 'sp_event' ):
|
||||
$query->set( 'order' , 'ASC' );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
return $query;
|
||||
|
||||
@@ -7,6 +7,10 @@ function sportspress_enqueue_scripts() {
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3.exp', true );
|
||||
wp_enqueue_script( 'jquery-datatables', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.dataTables.min.js', array( 'jquery' ), '1.9.4', true );
|
||||
wp_enqueue_script( 'jquery-countdown', SPORTSPRESS_PLUGIN_URL .'assets/js/jquery.countdown.min.js', array( 'jquery' ), '2.0.2', true );
|
||||
wp_enqueue_script( 'sportspress', SPORTSPRESS_PLUGIN_URL .'assets/js/sportspress.js', array( 'jquery' ), time(), true );
|
||||
|
||||
// Localize scripts.
|
||||
wp_localize_script( 'sportspress', 'localized_strings', array( 'days' => __( 'days', 'sportspress' ), 'hours' => __( 'hours', 'sportspress' ), 'mins' => __( 'mins', 'sportspress' ), 'secs' => __( 'secs', 'sportspress' ) ) );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'sportspress_enqueue_scripts' );
|
||||
Reference in New Issue
Block a user