Viewing File: /usr/local/cpanel/3rdparty/wp-toolkit/feature-showcase/WpToolkitHireDeveloper/META.pm

package Cpanel::Config::ConfigObj::Driver::WpToolkitHireDeveloper::META;

# cpanel - Cpanel/Config/ConfigObj/Driver/WpToolkitHireDeveloper/META.pm
# Copyright 1999-2025. WebPros International GmbH. All rights reserved.

use cPstrict;
use Cpanel::SafeRun::Simple ();

=encoding utf-8

=head1 NAME

Cpanel::Config::ConfigObj::Driver::WpToolkitHireDeveloper::META

=head1 DESCRIPTION

Feature Showcase metadata for WpToolkitHireDeveloper

=cut

use parent qw(Cpanel::Config::ConfigObj::Interface::Config::Version::v1);

our $VERSION = "1.0";

=head1 FUNCTIONS

=head2 get_driver_name()

Returns the driver name. This name is used as the filename for the touchfile
put in the C</var/cpanel/activate/features/> directory.

=cut

use constant get_driver_name => 'WpToolkitHireDeveloper';

=head2 get_setting()
=cut

sub get_setting ($setting) {
    my @commandArgs = ('/usr/local/bin/wp-toolkit', '--config', '-operation', 'get', '-format', 'json', '-option-name', $setting);
    my $stdout = Cpanel::SafeRun::Simple::saferunnoerror(@commandArgs);
    return Cpanel::JSON::Load($stdout);
}

=head2 content

Defines the content used in the Feature Showcase entry

=cut

sub content ($locale) {
    my $abstract = "<p>" . join(
        "</p><p>",
        "WP Toolkit introduces the \"Hire a developer\" link to direct WordPress site admins to a service that provides WordPress development services." ,

         "By default, the link directs site admins to the Codeable platform, where they gain access to top WordPress experts and developers who can handle all sorts of WordPress development tasks.",

         "The \"Hire a developer\" link can be hidden or customized any time later in WP Toolkit Settings.",

    ) . "</p>";

    $abstract .= <<form;

  <p>Link Configuration:</p><!--
  --><label style="width: 100%;"><input type="radio" name="wpToolkitHireDeveloperSource" value="none"> <span style="font-weight: normal">Link hidden</span></label>
  <label style="width: 100%;"><input type="radio" name="wpToolkitHireDeveloperSource" value="codeable" checked> <span>Default link (Codeable)</span></label>
  <label style="width: 100%;"><input type="radio" name="wpToolkitHireDeveloperSource" value="custom"> <span style="font-weight: normal">Link to custom URL</span>
      <input type="text" style="margin-left: 17px;" name="wpToolkitHireDeveloperHref" placeholder="http://example.com" onfocus="this.parentElement.firstElementChild.checked = true"></label>

form

    return {
        'vendor' => 'WebPros, L.L.C.',
        'name'   => {
            'short'  => 'Hire A Developer link',
            'long'   => 'Hire A Developer link',
            'driver' => get_driver_name(),
        },
        'first_appears_in' => '1',
        'version'          => $Cpanel::Config::ConfigObj::Driver::WpToolkitHireDeveloper::META::VERSION,
        'readonly'         => 1,
        'abstract'         => $abstract,
    };
}

=head2 showcase()

Determine how and if an item should appear in the showcase

=cut

sub showcase {
    my $data = get_setting('hireDeveloperFeature');
    if (!$data->{'optionValue'}) {
        return -1;
    }

    return { 'is_recommended' => 0, 'is_spotlight_feature' => 1 };
}
1;
Back to Directory File Manager