/**
  * Outputs the body of the widget.
  *
  * @param array   $args     Widget args.
  * @param array   $instance Widget instance.
  * @param array   $settings Widget settings.
  * @return string The widget body content.
  */
 function widget_body($args, $instance, $settings)
 {
     extract($args);
     extract($settings);
     $admin_only = !isset($show_non_admins) || empty($show_non_admins) || '0' === $show_non_admins;
     $args = array('admin_only' => $admin_only, 'echo' => false, 'return' => false);
     return c2c_RevealTemplate::get_instance()->reveal($template_path_type, $args);
 }
 public function c2c_RevealTemplate()
 {
     // Be a singleton
     if (!is_null(self::$instance)) {
         return;
     }
     parent::__construct('2.3', 'reveal-template', 'c2c', __FILE__, array('settings_page' => 'themes'));
     register_activation_hook(__FILE__, array(__CLASS__, 'activation'));
     self::$instance = $this;
 }
 function test_c2c_reveal_template_arg_format_from_settings()
 {
     apply_filters('category_template', get_stylesheet_directory() . '/category.php');
     $options = c2c_RevealTemplate::get_instance()->get_options();
     $this->assertEquals(str_replace('%template%', 'category.php', $options['format']), c2c_reveal_template(false, 'filename', array('format' => 'Abc (%template%)', 'format_from_settings' => true)));
 }
Exemple #4
0
 /**
  * Returns types of, and descriptions for, the valid template path types.
  *
  * @since 3.0
  *
  * @return array Keys are the template path types, values are the translated descriptions
  */
 public function get_template_path_types()
 {
     if (!self::$template_path_types) {
         self::$template_path_types = array('absolute' => __('Absolute path, e.g. /usr/local/www/yoursite/wp-content/themes/yourtheme/single.php', $this->textdomain), 'relative' => __('Relative path, e.g. wp-content/themes/yourtheme/single.php', $this->textdomain), 'theme-relative' => __('Path relative to themes directory, e.g. yourtheme/single.php', $this->textdomain), 'filename' => __('Filename, e.g. single.php', $this->textdomain));
     }
     return self::$template_path_types;
 }