More specific key labelling

This commit is contained in:
Brian Miyaji
2014-04-25 13:55:41 +10:00
parent 727d7d3fe6
commit a64b2c3923
16 changed files with 37 additions and 37 deletions

View File

@@ -41,7 +41,7 @@ class SP_Admin_CPT_Column extends SP_Admin_CPT {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ),
'sp_variable' => __( 'Variable', 'sportspress' ),
'sp_key' => __( 'Key', 'sportspress' ),
'sp_equation' => __( 'Equation', 'sportspress' ),
'sp_precision' => __( 'Rounding', 'sportspress' ),
'sp_order' => __( 'Sort Order', 'sportspress' ),
@@ -55,7 +55,7 @@ class SP_Admin_CPT_Column extends SP_Admin_CPT {
*/
public function custom_columns( $column, $post_id ) {
switch ( $column ):
case 'sp_variable':
case 'sp_key':
global $post;
echo $post->post_name;
break;

View File

@@ -41,7 +41,7 @@ class SP_Admin_CPT_Metric extends SP_Admin_CPT {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ),
'sp_variable' => __( 'Variable', 'sportspress' ),
'sp_key' => __( 'Variable', 'sportspress' ),
);
return $columns;
}
@@ -52,7 +52,7 @@ class SP_Admin_CPT_Metric extends SP_Admin_CPT {
*/
public function custom_columns( $column, $post_id ) {
switch ( $column ):
case 'sp_variable':
case 'sp_key':
global $post;
echo $post->post_name;
break;

View File

@@ -41,7 +41,7 @@ class SP_Admin_CPT_Outcome extends SP_Admin_CPT {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ),
'sp_variable' => __( 'Variable', 'sportspress' ),
'sp_key' => __( 'Variable', 'sportspress' ),
);
return $columns;
}
@@ -52,7 +52,7 @@ class SP_Admin_CPT_Outcome extends SP_Admin_CPT {
*/
public function custom_columns( $column, $post_id ) {
switch ( $column ):
case 'sp_variable':
case 'sp_key':
global $post;
echo $post->post_name;
break;

View File

@@ -41,7 +41,7 @@ class SP_Admin_CPT_Performance extends SP_Admin_CPT {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ),
'sp_variable' => __( 'Variable', 'sportspress' ),
'sp_key' => __( 'Variable', 'sportspress' ),
);
return $columns;
}
@@ -52,7 +52,7 @@ class SP_Admin_CPT_Performance extends SP_Admin_CPT {
*/
public function custom_columns( $column, $post_id ) {
switch ( $column ):
case 'sp_variable':
case 'sp_key':
global $post;
echo $post->post_name;
break;

View File

@@ -41,7 +41,7 @@ class SP_Admin_CPT_Result extends SP_Admin_CPT {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ),
'sp_variable' => __( 'Variable', 'sportspress' ),
'sp_key' => __( 'Variable', 'sportspress' ),
);
return $columns;
}
@@ -52,9 +52,9 @@ class SP_Admin_CPT_Result extends SP_Admin_CPT {
*/
public function custom_columns( $column, $post_id ) {
switch ( $column ):
case 'sp_variable':
case 'sp_key':
global $post;
echo $post->post_name;
echo $post->post_name . 'for, ' . $post->post_name . 'against';
break;
endswitch;
}

View File

@@ -41,7 +41,7 @@ class SP_Admin_CPT_Statistic extends SP_Admin_CPT {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ),
'sp_variable' => __( 'Variable', 'sportspress' ),
'sp_key' => __( 'Key', 'sportspress' ),
'sp_equation' => __( 'Equation', 'sportspress' ),
'sp_precision' => __( 'Rounding', 'sportspress' ),
);
@@ -54,7 +54,7 @@ class SP_Admin_CPT_Statistic extends SP_Admin_CPT {
*/
public function custom_columns( $column, $post_id ) {
switch ( $column ):
case 'sp_variable':
case 'sp_key':
global $post;
echo $post->post_name;
break;

View File

@@ -28,10 +28,10 @@ class SP_Meta_Box_Column_Details {
// Defaults
if ( $precision == '' ) $precision = 0;
?>
<p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p>
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_default_variable" type="hidden" id="sp_default_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_variable" type="text" id="sp_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_default_key" type="hidden" id="sp_default_key" value="<?php echo $post->post_name; ?>">
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
</p>
<p><strong><?php _e( 'Equation', 'sportspress' ); ?></strong></p>
<p class="sp-equation-selector">

View File

@@ -24,8 +24,8 @@ class SP_Meta_Box_Metric_Details {
?>
<p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_default_variable" type="hidden" id="sp_default_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_variable" type="text" id="sp_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_default_key" type="hidden" id="sp_default_key" value="<?php echo $post->post_name; ?>">
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
</p>
<?php
}

View File

@@ -23,8 +23,8 @@ class SP_Meta_Box_Outcome_Details {
?>
<p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_default_variable" type="hidden" id="sp_default_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_variable" type="text" id="sp_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_default_key" type="hidden" id="sp_default_key" value="<?php echo $post->post_name; ?>">
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
</p>
<?php
}

View File

@@ -24,8 +24,8 @@ class SP_Meta_Box_Performance_Details {
?>
<p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_default_variable" type="hidden" id="sp_default_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_variable" type="text" id="sp_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_default_key" type="hidden" id="sp_default_key" value="<?php echo $post->post_name; ?>">
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
</p>
<?php
}

View File

@@ -23,8 +23,8 @@ class SP_Meta_Box_Result_Details {
?>
<p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_default_variable" type="hidden" id="sp_default_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_variable" type="text" id="sp_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_default_key" type="hidden" id="sp_default_key" value="<?php echo $post->post_name; ?>">
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
</p>
<?php
}

View File

@@ -26,10 +26,10 @@ class SP_Meta_Box_Statistic_Details {
// Defaults
if ( $precision == '' ) $precision = 0;
?>
<p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p>
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
<p>
<input name="sp_default_variable" type="hidden" id="sp_default_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_variable" type="text" id="sp_variable" value="<?php echo $post->post_name; ?>">
<input name="sp_default_key" type="hidden" id="sp_default_key" value="<?php echo $post->post_name; ?>">
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
</p>
<p><strong><?php _e( 'Equation', 'sportspress' ); ?></strong></p>
<p class="sp-equation-selector">

View File

@@ -156,7 +156,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<tr>
<th scope="col"><?php _e( 'Primary', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Variables', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th>
</tr>
</thead>
@@ -180,7 +180,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
<td class="radio"><input type="radio" id="sportspress_primary_result_<?php echo $row->post_name; ?>" name="sportspress_primary_result" value="<?php echo $row->post_name; ?>" <?php checked( $selection, $row->post_name ); ?>></td>
<td class="row-title"><label for="sportspress_primary_result_<?php echo $row->post_name; ?>"><?php echo $row->post_title; ?></label></td>
<td><?php echo $row->post_name; ?>for / <?php echo $row->post_name; ?>against</td>
<td><?php echo $row->post_name; ?>for, <?php echo $row->post_name; ?>against</td>
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
</tr>
<?php $i++; endforeach; ?>
@@ -274,7 +274,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<thead>
<tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Sort Order', 'sportspress' ); ?></th>
@@ -383,7 +383,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<thead>
<tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Variable', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Equation', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th>

View File

@@ -3003,7 +3003,7 @@ if ( !function_exists( 'sp_delete_duplicate_post' ) ) {
function sp_delete_duplicate_post( &$post ) {
global $wpdb;
$key = isset( $post['sp_variable'] ) ? $post['sp_variable'] : null;
$key = isset( $post['sp_key'] ) ? $post['sp_key'] : null;
if ( ! $key ) $key = $post['post_title'];
$id = sp_array_value( $post, 'post_ID', 'var' );
$title = sp_get_eos_safe_slug( $key, $id );

View File

@@ -104,7 +104,7 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain ) {
if ( sp_is_config_type( $typenow ) ):
switch ( $untranslated_text ):
case 'Slug':
$translated_text = __( 'Variable', 'sportspress' );
$translated_text = ( in_array( $typenow, array( 'sp_column', 'sp_statistic' ) ) ) ? __( 'Key', 'sportspress' ) : __( 'Variable', 'sportspress' );
break;
endswitch;
endif;
@@ -180,9 +180,9 @@ function sportspress_sanitize_title( $title ) {
elseif ( isset( $_POST ) && array_key_exists( 'post_type', $_POST ) && sp_is_config_type( $_POST['post_type'] ) ):
$key = isset( $_POST['sp_variable'] ) ? $_POST['sp_variable'] : null;
$key = isset( $_POST['sp_key'] ) ? $_POST['sp_key'] : null;
if ( ! $key ) $key = isset( $_POST['sp_default_variable'] ) ? $_POST['sp_default_variable'] : null;
if ( ! $key ) $key = isset( $_POST['sp_default_key'] ) ? $_POST['sp_default_key'] : null;
if ( ! $key ) $key = $_POST['post_title'];