ID, 'webBookerID', true ); $include_header = get_post_meta( $post->ID, 'include_header', true ); $include_footer = get_post_meta( $post->ID, 'include_footer', true ); ?>
" . sprintf(__('(Get It %s Here %s)','arez'), '', ''); ?>
/>
/>
heredoc; } return $contextual_help; } add_filter('contextual_help', 'arez_plugin_help', 10, 3); // Add a menu for our option page add_action('admin_menu', 'arez_plugin_add_page'); function arez_plugin_add_page() { add_options_page( 'ActivityRez', 'ActivityRez', 'manage_options', 'arez_plugin', 'arez_plugin_option_page'); } function remoteAuth(){ global $flashError; $options = get_option( 'arez_plugin' ); include_once(ACTIVITYREZWB_PLUGIN_DIR . '/php/lib/arez.api.php'); $arezApi = ActivityRezAPI::instance(); $resp = $arezApi->r_authArez( $options['username'], $options['password'] ); if($resp['status']==0){ $flashError = __("Invalid Username or Password, Try again",'arez'); } } // Draw the option page function arez_plugin_option_page() { //error_log('page loaded'); $options = get_option( 'arez_plugin' ); global $nonce,$flashError; $_webbookers = array(); remoteAuth(); if( isset( $_REQUEST['arez_logout'] ) ){ unset($nonce); if(!headers_sent()) setcookie ("ACTIVITYREZ3", "", time() - 3600); } if( isset( $_REQUEST['translate'] ) && is_array( $_REQUEST['translate'] ) && !empty( $_REQUEST['translate'] ) ){ if( !isset($flashError) || !$flashError){ arez_get_translationFiles( $_REQUEST['translate'] ); } } if( isset( $_REQUEST['a'] ) && $_REQUEST['a'] === 'import' ){ //TODO import your webbookers if( !isset($flashError) || !$flashError){ $arezApi = ActivityRezAPI::instance(); $ResultString = $arezApi->importWebbookers(); echo ""; if( isset($ResultString['status']) && $ResultString['status'] == '1' ){ //Store the wb list and prompt the user wich ones they want to import $_webbookers = $ResultString['webBookers']; update_option('arez_webbooker_import',json_encode($_webbookers) ); }else{ $flashError = __("Failed to import webbookers:",'arez'). print_r($ResultString,1) . AREZ_SERVER . "nonce: {$nonce}".print_r($nonceData,1); } } }else if(isset( $_REQUEST['a'] ) && $_REQUEST['a'] === 'import_finish' && isset($_REQUEST['wbID']) && is_array($_REQUEST['wbID']) && !empty($_REQUEST['wbID']) ){ //finish import job based off user selection $_webbookers = json_decode(get_option( 'arez_webbooker_import' ),1); $wbImportCount = 0; foreach( $_webbookers as $wb ){ if($wb['post_status'] != 'publish') continue; if( !in_array($wb['ID'],$_REQUEST['wbID']) ) continue; $webbookers = get_posts( array( 'post_type'=>'webBooker', 'numberposts'=>-1, 'meta_key'=>'webBookerID','meta_value'=>$wb['ID'] ) ); if( !$webbookers || empty($webbookers)){ $post = array('post_status'=>'publish','post_title'=>$wb['post_title'],'post_type'=>'webBooker'); $post_id = wp_insert_post($post); update_post_meta($post_id,'webBookerID',$wb['ID']); update_post_meta($post_id,'include_header',1); update_post_meta($post_id,'include_footer',1); $wbImportCount++; }else{ //already been imported, skip this continue; } } delete_option('arez_webbooker_import'); $flashError = arez_update_webbookers(); $flashError .= sprintf(__("Successfully imported %s new Web Bookers",'arez'),$wbImportCount); }else if( isset( $_REQUEST['a'] ) && $_REQUEST['a'] === 'update' ){ global $nonce,$flashError; if( !isset($flashError) || !$flashError){ $flashError = arez_update_webbookers(); $flashError .= __("Successfully update all Web Bookers",'arez'); } } ?>



'webBooker', 'numberposts'=>-1, 'post_status'=>'publish' ) ); $i = 0; foreach($_webbookers as $wb){ if( 'publish' != $wb['post_status']) continue; ?>

'webBooker', 'numberposts'=>-1, 'post_status'=>'publish' ) ); if( !empty($webbookers) ){ ?>

ID ); $webbooker_id = 0; if(isset($meta['webBookerID'])){ $webbooker_id = $meta['webBookerID'][0]; } ?>
post_title; ?> post_status; ?>



Enter your settings here.

'; } // Display and fill the form field function arez_plugin_setting_username() { // get option 'text_string' value from the database $options = get_option( 'arez_plugin' ); $text_string = $options['username']; // echo the field echo ""; } function arez_plugin_setting_password() { // get option 'text_string' value from the database $options = get_option( 'arez_plugin' ); $text_string = $options['password']; // echo the field echo ""; } function arez_plugin_setting_server() { // get option 'text_string' value from the database $options = get_option( 'arez_plugin' ); $text_string = $options['server']; // echo the field echo ""; echo ""; } // Validate user input (we want text only) function arez_plugin_validate_options( $input ) { $valid = array(); //arezLog('wbStandalone',print_r($input,1)); if( isset( $input['username'] ) && !empty( $input['username'] ) ){ $valid['username'] = $input['username']; } if( isset( $input['password'] ) && !empty( $input['password'] ) ){ $valid['password'] = $input['password']; } if( isset( $input['api_key'] ) && !empty( $input['api_key'] ) ){ $valid['api_key'] = $input['api_key']; } if( isset( $input['server'] ) && !empty( $input['server'] ) ){ $valid['server'] = $input['server']; } return $valid; }