| 1 |
<?php |
| 2 |
/** |
| 3 |
* class-groups-help.php |
| 4 |
* |
| 5 |
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com |
| 6 |
* |
| 7 |
* This code is released under the GNU General Public License. |
| 8 |
* See COPYRIGHT.txt and LICENSE.txt. |
| 9 |
* |
| 10 |
* This code is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* This header and all notices must be kept intact. |
| 16 |
* |
| 17 |
* @author Karim Rahimpur |
| 18 |
* @package groups |
| 19 |
* @since groups 1.0.0 |
| 20 |
*/ |
| 21 |
|
| 22 |
/** |
| 23 |
* Help renderer. |
| 24 |
*/ |
| 25 |
class Groups_Help { |
| 26 |
|
| 27 |
public static function init() { |
| 28 |
add_action( 'contextual_help', array( __CLASS__, 'contextual_help' ), 10, 3 ); |
| 29 |
} |
| 30 |
|
| 31 |
public static function contextual_help( $contextual_help, $screen_id, $screen ) { |
| 32 |
|
| 33 |
$show_groups_help = false; |
| 34 |
$help = '<h3><a href="http://www.itthinx.com/plugins/groups" target="_blank">Groups</a></h3>'; |
| 35 |
$help .= '<p>'; |
| 36 |
$help .= __( 'The complete documentation is available on the <a href="http://www.itthinx.com/plugins/groups" target="_blank">Groups plugin page</a>', GROUPS_PLUGIN_DOMAIN ); |
| 37 |
$help .= '</p>'; |
| 38 |
|
| 39 |
switch ( $screen_id ) { |
| 40 |
case 'toplevel_page_groups-admin' : |
| 41 |
case 'groups_page_groups-admin-groups': |
| 42 |
$show_groups_help = true; |
| 43 |
$help .= '<p>' . __( 'Here you can <strong>add</strong>, <strong>edit</strong> and <strong>remove</strong> groups.', GROUPS_PLUGIN_DOMAIN ) . '</p>'; |
| 44 |
break; |
| 45 |
case 'groups_page_groups-admin-options' : |
| 46 |
$show_groups_help = true; |
| 47 |
break; |
| 48 |
default: |
| 49 |
} |
| 50 |
|
| 51 |
$help .= '<p>'; |
| 52 |
$help .= __( 'If you require <em>consulting services</em>, <em>support</em> or <em>customization</em>, you may <a href="http://www.itthinx.com/" target="_blank">contact me here</a>.', GROUPS_PLUGIN_DOMAIN ); |
| 53 |
$help .= '</p>'; |
| 54 |
$help .= '<p>'; |
| 55 |
$help .= __( 'If you find this plugin useful, please consider making a donation:', GROUPS_PLUGIN_DOMAIN ); |
| 56 |
$help .= self::donate( false, true ); |
| 57 |
$help .= '</p>'; |
| 58 |
|
| 59 |
if ( $show_groups_help ) { |
| 60 |
return $help; |
| 61 |
} else { |
| 62 |
return $contextual_help; |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
/** |
| 67 |
* Returns or renders the footer. |
| 68 |
* @param boolean $render |
| 69 |
*/ |
| 70 |
public static function footer( $render = true ) { |
| 71 |
$footer = '<div class="groups-footer">' . |
| 72 |
// '<p>' . |
| 73 |
__( 'Thank you for using <a href="http://www.itthinx.com/plugins/groups" target="_blank">Groups</a> by <a href="http://www.itthinx.com" target="_blank">itthinx</a>.', GROUPS_PLUGIN_DOMAIN ) . |
| 74 |
' ' . |
| 75 |
__( 'For consulting and development services related to Groups go <a href="http://www.itthinx.com/contact/" target="_blank">here</a>.', GROUPS_PLUGIN_DOMAIN ) . |
| 76 |
' ' . |
| 77 |
__( 'You can also support the project:', GROUPS_PLUGIN_DOMAIN ) . |
| 78 |
self::donate( false ) . |
| 79 |
// '</p>' . |
| 80 |
'</div>'; |
| 81 |
$footer = apply_filters( 'groups_footer', $footer ); |
| 82 |
if ( $render ) { |
| 83 |
echo $footer; |
| 84 |
} else { |
| 85 |
return $footer; |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
/** |
| 90 |
* Render or return a donation button. |
| 91 |
* Thanks for supporting me! |
| 92 |
* @param boolean $render |
| 93 |
* @param boolean $small |
| 94 |
*/ |
| 95 |
public static function donate( $render = true, $small = false ) { |
| 96 |
$donate = |
| 97 |
'<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> |
| 98 |
<input type="hidden" name="cmd" value="_donations"> |
| 99 |
<input type="hidden" name="business" value="itthinx@itthinx.com"> |
| 100 |
<input type="hidden" name="lc" value="US"> |
| 101 |
<input type="hidden" name="item_name" value="Support WordPress Plugins from itthinx"> |
| 102 |
<input type="hidden" name="item_number" value="WordPress Plugins"> |
| 103 |
<input type="hidden" name="no_note" value="0"> |
| 104 |
<input type="hidden" name="currency_code" value="EUR"> |
| 105 |
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest"> |
| 106 |
<input type="submit" name="submit" value="Contribute" style="border:1px solid #ccc;border-radius:4px;cursor:pointer;padding:0;margin:0;color:#999;"> |
| 107 |
</form>'; |
| 108 |
if ( $render ) { |
| 109 |
echo $donate; |
| 110 |
} else { |
| 111 |
return $donate; |
| 112 |
} |
| 113 |
} |
| 114 |
} |
| 115 |
Groups_Help::init(); |
| 116 |
|