Skip to content

Commit

Permalink
Update content for settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
rilwis committed Sep 17, 2024
1 parent e39dedc commit 74730d1
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 112 deletions.
13 changes: 13 additions & 0 deletions assets/admin/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,16 @@
#side-sortables .postbox {
display: block !important;
}
#side-sortables .dashicons {
color: #e53e3e;
font-size: 16px;
height: 16px;
width: 16px;
margin-top: 2px;
}
#side-sortables p:has(.dashicons) {
padding-left: 20px;
}
#side-sortables p:has(.dashicons) .dashicons {
margin-left: -20px;
}
1 change: 0 additions & 1 deletion src/Admin/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ public function enqueue( $hook ) {
wp_enqueue_style( 'al-admin', $css_dir . 'auto-listings.css', '', AUTO_LISTINGS_VERSION );
}
}

18 changes: 9 additions & 9 deletions src/Admin/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public function admin_body_class( $classes ) {
* Restrict Media Library for all user except administrator
*/
public function restrict_media_library( $query ) {
$current_user = wp_get_current_user();
if ( ! $current_user || empty( $current_user->roles ) ) {
return $query;
}
$roles = $current_user->roles;
if ( in_array( 'auto_listings_seller', $roles ) || in_array( 'auto_listings_dealer', $roles ) ) {
$query['author'] = $current_user->ID;
}
return $query;
$current_user = wp_get_current_user();
if ( ! $current_user || empty( $current_user->roles ) ) {
return $query;
}
$roles = $current_user->roles;
if ( in_array( 'auto_listings_seller', $roles ) || in_array( 'auto_listings_dealer', $roles ) ) {
$query['author'] = $current_user->ID;
}
return $query;
}
}
19 changes: 9 additions & 10 deletions src/Admin/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@ public function __construct() {
add_action( 'admin_print_styles-auto-listing_page_auto-listings', [ $this, 'enqueue' ] );
}

