minimum_capability,
'give-about',
array( $this, 'about_screen' )
);
// Changelog Page
add_dashboard_page(
esc_html__( 'Give Changelog', 'give' ),
esc_html__( 'Give Changelog', 'give' ),
$this->minimum_capability,
'give-changelog',
array( $this, 'changelog_screen' )
);
// Getting Started Page
add_dashboard_page(
/* translators: %s: Give version */
sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
esc_html__( 'Getting started with Give', 'give' ),
$this->minimum_capability,
'give-getting-started',
array( $this, 'getting_started_screen' )
);
// Credits Page
add_dashboard_page(
/* translators: %s: Give version */
sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
esc_html__( 'The people that build Give', 'give' ),
$this->minimum_capability,
'give-credits',
array( $this, 'credits_screen' )
);
}
/**
* Hide Individual Dashboard Pages
*
* @access public
* @since 1.0
* @return void
*/
public function admin_head() {
remove_submenu_page( 'index.php', 'give-about' );
remove_submenu_page( 'index.php', 'give-changelog' );
remove_submenu_page( 'index.php', 'give-getting-started' );
remove_submenu_page( 'index.php', 'give-credits' );
}
/**
* Navigation tabs
*
* @access public
* @since 1.0
* @return void
*/
public function tabs() {
$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
?>
get_welcome_header() ?>
plugin documentation and getting started guide below.', 'give' ),
esc_url( 'http://docs.givewp.com/docs' )
);
?>
tabs(); ?>
get_welcome_header() ?>
tabs(); ?>
Add Form."', 'give' ); ?>
get_welcome_header() ?>
tabs(); ?>
GitHub Repo.', 'give' ),
esc_url( 'https://github.com/impress-org/give' )
);
?>
contributors(); ?>
' . esc_html__( 'No valid changlog was found.', 'give' ) . '';
} else {
$readme = file_get_contents( $file );
$readme = nl2br( esc_html( $readme ) );
$readme = explode( '== Changelog ==', $readme );
$readme = end( $readme );
$readme = preg_replace( '/`(.*?)`/', '\\1', $readme );
$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' \\1', $readme );
$readme = preg_replace( '/[\040]\*(.*?)\*/', ' \\1', $readme );
$readme = preg_replace( '/= (.*?) =/', '\\1
', $readme );
$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '\\1', $readme );
}
return $readme;
}
/**
* Render Contributors List
*
* @since 1.0
* @uses Give_Welcome::get_contributors()
* @return string $contributor_list HTML formatted list of all the contributors for GIVE
*/
public function contributors() {
$contributors = $this->get_contributors();
if ( empty( $contributors ) ) {
return '';
}
$contributor_list = '';
foreach ( $contributors as $contributor ) {
$contributor_list .= '- ';
$contributor_list .= sprintf(
'
',
esc_url( 'https://github.com/' . $contributor->login ),
esc_url( $contributor->avatar_url ),
esc_attr( $contributor->login )
);
$contributor_list .= sprintf(
'%2$s',
esc_url( 'https://github.com/' . $contributor->login ),
esc_html( $contributor->login )
);
$contributor_list .= ' ';
}
$contributor_list .= '
';
return $contributor_list;
}
/**
* Retreive list of contributors from GitHub.
*
* @access public
* @since 1.0
* @return array $contributors List of contributors
*/
public function get_contributors() {
$contributors = Give_Cache::get( 'give_contributors', true );
if ( false !== $contributors ) {
return $contributors;
}
$response = wp_remote_get( 'https://api.github.com/repos/impress-org/give/contributors', array( 'sslverify' => false ) );
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
return array();
}
$contributors = json_decode( wp_remote_retrieve_body( $response ) );
if ( ! is_array( $contributors ) ) {
return array();
}
Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true );
return $contributors;
}
/**
* The header section for the welcome screen.
*
* @since 1.8.8
*/
public function get_welcome_header() {
// Badge for welcome page
$badge_url = GIVE_PLUGIN_URL . 'assets/dist/images/give-badge.png';
?>
social_media_elements(); ?>