Change localization textdomain per recommendations

This commit is contained in:
Jay Wood
2016-06-30 15:44:44 -04:00
parent f9e40a34a4
commit 37328d3035
5 changed files with 85 additions and 57 deletions

View File

@ -79,7 +79,7 @@ class CWV3Admin {
if ( is_array( $post_type ) ) { if ( is_array( $post_type ) ) {
foreach ( $post_type as $screen ) { foreach ( $post_type as $screen ) {
add_meta_box( 'cwv3_meta_section', add_meta_box( 'cwv3_meta_section',
__( 'CWV3 Security', 'cwv3' ), __( 'CWV3 Security', 'content-warning-v2' ),
array( $this, 'render_metabox' ), array( $this, 'render_metabox' ),
$screen, $screen,
'side', 'side',
@ -137,9 +137,9 @@ class CWV3Admin {
$disabled = isset( $site_wide[0] ) && 'enabled' == $site_wide[0] ? true : false; $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 ) : ?> <?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; <?php endif;
} }
} }

View File

@ -6,25 +6,53 @@ Description: A WordPress Plugin to allow site owners to display an acceptance d
Author: Jerry Wood Jr. Author: Jerry Wood Jr.
Version: 3.7 Version: 3.7
Author URI: http://plugish.com Author URI: http://plugish.com
Text Domain: cwv3 Text Domain: content-warning-v2
Domain Path: /lang 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' ) ) { class ContentWarning_v2 {
require_once dirname( __FILE__ ) . '/lib/jw_simple_options/simple_options.php';
/**
* Instance of ContentWarning_v2
* @var ContentWarning_v2
*/
public static $instance = null;
public static function init() {
if ( null == self::$instance ) {
self::$instance = new self();
} }
require_once dirname( __FILE__ ) . '/class/admin.class.php';
$cwv3_options = new JW_SIMPLE_OPTIONS( $cwv3_op_data ); return self::$instance;
// 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 content_warning_v2() {
function jw_cwv3_load_text_domain() { return ContentWarning_v2::init();
load_plugin_textdomain( 'cwv3', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
} }
add_action( 'plugins_loaded', array( content_warning_v2(), 'hooks' ) );

View File

@ -66,14 +66,14 @@ function cwv3_js_dialog() {
*/ */
function cwv3_get_js_dialog() { function cwv3_get_js_dialog() {
$exit_text = get_option( 'cwv3_exit_txt', __( 'Exit', 'cwv3' ) ); $exit_text = get_option( 'cwv3_exit_txt', __( 'Exit', 'content-warning-v2' ) );
$enter_text = get_option( 'cwv3_enter_txt', __( 'Enter', 'cwv3' ) ); $enter_text = get_option( 'cwv3_enter_txt', __( 'Enter', 'content-warning-v2' ) );
$cwv3_denial_title = get_option( 'cwv3_den_title', __( 'Access Denied', '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.', '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.', 'content-warning-v2' ) );
$cwv3_title = get_option( 'cwv3_d_title', __( 'Warning: Explicit Content', '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.', '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.', 'content-warning-v2' ) );
$exit_url = get_option( 'cwv3_exit_link', '#' ); $exit_url = get_option( 'cwv3_exit_link', '#' );
$enter_url = get_option( 'cwv3_enter_link', '#' ); $enter_url = get_option( 'cwv3_enter_link', '#' );

View File

@ -16,18 +16,18 @@ $cwv3_op_data = array(
'slug' => 'cwv3_options', 'slug' => 'cwv3_options',
'opData' => array( 'opData' => array(
'sitewide' => array( 'sitewide' => array(
'name' => __( 'Sitewide', 'cwv3' ), 'name' => __( 'Sitewide', 'content-warning-v2' ),
'type' => 'check', '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( 'fields' => array(
'enabled' => 'Enable', 'enabled' => 'Enable',
), ),
'def' => 'enabled', 'def' => 'enabled',
), ),
'homepage' => array( 'homepage' => array(
'name' => __( 'Home Page', 'cwv3' ), 'name' => __( 'Home Page', 'content-warning-v2' ),
'type' => 'check', '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( 'fields' => array(
'enabled' => 'Enable', 'enabled' => 'Enable',
), ),
@ -35,9 +35,9 @@ $cwv3_op_data = array(
), ),
'misc' => array( 'misc' => array(
'name' => __( 'Misc. Pages', 'cwv3' ), 'name' => __( 'Misc. Pages', 'content-warning-v2' ),
'type' => 'check', '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( 'fields' => array(
'enabled' => 'Enable', 'enabled' => 'Enable',
), ),
@ -47,22 +47,22 @@ $cwv3_op_data = array(
// jQuery.cookie doesn't allow hour/minutes, so we have to have a specific timeframe // jQuery.cookie doesn't allow hour/minutes, so we have to have a specific timeframe
// in days only. // in days only.
'death' => array( 'death' => array(
'name' => __( 'Cookie Life', 'cwv3' ), 'name' => __( 'Cookie Life', 'content-warning-v2' ),
'desc' => __( 'Time in days for the cookie to expire', 'cwv3' ), 'desc' => __( 'Time in days for the cookie to expire', 'content-warning-v2' ),
'type' => 'number', 'type' => 'number',
'def' => '1', 'def' => '1',
), ),
// Dialog Options // Dialog Options
'd_title' => array( 'd_title' => array(
'name' => __( 'Dialog Title', 'cwv3' ), 'name' => __( 'Dialog Title', 'content-warning-v2' ),
'desc' => '', 'desc' => '',
'type' => 'text', 'type' => 'text',
'def' => 'WARNING: Explicit Content', 'def' => 'WARNING: Explicit Content',
), ),
'd_msg' => array( 'd_msg' => array(
'name' => __( 'Dialog Message', 'cwv3' ), 'name' => __( 'Dialog Message', 'content-warning-v2' ),
'type' => 'editor', '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.', '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( 'settings' => array(
'teeny' => true, 'teeny' => true,
@ -70,38 +70,38 @@ $cwv3_op_data = array(
), ),
), ),
'exit_txt' => array( 'exit_txt' => array(
'name' => __( 'Exit Text', 'cwv3' ), 'name' => __( 'Exit Text', 'content-warning-v2' ),
'type' => 'text', 'type' => 'text',
'desc' => __( 'The text for the exit button.', 'cwv3' ), 'desc' => __( 'The text for the exit button.', 'content-warning-v2' ),
'def' => 'Exit', 'def' => 'Exit',
), ),
'exit_link' => array( 'exit_link' => array(
'name' => __( 'Exit Link', 'cwv3' ), 'name' => __( 'Exit Link', 'content-warning-v2' ),
'type' => 'text', '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', 'def' => 'http://google.com',
), ),
'enter_txt' => array( 'enter_txt' => array(
'name' => __( 'Enter Text', 'cwv3' ), 'name' => __( 'Enter Text', 'content-warning-v2' ),
'type' => 'text', 'type' => 'text',
'desc' => __( 'The text for the enter button.', 'cwv3' ), 'desc' => __( 'The text for the enter button.', 'content-warning-v2' ),
'def' => 'Enter', 'def' => 'Enter',
), ),
'enter_link' => array( 'enter_link' => array(
'name' => __( 'Enter Link', 'cwv3' ), 'name' => __( 'Enter Link', 'content-warning-v2' ),
'type' => 'text', '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' => '#', 'def' => '#',
), ),
// Denial Options // Denial Options
'denial' => array( 'denial' => array(
'name' => __( 'Toggle Denial Option', 'cwv3' ), 'name' => __( 'Toggle Denial Option', 'content-warning-v2' ),
'desc' => '', 'desc' => '',
'type' => 'check', 'type' => 'check',
'fields' => array( 'enabled' => 'Enable denial handling.' ), 'fields' => array( 'enabled' => 'Enable denial handling.' ),
), ),
'method' => array( 'method' => array(
'name' => __( 'Denial Handling Method', 'cwv3' ), 'name' => __( 'Denial Handling Method', 'content-warning-v2' ),
'desc' => '', 'desc' => '',
'type' => 'radio', 'type' => 'radio',
'fields' => array( 'fields' => array(
@ -111,16 +111,16 @@ $cwv3_op_data = array(
'def' => 'redirect', 'def' => 'redirect',
), ),
'den_title' => array( 'den_title' => array(
'name' => __( 'Dialog Title', 'cwv3' ), 'name' => __( 'Dialog Title', 'content-warning-v2' ),
'desc' => '', 'desc' => '',
'type' => 'text', 'type' => 'text',
'def' => 'Access Denied', 'def' => 'Access Denied',
), ),
'den_msg' => array( 'den_msg' => array(
'name' => __( 'Denial Message', 'cwv3' ), 'name' => __( 'Denial Message', 'content-warning-v2' ),
'desc' => '', 'desc' => '',
'type' => 'editor', '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( 'settings' => array(
'media_buttons' => false, 'media_buttons' => false,
'teeny' => true, 'teeny' => true,
@ -129,32 +129,32 @@ $cwv3_op_data = array(
// Advanced Options // Advanced Options
//// Styling Options //// Styling Options
'bg_image' => array( 'bg_image' => array(
'name' => __( 'Background Image', 'cwv3' ), 'name' => __( 'Background Image', 'content-warning-v2' ),
'desc' => __( 'If not empty, the dialog will use this instead of the background opacity and color.', 'cwv3' ), 'desc' => __( 'If not empty, the dialog will use this instead of the background opacity and color.', 'content-warning-v2' ),
'type' => 'media', 'type' => 'media',
), ),
'bg_opacity' => array( 'bg_opacity' => array(
'name' => __( 'Background Opacity', 'cwv3' ), 'name' => __( 'Background Opacity', 'content-warning-v2' ),
'desc' => __( 'Input a float value from 0-1, the latter being completely opaque.', 'cwv3' ), 'desc' => __( 'Input a float value from 0-1, the latter being completely opaque.', 'content-warning-v2' ),
'type' => 'number', 'type' => 'number',
'def' => 0.85, 'def' => 0.85,
'step' => 0.01, 'step' => 0.01,
), ),
'bg_color' => array( 'bg_color' => array(
'name' => __( 'Background Color', 'cwv3' ), 'name' => __( 'Background Color', 'content-warning-v2' ),
'desc' => __( 'The Overlay color.', 'cwv3' ), 'desc' => __( 'The Overlay color.', 'content-warning-v2' ),
'type' => 'color', 'type' => 'color',
'fields' => array( 'color' => '#000000' ), 'fields' => array( 'color' => '#000000' ),
), ),
'css' => array( 'css' => array(
'name' => __( 'Custom CSS', 'cwv3' ), 'name' => __( 'Custom CSS', 'content-warning-v2' ),
'desc' => __( 'For a completely custom look, just drop your css here.', 'cwv3' ), 'desc' => __( 'For a completely custom look, just drop your css here.', 'content-warning-v2' ),
'type' => 'textbox', 'type' => 'textbox',
'def' => '', 'def' => '',
), ),
'cat_list' => array( 'cat_list' => array(
'name' => __( 'Category restrictions', 'cwv3' ), 'name' => __( 'Category restrictions', 'content-warning-v2' ),
'desc' => __( 'Select categories that you would like to restrict with the dialog.', 'cwv3' ), 'desc' => __( 'Select categories that you would like to restrict with the dialog.', 'content-warning-v2' ),
'type' => 'check', 'type' => 'check',
'fields' => $final_cat_list, 'fields' => $final_cat_list,
), ),

0
inc/settings.php Normal file
View File