Skip to content

Commit

Permalink
work page linked to project posts and service taxonomies
Browse files Browse the repository at this point in the history
  • Loading branch information
bak11004 committed Mar 25, 2016
1 parent 33e13a7 commit 1acbc2b
Show file tree
Hide file tree
Showing 37 changed files with 10,169 additions and 16,175 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
<?php

/**
* Custom Post Type UI Debug Information.
*
* @package CPTUI
* @subpackage Debugging
* @author WebDevStudios
* @since 1.2.0
*/

/**
* Custom Post Type UI Debug Info
*/
class CPTUI_Debug_Info {

/**
* Tab content for the debug info tab.
*
* @since 1.2.0
*/
public function tab_site_info() {
?>
<p><?php _e( 'If you have sought support for Custom Post Type UI on the forums, you may be requested to send the information below to the plugin developer. Simply insert the email they provided in the input field at the bottom and click the "Send debug info" button. Only the data below will be sent to them.', 'custom-post-type-ui' ); ?></p>
<label for="cptui_audit_textarea">
<textarea readonly="readonly" id="cptui-audit-textarea" name="cptui_audit_textarea" rows="20" cols="100">
<textarea readonly="readonly" aria-readonly="true" id="cptui-audit-textarea" name="cptui_audit_textarea" rows="20" cols="100">
<?php echo $this->system_status(); ?>
</textarea></label>
<?php
}

/**
* Generate the debug information content.
*
* @since 1.2.0
*
* @return string
*/
private function system_status() {
if ( ! current_user_can( 'manage_options' ) ) {
return '';
Expand Down Expand Up @@ -63,13 +86,11 @@ private function system_status() {
$mu_plugins = get_mu_plugins();

if ( $mu_plugins ) :
$mu_count = count( $mu_plugins );

echo 'MU PLUGINS: (' . $mu_count . ')' . "\n\n";
echo "\t\t" . 'MU PLUGINS: (' . count( $mu_plugins ) . ')' . "\n\n";

foreach ( $mu_plugins as $mu_path => $mu_plugin ) {

echo $mu_plugin['Name'] . ': ' . $mu_plugin['Version'] . "\n";
echo "\t\t" . $mu_plugin['Name'] . ': ' . $mu_plugin['Version'] . "\n";
}
endif;
// standard plugins - active
Expand All @@ -79,27 +100,27 @@ private function system_status() {
$ac_count = count( $active );
$ic_count = $pg_count - $ac_count;

echo 'ACTIVE PLUGINS: (' . $ac_count . ')' . "\n\n";
echo "\t\t" . 'ACTIVE PLUGINS: (' . $ac_count . ')' . "\n\n";

foreach ( $plugins as $plugin_path => $plugin ) {
// If the plugin isn't active, don't show it.
if ( ! in_array( $plugin_path, $active ) ) {
continue;
}

echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
echo "\t\t" . $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
// standard plugins - inactive
echo "\n";
echo 'INACTIVE PLUGINS: (' . $ic_count . ')' . "\n\n";
echo "\t\t" , 'INACTIVE PLUGINS: (' . $ic_count . ')' . "\n\n";

foreach ( $plugins as $plugin_path => $plugin ) {
// If the plugin isn't active, show it here.
if ( in_array( $plugin_path, $active ) ) {
continue;
}

echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
echo "\t\t" . $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}

// if multisite, grab network as well
Expand Down Expand Up @@ -127,15 +148,28 @@ private function system_status() {
endif;

echo "\n";
$cptui_post_types = get_option( 'cptui_post_types', array() );
echo 'Post Types: ' . "\n";
echo esc_html( json_encode( $cptui_post_types ) ) . "\n";
$cptui_post_types = cptui_get_post_type_data();
echo "\t\t" . 'Post Types: ' . "\n";
echo "\t\t" . esc_html( json_encode( $cptui_post_types ) ) . "\n";

echo "\n\n";

$cptui_taxonomies = get_option( 'cptui_taxonomies', array() );
echo 'Taxonomies: ' . "\n";
echo esc_html( json_encode( $cptui_taxonomies ) ) . "\n";
$cptui_taxonomies = cptui_get_taxonomy_data();
echo "\t\t" . 'Taxonomies: ' . "\n";
echo "\t\t" . esc_html( json_encode( $cptui_taxonomies ) ) . "\n";
echo "\n";

if ( has_action( 'cptui_custom_debug_info' ) ) {
echo "\t\t" . 'EXTRA DEBUG INFO';
}

/**
* Fires at the end of the debug info output.
*
* @since 1.3.0
*/
do_action( 'cptui_custom_debug_info' );

echo "\n";
?>
### End Debug Info ###
Expand All @@ -145,7 +179,9 @@ private function system_status() {
}

/**
* helper function for number conversions
* Helper function for number conversions.
*
* @since 1.2.0
* @access public
*
* @param mixed $v
Expand All @@ -170,7 +206,15 @@ public function num_convt( $v ) {
return $ret;
}

public function send_email( $args ) {
/**
* Sends an email to the specified address, with the system status as the message.
*
* @since 1.2.0
*
* @param array $args Array of arguments for the method.
* @return bool
*/
public function send_email( $args = array() ) {

if ( ! isset( $args['email'] ) || ! is_email( $args['email'] ) ) {
return false;
Expand All @@ -182,12 +226,25 @@ public function send_email( $args ) {

$message = $this->system_status();

$subject = sprintf(
__( 'CPTUI debug information for %s'),
/**
* Filters the debug email subject.
*
* @since 1.3.0
*
* @param string $value Intended email subject.
*/
$subject = apply_filters( 'cptui_debug_email_subject', sprintf(
__( 'CPTUI debug information for %s', 'custom-post-type-ui' ),
home_url( '/' )
);
) );

wp_mail( $args['email'], $subject, $message );

/**
* Fires after the debug email has been sent.
*
* @since 1.3.0
*/
do_action( 'cptui_after_debug_email_sent' );
}
}

Loading

0 comments on commit 1acbc2b

Please sign in to comment.