public function add_to_cart_url($url, $product)
 {
     if (!(is_page_template('page-templates/template-plans-pricing.php') || listify_is_widgetized_page())) {
         return $url;
     }
     if (!in_array($product->product_type, array('subscription', 'job_package', 'job_package_subscription'))) {
         return $url;
     }
     if ('' == ($submit = job_manager_get_permalink('submit_job_form'))) {
         return $url;
     }
     $url = add_query_arg('selected_package', $product->id, $submit);
     return esc_url($url);
 }
<?php

/**
 * The template for displaying when no job listings are found (in a loop).
 *
 * @package Listify
 */
?>

<li class="no_job_listings_found col-xs-12">
	<div class="content-box">
		<?php 
printf(__('Perhaps try revising your search or <a href="%s">create a listing</a> instead!', 'listify'), job_manager_get_permalink('submit_job_form'));
?>
	</div>
</li>
                }
                ?>
									<ul class="job-dashboard-actions">
										<?php 
                $actions = array();
                switch ($job->post_status) {
                    case 'publish':
                        $actions['edit'] = array('label' => __('Edit', 'wp-job-manager'), 'nonce' => false);
                        if (is_position_filled($job)) {
                            $actions['mark_not_filled'] = array('label' => __('Mark not filled', 'wp-job-manager'), 'nonce' => true);
                        } else {
                            $actions['mark_filled'] = array('label' => __('Mark filled', 'wp-job-manager'), 'nonce' => true);
                        }
                        break;
                    case 'expired':
                        if (job_manager_get_permalink('submit_job_form')) {
                            $actions['relist'] = array('label' => __('Relist', 'wp-job-manager'), 'nonce' => true);
                        }
                        break;
                    case 'pending_payment':
                    case 'pending':
                        if (job_manager_user_can_edit_pending_submissions()) {
                            $actions['edit'] = array('label' => __('Edit', 'wp-job-manager'), 'nonce' => false);
                        }
                        break;
                }
                $actions['delete'] = array('label' => __('Delete', 'wp-job-manager'), 'nonce' => true);
                $actions = apply_filters('job_manager_my_job_actions', $actions, $job);
                foreach ($actions as $action => $value) {
                    $action_url = add_query_arg(array('action' => $action, 'job_id' => $job->ID));
                    if ($value['nonce']) {
 /**
  * Handles actions on job dashboard
  */
 public function job_dashboard_handler()
 {
     if (!empty($_REQUEST['action']) && !empty($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'job_manager_my_job_actions')) {
         $action = sanitize_title($_REQUEST['action']);
         $job_id = absint($_REQUEST['job_id']);
         try {
             // Get Job
             $job = get_post($job_id);
             // Check ownership
             if (!job_manager_user_can_edit_job($job_id)) {
                 throw new Exception(__('Invalid ID', 'wp-job-manager'));
             }
             switch ($action) {
                 case 'mark_filled':
                     // Check status
                     if ($job->_filled == 1) {
                         throw new Exception(__('This position has already been filled', 'wp-job-manager'));
                     }
                     // Update
                     update_post_meta($job_id, '_filled', 1);
                     // Message
                     $this->job_dashboard_message = '<div class="job-manager-message">' . sprintf(__('%s has been filled', 'wp-job-manager'), $job->post_title) . '</div>';
                     break;
                 case 'mark_not_filled':
                     // Check status
                     if ($job->_filled != 1) {
                         throw new Exception(__('This position is not filled', 'wp-job-manager'));
                     }
                     // Update
                     update_post_meta($job_id, '_filled', 0);
                     // Message
                     $this->job_dashboard_message = '<div class="job-manager-message">' . sprintf(__('%s has been marked as not filled', 'wp-job-manager'), $job->post_title) . '</div>';
                     break;
                 case 'delete':
                     // Trash it
                     wp_trash_post($job_id);
                     // Message
                     $this->job_dashboard_message = '<div class="job-manager-message">' . sprintf(__('%s has been deleted', 'wp-job-manager'), $job->post_title) . '</div>';
                     break;
                 case 'relist':
                     // redirect to post page
                     wp_redirect(add_query_arg(array('job_id' => absint($job_id)), job_manager_get_permalink('submit_job_form')));
                     break;
                 default:
                     do_action('job_manager_job_dashboard_do_action_' . $action);
                     break;
             }
             do_action('job_manager_my_job_do_action', $action, $job_id);
         } catch (Exception $e) {
             $this->job_dashboard_message = '<div class="job-manager-error">' . $e->getMessage() . '</div>';
         }
     }
 }
    /**
     * Output addons page
     */
    public function output()
    {
        $step = !empty($_GET['step']) ? absint($_GET['step']) : 1;
        if (3 === $step && !empty($_POST)) {
            $create_pages = isset($_POST['wp-job-manager-create-page']) ? $_POST['wp-job-manager-create-page'] : array();
            $page_titles = $_POST['wp-job-manager-page-title'];
            $pages_to_create = array('submit_job_form' => '[submit_job_form]', 'job_dashboard' => '[job_dashboard]', 'jobs' => '[jobs]');
            foreach ($pages_to_create as $page => $content) {
                if (!isset($create_pages[$page]) || empty($page_titles[$page])) {
                    continue;
                }
                $this->create_page(sanitize_text_field($page_titles[$page]), $content, 'job_manager_' . $page . '_page_id');
            }
        }
        ?>
		<div class="wrap wp_job_manager wp_job_manager_addons_wrap">
			<h2><?php 
        _e('WP Job Manager Setup', 'wp-job-manager');
        ?>
</h2>

			<ul class="wp-job-manager-setup-steps">
				<li class="<?php 
        if ($step === 1) {
            echo 'wp-job-manager-setup-active-step';
        }
        ?>
"><?php 
        _e('1. Introduction', 'wp-job-manager');
        ?>
</li>
				<li class="<?php 
        if ($step === 2) {
            echo 'wp-job-manager-setup-active-step';
        }
        ?>
"><?php 
        _e('2. Page Setup', 'wp-job-manager');
        ?>
</li>
				<li class="<?php 
        if ($step === 3) {
            echo 'wp-job-manager-setup-active-step';
        }
        ?>
"><?php 
        _e('3. Done', 'wp-job-manager');
        ?>
</li>
			</ul>

			<?php 
        if (1 === $step) {
            ?>

				<h3><?php 
            _e('Setup Wizard Introduction', 'wp-job-manager');
            ?>
</h3>

				<p><?php 
            _e('Thanks for installing <em>WP Job Manager</em>!', 'wp-job-manager');
            ?>
</p>
				<p><?php 
            _e('This setup wizard will help you get started by creating the pages for job submission, job management, and listing your jobs.', 'wp-job-manager');
            ?>
</p>
				<p><?php 
            printf(__('If you want to skip the wizard and setup the pages and shortcodes yourself manually, the process is still relatively simple. Refer to the %sdocumentation%s for help.', 'wp-job-manager'), '<a href="https://wpjobmanager.com/documentation/">', '</a>');
            ?>
</p>

				<p class="submit">
					<a href="<?php 
            echo esc_url(add_query_arg('step', 2));
            ?>
" class="button button-primary"><?php 
            _e('Continue to page setup', 'wp-job-manager');
            ?>
</a>
					<a href="<?php 
            echo esc_url(add_query_arg('skip-job-manager-setup', 1, admin_url('index.php?page=job-manager-setup&step=3')));
            ?>
" class="button"><?php 
            _e('Skip setup. I will setup the plugin manually', 'wp-job-manager');
            ?>
</a>
				</p>

			<?php 
        }
        ?>
			<?php 
        if (2 === $step) {
            ?>

				<h3><?php 
            _e('Page Setup', 'wp-job-manager');
            ?>
</h3>

				<p><?php 
            printf(__('<em>WP Job Manager</em> includes %1$sshortcodes%2$s which can be used within your %3$spages%2$s to output content. These can be created for you below. For more information on the job shortcodes view the %4$sshortcode documentation%2$s.', 'wp-job-manager'), '<a href="http://codex.wordpress.org/Shortcode" title="What is a shortcode?" target="_blank" class="help-page-link">', '</a>', '<a href="http://codex.wordpress.org/Pages" target="_blank" class="help-page-link">', '<a href="https://wpjobmanager.com/document/shortcode-reference/" target="_blank" class="help-page-link">');
            ?>
</p>

				<form action="<?php 
            echo esc_url(add_query_arg('step', 3));
            ?>
" method="post">
					<table class="wp-job-manager-shortcodes widefat">
						<thead>
							<tr>
								<th>&nbsp;</th>
								<th><?php 
            _e('Page Title', 'wp-job-manager');
            ?>
</th>
								<th><?php 
            _e('Page Description', 'wp-job-manager');
            ?>
</th>
								<th><?php 
            _e('Content Shortcode', 'wp-job-manager');
            ?>
</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td><input type="checkbox" checked="checked" name="wp-job-manager-create-page[submit_job_form]" /></td>
								<td><input type="text" value="<?php 
            echo esc_attr(_x('Post a Job', 'Default page title (wizard)', 'wp-job-manager'));
            ?>
" name="wp-job-manager-page-title[submit_job_form]" /></td>
								<td>
									<p><?php 
            _e('This page allows employers to post jobs to your website from the front-end.', 'wp-job-manager');
            ?>
</p>

									<p><?php 
            _e('If you do not want to accept submissions from users in this way (for example you just want to post jobs from the admin dashboard) you can skip creating this page.', 'wp-job-manager');
            ?>
</p>
								</td>
								<td><code>[submit_job_form]</code></td>
							</tr>
							<tr>
								<td><input type="checkbox" checked="checked" name="wp-job-manager-create-page[job_dashboard]" /></td>
								<td><input type="text" value="<?php 
            echo esc_attr(_x('Job Dashboard', 'Default page title (wizard)', 'wp-job-manager'));
            ?>
" name="wp-job-manager-page-title[job_dashboard]" /></td>
								<td>
									<p><?php 
            _e('This page allows employers to manage and edit their own jobs from the front-end.', 'wp-job-manager');
            ?>
</p>

									<p><?php 
            _e('If you plan on managing all listings from the admin dashboard you can skip creating this page.', 'wp-job-manager');
            ?>
</p>
								</td>
								<td><code>[job_dashboard]</code></td>
							</tr>
							<tr>
								<td><input type="checkbox" checked="checked" name="wp-job-manager-create-page[jobs]" /></td>
								<td><input type="text" value="<?php 
            echo esc_attr(_x('Jobs', 'Default page title (wizard)', 'wp-job-manager'));
            ?>
" name="wp-job-manager-page-title[jobs]" /></td>
								<td><?php 
            _e('This page allows users to browse, search, and filter job listings on the front-end of your site.', 'wp-job-manager');
            ?>
</td>
								<td><code>[jobs]</code></td>
							</tr>
						</tbody>
						<tfoot>
							<tr>
								<th colspan="4">
									<input type="submit" class="button button-primary" value="Create selected pages" />
									<a href="<?php 
            echo esc_url(add_query_arg('step', 3));
            ?>
" class="button"><?php 
            _e('Skip this step', 'wp-job-manager');
            ?>
</a>
								</th>
							</tr>
						</tfoot>
					</table>
				</form>

			<?php 
        }
        ?>
			<?php 
        if (3 === $step) {
            ?>

				<h3><?php 
            _e('All Done!', 'wp-job-manager');
            ?>
</h3>

				<p><?php 
            _e('Looks like you\'re all set to start using the plugin. In case you\'re wondering where to go next:', 'wp-job-manager');
            ?>
</p>

				<ul class="wp-job-manager-next-steps">
					<li><a href="<?php 
            echo admin_url('edit.php?post_type=job_listing&page=job-manager-settings');
            ?>
"><?php 
            _e('Tweak the plugin settings', 'wp-job-manager');
            ?>
</a></li>
					<li><a href="<?php 
            echo admin_url('post-new.php?post_type=job_listing');
            ?>
"><?php 
            _e('Add a job via the back-end', 'wp-job-manager');
            ?>
</a></li>

					<?php 
            if ($permalink = job_manager_get_permalink('submit_job_form')) {
                ?>
						<li><a href="<?php 
                echo esc_url($permalink);
                ?>
"><?php 
                _e('Add a job via the front-end', 'wp-job-manager');
                ?>
</a></li>
					<?php 
            } else {
                ?>
						<li><a href="https://wpjobmanager.com/document/the-job-submission-form/"><?php 
                _e('Find out more about the front-end job submission form', 'wp-job-manager');
                ?>
</a></li>
					<?php 
            }
            ?>

					<?php 
            if ($permalink = job_manager_get_permalink('jobs')) {
                ?>
						<li><a href="<?php 
                echo esc_url($permalink);
                ?>
"><?php 
                _e('View submitted job listings', 'wp-job-manager');
                ?>
</a></li>
					<?php 
            } else {
                ?>
						<li><a href="https://wpjobmanager.com/document/shortcode-reference/#section-1"><?php 
                _e('Add the [jobs] shortcode to a page to list jobs', 'wp-job-manager');
                ?>
</a></li>
					<?php 
            }
            ?>

					<?php 
            if ($permalink = job_manager_get_permalink('job_dashboard')) {
                ?>
						<li><a href="<?php 
                echo esc_url($permalink);
                ?>
"><?php 
                _e('View the job dashboard', 'wp-job-manager');
                ?>
</a></li>
					<?php 
            } else {
                ?>
						<li><a href="https://wpjobmanager.com/document/the-job-dashboard/"><?php 
                _e('Find out more about the front-end job dashboard', 'wp-job-manager');
                ?>
</a></li>
					<?php 
            }
            ?>
				</ul>

				<p><?php 
            printf(__('And don\'t forget, if you need any more help using <em>WP Job Manager</em> you can consult the %1$sdocumentation%2$s or %3$spost on the forums%2$s!', 'wp-job-manager'), '<a href="https://wpjobmanager.com/documentation/">', '</a>', '<a href="https://wordpress.org/support/plugin/wp-job-manager">');
            ?>
</p>

				<div class="wp-job-manager-support-the-plugin">
					<h3><?php 
            _e('Support the Ongoing Development of this Plugin', 'wp-job-manager');
            ?>
</h3>
					<p><?php 
            _e('There are many ways to support open-source projects such as WP Job Manager, for example code contribution, translation, or even telling your friends how awesome the plugin (hopefully) is. Thanks in advance for your support - it is much appreciated!', 'wp-job-manager');
            ?>
</p>
					<ul>
						<li class="icon-review"><a href="https://wordpress.org/support/view/plugin-reviews/wp-job-manager#postform"><?php 
            _e('Leave a positive review', 'wp-job-manager');
            ?>
</a></li>
						<li class="icon-localization"><a href="https://www.transifex.com/projects/p/wp-job-manager/"><?php 
            _e('Contribute a localization', 'wp-job-manager');
            ?>
</a></li>
						<li class="icon-code"><a href="https://github.com/mikejolley/WP-Job-Manager"><?php 
            _e('Contribute code or report a bug', 'wp-job-manager');
            ?>
</a></li>
						<li class="icon-forum"><a href="https://wordpress.org/support/plugin/wp-job-manager"><?php 
            _e('Help other users on the forums', 'wp-job-manager');
            ?>
</a></li>
					</ul>
				</div>

			<?php 
        }
        ?>
		</div>
		<?php 
    }
Exemplo n.º 6
0
    public function widget($args, $instance)
    {
        global $post;
        $placeholders = $this->get_placeholder_strings();
        //only put in the default title if the user hasn't saved anything in the database e.g. $instance is empty (as a whole)
        $title = apply_filters('widget_title', empty($instance) || !isset($instance['title']) ? $placeholders['title'] : $instance['title'], $instance, $this->id_base);
        $claim_button_text = empty($instance) || !isset($instance['claim_button_text']) ? $placeholders['claim_button_text'] : $instance['claim_button_text'];
        $claim_description_text = empty($instance) || !isset($instance['claim_description_text']) ? $placeholders['claim_description_text'] : $instance['claim_description_text'];
        $classes = WP_Job_Manager_Claim_Listing()->listing->add_post_class(array());
        if (isset($classes[0]) && !empty($classes[0])) {
            if ($classes[0] == 'claimed') {
                return;
            }
        }
        echo $args['before_widget'];
        if (!empty($title) || !empty($claim_button_text)) {
            //make sure that Login with Ajax can work
            if (empty($paid_claims) && !is_user_logged_in() && listable_using_lwa()) {
                //we need a wrapper with the lwa class
                $args['before_title'] .= '<div class="lwa">';
                $args['after_title'] = '</div>' . $args['after_title'];
            }
            echo $args['before_title'] . $title;
            if (!empty($claim_button_text)) {
                $paid_claims = get_option('wpjmcl_paid_claiming');
                $paid_claim_listing_page = job_manager_get_permalink('claim_listing');
                $href = esc_url(wp_nonce_url(add_query_arg(array('action' => 'claim_listing', 'listing_id' => $post->ID), $paid_claim_listing_page), 'claim_listing', 'claim_listing_nonce'));
                $classes = 'listing-claim-button';
                if (empty($paid_claims) && !is_user_logged_in()) {
                    $href = listable_get_login_url();
                    $classes = listable_get_login_link_class($classes);
                }
                echo ' <a class="' . $classes . '" href="' . $href . '">' . $claim_button_text . '</a>';
            }
            echo $args['after_title'];
        }
        if (!empty($claim_description_text)) {
            echo '<small class="listing-claim-description">' . $claim_description_text . '</small>';
        }
        wc_print_notices();
        ?>

		<?php 
        echo $args['after_widget'];
    }