Пример #1
0
/**
 * Adds few more links in the admin subnavigation
 *
 * @return array
 */
function donut_admin_sub_navigation()
{
    $navigation = array();
    $level = qa_get_logged_in_level();
    if ($level >= QA_USER_LEVEL_ADMIN) {
        $url = 'admin/donut-theme/general-settings';
        $navigation[$url] = array('label' => donut_lang('donut_theme_settings'), 'url' => qa_path_html($url));
    }
    return $navigation;
}
Пример #2
0
 public function admin_form(&$qa_content)
 {
     $saved = false;
     $error = false;
     if (qa_clicked(self::RESET_BTN)) {
         if (qa_check_form_security_code('donut/admin_options', qa_post_text('code'))) {
             if (donut_reset_all_options()) {
                 $saved = true;
                 qa_opt('donut_defaults_set_ok', 1);
             }
         } else {
             $error = qa_lang_html('admin/form_security_expired');
         }
     }
     $form = array('ok' => $saved ? donut_lang('options_reset') : null, 'fields' => array('simple_note' => array('type' => 'static', 'label' => donut_lang('admin_notes'), 'error' => $error)), 'buttons' => array(array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="' . self::RESET_BTN . '"')), 'hidden' => array('code' => qa_get_form_security_code('donut/admin_options')));
     return $form;
 }
Пример #3
0
/**
 * Return the default value for option $name
 *
 * @param $name
 *
 * @return bool|mixed|string
 */
function donut_default_option($name)
{
    $fixed_defaults = array('donut_activate_prod_mode' => 0, 'donut_use_local_font' => 1, 'donut_enable_top_bar' => 1, 'donut_show_top_social_icons' => 1, 'donut_enable_sticky_header' => 1, 'donut_enable_back_to_top_btn' => 1, 'donut_show_home_page_banner' => 1, 'donut_banner_closable' => 1, 'donut_banner_show_ask_box' => 1, 'donut_show_collapsible_btns' => 1, 'donut_show_breadcrumbs' => 1, 'donut_show_site_stats_above_footer' => 1, 'donut_show_social_links_at_footer' => 1, 'donut_show_copyright_at_footer' => 1, 'donut_show_custom_404_page' => 1, 'donut_copyright_text' => donut_lang('donut_theme'), 'donut_banner_head_text' => donut_lang('donut_discussion_forum'), 'donut_banner_div1_text' => donut_lang('search_answers'), 'donut_banner_div1_icon' => 'fa fa-search-plus', 'donut_banner_div2_text' => donut_lang('one_destination'), 'donut_banner_div2_icon' => 'fa fa-question-circle', 'donut_banner_div3_text' => donut_lang('get_expert_answers'), 'donut_banner_div3_icon' => 'fa fa-check-square-o', 'donut_top_bar_left_text' => donut_lang('responsive_q2a_theme'), 'donut_top_bar_right_text' => donut_lang('ask_us_anything'), 'donut_custom_404_text' => donut_lang('page_not_found_default_text'));
    if (isset($fixed_defaults[$name])) {
        $value = $fixed_defaults[$name];
    } else {
        switch ($name) {
            default:
                // call option_default method in any registered modules
                $modules = qa_load_all_modules_with('option_default');
                // Loads all modules with the 'option_default' method
                foreach ($modules as $module) {
                    $value = $module->option_default($name);
                    if (strlen($value)) {
                        return $value;
                    }
                }
                $value = '';
                break;
        }
    }
    return $value;
}
Пример #4
0
function donut_lang_html($identifier, $subs = null)
{
    return qa_html(donut_lang($identifier, $subs));
}
Пример #5
0
    ?>
">
                        <span class="fa fa-cog"></span>
                        <?php 
    echo qa_lang_html('main/nav_admin');
    ?>
                    </a>
                </li>
                <li>
                    <a href="<?php 
    echo qa_path_html('admin/donut-theme/general-settings');
    ?>
">
                        <span class="fa fa-wrench"></span>
                        <?php 
    echo donut_lang('donut_theme_settings');
    ?>
                    </a>
                </li>
                <li class="dropdown-header">Profile Section</li>
            <?php 
}
?>
            <li>
                <a href="<?php 
echo qa_path_html('user/' . qa_get_logged_in_handle());
?>
">
                    <span class="fa fa-user"></span>
                    <?php 
echo qa_get_logged_in_handle();
Пример #6
0
            if (isset($optionmaximum[$optionname])) {
                $optionvalue = min($optionmaximum[$optionname], $optionvalue);
            }
            if (isset($optionminimum[$optionname])) {
                $optionvalue = max($optionminimum[$optionname], $optionvalue);
            }
            qa_set_option($optionname, $optionvalue);
        }
        $formokhtml = donut_lang_html('options_saved');
    }
}
//	Get the actual options
$options = qa_get_options($getoptions);
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = donut_lang('donut_theme_settings') . ' - ' . donut_lang($subtitle);
$qa_content['error'] = $securityexpired ? qa_lang_html('admin/form_security_expired') : qa_admin_page_error();
$qa_content['script_rel'][] = 'qa-content/qa-admin.js?' . QA_VERSION;
$qa_content['form'] = array('ok' => $formokhtml, 'tags' => 'method="post" action="' . qa_self_html() . '" name="admin_form" onsubmit="document.forms.admin_form.has_js.value=1; return true;"', 'style' => $formstyle, 'fields' => array(), 'buttons' => array('save' => array('tags' => 'id="dosaveoptions"', 'label' => qa_lang_html('admin/save_options_button')), 'reset' => array('tags' => 'name="doresetoptions"', 'label' => qa_lang_html('admin/reset_options_button'))), 'hidden' => array('dosaveoptions' => '1', 'has_js' => '0', 'code' => qa_get_form_security_code('admin/' . $adminsection)));
function qa_optionfield_make_select(&$optionfield, $options, $value, $default)
{
    $optionfield['type'] = 'select';
    $optionfield['options'] = $options;
    $optionfield['value'] = isset($options[qa_html($value)]) ? $options[qa_html($value)] : @$options[$default];
}
$indented = false;
foreach ($showoptions as $optionname) {
    if (empty($optionname)) {
        $indented = false;
        $qa_content['form']['fields'][] = array('type' => 'blank');
    } elseif (strpos($optionname, '/') !== false) {
Пример #7
0
function donut_generate_social_links()
{
    $social_links = array('facebook' => array('icon' => 'facebook', 'text' => donut_lang('facebook'), 'hover-text' => donut_lang('follow_us_on_x', donut_lang('facebook'))), 'twitter' => array('icon' => 'twitter', 'text' => donut_lang('twitter'), 'hover-text' => donut_lang('follow_us_on_x', donut_lang('twitter'))), 'email' => array('icon' => 'envelope', 'text' => donut_lang('email'), 'hover-text' => donut_lang('send_us_an_email')), 'pinterest' => array('icon' => 'pinterest', 'text' => donut_lang('pinterest'), 'hover-text' => donut_lang('follow_us_on_x', donut_lang('pinterest'))), 'google-plus' => array('icon' => 'google-plus', 'text' => donut_lang('google-plus'), 'hover-text' => donut_lang('follow_us_on_x', donut_lang('google-plus'))), 'vk' => array('icon' => 'vk', 'text' => donut_lang('vk'), 'hover-text' => donut_lang('follow_us_on_x', donut_lang('vk'))));
    foreach ($social_links as $key => $s) {
        if ($key == 'email') {
            $address = qa_opt('donut_email_address');
            if (empty($address)) {
                unset($social_links[$key]);
                continue;
            }
            $social_links[$key]['link'] = 'mailto:' . $address;
            continue;
        }
        $url = qa_opt('donut_' . $key . '_url');
        if (empty($url)) {
            unset($social_links[$key]);
            continue;
        }
        $social_links[$key]['link'] = $url;
    }
    return $social_links;
}