本文整理汇总了PHP中Options::get_group方法的典型用法代码示例。如果您正苦于以下问题:PHP Options::get_group方法的具体用法?PHP Options::get_group怎么用?PHP Options::get_group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::get_group方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_init
public function action_init()
{
$options = array_merge(array('privatekey' => '', 'publickey' => '', 'email' => ''), Options::get_group('linkit'));
foreach ($options as $name => $value) {
$this->{$name} = $value;
}
}
示例2: SitemapBuild
public function SitemapBuild()
{
//return cached sitemap if exsist
if (Cache::has('sitemap')) {
$xml = Cache::get('sitemap');
} else {
$types = Options::get_group(__CLASS__);
//..or generate a new one
$xml = '<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="' . $this->get_url() . '/sitemap.xsl"?><urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"></urlset>';
$xml = new SimpleXMLElement($xml);
if (array_key_exists('any', $types) && $types['any'] || empty($types)) {
// Retrieve all published content, regardless of the type
$content['any'] = Posts::get(array('content_type' => 'any', 'status' => 'published', 'nolimit' => 1));
} else {
// Retreive all published content for select content types
$content['posts'] = Posts::get(array('content_type' => array_keys($types, 1), 'status' => 'published', 'nolimit' => 1));
}
// Add the index page first
$url = $xml->addChild('url');
$url_loc = $url->addChild('loc', Site::get_url('habari'));
// Generate the `<url>`, `<loc>`, `<lastmod>` markup for each post and page.
foreach ($content as $entries) {
foreach ($entries as $entry) {
$url = $xml->addChild('url');
$url_loc = $url->addChild('loc', $entry->permalink);
$url_lastmod = $url->addChild('lastmod', $entry->updated->get('c'));
}
}
$xml = $xml->asXML();
Cache::set('sitemap', $xml);
}
return $xml;
}
示例3: test_getGroup
public function test_getGroup()
{
$options_in = array('foo', 'bar', 'baz');
foreach ($options_in as $option) {
Options::set($this->prefix . $option, strrev($option));
}
$options_out = Options::get_group($this->prefix);
$this->assert_true(is_array($options_out), 'Retrieving option group should return an array.');
foreach ($options_in as $option_in) {
$this->assert_true(array_key_exists($option_in, $options_out), 'Returned array should contain named option.');
}
// Clean up
foreach ($options_in as $option) {
Options::delete($this->prefix . $option);
}
}
示例4: add_template_vars
/**
* Add some variables to the template output
*/
public function add_template_vars()
{
parent::add_template_vars();
// Use theme options to set values that can be used directly in the templates
$opts = Options::get_group(__CLASS__);
$this->assign('show_title_image', $opts['show_title_image']);
$this->assign('home_label', $opts['home_label']);
$this->assign('show_powered', $opts['show_powered']);
$this->assign('display_login', $opts['display_login']);
$this->assign('tags_in_multiple', $opts['tags_in_multiple']);
$this->assign('post_class', 'post' . (!$opts['show_entry_paperclip'] ? ' alt' : ''));
$this->assign('page_class', 'post' . (!$opts['show_page_paperclip'] ? ' alt' : ''));
$this->assign('show_post_nav', $opts['show_post_nav']);
$this->assign('loggedin', User::identify()->loggedin);
$locale = Options::get('locale');
if ($this->get_url($locale . '.css')) {
$this->assign('localized_css', $locale . '.css');
} else {
$this->assign('localized_css', false);
}
if ($opts['show_title_image']) {
if ($this->get_url('images.' . $locale . '/title-image.png')) {
$this->assign('title_image', 'images.' . $locale . '/title-image.png');
} else {
if ($this->get_url('images/title-image.png')) {
$this->assign('title_image', 'images/title-image.png');
} else {
$this->assign('title_image', 'images/sample-title.png');
}
}
}
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get('page_list'));
}
$this->assign('post_id', isset($this->post) && $this->post->content_type == Post::type('page') ? $this->post->id : 0);
if (is_object($this->request) && $this->request->display_entries_by_tag) {
if (count($this->include_tag) && count($this->exclude_tag) == 0) {
$this->tags_msg = _t('Displaying posts tagged: %s', array(Format::tag_and_list($this->include_tag)));
} else {
if (count($this->exclude_tag) && count($this->include_tag) == 0) {
$this->tags_msg = _t('Displaying posts not tagged: %s', array(Format::tag_and_list($this->exclude_tag)));
} else {
$this->tags_msg = _t('Displaying posts tagged: %s and not %s', array(Format::tag_and_list($this->include_tag), Format::tag_and_list($this->exclude_tag)));
}
}
}
}
示例5: testGetGroup
public function testGetGroup()
{
$options_in = array('foo', 'bar', 'baz');
foreach ( $options_in as $option ) {
Options::set($this->prefix.$option, strrev($option));
}
$options_out = Options::get_group($this->prefix);
$this->assertType('array', $options_out, 'Retrieving option group should return an array.');
foreach ( $options_in as $option_in ) {
$this->assertArrayHasKey($option_in, $options_out, 'Returned array should contain named option.');
}
// Clean up
foreach ( $options_in as $option ) {
Options::delete($this->prefix.$option);
}
}
示例6: add_template_vars
/**
* Add some variables to the template output
*/
public function add_template_vars()
{
// Use theme options to set values that can be used directly in the templates
$opts = Options::get_group(__CLASS__);
$this->assign('show_title_image', $opts['show_title_image']);
$this->assign('home_label', $opts['home_label']);
$this->assign('show_powered', $opts['show_powered']);
$this->assign('display_login', $opts['display_login']);
$this->assign('tags_in_multiple', $opts['tags_in_multiple']);
$this->assign('post_class', 'post' . (!$opts['show_entry_paperclip'] ? ' alt' : ''));
$this->assign('page_class', 'post' . (!$opts['show_page_paperclip'] ? ' alt' : ''));
$this->assign('show_post_nav', $opts['show_post_nav']);
$this->assign('loggedin', User::identify()->loggedin);
$locale = Options::get('locale');
if (file_exists(Site::get_dir('theme', true) . $locale . '.css')) {
$this->assign('localized_css', $locale . '.css');
} else {
$this->assign('localized_css', false);
}
if (!$this->template_engine->assigned('pages')) {
$this->assign('pages', Posts::get(array('content_type' => 'page', 'status' => 'published', 'nolimit' => 1)));
}
$this->assign('post_id', isset($this->post) && $this->post->content_type == Post::type('page') ? $this->post->id : 0);
if ($this->request->display_entries_by_tag) {
if (count($this->include_tag) && count($this->exclude_tag) == 0) {
$this->tags_msg = _t('Displaying posts tagged: %s', array(Format::tag_and_list($this->include_tag)));
} else {
if (count($this->exclude_tag) && count($this->include_tag) == 0) {
$this->tags_msg = _t('Displaying posts not tagged: %s', array(Format::tag_and_list($this->exclude_tag)));
} else {
$this->tags_msg = _t('Displaying posts tagged: %s and not %s', array(Format::tag_and_list($this->include_tag), Format::tag_and_list($this->exclude_tag)));
}
}
}
// Add FormUI template placing the input before the label
$this->add_template('charcoal_text', dirname(__FILE__) . '/formcontrol_text.php');
}
示例7: action_init
/**
* Initializes the action
*
* Executed upon script execution, and initiates several conditions and variables including:
*
* - Templates (options_view and options_edit)
* - $this->class_name : lowercase
* - $this->opts_core : a hard coded list of habari core options. Likely NOT complete
* - $this->opts_local : the options created by this plugin
*
* @return void
*/
public function action_init()
{
$this->add_template('options_view', dirname($this->get_file()) . '/options-view.php');
$this->add_template('options_edit', dirname($this->get_file()) . '/options-edit.php');
$this->class_name = strtolower(get_class($this));
// @todo better way to determine this? most likely
$this->opts_core = array('235381938', 'about', 'active_plugins', 'atom_entries', 'base_url', 'cron_running', 'comments_require_id', 'dash_available_modules', 'dateformat', 'db_version', 'db_upgrading', 'failed_plugins', 'GUID', 'import_errors', 'installed', 'import_errors', 'locale', 'log_backtraces', 'next_cron', 'pagination', 'plugins_present', 'system_locale', 'tagline', 'title', 'timeformat', 'timezone', 'theme_name', 'theme_dir', 'undelete__style');
// Note: This strips the group prefix, so returns allow_delete_core and allow_delete_other
$this->opts_local = Options::get_group($this->class_name);
}
示例8: load_options
private function load_options()
{
$this->options = Options::get_group('recaptcha');
$this->ready = empty($this->options['public_key']) || empty($this->options['private_key']) ? false : true;
}
示例9: action_init
public function action_init()
{
include 'vendor/php-typography/php-typography.php';
include 'vendor/TypographyFormat.php';
$opts = Options::get_group('typography');
$typo = new phpTypography();
// general attributes
$typo->set_tags_to_ignore($opts['tags_to_ignore']);
$typo->set_classes_to_ignore($opts['classes_to_ignore']);
$typo->set_ids_to_ignore($opts['ids_to_ignore']);
// smart characters
$typo->set_smart_quotes($opts['smart_quotes']);
$typo->set_smart_quotes_primary($opts['smart_quotes_primary']);
$typo->set_smart_quotes_secondary($opts['smart_quotes_secondary']);
$typo->set_smart_dashes($opts['smart_dashes']);
$typo->set_smart_ellipses($opts['smart_ellipses']);
$typo->set_smart_diacritics($opts['smart_diacritics']);
$typo->set_diacritic_language($opts['diacritic_language']);
$typo->set_diacritic_custom_replacements($opts['diacritic_custom_replacements']);
$typo->set_smart_marks($opts['smart_marks']);
$typo->set_smart_ordinal_suffix($opts['smart_ordinal_suffix']);
$typo->set_smart_math($opts['smart_math']);
$typo->set_smart_fractions($opts['smart_fractions']);
$typo->set_smart_exponents($opts['smart_exponents']);
// smart spacing
$typo->set_single_character_word_spacing($opts['single_character_word_spacing']);
$typo->set_fraction_spacing($opts['fraction_spacing']);
$typo->set_unit_spacing($opts['unit_spacing']);
$typo->set_units($opts['units']);
$typo->set_dash_spacing($opts['dash_spacing']);
$typo->set_dewidow($opts['dewidow']);
$typo->set_max_dewidow_length($opts['max_dewidow_length']);
$typo->set_max_dewidow_pull($opts['max_dewidow_pull']);
$typo->set_wrap_hard_hyphens($opts['wrap_hard_hyphens']);
$typo->set_url_wrap($opts['url_wrap']);
$typo->set_email_wrap($opts['email_wrap']);
$typo->set_min_after_url_wrap($opts['min_after_url_wrap']);
$typo->set_space_collapse($opts['space_collapse']);
// character styling
$typo->set_style_ampersands($opts['style_ampersands']);
$typo->set_style_caps($opts['style_caps']);
$typo->set_style_initial_quotes($opts['style_initial_quotes']);
$typo->set_style_numbers($opts['style_numbers']);
$typo->set_initial_quote_tags($opts['initial_quote_tags']);
// hyphenation
$typo->set_hyphenation($opts['hyphenation']);
$typo->set_hyphenation_language($opts['hyphenation_language']);
$typo->set_min_length_hyphenation($opts['min_length_hyphenation']);
$typo->set_min_before_hyphenation($opts['min_before_hyphenation']);
$typo->set_min_after_hyphenation($opts['min_after_hyphenation']);
$typo->set_hyphenate_headings($opts['hyphenate_headings']);
$typo->set_hyphenate_all_caps($opts['hyphenate_all_caps']);
$typo->set_hyphenate_title_case($opts['hyphenate_title_case']);
$typo->set_hyphenation_exceptions($opts['hyphenation_exceptions']);
$this->typo = $typo;
}
示例10: action_theme_ui
/**
* function action_theme_ui
* Create and display the Theme configuration
**/
public function action_theme_ui()
{
$opts = Options::get_group( __CLASS__ );
if ( empty( $opts ) ) {
Options::set_group( __CLASS__, $this->defaults );
}
$controls = array();
$controls['home_label'] = array(
'label' => _t('Home tab label:'),
'type' => 'text'
);
$controls['login_display_location'] = array(
'label' => _t('Login display:'),
'type' => 'select',
'options' => array(
'nowhere' => _t( 'Nowhere' ),
'header' => _t( 'As a navigation tab' ),
'sidebar' => _t( 'In the sidebar' )
)
);
$controls['show_author'] = array(
'label' => _t( 'Display author:' ),
'type' => 'checkbox',
);
$ui = new FormUI( strtolower( get_class( $this ) ) );
$wrapper = $ui->append( 'wrapper', 'k2config', 'k2config' );
$wrapper->class = "settings clear";
foreach ( $controls as $option_name => $option ) {
$field = $wrapper->append( $option['type'], $option_name, __CLASS__. '__' . $option_name, $option['label'] );
$field->template = 'optionscontrol_' . $option['type'];
$field->class = "item clear";
if ( $option['type'] === 'select' and isset( $option['options'] ) ) {
$field->options = $option['options'];
}
}
$ui->append( 'submit', 'save', _t( 'Save' ) );
$ui->on_success( array( $this, 'config_updated') );
$ui->out();
}
示例11: load_options
private function load_options()
{
$this->options = Options::get_group('keywords');
}
示例12: theme_twitter
/**
* Add last Twitter status, time, and image to the available template vars
* @param Theme $theme The theme that will display the template
**/
public function theme_twitter($theme)
{
$twitter = Options::get_group('twitter');
$theme->tweets = $this->tweets($twitter['username'], $twitter['hide_replies'], $twitter['limit'], $twitter['cache'], $twitter['linkify_urls'], $twitter['hashtags_query']);
return $theme->fetch('tweets');
}
示例13: action_handler_display_photoblog_js
public function action_handler_display_photoblog_js($handler_vars)
{
$options = Options::get_group('pb');
header("content-type: application/x-javascript");
include 'photoblog.js.php';
exit;
}