Created
June 8, 2022 05:41
-
-
Save wolfcoder/61cd0564e56f0a35f5e4a215f0487a5f to your computer and use it in GitHub Desktop.
setting view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| global $vap, $vap_settings; | |
| if( isset( $_REQUEST['vap_setting_save'] ) && isset( $_REQUEST['vap_setting'] ) && $_REQUEST['vap_setting'] != '' ) { | |
| do_action( 'vap_save_settings', $_POST ); | |
| } | |
| echo '<div class="wrap vap_content">'; | |
| if( isset( $_SESSION['vap_cfg_msg_status'] ) && $_SESSION['vap_cfg_msg_status'] ) { | |
| echo '<div id="vap_message" class="updated notice notice-success is-dismissible">'; | |
| echo '<p id="vap_message_content">'; | |
| echo (isset( $_SESSION['vap_cfg_msg'] ) && $_SESSION['vap_cfg_msg']!='' ) ? $_SESSION['vap_cfg_msg'] : 'Something went wrong.'; | |
| echo '</p>'; | |
| echo '<button type="button" class="notice-dismiss"><span class="screen-reader-text">'.__( 'Dismiss this notice.' ).'</span></button>'; | |
| echo '</div>'; | |
| unset($_SESSION['vap_cfg_msg_status']); | |
| unset($_SESSION['vap_cfg_msg']); | |
| } else { | |
| echo '<div id="vap_message" class="updated notice notice-success is-dismissible" style="display:none;">'; | |
| echo '<p id="vap_message_content"></p>'; | |
| echo '<button type="button" class="notice-dismiss"><span class="screen-reader-text">'.__( 'Dismiss this notice.' ).'</span></button>'; | |
| echo '</div>'; | |
| } | |
| echo '<form name="vap_settings" id="vap_settings" method="post" >'; | |
| global $vap, $vap_settings; | |
| $general_option = $vap_settings->vap_get_settings_func(); | |
| if( !empty( $general_option ) ) { | |
| echo '<div class="cmrc-table">'; | |
| echo '<div class="setting-general" >'; | |
| echo '<h2>'.__( 'General options' ).'</h2>'; | |
| $vap_api_url = isset( $general_option['vap_api_url'] ) ? $general_option['vap_api_url'] : ''; | |
| $vap_api_key = isset( $general_option['vap_api_key'] ) ? $general_option['vap_api_key'] : ''; | |
| $vap_project_id = isset( $general_option['vap_project_id'] ) ? $general_option['vap_project_id'] : ''; | |
| $vap_append_post = isset( $general_option['vap_append_post'] ) ? $general_option['vap_append_post'] : 1; | |
| $vap_auto_publish = isset( $general_option['vap_auto_publish'] ) ? $general_option['vap_auto_publish'] : ''; | |
| ?> | |
| <div class="remove_site_0"> | |
| <table class="form-table vap-setting-form count_table"> | |
| <tbody> | |
| <tr> | |
| <th><label for="vap_api_url"><?php _e( 'Vin Api Url' ); ?></label></th> | |
| <td> | |
| <input type="text" name="vap_api_url" id="vap_api_url" class="regular-text code" value="<?php echo $vap_api_url ?>" /> | |
| <p><?php _e( 'https://example.com/api/v1 - This is the VIN Article Api URL that your Content will be pulled from.' ); ?></p> | |
| </td> | |
| </tr> | |
| <tr> | |
| <th><label for="vap_api_key"><?php _e( 'Api Key' ); ?></label></th> | |
| <td> | |
| <input type="text" name="vap_api_key" id="vap_api_key" class="regular-text code" value="<?php echo $vap_api_key ?>" /> | |
| <p><?php _e( 'Enter the api key to access Vin Article Api.' ); ?></p> | |
| </td> | |
| </tr> | |
| <tr> | |
| <th><label for="vap_project_id"><?php _e( 'Project ID' ); ?></label></th> | |
| <td> | |
| <input type="text" name="vap_project_id" id="vap_project_id" class="regular-text code" value="<?php echo $vap_project_id ?>" /> | |
| <p><?php _e( 'Enter the project ID of the Vin Article to get the associated articles.' ); ?></p> | |
| </td> | |
| </tr> | |
| <tr> | |
| <th><label for="vap_append_post"><?php _e( 'Update Existing Post' ); ?></label></th> | |
| <td> | |
| <input <?php if($vap_append_post==1) { echo "checked='checked'"; } ?> type="radio" name="vap_append_post" value="1" class="vap_radio" id="vap_append_post_on" > | |
| <label for="vap_append_post_on"> <?php _e( 'On - Sync process will update the existing post with the same ID.' ); ?> </label> | |
| <br> | |
| <input <?php if($vap_append_post==0) { echo "checked='checked'"; } ?> type="radio" name="vap_append_post" value="0" class="vap_radio" id="vap_append_post_off"> | |
| <label for="vap_append_post_off"><?php _e( 'Off - Sync process will ignore the existing post with the same ID.' ); ?> </label> | |
| </td> | |
| </tr> | |
| <tr> | |
| <th><label for="vap_auto_publish"><?php _e( 'Post By Default Published' ); ?></label></th> | |
| <td> | |
| <input <?php if($vap_auto_publish) { echo "checked"; } ?> type="checkbox" class="vap_checkbox" name="vap_auto_publish" id="vap_auto_publish" /> | |
| <label for="vap_auto_publish"><?php _e( 'Post will be auto published on Sync process.' ); ?></label><br> | |
| </td> | |
| </tr> | |
| <tr> | |
| <th> </th> | |
| <td> | |
| <a id="lnk_vap_cfg_reset" class="button"><?php esc_html_e( 'Reset last sync configuration' ); ?></a> | |
| </td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| <hr/> | |
| </div> | |
| <?php | |
| echo '</div>'; | |
| echo '</div>'; | |
| } | |
| echo '<p class="submit">'; | |
| echo '<input type="hidden" name="vap_setting" id="vap_setting" value="vap_setting" />'; | |
| echo '<input name="vap_setting_save" class="button-primary vap_setting_save" type="submit" value="Save changes" />'; | |
| echo '</p>'; | |
| echo '</form>'; | |
| echo '</div>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment