Skip to content

Commit

Permalink
Fixed some issues caused by migration.
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejd committed Mar 12, 2017
1 parent 1c2eabc commit ef5e972
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 26 deletions.
47 changes: 32 additions & 15 deletions templates/forms.phtml
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
<?php
// TODO Bude tady jen jedna funkce na renderovani zdrojovych kodu `wpg_code_example` s tím že:
// 1) načítat se bude z externích textových souborů (nebo databázové tabulky)
// 2) bude obsahovat vše (počáteční i koncové HTML okolo kódu)
// 3) a to včetně jeho vyrendrování do skutečné podoby (možnost volby: ["above","below","hidden"])
// 4) budou umožněny filtry na HTML načtené z externích textových souborů

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/**
* @todo Here will be just one function for rendering source codes `wpg_code_example`.
* @todo Get plugin's option `display_detail_description`!
*/
$display_description = true;

// Bude tady jen jedna funkce na renderovani zdrojovych kodu `wpg_code_example` s tím že:
// 1) načítat se bude z externích textových souborů (nebo databázové tabulky)
// 2) bude obsahovat vše (počáteční i koncové HTML okolo kódu)
// 3) a to včetně jeho vyrendrování do skutečné podoby (možnost volby: ["above","below","hidden"])
// 4) budou umožněny filtry na HTML načtené z externích textových souborů

