', '', '', '' ), 'wp-members' ); $help_link = __( sprintf( 'See the %sUsers Guide on plugin options%s.', '', '' ), 'wp-members' ); // Build an array of post types $post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'names', 'and' ); $post_arr = array( 'post' => 'Posts', 'page' => 'Pages', ); if ( $post_types ) { foreach ( $post_types as $post_type ) { $cpt_obj = get_post_type_object( $post_type ); $post_arr[ $cpt_obj->name ] = $cpt_obj->labels->name; } } ?>

    $val ) { if ( $key == 'post' || $key == 'page' || ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ) { ?> > block[ $key ] ) ) ? $wpmem->block[ $key ] : ''; $values = array( __( 'Do not block', 'wp-members' ) . '|0', __( 'Block', 'wp-members' ) . '|1', // @todo Future development. __( 'Hide', 'wp-members' ) . '|2', ); echo wpmem_create_formfield( 'wpmem_block_' . $key, 'select', $values, $block ); ?> __( 'Show Excerpts', 'wp-members' ), 'show_login' => __( 'Show Login Form', 'wp-members' ), 'show_reg' => __( 'Show Registration Form', 'wp-members' ), 'autoex' => __( 'Auto Excerpt:', 'wp-members' ), ); foreach ( $option_group_array as $item_key => $item_val ) { $i = 0; $len = count( $post_arr ); foreach ( $post_arr as $key => $val ) { if ( $key == 'post' || $key == 'page' || ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ) { ?> > {$item_key}[ $key ] ) && $wpmem->{$item_key}[ $key ]['enabled'] == 1 ) { $setting = 1; $ex_len = $wpmem->{$item_key}[ $key ]['length']; $ex_text = ( isset( $wpmem->{$item_key}[ $key ]['text'] ) ) ? $wpmem->{$item_key}[ $key ]['text'] : ''; } else { $setting = 0; $ex_len = ''; $ex_text = ''; } echo wpmem_create_formfield( 'wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting ); ?>           {$item_key}[ $key ] ) ) ? $wpmem->{$item_key}[ $key ] : 0; echo wpmem_create_formfield( 'wpmem_' . $item_key . '_' . $key, 'checkbox', '1', $setting ); ?>

  • {$arr[ $row ][3]} ); ?>  

  • {$arr[$row][3]} ); ?>  
  • attrib ); ?>  
  • captcha ) { $captcha[] = 'reCAPTCHA v1 (deprecated)|1'; } $captcha[] = __( 'reCAPTCHA', 'wp-members' ) . '|3'; $captcha[] = __( 'Really Simple CAPTCHA', 'wp-members' ) . '|2'; echo wpmem_create_formfield( 'wpmem_settings_captcha', 'select', $captcha, $wpmem->captcha ); ?>
  • user_pages['login']; if ( ! $wpmem_logurl ) { $wpmem_logurl = wpmem_use_ssl(); } ?>
  •  
  • user_pages['register']; if ( ! $wpmem_regurl ) { $wpmem_regurl = wpmem_use_ssl(); } ?>
  •  
  • user_pages['profile']; if ( ! $wpmem_msurl ) { $wpmem_msurl = wpmem_use_ssl(); } ?>
  •  
  • cssurl; if ( ! $wpmem_cssurl ) { $wpmem_cssurl = wpmem_use_ssl(); } ?>


