protected function column_name(WP_MSM_Profile $profile) { echo '<strong>' . esc_html($profile->displayName) . '</strong>'; $urlBase = WP_MSM_Admin::pageURL('profiles'); $editUrl = add_query_arg(array('action' => 'edit', 'profile' => $profile->name), $urlBase); $duplicateUrl = add_query_arg(array('action' => 'duplicate', 'profile' => $profile->name, '_wpnonce' => wp_create_nonce('wpmsm_duplicate_profile_' . $profile->name)), $urlBase); $deleteUrl = add_query_arg(array('action' => 'delete', 'profile' => $profile->name, '_wpnonce' => wp_create_nonce('wpmsm_delete_profile_' . $profile->name)), $urlBase); $actions = array('edit' => '<a href="' . esc_url($editUrl) . '">' . _x('Edit', 'verb', 'WordPress-MultiServer-Migration') . '</a>', 'duplicate' => '<a href="' . esc_url($duplicateUrl) . '">' . _x('Duplicate', 'verb', 'WordPress-MultiServer-Migration') . '</a>', 'delete' => '<a href="' . esc_url($deleteUrl) . '">' . __('Delete', 'WordPress-MultiServer-Migration') . '</a>'); if ($this->profileManager->is_default_profile($profile->name)) { unset($actions['edit']); unset($actions['delete']); } echo $this->row_actions($actions); }
private static function _render_profiles() { global $wpdb; $action = empty($_GET['action']) ? '' : stripslashes($_GET['action']); switch ($action) { case 'edit': $profileManager = new WP_MSM_Profile_Manager(); $profile = empty($_GET['profile']) ? '' : $_GET['profile']; $profile = $profileManager->get_profile($profile); if (!$profile) { wp_die('That profile does not exist!'); } ?> <form style="max-width:500px;" method="post" action=""> <h2><?php printf(__('Edit Profile: %s', ''), $profile->displayName); ?> </h2> <?php wp_nonce_field('wpmsm_edit_profile_' . $profile->name); ?> <p> <label for="wpmsm_name"><strong><?php _e('Profile Name', 'WordPress-MultiServer-Migration'); ?> </strong></label><br /> <input type="text" class="widefat" name="wpmsm[name]" id="wpmsm_name" value="<?php echo esc_attr($profile->displayName); ?> " /> </p> <p> <label for="wpmsm_description"><strong><?php _e('Description', 'WordPress-MultiServer-Migration'); ?> </strong></label><br /> <textarea name="wpmsm[description]" class="widefat" id="wpmsm_description"><?php echo esc_textarea($profile->description); ?> </textarea> </p> <p> <strong><?php _e('Disable export?', 'WordPress-MultiServer-Migration'); ?> </strong><br /> <input type="radio" name="wpmsm[disable_export]" value="yes" id="wpmsm_disable_export_yes"<?php checked(!$profile->canExport); ?> /> <label for="wpmsm_disable_export_yes"> Yes </label> <input type="radio" name="wpmsm[disable_export]" value="no" id="wpmsm_disable_export_no"<?php checked($profile->canExport); ?> /> <label for="wpmsm_disable_export_no"> No</label> </p> <?php $tables = $wpdb->get_col("SHOW TABLES LIKE '{$wpdb->prefix}%';"); foreach ($tables as &$table) { $table = preg_replace('@^' . preg_quote($wpdb->prefix, '@') . '@', '', $table); } unset($table); $table_names = array('commentmeta' => __('Comment Meta', 'WordPress-MultiServer-Migration'), 'comments' => __('Comments', 'WordPress-MultiServer-Migration'), 'links' => __('Links', 'WordPress-MultiServer-Migration'), 'options' => __('Options', 'WordPress-MultiServer-Migration'), 'postmeta' => __('Post Meta', 'WordPress-MultiServer-Migration'), 'posts' => __('Posts', 'WordPress-MultiServer-Migration'), 'term_relationships' => __('Term Relationships', 'WordPress-MultiServer-Migration'), 'term_taxonomy' => __('Term Taxonomy', 'WordPress-MultiServer-Migration'), 'terms' => __('Terms', 'WordPress-MultiServer-Migration'), 'usermeta' => __('User Meta', 'WordPress-MultiServer-Migration'), 'users' => __('Users', 'WordPress-MultiServer-Migration')); $counter = 0; echo '<h4>Database Tables to exclude from exports</h4><p>'; $disabled = disabled($profile->canExport, false, false); foreach ($tables as $table) { $label = empty($table_names[$table]) ? $table : $table_names[$table]; $excluded = in_array($table, $profile->dbTablesToExclude); $excluded = checked($excluded, true, false); ?> <div class="excludeTableCheckbox" style="width:30%;margin-right:3%;float:left;"> <label> <input type="checkbox" name="wpmsm[exclude_table][]" value="<?php echo esc_attr($table); ?> "<?php echo $excluded . $disabled; ?> /> <?php echo esc_html($label); ?> </label> </div> <?php if (!(++$counter % 3)) { echo '<div class="clear"></div></p><p>'; } } echo '<div class="clear"></div></p>'; submit_button(__('Update Profile', 'WordPress-MultiServer-Migration')); ?> <script> jQuery(document).ready(function($){ $('#wpmsm_disable_export_yes, #wpmsm_disable_export_no').change(function(){ var item = $('#wpmsm_disable_export_yes'); $('.excludeTableCheckbox input').each(function(k,i){ $(i).prop( 'disabled', item.prop('checked') ); }); }); }); </script> </form> <?php break; default: self::$profileListTable->views(); ?> <form method="get" action=""> <br /> <?php self::$profileListTable->search_box(__('Search Profiles', 'WordPress-MultiServer-Migration'), 'profiles'); ?> </form> <form method="post" action=""> <input type="hidden" name="paged" value="<?php echo esc_attr(self::$profileListTable->get_pagenum()); ?> " /> <style> .wp-list-table th#name { width: 15%; } </style> <?php self::$profileListTable->display(); ?> </form> <?php } }