)" target="_blank" title="<?php _e("For the help with Lithuanian translation", 'pgc'); ?> " href="http://host1free.com">Vincent G</a> <a class="pgc_rsb_link" style="background-image:url(<?php echo PGC_PLUGIN_URL . '/images/paleosmak.png'; ?> )" target="_blank" title="<?php _e("For the help with Polish translation", 'pgc'); ?> " href="http://paleosmak.pl">Grzegorz Janoszka</a> <a class="pgc_rsb_link" target="_blank" title="<?php _e("For the help with Spanish translation", 'pgc'); ?> " >Melvis E. Leon Lopez</a> <hr /> <a class="pgc_rsb_link" target="_blank" title="<?php _e("For the help with bug fix and contribution to source code", 'pgc'); ?> " href="http://www.gigahub.com/">alx359</a> <hr /> <?php _e('Do you wish to see your name with link to your site here? You are welcome! Your help with translation and new ideas are very appreciated.', 'pgc'); echo pgc_displayBoxEnd(); ?> </div> </div> </div> </form>
function pgc_checkWpTablesStructure() { global $wpdb, $wp_queries; // Separate individual queries into an array $queries = explode(';', $wp_queries); if ('' == $queries[count($queries) - 1]) { array_pop($queries); } update_option('pgc_scanprogress_current', 1); update_option('pgc_scanprogress_status', 'Start scanning...'); update_option('pgc_scanprogress_total', count($queries)); $wpTablesList = array(); foreach ($queries as $query) { if (preg_match("|CREATE TABLE ([^ ]*)|", $query, $matches)) { $wpTablesList[trim(strtolower($matches[1]), '`')] = $query; } } $changedTables = array(); $i = 1; foreach ($wpTablesList as $table => $createQuery) { update_option('pgc_scanprogress_current', $i); update_option('pgc_scanprogress_status', $table); // orginal structure columns list $origColumns = pgc_extractFieldNames($createQuery); // fact structrue columns list $query = "describe {$table}"; $factColumns = $wpdb->get_results($query); foreach ($factColumns as $factColumn) { if (!isset($origColumns[strtolower($factColumn->Field)])) { if (!isset($changedTables[$table])) { $changedTables[$table] = array(); } $changedTables[$table][$factColumn->Field] = new stdClass(); $changedTables[$table][$factColumn->Field]->plugin_name = ''; $changedTables[$table][$factColumn->Field]->plugin_state = ''; } } } delete_option('pgc_scanprogress_current'); delete_option('pgc_scanprogress_total'); delete_option('pgc_scanprogress_status'); if (count($changedTables) > 0) { $html .= ' <table id="pgc_plugin_tables" class="widefat" style="clear:none;" cellpadding="0" cellspacing="0"> <thead>' . pgc_displayColumnHeadersWP() . '</thead> <tbody>'; $pgc_settings = get_option('pgc_settings'); $showHiddenTables = isset($_POST['show_hidden_tables']) && $_POST['show_hidden_tables']; $showDeleteButton = false; $hiddenTableExists = false; $i = 0; foreach ($changedTables as $tableName => $columnData) { foreach ($columnData as $column => $plugin) { if ($i & 1) { $rowClass = 'class="pgc_odd"'; } else { $rowClass = 'class="pgc_even"'; } $hiddenTable = isset($pgc_settings['hidden'][$tableName]); if ($hiddenTable && !$showHiddenTables) { // skip this table $hiddenTableExists = true; continue; } $i++; $html .= '<tr ' . $rowClass . ' id="' . $tableName . '" > <td>'; if ($plugin->plugin_state == 'active') { if ($hiddenTable) { $checked = 'checked="checked"'; } else { $checked = ''; } $html .= '<input type="checkbox" name="hidden_' . $tableName . '" id="hidden_' . $tableName . '" onclick="pgc_HideTable(this, \'' . $tableName . '\')" ' . $checked . ' /> <img id="ajax_' . $tableName . '" class="ajax_processing" src="' . PGC_WP_ADMIN_URL . '/images/loading.gif" alt="ajax request processing..." title="AJAX request processing..."/>'; } $html .= '</td> <td style="vertical-align:top;width:100px;" >'; $deleteCheckBox = ''; if (!$plugin->plugin_name) { $color = 'red'; $deleteCheckBox = '<input type="checkbox" name="delete_' . $tableName . '" />'; $showDeleteButton = true; } else { if ($plugin->plugin_state == 'active') { $color = 'green'; } else { $color = 'blue'; } } $html .= $deleteCheckBox . ' <span style="color:' . $color . ';">' . $tableName . '</span>'; $html .= ' </td> <td><span style="color:' . $color . ';">' . $column . '</span></td><td>'; if ($plugin->plugin_name) { $html .= '<span style="color:' . $color . ';">' . $plugin->plugin_name . '</span>'; } else { $html .= '<span style="color:red;">unknown</span>'; } $html .= '</td> <td><span style="color:' . $color . ';">' . $plugin->plugin_state . '</span></td> </tr>'; } } $html .= '</tbody> <tfoot>' . pgc_displayColumnHeadersWP() . '</tfoot> </table>'; if ($hiddenTableExists) { $html .= '<span style="color: #bbb; font-size: 0.8em;">' . __('Some tables are hidden by you. Turn on "Show hidden DB tables" option and click "Scan" button again to show them.', 'pgc') . '</span>'; } if ($showDeleteButton) { $html .= ' <table> <tr> <td> <div class="submit"> <input type="submit" name="deleteExtraColumnsAction" value="' . __('Delete Extra Columns', 'pgc') . '"/> </div> </td> <td> <div style="padding-left: 10px;"><span style="color: red; font-weight: bold;">' . __('Attention!', 'pgc') . '</span> ' . __('Operation rollback is not possible. Consider to make database backup first. Please double think before click <code>Delete Extra Columns</code> button.', 'pgc') . ' </div> </td> </tr> </table>'; } } else { $html .= pgc_displayBoxStart() . ' <span style="color: green; text-align: center; font-size: 1.2em;">' . __('Congratulations! It seems that your WordPress database tables structure is not changed', 'pgc') . ' </span>' . pgc_displayBoxEnd(); } return $html; }