|
142 | 142 |
|
143 | 143 | $App->set_action( 'admin_nav', function () { |
144 | 144 | global $page; |
145 | | - $slug = $this->admin_url( '?page=modules_manager', true ); |
146 | | - $active = ( 'modules_manager' === $page ? ' ss-bg-cyan' : '' ); |
147 | | - return "<a href=\"$slug\" class=\"ss-btn ss-inverted ss-bd-none ss-white$active\">Modules</a>"; |
| 145 | + $slug = $this->admin_url( '?page=marketplace', true ); |
| 146 | + $active = ( 'marketplace' === $page ? ' ss-bg-cyan' : '' ); |
| 147 | + return "<a href=\"$slug\" class=\"ss-btn ss-inverted ss-bd-none ss-white$active\">Marketplace</a>"; |
148 | 148 | }); |
149 | 149 |
|
150 | 150 | $App->set_action( 'admin_middle', function () { |
|
184 | 184 |
|
185 | 185 | require_once $this->root( 'app/layout.php' ); |
186 | 186 | break; |
187 | | - case 'modules_manager': |
| 187 | + case 'marketplace': |
188 | 188 | $config = $this->get( 'modules' ); |
189 | | - $layout[ 'title' ] = 'Modules'; |
| 189 | + $layout[ 'title' ] = 'Marketplace'; |
190 | 190 | $layout[ 'content' ] = ' |
191 | 191 | <div class="ss-container ss-center ss-mt-7"> |
192 | 192 | <input type="search" id="search" placeholder="Search" class="ss-input ss-mobile ss-w-6 ss-mx-auto"> |
|
196 | 196 | <option value="plugin">PLUGINS</option> |
197 | 197 | </select> |
198 | 198 | <p class="ss-right-align ss-tiny ss-mt-7 ss-mb-5 ss-mr-3"> |
199 | | - <a href="' . $this->admin_url( '?page=modules_manager&sync=true&token=' . $this->token(), true ) . '" class="ss-btn ss-inverted ss-white ss-bg-cyan ss-bd-cyan">Check for updates</a> |
| 199 | + <a href="' . $this->admin_url( '?page=marketplace&sync=true&token=' . $this->token(), true ) . '" class="ss-btn ss-inverted ss-white ss-bg-cyan ss-bd-cyan">Check for updates</a> |
200 | 200 | <br> Last sync: ' . date( 'F j, Y – H:i', filectime( modules_temporary_dir( 'packages.json' ) ) ) . ' |
201 | 201 | <br> Repository: ' . MODULES_REPO . ' |
202 | 202 | </p> |
|
268 | 268 | <h4 class="ss-monospace">' . $module[ 'name' ] . ' <sup class="ss-small">(' . $module[ 'slug' ] . ')</sup></h4> |
269 | 269 | <p>' . substr( $module[ 'description' ], 0, 300 ) . '</p> |
270 | 270 | <p> |
271 | | - <a' . ( ( $compatible && $version !== 0 ) ? ' href="' . $this->admin_url( '?page=modules_manager&download=true' . ( $downloaded ? '&update=true' : '' ) . '&slug=' . $module[ 'slug' ] . '&type=' . $module[ 'type' ] . '&token=' . $this->token(), true ) . '" onclick="return confirm(\'Are you sure you want to ' . ( $downloaded ? ( ( $version < 0 ) ? 'downgrade' : 'update' ) : 'download' ) . ' this ' . $module[ 'type' ] . '?\')"' : '' ) . ' class="ss-button ss-card' . ( ( $compatible && $version !== 0 ) ? '' : ' ss-disabled' ) . '" disabled>' . ( $downloaded ? ( ( $version < 0 ) ? 'Downgrade' : ( ( $version === 0 ) ? 'Up to Date' : 'Update' ) ) : 'Download' ) . '</a> |
272 | | - ' . ( $downloaded ? '<a' . ( ( $installed || $is_current_theme ) ? '' : ' href="' . $this->admin_url( '?page=modules_manager&delete=true&slug=' . $module[ 'slug' ] . '&type=' . $module[ 'type' ] . '&token=' . $this->token(), true ) . '" onclick="return confirm(\'Are you sure you want to delete this ' . $module[ 'type' ] . '?\')"' ) . ' class="ss-button ss-card ss-white ss-bg-light-red' . ( ( $installed || $is_current_theme ) ? ' ss-disabled" disabled' : '"' ) . '>Delete</a>' : '' ) . ' |
| 271 | + <a' . ( ( $compatible && $version !== 0 ) ? ' href="' . $this->admin_url( '?page=marketplace&download=true' . ( $downloaded ? '&update=true' : '' ) . '&slug=' . $module[ 'slug' ] . '&type=' . $module[ 'type' ] . '&token=' . $this->token(), true ) . '" onclick="return confirm(\'Are you sure you want to ' . ( $downloaded ? ( ( $version < 0 ) ? 'downgrade' : 'update' ) : 'download' ) . ' this ' . $module[ 'type' ] . '?\')"' : '' ) . ' class="ss-button ss-card' . ( ( $compatible && $version !== 0 ) ? '' : ' ss-disabled' ) . '" disabled>' . ( $downloaded ? ( ( $version < 0 ) ? 'Downgrade' : ( ( $version === 0 ) ? 'Up to Date' : 'Update' ) ) : 'Download' ) . '</a> |
| 272 | + ' . ( $downloaded ? '<a' . ( ( $installed || $is_current_theme ) ? '' : ' href="' . $this->admin_url( '?page=marketplace&delete=true&slug=' . $module[ 'slug' ] . '&type=' . $module[ 'type' ] . '&token=' . $this->token(), true ) . '" onclick="return confirm(\'Are you sure you want to delete this ' . $module[ 'type' ] . '?\')"' ) . ' class="ss-button ss-card ss-white ss-bg-light-red' . ( ( $installed || $is_current_theme ) ? ' ss-disabled" disabled' : '"' ) . '>Delete</a>' : '' ) . ' |
273 | 273 | </p> |
274 | 274 | <details class="ss-fieldset"> |
275 | 275 | <summary>More details</summary> |
|
349 | 349 | $this->auth( post: false ); |
350 | 350 | if ( modules_download_list() ) { |
351 | 351 | $this->alert( 'List updated successfully.', 'success' ); |
352 | | - $this->go( $this->admin_url( '?page=modules_manager' ) ); |
| 352 | + $this->go( $this->admin_url( '?page=marketplace' ) ); |
353 | 353 | } |
354 | 354 |
|
355 | 355 | $this->alert( 'Failed to update list, please try again.', 'error' ); |
356 | | - $this->go( $this->admin_url( '?page=modules_manager' ) ); |
| 356 | + $this->go( $this->admin_url( '?page=marketplace' ) ); |
357 | 357 | } |
358 | 358 |
|
359 | 359 | elseif ( isset( $_GET[ 'download' ] ) ) { |
|
362 | 362 | if ( download_module( $module, $msg ) ) { |
363 | 363 | $action = ( isset( $_GET[ 'update' ] ) ? 'updated' : 'downloaded' ); |
364 | 364 | $this->alert( sprintf( '%s <b>%s</b> has been %s successfully.', ucfirst( $module[ 'type' ] ), ucwords( $module[ 'name' ] ), $action ), 'success' ); |
365 | | - $this->go( $this->admin_url( '?page=modules_manager' ) ); |
| 365 | + $this->go( $this->admin_url( '?page=marketplace' ) ); |
366 | 366 | } |
367 | 367 |
|
368 | 368 | $this->alert( $msg . ', please try again.', 'error' ); |
369 | | - $this->go( $this->admin_url( '?page=modules_manager' ) ); |
| 369 | + $this->go( $this->admin_url( '?page=marketplace' ) ); |
370 | 370 | } |
371 | 371 |
|
372 | 372 | elseif ( isset( $_GET[ 'delete' ] ) ) { |
373 | 373 | $this->auth( post: false ); |
374 | 374 | $module = get_module( $_GET[ 'slug' ], $_GET[ 'type' ] ); |
375 | 375 | if ( delete_module( $module, $msg ) ) { |
376 | 376 | $this->alert( $msg . ' successfully.', 'success' ); |
377 | | - $this->go( $this->admin_url( '?page=modules_manager' ) ); |
| 377 | + $this->go( $this->admin_url( '?page=marketplace' ) ); |
378 | 378 | } |
379 | 379 |
|
380 | 380 | $this->alert( $msg . ', please try again.', 'error' ); |
381 | | - $this->go( $this->admin_url( '?page=modules_manager' ) ); |
| 381 | + $this->go( $this->admin_url( '?page=marketplace' ) ); |
382 | 382 | } |
383 | 383 |
|
384 | 384 | require_once $this->root( 'app/layout.php' ); |
|
0 commit comments