-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #69 - simplify [bwtrace] shortcode
- Loading branch information
1 parent
5c9ee71
commit b7b48e1
Showing
1 changed file
with
12 additions
and
44 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
define( 'OIK_TRACE_SHORTCODES_INCLUDED', true ); | ||
/* | ||
Copyright 2012-2018 Bobbing Wide (email : [email protected] ) | ||
Copyright 2012-2019 Bobbing Wide (email : [email protected] ) | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License version 2, | ||
|
@@ -29,9 +29,9 @@ | |
* **?** Actually it's an oversight! Herb 2012/03/20 | ||
*/ | ||
function bwtrace__syntax( $shortcode='bwtrace' ) { | ||
$syntax = array( "text" => BW_::bw_skv( " ", __( "text", "oik" ), __( "text for the trace button", "oik" ) ) | ||
, "option" => BW_::bw_skv( "", "view|reset|logs", __( "trace control links to display", "oik" ) ) | ||
, "type" => BW_::bw_skv( "browser", "ajax|rest|cli", __( "Trace type" ) ) | ||
$syntax = array( "text" => BW_::bw_skv( " ", __( "text", "oik-bwtrace" ), __( "text for the trace button", "oik-bwtrace" ) ) | ||
// , "option" => BW_::bw_skv( "", "view|logs", __( "trace control links to display", "oik" ) ) | ||
// , "type" => BW_::bw_skv( "browser", "ajax|rest|cli", __( "Trace type" ) ) | ||
); | ||
return( $syntax ); | ||
} | ||
|
@@ -40,9 +40,9 @@ function bwtrace__syntax( $shortcode='bwtrace' ) { | |
* Displays examples for [bwtrace] shortcode | ||
*/ | ||
function bwtrace__example( $shortcode='bwtrace' ) { | ||
bw_invoke_shortcode( $shortcode, null, __( "To display the trace options and trace reset buttons.", "oik" ) ); | ||
bw_invoke_shortcode( $shortcode, "option=view", __( "To display a link to the active trace file.", "oik" ) ); | ||
bw_invoke_shortcode( $shortcode, "option=reset", __( "To display the trace reset only", "oik" ) ); | ||
bw_invoke_shortcode( $shortcode, null, __( "Display a link to trace options.", "oik-bwtrace" ) ); | ||
//bw_invoke_shortcode( $shortcode, "option=view", __( "To display a link to the active trace file.", "oik" ) ); | ||
//bw_invoke_shortcode( $shortcode, "option=reset", __( "To display the trace reset only", "oik" ) ); | ||
} | ||
|
||
/** | ||
|
@@ -57,49 +57,17 @@ function bwtrace__example( $shortcode='bwtrace' ) { | |
* @return string - the expanded shortcode. If trace is not enabled it returns null. | ||
*/ | ||
function bw_trace_button( $atts=NULL ) { | ||
global $bw_trace_on; | ||
if ( $bw_trace_on ) { | ||
$option = bw_array_get( $atts, 'option', NULL ); | ||
|
||
switch ( $option ) { | ||
case 'view': | ||
oik_require2( 'admin/oik-bwtrace.php', "oik-bwtrace" ); | ||
$bw_trace_url = bw_trace_url(); | ||
BW_::alink( "button", $bw_trace_url, __( "View trace log", "oik" ), sprintf( __( 'View trace output in your browser. %1$s', "oik" ), $bw_trace_url ) ); | ||
break; | ||
|
||
case 'reset': | ||
bw_trace_reset_form(); | ||
break; | ||
|
||
case 'logs': | ||
bw_trace_logs( $atts ); | ||
break; | ||
|
||
default: | ||
$url = get_site_url( NULL, 'wp-admin/options-general.php?page=bw_trace_options' ); | ||
$text = bw_array_get( $atts, 'text', __( "Trace options", "oik" ) ); | ||
//$img = retimage( null, oik_url( 'images/oik-trace_48.png'), $text ); | ||
BW_::alink( "button", $url, $text, $text ); | ||
bw_trace_reset_form(); | ||
break; | ||
|
||
} | ||
global $bw_trace_on; | ||
if ( $bw_trace_on ) { | ||
$url = get_site_url( NULL, 'wp-admin/options-general.php?page=bw_trace_options' ); | ||
$text = bw_array_get( $atts, 'text', __( "Trace options", "oik-bwtrace" ) ); | ||
BW_::alink( "button", $url, $text, $text ); | ||
} else { | ||
|
||
} | ||
return( bw_ret()); | ||
} | ||
|
||
/** | ||
* Creates the Trace reset button for use somewhere in any page | ||
*/ | ||
function bw_trace_reset_form() { | ||
oik_require( "bobbforms.inc" ); | ||
e( '<form method="post" action="" class="bw_inline">' ); | ||
e( isubmit( "_bw_trace_reset", __( "Trace reset", "oik" ), null )); | ||
etag( "form" ); | ||
} | ||
|
||
|
||
/** | ||
|