コード例 #1
0
 /**
  * overloaded
  * Displays a standard plugin settings page in the Settings menu of the WordPress administration interface
  *
  * @see trunk/inc/YD_Plugin#plugin_options()
  */
 public function plugin_options()
 {
     /** reserved to contributors **/
     if (!current_user_can('edit_posts')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     if (class_exists('ydfgOP')) {
         $op = new ydfgOP($this);
     } else {
         $op = new YD_OptionPage($this);
     }
     if ($this->option_page_title) {
         $op->title = $this->option_page_title;
     } else {
         $op->title = __($this->plugin_name, $this->tdomain);
     }
     $op->sanitized_name = $this->sanitized_name;
     $op->yd_logo = '';
     $op->support_url = $this->support_url;
     $op->initial_funding = $this->initial_funding;
     // array( name, url )
     $op->additional_funding = $this->additional_funding;
     // array of arrays
     $op->version = $this->version;
     $op->translations = $this->translations;
     $op->plugin_dir = $this->plugin_dir;
     $op->has_cache = $this->has_cache;
     $op->option_page_text = $this->option_page_text;
     $op->plg_tdomain = $this->tdomain;
     $op->donate_block = $this->op_donate_block;
     $op->credit_block = $this->op_credit_block;
     $op->support_block = $this->op_support_block;
     $this->option_field_labels['disable_backlink'] = 'Disable backlink in the blog footer:';
     $op->option_field_labels = $this->option_field_labels;
     $op->form_add_actions = $this->form_add_actions;
     $op->form_method = $this->form_method;
     if ($_GET['do'] || $_POST['do']) {
         $op->do_action($this);
     }
     $op->header();
     if (class_exists('ydfgOP')) {
         $op->styles();
     }
     $op->option_values = get_option($this->option_key);
     $this->display_page();
     if ($this->has_cron) {
         $op->cron_status($this->crontab);
     }
 }
コード例 #2
0
			public function plugin_options() {
				if ( !current_user_can( 'manage_options' ) )  {
		   			wp_die( __('You do not have sufficient permissions to access this page.') );
		  		}
		  		$op = new YD_OptionPage( $this );
				if ( $this->option_page_title ) {
		  			$op->title = $this->option_page_title;
		  		} else {
		  			$op->title = __( $this->plugin_name, $this->tdomain );
		  		}
		  		$op->sanitized_name = $this->sanitized_name;
		  		$op->yd_logo = '';
		  		$op->support_url = $this->support_url;
		  		$op->initial_funding = $this->initial_funding; // array( name, url )
		  		$op->additional_funding = $this->additional_funding; // array of arrays
		  		$op->version = $this->version;
		  		$op->translations = $this->translations;
		  		$op->plugin_dir = $this->plugin_dir;
		  		$op->has_cache = $this->has_cache;
		  		$op->option_page_text = $this->option_page_text;
		  		$op->plg_tdomain = $this->tdomain;
		  		$op->donate_block = $this->op_donate_block;
				$op->credit_block = $this->op_credit_block;
				$op->support_block = $this->op_support_block;
				$this->option_field_labels['disable_backlink'] = 'Disable backlink in the blog footer:';
		  		$op->option_field_labels = $this->option_field_labels;
		  		$op->form_add_actions = $this->form_add_actions;
		  		$op->form_method =  $this->form_method;
		  		if( $_GET['do'] || $_POST['do'] ) $op->do_action( $this );
		  		$op->header();
		  		$op->option_values = get_option( $this->option_key );
		  		$op->sidebar();
		  		$op->form_header();
		  		/* deprecated with WP 2.7 Settings API
				 * @see http://codex.wordpress.org/Creating_Options_Pages
				 * 
		  		foreach( $this->form_blocks as $block_name => $block_fields ) {
		  			$op->form_block( $block_name, $block_fields );
		  		}
		  		*/
	    		foreach( $this->form_add_actions as $action_name => $action ) {
		  			$op->form_action_button( $action_name, $action );
		  		}
		  		//$op->form_block( 'Other options:', array( 'disable_backlink' => 'bool' ) );
		  		$op->form_footer();
		  		if( $this->has_cron ) $op->cron_status( $this->crontab );
		  		$op->footer();
			}