Changeset 2856663
- Timestamp:
- 01/29/2023 09:22:42 PM (3 years ago)
- Location:
- go-fetch-jobs-wp-job-manager
- Files:
-
- 2 added
- 18 edited
- 1 copied
-
tags/1.8.1.2 (copied) (copied from go-fetch-jobs-wp-job-manager/trunk)
-
tags/1.8.1.2/README.txt (modified) (2 diffs)
-
tags/1.8.1.2/changelog.txt (modified) (1 diff)
-
tags/1.8.1.2/gofetch-jobs-wpjm.php (modified) (2 diffs)
-
tags/1.8.1.2/includes/admin/class-gofetch-admin.php (modified) (8 diffs)
-
tags/1.8.1.2/includes/admin/intro/class-gofetch-api-providers-intro.php (modified) (1 diff)
-
tags/1.8.1.2/includes/class-gofetch-helper.php (modified) (3 diffs)
-
tags/1.8.1.2/includes/class-gofetch-importer.php (modified) (2 diffs)
-
tags/1.8.1.2/includes/images/logos/logo-adzuna.png (added)
-
tags/1.8.1.2/includes/modules/wpjm/class-gofetch-wpjm.php (modified) (3 diffs)
-
tags/1.8.1.2/includes/modules/wpjm/themes/cariera/class-gofetch-wpjm-cariera-importer.php (modified) (1 diff)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/gofetch-jobs-wpjm.php (modified) (2 diffs)
-
trunk/includes/admin/class-gofetch-admin.php (modified) (8 diffs)
-
trunk/includes/admin/intro/class-gofetch-api-providers-intro.php (modified) (1 diff)
-
trunk/includes/class-gofetch-helper.php (modified) (3 diffs)
-
trunk/includes/class-gofetch-importer.php (modified) (2 diffs)
-
trunk/includes/images/logos/logo-adzuna.png (added)
-
trunk/includes/modules/wpjm/class-gofetch-wpjm.php (modified) (3 diffs)
-
trunk/includes/modules/wpjm/themes/cariera/class-gofetch-wpjm-cariera-importer.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
go-fetch-jobs-wp-job-manager/tags/1.8.1.2/README.txt
r2835691 r2856663 6 6 Requires PHP: 5.2.4 7 7 Tested up to: 6.1 8 Stable tag: 1.8.1. 18 Stable tag: 1.8.1.2 9 9 10 10 Instantly populate your WP Job Manager database using RSS job feeds from the most popular job sites or load XML/JSON files (premium only). … … 93 93 94 94 == Changelog == 95 96 1.8.1.2 97 changes 98 - Better handling of complex XML files that use attributes in tags 99 - Updated AdZuna logo asset 100 - Auto disable free version of the plugin when installing paid version 101 102 fixes 103 - Job page not displaying properly when using 'WP Job Manager - Resume Manager' plugin 104 - Fatal error when using plugins that use the 'wp_kses_allowed_html' filter (i.e: Breadcrumbs NavXT) 105 - Extra comma causing fatal error on old PHP versions 106 - Guided tutorial showing during Freemius opt-in 95 107 96 108 1.8.1.1 -
go-fetch-jobs-wp-job-manager/tags/1.8.1.2/changelog.txt
r2835689 r2856663 1 1.8.1.2 2 changes 3 - Better handling of complex XML files that use attributes in tags 4 - Updated AdZuna logo asset 5 - Auto disable free version of the plugin when installing paid version 6 7 fixes 8 - Job page not displaying properly when using 'WP Job Manager - Resume Manager' plugin 9 - Fatal error when using plugins that use the 'wp_kses_allowed_html' filter (i.e: Breadcrumbs NavXT) 10 - Extra comma causing fatal error on old PHP versions 11 - Guided tutorial showing during Freemius opt-in 12 1 13 1.8.1.1 2 14 changes -
go-fetch-jobs-wp-job-manager/tags/1.8.1.2/gofetch-jobs-wpjm.php
r2835689 r2856663 3 3 /** 4 4 * Plugin Name: WP Job Manager - Go Fetch Jobs 5 * Version: 1.8.1. 15 * Version: 1.8.1.2 6 6 * Description: Instantly populate your WP Job Manager database using RSS job feeds from the most popular job sites. 7 7 * Author: Bruno Carreço … … 18 18 19 19 $GLOBALS['gofj_module_settings'] = array(); 20 // Begin Freemius.21 20 22 if ( !function_exists( 'gfjwjm_fs' ) ) { 23 /** 24 * Create a helper function for easy SDK access. 25 */ 26 function gfjwjm_fs() 27 { 28 global $gfjwjm_fs ; 29 30 if ( !isset( $gfjwjm_fs ) ) { 31 // Activate multisite network integration. 32 if ( !defined( 'WP_FS__PRODUCT_192_MULTISITE' ) ) { 33 define( 'WP_FS__PRODUCT_192_MULTISITE', true ); 21 if ( function_exists( 'gfjwjm_fs' ) ) { 22 gfjwjm_fs()->set_basename( false, __FILE__ ); 23 } else { 24 // Begin Freemius. 25 26 if ( !function_exists( 'gfjwjm_fs' ) ) { 27 /** 28 * Create a helper function for easy SDK access. 29 */ 30 function gfjwjm_fs() 31 { 32 global $gfjwjm_fs ; 33 34 if ( !isset( $gfjwjm_fs ) ) { 35 // Activate multisite network integration. 36 if ( !defined( 'WP_FS__PRODUCT_192_MULTISITE' ) ) { 37 define( 'WP_FS__PRODUCT_192_MULTISITE', true ); 38 } 39 // Include Freemius SDK. 40 require_once dirname( __FILE__ ) . '/includes/freemius/start.php'; 41 $gfjwjm_fs = fs_dynamic_init( array( 42 'id' => '192', 43 'slug' => 'gofetch-wpjm', 44 'public_key' => 'pk_d8c021486da49f69324049b5736a3', 45 'menu' => array( 46 'slug' => 'go-fetch-jobs-wp-job-manager', 47 'support' => false, 48 ), 49 'is_premium' => false, 50 'trial' => array( 51 'days' => 7, 52 'is_require_payment' => true, 53 ), 54 'is_live' => true, 55 ) ); 34 56 } 35 // Include Freemius SDK. 36 require_once dirname( __FILE__ ) . '/includes/freemius/start.php'; 37 $gfjwjm_fs = fs_dynamic_init( array( 38 'id' => '192', 39 'slug' => 'gofetch-wpjm', 40 'public_key' => 'pk_d8c021486da49f69324049b5736a3', 41 'menu' => array( 42 'slug' => 'go-fetch-jobs-wp-job-manager', 43 'support' => false, 44 ), 45 'is_premium' => false, 46 'trial' => array( 47 'days' => 7, 48 'is_require_payment' => true, 49 ), 50 'is_live' => true, 51 ) ); 57 58 return $gfjwjm_fs; 52 59 } 53 60 54 return $gfjwjm_fs; 55 } 56 57 gfjwjm_fs(); 58 gfjwjm_fs()->add_action( 'after_uninstall', array( 'GoFetch_Jobs', 'uninstall' ) ); 59 gfjwjm_fs()->add_filter( 'handle_gdpr_admin_notice', '__return_true' ); 60 // End Freemius. 61 register_activation_hook( __FILE__, array( 'GoFetch_Jobs', 'activate' ) ); 62 // Initialize the plugin after all plugins are loaded. 63 add_action( 'plugins_loaded', 'GoFetch_Jobs', 998 ); 64 if ( !class_exists( 'GoFetch_Jobs' ) ) { 65 /** 66 * Core class. 67 */ 68 final class GoFetch_Jobs 69 { 61 gfjwjm_fs(); 62 gfjwjm_fs()->add_action( 'after_uninstall', array( 'GoFetch_Jobs', 'uninstall' ) ); 63 gfjwjm_fs()->add_filter( 'handle_gdpr_admin_notice', '__return_true' ); 64 // End Freemius. 65 register_activation_hook( __FILE__, array( 'GoFetch_Jobs', 'activate' ) ); 66 // Initialize the plugin after all plugins are loaded. 67 add_action( 'plugins_loaded', 'GoFetch_Jobs', 998 ); 68 if ( !class_exists( 'GoFetch_Jobs' ) ) { 70 69 /** 71 * The dynamic module for the plugin.70 * Core class. 72 71 */ 73 protected static $module = 'wpjm' ; 74 /** 75 * @var The plugin version. 76 */ 77 public $version = '1.8.1.1' ; 78 /** 79 * @var The expected parent plugin/theme name. 80 */ 81 public $parent_plugin = 'WP Job Manager' ; 82 /** 83 * @var The expected parent plugin/theme ID. 84 */ 85 public $parent_plugin_id = 'JOB_MANAGER_VERSION' ; 86 /** 87 * @var The expected theme post type. 88 */ 89 public $parent_post_type = 'job_listing' ; 90 /** 91 * @var The plugin slug. 92 */ 93 public $slug = 'go-fetch-jobs-wp-job-manager' ; 94 /** 95 * @var The plugin post type. 96 */ 97 public $post_type = 'goft_wpjm_schedule' ; 98 /** 99 * @var The log messages limit. 100 */ 101 public $log_limit = 10 ; 102 /** 103 * @var The single instance of the class. 104 */ 105 protected static $_instance = null ; 106 /** 107 * Main 'Go Fetch Jobs' Instance. 108 * 109 * Ensures only one instance is loaded or can be loaded. 110 * 111 * @see GoFetch_Jobs() 112 * 113 * @return GoFetch_Jobs - Main instance 114 */ 115 public static function instance() 72 final class GoFetch_Jobs 116 73 { 117 if ( is_null( self::$_instance ) ) { 118 self::$_instance = new self(); 119 } 120 return self::$_instance; 121 } 122 123 /** 124 * The Constructor. 125 */ 126 public function __construct() 127 { 128 $this->define_constants(); 129 $this->includes(); 130 $this->include_modules(); 131 $this->init_hooks(); 132 do_action( 'gofetch_wpjm_loaded' ); 133 } 134 135 /** 136 * Include required core files used in admin and on the frontend. 137 */ 138 public function includes() 139 { 140 $active_module = self::$module; 141 // Framework Core. 142 require_once 'includes/framework/load.php'; 143 // Parent plugin module. 144 require_once "includes/modules/{$active_module}/class-{$active_module}-module.php"; 145 // Common dependencies. 146 require_once 'includes/settings.php'; 147 // Admin Setup. 148 require_once 'includes/admin/class-gofetch-admin-setup.php'; 149 require_once 'includes/class-gofetch-html-table.php'; 150 require_once 'includes/class-gofetch-helper.php'; 151 require_once 'includes/class-gofetch-importer.php'; 152 // Other. 153 require_once "includes/modules/{$active_module}/themes/cariera/class-gofetch-wpjm-cariera-importer.php"; 154 require_once "includes/modules/{$active_module}/plugins/mas-wp-job-manager-company-integration.php"; 155 // RSS providers. 156 require_once 'includes/class-gofetch-rss-providers.php'; 157 // External. 158 if ( !class_exists( 'OpenGraph' ) ) { 159 require_once 'includes/external/OpenGraph.php'; 160 } 161 if ( $this->is_request( 'backend' ) || $this->is_request( 'ajax' ) ) { 162 require_once 'includes/dynamic/admin/class-gofetch-dynamic-importer.php'; 163 } 164 165 if ( $this->is_request( 'backend' ) ) { 166 require_once 'includes/admin/class-gofetch-admin.php'; 167 if ( class_exists( 'GoFetch_Admin_Settings' ) ) { 168 require_once 'includes/dynamic/admin/class-gofetch-dynamic-settings.php'; 169 } 170 } else { 171 if ( $this->is_request( 'frontend' ) ) { 172 require_once 'includes/class-gofetch-frontend.php'; 173 } 74 /** 75 * The dynamic module for the plugin. 76 */ 77 protected static $module = 'wpjm' ; 78 /** 79 * @var The plugin version. 80 */ 81 public $version = '1.8.1.2' ; 82 /** 83 * @var The expected parent plugin/theme name. 84 */ 85 public $parent_plugin = 'WP Job Manager' ; 86 /** 87 * @var The expected parent plugin/theme ID. 88 */ 89 public $parent_plugin_id = 'JOB_MANAGER_VERSION' ; 90 /** 91 * @var The expected theme post type. 92 */ 93 public $parent_post_type = 'job_listing' ; 94 /** 95 * @var The plugin slug. 96 */ 97 public $slug = 'go-fetch-jobs-wp-job-manager' ; 98 /** 99 * @var The plugin post type. 100 */ 101 public $post_type = 'goft_wpjm_schedule' ; 102 /** 103 * @var The log messages limit. 104 */ 105 public $log_limit = 10 ; 106 /** 107 * @var The single instance of the class. 108 */ 109 protected static $_instance = null ; 110 /** 111 * Main 'Go Fetch Jobs' Instance. 112 * 113 * Ensures only one instance is loaded or can be loaded. 114 * 115 * @see GoFetch_Jobs() 116 * 117 * @return GoFetch_Jobs - Main instance 118 */ 119 public static function instance() 120 { 121 if ( is_null( self::$_instance ) ) { 122 self::$_instance = new self(); 123 } 124 return self::$_instance; 125 } 126 127 /** 128 * The Constructor. 129 */ 130 public function __construct() 131 { 132 $this->define_constants(); 133 $this->includes(); 134 $this->include_modules(); 135 $this->init_hooks(); 136 do_action( 'gofetch_wpjm_loaded' ); 137 } 138 139 /** 140 * Include required core files used in admin and on the frontend. 141 */ 142 public function includes() 143 { 144 $active_module = self::$module; 145 // Framework Core. 146 require_once 'includes/framework/load.php'; 147 // Parent plugin module. 148 require_once "includes/modules/{$active_module}/class-{$active_module}-module.php"; 149 // Common dependencies. 150 require_once 'includes/settings.php'; 151 // Admin Setup. 152 require_once 'includes/admin/class-gofetch-admin-setup.php'; 153 require_once 'includes/class-gofetch-html-table.php'; 154 require_once 'includes/class-gofetch-helper.php'; 155 require_once 'includes/class-gofetch-importer.php'; 156 // Other. 157 require_once "includes/modules/{$active_module}/themes/cariera/class-gofetch-wpjm-cariera-importer.php"; 158 require_once "includes/modules/{$active_module}/plugins/mas-wp-job-manager-company-integration.php"; 159 // RSS providers. 160 require_once 'includes/class-gofetch-rss-providers.php'; 161 // External. 162 if ( !class_exists( 'OpenGraph' ) ) { 163 require_once 'includes/external/OpenGraph.php'; 164 } 165 if ( $this->is_request( 'backend' ) || $this->is_request( 'ajax' ) ) { 166 require_once 'includes/dynamic/admin/class-gofetch-dynamic-importer.php'; 167 } 168 169 if ( $this->is_request( 'backend' ) ) { 170 require_once 'includes/admin/class-gofetch-admin.php'; 171 if ( class_exists( 'GoFetch_Admin_Settings' ) ) { 172 require_once 'includes/dynamic/admin/class-gofetch-dynamic-settings.php'; 173 } 174 } else { 175 if ( $this->is_request( 'frontend' ) ) { 176 require_once 'includes/class-gofetch-frontend.php'; 177 } 178 } 179 180 } 181 182 /** 183 * Include amy external modules 184 */ 185 public function include_modules() 186 { 187 $module = self::$module; 188 189 if ( $this->is_request( 'backend' ) ) { 190 require_once "includes/modules/{$module}/admin/class-gofetch-{$module}-settings.php"; 191 require_once "includes/modules/{$module}/admin/class-gofetch-{$module}-importer.php"; 192 } 193 194 require_once "includes/modules/{$module}/class-gofetch-{$module}.php"; 195 } 196 197 /** 198 * Define Constants. 199 */ 200 private function define_constants() 201 { 202 $this->define( 'GOFT_WPJM_PLUGIN_FILE', __FILE__ ); 203 } 204 205 /** 206 * Hook into actions and filters. 207 */ 208 private function init_hooks() 209 { 210 register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); 211 add_action( 'init', array( $this, 'init' ), 0 ); 212 add_action( 'init', array( $this, 'maybe_get_list_of_providers' ) ); 213 } 214 215 /** 216 * Init plugin when WordPress Initializes. 217 */ 218 public function init() 219 { 220 add_action( 'init', array( $this, 'maybe_install' ) ); 221 add_action( 'init', array( $this, 'maybe_install_sample_schedule' ) ); 222 // Before init action. 223 do_action( 'before_gofetch_wpjm_init' ); 224 // Set up localization. 225 $this->load_plugin_textdomain(); 226 // Init action. 227 do_action( 'gofetch_wpjm_init' ); 228 } 229 230 /** 231 * Load Localization files. 232 * 233 * Note: the first-loaded translation file overrides any following ones if the same translation is present. 234 * 235 * Locales are found in: 236 * - WP_LANG_DIR/plugins/gofetch-wpjm-LOCALE.mo 237 */ 238 public function load_plugin_textdomain() 239 { 240 $locale = apply_filters( 'plugin_locale', get_locale(), 'gofetch-wpjm' ); 241 load_textdomain( 'gofetch-wpjm', WP_LANG_DIR . '/plugins/gofetch-wpjm-' . $locale . '.mo' ); 242 load_plugin_textdomain( 'gofetch-wpjm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 243 } 244 245 /** 246 * Define constant if not already set. 247 * 248 * @param string $name 249 * @param string|bool $value 250 */ 251 private function define( $name, $value ) 252 { 253 if ( !defined( $name ) ) { 254 define( $name, $value ); 255 } 256 } 257 258 /** 259 * What type of request is this? 260 * 261 * string $type ajax, frontend or admin 262 * 263 * @return bool 264 */ 265 private function is_request( $type ) 266 { 267 switch ( $type ) { 268 case 'admin': 269 return is_admin(); 270 case 'ajax': 271 return defined( 'DOING_AJAX' ); 272 case 'cron': 273 return defined( 'DOING_CRON' ); 274 case 'frontend': 275 return (!is_admin() || defined( 'DOING_AJAX' )) && !defined( 'DOING_CRON' ); 276 default: 277 return is_admin() || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ); 278 } 279 } 280 281 /* 282 * On deactivation, remove plugin related stuff. 283 */ 284 public function deactivate() 285 { 286 wp_clear_scheduled_hook( 'gofetch_wpjm_importer' ); 287 } 288 289 /* 290 * On activate, set default stuff. 291 */ 292 public static function activate() 293 { 294 add_option( 'goft-wpjm-activated', 1 ); 295 } 296 297 /* 298 * On uninstall, do stuff. 299 */ 300 public static function uninstall() 301 { 302 } 303 304 /** 305 * Install any sample options. 306 */ 307 public function maybe_install() 308 { 309 global $goft_wpjm_options ; 310 311 if ( !defined( $this->parent_plugin_id ) ) { 312 add_option( 'goft-wpjm-error', 1 ); 313 return; 314 } else { 315 delete_option( 'goft-wpjm-error' ); 316 } 317 318 if ( !is_admin() || get_option( 'goft-wpjm-samples-installed' ) || !get_option( 'goft-wpjm-activated' ) ) { 319 return; 320 } 321 add_option( 'goft-wpjm-samples-installed', 1 ); 322 delete_option( 'goft-wpjm-activated' ); 323 // Skip sample install if there are already templates set. 324 if ( !empty($goft_wpjm_options->templates) ) { 325 return; 326 } 327 // Get the default values for the 'options' fields and save them on the DB. 328 //$options_defaults = $goft_wpjm_options->get_defaults( 'options' ); 329 //$goft_wpjm_options->set( 'options', $options_defaults ); 330 // Pre configure a default template. 331 // Provider. 332 $feed_url = 'https://jobs.theguardian.com/jobsrss/?keywords=wordpress%20full-time&radialtown=&'; 333 // Taxonomy. 334 $job_type = apply_filters( 335 'goft_wpjm_default_value_for_taxonomy', 336 '', 337 'job_listing_type', 338 'full-time' 339 ); 340 // Meta. 341 $expires = GoFetch_Dynamic_Import::get_expire_date(); 342 $templates = $goft_wpjm_options->templates; 343 $example = 'rss-example-theguardian-wordpress-fulltime-jobs'; 344 // @todo: adapt to the current module 345 $templates[$example] = array( 346 'rss_feed_import' => $feed_url, 347 'tax_input' => array( 348 'job_listing_type' => $job_type, 349 ), 350 'meta' => array( 351 '_job_expires' => $expires, 352 ), 353 'source' => array( 354 'name' => 'Guardian Jobs', 355 'website' => 'jobs.theguardian.com', 356 'logo' => GoFetch_Jobs()->plugin_url() . '/includes/images/logos/logo-theguardian.png', 357 ), 358 ); 359 // 360 $goft_wpjm_options->templates = $templates; 361 } 362 363 /** 364 * Install a sample schedule. 365 */ 366 public function maybe_install_sample_schedule() 367 { 368 $module = self::$module; 369 if ( !is_admin() || !post_type_exists( $this->post_type ) ) { 370 return; 371 } 372 if ( !class_exists( 'GoFetch_Scheduler' ) || !get_option( "goft-{$module}-samples-installed" ) || get_option( "goft-{$module}-samples-schedule-installed" ) || !get_option( "goft-{$module}-activated" ) ) { 373 return; 374 } 375 $example = 'rss-example-theguardian-wordpress-fulltime-jobs'; 376 GoFetch_Scheduler::create_schedule( 'Daily Import Example [WordPress Full-Time Jobs] (theguardian.com)', $example ); 377 } 378 379 /** 380 * Get the plugin URL. 381 */ 382 public function plugin_url() 383 { 384 return untrailingslashit( plugins_url( '/', __FILE__ ) ); 385 } 386 387 /** 388 * Conditional check for a 'GOFJ' job page. 389 */ 390 public function is_single_goft_job_page() 391 { 392 global $post ; 393 if ( !is_singular( GoFetch_Jobs()->parent_post_type ) ) { 394 return false; 395 } 396 if ( !get_post_meta( $post->ID, '_goft_wpjm_is_external', true ) ) { 397 return false; 398 } 399 return true; 400 } 401 402 /** 403 * Fod debug purposes only. 404 */ 405 public function maybe_get_list_of_providers() 406 { 407 408 if ( !empty($_GET['GOFJ_PROVIDERS_LIST']) ) { 409 var_dump( GoFetch_RSS_Providers::get_providers_list() ); 410 exit; 411 } 412 174 413 } 175 414 176 415 } 177 178 /**179 * Include amy external modules180 */181 public function include_modules()182 {183 $module = self::$module;184 185 if ( $this->is_request( 'backend' ) ) {186 require_once "includes/modules/{$module}/admin/class-gofetch-{$module}-settings.php";187 require_once "includes/modules/{$module}/admin/class-gofetch-{$module}-importer.php";188 }189 190 require_once "includes/modules/{$module}/class-gofetch-{$module}.php";191 }192 193 /**194 * Define Constants.195 */196 private function define_constants()197 {198 $this->define( 'GOFT_WPJM_PLUGIN_FILE', __FILE__ );199 }200 201 /**202 * Hook into actions and filters.203 */204 private function init_hooks()205 {206 register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );207 add_action( 'init', array( $this, 'init' ), 0 );208 add_action( 'init', array( $this, 'maybe_get_list_of_providers' ) );209 }210 211 /**212 * Init plugin when WordPress Initializes.213 */214 public function init()215 {216 add_action( 'init', array( $this, 'maybe_install' ) );217 add_action( 'init', array( $this, 'maybe_install_sample_schedule' ) );218 // Before init action.219 do_action( 'before_gofetch_wpjm_init' );220 // Set up localization.221 $this->load_plugin_textdomain();222 // Init action.223 do_action( 'gofetch_wpjm_init' );224 }225 226 /**227 * Load Localization files.228 *229 * Note: the first-loaded translation file overrides any following ones if the same translation is present.230 *231 * Locales are found in:232 * - WP_LANG_DIR/plugins/gofetch-wpjm-LOCALE.mo233 */234 public function load_plugin_textdomain()235 {236 $locale = apply_filters( 'plugin_locale', get_locale(), 'gofetch-wpjm' );237 load_textdomain( 'gofetch-wpjm', WP_LANG_DIR . '/plugins/gofetch-wpjm-' . $locale . '.mo' );238 load_plugin_textdomain( 'gofetch-wpjm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );239 }240 241 /**242 * Define constant if not already set.243 *244 * @param string $name245 * @param string|bool $value246 */247 private function define( $name, $value )248 {249 if ( !defined( $name ) ) {250 define( $name, $value );251 }252 }253 254 /**255 * What type of request is this?256 *257 * string $type ajax, frontend or admin258 *259 * @return bool260 */261 private function is_request( $type )262 {263 switch ( $type ) {264 case 'admin':265 return is_admin();266 case 'ajax':267 return defined( 'DOING_AJAX' );268 case 'cron':269 return defined( 'DOING_CRON' );270 case 'frontend':271 return (!is_admin() || defined( 'DOING_AJAX' )) && !defined( 'DOING_CRON' );272 default:273 return is_admin() || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' );274 }275 }276 277 /*278 * On deactivation, remove plugin related stuff.279 */280 public function deactivate()281 {282 wp_clear_scheduled_hook( 'gofetch_wpjm_importer' );283 }284 285 /*286 * On activate, set default stuff.287 */288 public static function activate()289 {290 add_option( 'goft-wpjm-activated', 1 );291 }292 293 /*294 * On uninstall, do stuff.295 */296 public static function uninstall()297 {298 }299 300 /**301 * Install any sample options.302 */303 public function maybe_install()304 {305 global $goft_wpjm_options ;306 307 if ( !defined( $this->parent_plugin_id ) ) {308 add_option( 'goft-wpjm-error', 1 );309 return;310 } else {311 delete_option( 'goft-wpjm-error' );312 }313 314 if ( !is_admin() || get_option( 'goft-wpjm-samples-installed' ) || !get_option( 'goft-wpjm-activated' ) ) {315 return;316 }317 add_option( 'goft-wpjm-samples-installed', 1 );318 delete_option( 'goft-wpjm-activated' );319 // Skip sample install if there are already templates set.320 if ( !empty($goft_wpjm_options->templates) ) {321 return;322 }323 // Get the default values for the 'options' fields and save them on the DB.324 //$options_defaults = $goft_wpjm_options->get_defaults( 'options' );325 //$goft_wpjm_options->set( 'options', $options_defaults );326 // Pre configure a default template.327 // Provider.328 $feed_url = 'https://jobs.theguardian.com/jobsrss/?keywords=wordpress%20full-time&radialtown=&';329 // Taxonomy.330 $job_type = apply_filters(331 'goft_wpjm_default_value_for_taxonomy',332 '',333 'job_listing_type',334 'full-time'335 );336 // Meta.337 $expires = GoFetch_Dynamic_Import::get_expire_date();338 $templates = $goft_wpjm_options->templates;339 $example = 'rss-example-theguardian-wordpress-fulltime-jobs';340 // @todo: adapt to the current module341 $templates[$example] = array(342 'rss_feed_import' => $feed_url,343 'tax_input' => array(344 'job_listing_type' => $job_type,345 ),346 'meta' => array(347 '_job_expires' => $expires,348 ),349 'source' => array(350 'name' => 'Guardian Jobs',351 'website' => 'jobs.theguardian.com',352 'logo' => GoFetch_Jobs()->plugin_url() . '/includes/images/logos/logo-theguardian.png',353 ),354 );355 //356 $goft_wpjm_options->templates = $templates;357 }358 359 /**360 * Install a sample schedule.361 */362 public function maybe_install_sample_schedule()363 {364 $module = self::$module;365 if ( !is_admin() || !post_type_exists( $this->post_type ) ) {366 return;367 }368 if ( !class_exists( 'GoFetch_Scheduler' ) || !get_option( "goft-{$module}-samples-installed" ) || get_option( "goft-{$module}-samples-schedule-installed" ) || !get_option( "goft-{$module}-activated" ) ) {369 return;370 }371 $example = 'rss-example-theguardian-wordpress-fulltime-jobs';372 GoFetch_Scheduler::create_schedule( 'Daily Import Example [WordPress Full-Time Jobs] (theguardian.com)', $example );373 }374 375 /**376 * Get the plugin URL.377 */378 public function plugin_url()379 {380 return untrailingslashit( plugins_url( '/', __FILE__ ) );381 }382 383 /**384 * Conditional check for a 'GOFJ' job page.385 */386 public function is_single_goft_job_page()387 {388 global $post ;389 if ( !is_singular( GoFetch_Jobs()->parent_post_type ) ) {390 return false;391 }392 if ( !get_post_meta( $post->ID, '_goft_wpjm_is_external', true ) ) {393 return false;394 }395 return true;396 }397 398 /**399 * Fod debug purposes only.400 */401 public function maybe_get_list_of_providers()402 {403 404 if ( !empty($_GET['GOFJ_PROVIDERS_LIST']) ) {405 var_dump( GoFetch_RSS_Providers::get_providers_list() );406 exit;407 }408 409 }410 411 416 } 412 } 413 /** 414 * Returns the main instance of 'Go Fetch Jobs'. 415 * 416 * @return GoFetch_Jobs instance. 417 */ 418 function GoFetch_Jobs() 419 { 420 return GoFetch_Jobs::instance(); 417 /** 418 * Returns the main instance of 'Go Fetch Jobs'. 419 * 420 * @return GoFetch_Jobs instance. 421 */ 422 function GoFetch_Jobs() 423 { 424 return GoFetch_Jobs::instance(); 425 } 426 421 427 } 422 428 -
go-fetch-jobs-wp-job-manager/tags/1.8.1.2/includes/admin/class-gofetch-admin.php
r2835689 r2856663 6 6 */ 7 7 8 use Stripe\Source; 9 8 10 if ( ! defined( 'ABSPATH' ) ) { 9 11 exit; // Exit if accessed directly … … 23 25 24 26 /** 27 * The guided tutorial instance 28 */ 29 protected $guided_tutorial = null; 30 31 /** 25 32 * Constructor. 26 33 */ 27 34 public function __construct() { 28 35 global $menu; 29 36 if ( get_option( 'goft-wpjm-error' ) ) { 30 37 add_action( 'admin_notices', array( $this, 'warnings' ) ); … … 35 42 36 43 if ( class_exists( 'GoFetch_Guided_Tutorial' ) ) { 37 new GoFetch_Guided_Tutorial(); 38 } 39 44 $this->guided_tutorial = new GoFetch_Guided_Tutorial(); 45 } 46 47 add_action( 'admin_init', array( $this, 'maybe_init_guided_tutorial' ), 25 ); 40 48 add_action( 'restrict_manage_posts', array( $this, 'jobs_filter_restrict_manage_posts' ) ); 41 49 add_action( 'restrict_manage_posts', array( $this, 'jobs_filter_restrict_providers' ) ); … … 69 77 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 21 ); 70 78 add_action( 'admin_head', array( $this, 'admin_icon' ) ); 79 } 80 81 public function maybe_init_guided_tutorial() { 82 global $submenu; 83 84 // Don't init the tutorial if the plugin items are not initialized yet (i.e: avoids tutorial showing on Freemius opt-in init page). 85 if ( empty( $submenu['go-fetch-jobs-wp-job-manager'] ) ) { 86 remove_action( 'admin_enqueue_scripts', array( $this->guided_tutorial, 'start_tour' ), 25 ); 87 } 88 71 89 } 72 90 … … 428 446 429 447 foreach ( $columns as $key => $label ) { 430 // Display custom columns regithbefore the last column.448 // Display custom columns before the last column. 431 449 if ( $total_cols - $cols === 1 ) { 432 450 $new_columns['job_provider'] = __( 'Provider', 'gofetch-wpjm' ); … … 455 473 case 'job_provider': 456 474 if ( ! empty( $source['website'] ) ) { 457 $url = GoFetch_RSS_Providers::simple_url( $source['website'] ); 458 echo '<span class="goft-job-provider">' . esc_url( $url ) . '</span>'; 475 if ( strtolower( $source['website'] ) !== 'unknown' ) { 476 $value = GoFetch_RSS_Providers::simple_url( $source['website'] ); 477 } else { 478 $import_params = get_post_meta( $post->ID, '_goft_wpjm_import_params', true ); 479 $value = sprintf( '%s / %s', $source['website'], $import_params['content_type'] ); 480 } 481 echo sprintf( '<span class="goft-job-provider">%s</span>', esc_attr( $value ) ); 459 482 } else { 460 483 echo '-'; … … 561 584 562 585 /** 563 * Add support ortfo additional HTML tags and attributes.586 * Add support fo additional HTML tags and attributes. 564 587 */ 565 588 public function allowed_html( $allowed_tags, $context ) { … … 567 590 if ( $context !== 'post' && ! $this->is_plugin_page() ) { 568 591 return $allowed_tags; 569 }570 571 $self_closing_tags = array( 'area', 'base', 'basefont', 'br', 'hr', 'img', 'link', 'meta' );572 573 foreach ( $self_closing_tags as $tag ) {574 if ( empty( $allowed_tags[ $tag ] ) ) {575 $allowed_tags[ $tag ] = true;576 }577 592 } 578 593 -
go-fetch-jobs-wp-job-manager/tags/1.8.1.2/includes/admin/intro/class-gofetch-api-providers-intro.php
r2716182 r2856663 81 81 'Careerjet' => 'http://www.careerjet.com', 82 82 'CV-Library' => 'https://www.cv-library.co.uk', 83 'Indeed' => 'https://www.indeed.com',84 83 'Talroo' => 'https://www.talroo.com', 85 84 'Jooble' => 'https://jooble.org', -
go-fetch-jobs-wp-job-manager/tags/1.8.1.2/includes/class-gofetch-helper.php
r2835689 r2856663 351 351 if ( 1 == count( $child_c_keys ) && $child_c_values > 1 ) { 352 352 if ( is_array( $child_c_values[0] ) ) { 353 $flattened = self::array_flatten( $child_c_values[0] ); 354 355 if ( ! is_numeric( $c_key ) ) { 356 $new_item[ $c_key ] = implode( '|', $flattened ); 353 354 $priority_props = array( 'value' => '', 'label' => '', 'url' => '' ); 355 356 if ( isset( $child_c_values[0]['@attributes'] ) ) { 357 $atts = $child_c_values[0]['@attributes']; 358 } else { 359 $atts = $child_c_values[0]; 357 360 } 361 362 $key_props_value = array_intersect_key( $atts, $priority_props ); 363 364 if ( ! empty( $key_props_value ) ) { 365 $new_item[ $c_key ] = reset( $key_props_value ); 366 } else { 367 $flattened = self::array_flatten( $child_c_values[0], $c_key ); 368 369 if ( isset( $flattened[ $c_key] ) ) { 370 $flattened = $flattened[ $c_key ]; 371 } 372 373 if ( ! is_numeric( $c_key ) ) { 374 $new_item[ $c_key ] = implode( '|', $flattened ); 375 } 376 377 } 378 358 379 } else { 359 380 if ( is_numeric( $c_key ) ) { … … 363 384 } 364 385 } else { 365 366 386 foreach ( $child_c_keys as $cc_values_index => $cc_values_k ) { 367 387 … … 403 423 } 404 424 405 public static function array_flatten( $array ) { 425 public static function maybe_use_xml_prop( $value, $props ) { 426 $priority_props = array( 'value' => '', 'label' => '' ); 427 428 if ( ! $value ) { 429 $prop = array_intersect_key( $props, $priority_props ); 430 if ( ! empty( $prop ) ) { 431 $value = reset( $prop ); 432 } 433 } 434 return $value; 435 } 436 437 public static function array_flatten( $array, $parent_key = '' ) { 406 438 $return = array(); 407 439 408 foreach ($array as $key => $value) { 409 if ( '@attributes' === $key ) { 410 unset( $return[ $key ] ); 411 } elseif ( is_array( $value ) ) { 412 $return = array_merge($return, self::array_flatten( $value ) ); 413 } else { 414 $return[$key] = $value; 440 $priority_props = array( 'value' => '', 'label' => '', 'url' => '' ); 441 442 foreach ( $array as $values ) { 443 444 foreach ( $values as $key => $value) { 445 446 if ( '@attributes' === $key ) { 447 $prop = array_intersect_key( $value, $priority_props ); 448 if ( $parent_key && ! empty( $prop ) ) { 449 $prop_value = reset( $prop ); 450 451 if ( ! isset( $return[ $parent_key ] ) ) { 452 $return[ $parent_key ] = array(); 453 } 454 $return[ $parent_key ][] = $prop_value; 455 } else { 456 unset( $return[ $key ] ); 457 } 458 } elseif ( is_array( $value ) ) { 459 $return = array_merge($return, self::array_flatten( $value, $parent_key ) ); 460 } else { 461 $return[$key] = $value; 462 } 415 463 } 416 464 } -
go-fetch-jobs-wp-job-manager/tags/1.8.1.2/includes/class-gofetch-importer.php
r2835689 r2856663 495 495 $xml = simplexml_load_string( $response, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOERROR ); 496 496 if ( !$xml ) { 497 //return apply_filters( 'goft_wpjm_xml_content_not_readable_error', new WP_Error( -1003, __( 'XML Content is not readable.', 'gofetch-wpjm' ) ), $valid_provider, $url_or_data );498 497 return apply_filters( 499 498 'goft_wpjm_xml_content_not_readable_error', … … 510 509 // If we don't have a simple array parse it using a different strategy. 511 510 512 if ( !count( $feed['items'] ) || 1 === count( $feed['items'] ) ) {511 if ( $xml && empty($feed['items'][0]['title']) || !count( $feed['items'] ) || 1 === count( $feed['items'] ) ) { 513 512 $json = json_encode( $xml ); 514 513 $items = json_decode( $json, true ); -
go-fetch-jobs-wp-job-manager/tags/1.8.1.2/includes/modules/wpjm/class-gofetch-wpjm.php
r2835689 r2856663 18 18 public function __construct() { 19 19 20 20 21 add_filter( 'the_job_location', array( $this, 'maybe_override_location' ), 20, 2 ); 21 22 … … 35 36 */ 36 37 public function single_job_page_hooks( $post ) { 38 add_action( 'wp', array( $this, 'override_application_details_url' ), 25 ); 39 37 40 remove_filter( 'the_content', array( 'GoFetch_Frontend', 'goft_the_job_description' ), 50 ); 38 41 add_filter( 'the_job_description', array( 'GoFetch_Frontend', 'goft_the_job_description' ), 50 ); … … 170 173 */ 171 174 public function override_application_details_url( $override ) { 175 // Removes any actions added by other plugins that do not apply to imported jobs. 176 remove_all_actions( 'job_manager_application_details_url' ); 177 172 178 add_action( 'job_manager_application_details_url', array( 'GoFetch_Frontend', 'application_details_url' ), 15 ); 173 179 -
go-fetch-jobs-wp-job-manager/tags/1.8.1.2/includes/modules/wpjm/themes/cariera/class-gofetch-wpjm-cariera-importer.php
r2715089 r2856663 106 106 $value = $meta[ $wpjm_apply_field ]; 107 107 108 if ( is_array( $value ) ) { 109 reset( $value ); 110 } 111 108 112 if ( ! GoFetch_Helper::is_email_address( $value ) ) { 109 113 update_post_meta( $post_id, $alt_application_field, $value ); -
go-fetch-jobs-wp-job-manager/trunk/README.txt
r2835691 r2856663 6 6 Requires PHP: 5.2.4 7 7 Tested up to: 6.1 8 Stable tag: 1.8.1. 18 Stable tag: 1.8.1.2 9 9 10 10 Instantly populate your WP Job Manager database using RSS job feeds from the most popular job sites or load XML/JSON files (premium only). … … 93 93 94 94 == Changelog == 95 96 1.8.1.2 97 changes 98 - Better handling of complex XML files that use attributes in tags 99 - Updated AdZuna logo asset 100 - Auto disable free version of the plugin when installing paid version 101 102 fixes 103 - Job page not displaying properly when using 'WP Job Manager - Resume Manager' plugin 104 - Fatal error when using plugins that use the 'wp_kses_allowed_html' filter (i.e: Breadcrumbs NavXT) 105 - Extra comma causing fatal error on old PHP versions 106 - Guided tutorial showing during Freemius opt-in 95 107 96 108 1.8.1.1 -
go-fetch-jobs-wp-job-manager/trunk/changelog.txt
r2835689 r2856663 1 1.8.1.2 2 changes 3 - Better handling of complex XML files that use attributes in tags 4 - Updated AdZuna logo asset 5 - Auto disable free version of the plugin when installing paid version 6 7 fixes 8 - Job page not displaying properly when using 'WP Job Manager - Resume Manager' plugin 9 - Fatal error when using plugins that use the 'wp_kses_allowed_html' filter (i.e: Breadcrumbs NavXT) 10 - Extra comma causing fatal error on old PHP versions 11 - Guided tutorial showing during Freemius opt-in 12 1 13 1.8.1.1 2 14 changes -
go-fetch-jobs-wp-job-manager/trunk/gofetch-jobs-wpjm.php
r2835689 r2856663 3 3 /** 4 4 * Plugin Name: WP Job Manager - Go Fetch Jobs 5 * Version: 1.8.1. 15 * Version: 1.8.1.2 6 6 * Description: Instantly populate your WP Job Manager database using RSS job feeds from the most popular job sites. 7 7 * Author: Bruno Carreço … … 18 18 19 19 $GLOBALS['gofj_module_settings'] = array(); 20 // Begin Freemius.21 20 22 if ( !function_exists( 'gfjwjm_fs' ) ) { 23 /** 24 * Create a helper function for easy SDK access. 25 */ 26 function gfjwjm_fs() 27 { 28 global $gfjwjm_fs ; 29 30 if ( !isset( $gfjwjm_fs ) ) { 31 // Activate multisite network integration. 32 if ( !defined( 'WP_FS__PRODUCT_192_MULTISITE' ) ) { 33 define( 'WP_FS__PRODUCT_192_MULTISITE', true ); 21 if ( function_exists( 'gfjwjm_fs' ) ) { 22 gfjwjm_fs()->set_basename( false, __FILE__ ); 23 } else { 24 // Begin Freemius. 25 26 if ( !function_exists( 'gfjwjm_fs' ) ) { 27 /** 28 * Create a helper function for easy SDK access. 29 */ 30 function gfjwjm_fs() 31 { 32 global $gfjwjm_fs ; 33 34 if ( !isset( $gfjwjm_fs ) ) { 35 // Activate multisite network integration. 36 if ( !defined( 'WP_FS__PRODUCT_192_MULTISITE' ) ) { 37 define( 'WP_FS__PRODUCT_192_MULTISITE', true ); 38 } 39 // Include Freemius SDK. 40 require_once dirname( __FILE__ ) . '/includes/freemius/start.php'; 41 $gfjwjm_fs = fs_dynamic_init( array( 42 'id' => '192', 43 'slug' => 'gofetch-wpjm', 44 'public_key' => 'pk_d8c021486da49f69324049b5736a3', 45 'menu' => array( 46 'slug' => 'go-fetch-jobs-wp-job-manager', 47 'support' => false, 48 ), 49 'is_premium' => false, 50 'trial' => array( 51 'days' => 7, 52 'is_require_payment' => true, 53 ), 54 'is_live' => true, 55 ) ); 34 56 } 35 // Include Freemius SDK. 36 require_once dirname( __FILE__ ) . '/includes/freemius/start.php'; 37 $gfjwjm_fs = fs_dynamic_init( array( 38 'id' => '192', 39 'slug' => 'gofetch-wpjm', 40 'public_key' => 'pk_d8c021486da49f69324049b5736a3', 41 'menu' => array( 42 'slug' => 'go-fetch-jobs-wp-job-manager', 43 'support' => false, 44 ), 45 'is_premium' => false, 46 'trial' => array( 47 'days' => 7, 48 'is_require_payment' => true, 49 ), 50 'is_live' => true, 51 ) ); 57 58 return $gfjwjm_fs; 52 59 } 53 60 54 return $gfjwjm_fs; 55 } 56 57 gfjwjm_fs(); 58 gfjwjm_fs()->add_action( 'after_uninstall', array( 'GoFetch_Jobs', 'uninstall' ) ); 59 gfjwjm_fs()->add_filter( 'handle_gdpr_admin_notice', '__return_true' ); 60 // End Freemius. 61 register_activation_hook( __FILE__, array( 'GoFetch_Jobs', 'activate' ) ); 62 // Initialize the plugin after all plugins are loaded. 63 add_action( 'plugins_loaded', 'GoFetch_Jobs', 998 ); 64 if ( !class_exists( 'GoFetch_Jobs' ) ) { 65 /** 66 * Core class. 67 */ 68 final class GoFetch_Jobs 69 { 61 gfjwjm_fs(); 62 gfjwjm_fs()->add_action( 'after_uninstall', array( 'GoFetch_Jobs', 'uninstall' ) ); 63 gfjwjm_fs()->add_filter( 'handle_gdpr_admin_notice', '__return_true' ); 64 // End Freemius. 65 register_activation_hook( __FILE__, array( 'GoFetch_Jobs', 'activate' ) ); 66 // Initialize the plugin after all plugins are loaded. 67 add_action( 'plugins_loaded', 'GoFetch_Jobs', 998 ); 68 if ( !class_exists( 'GoFetch_Jobs' ) ) { 70 69 /** 71 * The dynamic module for the plugin.70 * Core class. 72 71 */ 73 protected static $module = 'wpjm' ; 74 /** 75 * @var The plugin version. 76 */ 77 public $version = '1.8.1.1' ; 78 /** 79 * @var The expected parent plugin/theme name. 80 */ 81 public $parent_plugin = 'WP Job Manager' ; 82 /** 83 * @var The expected parent plugin/theme ID. 84 */ 85 public $parent_plugin_id = 'JOB_MANAGER_VERSION' ; 86 /** 87 * @var The expected theme post type. 88 */ 89 public $parent_post_type = 'job_listing' ; 90 /** 91 * @var The plugin slug. 92 */ 93 public $slug = 'go-fetch-jobs-wp-job-manager' ; 94 /** 95 * @var The plugin post type. 96 */ 97 public $post_type = 'goft_wpjm_schedule' ; 98 /** 99 * @var The log messages limit. 100 */ 101 public $log_limit = 10 ; 102 /** 103 * @var The single instance of the class. 104 */ 105 protected static $_instance = null ; 106 /** 107 * Main 'Go Fetch Jobs' Instance. 108 * 109 * Ensures only one instance is loaded or can be loaded. 110 * 111 * @see GoFetch_Jobs() 112 * 113 * @return GoFetch_Jobs - Main instance 114 */ 115 public static function instance() 72 final class GoFetch_Jobs 116 73 { 117 if ( is_null( self::$_instance ) ) { 118 self::$_instance = new self(); 119 } 120 return self::$_instance; 121 } 122 123 /** 124 * The Constructor. 125 */ 126 public function __construct() 127 { 128 $this->define_constants(); 129 $this->includes(); 130 $this->include_modules(); 131 $this->init_hooks(); 132 do_action( 'gofetch_wpjm_loaded' ); 133 } 134 135 /** 136 * Include required core files used in admin and on the frontend. 137 */ 138 public function includes() 139 { 140 $active_module = self::$module; 141 // Framework Core. 142 require_once 'includes/framework/load.php'; 143 // Parent plugin module. 144 require_once "includes/modules/{$active_module}/class-{$active_module}-module.php"; 145 // Common dependencies. 146 require_once 'includes/settings.php'; 147 // Admin Setup. 148 require_once 'includes/admin/class-gofetch-admin-setup.php'; 149 require_once 'includes/class-gofetch-html-table.php'; 150 require_once 'includes/class-gofetch-helper.php'; 151 require_once 'includes/class-gofetch-importer.php'; 152 // Other. 153 require_once "includes/modules/{$active_module}/themes/cariera/class-gofetch-wpjm-cariera-importer.php"; 154 require_once "includes/modules/{$active_module}/plugins/mas-wp-job-manager-company-integration.php"; 155 // RSS providers. 156 require_once 'includes/class-gofetch-rss-providers.php'; 157 // External. 158 if ( !class_exists( 'OpenGraph' ) ) { 159 require_once 'includes/external/OpenGraph.php'; 160 } 161 if ( $this->is_request( 'backend' ) || $this->is_request( 'ajax' ) ) { 162 require_once 'includes/dynamic/admin/class-gofetch-dynamic-importer.php'; 163 } 164 165 if ( $this->is_request( 'backend' ) ) { 166 require_once 'includes/admin/class-gofetch-admin.php'; 167 if ( class_exists( 'GoFetch_Admin_Settings' ) ) { 168 require_once 'includes/dynamic/admin/class-gofetch-dynamic-settings.php'; 169 } 170 } else { 171 if ( $this->is_request( 'frontend' ) ) { 172 require_once 'includes/class-gofetch-frontend.php'; 173 } 74 /** 75 * The dynamic module for the plugin. 76 */ 77 protected static $module = 'wpjm' ; 78 /** 79 * @var The plugin version. 80 */ 81 public $version = '1.8.1.2' ; 82 /** 83 * @var The expected parent plugin/theme name. 84 */ 85 public $parent_plugin = 'WP Job Manager' ; 86 /** 87 * @var The expected parent plugin/theme ID. 88 */ 89 public $parent_plugin_id = 'JOB_MANAGER_VERSION' ; 90 /** 91 * @var The expected theme post type. 92 */ 93 public $parent_post_type = 'job_listing' ; 94 /** 95 * @var The plugin slug. 96 */ 97 public $slug = 'go-fetch-jobs-wp-job-manager' ; 98 /** 99 * @var The plugin post type. 100 */ 101 public $post_type = 'goft_wpjm_schedule' ; 102 /** 103 * @var The log messages limit. 104 */ 105 public $log_limit = 10 ; 106 /** 107 * @var The single instance of the class. 108 */ 109 protected static $_instance = null ; 110 /** 111 * Main 'Go Fetch Jobs' Instance. 112 * 113 * Ensures only one instance is loaded or can be loaded. 114 * 115 * @see GoFetch_Jobs() 116 * 117 * @return GoFetch_Jobs - Main instance 118 */ 119 public static function instance() 120 { 121 if ( is_null( self::$_instance ) ) { 122 self::$_instance = new self(); 123 } 124 return self::$_instance; 125 } 126 127 /** 128 * The Constructor. 129 */ 130 public function __construct() 131 { 132 $this->define_constants(); 133 $this->includes(); 134 $this->include_modules(); 135 $this->init_hooks(); 136 do_action( 'gofetch_wpjm_loaded' ); 137 } 138 139 /** 140 * Include required core files used in admin and on the frontend. 141 */ 142 public function includes() 143 { 144 $active_module = self::$module; 145 // Framework Core. 146 require_once 'includes/framework/load.php'; 147 // Parent plugin module. 148 require_once "includes/modules/{$active_module}/class-{$active_module}-module.php"; 149 // Common dependencies. 150 require_once 'includes/settings.php'; 151 // Admin Setup. 152 require_once 'includes/admin/class-gofetch-admin-setup.php'; 153 require_once 'includes/class-gofetch-html-table.php'; 154 require_once 'includes/class-gofetch-helper.php'; 155 require_once 'includes/class-gofetch-importer.php'; 156 // Other. 157 require_once "includes/modules/{$active_module}/themes/cariera/class-gofetch-wpjm-cariera-importer.php"; 158 require_once "includes/modules/{$active_module}/plugins/mas-wp-job-manager-company-integration.php"; 159 // RSS providers. 160 require_once 'includes/class-gofetch-rss-providers.php'; 161 // External. 162 if ( !class_exists( 'OpenGraph' ) ) { 163 require_once 'includes/external/OpenGraph.php'; 164 } 165 if ( $this->is_request( 'backend' ) || $this->is_request( 'ajax' ) ) { 166 require_once 'includes/dynamic/admin/class-gofetch-dynamic-importer.php'; 167 } 168 169 if ( $this->is_request( 'backend' ) ) { 170 require_once 'includes/admin/class-gofetch-admin.php'; 171 if ( class_exists( 'GoFetch_Admin_Settings' ) ) { 172 require_once 'includes/dynamic/admin/class-gofetch-dynamic-settings.php'; 173 } 174 } else { 175 if ( $this->is_request( 'frontend' ) ) { 176 require_once 'includes/class-gofetch-frontend.php'; 177 } 178 } 179 180 } 181 182 /** 183 * Include amy external modules 184 */ 185 public function include_modules() 186 { 187 $module = self::$module; 188 189 if ( $this->is_request( 'backend' ) ) { 190 require_once "includes/modules/{$module}/admin/class-gofetch-{$module}-settings.php"; 191 require_once "includes/modules/{$module}/admin/class-gofetch-{$module}-importer.php"; 192 } 193 194 require_once "includes/modules/{$module}/class-gofetch-{$module}.php"; 195 } 196 197 /** 198 * Define Constants. 199 */ 200 private function define_constants() 201 { 202 $this->define( 'GOFT_WPJM_PLUGIN_FILE', __FILE__ ); 203 } 204 205 /** 206 * Hook into actions and filters. 207 */ 208 private function init_hooks() 209 { 210 register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); 211 add_action( 'init', array( $this, 'init' ), 0 ); 212 add_action( 'init', array( $this, 'maybe_get_list_of_providers' ) ); 213 } 214 215 /** 216 * Init plugin when WordPress Initializes. 217 */ 218 public function init() 219 { 220 add_action( 'init', array( $this, 'maybe_install' ) ); 221 add_action( 'init', array( $this, 'maybe_install_sample_schedule' ) ); 222 // Before init action. 223 do_action( 'before_gofetch_wpjm_init' ); 224 // Set up localization. 225 $this->load_plugin_textdomain(); 226 // Init action. 227 do_action( 'gofetch_wpjm_init' ); 228 } 229 230 /** 231 * Load Localization files. 232 * 233 * Note: the first-loaded translation file overrides any following ones if the same translation is present. 234 * 235 * Locales are found in: 236 * - WP_LANG_DIR/plugins/gofetch-wpjm-LOCALE.mo 237 */ 238 public function load_plugin_textdomain() 239 { 240 $locale = apply_filters( 'plugin_locale', get_locale(), 'gofetch-wpjm' ); 241 load_textdomain( 'gofetch-wpjm', WP_LANG_DIR . '/plugins/gofetch-wpjm-' . $locale . '.mo' ); 242 load_plugin_textdomain( 'gofetch-wpjm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 243 } 244 245 /** 246 * Define constant if not already set. 247 * 248 * @param string $name 249 * @param string|bool $value 250 */ 251 private function define( $name, $value ) 252 { 253 if ( !defined( $name ) ) { 254 define( $name, $value ); 255 } 256 } 257 258 /** 259 * What type of request is this? 260 * 261 * string $type ajax, frontend or admin 262 * 263 * @return bool 264 */ 265 private function is_request( $type ) 266 { 267 switch ( $type ) { 268 case 'admin': 269 return is_admin(); 270 case 'ajax': 271 return defined( 'DOING_AJAX' ); 272 case 'cron': 273 return defined( 'DOING_CRON' ); 274 case 'frontend': 275 return (!is_admin() || defined( 'DOING_AJAX' )) && !defined( 'DOING_CRON' ); 276 default: 277 return is_admin() || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ); 278 } 279 } 280 281 /* 282 * On deactivation, remove plugin related stuff. 283 */ 284 public function deactivate() 285 { 286 wp_clear_scheduled_hook( 'gofetch_wpjm_importer' ); 287 } 288 289 /* 290 * On activate, set default stuff. 291 */ 292 public static function activate() 293 { 294 add_option( 'goft-wpjm-activated', 1 ); 295 } 296 297 /* 298 * On uninstall, do stuff. 299 */ 300 public static function uninstall() 301 { 302 } 303 304 /** 305 * Install any sample options. 306 */ 307 public function maybe_install() 308 { 309 global $goft_wpjm_options ; 310 311 if ( !defined( $this->parent_plugin_id ) ) { 312 add_option( 'goft-wpjm-error', 1 ); 313 return; 314 } else { 315 delete_option( 'goft-wpjm-error' ); 316 } 317 318 if ( !is_admin() || get_option( 'goft-wpjm-samples-installed' ) || !get_option( 'goft-wpjm-activated' ) ) { 319 return; 320 } 321 add_option( 'goft-wpjm-samples-installed', 1 ); 322 delete_option( 'goft-wpjm-activated' ); 323 // Skip sample install if there are already templates set. 324 if ( !empty($goft_wpjm_options->templates) ) { 325 return; 326 } 327 // Get the default values for the 'options' fields and save them on the DB. 328 //$options_defaults = $goft_wpjm_options->get_defaults( 'options' ); 329 //$goft_wpjm_options->set( 'options', $options_defaults ); 330 // Pre configure a default template. 331 // Provider. 332 $feed_url = 'https://jobs.theguardian.com/jobsrss/?keywords=wordpress%20full-time&radialtown=&'; 333 // Taxonomy. 334 $job_type = apply_filters( 335 'goft_wpjm_default_value_for_taxonomy', 336 '', 337 'job_listing_type', 338 'full-time' 339 ); 340 // Meta. 341 $expires = GoFetch_Dynamic_Import::get_expire_date(); 342 $templates = $goft_wpjm_options->templates; 343 $example = 'rss-example-theguardian-wordpress-fulltime-jobs'; 344 // @todo: adapt to the current module 345 $templates[$example] = array( 346 'rss_feed_import' => $feed_url, 347 'tax_input' => array( 348 'job_listing_type' => $job_type, 349 ), 350 'meta' => array( 351 '_job_expires' => $expires, 352 ), 353 'source' => array( 354 'name' => 'Guardian Jobs', 355 'website' => 'jobs.theguardian.com', 356 'logo' => GoFetch_Jobs()->plugin_url() . '/includes/images/logos/logo-theguardian.png', 357 ), 358 ); 359 // 360 $goft_wpjm_options->templates = $templates; 361 } 362 363 /** 364 * Install a sample schedule. 365 */ 366 public function maybe_install_sample_schedule() 367 { 368 $module = self::$module; 369 if ( !is_admin() || !post_type_exists( $this->post_type ) ) { 370 return; 371 } 372 if ( !class_exists( 'GoFetch_Scheduler' ) || !get_option( "goft-{$module}-samples-installed" ) || get_option( "goft-{$module}-samples-schedule-installed" ) || !get_option( "goft-{$module}-activated" ) ) { 373 return; 374 } 375 $example = 'rss-example-theguardian-wordpress-fulltime-jobs'; 376 GoFetch_Scheduler::create_schedule( 'Daily Import Example [WordPress Full-Time Jobs] (theguardian.com)', $example ); 377 } 378 379 /** 380 * Get the plugin URL. 381 */ 382 public function plugin_url() 383 { 384 return untrailingslashit( plugins_url( '/', __FILE__ ) ); 385 } 386 387 /** 388 * Conditional check for a 'GOFJ' job page. 389 */ 390 public function is_single_goft_job_page() 391 { 392 global $post ; 393 if ( !is_singular( GoFetch_Jobs()->parent_post_type ) ) { 394 return false; 395 } 396 if ( !get_post_meta( $post->ID, '_goft_wpjm_is_external', true ) ) { 397 return false; 398 } 399 return true; 400 } 401 402 /** 403 * Fod debug purposes only. 404 */ 405 public function maybe_get_list_of_providers() 406 { 407 408 if ( !empty($_GET['GOFJ_PROVIDERS_LIST']) ) { 409 var_dump( GoFetch_RSS_Providers::get_providers_list() ); 410 exit; 411 } 412 174 413 } 175 414 176 415 } 177 178 /**179 * Include amy external modules180 */181 public function include_modules()182 {183 $module = self::$module;184 185 if ( $this->is_request( 'backend' ) ) {186 require_once "includes/modules/{$module}/admin/class-gofetch-{$module}-settings.php";187 require_once "includes/modules/{$module}/admin/class-gofetch-{$module}-importer.php";188 }189 190 require_once "includes/modules/{$module}/class-gofetch-{$module}.php";191 }192 193 /**194 * Define Constants.195 */196 private function define_constants()197 {198 $this->define( 'GOFT_WPJM_PLUGIN_FILE', __FILE__ );199 }200 201 /**202 * Hook into actions and filters.203 */204 private function init_hooks()205 {206 register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );207 add_action( 'init', array( $this, 'init' ), 0 );208 add_action( 'init', array( $this, 'maybe_get_list_of_providers' ) );209 }210 211 /**212 * Init plugin when WordPress Initializes.213 */214 public function init()215 {216 add_action( 'init', array( $this, 'maybe_install' ) );217 add_action( 'init', array( $this, 'maybe_install_sample_schedule' ) );218 // Before init action.219 do_action( 'before_gofetch_wpjm_init' );220 // Set up localization.221 $this->load_plugin_textdomain();222 // Init action.223 do_action( 'gofetch_wpjm_init' );224 }225 226 /**227 * Load Localization files.228 *229 * Note: the first-loaded translation file overrides any following ones if the same translation is present.230 *231 * Locales are found in:232 * - WP_LANG_DIR/plugins/gofetch-wpjm-LOCALE.mo233 */234 public function load_plugin_textdomain()235 {236 $locale = apply_filters( 'plugin_locale', get_locale(), 'gofetch-wpjm' );237 load_textdomain( 'gofetch-wpjm', WP_LANG_DIR . '/plugins/gofetch-wpjm-' . $locale . '.mo' );238 load_plugin_textdomain( 'gofetch-wpjm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );239 }240 241 /**242 * Define constant if not already set.243 *244 * @param string $name245 * @param string|bool $value246 */247 private function define( $name, $value )248 {249 if ( !defined( $name ) ) {250 define( $name, $value );251 }252 }253 254 /**255 * What type of request is this?256 *257 * string $type ajax, frontend or admin258 *259 * @return bool260 */261 private function is_request( $type )262 {263 switch ( $type ) {264 case 'admin':265 return is_admin();266 case 'ajax':267 return defined( 'DOING_AJAX' );268 case 'cron':269 return defined( 'DOING_CRON' );270 case 'frontend':271 return (!is_admin() || defined( 'DOING_AJAX' )) && !defined( 'DOING_CRON' );272 default:273 return is_admin() || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' );274 }275 }276 277 /*278 * On deactivation, remove plugin related stuff.279 */280 public function deactivate()281 {282 wp_clear_scheduled_hook( 'gofetch_wpjm_importer' );283 }284 285 /*286 * On activate, set default stuff.287 */288 public static function activate()289 {290 add_option( 'goft-wpjm-activated', 1 );291 }292 293 /*294 * On uninstall, do stuff.295 */296 public static function uninstall()297 {298 }299 300 /**301 * Install any sample options.302 */303 public function maybe_install()304 {305 global $goft_wpjm_options ;306 307 if ( !defined( $this->parent_plugin_id ) ) {308 add_option( 'goft-wpjm-error', 1 );309 return;310 } else {311 delete_option( 'goft-wpjm-error' );312 }313 314 if ( !is_admin() || get_option( 'goft-wpjm-samples-installed' ) || !get_option( 'goft-wpjm-activated' ) ) {315 return;316 }317 add_option( 'goft-wpjm-samples-installed', 1 );318 delete_option( 'goft-wpjm-activated' );319 // Skip sample install if there are already templates set.320 if ( !empty($goft_wpjm_options->templates) ) {321 return;322 }323 // Get the default values for the 'options' fields and save them on the DB.324 //$options_defaults = $goft_wpjm_options->get_defaults( 'options' );325 //$goft_wpjm_options->set( 'options', $options_defaults );326 // Pre configure a default template.327 // Provider.328 $feed_url = 'https://jobs.theguardian.com/jobsrss/?keywords=wordpress%20full-time&radialtown=&';329 // Taxonomy.330 $job_type = apply_filters(331 'goft_wpjm_default_value_for_taxonomy',332 '',333 'job_listing_type',334 'full-time'335 );336 // Meta.337 $expires = GoFetch_Dynamic_Import::get_expire_date();338 $templates = $goft_wpjm_options->templates;339 $example = 'rss-example-theguardian-wordpress-fulltime-jobs';340 // @todo: adapt to the current module341 $templates[$example] = array(342 'rss_feed_import' => $feed_url,343 'tax_input' => array(344 'job_listing_type' => $job_type,345 ),346 'meta' => array(347 '_job_expires' => $expires,348 ),349 'source' => array(350 'name' => 'Guardian Jobs',351 'website' => 'jobs.theguardian.com',352 'logo' => GoFetch_Jobs()->plugin_url() . '/includes/images/logos/logo-theguardian.png',353 ),354 );355 //356 $goft_wpjm_options->templates = $templates;357 }358 359 /**360 * Install a sample schedule.361 */362 public function maybe_install_sample_schedule()363 {364 $module = self::$module;365 if ( !is_admin() || !post_type_exists( $this->post_type ) ) {366 return;367 }368 if ( !class_exists( 'GoFetch_Scheduler' ) || !get_option( "goft-{$module}-samples-installed" ) || get_option( "goft-{$module}-samples-schedule-installed" ) || !get_option( "goft-{$module}-activated" ) ) {369 return;370 }371 $example = 'rss-example-theguardian-wordpress-fulltime-jobs';372 GoFetch_Scheduler::create_schedule( 'Daily Import Example [WordPress Full-Time Jobs] (theguardian.com)', $example );373 }374 375 /**376 * Get the plugin URL.377 */378 public function plugin_url()379 {380 return untrailingslashit( plugins_url( '/', __FILE__ ) );381 }382 383 /**384 * Conditional check for a 'GOFJ' job page.385 */386 public function is_single_goft_job_page()387 {388 global $post ;389 if ( !is_singular( GoFetch_Jobs()->parent_post_type ) ) {390 return false;391 }392 if ( !get_post_meta( $post->ID, '_goft_wpjm_is_external', true ) ) {393 return false;394 }395 return true;396 }397 398 /**399 * Fod debug purposes only.400 */401 public function maybe_get_list_of_providers()402 {403 404 if ( !empty($_GET['GOFJ_PROVIDERS_LIST']) ) {405 var_dump( GoFetch_RSS_Providers::get_providers_list() );406 exit;407 }408 409 }410 411 416 } 412 } 413 /** 414 * Returns the main instance of 'Go Fetch Jobs'. 415 * 416 * @return GoFetch_Jobs instance. 417 */ 418 function GoFetch_Jobs() 419 { 420 return GoFetch_Jobs::instance(); 417 /** 418 * Returns the main instance of 'Go Fetch Jobs'. 419 * 420 * @return GoFetch_Jobs instance. 421 */ 422 function GoFetch_Jobs() 423 { 424 return GoFetch_Jobs::instance(); 425 } 426 421 427 } 422 428 -
go-fetch-jobs-wp-job-manager/trunk/includes/admin/class-gofetch-admin.php
r2835689 r2856663 6 6 */ 7 7 8 use Stripe\Source; 9 8 10 if ( ! defined( 'ABSPATH' ) ) { 9 11 exit; // Exit if accessed directly … … 23 25 24 26 /** 27 * The guided tutorial instance 28 */ 29 protected $guided_tutorial = null; 30 31 /** 25 32 * Constructor. 26 33 */ 27 34 public function __construct() { 28 35 global $menu; 29 36 if ( get_option( 'goft-wpjm-error' ) ) { 30 37 add_action( 'admin_notices', array( $this, 'warnings' ) ); … … 35 42 36 43 if ( class_exists( 'GoFetch_Guided_Tutorial' ) ) { 37 new GoFetch_Guided_Tutorial(); 38 } 39 44 $this->guided_tutorial = new GoFetch_Guided_Tutorial(); 45 } 46 47 add_action( 'admin_init', array( $this, 'maybe_init_guided_tutorial' ), 25 ); 40 48 add_action( 'restrict_manage_posts', array( $this, 'jobs_filter_restrict_manage_posts' ) ); 41 49 add_action( 'restrict_manage_posts', array( $this, 'jobs_filter_restrict_providers' ) ); … … 69 77 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 21 ); 70 78 add_action( 'admin_head', array( $this, 'admin_icon' ) ); 79 } 80 81 public function maybe_init_guided_tutorial() { 82 global $submenu; 83 84 // Don't init the tutorial if the plugin items are not initialized yet (i.e: avoids tutorial showing on Freemius opt-in init page). 85 if ( empty( $submenu['go-fetch-jobs-wp-job-manager'] ) ) { 86 remove_action( 'admin_enqueue_scripts', array( $this->guided_tutorial, 'start_tour' ), 25 ); 87 } 88 71 89 } 72 90 … … 428 446 429 447 foreach ( $columns as $key => $label ) { 430 // Display custom columns regithbefore the last column.448 // Display custom columns before the last column. 431 449 if ( $total_cols - $cols === 1 ) { 432 450 $new_columns['job_provider'] = __( 'Provider', 'gofetch-wpjm' ); … … 455 473 case 'job_provider': 456 474 if ( ! empty( $source['website'] ) ) { 457 $url = GoFetch_RSS_Providers::simple_url( $source['website'] ); 458 echo '<span class="goft-job-provider">' . esc_url( $url ) . '</span>'; 475 if ( strtolower( $source['website'] ) !== 'unknown' ) { 476 $value = GoFetch_RSS_Providers::simple_url( $source['website'] ); 477 } else { 478 $import_params = get_post_meta( $post->ID, '_goft_wpjm_import_params', true ); 479 $value = sprintf( '%s / %s', $source['website'], $import_params['content_type'] ); 480 } 481 echo sprintf( '<span class="goft-job-provider">%s</span>', esc_attr( $value ) ); 459 482 } else { 460 483 echo '-'; … … 561 584 562 585 /** 563 * Add support ortfo additional HTML tags and attributes.586 * Add support fo additional HTML tags and attributes. 564 587 */ 565 588 public function allowed_html( $allowed_tags, $context ) { … … 567 590 if ( $context !== 'post' && ! $this->is_plugin_page() ) { 568 591 return $allowed_tags; 569 }570 571 $self_closing_tags = array( 'area', 'base', 'basefont', 'br', 'hr', 'img', 'link', 'meta' );572 573 foreach ( $self_closing_tags as $tag ) {574 if ( empty( $allowed_tags[ $tag ] ) ) {575 $allowed_tags[ $tag ] = true;576 }577 592 } 578 593 -
go-fetch-jobs-wp-job-manager/trunk/includes/admin/intro/class-gofetch-api-providers-intro.php
r2716182 r2856663 81 81 'Careerjet' => 'http://www.careerjet.com', 82 82 'CV-Library' => 'https://www.cv-library.co.uk', 83 'Indeed' => 'https://www.indeed.com',84 83 'Talroo' => 'https://www.talroo.com', 85 84 'Jooble' => 'https://jooble.org', -
go-fetch-jobs-wp-job-manager/trunk/includes/class-gofetch-helper.php
r2835689 r2856663 351 351 if ( 1 == count( $child_c_keys ) && $child_c_values > 1 ) { 352 352 if ( is_array( $child_c_values[0] ) ) { 353 $flattened = self::array_flatten( $child_c_values[0] ); 354 355 if ( ! is_numeric( $c_key ) ) { 356 $new_item[ $c_key ] = implode( '|', $flattened ); 353 354 $priority_props = array( 'value' => '', 'label' => '', 'url' => '' ); 355 356 if ( isset( $child_c_values[0]['@attributes'] ) ) { 357 $atts = $child_c_values[0]['@attributes']; 358 } else { 359 $atts = $child_c_values[0]; 357 360 } 361 362 $key_props_value = array_intersect_key( $atts, $priority_props ); 363 364 if ( ! empty( $key_props_value ) ) { 365 $new_item[ $c_key ] = reset( $key_props_value ); 366 } else { 367 $flattened = self::array_flatten( $child_c_values[0], $c_key ); 368 369 if ( isset( $flattened[ $c_key] ) ) { 370 $flattened = $flattened[ $c_key ]; 371 } 372 373 if ( ! is_numeric( $c_key ) ) { 374 $new_item[ $c_key ] = implode( '|', $flattened ); 375 } 376 377 } 378 358 379 } else { 359 380 if ( is_numeric( $c_key ) ) { … … 363 384 } 364 385 } else { 365 366 386 foreach ( $child_c_keys as $cc_values_index => $cc_values_k ) { 367 387 … … 403 423 } 404 424 405 public static function array_flatten( $array ) { 425 public static function maybe_use_xml_prop( $value, $props ) { 426 $priority_props = array( 'value' => '', 'label' => '' ); 427 428 if ( ! $value ) { 429 $prop = array_intersect_key( $props, $priority_props ); 430 if ( ! empty( $prop ) ) { 431 $value = reset( $prop ); 432 } 433 } 434 return $value; 435 } 436 437 public static function array_flatten( $array, $parent_key = '' ) { 406 438 $return = array(); 407 439 408 foreach ($array as $key => $value) { 409 if ( '@attributes' === $key ) { 410 unset( $return[ $key ] ); 411 } elseif ( is_array( $value ) ) { 412 $return = array_merge($return, self::array_flatten( $value ) ); 413 } else { 414 $return[$key] = $value; 440 $priority_props = array( 'value' => '', 'label' => '', 'url' => '' ); 441 442 foreach ( $array as $values ) { 443 444 foreach ( $values as $key => $value) { 445 446 if ( '@attributes' === $key ) { 447 $prop = array_intersect_key( $value, $priority_props ); 448 if ( $parent_key && ! empty( $prop ) ) { 449 $prop_value = reset( $prop ); 450 451 if ( ! isset( $return[ $parent_key ] ) ) { 452 $return[ $parent_key ] = array(); 453 } 454 $return[ $parent_key ][] = $prop_value; 455 } else { 456 unset( $return[ $key ] ); 457 } 458 } elseif ( is_array( $value ) ) { 459 $return = array_merge($return, self::array_flatten( $value, $parent_key ) ); 460 } else { 461 $return[$key] = $value; 462 } 415 463 } 416 464 } -
go-fetch-jobs-wp-job-manager/trunk/includes/class-gofetch-importer.php
r2835689 r2856663 495 495 $xml = simplexml_load_string( $response, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOERROR ); 496 496 if ( !$xml ) { 497 //return apply_filters( 'goft_wpjm_xml_content_not_readable_error', new WP_Error( -1003, __( 'XML Content is not readable.', 'gofetch-wpjm' ) ), $valid_provider, $url_or_data );498 497 return apply_filters( 499 498 'goft_wpjm_xml_content_not_readable_error', … … 510 509 // If we don't have a simple array parse it using a different strategy. 511 510 512 if ( !count( $feed['items'] ) || 1 === count( $feed['items'] ) ) {511 if ( $xml && empty($feed['items'][0]['title']) || !count( $feed['items'] ) || 1 === count( $feed['items'] ) ) { 513 512 $json = json_encode( $xml ); 514 513 $items = json_decode( $json, true ); -
go-fetch-jobs-wp-job-manager/trunk/includes/modules/wpjm/class-gofetch-wpjm.php
r2835689 r2856663 18 18 public function __construct() { 19 19 20 20 21 add_filter( 'the_job_location', array( $this, 'maybe_override_location' ), 20, 2 ); 21 22 … … 35 36 */ 36 37 public function single_job_page_hooks( $post ) { 38 add_action( 'wp', array( $this, 'override_application_details_url' ), 25 ); 39 37 40 remove_filter( 'the_content', array( 'GoFetch_Frontend', 'goft_the_job_description' ), 50 ); 38 41 add_filter( 'the_job_description', array( 'GoFetch_Frontend', 'goft_the_job_description' ), 50 ); … … 170 173 */ 171 174 public function override_application_details_url( $override ) { 175 // Removes any actions added by other plugins that do not apply to imported jobs. 176 remove_all_actions( 'job_manager_application_details_url' ); 177 172 178 add_action( 'job_manager_application_details_url', array( 'GoFetch_Frontend', 'application_details_url' ), 15 ); 173 179 -
go-fetch-jobs-wp-job-manager/trunk/includes/modules/wpjm/themes/cariera/class-gofetch-wpjm-cariera-importer.php
r2715089 r2856663 106 106 $value = $meta[ $wpjm_apply_field ]; 107 107 108 if ( is_array( $value ) ) { 109 reset( $value ); 110 } 111 108 112 if ( ! GoFetch_Helper::is_email_address( $value ) ) { 109 113 update_post_meta( $post_id, $alt_application_field, $value );
Note: See TracChangeset
for help on using the changeset viewer.