diff --git a/.gitignore b/.gitignore
index 901fe44f..53b29fc4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,5 @@ tests/_output/*
tests/_support/*
languages/
+build/
tests/_output/*
\ No newline at end of file
diff --git a/assets/banner-1544x500.jpg b/assets/banner-1544x500.jpg
new file mode 100644
index 00000000..2f92b939
Binary files /dev/null and b/assets/banner-1544x500.jpg differ
diff --git a/assets/banner-772x250.jpg b/assets/banner-772x250.jpg
new file mode 100644
index 00000000..4247510c
Binary files /dev/null and b/assets/banner-772x250.jpg differ
diff --git a/assets/icon-128x128.jpg b/assets/icon-128x128.jpg
new file mode 100644
index 00000000..b95cb331
Binary files /dev/null and b/assets/icon-128x128.jpg differ
diff --git a/assets/icon-256x256.jpg b/assets/icon-256x256.jpg
new file mode 100644
index 00000000..dd2dbe8a
Binary files /dev/null and b/assets/icon-256x256.jpg differ
diff --git a/assets/screenshot-1.jpg b/assets/screenshot-1.jpg
new file mode 100644
index 00000000..d735d663
Binary files /dev/null and b/assets/screenshot-1.jpg differ
diff --git a/assets/screenshot-2.jpg b/assets/screenshot-2.jpg
new file mode 100644
index 00000000..2dac9a7f
Binary files /dev/null and b/assets/screenshot-2.jpg differ
diff --git a/includes/admin/transifex-live-integration-settings-page.php b/includes/admin/transifex-live-integration-settings-page.php
index f783a9b3..a9665ed8 100644
--- a/includes/admin/transifex-live-integration-settings-page.php
+++ b/includes/admin/transifex-live-integration-settings-page.php
@@ -50,7 +50,7 @@ public function admin_notices() {
$notice .= '
' . __( 'Your changes to the colors have been saved!', TRANSIFEX_LIVE_INTEGRATION_TEXT_DOMAIN ) . '
';
}
- echo '' . $notice . '
';
+ echo '' . $notice . '
';
}
static public function sanitize_settings( $settings ) {
diff --git a/includes/plugin-debug.php b/includes/plugin-debug.php
index a2884084..288cbac0 100644
--- a/includes/plugin-debug.php
+++ b/includes/plugin-debug.php
@@ -4,8 +4,8 @@
* Class Name: Plugin Debug
* Description: An plugin/application error/trace log handler. It *only* traps info from the plugin, and the display is controllable from "Settings" page
* Author: Matthew Jackowski
- * Version: 0.2.0
- * Author URI: http://www.linkedin.com/pub/matthew-jackowski/6/6b2/242
+ * Version: 0.2.1
+ * Author URI: https://github.com/matthewjackowski/
* License: GNU General Public License 2.0 (GPL) http://www.gnu.org/licenses/gpl.html
*/
?>
@@ -21,7 +21,7 @@ class Plugin_Debug {
* Define the core functionality of the plugin.
*/
public function __construct() {
- self::$debug_mode = true;
+ self::$debug_mode = false;
$this->logTrace();
// Check to see if plugin is in debug mode
@@ -70,43 +70,44 @@ public function printLog() {
}
static function printLogCallback( $value, $key ) {
- // $options = get_option('debug_section');
- echo "*
";
- if ( array_key_exists( 'file', $value ) )
- echo ("File: " . basename( $value['file'] ) . " - ");
- if ( array_key_exists( 'line', $value ) )
- echo ('Line #: ' . $value['line'] . '');
- echo "
";
- if ( array_key_exists( 'class', $value ) )
- echo ("Class: " . $value['class'] . " - ");
- if ( array_key_exists( 'function', $value ) )
- echo ('Function: ' . $value['function'] . '');
- echo "
";
- if ( array_key_exists( 'type', $value ) ) {
- echo ("Type: ");
- switch ($value['type']) {
- case "::":
- echo ("static method call");
- break;
- case "->" :
- echo ("method call");
- break;
- default :
- echo ("function call");
+ if ( self::$debug_mode ) {
+ echo "*
";
+ if ( array_key_exists( 'file', $value ) )
+ echo ("File: " . basename( $value['file'] ) . " - ");
+ if ( array_key_exists( 'line', $value ) )
+ echo ('Line #: ' . $value['line'] . '');
+ echo "
";
+ if ( array_key_exists( 'class', $value ) )
+ echo ("Class: " . $value['class'] . " - ");
+ if ( array_key_exists( 'function', $value ) )
+ echo ('Function: ' . $value['function'] . '');
+ echo "
";
+ if ( array_key_exists( 'type', $value ) ) {
+ echo ("Type: ");
+ switch ($value['type']) {
+ case "::":
+ echo ("static method call");
+ break;
+ case "->" :
+ echo ("method call");
+ break;
+ default :
+ echo ("function call");
+ }
+ echo(" - ");
}
- echo(" - ");
- }
- if ( array_key_exists( 'args', $value ) ) {
- echo ('Parameters: ');
- print_r( $value['args'] );
+ if ( array_key_exists( 'args', $value ) ) {
+ echo ('Parameters: ');
+ print_r( $value['args'] );
+ echo ('');
+ }
+ echo "
";
+ if ( array_key_exists( 'message', $value ) && $value['message'] != null )
+ echo ('');
+ print_r( $value['message'] );
echo ('');
+ echo "
*";
}
- echo "
";
- if ( array_key_exists( 'message', $value ) && $value['message'] != null )
- echo ('');
- print_r( $value['message'] );
- echo ('');
- echo "
*";
}
}
diff --git a/includes/transifex-live-integration-css.php b/includes/transifex-live-integration-css.php
index bd86eb80..7698fba5 100644
--- a/includes/transifex-live-integration-css.php
+++ b/includes/transifex-live-integration-css.php
@@ -1,12 +1,32 @@
settings = $settings;
}
+ /**
+ * Renders CSS inline on the page
+ */
function inline_render() {
Plugin_Debug::logTrace();
if ( $this->ok_add_css ) {
$colors = array_map( 'esc_attr', (array) get_option( 'transifex_live_colors', array() ) );
- foreach ($colors as $key => $values) {
- if ( empty( $colors[$key] ) ) {
- $colors[$key] = $values['default'];
+ foreach ( $colors as $key => $values ) {
+ if ( empty( $colors[ $key ] ) ) {
+ $colors[ $key ] = $values['default'];
}
}
@@ -61,7 +84,7 @@ function inline_render() {
}
CSS;
- Transifex_Live_Integration_Lib::enqueue_inline_styles( 'transifex-live-integration-css', $css );
+ wp_add_inline_style( 'transifex-live-integration-css', $css );
}
}
diff --git a/includes/transifex-live-integration-defaults.php b/includes/transifex-live-integration-defaults.php
index a61fe1f0..ea7759e8 100644
--- a/includes/transifex-live-integration-defaults.php
+++ b/includes/transifex-live-integration-defaults.php
@@ -1,7 +1,18 @@
'#ffffff',
'background' => '#000000',
'menu' => '#eaf1f7',
- 'languages' => '#666666'
+ 'languages' => '#666666',
],
'color_labels' => [
'accent' => __( 'Accent', TRANSIFEX_LIVE_INTEGRATION_TEXT_DOMAIN ),
'text' => __( 'Text', TRANSIFEX_LIVE_INTEGRATION_TEXT_DOMAIN ),
'background' => __( 'Background', TRANSIFEX_LIVE_INTEGRATION_TEXT_DOMAIN ),
'menu' => __( 'Menu', TRANSIFEX_LIVE_INTEGRATION_TEXT_DOMAIN ),
- 'languages' => __( 'Languages', TRANSIFEX_LIVE_INTEGRATION_TEXT_DOMAIN )
+ 'languages' => __( 'Languages', TRANSIFEX_LIVE_INTEGRATION_TEXT_DOMAIN ),
],
'urls' => [
'rate_us' => 'https://wordpress.org/support/view/plugin-reviews/transifex-live-integration?rate=5#postform',
- 'api_key_landing_page' => 'https://www.transifex.com/live/?utm_source=liveplugin'
- ]
+ 'api_key_landing_page' => 'https://www.transifex.com/live/?utm_source=liveplugin',
+ ],
);
}
diff --git a/includes/transifex-live-integration-javascript.php b/includes/transifex-live-integration-javascript.php
index b9909345..a6999dc7 100644
--- a/includes/transifex-live-integration-javascript.php
+++ b/includes/transifex-live-integration-javascript.php
@@ -1,22 +1,41 @@
live_settings = $live_settings;
}
+ /**
+ * Renders javascript includes in the page
+ */
function render() {
Plugin_Debug::logTrace();
$live_settings_string = json_encode( $this->live_settings );
Plugin_Debug::logTrace( $live_settings_string );
- echo <<window.liveSettings=$live_settings_string;
LIVE;
+ echo $include;
}
}
diff --git a/includes/transifex-live-integration-lib.php b/includes/transifex-live-integration-lib.php
index 7de896fd..50d80c03 100644
--- a/includes/transifex-live-integration-lib.php
+++ b/includes/transifex-live-integration-lib.php
@@ -1,5 +1,12 @@
done[] = $handle;
- };
- $hook = 'wp_print_styles';
- add_action( $hook, $cb );
- }
}
diff --git a/includes/transifex-live-integration-static-files-handler.php b/includes/transifex-live-integration-static-files-handler.php
index d476db05..c1004f51 100644
--- a/includes/transifex-live-integration-static-files-handler.php
+++ b/includes/transifex-live-integration-static-files-handler.php
@@ -1,60 +1,103 @@
css_files = array();
$this->js_files = array();
}
+ /**
+ * Adds a single css file to plugin
+ * @param string $version Current plugin version.
+ * @param string $url Url to static file (can be external).
+ * @param string $handle Identifier if it might be used previously, otherwise generate a random one.
+ * @return array Associatative array in a format that can be enqueued.
+ */
public function add_css_file( $version, $url, $handle = null ) {
- if ( $handle == null ) {
+ if ( null === $handle ) {
$length = 4;
- $randomString = substr( str_shuffle( "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ), 0, $length );
+ $randomString = substr( str_shuffle( '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ), 0, $length );
$handle = TRANSIFEX_LIVE_INTEGRATION_NAME . $randomString;
}
- $arr = ['version' => $version, 'url' => $url, 'handle' => $handle ];
+ $arr = [ 'version' => $version, 'url' => $url, 'handle' => $handle ];
return array_push( $this->css_files, $arr );
}
+ /**
+ * Adds a single js file to plugin
+ * @param string $version Current plugin version.
+ * @param string $url Url to static file (can be external).
+ * @param string $handle Identifier if it might be used previously, otherwise generate a random one.
+ * @return array Associatative array in a format that can be enqueued.
+ */
public function add_js_file( $version, $url, $handle = null ) {
- if ( $handle == null ) {
+ if ( null === $handle ) {
$length = 4;
- $randomString = substr( str_shuffle( "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ), 0, $length );
+ $randomString = substr( str_shuffle( '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ), 0, $length );
$handle = TRANSIFEX_LIVE_INTEGRATION_NAME . $randomString;
}
- $arr = ['version' => $version, 'url' => $url, 'handle' => $handle ];
+ $arr = [ 'version' => $version, 'url' => $url, 'handle' => $handle ];
return array_push( $this->js_files, $arr );
}
+ /**
+ * Renders css through enqueue
+ */
public function render_css() {
Plugin_Debug::logTrace();
- foreach ($this->css_files as $file) {
+ foreach ( $this->css_files as $file ) {
wp_enqueue_style( $file['handle'], $file['url'], false, $file['version'], 'all' );
}
}
+ /**
+ * Renders js through enqueue
+ */
public function render_js() {
Plugin_Debug::logTrace();
- foreach ($this->js_files as $file) {
+ foreach ( $this->js_files as $file ) {
wp_enqueue_script( $file['handle'], $file['url'], false, $file['version'], 'all' );
}
}
+ /**
+ * Tries to use existing Wordpress color picker js, otherwise load from admin
+ * @return none
+ */
public function render_iris_color_picker() {
Plugin_Debug::logTrace();
if ( isset( $wp_scripts->registered['iris'] ) ) {
return;
}
- // thanks to http://wordpress.stackexchange.com/questions/82718/how-do-i-implement-the-wordpress-iris-picker-into-my-plugin-on-the-front-end
+ // Thanks to http://wordpress.stackexchange.com/questions/82718/how-do-i-implement-the-wordpress-iris-picker-into-my-plugin-on-the-front-end.
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script(
- 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 'wp-color-picker', admin_url( 'js/color-picker.min.js' ), array( 'iris' ), false, 1
+ 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 'wp-color-picker', admin_url( 'js/color-picker.min.js' ), array( 'iris' ), false, 1
);
}
diff --git a/readme.md b/readme.md
index 25f383ed..f7f06873 100755
--- a/readme.md
+++ b/readme.md
@@ -28,7 +28,7 @@ Translators can contribute new languages to this plugin or our other WordPress p
== Minimum Requirements ==
-* WordPress 3.0 or greater
+* WordPress 3.5.2 or greater
* PHP version 5.2.4 or greater
* MySQL version 5.0 or greater
@@ -64,8 +64,8 @@ Full relase. Restructured plugin to follow boilerplate. Added unit tests.
= 1.0.1
Minor edits for documentation
-=1.0.2
-Code refactor
+= 1.0.2 =
+Fixed brittle js ordering and namespace
-=1.0.3
+= 1.0.3 =
Removed settings that can now be controlled in Transifex Live dashboard
\ No newline at end of file
diff --git a/readme.txt b/readme.txt
index 2be3dc14..a986977d 100755
--- a/readme.txt
+++ b/readme.txt
@@ -2,9 +2,9 @@
Name: Transifex Live Translation Plugin
Contributors: txmatthew, ThemeBoy, brooksx
Tags: transifex, translate, translations, localize, localise, localization, localisation, multilingual, t9n, l10n, i18n, language, switcher, live, translation, translator
-Requires at least: 3.0
-Tested up to: 4.2.2
-Stable tag: 1.0.2
+Requires at least: 3.5.2
+Tested up to: 4.3.1
+Stable tag: 1.0.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -36,7 +36,7 @@ Translators can contribute new languages to this plugin or our other WordPress p
Minimum Requirements
-* WordPress 3.0 or greater
+* WordPress 3.5.2 or greater
* PHP version 5.2.4 or greater
* MySQL version 5.0 or greater
@@ -75,3 +75,6 @@ Cleaned up readme and notes
= 1.0.2 =
Fixed brittle js ordering and namespace
+
+= 1.0.3 =
+Removed settings that can now be controlled in Transifex Live dashboard
diff --git a/transifex-live-integration.php b/transifex-live-integration.php
index 3f700e6b..59b7b310 100755
--- a/transifex-live-integration.php
+++ b/transifex-live-integration.php
@@ -1,8 +1,9 @@
inline_render();
}
}
-
+ /**
+ * Callback function for admin_menu action
+ */
static function admin_menu_hook() {
Plugin_Debug::logTrace();
add_options_page( 'Transifex Live', 'Transifex Live', 'manage_options', TRANSIFEX_LIVE_INTEGRATION_TEXT_DOMAIN, array( 'Transifex_Live_Integration_Settings_Page', 'options_page' ) );
}
+ /**
+ * Plugin deactivation stub
+ */
static function deactivation_hook() {
Plugin_Debug::logTrace();
}
+ /**
+ * Plugin activation stub
+ */
static function activation_hook() {
Plugin_Debug::logTrace();
}
}
-Transifex_Live_Integration::do_plugin( is_admin(), '1.0.3' );
+Transifex_Live_Integration::do_plugin( is_admin(), $version );