Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasplevy committed Dec 27, 2016
1 parent ba1c7fc commit 2c4f3df
Show file tree
Hide file tree
Showing 7 changed files with 453 additions and 29 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
LifterLMS Labs Changelog
========================

= v1.0 - 2016-12-27 =
---------------------

+ Initial public release
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LifterLMS Labs
==============

Experimental, conceptual, and possibly silly new features to improve and enhance the functionality of the LifterLMS core

### [Changelog](./CHANGELOG.md)
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Because not every LifterLMS user needs (or wants) the features in this plugin!

== Changelog ==

= 1.0 =
= v1.0 - 2016-12-27 =

+ Initial public release
66 changes: 39 additions & 27 deletions inc/class.llms.labs.settings.page.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ private function get_tab() {
* @version 1.0.0
*/
public function handle_form() {

if ( empty( $_POST['llms_labs_manager_nonce'] ) || ! wp_verify_nonce( $_POST['llms_labs_manager_nonce'], 'llms_labs_manager' ) ) {
return;
}
Expand Down Expand Up @@ -72,8 +73,13 @@ public function handle_form() {
if ( ! $lab ) {
return;
}

$lab->set_option( 'enabled', $val );

if ( 'yes' === $val ) {
wp_safe_redirect( admin_url( 'admin.php?page=llms-labs&tab=' . $lab->get_id() ) );
}

} elseif ( 'settings' === $action ) {

foreach ( $lab->get_settings() as $field ) {
Expand All @@ -84,9 +90,9 @@ public function handle_form() {

}

}

do_action( 'llms_lab_' . $id . '_settings_saved' );

}

}

Expand Down Expand Up @@ -134,7 +140,7 @@ private function render_main() {
?>

<h4><?php _e( 'Each lab is an experimental, conceptual, or fun new feature which you can enable to enhance, improve, or alter the core functionality of LifterLMS.' ); ?></h4>
<h4><?php _e( 'Some labs are being tested and may be moved into the LifterLMS core, others migth remain here forever.' ); ?></h4>
<h4><?php _e( 'Some labs are being tested and may be moved into the LifterLMS core, others might remain here forever.' ); ?></h4>

<table class="wp-list-table widefat fixed striped">
<thead>
Expand Down Expand Up @@ -165,8 +171,8 @@ private function render_main() {
</td>
<td>
<?php if ( $enabled ) :?>
<a class="llms-button-primary small" href="<?php echo admin_url( 'admin.php?page=llms-labs&tab=' . $lab->get_id() ); ?>"><?php _e( 'Configure', 'lifterlms-labs' ); ?></a>
<button class="llms-button-danger small" name="llms-lab-disable" type="submit" value="<?php echo $lab->get_id(); ?>"><?php _e( 'Disable', 'lifterlms-labs' ); ?></button>
<a href="<?php echo admin_url( 'admin.php?page=llms-labs&tab=' . $lab->get_id() ); ?>"><?php _e( 'Configure', 'lifterlms-labs' ); ?></a>
<?php else : ?>
<button class="llms-button-primary small" name="llms-lab-enable" type="submit" value="<?php echo $lab->get_id(); ?>"><?php _e( 'Enable', 'lifterlms-labs' ); ?></button>
<?php endif; ?>
Expand All @@ -192,29 +198,35 @@ private function render_tab() {
_e( 'Invalid lab.', 'lifterlms-labs' );
return;
}
if ( ! $lab->is_enabled() ) {
_e( 'This lab in not enabled, please enable the lab and try again.', 'lifterlms-labs' );
return;
}

echo '<h4>' . $lab->get_description() . '</h4>';
echo '<div class="llms-widget">';

echo '<div class="llms-form-fields">';
foreach ( $lab->get_settings() as $field ) {
llms_form_field( $field );
}
echo '<h4>' . $lab->get_description() . '</h4>';

llms_form_field( array(
'columns' => 2,
'classes' => 'llms-button-primary',
'id' => 'llms-lab-settings-save',
'value' => __( 'Save', 'lifterlms-labs' ),
'last_column' => true,
'required' => false,
'type' => 'submit',
) );
echo '<div class="llms-form-fields">';
foreach ( $lab->get_settings() as $field ) {
llms_form_field( $field );
}

echo '<input name="llms-lab-id" type="hidden" value="' . $lab->get_id() . '">';
llms_form_field( array(
'columns' => 2,
'classes' => 'llms-button-primary',
'id' => 'llms-lab-settings-save',
'value' => __( 'Save', 'lifterlms-labs' ),
'last_column' => true,
'required' => false,
'type' => 'submit',
) );

echo '</div>';
echo '<input name="llms-lab-id" type="hidden" value="' . $lab->get_id() . '">';

echo '<p><a href="' . admin_url( 'admin.php?page=llms-labs' ) . '">' . __( 'Back', 'lifterlms-labs' ) . '</a></p>';
echo '</div>';

echo '</div>';

}

Expand All @@ -226,13 +238,13 @@ private function render_tab() {
*/
private function render_title() {
echo '<h1>';
_e( 'LifterLMS Labs', 'lifterlms-labs' );
if ( $id = $this->get_tab() ) {
$lab = LLMS_Labs_LabTech::get_lab( $id );
if ( $lab ) {
printf( ' &ndash; %s', $lab->get_title() );
_e( 'LifterLMS Labs', 'lifterlms-labs' );
if ( $id = $this->get_tab() ) {
$lab = LLMS_Labs_LabTech::get_lab( $id );
if ( $lab ) {
printf( ' &ndash; %s', $lab->get_title() );
}
}
}
echo '</h1>';
}

Expand Down
Loading

0 comments on commit 2c4f3df

Please sign in to comment.