$val ) { if ( 'post' != $key && 'page' != $key ) { $checked = ( isset( $wpmem->post_types ) && array_key_exists( $key, $wpmem->post_types ) ) ? ' checked' : ''; echo '
'; } } ?>
true, '_builtin' => false ), 'names', 'and' ); if ( $post_types ) { foreach ( $post_types as $post_type ) { $cpt_obj = get_post_type_object( $post_type ); $post_arr[ $cpt_obj->name ] = $cpt_obj->labels->name; } } $post_vals = ( isset( $_POST['wpmembers_handle_cpts'] ) ) ? $_POST['wpmembers_handle_cpts'] : false; if ( $post_vals ) { foreach ( $post_vals as $val ) { $cpts[ $val ] = $post_arr[ $val ]; } } else { $cpts = array(); } $wpmem_newsettings['post_types'] = $cpts; // Update settings, remove or add CPTs. $chk_settings = array( 'block', 'show_excerpt', 'show_login', 'show_reg', 'autoex' ); foreach ( $chk_settings as $chk ) { // Handle removing unmanaged CPTs. foreach ( $wpmem_newsettings[ $chk ] as $key => $val ) { if ( 'post' != $key && 'page' != $key ) { // If the $key is not in managed CPTs, remove it. if ( ! array_key_exists( $key, $cpts ) ) { unset( $wpmem_newsettings[ $chk ][ $key ] ); } } } // Handle adding managed CPTs. foreach ( $cpts as $key => $val ) { if ( ! array_key_exists( $key, $wpmem_newsettings[ $chk ] ) ) { if ( 'autoex' == $chk ) { // Auto excerpt is an array. $wpmem_newsettings[ $chk ][ $key ] = array( 'enabled' => 0, 'length' => '', ); } else { // All other settings are 0|1. $wpmem_newsettings[ $chk ][ $key ] = 0; } } } } wpmem_admin_new_settings( $wpmem_newsettings ); return __( 'Custom Post Type settings were updated', 'wp-members' ); } /** * Updates the plugin options. * * @since 2.8.0 * * @global object $wpmem The WP_Members object. * @return string The options updated message. */ function wpmem_update_options() { global $wpmem; // Check nonce. check_admin_referer( 'wpmem-update-settings' ); $wpmem_settings_msurl = ( $_POST['wpmem_settings_mspage'] == 'use_custom' ) ? $_POST['wpmem_settings_msurl'] : ''; $wpmem_settings_mspage = ( $_POST['wpmem_settings_mspage'] == 'use_custom' ) ? '' : $_POST['wpmem_settings_mspage']; if ( $wpmem_settings_msurl != wpmem_use_ssl() && $wpmem_settings_msurl != 'use_custom' && ! $wpmem_settings_mspage ) { $msurl = trim( $wpmem_settings_msurl ); } else { $msurl = $wpmem_settings_mspage; } $wpmem_settings_regurl = ( $_POST['wpmem_settings_regpage'] == 'use_custom' ) ? $_POST['wpmem_settings_regurl'] : ''; $wpmem_settings_regpage = ( $_POST['wpmem_settings_regpage'] == 'use_custom' ) ? '' : $_POST['wpmem_settings_regpage']; if ( $wpmem_settings_regurl != wpmem_use_ssl() && $wpmem_settings_regurl != 'use_custom' && ! $wpmem_settings_regpage ) { $regurl = trim( $wpmem_settings_regurl ); } else { $regurl = $wpmem_settings_regpage; } $wpmem_settings_logurl = ( $_POST['wpmem_settings_logpage'] == 'use_custom' ) ? $_POST['wpmem_settings_logurl'] : ''; $wpmem_settings_logpage = ( $_POST['wpmem_settings_logpage'] == 'use_custom' ) ? '' : $_POST['wpmem_settings_logpage']; if ( $wpmem_settings_logurl != wpmem_use_ssl() && $wpmem_settings_logurl != 'use_custom' && ! $wpmem_settings_logpage ) { $logurl = trim( $wpmem_settings_logurl ); } else { $logurl = $wpmem_settings_logpage; } $wpmem_settings_cssurl = $_POST['wpmem_settings_cssurl']; $cssurl = ( $wpmem_settings_cssurl != wpmem_use_ssl() ) ? trim( $wpmem_settings_cssurl ) : ''; $wpmem_settings_style = ( isset( $_POST['wpmem_settings_style'] ) ) ? $_POST['wpmem_settings_style'] : false; $wpmem_newsettings = array( 'version' => WPMEM_VERSION, 'notify' => wpmem_get( 'wpmem_settings_notify', 0 ), 'mod_reg' => wpmem_get( 'wpmem_settings_moderate', 0 ), 'captcha' => wpmem_get( 'wpmem_settings_captcha', 0 ), 'use_exp' => wpmem_get( 'wpmem_settings_time_exp', 0 ), 'use_trial' => wpmem_get( 'wpmem_settings_trial', 0 ), 'warnings' => wpmem_get( 'wpmem_settings_ignore_warnings', 0 ), 'user_pages' => array( 'profile' => ( $msurl ) ? $msurl : '', 'register' => ( $regurl ) ? $regurl : '', 'login' => ( $logurl ) ? $logurl : '', ), 'cssurl' => ( $cssurl ) ? $cssurl : '', 'style' => $wpmem_settings_style, 'attrib' => wpmem_get( 'attribution', 0 ), ); // Build an array of post types $post_arr = array( 'post', 'page' ); if ( isset( $wpmem->post_types ) ) { $wpmem_newsettings['post_types'] = $wpmem->post_types; foreach ( $wpmem_newsettings['post_types'] as $key => $val ) { $post_arr[] = $key; } } // Leave form tag settings alone. if ( isset( $wpmem->form_tags ) ) { $wpmem_newsettings['form_tags'] = $wpmem->form_tags; } // Leave email settings alone. if ( isset( $wpmem->email ) ) { $wpmem_newsettings['email'] = $wpmem->email; } // Get settings for blocking, excerpts, show login, and show registration for posts, pages, and custom post types. $option_group_array = array( 'block', 'show_excerpt', 'show_login', 'show_reg', 'autoex' ); foreach ( $option_group_array as $option_group_item ) { $arr = array(); foreach ( $post_arr as $post_type ) { $post_var = 'wpmem_' . $option_group_item . '_' . $post_type; if ( $option_group_item == 'autoex' ) { // Auto excerpt is an array. $arr[ $post_type ]['enabled'] = ( isset( $_POST[ $post_var ] ) ) ? $_POST[ $post_var ] : 0; $arr[ $post_type ]['length'] = ( isset( $_POST[ $post_var . '_len' ] ) ) ? ( ( $_POST[ $post_var . '_len' ] == '' ) ? 0 : $_POST[ $post_var . '_len' ] ) : ''; $arr[ $post_type ]['text'] = ( isset( $_POST[ $post_var . '_text' ] ) ) ? $_POST[ $post_var . '_text' ] : ''; } else { // All other settings are 0|1. $arr[ $post_type ] = ( isset( $_POST[ $post_var ] ) ) ? $_POST[ $post_var ] : 0; } } $wpmem_newsettings[ $option_group_item ] = $arr; } /* * If we are setting registration to be moderated, * check to see if the current admin has been * activated so they don't accidentally lock themselves * out later. */ if ( isset( $_POST['wpmem_settings_moderate'] ) == 1 ) { global $current_user; wp_get_current_user(); $user_ID = $current_user->ID; update_user_meta( $user_ID, 'active', 1 ); } wpmem_admin_new_settings( $wpmem_newsettings ); return __( 'WP-Members settings were updated', 'wp-members' ); } /** * Puts new settings into the current object. * * @since 3.0.9 * * @global $wpmem * @param $new * @return $settings */ function wpmem_admin_new_settings( $new ) { // Update saved settings. update_option( 'wpmembers_settings', $new ); // Update the current WP_Members object with the new settings. global $wpmem; foreach ( $new as $key => $val ) { if ( 'user_pages' == $key ) { foreach ( $val as $subkey => $subval ) { $val[ $subkey ] = ( is_numeric( $subval ) ) ? get_page_link( $subval ) : $subval; } } $wpmem->$key = $val; } } /** * Create the stylesheet dropdown selection. * * @since 2.8 * * @param $style string The stored stylesheet setting. */ function wpmem_admin_style_list( $style ) { $list = array( 'No Float' => WPMEM_DIR . 'css/generic-no-float.css', 'Rigid' => WPMEM_DIR . 'css/generic-rigid.css', 'Twenty Sixteen - no float' => WPMEM_DIR . 'css/wp-members-2016-no-float.css', 'Twenty Fifteen' => WPMEM_DIR . 'css/wp-members-2015.css', 'Twenty Fifteen - no float' => WPMEM_DIR . 'css/wp-members-2015-no-float.css', 'Twenty Fourteen' => WPMEM_DIR . 'css/wp-members-2014.css', 'Twenty Fourteen - no float' => WPMEM_DIR . 'css/wp-members-2014-no-float.css', 'Twenty Thirteen' => WPMEM_DIR . 'css/wp-members-2013.css', 'Twenty Twelve' => WPMEM_DIR . 'css/wp-members-2012.css', 'Twenty Eleven' => WPMEM_DIR . 'css/wp-members-2011.css', 'Twenty Ten' => WPMEM_DIR . 'css/wp-members.css', //'Kubrick' => WPMEM_DIR . 'css/wp-members-kubrick.css', ); /** * Filters the list of stylesheets in the plugin options dropdown. * * @since 2.8.0 * * @param array $list An array of stylesheets that can be applied to the plugin's forms. */ $list = apply_filters( 'wpmem_admin_style_list', $list ); $selected = false; foreach ( $list as $name => $location ) { $selected = ( $location == $style ) ? true : $selected; echo '\n"; } $selected = ( ! $selected ) ? ' selected' : ''; echo ''; return; } /** * Create a dropdown selection of pages. * * @since 2.8.1 * @todo Consider wp_dropdown_pages. Can be retrieved as HTML (echo=false) and str_replaced to add custom values. * * @param string $val */ function wpmem_admin_page_list( $val, $show_custom_url = true ) { $selected = ( $val == 'http://' || $val == 'https://' ) ? 'select a page' : false; $pages = get_pages(); echo ''; foreach ( $pages as $page ) { $selected = ( get_page_link( $page->ID ) == $val ) ? true : $selected; //echo "VAL: " . $val . ' PAGE LINK: ' . get_page_link( $page->ID ); $option = ''; echo $option; } if ( $show_custom_url ) { $selected = ( ! $selected ) ? ' selected' : ''; echo ''; } } // End of file.