/**
  * Handles UI output and form processing
  *
  * @since 0.4.0
  */
 function deploy_handler()
 {
     if (pods_v_sanitized('pods-deploy-submit', 'post')) {
         if (!pods_deploy_dependency_check()) {
             return;
         }
         if (!($nonce = pods_v_sanitized('_wpnonce', $_REQUEST)) || !wp_verify_nonce($nonce, 'pods-deploy')) {
             pods_error(__('Bad nonce.', 'pods-deploy'));
         }
         $remote_url = pods_v_sanitized('remote-url', 'post', false, true);
         $private_key = pods_v_sanitized('private-key', 'post');
         $public_key = pods_v_sanitized('public-key', 'post');
         if ($remote_url && $private_key && $public_key) {
             Pods_Deploy_Auth::save_local_keys($private_key, $public_key);
             update_option(self::$remote_url_key, $remote_url);
             $params = array('remote_url' => $remote_url, 'private_key' => $private_key, 'public_key' => $public_key);
             $pod_types = $this->pod_types();
             foreach ($pod_types as $type => $type_names) {
                 $type_sanitized = $this->type_sanitize($type, $type_names);
                 if (!empty($type_sanitized)) {
                     $params['deploy_types'][$type] = $type_sanitized;
                 }
             }
             /**
              * Filter which Pods to deploy.
              *
              * @param array $Pods Name of Pods to be deployed.
              * @param array $params Full params array.
              *
              * @return array $Pods
              *
              * @since 0.5.0
              */
             $params['deploy_types'] = apply_filters('pods_deploy_pods_to_deploy', $params['deploy_types'], $params);
             if (!pods_v_sanitized('deploy-components', 'post')) {
                 $params['components'] = false;
             } else {
                 $params['components'] = true;
             }
             pods_deploy($params);
         } else {
             _e('Keys and URL for remote site not set', 'pods-deploy');
             pods_error(var_dump(array($remote_url, $private_key, $public_key)));
         }
     } elseif (pods_v_sanitized('pods-deploy-key-gen-submit', 'post')) {
         $activate = pods_v_sanitized('allow-deploy', 'post');
         if ($activate) {
             Pods_Deploy_Auth::allow_deploy();
             Pods_Deploy_Auth::generate_keys();
         } else {
             Pods_Deploy_Auth::revoke_keys();
         }
         $this->include_view();
     } else {
         $this->include_view();
     }
 }
Пример #2
0
function pods_deploy_load_plugin()
{
    if (pods_deploy_dependency_check()) {
        include_once PODS_DEPLOY_DIR . 'class-pods-deploy-auth.php';
        include_once PODS_DEPLOY_DIR . 'class-pods-deploy-ui.php';
        include_once PODS_DEPLOY_DIR . 'class-pods-deploy.php';
        $ui = new Pods_Deploy_UI();
        add_filter('pods_admin_menu', array($ui, 'menu'));
        add_action('init', 'pods_deploy_auth');
    }
}
Пример #3
0
function pods_deploy_load_plugin()
{
    if (pods_deploy_dependency_check()) {
        include_once PODS_DEPLOY_DIR . 'class-pods-deploy-auth.php';
        include_once PODS_DEPLOY_DIR . 'class-pods-deploy.php';
        add_filter('pods_admin_menu', 'pods_deploy_tools_menu');
        add_action('init', 'pods_deploy_auth');
    }
}