Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/go-fetch-jobs-wp-job-manager/gofetch-jobs-wpjm.php
+++ b/go-fetch-jobs-wp-job-manager/gofetch-jobs-wpjm.php
@@ -2,7 +2,7 @@
/**
* Plugin Name: WP Job Manager - Go Fetch Jobs
- * Version: 1.8.4.8.1
+ * Version: 1.8.4.9
* Description: Instantly populate your WP Job Manager database using RSS job feeds from the most popular job sites.
* Author: Bruno Carreço
* Plugin URI: https://gofetchjobs.com
@@ -70,7 +70,7 @@
/**
* @var The plugin version.
*/
- public $version = '1.8.4.8.1';
+ public $version = '1.8.4.9';
/**
* @var The expected parent plugin/theme name.
--- a/go-fetch-jobs-wp-job-manager/includes/admin/class-gofetch-admin-builder.php
+++ b/go-fetch-jobs-wp-job-manager/includes/admin/class-gofetch-admin-builder.php
@@ -138,7 +138,7 @@
echo html( 'div class="secondary-container provider-credits-info"', html( 'span class="dashicons-before dashicons-megaphone" style="padding-right: 8px;"', '' ) . html( 'div', __( 'Please note, all imported jobs belong to the respective providers. Always make sure they are properly credited.', 'gofetch-wpjm' ) ) );
if ( ! gfjwjm_fs()->can_use_premium_code() ) {
- echo scb_admin_notice( sprintf( html( 'span class="dashicons dashicons-warning" style=""', ' ' ) . ' ' . __( 'If you need further features like more job providers, a custom feed builder, featuring imported jobs, smart categories assign, schedule imports, and more, please upgrade to a <a href="%1$s">premium plan</a>.', 'gofetch-wpjm' ), esc_url( gfjwjm_fs()->get_upgrade_url() ) ) );
+ echo scb_bc_admin_notice( sprintf( html( 'span class="dashicons dashicons-warning" style=""', ' ' ) . ' ' . __( 'If you need further features like more job providers, a custom feed builder, featuring imported jobs, smart categories assign, schedule imports, and more, please upgrade to a <a href="%1$s">premium plan</a>.', 'gofetch-wpjm' ), esc_url( gfjwjm_fs()->get_upgrade_url() ) ) );
}
$templates = GoFetch_Helper::get_sanitized_templates();
@@ -467,7 +467,7 @@
'default' => 'daily',
);
- $additional_fields = scbForms::input( $field, array() );
+ $additional_fields = scbBcForms::input( $field, array() );
$additional_fields .= html( 'input', array(
'type' => 'text',
@@ -1000,7 +1000,7 @@
if ( ! empty( $_POST['templates_list'] ) ) {
$this->delete_template( sanitize_text_field( $_POST['templates_list'] ) );
} else {
- echo scb_admin_notice( __( 'Please select a template to delete.', 'gofetch-wpjm' ), 'error' );
+ echo scb_bc_admin_notice( __( 'Please select a template to delete.', 'gofetch-wpjm' ), 'error' );
}
return;
@@ -1012,7 +1012,7 @@
} else {
if ( empty( $_POST['template_name'] ) ) {
- echo scb_admin_notice( __( 'Please name your template.', 'gofetch-wpjm' ), 'error' );
+ echo scb_bc_admin_notice( __( 'Please name your template.', 'gofetch-wpjm' ), 'error' );
return;
}
@@ -1116,14 +1116,14 @@
}
if ( empty( $items ) ) {
- echo scb_admin_notice( __( "Sorry, couldn't find anything to import.", 'gofetch-wpjm' ), 'error' );
+ echo scb_bc_admin_notice( __( "Sorry, couldn't find anything to import.", 'gofetch-wpjm' ), 'error' );
return;
}
$mappings_check = apply_filters( 'goft_wpjm_import_mappings_check', true, $params['field_mappings'], $items, $params['content_type'] );
if ( is_wp_error( $mappings_check ) ) {
- echo scb_admin_notice( __( "<strong>IMPORT ERROR</strong>", 'gofetch-wpjm' ) . '<br/>' . $mappings_check->get_error_message(), 'error' );
+ echo scb_bc_admin_notice( __( "<strong>IMPORT ERROR</strong>", 'gofetch-wpjm' ) . '<br/>' . $mappings_check->get_error_message(), 'error' );
return;
}
@@ -1249,7 +1249,7 @@
$templates = GoFetch_Helper::get_sanitized_templates();
if ( empty( $templates[ $name ] ) ) {
- echo scb_admin_notice( __( 'Could not delete template. Template name not found.', 'gofetch-wpjm' ) );
+ echo scb_bc_admin_notice( __( 'Could not delete template. Template name not found.', 'gofetch-wpjm' ) );
return;
}
@@ -1258,7 +1258,7 @@
$goft_wpjm_options->templates = $templates;
- echo scb_admin_notice( __( 'The template was deleted.', 'gofetch-wpjm' ) );
+ echo scb_bc_admin_notice( __( 'The template was deleted.', 'gofetch-wpjm' ) );
}
/**
@@ -1494,7 +1494,7 @@
$class .= ' goft-stats-container';
- echo scb_admin_notice( $msg, $class );
+ echo scb_bc_admin_notice( $msg, $class );
}
/**
@@ -1510,7 +1510,7 @@
$msg = wp_kses_post( $stats['new_schedule'] );
- echo scb_admin_notice( $msg, $class );
+ echo scb_bc_admin_notice( $msg, $class );
}
}
--- a/go-fetch-jobs-wp-job-manager/includes/admin/class-gofetch-admin-settings.php
+++ b/go-fetch-jobs-wp-job-manager/includes/admin/class-gofetch-admin-settings.php
@@ -152,7 +152,7 @@
}
$value = '';
if ( !empty( $_POST['bc_screen_options'] ) ) {
- $value = scb_recursive_sanitize_text_field( wp_unslash( $_POST['bc_screen_options'] ) );
+ $value = scb_bc_recursive_sanitize_text_field( wp_unslash( $_POST['bc_screen_options'] ) );
}
return $value;
}
@@ -568,7 +568,7 @@
}
$msg .= __( 'Settings <strong>saved</strong>.', esc_html( $this->textdomain ) );
}
- echo scb_admin_notice( $msg, $class );
+ echo scb_bc_admin_notice( $msg, $class );
}
/**
--- a/go-fetch-jobs-wp-job-manager/includes/admin/class-gofetch-admin.php
+++ b/go-fetch-jobs-wp-job-manager/includes/admin/class-gofetch-admin.php
@@ -555,7 +555,7 @@
return;
}
- if ( is_admin() && 'edit.php' === $pagenow && ! empty( $_GET['goft_provider'] ) && ( empty( $_GET['goft_imported_jobs'] ) || 2 !== (int) $_GET['goft_imported_jobs'] ) ) {
+ if ( is_admin() && 'edit.php' === $pagenow && ! empty( $_GET['providers_list'] ) && ! empty( $_GET['goft_provider'] ) && ( empty( $_GET['goft_imported_jobs'] ) || 2 !== (int) $_GET['goft_imported_jobs'] ) ) {
$providers = explode( ',', stripslashes( sanitize_text_field( $_GET['providers_list'] ) ) );
$values = array_combine( range( 1, count( $providers ) ), $providers );
@@ -715,7 +715,7 @@
* Admin notices.
*/
public function warnings() {
- echo scb_admin_notice( sprintf( __( '<strong>%1$s</strong> was not found. Please install it first to be able to use <strong>%2$s</strong>.', 'gofetch-wpjm' ), GoFetch_Jobs()->parent_plugin, 'Go Fetch Jobs' ), 'error' );
+ echo scb_bc_admin_notice( sprintf( __( '<strong>%1$s</strong> was not found. Please install it first to be able to use <strong>%2$s</strong>.', 'gofetch-wpjm' ), GoFetch_Jobs()->parent_plugin, 'Go Fetch Jobs' ), 'error' );
}
public static function limited_plan_warn() {
--- a/go-fetch-jobs-wp-job-manager/includes/class-gofetch-helper.php
+++ b/go-fetch-jobs-wp-job-manager/includes/class-gofetch-helper.php
@@ -137,6 +137,7 @@
*/
public static function remove_slashes( $string ) {
$string = implode( '', explode( '\', $string ) );
+ if ( ! $string ) return $string;
return stripslashes( trim( $string ) );
}
--- a/go-fetch-jobs-wp-job-manager/includes/class-gofetch-rss-providers.php
+++ b/go-fetch-jobs-wp-job-manager/includes/class-gofetch-rss-providers.php
@@ -722,11 +722,11 @@
),
'desc' => '<br/><small><strong>Note:</strong> Some countries might not have RSS feeds working. Check for any errors displayed below.</small>',
);
- $output_field = scbForms::input( $field, array() ) . '<br/>';
+ $output_field = scbBcForms::input( $field, array() ) . '<br/>';
if ( isset( $data['region_param_domain'] ) ) {
echo html( 'p class="domain-param params opt-param-' . esc_attr( $field_name ) . '"', $output_field . '<input type="hidden" name="feed-param-' . esc_attr( $field_name ) . '">' );
} else {
- echo scbForms::input( $field, array() ) . '<br/>';
+ echo scbBcForms::input( $field, array() ) . '<br/>';
}
}
}
--- a/go-fetch-jobs-wp-job-manager/includes/dynamic/admin/class-gofetch-dynamic-settings.php
+++ b/go-fetch-jobs-wp-job-manager/includes/dynamic/admin/class-gofetch-dynamic-settings.php
@@ -172,7 +172,9 @@
$expire_field = $goft_wpjm_options->setup_field_expiration;
// Decode any JSON encoded URL's
- $settings['rss_feed_import'] = stripslashes( $settings['rss_feed_import'] );
+ if ( ! empty( $settings['rss_feed_import'] ) ) {
+ $settings['rss_feed_import'] = stripslashes( $settings['rss_feed_import'] );
+ }
// Always calculate a new expiry date.
if ( ! empty( $settings['meta'][ $expire_field ] ) ) {
--- a/go-fetch-jobs-wp-job-manager/includes/framework/admin/class-bc-admin-page.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/admin/class-bc-admin-page.php
@@ -12,7 +12,7 @@
/**
* Data-aware form generator.
*/
-class BC_Framework_Admin_page extends scbAdminPage {
+class BC_Framework_Admin_page extends scbBcAdminPage {
/**
* This is where the page content goes.
--- a/go-fetch-jobs-wp-job-manager/includes/framework/admin/class-scb-tabs-page.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/admin/class-scb-tabs-page.php
@@ -50,7 +50,7 @@
foreach ( $this->tab_sections[ $_POST['action'] ] as $section )
$form_fields = array_merge( $form_fields, $section['fields'] );
- $to_update = scbForms::validate_post_data( $form_fields, null, $this->options->get() );
+ $to_update = scbBcForms::validate_post_data( $form_fields, null, $this->options->get() );
$this->options->update( $to_update );
@@ -71,7 +71,7 @@
$active_tab = key( $tabs );
}
- $current_url = scbUtil::get_current_url();
+ $current_url = scbBcUtil::get_current_url();
echo '<h3 class="nav-tab-wrapper">';
foreach ( $tabs as $tab_id => $tab_title ) {
--- a/go-fetch-jobs-wp-job-manager/includes/framework/admin/class-tooltips.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/admin/class-tooltips.php
@@ -350,7 +350,7 @@
if ( ! empty( $field['section_break'] ) ) {
return html( "tr class='" . implode( ' ', (array) $atts ) . " hr-break'",
- html( "th colspan=3", scbForms::input( $field, $formdata ) )
+ html( "th colspan=3", scbBcForms::input( $field, $formdata ) )
);
} else {
@@ -360,12 +360,12 @@
return html( "tr class='" . implode( ' ', (array) $atts ) . " hr-break'",
html( "th scope='row'", '' ),
html( "td", '' ),
- html( "td", scbForms::input( $field, $formdata ) )
+ html( "td", scbBcForms::input( $field, $formdata ) )
);
} else {
- return self::row_wrap( $field['title'], scbForms::input( $field, $formdata ), $tip, $atts );
+ return self::row_wrap( $field['title'], scbBcForms::input( $field, $formdata ), $tip, $atts );
}
--- a/go-fetch-jobs-wp-job-manager/includes/framework/admin/plugins-browser/class-wp-plugin-browser-menu.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/admin/plugins-browser/class-wp-plugin-browser-menu.php
@@ -7,7 +7,7 @@
/**
* Base class for the menu page.
*
- * Streamlined version of Scribu's scbFramework scbAdminPage class.
+ * Streamlined version of Scribu's scbFramework scbBcAdminPage class.
*/
abstract class BC_Framework_Plugin_Browser_Menu_Page {
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/AdminPage.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/AdminPage.php
@@ -2,7 +2,7 @@
/**
* Administration page base class.
*/
-abstract class scbAdminPage {
+abstract class scbBcAdminPage {
/** Page args
* $page_title string (mandatory)
* $parent (string) (default: options-general.php)
@@ -27,7 +27,7 @@
// Created at page init
protected $pagehook;
- // scbOptions object holder
+ // scbBcOptions object holder
// Normally, it's used for storing formdata
protected $options;
protected $option_name;
@@ -46,7 +46,7 @@
*
* @param string $class
* @param string $file
- * @param object $options (optional) A scbOptions object.
+ * @param object $options (optional) A scbBcOptions object.
*
* @return bool
*/
@@ -117,12 +117,12 @@
* Constructor.
*
* @param string|bool $file (optional)
- * @param object $options (optional) A scbOptions object.
+ * @param object $options (optional) A scbBcOptions object.
*
* @return void
*/
public function __construct( $file = false, $options = null ) {
- if ( is_a( $options, 'scbOptions' ) ) {
+ if ( is_a( $options, 'scbBcOptions' ) ) {
$this->options = $options;
}
@@ -259,7 +259,7 @@
$msg = __( 'Settings <strong>saved</strong>.', $this->textdomain );
}
- echo scb_admin_notice( $msg, $class );
+ echo scb_bc_admin_notice( $msg, $class );
}
@@ -288,7 +288,7 @@
}
/**
- * Mimics scbForms::form_wrap()
+ * Mimics scbBcForms::form_wrap()
*
* $this->form_wrap( $content ); // generates a form with a default submit button
*
@@ -300,7 +300,7 @@
* 'name' => 'action',
* ) );
*
- * @see scbForms::form_wrap()
+ * @see scbBcForms::form_wrap()
*
* @param string $content
* @param boolean|string|array $submit_button (optional)
@@ -321,7 +321,7 @@
$content .= call_user_func_array( array( $this, 'submit_button' ), $button_args );
}
- return scbForms::form_wrap( $content, $this->nonce );
+ return scbBcForms::form_wrap( $content, $this->nonce );
}
/**
@@ -389,9 +389,9 @@
}
/**
- * Mimic scbForms inheritance.
+ * Mimic scbBcForms inheritance.
*
- * @see scbForms
+ * @see scbBcForms
*
* @param string $method
* @param array $args
@@ -409,7 +409,7 @@
}
}
- return call_user_func_array( array( 'scbForms', $method ), $args );
+ return call_user_func_array( array( 'scbBcForms', $method ), $args );
}
/**
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/BoxesPage.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/BoxesPage.php
@@ -2,7 +2,7 @@
/**
* Admin screen with metaboxes base class.
*/
-abstract class scbBoxesPage extends scbAdminPage {
+abstract class scbBcBoxesPage extends scbBcAdminPage {
/*
A box definition looks like this:
array( $slug, $title, $column );
@@ -15,14 +15,14 @@
* Constructor.
*
* @param string|bool $file (optional)
- * @param object $options (optional) A scbOptions object.
+ * @param object $options (optional) A scbBcOptions object.
*
* @return void
*/
public function __construct( $file = false, $options = null ) {
parent::__construct( $file, $options );
- scbUtil::add_uninstall_hook( $this->file, array( $this, 'uninstall' ) );
+ scbBcUtil::add_uninstall_hook( $this->file, array( $this, 'uninstall' ) );
}
/**
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Cron.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Cron.php
@@ -2,7 +2,7 @@
/**
* WP Cron job container.
*/
-class scbCron {
+class scbBcCron {
protected $schedule;
protected $interval;
protected $time;
@@ -53,7 +53,7 @@
}
if ( $file && $this->schedule ) {
- scbUtil::add_activation_hook( $file, array( $this, 'reset' ) );
+ scbBcUtil::add_activation_hook( $file, array( $this, 'reset' ) );
register_deactivation_hook( $file, array( $this, 'unschedule' ) );
}
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Forms.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Forms.php
@@ -2,20 +2,20 @@
/**
* Data-aware form generator.
*/
-class scbForms {
+class scbBcForms {
const TOKEN = '%input%';
/**
* Generates form field.
*
- * @param array|scbFormField_I $args
+ * @param array|scbBcFormField_I $args
* @param mixed $value
*
* @return string
*/
public static function input_with_value( $args, $value ) {
- $field = scbFormField::create( $args );
+ $field = scbBcFormField::create( $args );
return $field->render( $value );
}
@@ -23,15 +23,15 @@
/**
* Generates form field.
*
- * @param array|scbFormField_I $args
+ * @param array|scbBcFormField_I $args
* @param array $formdata (optional)
*
* @return string
*/
public static function input( $args, $formdata = null ) {
- $field = scbFormField::create( $args );
+ $field = scbBcFormField::create( $args );
- return $field->render( scbForms::get_value( $args['name'], $formdata ) );
+ return $field->render( scbBcForms::get_value( $args['name'], $formdata ) );
}
/**
@@ -210,7 +210,7 @@
/**
* Given a list of fields, validate some data.
*
- * @param array $fields List of args that would be sent to scbForms::input()
+ * @param array $fields List of args that would be sent to scbBcForms::input()
* @param array $data (optional) The data to validate. Defaults to $_POST
* @param array $to_update (optional) Existing data to populate. Necessary for nested values
*
@@ -222,9 +222,9 @@
}
foreach ( $fields as $field ) {
- $value = scbForms::get_value( $field['name'], $data );
+ $value = scbBcForms::get_value( $field['name'], $data );
- $fieldObj = scbFormField::create( $field );
+ $fieldObj = scbBcFormField::create( $field );
$value = $fieldObj->validate( $value );
@@ -326,9 +326,9 @@
/**
- * A wrapper for scbForms, containing the formdata.
+ * A wrapper for scbBcForms, containing the formdata.
*/
-class scbForm {
+class scbBcForm {
protected $data = array();
protected $prefix = array();
@@ -355,14 +355,14 @@
*
* @param string $path
*
- * @return object A scbForm
+ * @return object A scbBcForm
*/
public function traverse_to( $path ) {
- $data = scbForms::get_value( $path, $this->data );
+ $data = scbBcForms::get_value( $path, $this->data );
$prefix = array_merge( $this->prefix, (array) $path );
- return new scbForm( $data, $prefix );
+ return new scbBcForm( $data, $prefix );
}
/**
@@ -373,20 +373,20 @@
* @return string
*/
public function input( $args ) {
- $value = scbForms::get_value( $args['name'], $this->data );
+ $value = scbBcForms::get_value( $args['name'], $this->data );
if ( ! empty( $this->prefix ) ) {
$args['name'] = array_merge( $this->prefix, (array) $args['name'] );
}
- return scbForms::input_with_value( $args, $value );
+ return scbBcForms::input_with_value( $args, $value );
}
}
/**
* Interface for form fields.
*/
-interface scbFormField_I {
+interface scbBcFormField_I {
/**
* Generate the corresponding HTML for a field.
@@ -410,19 +410,19 @@
/**
* Base class for form fields implementations.
*/
-abstract class scbFormField implements scbFormField_I {
+abstract class scbBcFormField implements scbBcFormField_I {
protected $args;
/**
* Creates form field.
*
- * @param array|scbFormField_I $args
+ * @param array|scbBcFormField_I $args
*
* @return mixed false on failure or instance of form class
*/
public static function create( $args ) {
- if ( is_a( $args, 'scbFormField_I' ) ) {
+ if ( is_a( $args, 'scbBcFormField_I' ) ) {
return $args;
}
@@ -447,8 +447,8 @@
$args = wp_parse_args( $args, array(
'desc' => '',
'desc_pos' => 'after',
- 'wrap' => scbForms::TOKEN,
- 'wrap_each' => scbForms::TOKEN,
+ 'wrap' => scbBcForms::TOKEN,
+ 'wrap_each' => scbBcForms::TOKEN,
) );
// depends on $args['desc']
@@ -458,19 +458,19 @@
switch ( $args['type'] ) {
case 'radio':
- return new scbRadiosField( $args );
+ return new scbBcRadiosField( $args );
case 'select':
- return new scbSelectField( $args );
+ return new scbBcSelectField( $args );
case 'checkbox':
if ( isset( $args['choices'] ) ) {
- return new scbMultipleChoiceField( $args );
+ return new scbBcMultipleChoiceField( $args );
} else {
- return new scbSingleCheckboxField( $args );
+ return new scbBcSingleCheckboxField( $args );
}
case 'custom':
- return new scbCustomField( $args );
+ return new scbBcCustomField( $args );
default:
- return new scbTextField( $args );
+ return new scbBcTextField( $args );
}
}
@@ -525,9 +525,9 @@
$this->_set_value( $args, $value );
}
- $args['name'] = scbForms::get_name( $args['name'] );
+ $args['name'] = scbBcForms::get_name( $args['name'] );
- return str_replace( scbForms::TOKEN, $this->_render( $args ), $this->wrap );
+ return str_replace( scbBcForms::TOKEN, $this->_render( $args ), $this->wrap );
}
/**
@@ -662,7 +662,7 @@
/**
* Text form field.
*/
-class scbTextField extends scbFormField {
+class scbBcTextField extends scbBcFormField {
/**
* Sanitizes value.
@@ -695,7 +695,7 @@
$args['extra']['id'] = $args['name'];
}
- return scbFormField::_input_gen( $args );
+ return scbBcFormField::_input_gen( $args );
}
/**
@@ -714,7 +714,7 @@
/**
* Base class for form fields with single choice.
*/
-abstract class scbSingleChoiceField extends scbFormField {
+abstract class scbBcSingleChoiceField extends scbBcFormField {
/**
* Validates a value against a field.
@@ -777,7 +777,7 @@
/**
* Dropdown field.
*/
-class scbSelectField extends scbSingleChoiceField {
+class scbBcSelectField extends scbBcSingleChoiceField {
/**
* Generate the corresponding HTML for a field.
@@ -821,14 +821,14 @@
$input = html( 'select', $args['extra'], $opts );
- return scbFormField::add_label( $input, $args['desc'], $args['desc_pos'] );
+ return scbBcFormField::add_label( $input, $args['desc'], $args['desc_pos'] );
}
}
/**
* Radio field.
*/
-class scbRadiosField extends scbSelectField {
+class scbBcRadiosField extends scbBcSelectField {
/**
* Generate the corresponding HTML for a field.
@@ -848,7 +848,7 @@
foreach ( $args['choices'] as $value => $title ) {
$value = (string) $value;
- $single_input = scbFormField::_checkbox( array(
+ $single_input = scbBcFormField::_checkbox( array(
'name' => $args['name'],
'type' => 'radio',
'value' => $value,
@@ -857,17 +857,17 @@
'desc_pos' => 'after',
) );
- $opts .= str_replace( scbForms::TOKEN, $single_input, $args['wrap_each'] );
+ $opts .= str_replace( scbBcForms::TOKEN, $single_input, $args['wrap_each'] );
}
- return scbFormField::add_desc( $opts, $args['desc'], $args['desc_pos'] );
+ return scbBcFormField::add_desc( $opts, $args['desc'], $args['desc_pos'] );
}
}
/**
* Checkbox field with multiple choices.
*/
-class scbMultipleChoiceField extends scbFormField {
+class scbBcMultipleChoiceField extends scbBcFormField {
/**
* Validates a value against a field.
@@ -899,7 +899,7 @@
$opts = '';
foreach ( $args['choices'] as $value => $title ) {
- $single_input = scbFormField::_checkbox( array(
+ $single_input = scbBcFormField::_checkbox( array(
'name' => $args['name'] . '[]',
'type' => 'checkbox',
'value' => $value,
@@ -908,10 +908,10 @@
'desc_pos' => 'after',
) );
- $opts .= str_replace( scbForms::TOKEN, $single_input, $args['wrap_each'] );
+ $opts .= str_replace( scbBcForms::TOKEN, $single_input, $args['wrap_each'] );
}
- return scbFormField::add_desc( $opts, $args['desc'], $args['desc_pos'] );
+ return scbBcFormField::add_desc( $opts, $args['desc'], $args['desc_pos'] );
}
/**
@@ -930,7 +930,7 @@
/**
* Checkbox field.
*/
-class scbSingleCheckboxField extends scbFormField {
+class scbBcSingleCheckboxField extends scbBcFormField {
/**
* Validates a value against a field.
@@ -964,7 +964,7 @@
$args['desc'] = str_replace( '[]', '', $args['value'] );
}
- return scbFormField::_input_gen( $args );
+ return scbBcFormField::_input_gen( $args );
}
/**
@@ -983,7 +983,7 @@
/**
* Wrapper field for custom callbacks.
*/
-class scbCustomField implements scbFormField_I {
+class scbBcCustomField implements scbBcFormField_I {
protected $args;
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Hooks.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Hooks.php
@@ -2,7 +2,7 @@
/**
* Automatic filter binding.
*/
-class scbHooks {
+class scbBcHooks {
private static $mangle_name;
/**
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Options.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Options.php
@@ -2,7 +2,7 @@
/**
* Container for an array of options.
*/
-class scbOptions {
+class scbBcOptions {
/**
* The option name.
@@ -36,8 +36,8 @@
$this->defaults = $defaults;
if ( $file ) {
- scbUtil::add_activation_hook( $file, array( $this, '_activation' ) );
- scbUtil::add_uninstall_hook( $file, array( $this, 'delete' ) );
+ scbBcUtil::add_activation_hook( $file, array( $this, '_activation' ) );
+ scbBcUtil::add_uninstall_hook( $file, array( $this, 'delete' ) );
}
}
@@ -61,7 +61,7 @@
public function get( $field = null, $default = null ) {
$data = array_merge( $this->defaults, (array) get_option( $this->key, array() ) );
- return scbForms::get_value( $field, $data, $default );
+ return scbBcForms::get_value( $field, $data, $default );
}
/**
@@ -72,7 +72,7 @@
* @return mixed Whatever is in those fields.
*/
public function get_defaults( $field = null ) {
- return scbForms::get_value( $field, $this->defaults );
+ return scbBcForms::get_value( $field, $this->defaults );
}
/**
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/PostMetabox.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/PostMetabox.php
@@ -2,7 +2,7 @@
/**
* Class that creates metaboxes on the post editing page.
*/
-class scbPostMetabox {
+class scbBcPostMetabox {
/**
* Metabox ID.
@@ -172,7 +172,7 @@
$output .= $this->table_row( $row, $formdata, $errors );
}
- $output = scbForms::table_wrap( $output );
+ $output = scbBcForms::table_wrap( $output );
return $output;
}
@@ -187,7 +187,7 @@
* @return string
*/
public function table_row( $row, $formdata, $errors = array() ) {
- $input = scbForms::input( $row, $formdata );
+ $input = scbBcForms::input( $row, $formdata );
// If row has an error, highlight it
$style = ( in_array( $row['name'], $errors ) ) ? 'style="background-color: #FFCCCC"' : '';
@@ -211,7 +211,7 @@
$class .= ' inline';
foreach ( (array) $notices as $notice ) {
- echo scb_admin_notice( $notice, $class );
+ echo scb_bc_admin_notice( $notice, $class );
}
}
@@ -276,7 +276,7 @@
protected function save( $post_id ) {
$form_fields = $this->form_fields();
- $to_update = scbForms::validate_post_data( $form_fields );
+ $to_update = scbBcForms::validate_post_data( $form_fields );
// Filter data
$to_update = $this->before_save( $to_update, $post_id );
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Table.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Table.php
@@ -2,7 +2,7 @@
/**
* Takes care of creating, updating and deleting database tables.
*/
-class scbTable {
+class scbBcTable {
/**
* The table name.
@@ -37,11 +37,11 @@
$this->columns = $columns;
$this->upgrade_method = $upgrade_method;
- scb_register_table( $name );
+ scb_bc_register_table( $name );
if ( $file ) {
- scbUtil::add_activation_hook( $file, array( $this, 'install' ) );
- scbUtil::add_uninstall_hook( $file, array( $this, 'uninstall' ) );
+ scbBcUtil::add_activation_hook( $file, array( $this, 'install' ) );
+ scbBcUtil::add_uninstall_hook( $file, array( $this, 'uninstall' ) );
}
}
@@ -51,7 +51,7 @@
* @return void
*/
public function install() {
- scb_install_table( $this->name, $this->columns, $this->upgrade_method );
+ scb_bc_install_table( $this->name, $this->columns, $this->upgrade_method );
}
/**
@@ -60,7 +60,7 @@
* @return void
*/
public function uninstall() {
- scb_uninstall_table( $this->name );
+ scb_bc_uninstall_table( $this->name );
}
}
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Util.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Util.php
@@ -2,7 +2,7 @@
/**
* Various utilities.
*/
-class scbUtil {
+class scbBcUtil {
/**
* Force script enqueue.
@@ -49,7 +49,7 @@
}
/**
- * Enable delayed plugin activation. To be used with scb_init()
+ * Enable delayed plugin activation. To be used with scb_bc_init()
*
* @param string $plugin
* @param string|array $callback
@@ -60,7 +60,7 @@
if ( defined( 'SCB_LOAD_MU' ) ) {
register_activation_hook( $plugin, $callback );
} else {
- add_action( 'scb_activation_' . plugin_basename( $plugin ), $callback );
+ add_action( 'scb_bc_activation_' . plugin_basename( $plugin ), $callback );
}
}
@@ -73,7 +73,7 @@
* @return void
*/
public static function do_activation( $plugin ) {
- do_action( 'scb_activation_' . plugin_basename( $plugin ) );
+ do_action( 'scb_bc_activation_' . plugin_basename( $plugin ) );
}
/**
@@ -172,8 +172,8 @@
* Transform a list of objects into an associative array.
*
* @deprecated r41
- * @deprecated Use scb_list_fold()
- * @see scb_list_fold()
+ * @deprecated Use scb_bc_list_fold()
+ * @see scb_bc_list_fold()
*
* @param array $objects
* @param string $key
@@ -182,8 +182,8 @@
* @return array
*/
public static function objects_to_assoc( $objects, $key, $value ) {
- _deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'r41', 'scb_list_fold()' );
- return scb_list_fold( $objects, $key, $value );
+ _deprecated_function( __CLASS__ . '::' . __FUNCTION__, 'r41', 'scb_bc_list_fold()' );
+ return scb_bc_list_fold( $objects, $key, $value );
}
/**
@@ -231,7 +231,7 @@
*
* @return string
*/
-function scb_admin_notice( $msg, $class = 'updated' ) {
+function scb_bc_admin_notice( $msg, $class = 'updated' ) {
return html( "div class='$class fade'", html( "p", $msg ) );
}
@@ -244,7 +244,7 @@
*
* @return array
*/
-function scb_list_fold( $list, $key, $value ) {
+function scb_bc_list_fold( $list, $key, $value ) {
$r = array();
if ( is_array( reset( $list ) ) ) {
@@ -268,7 +268,7 @@
*
* @return array
*/
-function scb_list_group_by( $list, $fn ) {
+function scb_bc_list_group_by( $list, $fn ) {
$groups = array();
foreach ( $list as $item ) {
@@ -294,7 +294,7 @@
*
* @return void
*/
-function scb_register_table( $key, $name = false ) {
+function scb_bc_register_table( $key, $name = false ) {
global $wpdb;
if ( ! $name ) {
@@ -308,13 +308,13 @@
/**
* Runs the SQL query for installing/upgrading a table.
*
- * @param string $key The key used in scb_register_table().
+ * @param string $key The key used in scb_bc_register_table().
* @param string $columns The SQL columns for the CREATE TABLE statement.
* @param array $opts (optional) Various other options.
*
* @return void
*/
-function scb_install_table( $key, $columns, $opts = array() ) {
+function scb_bc_install_table( $key, $columns, $opts = array() ) {
global $wpdb;
$full_table_name = $wpdb->$key;
@@ -356,11 +356,11 @@
/**
* Runs the SQL query for uninstalling a table.
*
- * @param string $key The key used in scb_register_table().
+ * @param string $key The key used in scb_bc_register_table().
*
* @return void
*/
-function scb_uninstall_table( $key ) {
+function scb_bc_uninstall_table( $key ) {
global $wpdb;
$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->$key );
@@ -436,7 +436,7 @@
*
* @return array
*/
-function scb_get_query_flags( $wp_query = null ) {
+function scb_bc_get_query_flags( $wp_query = null ) {
if ( ! $wp_query ) {
$wp_query = $GLOBALS['wp_query'];
}
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Widget.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/Widget.php
@@ -1,8 +1,8 @@
<?php
/**
- * Adds compatibility methods between WP_Widget and scbForms.
+ * Adds compatibility methods between WP_Widget and scbBcForms.
*/
-abstract class scbWidget extends WP_Widget {
+abstract class scbBcWidget extends WP_Widget {
/**
* Widget defaults.
@@ -14,7 +14,7 @@
* Widgets to register.
* @var array
*/
- private static $scb_widgets = array();
+ private static $scb_bc_widgets = array();
/**
* Initializes widget.
@@ -26,13 +26,13 @@
* @return void
*/
public static function init( $class, $file = '', $base = '' ) {
- self::$scb_widgets[] = $class;
+ self::$scb_bc_widgets[] = $class;
- add_action( 'widgets_init', array( __CLASS__, '_scb_register' ) );
+ add_action( 'widgets_init', array( __CLASS__, '_scb_bc_register' ) );
// for auto-uninstall
- if ( $file && $base && class_exists( 'scbOptions' ) ) {
- new scbOptions( "widget_$base", $file );
+ if ( $file && $base && class_exists( 'scbBcOptions' ) ) {
+ new scbBcOptions( "widget_$base", $file );
}
}
@@ -41,8 +41,8 @@
*
* @return void
*/
- public static function _scb_register() {
- foreach ( self::$scb_widgets as $widget ) {
+ public static function _scb_bc_register() {
+ foreach ( self::$scb_bc_widgets as $widget ) {
register_widget( $widget );
}
}
@@ -97,7 +97,7 @@
protected function input( $args, $formdata = array() ) {
$prefix = array( 'widget-' . $this->id_base, $this->number );
- $form = new scbForm( $formdata, $prefix );
+ $form = new scbBcForm( $formdata, $prefix );
// Add default class
if ( ! isset( $args['extra'] ) && 'text' == $args['type'] ) {
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/load-composer.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/load-composer.php
@@ -5,7 +5,7 @@
*
* @param callable $callback
*/
-function scb_init( $callback = null ) {
+function scb_bc_init( $callback = null ) {
if ( $callback ) {
call_user_func( $callback );
}
--- a/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/load.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/includes/wp-scb-framework/load.php
@@ -1,25 +1,25 @@
<?php
-$GLOBALS['_scb_data'] = array( 60, __FILE__, array(
- 'scbUtil',
- 'scbOptions',
- 'scbForms',
- 'scbTable',
- 'scbWidget',
- 'scbAdminPage',
- 'scbBoxesPage',
- 'scbPostMetabox',
- 'scbCron',
- 'scbHooks',
+$GLOBALS['_scb_bc_data'] = array( 60, __FILE__, array(
+ 'scbBcUtil',
+ 'scbBcOptions',
+ 'scbBcForms',
+ 'scbBcTable',
+ 'scbBcWidget',
+ 'scbBcAdminPage',
+ 'scbBcBoxesPage',
+ 'scbBcPostMetabox',
+ 'scbBcCron',
+ 'scbBcHooks',
) );
-if ( ! class_exists( 'scbLoad4' ) ) :
+if ( ! class_exists( 'scbBcLoad' ) ) :
/**
* The main idea behind this class is to load the most recent version of the scb classes available.
*
* It waits until all plugins are loaded and then does some crazy hacks to make activation hooks work.
*/
-class scbLoad4 {
+class scbBcLoad {
private static $candidates = array();
private static $classes;
@@ -28,7 +28,7 @@
private static $loaded;
static function init( $callback = '' ) {
- list( $rev, $file, $classes ) = $GLOBALS['_scb_data'];
+ list( $rev, $file, $classes ) = $GLOBALS['_scb_bc_data'];
self::$candidates[ $file ] = $rev;
self::$classes[ $file ] = $classes;
@@ -57,7 +57,7 @@
if ( dirname( dirname( plugin_basename( $file ) ) ) == $plugin_dir ) {
self::load( false );
call_user_func( $callback );
- do_action( 'scb_activation_' . $plugin );
+ do_action( 'scb_bc_activation_' . $plugin );
break;
}
}
@@ -71,12 +71,16 @@
$path = dirname( $file ) . '/';
foreach ( self::$classes[ $file ] as $class_name ) {
+
if ( class_exists( $class_name ) ) {
continue;
}
$fpath = $path . substr( $class_name, 3 ) . '.php';
+ $fpath = str_replace( "/Bc", '/', $fpath );
+
if ( file_exists( $fpath ) ) {
+
include $fpath;
self::$loaded[] = $fpath;
}
@@ -97,9 +101,9 @@
}
endif;
-if ( ! function_exists( 'scb_init' ) ) :
-function scb_init( $callback = '' ) {
- scbLoad4::init( $callback );
+if ( ! function_exists( 'scb_bc_init' ) ) :
+function scb_bc_init( $callback = '' ) {
+ scbBcLoad::init( $callback );
}
endif;
--- a/go-fetch-jobs-wp-job-manager/includes/framework/load.php
+++ b/go-fetch-jobs-wp-job-manager/includes/framework/load.php
@@ -63,7 +63,7 @@
if ( dirname( dirname( plugin_basename( $file ) ) ) == $plugin_dir ) {
self::load( false );
call_user_func( $callback );
- do_action( 'scb_activation_' . $plugin );
+ do_action( 'scb_bc_activation_' . $plugin );
break;
}
}
@@ -101,12 +101,12 @@
// __Initialize frameworks considering the latest revision.
-if ( ! function_exists( 'bc_scb_init' ) ) :
-function bc_scb_init( $callback = '' ) {
+if ( ! function_exists( 'bc_scb_bc_init' ) ) :
+function bc_scb_bc_init( $callback = '' ) {
BC_SCB_Load::init( $callback );
- do_action( 'bc_scb_framework_loaded' );
+ do_action( 'bc_scb_bc_framework_loaded' );
}
endif;
-scb_init( 'bc_scb_init' );
+scb_bc_init( 'bc_scb_bc_init' );
--- a/go-fetch-jobs-wp-job-manager/includes/settings.php
+++ b/go-fetch-jobs-wp-job-manager/includes/settings.php
@@ -244,6 +244,13 @@
'jooble_feed_default_salary_to' => '',
'jooble_feed_default_search_mode' => '1',
'jooble_block_search_indexing' => false,
+ // Jooble affiliate vars
+ 'jooble_aff_api_key' => '',
+ 'jooble_feed_default_job_type' => array(),
+ 'jooble_feed_default_max_days_old' => '',
+ 'jooble_feed_default_remote_only' => '',
+ 'jooble_feed_default_salary_rate' => '3',
+ 'jooble_feed_default_category' => array(),
// JuJu
'juju_publisher_id' => '',
@@ -273,4 +280,4 @@
// Merge options with the active module.
$options = wp_parse_args( $gofj_module_settings['options'], $options );
-$GLOBALS['goft_wpjm_options'] = new scbOptions( 'goft_wpjm_options', __FILE__, $options );
+$GLOBALS['goft_wpjm_options'] = new scbBcOptions( 'goft_wpjm_options', __FILE__, $options );
No newline at end of file
--- a/go-fetch-jobs-wp-job-manager/trunk/gofetch-jobs-wpjm.php
+++ b/go-fetch-jobs-wp-job-manager/trunk/gofetch-jobs-wpjm.php
@@ -1,399 +0,0 @@
-<?php
-
-/**
- * Plugin Name: WP Job Manager - Go Fetch Jobs
- * Version: 1.8.4.8.1
- * Description: Instantly populate your WP Job Manager database using RSS job feeds from the most popular job sites.
- * Author: Bruno Carreço
- * Plugin URI: https://gofetchjobs.com
- * Other: Icons by freepik 'http://www.freepik.com'
- *
- */
-if ( !defined( 'ABSPATH' ) ) {
- exit;
- // Exit if accessed directly.
-}
-$GLOBALS['gofj_module_settings'] = array();
-if ( function_exists( 'gfjwjm_fs' ) ) {
- gfjwjm_fs()->set_basename( false, __FILE__ );
-} else {
- // Begin Freemius.
- if ( !function_exists( 'gfjwjm_fs' ) ) {
- /**
- * Create a helper function for easy SDK access.
- */
- function gfjwjm_fs() {
- global $gfjwjm_fs;
- if ( !isset( $gfjwjm_fs ) ) {
- // Activate multisite network integration.
- if ( !defined( 'WP_FS__PRODUCT_192_MULTISITE' ) ) {
- define( 'WP_FS__PRODUCT_192_MULTISITE', true );
- }
- // Include Freemius SDK.
- require_once dirname( __FILE__ ) . '/includes/freemius/start.php';
- $gfjwjm_fs = fs_dynamic_init( array(
- 'id' => '192',
- 'slug' => 'gofetch-wpjm',
- 'public_key' => 'pk_d8c021486da49f69324049b5736a3',
- 'menu' => array(
- 'slug' => 'go-fetch-jobs-wp-job-manager',
- 'support' => false,
- ),
- 'is_premium' => false,
- 'trial' => array(
- 'days' => 7,
- 'is_require_payment' => true,
- ),
- 'is_live' => true,
- ) );
- }
- return $gfjwjm_fs;
- }
-
- gfjwjm_fs();
- gfjwjm_fs()->add_action( 'after_uninstall', array('GoFetch_Jobs', 'uninstall') );
- gfjwjm_fs()->add_filter( 'handle_gdpr_admin_notice', '__return_true' );
- // End Freemius.
- register_activation_hook( __FILE__, array('GoFetch_Jobs', 'activate') );
- // Initialize the plugin after all plugins are loaded.
- add_action( 'plugins_loaded', 'GoFetch_Jobs', 998 );
- if ( !class_exists( 'GoFetch_Jobs' ) ) {
- /**
- * Core class.
- */
- final class GoFetch_Jobs {
- /**
- * The dynamic module for the plugin.
- */
- protected static $module = 'wpjm';
-
- /**
- * @var The plugin version.
- */
- public $version = '1.8.4.8.1';
-
- /**
- * @var The expected parent plugin/theme name.
- */
- public $parent_plugin = 'WP Job Manager';
-
- /**
- * @var The expected parent plugin/theme ID.
- */
- public $parent_plugin_id = 'JOB_MANAGER_VERSION';
-
- /**
- * @var The expected theme post type.
- */
- public $parent_post_type = 'job_listing';
-
- /**
- * @var The plugin slug.
- */
- public $slug = 'go-fetch-jobs-wp-job-manager';
-
- /**
- * @var The plugin post type.
- */
- public $post_type = 'goft_wpjm_schedule';
-
- /**
- * @var The log messages limit.
- */
- public $log_limit = 10;
-
- /**
- * @var The single instance of the class.
- */
- protected static $_instance = null;
-
- /**
- * Main 'Go Fetch Jobs' Instance.
- *
- * Ensures only one instance is loaded or can be loaded.
- *
- * @see GoFetch_Jobs()
- *
- * @return GoFetch_Jobs - Main instance
- */
- public static function instance() {
- if ( is_null( self::$_instance ) ) {
- self::$_instance = new self();
- }
- return self::$_instance;
- }
-
- /**
- * The Constructor.
- */
- public function __construct() {
- $this->define_constants();
- $this->includes();
- $this->include_modules();
- $this->init_hooks();
- do_action( 'gofetch_wpjm_loaded' );
- }
-
- /**
- * Include required core files used in admin and on the frontend.
- */
- public function includes() {
- $active_module = self::$module;
- // Framework Core.
- require_once 'includes/framework/load.php';
- // Parent plugin module.
- require_once "includes/modules/{$active_module}/class-{$active_module}-module.php";
- // Common dependencies.
- require_once 'includes/settings.php';
- require_once 'includes/dynamic/admin/class-gofetch-dynamic-importer.php';
- // Admin Setup.
- require_once 'includes/admin/class-gofetch-admin-setup.php';
- require_once 'includes/class-gofetch-html-table.php';
- require_once 'includes/class-gofetch-helper.php';
- require_once 'includes/class-gofetch-importer.php';
- // Other.
- if ( defined( 'CARIERA_VERSION' ) ) {
- require_once "includes/modules/{$active_module}/themes/cariera/class-gofetch-wpjm-cariera-importer.php";
- }
- require_once "includes/modules/{$active_module}/plugins/mas-wp-job-manager-company-integration.php";
- // RSS providers.
- require_once 'includes/class-gofetch-rss-providers.php';
- require_once 'includes/dynamic/admin/class-gofetch-dynamic-importer.php';
- require_once 'includes/admin/class-gofetch-admin.php';
- if ( class_exists( 'GoFetch_Admin_Settings' ) ) {
- require_once 'includes/dynamic/admin/class-gofetch-dynamic-settings.php';
- }
- if ( $this->is_request( 'frontend' ) ) {
- require_once 'includes/class-gofetch-frontend.php';
- }
- }
-
- /**
- * Include amy external modules
- */
- public function include_modules() {
- $module = self::$module;
- if ( $this->is_request( 'backend' ) ) {
- require_once "includes/modules/{$module}/admin/class-gofetch-{$module}-settings.php";
- require_once "includes/modules/{$module}/admin/class-gofetch-{$module}-importer.php";
- }
- require_once "includes/modules/{$module}/class-gofetch-{$module}.php";
- }
-
- /**
- * Define Constants.
- */
- private function define_constants() {
- $this->define( 'GOFT_WPJM_PLUGIN_FILE', __FILE__ );
- }
-
- /**
- * Hook into actions and filters.
- */
- private function init_hooks() {
- register_deactivation_hook( __FILE__, array($this, 'deactivate') );
- add_action( 'init', array($this, 'init'), 0 );
- add_action( 'init', array($this, 'maybe_get_list_of_providers') );
- }
-
- /**
- * Init plugin when WordPress Initializes.
- */
- public function init() {
- add_action( 'init', array($this, 'maybe_install') );
- add_action( 'init', array($this, 'maybe_install_sample_schedule') );
- // Before init action.
- do_action( 'before_gofetch_wpjm_init' );
- // Set up localization.
- $this->load_plugin_textdomain();
- // Init action.
- do_action( 'gofetch_wpjm_init' );
- }
-
- /**
- * Load Localization files.
- *
- * Note: the first-loaded translation file overrides any following ones if the same translation is present.
- *
- * Locales are found in:
- * - WP_LANG_DIR/plugins/gofetch-wpjm-LOCALE.mo
- */
- public function load_plugin_textdomain() {
- $locale = apply_filters( 'plugin_locale', get_locale(), 'gofetch-wpjm' );
- load_textdomain( 'gofetch-wpjm', WP_LANG_DIR . '/plugins/gofetch-wpjm-' . $locale . '.mo' );
- load_plugin_textdomain( 'gofetch-wpjm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
- }
-
- /**
- * Define constant if not already set.
- *
- * @param string $name
- * @param string|bool $value
- */
- private function define( $name, $value ) {
- if ( !defined( $name ) ) {
- define( $name, $value );
- }
- }
-
- /**
- * What type of request is this?
- *
- * string $type ajax, frontend or admin
- *
- * @return bool
- */
- private function is_request( $type ) {
- switch ( $type ) {
- case 'admin':
- return is_admin();
- case 'ajax':
- return defined( 'DOING_AJAX' );
- case 'cron':
- return defined( 'DOING_CRON' );
- case 'frontend':
- return (!is_admin() || defined( 'DOING_AJAX' )) && !defined( 'DOING_CRON' );
- case 'frontend_no_cron_ajax':
- return !is_admin() && !defined( 'DOING_AJAX' ) && !defined( 'DOING_CRON' );
- default:
- // backend
- return is_admin() || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' );
- }
- }
-
- /*
- * On deactivation, remove plugin related stuff.
- */
- public function deactivate() {
- wp_clear_scheduled_hook( 'gofetch_wpjm_importer' );
- }
-
- /*
- * On activate, set default stuff.
- */
- public static function activate() {
- add_option( 'goft-wpjm-activated', 1 );
- }
-
- /*
- * On uninstall, do stuff.
- */
- public static function uninstall() {
- }
-
- /**
- * Install any sample options.
- */
- public function maybe_install() {
- global $goft_wpjm_options;
- if ( !defined( $this->parent_plugin_id ) ) {
- add_option( 'goft-wpjm-error', 1 );
- return;
- } else {
- delete_option( 'goft-wpjm-error' );
- }
- if ( !is_admin() || get_option( 'goft-wpjm-samples-installed' ) || !get_option( 'goft-wpjm-activated' ) ) {
- return;
- }
- add_option( 'goft-wpjm-samples-installed', 1 );
- delete_option( 'goft-wpjm-activated' );
- // Skip sample install if there are already templates set.
- if ( !empty( $goft_wpjm_options->templates ) ) {
- return;
- }
- // Get the default values for the 'options' fields and save them on the DB.
- //$options_defaults = $goft_wpjm_options->get_defaults( 'options' );
- //$goft_wpjm_options->set( 'options', $options_defaults );
- // Pre configure a default template.
- // Provider.
- $feed_url = 'https://jobs.theguardian.com/jobsrss/?keywords=wordpress%20full-time&radialtown=&';
- // Taxonomy.
- $job_type = apply_filters(
- 'goft_wpjm_default_value_for_taxonomy',
- '',
- 'job_listing_type',
- 'full-time'
- );
- // Meta.
- $expires = GoFetch_Dynamic_Import::get_expire_date();
- $templates = $goft_wpjm_options->templates;
- $example = 'rss-example-theguardian-wordpress-fulltime-jobs';
- // @todo: adapt to the current module
- $templates[$example] = array(
- 'rss_feed_import' => $feed_url,
- 'tax_input' => array(
- 'job_listing_type' => $job_type,
- ),
- 'meta' => array(
- '_job_expires' => $expires,
- ),
- 'source' => array(
- 'name' => 'Guardian Jobs',
- 'website' => 'jobs.theguardian.com',
- 'logo' => GoFetch_Jobs()->plugin_url() . '/includes/images/logos/logo-theguardian.png',
- ),
- );
- //
- $goft_wpjm_options->templates = $templates;
- }
-
- /**
- * Install a sample schedule.
- */
- public function maybe_install_sample_schedule() {
- $module = self::$module;
- if ( !is_admin() || !post_type_exists( $this->post_type ) ) {
- return;
- }
- if ( !class_exists( 'GoFetch_Scheduler' ) || !get_option( "goft-{$module}-samples-installed" ) || get_option( "goft-{$module}-samples-schedule-installed" ) || !get_option( "goft-{$module}-activated" ) ) {
- return;
- }
- $example = 'rss-example-theguardian-wordpress-fulltime-jobs';
- GoFetch_Scheduler::create_schedule( 'Daily Import Example [WordPress Full-Time Jobs] (theguardian.com)', $example );
- }
-
- /**
- * Get the plugin URL.
- */
- public function plugin_url() {
- return untrailingslashit( plugins_url( '/', __FILE__ ) );
- }
-
- /**
- * Conditional check for a 'GOFJ' job page.
- */
- public function is_single_goft_job_page() {
- global $post;
- if ( !is_singular( GoFetch_Jobs()->parent_post_type ) ) {
- return false;
- }
- if ( !get_post_meta( $post->ID, '_goft_wpjm_is_external', true ) ) {
- return false;
- }
- return true;
- }
-
- /**
- * Fod debug purposes only.
- */
- public function maybe_get_list_of_providers() {
- if ( !empty( $_GET['GOFJ_PROVIDERS_LIST'] ) ) {
- var_dump( GoFetch_RSS_Providers::get_providers_list() );
- exit;
- }
- }
-
- }
-
- }
- /**
- * Returns the main instance of 'Go Fetch Jobs'.
- *
- * @return GoFetch_Jobs instance.
- */
- function GoFetch_Jobs() {
- return GoFetch_Jobs::instance();
- }
-
- }
-}
No newline at end of file
--- a/go-fetch-jobs-wp-job-manager/trunk/includes/admin/class-gofetch-admin-ajax.php
+++ b/go-fetch-jobs-wp-job-manager/trunk/includes/admin/class-gofetch-admin-ajax.php
@@ -1,247 +0,0 @@
-<?php
-/**
- * Contains AJAX admin related callbacks.
- *
- * @package GoFetchJobs/Admin/Ajax
- */
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly.
-}
-
-/**
- * Ajax class.
- */
-class GoFetch_Ajax {
-
- public function __construct() {
- add_action( 'wp_ajax_goft_wpjm_load_template_content', array( $this, 'load_template_content' ) );
- add_action( 'wp_ajax_goft_wpjm_update_templates_list', array( $this, 'update_templates_list' ) );
- add_action( 'wp_ajax_goft_wpjm_load_provider_info', array( $this, 'load_provider_info' ) );
- add_action( 'wp_ajax_goft_wpjm_import_feed', array( $this, 'import_feed' ) );
- add_action( 'wp_ajax_goft_wpjm_toggle_settings', array( $this, 'toggle_settings' ) );
- }
-
- /**
- * Dynamically outputs the pre-saved fields settings for a given template.
- */
- public function load_template_content() {
-
- if ( ! wp_verify_nonce( $_POST['_ajax_nonce'], 'goft_wpjm_nonce' ) ) {
- die(0);
- }
-
- // User selected 'none' on the template list dropdown.
- if ( empty( $_POST['template'] ) ) {
-
- die(0);
-
- } else {
-
- // User has selected a template.
-
- $template_name = sanitize_text_field( $_POST['template'] );
- $template_name = GoFetch_Helper::remove_slashes( $template_name );
-
- $templates = GoFetch_Helper::get_sanitized_templates();
-
- $template_settings = $templates[ $template_name ];
-
- $query_args = apply_filters( 'goft_wpjm_template_setup', $template_settings, $template_name );
- }
-
- echo wp_json_encode( $query_args );
- die( 1 );
- }
-
- /**
- * Dynamically update the templates list.
- */
- public function update_templates_list() {
- global $goft_wpjm_options;
-
- if ( ! wp_verify_nonce( $_POST['_ajax_nonce'], 'goft_wpjm_nonce' ) ) {
- die( 0 );
- }
-
- $templates = GoFetch_Helper::get_sanitized_templates();
-
- echo wp_json_encode( array(
- 'templates' => array_keys( $templates ),
- ) );
-
- die( 1 );
- }
-
- /**
- * Load a given providers info.
- */
- public function load_provider_info() {
-
- if ( ! wp_verify_nonce( $_POST['_ajax_nonce'], 'goft_wpjm_nonce' ) ) {
- die(0);
- }
-
- // User didn't select a provider.
- if ( empty( $_POST['provider'] ) ) {
-
- die( 0 );
-
- } else {
-
- // User has selected a provider.
-
- $provider = sanitize_text_field( $_POST['provider'] );
-
- $data = array(
- 'provider' => GoFetch_RSS_Providers::get_providers( $provider ),
- 'setup' => GoFetch_RSS_Providers::setup_instructions_for( $provider ),
- 'required_query_params' => GoFetch_RSS_Providers::required_query_params( $provider ),
- );
-
- }
-
- echo wp_json_encode( $data );
- die( 1 );
- }
-
- /**
- * Dynamically import an RSS feed.
- */
- public function import_feed() {
-
- if ( ! wp_verify_nonce( $_POST['_ajax_nonce'], 'goft_wpjm_nonce' ) ) {
- die( 0 );
- }
-
- $is_file_upload = (int) sanitize_text_field( $_POST['file_upload'] );
-
- if ( $is_file_upload ) {
-
- $url = sanitize_text_field( $_POST['url'] );
-
- $file = $_FILES['import_local_feed']['tmp_name'];
-
- if ( GoFetch_Helper::is_gziped( $url ) ) {
- if ( ! extension_loaded('zlib') ) {
- echo wp_json_encode( array(
- 'error' => __( 'You must have the PHP's 'zlib' extension installed, to load zipped files. ', 'gofetch-wpjm' ),
- ) );
- die( 0 );
- }
-
- GoFetch_Helper::temp_remove_memory_limits();
-
- $contents = file_get_contents( "compress.zlib://{$file}" );
- } else {
- $contents = file_get_contents( $file );
- }
-
- $feed = GoFetch_Importer::import_custom_content_type( $contents, $is_file_upload );
-
- if ( ! is_wp_error( $feed ) ) {
-
- // Set provider data.
- $provider_data = array(
- 'id' => 'custom',
- 'title' => $url,
- 'description' => $url,
- );
- $provider = GoFetch_RSS_Providers::get_base_provider( $provider_data );
-
- $result = GoFetch_Importer::fetch_feed_items( $feed, $_url = '', $provider, $_custom_content_type = true );
-
- if ( ! empty( $result['items'] ) ) {
- GoFetch_Importer::cache_feed_items( $result['items'] );
- }
-
- } else {
- $result = $feed;
- }
- } else {
-
- $url = sanitize_url( $_POST['url'] );
- $sanitized_post = array_map( 'sanitize_te