if ( !function_exists( 'code_example_start' ) ):
/**
* Render begining of a block of source code example.
* @param string $id
* @return void
*
* @todo Get plugin's option `display_source_code_examples`!
*/
function code_example_start( $id, $language="language-php" ) {
$display = ( ( bool ) WP_Style_Guide::get_option('display_source_code_examples') === true ) ? true : false;
//$display = ( ( bool ) WP_Style_Guide::get_option('display_source_code_examples') === true ) ? true : false;
$display = true;
$style = ( $display === true ) ? '' : ' style="display: none;"';
?>
<div id="code_example-<?= $id ?>" class="code-example">
Expand All @@ -26,6 +41,8 @@ if ( !function_exists( 'code_example_end' ) ):
* Render end of a block of source code example.
* @param string $id
* @return void
*
* @todo Get plugin's option `display_source_code_examples`!
*/
function code_example_end( $id, $show_hide = false ) {
$display = ( ( bool ) WP_Style_Guide::get_option('display_source_code_examples') === true ) ? true : false;
Expand Down Expand Up @@ -73,7 +90,7 @@ endif;
<li><a href="#tr-others">Other Elements</a> | </li>
<li><a href="#tr-buttons">Buttons</a> | </li>
<li><a href="#tr-form_table">Form Table</a> | </li>
<li><a href="#tr-nonce">NONCE Field', WP_Style_Guide::PLUGIN_SLUG); ?></a></li>
<li><a href="#tr-nonce">NONCE Field</a></li>
</ul>

<form id="form" style="clear: both; padding-top: 20px;">
Expand All @@ -84,7 +101,7 @@ endif;
<label for="input-text">Helper Functions</label>
</th>
<td class="wp-pattern-example">
<p><b>WordPress</b> contains three helper functions for rendering <code>disabled</code>, <code>checked</code> or <code>selected</code> attributes: '); ?></p>
<p><b>WordPress</b> contains three helper functions for rendering <code>disabled</code>, <code>checked</code> or <code>selected</code> attributes:</p>
<?php code_example_start( 'helper_functions' ); ?>checked( $checked, $current = TRUE, $echo = TRUE );
selected( $selected, $current = TRUE, $echo = TRUE );
disabled( $disabled, $current = TRUE, $echo = TRUE );<?php code_example_end( 'helper_functions' ); ?>
Expand Down Expand Up @@ -227,7 +244,7 @@ endif;
<label for="input-time">Date Time Elements</label>
</th>
<td class="wp-pattern-example">
<p><?= sprintf( __( 'If you creating date time inputs for form for editing <em>custom-</em>post type you can use <b>WordPress</b> function <a href="touch_time" target="blank"><code>touch_time()</code></a> (<b>Warning:</b> This function can be used only on <code>post.php</code> or <code>post-new.php</code> pages!):', WP_Style_Guide::PLUGIN_SLUG ), 'https://developer.wordpress.org/reference/functions/touch_time/' )?></p>
<p><?= sprintf( 'If you creating date time inputs for form for editing <em>custom-</em>post type you can use <b>WordPress</b> function <a href="touch_time" target="blank"><code>touch_time()</code></a> (<b>Warning:</b> This function can be used only on <code>post.php</code> or <code>post-new.php</code> pages!):', 'https://developer.wordpress.org/reference/functions/touch_time/' )?></p>
<pre><code class="language-php">&lt;?php @touch_time( false, false, false, true ); ?&gt;</code></pre>
<?php
@touch_time(false, false, false, true);
Expand Down Expand Up @@ -306,10 +323,10 @@ endif;
<label for="input-time">Buttons</label>
</th>
<td class="wp-pattern-example">
<p><?php printf( __( '<b>WordPress</b> contains helper function for rendering submit buttons <a href="%s" target="blank"><code>submit_button</code></a>:', WP_Style_Guide::PLUGIN_SLUG ) , 'https://developer.wordpress.org/reference/functions/submit_button/' ); ?></p>
<p><?php printf( '<b>WordPress</b> contains helper function for rendering submit buttons <a href="%s" target="blank"><code>submit_button</code></a>:', 'https://developer.wordpress.org/reference/functions/submit_button/' ); ?></p>
<p class="description">Note: This function can be used only in administration (is located in file <code>wp-admin/includes/template.php</code>).</p>
<?php code_example_start( 'buttons1' ); ?>&lt;?php submit_button( 'Submit Input', 'primary', 'my-submit' ); ?&gt;<?php code_example_end( 'buttons1' ); ?>
<?php submit_button( esc_html( 'Submit Input', WP_Style_Guide::PLUGIN_SLUG ), 'primary', 'my-submit' );?>
<?php submit_button( 'Submit Input', 'primary', 'my-submit' );?>
<p>But you can also use plain HTML:</p>
<?php code_example_start( 'buttons2' ); ?>&lt;input type="submit" value="Submit Input" class="button"&gt;
&lt;input type="button" value="Secondary Button" class="button-secondary"&gt;
Expand Down Expand Up @@ -364,7 +381,7 @@ endif;
<td>
<fieldset>
<p>
<label for="test-input-02">Shop\'s description should be simple and easily to remember.</label>
<label for="test-input-02">Shop's description should be simple and easily to remember.</label>
<input type="text" name="test-input-02" id="test-input-02" class="regular-text">
</p>
<p class="description">Enter text with at the most 255 characters.</p>
Expand Down Expand Up @@ -437,7 +454,7 @@ jQuery(document).on("ready", function () {
&lt;fieldset&gt;
&lt;p&gt;
&lt;label for="test-input-02"&gt;
Shop\'s description should be simple and easily to remember.
Shop's description should be simple and easily to remember.
&lt;/label&gt;
&lt;input type="text" name="test-input-02" id="test-input-02" class="regular-text"&gt;
&lt;/p&gt;
Expand Down Expand Up @@ -471,9 +488,9 @@ jQuery(document).on('ready', function () {
<label>NONCE Field</label>
</th>
<td class="wp-pattern-example">
<p><?php printf( __( 'When you need add security field into your forms you can use <a href="%s" target="blank"><code>wp_nonce_field</code></a> function.', WP_Style_Guide::PLUGIN_SLUG), 'https://developer.wordpress.org/reference/functions/wp_nonce_field/' ); ?></p>
<p><?php printf( 'When you need add security field into your forms you can use <a href="%s" target="blank"><code>wp_nonce_field</code></a> function.', 'https://developer.wordpress.org/reference/functions/wp_nonce_field/' ); ?></p>
<pre><code class="language-php">&lt;?php wp_nonce_field(); ?&gt;</code></pre>
<p class="description"><?php printf( __( '<b>Note:</b> Nonces are described here in article <a href="%s" target="blank">WordPress Nonces</a> (WordPress Codex).', WP_Style_Guide::PLUGIN_SLUG), 'https://codex.wordpress.org/WordPress_Nonces' ); ?></p>
<p class="description"><?php printf( '<b>Note:</b> Nonces are described here in article <a href="%s" target="blank">WordPress Nonces</a> (WordPress Codex).', 'https://codex.wordpress.org/WordPress_Nonces' ); ?></p>
</td>
</tr>
<tr><td colspan="2"><p class="description"><a href="#wpbody" class="alignright">Back to top</a></p></td></tr>
Expand Down
12 changes: 11 additions & 1 deletion templates/jqueryui.phtml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
<?php

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/**
* @todo Add source code examples!
* @todo Add code example (this page, how jQuery is registered etc.)!
* @todo Get plugin's option `display_detail_description`!
*/
$display_description = true;

?><div class="wrap">

<?php screen_icon(); ?>
Expand Down
21 changes: 17 additions & 4 deletions templates/otherwidgets.phtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
<div class="wrap">
<?php

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/**
* @todo Get plugin's option `display_detail_description`!
*/
$display_description = true;

?><div class="wrap">

<?php screen_icon(); ?>

Expand Down Expand Up @@ -28,15 +41,15 @@

<img src="<?php echo plugins_url( '../images/admin_notices.png', __FILE__ ); ?>" alt="Example notices"/>

<p><?php printf( __( 'As you can see the last notice is also dismissible - this is because of using class <code>.is-dismissible</code>. If you want to store state of dismissible notice you can use small library <a href="">CalderaWP/dismissible_notice</a>.', WP_Style_Guide::PLUGIN_SLUG ), 'https://github.com/CalderaWP/dismissible_notice/tree/master/src' ); ?></p>
<p><?php printf( 'As you can see the last notice is also dismissible - this is because of using class <code>.is-dismissible</code>. If you want to store state of dismissible notice you can use small library <a href="">CalderaWP/dismissible_notice</a>.', 'https://github.com/CalderaWP/dismissible_notice/tree/master/src' ); ?></p>
</div>
<p class="description"><a href="#wpbody" class="alignright">Back to top</a></p>

<!-- Bubble Icon -->
<br id="br-bubble_icon" class="clear" />
<h2>Bubble Icon</h2>
<div class="wp-pattern-example">
<p><?php printf( __( 'Sometimes you want to show count of items for an admin menu item (doesn\'t matter if it is your menuitem or <i>WP</i> original). It\'s pretty simple you just need to add hook for action <code><a href="%s" target="blank">admin_menu</a></code> and update any menu item you want: ', WP_Style_Guide::PLUGIN_SLUG ), 'https://codex.wordpress.org/Plugin_API/Action_Reference/admin_menu' ); ?></p>
<p><?php printf( 'Sometimes you want to show count of items for an admin menu item (doesn\'t matter if it is your menuitem or <i>WP</i> original). It\'s pretty simple you just need to add hook for action <code><a href="%s" target="blank">admin_menu</a></code> and update any menu item you want: ', 'https://codex.wordpress.org/Plugin_API/Action_Reference/admin_menu' ); ?></p>
<pre><code class="language-php">/**
&nbsp; * @global array $menu
&nbsp; * @return void;
Expand Down Expand Up @@ -109,7 +122,7 @@ add_action( 'admin_menu', 'add_user_menu_bubble' );
<br id="br-spinner" />
<h2>Spinner</h2>
<div class="wp-pattern-example">
<p><?php printf( __( 'This element is new since <b>WordPress</b> version <b>4.2</b> (<a href="%s" target="blank">more details</a>). Is oftenly used in inline forms while AJAX submitting is performed. See example below:', WP_Style_Guide::PLUGIN_SLUG ), 'https://make.wordpress.org/core/2015/04/23/spinners-and-dismissible-admin-notices-in-4-2/' ); ?></p>
<p><?php printf( 'This element is new since <b>WordPress</b> version <b>4.2</b> (<a href="%s" target="blank">more details</a>). Is oftenly used in inline forms while AJAX submitting is performed. See example below:', 'https://make.wordpress.org/core/2015/04/23/spinners-and-dismissible-admin-notices-in-4-2/' ); ?></p>
<p>Here is an excerpt from required HTML code:</p>
<pre><code class="language-markup">&lt;p class="submit submit-example"&gt;
&lt;button class="button-primary save alignright" type="button"&gt;Click me!&lt;/button&gt;
Expand Down
16 changes: 10 additions & 6 deletions templates/tables.phtml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?php

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

/**
* Page "Tables".
*
* @author Ondrej Donek, <[email protected]>
* @since 1.0.1
* @todo Get plugin's option `display_detail_description`!
*/
$display_description = ( ( bool ) WP_Style_Guide::get_option( 'display_detail_description' ) === true ) ? true : false;
$display_description = true;

?><div class="wrap">

Expand All @@ -19,7 +23,7 @@ $display_description = ( ( bool ) WP_Style_Guide::get_option( 'display_detail_de
<!--
<div class="wp-pattern-example">
<p><?php printf(
__( 'If you want list some data in your plugin you need to implement new class that extends <a href="%1$s" target="blank"><code>WP_List_Table</code></a>. It is not complicated task and we show it here using simple wizard that generates all neccessary code.', WP_Style_Guide::PLUGIN_SLUG ),
'If you want list some data in your plugin you need to implement new class that extends <a href="%1$s" target="blank"><code>WP_List_Table</code></a>. It is not complicated task and we show it here using simple wizard that generates all neccessary code.',
''
); ?></p>
</div>
Expand Down

0 comments on commit ef5e972

Please sign in to comment.