public function register_settings_pages( array $settings_pages ) : array {
public function register_settings_pages( array $settings_pages ): array {
$settings_pages['auto-listings'] = [
'id' => 'auto-listings',
'option_name' => 'auto_listings_options',
'menu_title' => __( 'Settings', 'auto-listings' ),
'parent' => 'edit.php?post_type=auto-listing',
'tabs' => [
'general' => __( 'General', 'auto-listings' ),
'listings' => __( 'Listings', 'auto-listings' ),
'fields' => __( 'Fields', 'auto-listings' ),
'display' => __( 'Display', 'auto-listings' ),
'contact' => __( 'Contact Form', 'auto-listings' ),
'advanced' => __( 'Advanced', 'auto-listings' ),
'extensions' => __( 'Extensions', 'auto-listings' ),
'general' => __( 'General', 'auto-listings' ),
'listings' => __( 'Listings', 'auto-listings' ),
'fields' => __( 'Fields', 'auto-listings' ),
'display' => __( 'Display', 'auto-listings' ),
'contact' => __( 'Contact Form', 'auto-listings' ),
'advanced' => __( 'Advanced', 'auto-listings' ),
],
];
return $settings_pages;
}

public function register_settings_fields( array $meta_boxes ) : array {
public function register_settings_fields( array $meta_boxes ): array {
$files = glob( __DIR__ . '/settings/*.php' );
foreach ( $files as $file ) {
$meta_box = include $file;
Expand All @@ -38,6 +37,6 @@ public function register_settings_fields( array $meta_boxes ) : array {
}

public function enqueue() {
wp_enqueue_style( 'auto-listings-settings', AUTO_LISTINGS_URL . 'assets/admin/css/settings.css', [], AUTO_LISTINGS_VERSION );
wp_enqueue_style( 'auto-listings-settings', AUTO_LISTINGS_URL . 'assets/admin/css/settings.css', [], filemtime( AUTO_LISTINGS_DIR . 'assets/admin/css/settings.css' ) );
}
}
6 changes: 3 additions & 3 deletions src/Admin/settings/03-general-format.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
'std' => 2,
],
[
'id' => 'price_range',
'name' => __( 'Price Range', 'auto-listings' ),
'type' => 'text',
'id' => 'price_range',
'name' => __( 'Price Range', 'auto-listings' ),
'type' => 'text',
'desc' => __( 'Enter your price range here, from lowest to highest, seperated by the comma. If this is left empty, our default price range will be used.', 'auto-listings' ),
],
] ),
Expand Down
4 changes: 2 additions & 2 deletions src/Admin/settings/04-general-captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
Register your website with Google to get required API keys and enter them below.
<a href="https://www.google.com/recaptcha/admin#list" target="_blank">Get the API Keys</a>
</i>
</div>'
, 'autolistings-pro'
</div>',
'autolistings-pro'
),
],
[
Expand Down
6 changes: 3 additions & 3 deletions src/Admin/settings/04-listing-status.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
'add_button' => __( '+ Add Status', 'auto-listings' ),
'fields' => [
[
'name' => __( 'Status', 'auto-listings' ),
'id' => 'status',
'type' => 'text',
'name' => __( 'Status', 'auto-listings' ),
'id' => 'status',
'type' => 'text',
'sanitize_callback' => 'wp_kses_post',
],
[
Expand Down
8 changes: 4 additions & 4 deletions src/Admin/settings/08-display-slider.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
return [
return [
'id' => 'slider',
'title' => __( 'Image Slider', 'auto-listings' ),
'settings_pages' => 'auto-listings',
'tab' => 'display',
'fields' => [
[
'fields' => [
[
'name' => __( 'Auto start', 'auto-listings' ),
'id' => 'slider_auto',
'type' => 'switch',
'style' => 'square',
'on_label' => __( 'Enable', 'auto-listings' ),
'off_label' => __( 'Disable', 'auto-listings' ),
],
[
[
'name' => __( 'Slider speed', 'auto-listings' ),
'id' => 'slider_speed',
'type' => 'number',
Expand Down
8 changes: 4 additions & 4 deletions src/Admin/settings/10-contact-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
'placeholder' => '[email protected]',
],
[
'name' => __( 'Enable Ajax submission', 'auto-listings' ),
'id' => 'contact_form_ajax',
'type' => 'checkbox',
'std' => 1,
'name' => __( 'Enable Ajax submission', 'auto-listings' ),
'id' => 'contact_form_ajax',
'type' => 'checkbox',
'std' => 1,
],
],
];
137 changes: 68 additions & 69 deletions src/Admin/settings/14-extensions.php
Original file line number Diff line number Diff line change
@@ -1,84 +1,83 @@
<?php
/**
* List of Auto Listings extensions.
*
* @package Auto Listings.
*/
<?php ob_start(); ?>

<?php if ( ! class_exists( '\AutoListingsTabs\General\Settings' ) ) : ?>
<p>
<span class="dashicons dashicons-yes-alt"></span>
<?php
// Translators: %1$s - extension URL, %2$s - extension name.
echo wp_kses_post( sprintf( __( '<a href="%1$s" target="_blank"><b>%2$s</b></a> - Add custom tabs for listings to show your terms or promotions.', 'auto-listings' ), 'https://wpautolistings.com/extensions/tabs/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings', 'Tabs' ) );
?>
</p>
<?php endif ?>

ob_start()
?>
<p class="about-description">
<?php echo wp_kses_post( __( 'There are a number of premium extensions available at <a href="http://wpautolistings.com/docs/?utm_source=plugin&utm_medium=settings_page&utm_content=extensions" target="_blank">www.wpautolistings.com</a> that will take your automotive website to the next level.', 'auto-listings' ) ); ?>
</p>
<?php if ( ! defined( 'ALCP_DIR' ) ) : ?>
<p>
<span class="dashicons dashicons-yes-alt"></span>
<?php
// Translators: %1$s - extension URL, %2$s - extension name.
echo wp_kses_post( sprintf( __( '<a href="%1$s" target="_blank"><b>%2$s</b></a> - Create custom page to show your sold or new cars.', 'auto-listings' ), 'https://wpautolistings.com/extensions/custom-page/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings', 'Custom Page' ) );
?>
</p>
<?php endif ?>

<div class="extensions wp-clearfix">
<div class="extension">
<div class="extension-inner">
<img class="extension-icon" src="<?php echo esc_url( AUTO_LISTINGS_URL . 'assets/images/dlva-search-icon.png' ); ?>" width="30" height="30">
<div class="extension-info">
<h3>DVLA Search</h3>
<p><?php esc_html_e( 'Integrates with the DVLA Search API for the UK.', 'auto-listings' ); ?></p>
</div>
</div>
<div class="extension-action">
<a class="button" target="_blank" href="https://wpautolistings.com/extensions/dvla-search/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Learn More', 'auto-listings' ); ?></a>
</div>
</div>
<?php if ( ! defined( 'AL_DVLA_DIR' ) ) : ?>
<p>
<span class="dashicons dashicons-yes-alt"></span>
<?php
// Translators: %1$s - extension URL, %2$s - extension name.
echo wp_kses_post( sprintf( __( '<a href="%1$s" target="_blank"><b>%2$s</b></a> - Integrates with the DVLA Search API for the UK to query vehicle details.', 'auto-listings' ), 'https://wpautolistings.com/extensions/dvla-search/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings', 'DVLA Search' ) );
?>
</p>
<?php endif ?>

<div class="extension">
<div class="extension-inner">
<img class="extension-icon" src="<?php echo esc_url( AUTO_LISTINGS_URL . 'assets/images/regcheck-api-icon.png' ); ?>" width="30" height="30">
<div class="extension-info">
<h3>RegCheck API</h3>
<p><?php esc_html_e( 'Delivers precise data lookup for vehicles.', 'auto-listings' ); ?></p>
</div>
</div>
<div class="extension-action">
<a class="button" target="_blank" href="https://wpautolistings.com/extensions/regcheck-api/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Learn More', 'auto-listings' ); ?></a>
</div>
</div>
<?php if ( ! defined( 'AL_REGCHECK_DIR' ) ) : ?>
<p>
<span class="dashicons dashicons-yes-alt"></span>
<?php
// Translators: %1$s - extension URL, %2$s - extension name.
echo wp_kses_post( sprintf( __( '<a href="%1$s" target="_blank"><b>%2$s</b></a> - Delivers precise data lookup for vehicles.', 'auto-listings' ), 'https://wpautolistings.com/extensions/regcheck-api/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings', 'RegCheck API' ) );
?>
</p>
<?php endif ?>

<div class="extension">
<div class="extension-inner">
<img class="extension-icon" src="<?php echo esc_url( AUTO_LISTINGS_URL . 'assets/images/frontend-icon.png' ); ?>" width="30" height="30">
<div class="extension-info">
<h3>Frontend</h3>
<p><?php esc_html_e( 'Allow users to pay for and submit their own listings.', 'auto-listings' ); ?></p>
</div>
</div>
<div class="extension-action">
<a class="button" target="_blank" href="https://wpautolistings.com/extensions/frontend/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Learn More', 'auto-listings' ); ?></a>
</div>
</div>
<?php if ( ! defined( 'AL_FRONTEND_PLUGIN_DIR' ) ) : ?>
<p>
<span class="dashicons dashicons-yes-alt"></span>
<?php
// Translators: %1$s - extension URL, %2$s - extension name.
echo wp_kses_post( sprintf( __( '<a href="%1$s" target="_blank"><b>%2$s</b></a> - Allow users to pay for and submit their own listings.', 'auto-listings' ), 'https://wpautolistings.com/extensions/frontend/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings', 'Frontend' ) );
?>
</p>
<?php endif ?>

<?php if ( ! defined( 'AL_DEALERS_PLUGIN_DIR' ) ) : ?>
<p>
<span class="dashicons dashicons-yes-alt"></span>
<?php
// Translators: %1$s - extension URL, %2$s - extension name.
echo wp_kses_post( sprintf( __( '<a href="%1$s" target="_blank"><b>%2$s</b></a> - Create a multi-dealer car sales website.', 'auto-listings' ), 'https://wpautolistings.com/extensions/multiple-dealers/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings', 'Multiple Dealers' ) );
?>
</p>
<?php endif ?>

<div class="extension">
<div class="extension-inner">
<img class="extension-icon" src="<?php echo esc_url( AUTO_LISTINGS_URL . 'assets/images/multiple-dealers-icon.png' ); ?>" width="30" height="30">
<div class="extension-info">
<h3>Multiple Dealers</h3>
<p><?php esc_html_e( 'Create a multi-dealer car sales website.', 'auto-listings' ); ?></p>
</div>
</div>
<div class="extension-action">
<a class="button" target="_blank" href="https://wpautolistings.com/extensions/multiple-dealers/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Learn More', 'auto-listings' ); ?></a>
</div>
</div>
</div>
<?php
$messages = ob_get_clean();
$message = trim( ob_get_clean() );

if ( empty( $message ) ) {
return [];
}

$message .= '<a href="https://wpautolistings.com/extensions/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings" class="button button-primary">' . esc_html__( 'Get all extensions', 'auto-listings' ) . ' &rarr;</a>';

return [
'id' => 'extensions',
'title' => __( 'Extensions', 'auto-listings' ),
'id' => 'auto-listings-premium-extensions',
'title' => __( 'Premium Extensions', 'auto-listings' ),
'settings_pages' => 'auto-listings',
'tab' => 'extensions',
'context' => 'side',
'fields' => [
[
'std' => $messages,
'std' => wp_kses_post( $message ),
'type' => 'custom_html',
],
],
];



5 changes: 4 additions & 1 deletion src/Admin/settings/15-sidebar-themes.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
<?php ob_start(); ?>
<p>
<span class="dashicons dashicons-yes-alt"></span>
<?php
/* translators: theme url */
echo wp_kses_post( sprintf( __( '%s - powerful, elegant and lightweight premium theme for car dealership and car listings websites.', 'auto-listings' ), '<strong>eCar</strong>' ) );
?>
</p>
<p>
<span class="dashicons dashicons-yes-alt"></span>
<?php
/* translators: theme url */
echo wp_kses_post( sprintf( __( '%s - a must-have WordPress theme for car dealership and car listings websites.', 'auto-listings' ), '<strong>Corify</strong>' ) );
?>
</p>
<p>
<span class="dashicons dashicons-yes-alt"></span>
<?php
/* translators: theme url */
echo wp_kses_post( sprintf( __( '%s - free theme that helps you build a listings website with ease.', 'auto-listings' ), '<strong>CarListings</strong>' ) );
?>
</p>
<a href="https://wpautolistings.com/themes/?utm_source=WordPress&utm_medium=link&utm_campaign=settings" type="button" class="button"><?php esc_html_e( 'Get all themes', 'auto-listings' ); ?></a>
<a href="https://wpautolistings.com/themes/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings" class="button button-primary"><?php esc_html_e( 'Get all themes', 'auto-listings' ); ?> &rarr;</a>
<?php
$message = ob_get_clean();
return [
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/settings/16-sidebar-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<p><?php esc_html_e( 'Need to customize the plugin to suit your needs?', 'auto-listings' ); ?></p>
<p><?php esc_html_e( 'We offer customization service with affordable price.', 'auto-listings' ); ?></p>
<p><a href="https://wpautolistings.com/services/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin" target="_blank"><?php esc_html_e( 'Send us an email', 'auto-listings' ); ?></a></p>
<p><a href="https://wpautolistings.com/services/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings" class="button button-primary" target="_blank"><?php esc_html_e( 'Send us an email', 'auto-listings' ); ?> &rarr;</a></p>
<?php
$message = ob_get_clean();
return [
Expand Down
17 changes: 12 additions & 5 deletions src/Admin/settings/17-sidebar-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@
ob_start();
?>

<p><?php esc_html_e( ' Like this plugin? Check out our other WordPress products:', 'auto-listings' ); ?></p>
<p><a href="https://metabox.io/?utm_source=WordPress&utm_medium=link&utm_campaign=autolistings" target="_blank"><?php esc_html_e( 'Meta Box', 'auto-listings' ); ?></a> - <?php esc_html_e( 'Custom Fields Framework for WordPress' ); ?>.</p>
<p><a href="https://wpslimseo.com/?utm_source=WordPress&utm_medium=link&utm_campaign=autolistings" target="_blank"><?php esc_html_e( 'Slim SEO', 'auto-listings' ); ?></a> - <?php esc_html_e( 'Automated & fast SEO plugin for WordPress' ); ?>.</p>
<p><a href="https://gretathemes.com/?utm_source=WordPress&utm_medium=link&utm_campaign=autolistings" target="_blank"><?php esc_html_e( 'GretaThemes', 'auto-listings' ); ?></a> - <?php esc_html_e( 'Free and Premium WordPress Themes' ); ?>.</p>
<p><?= wp_kses_post( sprintf( __( ' Wanna to improve SEO for your site? Check out <a href="%1$s" target="_blank"><strong>%2$s</strong></a>, our automated and lightweight SEO plugin that:', 'auto-listings' ), 'https://wpslimseo.com/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings', 'Slim SEO' ) ); ?></p>
<ul>
<li><span class="dashicons dashicons-yes-alt"></span> <?php esc_html_e( 'Automatically generates meta tags', 'slim-seo' ) ?></li>
<li><span class="dashicons dashicons-yes-alt"></span> <?php esc_html_e( 'Adds XML sitemap', 'slim-seo' ) ?></li>
<li><span class="dashicons dashicons-yes-alt"></span> <?php esc_html_e( 'Automatically generates schemas', 'slim-seo' ) ?></li>
<li><span class="dashicons dashicons-yes-alt"></span> <?php esc_html_e( 'Integrates well with Auto Listings', 'slim-seo' ) ?></li>
</ul>
<a class="button button-primary" href="https://wpslimseo.com/?utm_source=settings_page&utm_medium=link&utm_campaign=auto_listings" target="_blank">
<?php // Translators: %s - plugin name ?>
<?= esc_html( sprintf( __( 'Get %s', 'slim-seo' ), 'Slim SEO' ) ); ?> &rarr;
</a>
<?php
$message = ob_get_clean();
return [
'id' => 'products-services',
'title' => __( 'Our WordPress Products', 'auto-listings' ),
'title' => __( 'Recommended SEO', 'auto-listings' ),
'settings_pages' => 'auto-listings',
'context' => 'side',
'fields' => [
Expand Down

0 comments on commit 74730d1

Please sign in to comment.