Skip to content

Commit

Permalink
Push version 1.1.0 (WPAU)
Browse files Browse the repository at this point in the history
git-svn-id: http://plugins.svn.wordpress.org/wp-approve-user/trunk@508302 b8457f37-d9ea-0310-8a92-e5e31aec5664
  • Loading branch information
kobenland committed Feb 21, 2012
1 parent b8012ed commit 3b542b7
Show file tree
Hide file tree
Showing 8 changed files with 515 additions and 213 deletions.
7 changes: 7 additions & 0 deletions js/wp-approve-user.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
jQuery(function($){
$('tr:has(.submitapprove)').css('background-color', '#FFFFE0');
$('.actions select[name^="action"]').append(
'<option value="wpau_bulk_approve">' + wp_approve_user.approve + '</option>' +
'<option value="wpau_bulk_unapprove">' + wp_approve_user.unapprove + '</option>'
);
});
1 change: 1 addition & 0 deletions js/wp-approve-user.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified lang/wp-approve-user-de_DE.mo
Binary file not shown.
47 changes: 27 additions & 20 deletions lang/wp-approve-user-de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ msgstr ""
"X-Poedit-SearchPath-0: .\n"
"X-Textdomain-Support: yes"

#: obenland-wp-plugins.php:121
#: obenland-wp-plugins.php:113
#@ wp-approve-user
msgid "Donate"
msgstr "Spenden"
Expand Down Expand Up @@ -54,56 +54,63 @@ msgstr ""
msgid "http://en.wp.obenland.it/?utm_source=wordpress&utm_medium=plugin&utm_campaign=wp-approve-user"
msgstr "http://wp.obenland.it/?utm_source=wordpress&utm_medium=plugin&utm_campaign=wp-approve-user"

#. translators: plugin header field 'Version'
#: wp-approve-user.php:0
#@ wp-approve-user
msgid "1.0"
msgstr ""

#: wp-approve-user.php:134
#: wp-approve-user.php:156
#: wp-approve-user.php:186
#@ wp-approve-user
msgid "Unapprove"
msgstr "Zur&uuml;ckweisen"

#: wp-approve-user.php:142
#: wp-approve-user.php:155
#: wp-approve-user.php:194
#@ wp-approve-user
msgid "Approve"
msgstr "Genehmigen"

#: wp-approve-user.php:169
#: wp-approve-user.php:221
#@ wp-approve-user
msgid "<strong>ERROR:</strong> Your account has to be confirmed by an administrator before you can login."
msgstr "<strong>FEHLER:</strong> Dein Konto muss erst von einem Administrator genehmigt werden, bevor du dich anmelden kannst."

#: wp-approve-user.php:201
#: wp-approve-user.php:406
#@ wp-approve-user
msgid "You can&#8217;t approve users."
msgstr "Du kannst keine Benutzer genehmigen."

#: wp-approve-user.php:215
#: wp-approve-user.php:255
#: wp-approve-user.php:420
#: wp-approve-user.php:459
#@ default
msgid "You can&#8217;t edit that user."
msgstr ""

#: wp-approve-user.php:224
#: wp-approve-user.php:318
#, php-format
#@ wp-approve-user
msgid "User approved."
msgid_plural "%d users approved."
msgstr[0] "Benutzer genehmigt."
msgstr[1] "%d Benutzer genehmigt."

#: wp-approve-user.php:241
#@ wp-approve-user
msgid "You can&#8217;t reject users."
msgstr "Du kannst keine Benutzer zur&uuml;ckweisen."

#: wp-approve-user.php:264
#: wp-approve-user.php:322
#, php-format
#@ wp-approve-user
msgid "User unapproved."
msgid_plural "%d users unapproved."
msgstr[0] "Benutzer zur&uuml;ckgewiesen."
msgstr[1] "%d Benutzer zur&uuml;ckgewiesen."

#. translators: plugin header field 'Version'
#: wp-approve-user.php:0
#@ wp-approve-user
msgid "1.1.0"
msgstr ""

#: wp-approve-user.php:380
#@ default
msgid "Users"
msgstr ""

#: wp-approve-user.php:445
#@ wp-approve-user
msgid "You can&#8217;t unapprove users."
msgstr "Du kannst Benutzer nicht zur&uuml;ckweisen."

188 changes: 144 additions & 44 deletions obenland-wp-plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
/** obenland-wp-plugins.php
*
* @author Konstantin Obenland
* @version 1.4
* @version 1.5
*/


