[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-forums/bbpress/bb-admin/ -> options-writing.php (source)

   1  <?php
   2  
   3  require_once ('admin.php');
   4  
   5  if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && $_POST['action'] == 'update' ) {
   6      
   7      bb_check_admin_referer( 'options-writing-update' );
   8      
   9      // Deal with xmlrpc checkbox when it isn't checked
  10      if ( !isset( $_POST['enable_xmlrpc'] ) ) {
  11          $_POST['enable_xmlrpc'] = false;
  12      }
  13      
  14      foreach ( (array) $_POST as $option => $value ) {
  15          if ( !in_array( $option, array( '_wpnonce', '_wp_http_referer', 'action', 'submit' ) ) ) {
  16              $option = trim( $option );
  17              $value = is_array( $value ) ? $value : trim( $value );
  18              $value = stripslashes_deep( $value );
  19              if ( $value ) {
  20                  bb_update_option( $option, $value );
  21              } else {
  22                  bb_delete_option( $option );
  23              }
  24          }
  25      }
  26      
  27      $goback = add_query_arg( 'updated', 'true', wp_get_referer() );
  28      bb_safe_redirect( $goback );
  29      exit;
  30  }
  31  
  32  if ( !empty($_GET['updated']) ) {
  33      bb_admin_notice( __( '<strong>Settings saved.</strong>' ) );
  34  }
  35  
  36  $general_options = array(
  37      'edit_lock' => array(
  38          'title' => __( 'Lock post editing after' ),
  39          'class' => 'short',
  40          'after' => __( 'minutes' ),
  41          'note' => __( 'A user can edit a post for this many minutes after submitting.' ),
  42      ),
  43      'throttle_time' => array(
  44          'title' => __( 'Throttle time' ),
  45          'class' => 'short',
  46          'after' => __( 'seconds' ),
  47          'note' => __( 'Users must wait this many seconds between posts. By default, moderators, administrators and keymasters are not throttled.' )
  48      )
  49  );
  50  
  51  $remote_options = array(
  52      'enable_xmlrpc' => array(
  53          'title' => __( 'XML-RPC' ),
  54          'type' => 'checkbox',
  55          'options' => array(
  56              1 => __( 'Enable the bbPress XML-RPC publishing protocol.' )
  57          )
  58      )
  59  );
  60  
  61  $bb_admin_body_class = ' bb-admin-settings';
  62  
  63  bb_get_admin_header();
  64  
  65  ?>
  66  
  67  <div class="wrap">
  68  
  69  <h2><?php _e( 'Writing Settings' ); ?></h2>
  70  <?php do_action( 'bb_admin_notices' ); ?>
  71  
  72  <form class="settings" method="post" action="<?php bb_uri( 'bb-admin/options-writing.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ); ?>">
  73      <fieldset><?php foreach ( $general_options as $option => $args ) bb_option_form_element( $option, $args ); ?></fieldset>
  74      <fieldset>
  75          <legend><?php _e( 'Remote Publishing' ); ?></legend>
  76          <p>
  77              <?php _e( 'To interact with bbPress from a desktop client or remote website that uses the XML-RPC publishing interface you must enable it below.' ); ?>
  78          </p>
  79  <?php        foreach ( $remote_options as $option => $args ) bb_option_form_element( $option, $args ); ?>
  80      </fieldset>
  81      <fieldset class="submit">
  82          <?php bb_nonce_field( 'options-writing-update' ); ?>
  83          <input type="hidden" name="action" value="update" />
  84          <input class="submit" type="submit" name="submit" value="<?php _e( 'Save Changes' ); ?>" />
  85      </fieldset>
  86  </form>
  87  
  88  </div>
  89  
  90  <?php
  91  
  92  bb_get_admin_footer();


Generated: Thu Dec 7 01:01:35 2017 Cross-referenced by PHPXref 0.7.1