Example #1
0
                echo $adjusted_price > 0 ? rcp_currency_filter($adjusted_price) : __('free', 'jobify');
                ?>
										</h2>
									<?php 
            }
            ?>
								</span>
							</h2>

							<p><span class="rcp_level_duration"><?php 
            echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'jobify');
            ?>
</span></p>

							<?php 
            echo wpautop(wp_kses(stripslashes($level->description), rcp_allowed_html_tags()));
            ?>

							<p><a href="#" class="rcp-select button"><?php 
            _e('Select', 'jobify');
            ?>
</a></p>
						</div>
					</div>
				</div>
				<?php 
        }
        ?>
			<?php 
    }
    ?>
 /**
  * Update an existing subscription level
  *
  * @access  public
  * @since   1.5
  */
 public function update($level_id = 0, $args = array())
 {
     global $wpdb;
     $level = $this->get_level($level_id);
     $level = get_object_vars($level);
     $args = array_merge($level, $args);
     do_action('rcp_pre_edit_subscription_level', absint($args['id']), $args);
     foreach (array('price', 'fee') as $key) {
         if (empty($args[$key])) {
             $args[$key] = '0';
         }
         $args[$key] = str_replace(',', '', $args[$key]);
     }
     // Validate price value
     if (false === $this->valid_amount($args['price']) || $args['price'] < 0) {
         return false;
     }
     // Validate fee value
     if (false === $this->valid_amount($args['fee'])) {
         return false;
     }
     $update = $wpdb->query($wpdb->prepare("UPDATE {$this->db_name} SET\n\t\t\t\t\t`name`          = '%s',\n\t\t\t\t\t`description`   = '%s',\n\t\t\t\t\t`duration`      = '%d',\n\t\t\t\t\t`duration_unit` = '%s',\n\t\t\t\t\t`price`         = '%s',\n\t\t\t\t\t`fee`           = '%s',\n\t\t\t\t\t`level`         = '%d',\n\t\t\t\t\t`status`        = '%s',\n\t\t\t\t\t`role`          = '%s'\n\t\t\t\t\tWHERE `id`      = '%d'\n\t\t\t\t;", sanitize_text_field($args['name']), wp_kses($args['description'], rcp_allowed_html_tags()), sanitize_text_field($args['duration']), sanitize_text_field($args['duration_unit']), sanitize_text_field($args['price']), sanitize_text_field($args['fee']), absint($args['level']), sanitize_text_field($args['status']), sanitize_text_field($args['role']), absint($args['id'])));
     $cache_args = array('status' => 'all', 'limit' => null, 'orderby' => 'list_order');
     $cache_key = md5(implode('|', $cache_args));
     wp_cache_delete($cache_key, 'rcp');
     wp_cache_delete('level_' . $level_id, 'rcp');
     do_action('rcp_edit_subscription_level', absint($args['id']), $args);
     if ($update !== false) {
         return true;
     }
     return false;
 }
Example #3
0
					<div class="pricing-table-widget-description">
						<h2><span class="rcp_price" rel="<?php 
            echo esc_attr($level->price);
            ?>
"><?php 
            echo $level->price > 0 ? rcp_currency_filter($level->price) : __('free', 'jobify');
            ?>
</h2>

						<p><span class="rcp_level_duration"><?php 
            echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'jobify');
            ?>
