Skip to content

Commit

Permalink
Change localization textdomain per recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
JayWood committed Jun 30, 2016
1 parent f9e40a3 commit 37328d3
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 57 deletions.
6 changes: 3 additions & 3 deletions class/admin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function setup_metabox() {
if ( is_array( $post_type ) ) {
foreach ( $post_type as $screen ) {
add_meta_box( 'cwv3_meta_section',
__( 'CWV3 Security', 'cwv3' ),
__( 'CWV3 Security', 'content-warning-v2' ),
array( $this, 'render_metabox' ),
$screen,
'side',
Expand Down Expand Up @@ -137,9 +137,9 @@ public function render_metabox( $post ) {
$disabled = isset( $site_wide[0] ) && 'enabled' == $site_wide[0] ? true : false;
?>

<label for="cwv3_auth"><input type="checkbox" id="cwv3_auth" name="cwv3_auth" <?php checked( 'yes', $meta_value, true ); ?> value="yes" <?php disabled( $disabled ); ?>/><?php _e( 'Use authorization for this content', 'cwv3' ); ?></label>
<label for="cwv3_auth"><input type="checkbox" id="cwv3_auth" name="cwv3_auth" <?php checked( 'yes', $meta_value, true ); ?> value="yes" <?php disabled( $disabled ); ?>/><?php _e( 'Use authorization for this content', 'content-warning-v2' ); ?></label>
<?php if ( $disabled ) : ?>
<p class="description"><?php _e( 'Cannot be changed while site wide option is enabled.', 'cwv3' ); ?></p>
<p class="description"><?php _e( 'Cannot be changed while site wide option is enabled.', 'content-warning-v2' ); ?></p>
<?php endif;
}
}
Expand Down
56 changes: 42 additions & 14 deletions content-warning-v3.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,53 @@
Author: Jerry Wood Jr.
Version: 3.7
Author URI: http://plugish.com
Text Domain: cwv3
Text Domain: content-warning-v2
Domain Path: /lang
*/
require_once dirname( __FILE__ ) . '/inc/api.php';
//require_once dirname( __FILE__ ) . '/inc/api.php';
//
//if ( is_admin() ) {
// require_once dirname( __FILE__ ) . '/inc/options.inc.php';
// if ( ! class_exists( 'JW_SIMPLE_OPTIONS' ) ) {
// require_once dirname( __FILE__ ) . '/lib/jw_simple_options/simple_options.php';
// }
// require_once dirname( __FILE__ ) . '/class/admin.class.php';
//
// $cwv3_options = new JW_SIMPLE_OPTIONS( $cwv3_op_data );
//// register_uninstall_hook( __FILE__, array( $cwv3_options, 'uninstall' ) );
//} else {
// require_once dirname( __FILE__ ) . '/class/main.class.php';
//}
//
//add_action( 'plugins_loaded', 'jw_cwv3_load_text_domain' );
//function jw_cwv3_load_text_domain() {
// load_plugin_textdomain( 'content-warning-v2', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
//}

if ( is_admin() ) {
require_once dirname( __FILE__ ) . '/inc/options.inc.php';
if ( ! class_exists( 'JW_SIMPLE_OPTIONS' ) ) {
require_once dirname( __FILE__ ) . '/lib/jw_simple_options/simple_options.php';


class ContentWarning_v2 {

/**
* Instance of ContentWarning_v2
* @var ContentWarning_v2
*/
public static $instance = null;

public static function init() {
if ( null == self::$instance ) {
self::$instance = new self();
}

return self::$instance;
}
require_once dirname( __FILE__ ) . '/class/admin.class.php';

$cwv3_options = new JW_SIMPLE_OPTIONS( $cwv3_op_data );
// register_uninstall_hook( __FILE__, array( $cwv3_options, 'uninstall' ) );
} else {
require_once dirname( __FILE__ ) . '/class/main.class.php';
public function hooks() {
// All hooks here.
}
}

add_action( 'plugins_loaded', 'jw_cwv3_load_text_domain' );
function jw_cwv3_load_text_domain() {
load_plugin_textdomain( 'cwv3', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
function content_warning_v2() {
return ContentWarning_v2::init();
}
add_action( 'plugins_loaded', array( content_warning_v2(), 'hooks' ) );
12 changes: 6 additions & 6 deletions inc/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ function cwv3_js_dialog() {
*/
function cwv3_get_js_dialog() {

$exit_text = get_option( 'cwv3_exit_txt', __( 'Exit', 'cwv3' ) );
$enter_text = get_option( 'cwv3_enter_txt', __( 'Enter', 'cwv3' ) );
$exit_text = get_option( 'cwv3_exit_txt', __( 'Exit', 'content-warning-v2' ) );
$enter_text = get_option( 'cwv3_enter_txt', __( 'Enter', 'content-warning-v2' ) );

$cwv3_denial_title = get_option( 'cwv3_den_title', __( 'Access Denied', 'cwv3' ) );
$cwv3_denial_message = get_option( 'cwv3_den_msg', __( 'You have been denied access to this content. If you feel this is in error, please contact a site administrator.', 'cwv3' ) );
$cwv3_denial_title = get_option( 'cwv3_den_title', __( 'Access Denied', 'content-warning-v2' ) );
$cwv3_denial_message = get_option( 'cwv3_den_msg', __( 'You have been denied access to this content. If you feel this is in error, please contact a site administrator.', 'content-warning-v2' ) );

$cwv3_title = get_option( 'cwv3_d_title', __( 'Warning: Explicit Content', 'cwv3' ) );
$cwv3_message = get_option( 'cwv3_d_msg', __( 'The content you are about to view may be considered offensive and/or inappropriate. Furthermore, this content may be considered adult content, if you are not of legal age or are easily offended, you are required to click the exit button.', 'cwv3' ) );
$cwv3_title = get_option( 'cwv3_d_title', __( 'Warning: Explicit Content', 'content-warning-v2' ) );
$cwv3_message = get_option( 'cwv3_d_msg', __( 'The content you are about to view may be considered offensive and/or inappropriate. Furthermore, this content may be considered adult content, if you are not of legal age or are easily offended, you are required to click the exit button.', 'content-warning-v2' ) );

$exit_url = get_option( 'cwv3_exit_link', '#' );
$enter_url = get_option( 'cwv3_enter_link', '#' );
Expand Down
68 changes: 34 additions & 34 deletions inc/options.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@
'slug' => 'cwv3_options',
'opData' => array(
'sitewide' => array(
'name' => __( 'Sitewide', 'cwv3' ),
'name' => __( 'Sitewide', 'content-warning-v2' ),
'type' => 'check',
'desc' => __( 'Takes priority over category, page, and post, home, and misc. pages/posts.', 'cwv3' ),
'desc' => __( 'Takes priority over category, page, and post, home, and misc. pages/posts.', 'content-warning-v2' ),
'fields' => array(
'enabled' => 'Enable',
),
'def' => 'enabled',
),
'homepage' => array(
'name' => __( 'Home Page', 'cwv3' ),
'name' => __( 'Home Page', 'content-warning-v2' ),
'type' => 'check',
'desc' => __( 'Toggle the home page dialog, useful if you have not set a static page for your front-page in Settings -> Reading.', 'cwv3' ),
'desc' => __( 'Toggle the home page dialog, useful if you have not set a static page for your front-page in Settings -> Reading.', 'content-warning-v2' ),
'fields' => array(
'enabled' => 'Enable',
),
'def' => 'enabled',

),
'misc' => array(
'name' => __( 'Misc. Pages', 'cwv3' ),
'name' => __( 'Misc. Pages', 'content-warning-v2' ),
'type' => 'check',
'desc' => __( 'Enable this to protect search, archive, and other such pages.', 'cwv3' ),
'desc' => __( 'Enable this to protect search, archive, and other such pages.', 'content-warning-v2' ),
'fields' => array(
'enabled' => 'Enable',
),
Expand All @@ -47,61 +47,61 @@
// jQuery.cookie doesn't allow hour/minutes, so we have to have a specific timeframe
// in days only.
'death' => array(
'name' => __( 'Cookie Life', 'cwv3' ),
'desc' => __( 'Time in days for the cookie to expire', 'cwv3' ),
'name' => __( 'Cookie Life', 'content-warning-v2' ),
'desc' => __( 'Time in days for the cookie to expire', 'content-warning-v2' ),
'type' => 'number',
'def' => '1',
),
// Dialog Options
'd_title' => array(
'name' => __( 'Dialog Title', 'cwv3' ),
'name' => __( 'Dialog Title', 'content-warning-v2' ),
'desc' => '',
'type' => 'text',
'def' => 'WARNING: Explicit Content',
),
'd_msg' => array(
'name' => __( 'Dialog Message', 'cwv3' ),
'name' => __( 'Dialog Message', 'content-warning-v2' ),
'type' => 'editor',
'desc' => __( 'A message shown to your visitor.', 'cwv3' ),
'desc' => __( 'A message shown to your visitor.', 'content-warning-v2' ),
'def' => 'The content you are about to view may be considered offensive and/or inappropriate. Furthermore, this content may be considered adult content, if you are not of legal age or are easily offended, you are required to click the exit button.',
'settings' => array(
'teeny' => true,
'media_buttons' => false,
),
),
'exit_txt' => array(
'name' => __( 'Exit Text', 'cwv3' ),
'name' => __( 'Exit Text', 'content-warning-v2' ),
'type' => 'text',
'desc' => __( 'The text for the exit button.', 'cwv3' ),
'desc' => __( 'The text for the exit button.', 'content-warning-v2' ),
'def' => 'Exit',
),
'exit_link' => array(
'name' => __( 'Exit Link', 'cwv3' ),
'name' => __( 'Exit Link', 'content-warning-v2' ),
'type' => 'text',
'desc' => __( 'The full URL a user should be directed to upon clicking the exit button.', 'cwv3' ),
'desc' => __( 'The full URL a user should be directed to upon clicking the exit button.', 'content-warning-v2' ),
'def' => 'http://google.com',
),
'enter_txt' => array(
'name' => __( 'Enter Text', 'cwv3' ),
'name' => __( 'Enter Text', 'content-warning-v2' ),
'type' => 'text',
'desc' => __( 'The text for the enter button.', 'cwv3' ),
'desc' => __( 'The text for the enter button.', 'content-warning-v2' ),
'def' => 'Enter',
),
'enter_link' => array(
'name' => __( 'Enter Link', 'cwv3' ),
'name' => __( 'Enter Link', 'content-warning-v2' ),
'type' => 'text',
'desc' => __( 'The full URL a user should be directed to upon clicking the enter button. Leave blank to just close the dialog.', 'cwv3' ),
'desc' => __( 'The full URL a user should be directed to upon clicking the enter button. Leave blank to just close the dialog.', 'content-warning-v2' ),
'def' => '#',
),
// Denial Options
'denial' => array(
'name' => __( 'Toggle Denial Option', 'cwv3' ),
'name' => __( 'Toggle Denial Option', 'content-warning-v2' ),
'desc' => '',
'type' => 'check',
'fields' => array( 'enabled' => 'Enable denial handling.' ),
),
'method' => array(
'name' => __( 'Denial Handling Method', 'cwv3' ),
'name' => __( 'Denial Handling Method', 'content-warning-v2' ),
'desc' => '',
'type' => 'radio',
'fields' => array(
Expand All @@ -111,16 +111,16 @@
'def' => 'redirect',
),
'den_title' => array(
'name' => __( 'Dialog Title', 'cwv3' ),
'name' => __( 'Dialog Title', 'content-warning-v2' ),
'desc' => '',
'type' => 'text',
'def' => 'Access Denied',
),
'den_msg' => array(
'name' => __( 'Denial Message', 'cwv3' ),
'name' => __( 'Denial Message', 'content-warning-v2' ),
'desc' => '',
'type' => 'editor',
'def' => __( 'You have been denied access to this content. If you feel this is in error, please contact a site administrator.', 'cwv3' ),
'def' => __( 'You have been denied access to this content. If you feel this is in error, please contact a site administrator.', 'content-warning-v2' ),
'settings' => array(
'media_buttons' => false,
'teeny' => true,
Expand All @@ -129,32 +129,32 @@
// Advanced Options
//// Styling Options
'bg_image' => array(
'name' => __( 'Background Image', 'cwv3' ),
'desc' => __( 'If not empty, the dialog will use this instead of the background opacity and color.', 'cwv3' ),
'name' => __( 'Background Image', 'content-warning-v2' ),
'desc' => __( 'If not empty, the dialog will use this instead of the background opacity and color.', 'content-warning-v2' ),
'type' => 'media',
),
'bg_opacity' => array(
'name' => __( 'Background Opacity', 'cwv3' ),
'desc' => __( 'Input a float value from 0-1, the latter being completely opaque.', 'cwv3' ),
'name' => __( 'Background Opacity', 'content-warning-v2' ),
'desc' => __( 'Input a float value from 0-1, the latter being completely opaque.', 'content-warning-v2' ),
'type' => 'number',
'def' => 0.85,
'step' => 0.01,
),
'bg_color' => array(
'name' => __( 'Background Color', 'cwv3' ),
'desc' => __( 'The Overlay color.', 'cwv3' ),
'name' => __( 'Background Color', 'content-warning-v2' ),
'desc' => __( 'The Overlay color.', 'content-warning-v2' ),
'type' => 'color',
'fields' => array( 'color' => '#000000' ),
),
'css' => array(
'name' => __( 'Custom CSS', 'cwv3' ),
'desc' => __( 'For a completely custom look, just drop your css here.', 'cwv3' ),
'name' => __( 'Custom CSS', 'content-warning-v2' ),
'desc' => __( 'For a completely custom look, just drop your css here.', 'content-warning-v2' ),
'type' => 'textbox',
'def' => '',
),
'cat_list' => array(
'name' => __( 'Category restrictions', 'cwv3' ),
'desc' => __( 'Select categories that you would like to restrict with the dialog.', 'cwv3' ),
'name' => __( 'Category restrictions', 'content-warning-v2' ),
'desc' => __( 'Select categories that you would like to restrict with the dialog.', 'content-warning-v2' ),
'type' => 'check',
'fields' => $final_cat_list,
),
Expand Down
Empty file added inc/settings.php
Empty file.

0 comments on commit 37328d3

Please sign in to comment.