-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring for extensions-manager (views)
- Loading branch information
1 parent
c2e3e38
commit 392be46
Showing
5 changed files
with
162 additions
and
130 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
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
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
235 changes: 139 additions & 96 deletions
235
runway-framework/framework/includes/extensions-manager/views/admin-home.php
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 |
---|---|---|
@@ -1,137 +1,180 @@ | ||
<?php | ||
// Info and Alert Messages | ||
if ( $info_message != '' ) { | ||
echo '<div id="message" class="updated"><p>'. $info_message .'</p></div>'; | ||
echo '<div id="message" class="updated"><p>' . $info_message . '</p></div>'; | ||
} | ||
|
||
$ext_inactive_status = ''; | ||
switch ( $this->navigation ) { | ||
case ( 'inactive' ):{ | ||
case ( 'inactive' ): { | ||
$ext_inactive_status = 'class="current"'; | ||
|
||
} break; | ||
case ( 'upgrade' ):{ | ||
} | ||
break; | ||
case ( 'upgrade' ): { | ||
$ext_upgrade_status = 'class="current"'; | ||
} break; | ||
default:{ | ||
} | ||
break; | ||
default: { | ||
$ext_all_status = 'class="current"'; | ||
} | ||
} | ||
?> | ||
|
||
<ul class="subsubsub"> | ||
<li class="all"><a href="<?php echo admin_url('admin.php?page=extensions&navigation=all'); ?>" <?php echo isset($ext_all_status) ? $ext_all_status : ""; ?>><?php echo __( 'All', 'runway' );?> <span class="count">(<?php echo wp_kses_post($ext_all_total); ?>)</span></a> |</li> | ||
<li class="inactive"><a href="<?php echo admin_url('admin.php?page=extensions&navigation=inactive'); ?>" <?php echo isset($ext_inactive_status) ? $ext_inactive_status : ''; ?>><?php echo __( 'Inactive', 'runway' );?> <span class="count">(<?php echo wp_kses_post($ext_inactive_total); ?>)</span></a></li> | ||
<li class="all"> | ||
<a href="<?php echo admin_url( 'admin.php?page=extensions&navigation=all' ); ?>" <?php echo isset( $ext_all_status ) ? $ext_all_status : ''; ?>> | ||
<?php echo __( 'All', 'runway' ); ?> <span class="count">(<?php echo wp_kses_post( $ext_all_total ); ?>)</span> | ||
</a> | | ||
</li> | ||
<li class="inactive"> | ||
<a href="<?php echo admin_url( 'admin.php?page=extensions&navigation=inactive' ); ?>" <?php echo isset( $ext_inactive_status ) ? $ext_inactive_status : ''; ?>> | ||
<?php echo __( 'Inactive', 'runway' ); ?> <span class="count">(<?php echo wp_kses_post( $ext_inactive_total ); ?>)</span> | ||
</a> | ||
</li> | ||
</ul> | ||
<form method="post" action="<?php echo admin_url('admin.php?page=extensions&navigation=search#add-exts'); ?>" class="clear"> | ||
<form method="post" action="<?php echo admin_url( 'admin.php?page=extensions&navigation=search#add-exts' ); ?>" class="clear"> | ||
<p class="search-box"> | ||
<label class="screen-reader-text" for="exts-search-input"><?php echo __( 'Search Extensions', 'runway' );?>:</label> | ||
<input type="search" id="exts-search-input" name="exts-search-input" value="<?php echo isset($_POST['exts-search-input']) ? $_POST['exts-search-input'] : ''; ?>"> | ||
<input type="submit" name="ext-search-submit" id="ext-search-submit" class="button" value="<?php echo __('Search Extensions', 'runway'); ?>"></p> | ||
<input type="search" id="exts-search-input" name="exts-search-input" | ||
value="<?php echo isset( $_POST['exts-search-input'] ) ? $_POST['exts-search-input'] : ''; ?>"> | ||
<input type="submit" name="ext-search-submit" id="ext-search-submit" class="button" | ||
value="<?php echo __( 'Search Extensions', 'runway' ); ?>"> | ||
</p> | ||
</form> | ||
|
||
<form action="<?php echo admin_url('admin.php?page=extensions&navigation=bulk-actions'); ?>" method="post"> | ||
<form action="<?php echo admin_url( 'admin.php?page=extensions&navigation=bulk-actions' ); ?>" method="post"> | ||
<div class="alignleft actions"> | ||
<select name="action"> | ||
<option value="-1" selected="selected"><?php echo __( 'Bulk Actions', 'runway' );?></option> | ||
<option value="activate-selected"><?php echo __( 'Activate', 'runway' );?></option> | ||
<option value="deactivate-selected"><?php echo __( 'Deactivate', 'runway' );?></option> | ||
<option value="delete-selected"><?php echo __( 'Delete', 'runway' );?></option> | ||
<option value="-1" selected="selected"><?php echo __( 'Bulk Actions', 'runway' ); ?></option> | ||
<option value="activate-selected"><?php echo __( 'Activate', 'runway' ); ?></option> | ||
<option value="deactivate-selected"><?php echo __( 'Deactivate', 'runway' ); ?></option> | ||
<option value="delete-selected"><?php echo __( 'Delete', 'runway' ); ?></option> | ||
</select> | ||
<input type="submit" name="bulk-actions-submit" class="button-secondary action" value="Apply"> | ||
</div> | ||
<br><br> | ||
<br><br> | ||
|
||
<table class="wp-list-table widefat"> | ||
<thead> | ||
<table class="wp-list-table widefat"> | ||
<thead> | ||
<tr> | ||
<th scope="col" id="cb" class="manage-column column-cb check-column" style="width: 0px;"><input type="checkbox" name="ext_chk[]" /></th> | ||
<th id="name" class="manage-column column-name"><?php echo __( 'Extension', 'runway' );?></th> | ||
<th id="description" class="manage-column column-description"><?php echo __( 'Description', 'runway' );?></th> | ||
<th scope="col" id="cb" class="manage-column column-cb check-column" style="width: 0px;"> | ||
<input type="checkbox" name="ext_chk[]"/> | ||
</th> | ||
<th id="name" class="manage-column column-name"> | ||
<?php echo __( 'Extension', 'runway' ); ?> | ||
</th> | ||
<th id="description" class="manage-column column-description"> | ||
<?php echo __( 'Description', 'runway' ); ?> | ||
</th> | ||
</tr> | ||
</thead> | ||
</thead> | ||
<tbody id="the-list"> | ||
|
||
<?php | ||
if ( !empty( $exts ) ): | ||
foreach ( $exts as $ext => $ext_info ): | ||
$ext_cnt = !$extm->is_activated( $ext ); | ||
?> | ||
<tr <?php if ( $ext_cnt ): ?> class="inactive" <?php else: ?> calss="active" <?php endif; ?> > | ||
<th class="check-column"> | ||
<input type="checkbox" name="ext_chk[]" value="<?php echo esc_attr($ext); ?>" /> | ||
</th> | ||
<td class="plugin-title"> | ||
<strong><?php echo wp_kses_post($ext_info['Name']); ?></strong> | ||
<?php if ( $ext_cnt ): ?> | ||
<br><a href="<?php echo admin_url('admin.php?page=extensions&navigation=extension-activate&ext='.urlencode( $ext )); ?>"><?php echo __( 'Activate', 'runway' );?></a> | | ||
<a style="color: #BC0B0B;" href="<?php echo admin_url('admin.php?page=extensions&navigation=del-extension-confirm&ext='.urlencode( $ext )); ?>"><?php echo __( 'Delete', 'runway' );?></a> | ||
<?php elseif ( !$ext_cnt ): ?> | ||
<br><a class="edit" href="<?php echo admin_url('admin.php?page=extensions&navigation=extension-deactivate&ext='.urlencode( $ext )); ?>"><?php echo __( 'Deactivate', 'runway' );?></a> | ||
<?php endif;?> | ||
</td> | ||
<td class="column-description desc"> | ||
<?php | ||
// Item description | ||
$description = '<div class="plugin-description"><p>'. wp_kses_post($ext_info['Description']) .'</p></div>'; | ||
// Item info | ||
$class = ( $ext_cnt ) ? 'inactive' : 'active' ; | ||
$version = ( $ext_info['Version'] ) ? sprintf( __( 'Version: %s', 'runway' ), $ext_info['Version'] ) : ''; | ||
if ( $ext_info['Author'] ) { | ||
$author = ' | '. sprintf( __('By %s', 'runway'), $ext_info['Author'] ); | ||
if ( $ext_info['AuthorURI'] ) { | ||
$author = ' | '.__('By', 'runway').' <a href="'. $ext_info['AuthorURI'] .'" title="' . __( 'Visit author homepage', 'runway' ) .'">'. $ext_info['Author'] .'</a>'; | ||
} | ||
} | ||
else { | ||
$author = ' | '. __( 'By Unknown', 'runway' ); | ||
} | ||
$plugin_link = ( $ext_info['ExtensionURI'] ) ? ' | <a href="'. esc_url($ext_info['ExtensionURI']) .'" title="' . __( 'Visit plugin site', 'runway' ).'">' . __( 'Visit plugin site', 'runway' ) . '</a>' : ''; | ||
$info = '<div class="'. esc_attr($class) .'second plugin-version-author-uri">'. $version . $author . $plugin_link .'</div>'; | ||
if ( ! empty( $exts ) ) { | ||
foreach ( $exts as $ext => $ext_info ) { | ||
$ext_cnt = ! $extm->is_activated( $ext ); | ||
?> | ||
|
||
// Print details | ||
echo rf_string($description); | ||
echo rf_string($info); // escaped above | ||
?> | ||
<tr <?php if ( $ext_cnt ) { ?> class="inactive" <?php } else { ?> class="active" <?php } ?>> | ||
<th class="check-column"> | ||
<input type="checkbox" name="ext_chk[]" value="<?php echo esc_attr( $ext ); ?>"/> | ||
</th> | ||
<td class="plugin-title"> | ||
<strong><?php echo wp_kses_post( $ext_info['Name'] ); ?></strong> | ||
<?php if ( $ext_cnt ) { ?> | ||
<br> | ||
<a href="<?php echo admin_url( 'admin.php?page=extensions&navigation=extension-activate&ext=' . urlencode( $ext ) ); ?>"> | ||
<?php echo __( 'Activate', 'runway' ); ?> | ||
</a> | | ||
<a style="color: #BC0B0B;" | ||
href="<?php echo admin_url( 'admin.php?page=extensions&navigation=del-extension-confirm&ext=' . urlencode( $ext ) ); ?>"> | ||
<?php echo __( 'Delete', 'runway' ); ?> | ||
</a> | ||
<?php } elseif ( ! $ext_cnt ) { ?> | ||
<br> | ||
<a class="edit" | ||
href="<?php echo admin_url( 'admin.php?page=extensions&navigation=extension-deactivate&ext=' . urlencode( $ext ) ); ?>"> | ||
<?php echo __( 'Deactivate', 'runway' ); ?> | ||
</a> | ||
<?php } ?> | ||
|
||
</td> | ||
<td class="column-description desc"> | ||
|
||
<?php if ( count( $ext_info['DepsExts'] ) > 0 && isset( $ext_info['DepsExts'] ) && !empty( $ext_info['DepsExts'] ) ): ?> | ||
<b><?php echo __( 'Dependencies', 'runway' );?>:</b> | ||
<?php | ||
$deps_count = count( $ext_info['DepsExts'] ); $i = 0; | ||
foreach ( $ext_info['DepsExts'] as $dep_ext ): | ||
$i++; | ||
$dep_ext = explode( '|', $dep_ext ); | ||
if ( file_exists( $extm->extensions_dir.$dep_ext[1] ) ) { | ||
$ext_data = $extm->get_extension_data( $extm->extensions_dir.$dep_ext[1] ); | ||
$active = FALSE; | ||
if ( !empty( $extm->admin_settings ) ) | ||
foreach ( $extm->admin_settings['extensions'][$extm->theme_name] as $ext_tmp ) { | ||
if ( $ext_tmp == $dep_ext[1] ) { | ||
$active = TRUE; | ||
} | ||
} | ||
} | ||
else { | ||
$active = FALSE; | ||
$ext_data['Name'] = $dep_ext[0]; | ||
} | ||
$coma = ( $i == $deps_count ) ? '' : ','; | ||
// Item description | ||
$description = '<div class="plugin-description"><p>' . wp_kses_post( $ext_info['Description'] ) . '</p></div>'; | ||
// Item info | ||
$class = $ext_cnt ? 'inactive' : 'active'; | ||
$version = $ext_info['Version'] ? sprintf( __( 'Version: %s', 'runway' ), $ext_info['Version'] ) : ''; | ||
if ( $ext_info['Author'] ) { | ||
$author = ' | ' . sprintf( __( 'By %s', 'runway' ), $ext_info['Author'] ); | ||
if ( $ext_info['AuthorURI'] ) { | ||
$author = ' | ' . __( 'By', 'runway' ) . | ||
' <a href="' . $ext_info['AuthorURI'] . '" title="' . __( 'Visit author homepage', 'runway' ) . '">' . | ||
$ext_info['Author'] . | ||
'</a>'; | ||
} | ||
} else { | ||
$author = ' | ' . __( 'By Unknown', 'runway' ); | ||
} | ||
$plugin_link = $ext_info['ExtensionURI'] ? ' | <a href="' . esc_url( $ext_info['ExtensionURI'] ) . '" title="' . | ||
__( 'Visit plugin site', 'runway' ) . '">' . | ||
__( 'Visit plugin site', 'runway' ) . '</a>' : ''; | ||
$info = '<div class="' . esc_attr( $class ) . 'second plugin-version-author-uri">' . $version . $author . $plugin_link . '</div>'; | ||
|
||
// Print details | ||
echo rf_string( $description ); | ||
echo rf_string( $info ); // escaped above | ||
|
||
if ( count( $ext_info['DepsExts'] ) > 0 && isset( $ext_info['DepsExts'] ) && ! empty( $ext_info['DepsExts'] ) ) { ?> | ||
<b><?php echo __( 'Dependencies', 'runway' ); ?>:</b> | ||
<?php | ||
$deps_count = count( $ext_info['DepsExts'] ); | ||
$i = 0; | ||
foreach ( $ext_info['DepsExts'] as $dep_ext ) { | ||
$i ++; | ||
$dep_ext = explode( '|', $dep_ext ); | ||
if ( file_exists( $extm->extensions_dir . $dep_ext[1] ) ) { | ||
$ext_data = $extm->get_extension_data( $extm->extensions_dir . $dep_ext[1] ); | ||
$active = false; | ||
if ( ! empty( $extm->admin_settings ) ) { | ||
foreach ( $extm->admin_settings['extensions'][ $extm->theme_name ] as $ext_tmp ) { | ||
if ( $ext_tmp == $dep_ext[1] ) { | ||
$active = true; | ||
} | ||
} | ||
} | ||
} else { | ||
$active = false; | ||
$ext_data['Name'] = $dep_ext[0]; | ||
} | ||
$coma = ( $i == $deps_count ) ? '' : ','; | ||
|
||
$active = $active ? | ||
'<i style="color: green;">' . __( 'Active', 'runway' ) . '</i>' : | ||
'<i style="color: red;">' . __( 'Disabled', 'runway' ) . '</i>'; | ||
|
||
echo wp_kses_post( $ext_data['Name'] ); ?>(<?php echo wp_kses_post( $active ); ?>)<?php echo wp_kses_post( $coma ); | ||
|
||
} | ||
} ?> | ||
</td> | ||
</tr> | ||
<?php } | ||
} else { ?> | ||
|
||
$active = $active ? '<i style="color: green;">' . __( 'Active', 'runway' ) .'</i>' : | ||
'<i style="color: red;">' . __( 'Disabled', 'runway' ) . '</i>'; | ||
?> | ||
<?php echo wp_kses_post($ext_data['Name']); ?>(<?php echo wp_kses_post($active); ?>)<?php echo wp_kses_post($coma); ?> | ||
<?php endforeach; ?> | ||
<?php endif; ?> | ||
</td> | ||
</tr> | ||
<?php endforeach; else: ?> | ||
<tr calss="active"> | ||
<td class="plugin-title"> | ||
<?php echo __( 'Extensions not found', 'runway' );?>. | ||
<?php echo __( 'Extensions not found', 'runway' ); ?>. | ||
</td> | ||
<td class="column-description desc"> </td> | ||
<td class="column-description desc"></td> | ||
</tr> | ||
<?php endif; ?> | ||
|
||
<?php } ?> | ||
|
||
</tbody> | ||
</table> | ||
</table> | ||
</form> |
16 changes: 11 additions & 5 deletions
16
runway-framework/framework/includes/extensions-manager/views/del-extension-confirmation.php
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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
<p><?php echo __( 'You are about to remove the following extension from server', 'runway' );?>:</p> | ||
<p><?php echo __( 'You are about to remove the following extension from server', 'runway' ); ?>:</p> | ||
|
||
<ul class="ul-disc"> | ||
<li><strong><?php echo wp_kses_post($extm->extensions_List[$_GET['ext']]['Name']) ?></strong> <?php echo __('by', 'runway'); ?> <em><?php echo ( $extm->extensions_List[$_GET['ext']]['Author'] != '' ) ? $extm->extensions_List[$_GET['ext']]['Author'] : 'Parallelus'; ?></em></li> | ||
<li> | ||
<strong><?php echo wp_kses_post( $extm->extensions_List[ $_GET['ext'] ]['Name'] ) ?></strong> | ||
<?php echo __( 'by', 'runway' ); ?> | ||
<em><?php echo ( $extm->extensions_List[ $_GET['ext'] ]['Author'] != '' ) ? $extm->extensions_List[ $_GET['ext'] ]['Author'] : 'Parallelus'; ?></em> | ||
</li> | ||
</ul> | ||
|
||
<p><?php echo __( 'Are you sure you wish to delete these files', 'runway' );?>?</p> | ||
<a href="<?php echo esc_url( admin_url('admin.php?page=extensions&navigation=del-extension&ext='.$_GET['ext'].'&confirm=true') ); ?>" class = "button-secondary"><?php echo __( 'Yes, Delete these files', 'runway' );?></a> | ||
<a href="<?php echo esc_url( admin_url('admin.php?page=extensions') ); ?>" class = "button-secondary"><?php echo __( 'No, Return me to the theme list', 'runway' );?></a> | ||
<p><?php echo __( 'Are you sure you wish to delete these files', 'runway' ); ?>?</p> | ||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=extensions&navigation=del-extension&ext=' . $_GET['ext'] . '&confirm=true' ) ); ?>" | ||
class="button-secondary"><?php echo __( 'Yes, Delete these files', 'runway' ); ?></a> | ||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=extensions' ) ); ?>" | ||
class="button-secondary"><?php echo __( 'No, Return me to the theme list', 'runway' ); ?></a> |