コード例 #1
0
function amr_meta_overview_page()
{
    /* the main setting spage  - num of lists and names of lists */
    global $amain;
    global $aopt;
    if (empty($amain)) {
        $amain = ausers_get_option('amr-users-main');
    }
    //amr_meta_main_admin_header('Overview of configured user lists'.' '.AUSERS_VERSION);
    amr_meta_admin_headings($plugin_page = '');
    // does the nonce check etc
    if (isset($_POST['import-list'])) {
        amr_meta_handle_import();
    } elseif (isset($_POST['action']) and $_POST['action'] == "save") {
        if (!empty($_POST['reset'])) {
            amr_meta_reset();
            return;
        } elseif (isset($_POST['export-list'])) {
            amr_meta_handle_export();
        } else {
            amrmeta_validate_overview();
        }
    } else {
        amr_handle_copy_delete();
    }
    if (!ameta_cache_enable() or !ameta_cachelogging_enable()) {
        echo '<h2>' . __('Problem creating DB tables', 'amr-users') . '</h2>';
    }
    if (!isset($amain['checkedpublic'])) {
        echo '<input type="hidden" name="checkedpublic" value="true"/>';
    }
    echo '<h2>' . __('Overview &amp; tools', 'amr-users') . '</h2>';
    echo PHP_EOL . '<div class="wrap"><!-- one wrap -->' . PHP_EOL;
    if (!isset($amain['names'])) {
        echo '<h2>' . __('There is a problem - Some overview list settings got lost somehow.  Try reset options.', 'amr-users') . '</h2>';
    } else {
        amr_meta_overview_onelist_headings();
        amr_meta_overview_onelist_headings_middle();
        foreach ($amain['names'] as $i => $name) {
            //for ($i = 1; $i <= $amain['no-lists']; $i++)	{
            amr_meta_overview_onelist_settings($i);
            echo '</tr>';
        }
        amr_meta_overview_onelist_headings_end();
    }
    echo '</div><!-- end of one wrap --> <br />' . PHP_EOL;
    //echo '<div style="clear: both; float:right; padding-right:100px;" class="submit">';
    echo ausers_submit();
    echo '<input class="button-primary" type="submit" name="addnew" value="' . __('Add new', 'amr-users') . '" />';
    amr_list_export_form();
    echo ausers_form_end();
    amr_list_import_form();
    // different form
}
コード例 #2
0
function amr_meta_general_page_display()
{
    global $amain;
    //amr_mimic_meta_box('related', 'Related plugins','amru_related', true);
    if (empty($amain)) {
        $amain = ausers_get_option('amr-users-main');
    }
    if (empty($amain['csv_text'])) {
        $amain['csv_text'] = '<img src="' . plugins_url('amr-users/images/file_export.png') . '" alt="' . __('Csv', 'amr-users') . '"/>';
    }
    if (empty($amain['refresh_text'])) {
        $amain['refresh_text'] = '<img src="' . plugins_url('amr-users/images/rebuild.png') . '" alt="' . __('Refresh user list cache', 'amr-users') . '"/>';
    }
    if (empty($amain['noaccess_text'])) {
        $amain['noaccess_text'] = __('You do not have access to this list, or are not logged in.', 'amr-users');
    }
    if (!isset($amain['checkedpublic'])) {
        echo '<input type="hidden" name="checkedpublic" value="true"/>';
    }
    if (isset($amain['do_not_use_css']) and $amain['do_not_use_css']) {
        $do_not_use_css = ' checked="checked" ';
    } else {
        $do_not_use_css = '';
    }
    echo PHP_EOL . '<div class="clear wrap">';
    amr_users_say_thanks_opportunity_form();
    echo '<br />';
    echo '<h3>';
    _e('How to fetch data?', 'amr-users');
    echo '</h3><input type="radio"  name="use_wp_query" value="1" ';
    if (!empty($amain['use_wp_query'])) {
        echo ' checked="checked" ';
    }
    echo '> ';
    _e('Fetch user data with wp_query? &nbsp; ', 'amr-users');
    echo ' <em>';
    _e('WordPress does some extra work which requires more memory', 'amr-users');
    echo '</em>';
    echo '<br />';
    //	echo '</label>';
    //	echo '<label for="use_wp_query">';
    echo '<input type="radio"  name="use_wp_query" value="0" ';
    if (empty($amain['use_wp_query'])) {
        echo ' checked="checked" ';
    }
    echo '> ';
    _e('Fetch user data directly? &nbsp; ', 'amr-users');
    echo ' <em>';
    _e('This seems to use less memory, better for very large databases.', 'amr-users');
    echo '</em>';
    echo '<br /><br />';
    //echo '</label>';
    echo '<h3 id="general">' . __('General & Styling', 'amr-users') . '</h3>';
    echo '<label for="do_not_use_css">';
    _e('No css ', 'amr-users');
    echo '</label>
			<input type="checkbox" size="2" id="do_not_use_css" 
					name="do_not_use_css" ';
    echo empty($amain['do_not_use_css']) ? '' : ' checked="checked" ';
    echo '/>';
    echo '<em> ';
    _e('Do not use css provided, my theme css is good enough', 'amr-users');
    echo '</em>';
    echo '<br /><br />';
    if (!empty($amain['do_not_use_css'])) {
        $disabled = ' disabled="disabled" ';
    } else {
        $disabled = '';
    }
    echo '<label for="use_css_on_pages">';
    _e('Use css on these pages only ', 'amr-users');
    echo ' <em>';
    _e('(Else all if using css)', 'amr-users');
    _e('(comma separated integers)', 'amr-users');
    echo ' </em>';
    echo '</label><br />
			<input ' . ' type="text" size="130" id="use_css_on_pages" 
					name="use_css_on_pages" ';
    echo empty($amain['use_css_on_pages']) ? '' : ' value="' . $amain['use_css_on_pages'] . '" ';
    echo '/><br /><br />';
    echo PHP_EOL . '<label for="csv_text">';
    _e('Text for csv link', 'amr-users');
    echo ' <em>';
    _e('(May be plain text or an icon link)', 'amr-users');
    echo ' </em>';
    echo '</label><br />' . PHP_EOL . '<input type="text" size="130" id="csv_text" 
					name="csv_text" value="';
    echo esc_attr($amain['csv_text']);
    echo '"/>' . ' ' . __('Preview:', 'amr-users') . ' ' . '<a href="#" title="' . __('This will be a link', 'amr-users') . '" >' . $amain['csv_text'] . '</a>';
    echo '<br /><br />' . PHP_EOL . '<label for="refresh_text">';
    _e('Text for cache refresh link', 'amr-users');
    echo '</label><br />' . PHP_EOL . '<input type="text" size="130" id="refresh_text" 
					name="refresh_text" value="';
    echo esc_attr($amain['refresh_text']);
    echo '"/>' . ' ' . __('Preview:', 'amr-users') . ' ' . '<a href="#" title="' . __('This will be a link', 'amr-users') . '" >' . $amain['refresh_text'] . '</a>';
    echo '<br /><br />' . PHP_EOL . '<label for="noaccess_text">';
    _e('Message when user does not have access or not logged in.', 'amr-users');
    echo '</label><br />';
    echo '<textarea rows="5" cols="130" id="noaccess_text" 
					name="noaccess_text" />';
    echo esc_attr($amain['noaccess_text']);
    echo '</textarea>';
    echo '<br /><br />
			<label for="rows_per_page">';
    _e('Default rows per page:', 'amr-users');
    echo '</label><br />
			<input type="text" size="2" id="rows_per_page" 
					name="rows_per_page" value="';
    echo empty($amain['rows_per_page']) ? 50 : $amain['rows_per_page'];
    echo '"/><br /><br />
			<label for="avatar_size">';
    _e('Avatar size:', 'amr-users');
    echo ' 20,40, 80, 160, 200 </label>' . '<a title="gravatar size info" href="http://en.gravatar.com/site/implement/images/">' . __('Info', 'amr-users') . '</a>' . '<br />
			<input type="text" size="2" id="avatar_size" 
					name="avatar_size" value="';
    echo empty($amain['avatar_size']) ? '' : $amain['avatar_size'];
    // because it is new and I hate notices
    echo '"/>';
    echo ausers_submit();
    echo '<br />' . PHP_EOL . '</div><!-- end of clear wrap -->	' . PHP_EOL . '<div class="clear"> </div>' . PHP_EOL;
}