Exemple #1
0
 /**
  * On theme activation, set the default options and activate a default menu
  */
 public function action_theme_activated()
 {
     $opts = Options::get_group(__CLASS__);
     if (empty($opts)) {
         Options::set_group(__CLASS__, $this->defaults);
     }
     $blocks = $this->get_blocks('nav', 0, $this);
     if (count($blocks) == 0) {
         $block = new Block(array('title' => _t('Charcoal Menu'), 'type' => 'charcoal_menu'));
         $block->add_to_area('nav');
         Session::notice(_t('Added Charcoal Menu block to Nav area.'));
     }
 }
 function action_plugin_activation($file)
 {
     if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
         Options::set_group('recaptcha', array('public_key' => '', 'private_key' => '', 'theme' => 'red'));
     }
 }
Exemple #3
0
	/**
	 * 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();
	}