Advanced Web Server Manager
Complete File Manager & Terminal - Standalone Version
By Sid Gifari | Gifari Industries
Current path:
/
/
home
/
qtdcvxyp
/
public_html
/
wp-content
/
plugins
/
star4hire-core
/
includes
✏️
Editing: class-s4h-install.php
<?php if ( ! defined( 'ABSPATH' ) ) { exit; } class S4H_Install { public static function activate() { S4H_DB::create_tables(); S4H_DB::migrate_multi_deal_data(); S4H_DB::seed_english_questions(); self::capabilities(); if ( class_exists('S4H_Team_Access') ) S4H_Team_Access::maybe_seed_named_team(); if ( class_exists('S4H_Program_Packages') ) S4H_Program_Packages::maybe_migrate_included_consultations(); if ( ! get_option( 's4h_installation_uuid' ) ) { update_option( 's4h_installation_uuid', wp_generate_uuid4(), false ); } if ( ! get_option( 's4h_installation_mode' ) ) { update_option( 's4h_installation_mode', 'hq', false ); } if ( ! get_option( 's4h_ghl_webhook_secret' ) ) { update_option( 's4h_ghl_webhook_secret', wp_generate_password( 32, false, false ), false ); } if ( ! get_option( 's4h_indexnow_key' ) ) { update_option( 's4h_indexnow_key', wp_generate_password( 32, false, false ), false ); } if ( false === get_option( 's4h_ai_search_allow_oai', false ) ) { update_option( 's4h_ai_search_allow_oai', 1, false ); } self::create_pages(); S4H_CPT::register(); if(class_exists('S4H_Intelligence')) S4H_Intelligence::register_taxonomies(); if(class_exists('S4H_Pathways')) S4H_Pathways::maybe_seed_defaults(); flush_rewrite_rules(); } public static function deactivate() { if ( class_exists('S4H_Opportunities') ) { S4H_Opportunities::clear_schedule(); } flush_rewrite_rules(); } public static function maybe_upgrade() { // IMPORTANT: plugins_loaded is too early for register_post_type(), // register_taxonomy(), or flush_rewrite_rules() on some WordPress stacks. // Database/content migrations run here; routes are registered on `init`. if ( get_option( 's4h_core_db_version' ) !== S4H_CORE_DB_VERSION ) { S4H_DB::create_tables(); S4H_DB::migrate_multi_deal_data(); S4H_DB::seed_english_questions(); self::create_pages(); self::capabilities(); update_option( 's4h_flush_rewrite_needed', 1, false ); } elseif ( get_option('s4h_english_seed_version') !== '1.3.2' ) { S4H_DB::seed_english_questions(); } if ( get_option('s4h_capability_version') !== S4H_CORE_VERSION ) { self::capabilities(); } if ( class_exists('S4H_Team_Access') ) S4H_Team_Access::maybe_seed_named_team(); if ( class_exists('S4H_Program_Packages') ) S4H_Program_Packages::maybe_migrate_included_consultations(); if ( ! get_option( 's4h_ghl_webhook_secret' ) ) { update_option( 's4h_ghl_webhook_secret', wp_generate_password( 32, false, false ), false ); } if ( ! get_option( 's4h_indexnow_key' ) ) { update_option( 's4h_indexnow_key', wp_generate_password( 32, false, false ), false ); } if ( false === get_option( 's4h_ai_search_allow_oai', false ) ) { update_option( 's4h_ai_search_allow_oai', 1, false ); } if ( class_exists('S4H_Pathways') ) S4H_Pathways::maybe_seed_defaults(); } public static function maybe_flush_rewrite() { if ( ! get_option( 's4h_flush_rewrite_needed' ) ) return; // By priority 99 on `init`, CPTs and taxonomies have already been registered. flush_rewrite_rules( false ); delete_option( 's4h_flush_rewrite_needed' ); } private static function capabilities() { $content_caps = array( 'event'=>array('singular'=>'s4h_event','plural'=>'s4h_events'), 'pathway'=>array('singular'=>'s4h_pathway','plural'=>'s4h_pathways'), 'proof'=>array('singular'=>'s4h_proof','plural'=>'s4h_proofs'), 'partner'=>array('singular'=>'s4h_partner','plural'=>'s4h_partners'), 'insight'=>array('singular'=>'s4h_insight','plural'=>'s4h_insights'), ); $caps=array('manage_s4h','s4h_access','s4h_counselor','s4h_participant_success','s4h_success_view','s4h_finance','s4h_journey_update','s4h_journey_view','s4h_career_architect','s4h_control_tower'); foreach($content_caps as $cfg){ $s=$cfg['singular']; $p=$cfg['plural']; $caps=array_merge($caps,array( "edit_$s","read_$s","delete_$s","edit_$p","edit_others_$p","publish_$p","read_private_$p", "delete_$p","delete_private_$p","delete_published_$p","delete_others_$p","edit_private_$p","edit_published_$p" )); } $role = get_role( 'administrator' ); if ( $role ) { foreach ( $caps as $cap ) { $role->add_cap($cap); } } $manager = get_role('s4h_manager'); if(!$manager){ $manager=add_role('s4h_manager','STAR4Hire Manager',array('read'=>true,'upload_files'=>true,'manage_s4h'=>true,'s4h_counselor'=>true)); } if($manager){ foreach($caps as $cap){ $manager->add_cap($cap); } $manager->add_cap('upload_files'); } $success = get_role('s4h_success_manager'); if(!$success){ $success=add_role('s4h_success_manager','STAR4Hire Participant Success',array('read'=>true,'s4h_access'=>true,'s4h_participant_success'=>true,'s4h_success_view'=>true,'s4h_journey_update'=>true)); } if($success){ foreach(array('read','s4h_access','s4h_participant_success','s4h_success_view','s4h_journey_update') as $cap) $success->add_cap($cap); } $counselor = get_role('s4h_counselor'); if(!$counselor){ $counselor=add_role('s4h_counselor','STAR4Hire Career Counselor',array('read'=>true,'s4h_access'=>true,'s4h_counselor'=>true,'s4h_journey_update'=>true)); } if($counselor){ foreach(array('read','s4h_access','s4h_counselor','s4h_journey_update') as $cap) $counselor->add_cap($cap); } $finance = get_role('s4h_finance_officer'); if(!$finance){ $finance=add_role('s4h_finance_officer','STAR4Hire Finance',array('read'=>true,'s4h_access'=>true,'s4h_finance'=>true,'s4h_success_view'=>true)); } if($finance){ foreach(array('read','s4h_access','s4h_finance','s4h_success_view') as $cap) $finance->add_cap($cap); } $architect = get_role('s4h_career_architect'); if(!$architect){ $architect=add_role('s4h_career_architect','STAR4Hire Career Architect',array('read'=>true,'s4h_access'=>true,'s4h_career_architect'=>true,'s4h_counselor'=>true,'s4h_journey_update'=>true,'s4h_success_view'=>true,'s4h_control_tower'=>true)); } if($architect){ foreach(array('read','s4h_access','s4h_career_architect','s4h_counselor','s4h_journey_update','s4h_success_view','s4h_control_tower') as $cap) $architect->add_cap($cap); } $pmo = get_role('s4h_pmo'); if(!$pmo){ $pmo=add_role('s4h_pmo','STAR4Hire PMO / Control Tower',array('read'=>true,'s4h_access'=>true,'s4h_control_tower'=>true,'s4h_success_view'=>true,'s4h_journey_view'=>true)); } if($pmo){ foreach(array('read','s4h_access','s4h_control_tower','s4h_success_view','s4h_journey_view') as $cap) $pmo->add_cap($cap); } update_option('s4h_capability_version', S4H_CORE_VERSION, false); } private static function ensure_page( $title, $slug, $content, $option ) { $existing = get_page_by_path( $slug ); if ( $existing ) { update_option( $option, $existing->ID ); return $existing->ID; } $id = wp_insert_post( array('post_title'=>$title,'post_name'=>$slug,'post_status'=>'publish','post_type'=>'page','post_content'=>$content) ); if ( ! is_wp_error($id) ) { update_option($option,$id); } return $id; } private static function about_content() { return '<!-- wp:group {"align":"full","className":"s4h-about-hero","layout":{"type":"constrained"}} --> <div class="wp-block-group alignfull s4h-about-hero"> <!-- wp:paragraph {"className":"s4h-eyebrow"} --><p class="s4h-eyebrow">ABOUT STAR4HIRE</p><!-- /wp:paragraph --> <!-- wp:heading {"level":1} --><h1 class="wp-block-heading">Building Global Careers, Not Just Sending People Abroad.</h1><!-- /wp:heading --> <!-- wp:paragraph {"fontSize":"medium"} --><p class="has-medium-font-size">STAR4Hire is a Global Career Platform helping Indonesian talent discover where they are today, build the career assets they still need, and access education, internship, and work opportunities across global markets.</p><!-- /wp:paragraph --> </div><!-- /wp:group --> <!-- wp:columns {"align":"wide","className":"s4h-about-grid"} --><div class="wp-block-columns alignwide s4h-about-grid"> <!-- wp:column --><div class="wp-block-column"><!-- wp:heading {"level":3} --><h3 class="wp-block-heading">Discover</h3><!-- /wp:heading --><!-- wp:paragraph --><p>Career Assessment, English Level Check, and Career Passport help talent understand their starting point.</p><!-- /wp:paragraph --></div><!-- /wp:column --> <!-- wp:column --><div class="wp-block-column"><!-- wp:heading {"level":3} --><h3 class="wp-block-heading">Build</h3><!-- /wp:heading --><!-- wp:paragraph --><p>Language, education, skills, international exposure, and career readiness become career assets that grow over time.</p><!-- /wp:paragraph --></div><!-- /wp:column --> <!-- wp:column --><div class="wp-block-column"><!-- wp:heading {"level":3} --><h3 class="wp-block-heading">Access</h3><!-- /wp:heading --><!-- wp:paragraph --><p>Webinars, Career Day, Career GPS, partners, employers, and global pathways connect preparation to real next moves.</p><!-- /wp:paragraph --></div><!-- /wp:column --> </div><!-- /wp:columns --> <!-- wp:group {"align":"wide","className":"s4h-about-statement","layout":{"type":"constrained"}} --><div class="wp-block-group alignwide s4h-about-statement"> <!-- wp:heading {"level":2} --><h2 class="wp-block-heading">Our belief: the more career assets you build, the more choices you create.</h2><!-- /wp:heading --> <!-- wp:paragraph --><p>This is the idea behind the Future Millionaire Career System: build education, language, skills, experience, network, qualifications, reputation, and income capacity step by step—so a global career becomes a system, not a gamble.</p><!-- /wp:paragraph --> <!-- wp:buttons --><div class="wp-block-buttons"><!-- wp:button --><div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/career-assessment/">Start My Career Assessment →</a></div><!-- /wp:button --></div><!-- /wp:buttons --> </div><!-- /wp:group -->'; } public static function create_pages() { self::ensure_page( 'Global Career Assessment', 'career-assessment', '[s4h_assessment]', 's4h_assessment_page_id' ); self::ensure_page( 'Career Snapshot', 'career-snapshot', '[s4h_snapshot]', 's4h_snapshot_page_id' ); self::ensure_page( 'Events', 'events', '[s4h_events]', 's4h_events_page_id' ); self::ensure_page( 'Free English Level Test', 'english-level-test', '[s4h_english_test]', 's4h_english_test_page_id' ); self::ensure_page( 'English Level Result', 'english-level-result', '[s4h_english_result]', 's4h_english_result_page_id' ); self::ensure_page( 'About Us', 'about-us', self::about_content(), 's4h_about_page_id' ); self::ensure_page( 'Career Counselor Workspace', 'counselor', '[s4h_counselor_workspace]', 's4h_counselor_page_id' ); self::ensure_page( 'My Journey', 'my-journey', '[s4h_my_journey]', 's4h_my_journey_page_id' ); self::ensure_page( 'Track My Journey', 'track-journey', '[s4h_track_journey]', 's4h_track_journey_page_id' ); self::ensure_page( 'Parent Journey View', 'parent-journey', '[s4h_parent_journey]', 's4h_parent_journey_page_id' ); self::ensure_page( 'Career Opportunities', 'opportunities', '[s4h_opportunities]', 's4h_opportunities_page_id' ); self::ensure_page( 'Participant Success Workspace', 'success-workspace', '[s4h_success_workspace]', 's4h_success_workspace_page_id' ); } }
💾 Save Changes
❌ Cancel