Ejemplo n.º 1
0
     if ($is_paying) {
         $buttons[] = fs_ui_get_action_button($slug, 'account', 'deactivate_license', __fs('deactivate-license', $slug), array('plugin_id' => $addon_id), false);
     } else {
         if ($is_paid_trial) {
             $buttons[] = fs_ui_get_action_button($slug, 'account', 'cancel_trial', __fs('cancel-trial', $slug), array('plugin_id' => $addon_id), false, 'dashicons dashicons-download', __fs('cancel-trial-confirm', $slug), 'POST');
         } else {
             $premium_license = $fs_addon->_get_available_premium_license();
             if (is_object($premium_license)) {
                 $site = $fs_addon->get_site();
                 $buttons[] = fs_ui_get_action_button($slug, 'account', 'activate_license', sprintf(__fs('activate-x-plan', $slug), $fs_addon->get_plan_title(), $site->is_localhost() && $premium_license->is_free_localhost ? '[localhost]' : (1 < $premium_license->left() ? $premium_license->left() . ' left' : '')), array('plugin_id' => $addon_id, 'license_id' => $premium_license->id));
             }
         }
     }
     if (0 == count($buttons)) {
         // Add sync license only if non of the other CTAs are visible.
         $buttons[] = fs_ui_get_action_button($slug, 'account', $slug . '_sync_license', __fs('sync-license', $slug), array('plugin_id' => $addon_id), false);
     }
 } else {
     if (!$show_upgrade) {
         if ($fs->is_addon_installed($addon->slug)) {
             $addon_file = $fs->get_addon_basename($addon->slug);
             $buttons[] = sprintf('<a class="button button-primary" href="%s" title="%s" class="edit">%s</a>', wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $addon_file, 'activate-plugin_' . $addon_file), esc_attr(__fs('activate-this-addon', $slug)), __fs('activate', $slug));
         } else {
             if ($fs->is_allowed_to_install()) {
                 $buttons[] = sprintf('<a class="button button-primary" href="%s" class="edit">%s</a>', wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $addon->slug), 'install-plugin_' . $addon->slug), __fs('install-now', $slug));
             } else {
                 $buttons[] = sprintf('<a target="_blank" class="button button-primary" href="%s" class="edit">%s</a>', $fs->_get_latest_download_local_url($addon_id), __fs('download-latest', $slug));
             }
         }
     }
 }
Ejemplo n.º 2
0
/**
 * @param string      $slug
 * @param string      $page
 * @param string      $action
 * @param string      $title
 * @param array       $params
 * @param bool        $is_primary
 * @param string|bool $icon_class   Optional class for an icon (since 1.1.7).
 * @param string|bool $confirmation Optional confirmation message before submit (since 1.1.7).
 * @param string      $method       Since 1.1.7
 *
 * @uses fs_ui_get_action_button()
 */
function fs_ui_action_button($slug, $page, $action, $title, $params = array(), $is_primary = true, $icon_class = false, $confirmation = false, $method = 'GET')
{
    echo fs_ui_get_action_button($slug, $page, $action, $title, $params, $is_primary, $icon_class, $confirmation, $method);
}