</span></p>

						<?php 
            echo wpautop(wp_kses($level->description, rcp_allowed_html_tags()));
            ?>
						
					</div>
				</div>
				<?php 
        }
        ?>
			<?php 
    }
    ?>
		</div>
	<?php 
} elseif ($levels) {
    ?>
		<input type="hidden" class="rcp_level" name="rcp_level" rel="<?php 
    /**
     * widget function.
     *
     * @see WP_Widget
     * @access public
     * @param array $args
     * @param array $instance
     * @return void
     */
    function widget($args, $instance)
    {
        if ($this->get_cached_widget($args)) {
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
        $description = $instance['description'];
        $levels = rcp_get_subscription_levels('active');
        if (!$levels) {
            return;
        }
        $content = ob_get_clean();
        echo $before_widget;
        ?>

		<div class="container">

			<?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>

			<?php 
        if ($description) {
            ?>
				<p class="homepage-widget-description"><?php 
            echo $description;
            ?>
</p>
			<?php 
        }
        ?>

			<div class="job-packages row">

				<?php 
        foreach ($levels as $key => $level) {
            ?>
					<?php 
            if (rcp_show_subscription_level($level->id)) {
                ?>

					<div class="col-lg-4 col-md-6 col-sm-12 pricing-table-widget-wrapper">
						<div class="pricing-table-widget rcp_subscription_level rcp_subscription_level_fake" data-href="<?php 
                echo esc_url(get_permalink(jobify_find_page_with_shortcode(array('register_form'))));
                ?>
">
							<div class="pricing-table-widget-title">
								<span class="rcp_subscription_level_name"><?php 
                echo stripslashes($level->name);
                ?>
</span>
							</div>

							<div class="pricing-table-widget-description">
								<h2>
									<span class="rcp_price" rel="<?php 
                echo esc_attr($level->price);
                ?>
">
										<?php 
                if ($level->fee) {
                    ?>
											<?php 
                    $adjusted_price = $level->price + $level->fee;
                    ?>
											<?php 
                    echo $adjusted_price > 0 ? rcp_currency_filter($adjusted_price) : __('free', 'jobify');
                    ?>
											</h2>
											<small>
												<?php 
                    $promo_duration = sprintf(_n('%2$s', '%1$s %2$ss', $level->duration, 'jobify'), $level->duration, $level->duration_unit);
                    ?>
												<?php 
                    printf(__('* %s after first %s', 'jobify'), rcp_currency_filter($level->price), $promo_duration);
                    ?>
											</small>
										<?php 
                } else {
                    ?>
											<?php 
                    $adjusted_price = $level->price;
                    ?>
											<?php 
                    echo $adjusted_price > 0 ? rcp_currency_filter($adjusted_price) : __('free', 'jobify');
                    ?>
											</h2>
										<?php 
                }
                ?>
									</span>
								</h2>

								<p><span class="rcp_level_duration"><?php 
                echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'jobify');
                ?>
</span></p>

								<?php 
                echo wpautop(wp_kses(stripslashes($level->description), rcp_allowed_html_tags()));
                ?>

								<p><a href="#" class="rcp-select button"><?php 
                _e('Get Started', 'jobify');
                ?>
</a></p>
							</div>
						</div>
					</div>
					<?php 
            }
            ?>
				<?php 
        }
        ?>
			</div>

		</div>

		<?php 
        echo $after_widget;
        echo $content;
        $this->cache_widget($args, $content);
    }
Example #5
0
    /**
     * widget function.
     *
     * @see WP_Widget
     * @access public
     * @param array $args
     * @param array $instance
     * @return void
     */
    function widget($args, $instance)
    {
        if ($this->get_cached_widget($args)) {
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
        $description = $instance['description'];
        $levels = rcp_get_subscription_levels('active');
        if (!$levels) {
            return;
        }
        $content = ob_get_clean();
        echo $before_widget;
        ?>

		<div class="container">

			<?php 
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>

			<?php 
        if ($description) {
            ?>
				<p class="homepage-widget-description"><?php 
            echo $description;
            ?>
</p>
			<?php 
        }
        ?>

			<div class="pricing-table-widget-<?php 
        echo count($levels);
        ?>
">
				<?php 
        foreach ($levels as $key => $level) {
            ?>
					<?php 
            if (rcp_show_subscription_level($level->id)) {
                ?>
					<div id="rcp_subscription_level_<?php 
                echo $level->id;
                ?>
" class="pricing-table-widget rcp_subscription_level_fake" data-href="<?php 
                echo esc_url(get_permalink(jobify_find_page_with_shortcode(array('register_form'))));
                ?>
">
						<div class="pricing-table-widget-title" style="background-color: #01da90">
							<span class="rcp_subscription_level_name"><?php 
                echo stripslashes($level->name);
                ?>
</span>
						</div>

						<div class="pricing-table-widget-description">
							<h2><span class="rcp_price" rel="<?php 
                echo esc_attr($level->price);
                ?>
"><?php 
                echo $level->price > 0 ? rcp_currency_filter($level->price) : __('free', 'jobify');
                ?>
</h2>

							<p><span class="rcp_level_duration"><?php 
                echo $level->duration > 0 ? $level->duration . '&nbsp;' . rcp_filter_duration_unit($level->duration_unit, $level->duration) : __('unlimited', 'jobify');
                ?>
</span></p>

							<?php 
                echo wpautop(wp_kses($level->description, rcp_allowed_html_tags()));
                ?>
						</div>
					</div>
					<?php 
            }
            ?>
				<?php 
        }
        ?>
			</div>

		</div>

		<?php 
        echo $after_widget;
        echo $content;
        $this->cache_widget($args, $content);
    }