diff --git a/buena/404.php b/buena/404.php deleted file mode 100644 index 543055f..0000000 --- a/buena/404.php +++ /dev/null @@ -1,96 +0,0 @@ - - - - -> - - - - - - - - - - - -> -
- -
- 'primary', 'depth' => 2, 'container' => 'nav', 'container_class' => 'nav-menu' ] ); ?> - - - -
-
- - - '' ] ); ?> - - - -
-

-
- - - -
-

-
- -
-
-
- - - - - -
- -
- -
- - -
-
- - - - - - diff --git a/buena/comments.php b/buena/comments.php deleted file mode 100644 index 3669590..0000000 --- a/buena/comments.php +++ /dev/null @@ -1,27 +0,0 @@ -%s

', __( 'Kommentare werden erst angezeigt, wenn das Kennwort eingegeben wurde.', 'buena-theme' ) ); - return; -} - -// FIXME: Hier sollten die Social-Media-Knöpfe auftauchen… - -?> -
- -

- - - - - - -

- -
diff --git a/buena/content.php b/buena/content.php deleted file mode 100644 index 54689ca..0000000 --- a/buena/content.php +++ /dev/null @@ -1,17 +0,0 @@ -
> - - -

- '' ) ); ?> - - - '' ] ); ?> - -
-

-
- -
- - -
diff --git a/buena/functions.php b/buena/functions.php deleted file mode 100644 index ac7df51..0000000 --- a/buena/functions.php +++ /dev/null @@ -1,89 +0,0 @@ -= 50400 ) { - // Register autoloader if updater plugin missing - if ( ! class_exists( 'plugins\buena\use\shy-wordpress\src\Shy\WordPress\Theme' ) ) { - if ( ! include_once __DIR__ . '/use/shy-wordpress/src/autoloader.php' ) { - trigger_pfadfinden_plugin_error( - __( 'Das Theme ist unvollständig und konnte nicht geladen werden. Neuinstallation müsste helfen.', 'buena-theme' ), - E_USER_ERROR - ); - return; - } - } - - // Register our autoloader - if ( ! include_once __DIR__ . '/src/autoloader.php' ) { - trigger_pfadfinden_plugin_error( - __( 'Das Theme ist unvollständig und konnte nicht geladen werden. Neuinstallation müsste helfen.', 'buena-theme' ), - E_USER_ERROR - ); - return; - } - - /** - * @return \plugins\buena\src\Pfadfinden\WordPress\BuenaTheme - */ - function buena_get_theme() - { - static $theme = null; - if (!$theme) { - $theme = new ReflectionClass( 'plugins\buena\src\Pfadfinden\WordPress\BuenaTheme' ); - $theme = $theme->newInstance(); - } - - return $theme; - } - - /** - * @param string $method - * @return callable - */ - function buena_get_callback( $method ) - { - return array( buena_get_theme(), (string) $method ); - } - - return buena_get_theme(); -} - - -// Display error message -trigger_pfadfinden_plugin_error( - sprintf( - __( 'You need at least PHP 5.4 to use the Buena theme. Your are using %s.', 'buena-theme' ), - PHP_VERSION - ), - E_USER_ERROR -); diff --git a/buena/index.php b/buena/index.php deleted file mode 100644 index c823787..0000000 --- a/buena/index.php +++ /dev/null @@ -1,106 +0,0 @@ - - - - -> - - - - - - - - - - - - - -> -
- -
- 'primary', 'depth' => 2, 'container' => 'nav', 'container_class' => 'nav-menu nav-menu-primary' ] ); ?> - - - -
- getTeaserImage() ): ?> -
- -
-

printTitle(); ?>

-
-
- -
-

printTitle(); ?>

