diff --git a/admin/css/wp-allstars-plugins.css b/admin/css/wp-allstars-plugins.css new file mode 100644 index 0000000..66f0f61 --- /dev/null +++ b/admin/css/wp-allstars-plugins.css @@ -0,0 +1,203 @@ +/* Plugin List Container */ +.wp-list-table-container { + margin-top: 20px; + position: relative; + min-height: 400px; +} + +/* Plugin Cards */ +.plugin-card { + float: left; + margin: 0 8px 16px; + width: calc(50% - 16px); + border: 1px solid #dcdcde; + box-sizing: border-box; + background-color: #fff; + box-shadow: 0 1px 1px rgba(0,0,0,.04); + padding: 0; +} + +.plugin-card-top { + padding: 20px 20px 10px; + position: relative; + min-height: 135px; +} + +.plugin-card .name, +.plugin-card .desc { + margin-right: 120px; +} + +.plugin-card .name h3 { + font-size: 15px; + line-height: 1.3; + margin: 0 0 12px; +} + +.plugin-card .desc { + color: #646970; + font-size: 13px; + line-height: 1.5; + margin: 0 0 10px; +} + +.plugin-card .plugin-card-bottom { + clear: both; + padding: 12px 20px; + background-color: #f6f7f7; + border-top: 1px solid #dcdcde; + overflow: hidden; +} + +.plugin-card .column-rating { + line-height: 23px; +} + +.plugin-card .column-updated, +.plugin-card .column-downloaded { + text-align: right; + color: #646970; + font-size: 13px; +} + +.plugin-card .plugin-icon { + position: absolute; + top: 20px; + right: 20px; + width: 100px; + height: 100px; +} + +.plugin-card .action-links { + position: relative; +} + +.plugin-action-buttons { + clear: right; + float: right; + margin-left: 2em; + margin-bottom: 1em; + text-align: right; +} + +.plugin-action-buttons .button { + margin-right: 5px; +} + +.plugin-card-bottom .star-rating { + display: inline-block; + vertical-align: middle; +} + +/* Plugin Filters */ +.wpa-plugin-filters { + margin: 20px 0; + padding: 12px 15px; + background: #fff; + border: 1px solid #c3c4c7; + border-radius: 4px; + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.wpa-plugin-filters a { + margin: 0; +} + +/* Loading Overlay */ +.wpa-loading-overlay { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.8); + z-index: 10; + display: flex; + align-items: center; + justify-content: center; +} + +/* Theme Browser */ +.theme-browser .theme { + cursor: pointer; + float: left; + margin: 0 4% 4% 0; + position: relative; + width: 30.6%; + border: 1px solid #dcdcde; + box-shadow: 0 1px 1px rgba(0,0,0,.04); + box-sizing: border-box; +} + +.theme-browser .theme .theme-screenshot { + display: block; + overflow: hidden; + position: relative; + background: #fff; +} + +.theme-browser .theme .theme-screenshot img { + display: block; + width: 100%; + height: auto; +} + +.theme-browser .theme .theme-name { + font-size: 15px; + font-weight: 600; + height: 48px; + margin: 0; + padding: 15px; + box-shadow: inset 0 1px 0 rgba(0,0,0,.1); + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + background: #f6f7f7; + position: relative; +} + +.theme-browser .theme .theme-actions { + position: absolute; + top: 50%; + transform: translateY(-50%); + left: 0; + right: 0; + bottom: auto; + height: auto; + display: flex; + align-items: center; + justify-content: center; + gap: 5px; + background: rgba(255, 255, 255, 0.9); + padding: 20px 0; + opacity: 0; + transition: opacity .1s ease-in-out; +} + +.theme-browser .theme:hover .theme-actions { + opacity: 1; +} + +.theme-browser .theme .theme-actions .button { + margin: 0; +} + +/* Responsive Adjustments */ +@media screen and (max-width: 1100px) { + .plugin-card { + width: calc(100% - 16px); + } + + .theme-browser .theme { + width: 47%; + } +} + +@media screen and (max-width: 782px) { + .theme-browser .theme { + width: 100%; + margin-right: 0; + } +} \ No newline at end of file diff --git a/admin/settings.php b/admin/settings.php index 5043db2..97da865 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -215,29 +215,8 @@ function wp_allstars_ajax_get_plugins() { if ($cached_data !== false) { error_log('Using cached data for category: ' . $category); try { - // Setup the list table with cached data - $GLOBALS['tab'] = 'plugin-install'; - $_REQUEST['tab'] = 'plugin-install'; - $_REQUEST['type'] = 'plugin-install'; - set_current_screen('plugin-install'); - - $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table', array( - 'screen' => 'plugin-install' - )); - - // Override the items with our cached data - $wp_list_table->items = $cached_data->plugins; - $wp_list_table->set_pagination_args(array( - 'total_items' => count($cached_data->plugins), - 'per_page' => count($cached_data->plugins), - )); - - add_filter('plugin_install_action_links', 'wp_allstars_add_pro_button', 10, 2); - - ob_start(); - $wp_list_table->display(); - $html = ob_get_clean(); - + // Generate plugin cards HTML + $html = wp_allstars_generate_plugin_cards($cached_data->plugins); wp_send_json_success($html); return; } catch (Exception $e) { @@ -313,34 +292,8 @@ function wp_allstars_ajax_get_plugins() { // Cache the results wp_allstars_set_cached_plugins($category, $res); - // Setup the list table - $GLOBALS['tab'] = 'plugin-install'; - $_REQUEST['tab'] = 'plugin-install'; - $_REQUEST['type'] = 'plugin-install'; - set_current_screen('plugin-install'); - - $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table', array( - 'screen' => 'plugin-install' - )); - - // Set the items directly - $wp_list_table->items = $plugins; - $wp_list_table->set_pagination_args(array( - 'total_items' => count($plugins), - 'per_page' => count($plugins), - )); - - add_filter('plugin_install_action_links', 'wp_allstars_add_pro_button', 10, 2); - - ob_start(); - $wp_list_table->display(); - $html = ob_get_clean(); - - if (empty($html)) { - wp_send_json_error('Failed to generate plugin display HTML'); - return; - } - + // Generate plugin cards HTML + $html = wp_allstars_generate_plugin_cards($plugins); wp_send_json_success($html); } catch (Exception $e) { @@ -350,6 +303,88 @@ function wp_allstars_ajax_get_plugins() { } add_action('wp_ajax_wp_allstars_get_plugins', 'wp_allstars_ajax_get_plugins'); +// Function to generate plugin cards HTML +function wp_allstars_generate_plugin_cards($plugins) { + if (empty($plugins)) { + return '
No plugins found.
short_description); ?>
+