/**
  * Check for GP Pro being active.
  *
  * @return void
  */
 public function gppro_active_check()
 {
     // First make sure we have our function.
     if (!function_exists('get_current_screen')) {
         return;
     }
     // Get the current screen.
     $screen = get_current_screen();
     // Bail if not on the plugins page.
     if (empty($screen) || !is_object($screen) || 'plugins.php' !== $screen->parent_file) {
         return;
     }
     // Run the active check.
     $coreactive = class_exists('Genesis_Palette_Pro') ? Genesis_Palette_Pro::check_active() : false;
     // Active. bail.
     if ($coreactive) {
         return;
     }
     // Set my text.
     $text = esc_html__('This plugin requires Genesis Design Palette Pro to function and cannot be activated.', 'gp-pro-freeform-style');
     // Not active. show message.
     echo wp_kses_post('<div id="message" class="error fade below-h2"><p><strong>' . $text . '</strong></p></div>');
     // Hide activation method.
     unset($_GET['activate']);
     // Deactivate the plugin.
     deactivate_plugins(plugin_basename(__FILE__));
     // And finish.
     return;
 }
 /**
  * create input field for CSS export
  *
  * @return
  */
 static function export_css_input($field, $item)
 {
     // bail if items missing
     if (!$field || !$item) {
         return;
     }
     // first check for the data
     $saved = get_option('gppro-settings');
     // display message without saved options
     if (empty($saved)) {
         $text = __('No data has been saved. Please save your settings before attempting to export.', 'gppro-export-css');
         return '<div class="gppro-input gppro-description-input"><p class="description">' . esc_attr($text) . '</p></div>';
     }
     // get my values
     $id = GP_Pro_Helper::get_field_id($field);
     $name = GP_Pro_Helper::get_field_name($field);
     $button = !empty($item['button']) ? esc_attr($item['button']) : __('Export File', 'gppro-export-css');
     // get CSS file for link
     $file = Genesis_Palette_Pro::filebase();
     // create export URL with nonce
     $expnonce = wp_create_nonce('gppro_css_export_nonce');
     // set the empty
     $input = '';
     // begin markup
     $input .= '<div class="gppro-input gppro-css-export-input gppro-setting-input">';
     // handle label with optional CSS file link
     $input .= '<div class="gppro-input-item gppro-input-wrap"><p class="description">';
     $input .= esc_attr($item['label']);
     // handle browser link
     if (file_exists($file['dir']) && !empty($file['url'])) {
         $input .= '<a class="gppro-css-export-view" href="' . esc_url($file['url']) . '" title="' . __('View in browser', 'gppro-export-css') . '" target="_blank">';
         $input .= '<i class="dashicons dashicons-admin-site"></i>';
         $input .= '</a>';
     }
     $input .= '</p></div>';
     // display button
     $input .= '<div class="gppro-input-item gppro-input-label choice-label">';
     $input .= '<span class="gppro-settings-button">';
     $input .= '<a name="' . esc_attr($name) . '" id="' . sanitize_html_class($id) . '" href="' . menu_page_url('genesis-palette-pro', 0) . '&gppro-css-export=go&_wpnonce=' . $expnonce . '" class="button-primary button-small ' . esc_attr($field) . '">' . $button . '</a>';
     $input .= '</span>';
     $input .= '</div>';
     // close markup
     $input .= '</div>';
     // send it back
     return $input;
 }
 /**
  * Check for GP Pro being active.
  *
  * @return HTML message or nothing.
  */
 public function gppro_active_check()
 {
     // Make sure the function exists.
     if (!function_exists('get_current_screen')) {
         return;
     }
     // Get the current screen.
     $screen = get_current_screen();
     // Bail if not on the plugins page.
     if (!is_object($screen) || empty($screen->parent_file) || 'plugins.php' !== esc_attr($screen->parent_file)) {
         return;
     }
     // Run the active check.
     $coreactive = class_exists('Genesis_Palette_Pro') ? Genesis_Palette_Pro::check_active() : false;
     // Active. bail.
     if ($coreactive) {
         return;
     }
     // Not active. Show message.
     echo '<div id="message" class="notice settings-error is-dismissible gppro-admin-warning"><p><strong>' . esc_html__('This plugin requires Genesis Design Palette Pro to function and cannot be activated.', 'gppro-entry-content') . '</strong></p></div>';
     // Hide activation method.
     unset($_GET['activate']);
     // Deactivate the plugin.
     deactivate_plugins(plugin_basename(__FILE__));
     // And finish.
     return;
 }
 /**
  * check for GP Pro being active
  *
  * @return GP_Pro_Widget_Enews
  */
 public function gppro_active_check()
 {
     // Confirm we are on the correct screen to check.
     if (class_exists('GP_Pro_Utilities') && false === ($check = GP_Pro_Utilities::check_current_dpp_screen('plugins.php'))) {
         return;
     }
     // Confirm that DPP isn't active before proceeding.
     if (class_exists('Genesis_Palette_Pro') && false !== ($active = Genesis_Palette_Pro::check_active())) {
         return;
     }
     // DPP is not active. show message.
     echo '<div id="message" class="error notice is-dismissible"><p><strong>' . __(sprintf('This plugin requires Genesis Design Palette Pro to function and cannot be activated.'), 'gpwen') . '</strong></p></div>';
     // Hide activation method.
     unset($_GET['activate']);
     // Deactivate the plugin.
     deactivate_plugins(plugin_basename(__FILE__));
     // And finish.
     return;
 }