class Obenland_Wp_Plugins {
class Obenland_Wp_Plugins_v15 {


/////////////////////////////////////////////////////////////////////////////
// PROPERTIES, PROTECTED
/////////////////////////////////////////////////////////////////////////////

/**
* The plugins' text domain
*
Expand All @@ -23,8 +23,8 @@ class Obenland_Wp_Plugins {
* @var string
*/
protected $textdomain;


/**
* The name of the calling plugin
*
Expand All @@ -35,8 +35,8 @@ class Obenland_Wp_Plugins {
* @var string
*/
protected $plugin_name;


/**
* The donate link for the plugin
*
Expand All @@ -47,8 +47,8 @@ class Obenland_Wp_Plugins {
* @var string
*/
protected $donate_link;


/**
* The path to the plugin folder
*
Expand All @@ -61,12 +61,12 @@ class Obenland_Wp_Plugins {
* @var string
*/
protected $plugin_path;


///////////////////////////////////////////////////////////////////////////
// METHODS, PUBLIC
///////////////////////////////////////////////////////////////////////////

/**
* Constructor
*
Expand All @@ -80,28 +80,20 @@ class Obenland_Wp_Plugins {
* @return Obenland_Wp_Plugins
*/
public function __construct( $args = array() ) {

// Set class properties
$this->textdomain = $args['textdomain'];
$this->plugin_name = $args['plugin_name'];

$this->plugin_path = plugin_dir_path( $args['plugin_path'] );
$this->plugin_name = plugin_basename( $args['plugin_path'] );

$this->set_donate_link( $args['donate_link_id'] );

$plugin_folder = str_replace(
basename($this->plugin_name),
"",
$this->plugin_name
);
$this->plugin_path = trailingslashit( WP_PLUGIN_DIR ) . $plugin_folder;




// Add actions and filters
add_action( 'plugin_row_meta', array(
&$this,
'plugin_meta_donate'
), 10, 2 );
$this->hook( 'plugin_row_meta' );
}



/**
*
* @author Konstantin Obenland
Expand All @@ -113,21 +105,58 @@ public function __construct( $args = array() ) {
*
* @return string
*/
public function plugin_meta_donate( $plugin_meta, $plugin_file ) {
public function plugin_row_meta( $plugin_meta, $plugin_file ) {
if ( $this->plugin_name == $plugin_file ) {
$plugin_meta[] = sprintf('
<a href="%1$s" target="_blank" title="%2$s">%2$s</a>',
$this->donate_link,
__('Donate', $this->textdomain)
$this->donate_link,
__('Donate', $this->textdomain)
);
}
return $plugin_meta;
}


///////////////////////////////////////////////////////////////////////////
// METHODS, PROTECTED
///////////////////////////////////////////////////////////////////////////

/**
* Hooks methods their WordPress Actions and Filters
*
* @example:
* $this->hook( 'the_title' );
* $this->hook( 'init', 5 );
* $this->hook( 'omg', 'is_really_tedious', 3 );
*
* @author Mark Jaquith
* @see http://sliwww.slideshare.net/markjaquith/creating-and-maintaining-wordpress-plugins
* @since 1.5 - 12.02.2012
* @access protected
*
* @param string $hook Action or Filter Hook name
*
* @return boolean true
*/
protected function hook( $hook ) {
$priority = 10;
$method = $this->sanitize_method( $hook );
$args = func_get_args();
unset( $args[0] ); // Filter name

foreach ( (array) $args as $arg ) {
if ( is_int( $arg ) ) {
$priority = $arg;
}
else {
$method = $arg;

}
}

return add_action( $hook, array( $this, $method ), $priority , 999 );
}


/**
* Sets the donate link
Expand All @@ -146,29 +175,100 @@ protected function set_donate_link( $donate_link_id ) {
'hosted_button_id' => $donate_link_id
), 'https://www.paypal.com/cgi-bin/webscr' );
}


/**
* Retrieve option value based on the environment.
*
* @author Konstantin Obenland
* @since 1.4 - 23.12.2011
* @access protected
*
* @param string $option Name of option to retrieve. Expected to not be SQL-escaped.
* @param string $option_name Name of option to retrieve. Expected to not be SQL-escaped.
* @param mixed $default Optional. Default value to return if the option does not exist.
* @param boolean $use_cache Optional. Whether to use cache. Multisite only. Default true.
*
* @return mixed Value set for the option.
*/
protected function get_option( $option_name, $default = false, $use_cache = true ) {

$options = $this->get_options( $default, $use_cache );

if ( isset($options[$option_name]) ) {
return $options[$option_name];
}

return $default;
}


/**
*
* @author Konstantin Obenland
* @since 1.5 - 12.02.2012
* @access protected
*
* @param string $option_name Name of option to retrieve. Expected to not be SQL-escaped.
* @param mixed $value Option value. Expected to not be SQL-escaped.
*
* @return boolen False if value was not updated and true if value was updated.
*/
protected function set_option( $option_name, $value ) {
$options = $this->get_options();
$options[$key] = $value;

if ( is_plugin_active_for_network($this->plugin_name) ) {
return update_site_option( $this->textdomain, $options );
}

return update_option( $this->textdomain, $options );
}


///////////////////////////////////////////////////////////////////////////
// METHODS, PRIVATE
///////////////////////////////////////////////////////////////////////////

/**
* Retrieve options based on the environment.
*
* @author Konstantin Obenland
* @since 1.5 - 12.02.2012
* @access private
*
* @param mixed $default Optional. Default value to return if the option does not exist.
* @param boolean $use_cache Optional. Whether to use cache. Multisite only. Default true.
*
* @return mixed Value set for the option.
*/
protected function get_option( $option, $default = false, $use_cache = true ) {
if ( is_plugin_active_for_network( $this->plugin_name ) ) {
$return = get_site_option( $option_name, $default, $use_cache );
private function get_options( $default = false, $use_cache = true ) {

if ( is_plugin_active_for_network($this->plugin_name) ) {
$options = get_site_option( $this->textdomain, $default, $use_cache );
} else {
$return = get_option( $option_name, $default );
$options = get_option( $this->textdomain, $default );
}
return $return;

return $options;
}


/**
* Sanitizes method names
*
* @author Mark Jaquith
* @see http://sliwww.slideshare.net/markjaquith/creating-and-maintaining-wordpress-plugins
* @since 1.5 - 12.02.2012
* @access private
*
* @param string $method Method name to be sanitized
*
* @return string Sanitized method name
*/
private function sanitize_method( $method ) {
return str_replace( array( '.', '-' ), '_', $method );
}

} // End of class Obenland_Wp_Plugins


Expand Down
Loading

0 comments on commit 3b542b7

Please sign in to comment.