-
- -
-
- - - - - -
- -
- -
- - -
-
- - - - - diff --git a/buena/searchform.php b/buena/searchform.php deleted file mode 100644 index 16ba18d..0000000 --- a/buena/searchform.php +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/buena/src/autoloader.php b/buena/src/autoloader.php deleted file mode 100644 index d09cc39..0000000 --- a/buena/src/autoloader.php +++ /dev/null @@ -1,19 +0,0 @@ -slug; - } - - - protected function __construct( $slug ) - { - $this->slug = (string) $slug; - - $this->addHookMethod( 'default_option_' . $this->slug, 'getDefaults' ); - } - - - /** - * Return default values for all suboptions. - * Hooked into get_option() defaults. - * - * @return array - */ - abstract public function getDefaults(); - - /** - * @param string $offset - * @return mixed - */ - public function getDefault( $offset ) - { - return $this->getDefaults()[ $offset ]; - } - - - public function offsetExists( $offset ) - { - $settings = get_option( $this->slug ); - return isset( $settings[ $offset ] ); - } - - public function offsetGet( $offset ) - { - $settings = get_option( $this->slug ); - if ( ! isset( $settings[ $offset ] ) ) { - throw new \OutOfBoundsException( "There is no setting '$offset'." ); - } - - return $settings[ $offset ]; - } - - public function offsetSet( $offset, $value ) - { - $settings = get_option( $this->slug ); - if ( ! isset( $settings[ $offset ] ) ) { - throw new \OutOfBoundsException( "There is no setting '$offset'." ); - } - - $settings[ $offset ] = $value; - update_option( $this->slug, $settings ); - } - - public function offsetUnset( $offset ) - { - throw new \BadMethodCallException( 'You cannot unset settings.' ); - } - - - public function count() - { - return count( $this->getDefaults() ); - } - - - public function getIterator() - { - return new \ArrayIterator( get_option( $this->slug ) ); - } -} diff --git a/buena/use/shy-wordpress/src/Shy/WordPress/HookableTrait.php b/buena/use/shy-wordpress/src/Shy/WordPress/HookableTrait.php deleted file mode 100644 index e6adc43..0000000 --- a/buena/use/shy-wordpress/src/Shy/WordPress/HookableTrait.php +++ /dev/null @@ -1,35 +0,0 @@ -getPageTitle(); - } - - - /** - * @param string $slug Page slug - * @param string $capability Required capability to view - */ - protected function __construct( $slug, $capability = 'manage_options' ) - { - parent::__construct( $slug ); - - $this->capability = (string) $capability; - - $this->addHookMethod( 'admin_menu', 'registerPage' ); - $this->addHookMethod( 'admin_init', 'registerSettings' ); - } - - public function __toString() - { - return $this->slug; - } - - /** - * Register our options page. - * - * @return void - */ - public function registerPage() - { - add_submenu_page( - $this->getParentSlug(), - $this->getPageTitle(), - $this->getMenuTitle(), - $this->capability, - $this->slug, - array( $this, 'renderPage' ) - ); - } - - /** - * Register the actual settings. - * Override and use addSection() and add*Field() methods. - * - * @return void - */ - public function registerSettings() - { - register_setting( - $this->slug, - $this->slug, - array( $this, 'sanitizeOptions' ) - ); - } - - /** - * Sanitize option values after form submission. - * - * @param array $options - * @return array - */ - abstract public function sanitizeOptions( array $options ); - - - /** - * Section to add fields to. - * - * Parameter default from add_settings_field(). - * - * @var string - */ - protected $currentSection = 'default'; - - /** - * Add a new section and return its generated name. - * - * @param string $title optional, can be empty - * @param string $name optional, will be generated if empty - * @return string - */ - protected function addSection( $title = '', $name = '' ) - { - $name = (string) $name; - if ( ! strlen( $name ) ) { - $name = $this->slug . '-section' . ( count( $this->getSections() ) + 1 ); - } - - add_settings_section( - $name, - esc_html( $title ), - array( $this, 'renderSectionTeaser' ), - $this->slug - ); - - return $this->currentSection = $name; - } - - /** - * Callback before output of section fields. - * - * Teasers must escape their output themselves. - * - * @param array $section { - * @type string $id - * @type string $title - * @type callable $callback - * } - */ - public function renderSectionTeaser( array $section ) - { - } - - /** - * Get all known section names on this page. - * - * @global $wp_settings_fields - * @return array - */ - public function getSections() - { - global $wp_settings_fields; - - if ( ! isset( $wp_settings_fields[ $this->slug ] ) ) { - return array(); - } - - return array_keys( $wp_settings_fields[ $this->slug ] ); - } - - /** - * @global $wp_settings_fields - * @param string $section - * @return array - */ - public function getFieldsForSection( $section ) - { - global $wp_settings_fields; - - return $wp_settings_fields[ $this->slug ][ $section ]; - } - - /** - * Add a custom field to this setting page. - * - * @param string $name - * @param string $label - * @param callable $callback - * @param array $args - */ - protected function addField( $name, $label, $callback, $args = array() ) - { - if ( ! is_callable( $callback ) ) { - throw new \InvalidArgumentException( 'Parameter $callback must be callable.' ); - } - - add_settings_field( - $name, - esc_html( $label ), - $callback, - $this->slug, - $this->currentSection, - $args - ); - } - - /** - * Add a text field to this settings page. - * - * @param string $name - * @param string $label - * @param array $args - * @param string $callback - */ - protected function addTextField( $name, $label, $args = array(), $callback = '' ) - { - if ( ! $callback || ! is_callable( $callback ) ) { - $callback = array( $this, 'renderTextField' ); - } - - $this->addField( - $name, - $label, - $callback, - $args + array( - 'label_for' => $this->slug . '-' . $name, - 'name' => $name, - 'attr' => array(), - ) - ); - } - - /** - * @param string $name - * @param string $label - * @param string $caption - * @param array $args - * @param callable $callback - */ - protected function addCheckboxField( $name, $label, $caption, $args = array(), $callback = '' ) - { - if ( ! $callback || ! is_callable( $callback ) ) { - $callback = array( $this, 'renderCheckboxField' ); - } - - $this->addField( - $name, - $label, - $callback, - $args + array( - 'label_for' => $this->slug . '-' . $name, - 'name' => $name, - 'caption' => $caption, - 'attr' => array(), - ) - ); - } - - /** - * Add an error. - * - * @param string $code - * @param string $message - */ - protected function addError( $code, $message ) - { - add_settings_error( $this->slug, $code, $message ); - } - - /** - * Errors for this setting. - * - * @return array { - * @type string $setting - * @type string $code - * @type string $message - * @type string $type 'error' - * } - */ - public function getErrors() - { - return get_settings_errors( $this->slug ); - } - - - /** - * Render a setting as text field. - * - * @param array $args { - * @type string $name - * @type string $label_for - * @type array $attr - * } - */ - public function renderTextField( array $args ) - { - $name = $args['name']; - - $this->renderInputTag( array( - 'type' => 'text', - 'id' => $args['label_for'], - 'class' => 'regular-text', - 'name' => $this->slug . '[' . $name . ']', - 'value' => $this[ $name ], - ) + $args['attr'] ); - } - - /** - * Render a setting as checkbox. - * - * @param array $args { - * @type string $caption - * @type string $name - * @type string $label_for - * @type array $attr - * } - */ - public function renderCheckboxField( array $args ) - { - $name = $args['name']; - - echo ''; - } - - /** - * Output an input tag with given HTML attributes. - * - * @param array $attr - */ - protected function renderInputTag( array $attr ) - { - echo ' $v ) { - if ( null !== $v ) { - printf( ' %s="%s"', $k, esc_attr( $v ) ); - } - } - echo ' />'; - } - - /** - * Output settings page. - */ - public function renderPage() - { - if ( ! current_user_can( $this->capability ) ) { - wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); - } - - ?> -
-

getPageTitle() ); ?>

-
- - slug ); ?> - slug ); ?> - -
-
- getContentWidth(); - } - - /** - * @return integer - */ - abstract public function getContentWidth(); -} diff --git a/buena/use/shy-wordpress/src/autoloader.php b/buena/use/shy-wordpress/src/autoloader.php deleted file mode 100644 index 00744fb..0000000 --- a/buena/use/shy-wordpress/src/autoloader.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ -class HookableTraitTest extends \WP_UnitTestCase -{ - use HookableTrait; - - - public function actionMethod() - { - } - - public function testWorksAsAction() - { - $this->addHookMethod( 'shywp_test_action', 'actionMethod' ); - $this->assertTrue( has_action( 'shywp_test_action' ), 'Registering an action via addHookMethod() worked.' ); - } - - - public function filterMethod( $value ) - { - return $value; - } - - public function testWorksAsFilter() - { - $this->addHookMethod( 'shywp_test_filter', 'filterMethod' ); - $this->assertTrue( has_filter( 'shywp_test_filter' ), 'Registering a filter via addHookMethod() worked.' ); - } -} diff --git a/buena/use/shy-wordpress/tests/Shy/WordPress/Tests/SettingsPageTest.php b/buena/use/shy-wordpress/tests/Shy/WordPress/Tests/SettingsPageTest.php deleted file mode 100644 index 12459f6..0000000 --- a/buena/use/shy-wordpress/tests/Shy/WordPress/Tests/SettingsPageTest.php +++ /dev/null @@ -1,181 +0,0 @@ -getMockBuilder( 'plugins\buena\use\shy-wordpress\src\Shy\WordPress\SettingsPage' ) - ->enableProxyingToOriginalMethods(); - - if ( null === $slug ) { - $builder->disableOriginalConstructor(); - } else { - $builder->setConstructorArgs( array( $slug, $capability ) ); - } - - return $builder->getMock(); - } - - - /** - * Test reading defaults from the settings page. - * - * @covers wordpress\src\Shy\WordPress\SettingsPage::__construct() - * @covers wordpress\src\Shy\WordPress\SettingsPage::getDefaults() - * @covers wordpress\src\Shy\WordPress\SettingsPage::offsetExists() - * @covers wordpress\src\Shy\WordPress\SettingsPage::offsetGet() - * @expectedException OutOfBoundsException - */ - public function testReading() - { - $slug = 'shywp_settingspage_test_slug_reading'; - $defaults = array( 'foo' => 'bar' ); - - $page = $this->mockSettingsPage( $slug ); - $page->method( 'getDefaults' )->willReturn( $defaults ); - - $this->assertEquals( $defaults, get_option( $slug ) ); - - $this->assertArrayHasKey( 'foo', $page ); - $this->assertEquals( $defaults['foo'], $page['foo'] ); - - $this->assertArrayNotHasKey( 'baz', $page ); - $page['baz']; - } - - /** - * Test writing to the settings page. - * - * @covers wordpress\src\Shy\WordPress\SettingsPage::offsetSet() - * @expectedException OutOfBoundsException - */ - public function testWriting() - { - $slug = 'shywp_settingspage_test_slug_writing'; - $defaults = array( 'foo' => 'bar' ); - - $page = $this->mockSettingsPage( $slug ); - $page->method( 'getDefaults' )->willReturn( $defaults ); - - $page['foo'] = 'foo'; - $this->assertEquals( 'foo', $page['foo'] ); - $page['baz'] = '123'; - } - - /** - * Fail to remove a setting. - * - * @covers SettingPage::offsetUnset() - * @expectedException BadMethodCallException - */ - public function testRemoving() - { - $slug = 'shywp_settingspage_test_slug_removing'; - $defaults = array(); - - $page = $this->mockSettingsPage( $slug ); - $page->method( 'getDefaults' )->willReturn( $defaults ); - - unset( $page['baz'] ); - } - - - /** - * Test whether the settings page can be showed. - * - * @covers wordpress\src\Shy\WordPress\SettingsPage::__construct() - * @covers wordpress\src\Shy\WordPress\SettingsPage::getParentSlug() - * @covers wordpress\src\Shy\WordPress\SettingsPage::getPageTitle() - * @covers wordpress\src\Shy\WordPress\SettingsPage::getMenuTitle() - */ - public function testRegisterPage() - { - $this->expectOutputRegex( '/<page&title>/' ); - - $slug = 'shywp_settingspage_test_slug_registerpage'; - - $page = $this->mockSettingsPage( $slug ); - $page->method( 'getParentSlug' )->willReturn( 'index.php' ); - $page->method( 'getPageTitle' )->willReturn( '' ); - $page->method( 'getMenuTitle' )->willReturn( '' ); - - $page->expects( $this->once() )->method( 'registerPage' )->with(); - $page->expects( $this->once() )->method( 'registerSettings' )->with(); - - // FIXME: Simulate display of backend. - } - - - /** - * @covers wordpress\src\Shy\WordPress\SettingsPage::sanitizeOptions() - */ - public function testSanitize() - { - $slug = 'shywp_settingspage_test_slug_sanitize'; - - $page = $this->mockSettingsPage( $slug ); - $page->method( 'sanitizeOptions' )->will( $this->returnArgument( 0 ) ); - $page->expects( $this->atLeastOnce() )->method( 'sanitizeOptions' ); - - $this->markTestIncomplete(); - // FIXME: Simulate form submission - } - - public function testRenderTextField() - { - $this->expectOutputRegex( '/^mockSettingsPage(); - $page->renderTextField( array( - 'label_for' => 'foo', - 'name' => 'bar', - ) ); - } - - public function testRenderCheckboxField() - { - $this->expectOutputRegex( '/^