Skip to content

Commit

Permalink
Merge pull request #348 from Codeinwp/development
Browse files Browse the repository at this point in the history
Fix issues with newsletter form
  • Loading branch information
contactashish13 authored Apr 18, 2019
2 parents 70fe60b + 572e8f6 commit f8ba942
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 30 deletions.
6 changes: 3 additions & 3 deletions class-autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ class Autoloader {
protected static function check_namespaces( $class_name ) {
$found = false;
foreach ( static::$namespaces as $namespace ) {
if ( substr( $class_name, 0, strlen( $namespace ) ) == $namespace ) {
if ( substr( $class_name, 0, strlen( $namespace ) ) === $namespace ) {
$found = true;
}
if ( $namespace == 'OBFX_Module' && substr( $class_name, strlen( $namespace ) * ( -1 ), strlen( $namespace ) ) == $namespace ) {
if ( $namespace === 'OBFX_Module' && substr( $class_name, strlen( $namespace ) * ( -1 ), strlen( $namespace ) ) === $namespace ) {
return static::module_loader( $class_name );
}
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public static function loader( $class_name ) {
*/
public static function module_loader( $class_name ) {
$module_name = str_replace( '_', '-', strtolower( str_replace( '_OBFX_Module', '', $class_name ) ) );
if ( static::$plugins_path != '' ) {
if ( static::$plugins_path !== '' ) {
$directories = glob( static::$plugins_path . '*' . DIRECTORY_SEPARATOR . 'obfx_modules' . DIRECTORY_SEPARATOR . $module_name, GLOB_ONLYDIR );
foreach ( $directories as $directory ) {
$filename = $directory . DIRECTORY_SEPARATOR . 'init.php';
Expand Down
10 changes: 6 additions & 4 deletions core/app/abstract/class-orbit-fox-module-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,15 @@ public function get_notices() {
*/
public function update_showed_notices() {
$showed_notices = $this->get_status( 'showed_notices' );
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( $showed_notices == false ) {
$showed_notices = array();
}
foreach ( $this->notices as $notice ) {
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( $notice['display_always'] == false ) {
$hash = md5( serialize( $notice ) );
if ( ! in_array( $hash, $showed_notices ) ) {
if ( ! in_array( $hash, $showed_notices, true ) ) {
$showed_notices[] = $hash;
}
}
Expand Down Expand Up @@ -294,7 +296,7 @@ public abstract function hooks();
* @return bool
*/
final public function get_is_active() {
if ( $this->auto == true ) {
if ( $this->auto === true ) {
return true;
}
if ( ! isset( $this->model ) ) {
Expand Down Expand Up @@ -490,7 +492,7 @@ private function set_styles( $enqueue, $prefix ) {
$order = 0;
$map = array();
foreach ( $enqueue['css'] as $file_name => $dependencies ) {
if ( $dependencies == false ) {
if ( $dependencies === false ) {
$dependencies = array();
} else {
// check if any dependency has been loaded by us. If yes, then use that id as the dependency.
Expand Down Expand Up @@ -564,7 +566,7 @@ private function set_scripts( $enqueue, $prefix ) {
$order = 0;
$map = array();
foreach ( $enqueue['js'] as $file_name => $dependencies ) {
if ( $dependencies == false ) {
if ( $dependencies === false ) {
$dependencies = array();
} else {
// check if any dependency has been loaded by us. If yes, then use that id as the dependency.
Expand Down
15 changes: 9 additions & 6 deletions core/app/class-orbit-fox-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function enqueue_styles() {
if ( empty( $screen ) ) {
return;
}
if ( in_array( $screen->id, array( 'toplevel_page_obfx_companion' ) ) ) {
if ( in_array( $screen->id, array( 'toplevel_page_obfx_companion' ), true ) ) {
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . '../assets/css/orbit-fox-admin.css', array(), $this->version, 'all' );
}
do_action( 'obfx_admin_enqueue_styles' );
Expand Down Expand Up @@ -105,7 +105,7 @@ public function enqueue_scripts() {
if ( empty( $screen ) ) {
return;
}
if ( in_array( $screen->id, array( 'toplevel_page_obfx_companion' ) ) ) {
if ( in_array( $screen->id, array( 'toplevel_page_obfx_companion' ), true ) ) {
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . '../assets/js/orbit-fox-admin.js', array( 'jquery' ), $this->version, false );
}
do_action( 'obfx_admin_enqueue_scripts' );
Expand Down Expand Up @@ -163,6 +163,7 @@ class="notice-dismiss" style="text-decoration: none;">
function visit_dashboard_notice_dismiss() {
global $current_user;
$user_id = $current_user->ID;
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( isset( $_GET['obfx_ignore_visit_dashboard_notice'] ) && '0' == $_GET['obfx_ignore_visit_dashboard_notice'] ) {
add_user_meta( $user_id, 'obfx_ignore_visit_dashboard_notice', 'true', true );
wp_safe_redirect( admin_url( 'admin.php?page=obfx_companion' ) );
Expand Down Expand Up @@ -419,7 +420,7 @@ public function try_module_activate( $data ) {
* @access public
*/
public function trigger_activate_deactivate( $active_status, Orbit_Fox_Module_Abstract $module ) {
if ( $active_status == true ) {
if ( $active_status === true ) {
do_action( $module->get_slug() . '_activate' );
} else {
do_action( $module->get_slug() . '_deactivate' );
Expand Down Expand Up @@ -457,16 +458,18 @@ public function page_modules_render() {
$data = array(
'notice' => $notice,
);
if ( $notice['display_always'] == false && ! in_array( $hash, $showed_notices ) ) {
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( $notice['display_always'] == false && ! in_array( $hash, $showed_notices, true ) ) {
$toasts .= $rdh->get_partial( 'module-toast', $data );
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
} elseif ( $notice['display_always'] == true ) {
$toasts .= $rdh->get_partial( 'module-toast', $data );
}
}
}

$module->update_showed_notices();
if ( $module->auto == false ) {
if ( $module->auto === false ) {
$count_modules ++;
$checked = '';
if ( $module->get_is_active() ) {
Expand Down Expand Up @@ -510,7 +513,7 @@ public function page_modules_render() {

$no_modules = false;
$empty_tpl = '';
if ( $count_modules == 0 ) {
if ( $count_modules === 0 ) {
$no_modules = true;
$empty_tpl = $rdh->get_partial(
'empty',
Expand Down
5 changes: 3 additions & 2 deletions core/app/helpers/class-orbit-fox-render-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private function field_text( $option = array(), $is_email = false ) {
*/
private function set_field_value( $option = array() ) {
$field_value = $option['default'];
if ( isset( $option['value'] ) && $option['value'] != '' ) {
if ( isset( $option['value'] ) && $option['value'] !== '' ) {
$field_value = $option['value'];
}

Expand Down Expand Up @@ -306,6 +306,7 @@ private function field_select( $option = array() ) {
$select_options = '';
foreach ( $option['options'] as $value => $label ) {
$is_selected = '';
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( $field_value == $value ) {
$is_selected = 'selected';
}
Expand Down Expand Up @@ -335,7 +336,7 @@ private function field_radio( $option = array() ) {
$select_options = '';
foreach ( $option['options'] as $value => $label ) {
$checked = '';
if ( $value == $field_value ) {
if ( $value === $field_value ) {
$checked = 'checked';
}
$select_options .= $this->generate_check_type( 'radio', $value, $checked, $label, $option );
Expand Down
2 changes: 1 addition & 1 deletion core/app/views/modules-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<div class="panel-header text-center">
<div class="panel-title mt-10"><?php echo __( 'Activated Modules Options', 'themeisle-companion' ); ?></div>
</div>
<?php echo ( $panels == '' ) ? '<p class="text-center">' . __( 'No modules activated.', 'themeisle-companion' ) . '</p>' : $panels; ?>
<?php echo ( $panels === '' ) ? '<p class="text-center">' . __( 'No modules activated.', 'themeisle-companion' ) . '</p>' : $panels; ?>
</div>
<?php
}
Expand Down
2 changes: 1 addition & 1 deletion core/assets/css/orbit-fox-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Extends Spectre.css Library
*/
/*
Version: 2.8.0
Version: 2.8.1
*/

/* Document
Expand Down
2 changes: 1 addition & 1 deletion core/includes/class-orbit-fox.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __construct() {

$this->plugin_name = 'orbit-fox';

$this->version = '2.8.0';
$this->version = '2.8.1';

$this->load_dependencies();
$this->set_locale();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function obfx_show_post_grid_meta( $settings ) {
$meta_data = ! empty( $settings->meta_data ) ? ( is_array( $settings->meta_data ) ? $settings->meta_data : array( $settings->meta_data ) ) : array();
$show_icons = ! empty( $settings->show_icons ) ? $settings->show_icons : '';
echo '<div class="obfx-post-grid-meta">';
if ( in_array( 'author', $meta_data ) ) {
if ( in_array( 'author', $meta_data, true ) ) {
$author = get_the_author( $pid );
if ( ! empty( $author ) ) {
echo '<div class="obfx-author">';
Expand All @@ -109,7 +109,7 @@ function obfx_show_post_grid_meta( $settings ) {
}
}

if ( in_array( 'date', $meta_data ) ) {
if ( in_array( 'date', $meta_data, true ) ) {
echo '<div class="obfx-date">';
if ( $show_icons === 'yes' ) {
echo '<i class="fa fa-calendar"></i>';
Expand All @@ -118,7 +118,7 @@ function obfx_show_post_grid_meta( $settings ) {
echo '</div>';
}

if ( in_array( 'category', $meta_data ) ) {
if ( in_array( 'category', $meta_data, true ) ) {
$cat = get_the_category();
if ( ! empty( $cat ) ) {
echo '<div class="obfx-category">';
Expand All @@ -143,7 +143,7 @@ function obfx_show_post_grid_meta( $settings ) {
}
}

if ( in_array( 'tags', $meta_data ) ) {
if ( in_array( 'tags', $meta_data, true ) ) {
$tags = wp_get_post_tags( $pid );
if ( ! empty( $tags ) ) {
echo '<div class="obfx-tags">';
Expand All @@ -168,12 +168,13 @@ function obfx_show_post_grid_meta( $settings ) {
}
}

if ( in_array( 'comments', $meta_data ) ) {
if ( in_array( 'comments', $meta_data, true ) ) {
echo '<div class=obfx-comments">';
if ( $show_icons === 'yes' ) {
echo '<i class="fa fa-comment"></i>';
}
$comments_number = get_comments_number();
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( 0 == ! $comments_number ) {
if ( 1 === $comments_number ) {
/* translators: %s: post title */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<?php foreach ( FLBuilderLoop::post_types() as $slug => $type ) : ?>
<table class="fl-form-table fl-custom-query-filter fl-custom-query-<?php echo $slug; ?>-filter"
<?php
if ( $slug == $settings->post_type ) {
if ( $slug === $settings->post_type ) {
echo 'style="display:table;"';}
?>
>
Expand Down
4 changes: 2 additions & 2 deletions obfx_modules/image-cdn/inc/class-orbit-fox-image-replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public function filter_image_downsize( $image, $attachment_id, $size ) {
* @return array
*/
protected static function image_sizes() {
if ( null == self::$image_sizes ) {
if ( null === self::$image_sizes ) {
global $_wp_additional_image_sizes;

// Populate an array matching the data structure of $_wp_additional_image_sizes so we have a consistent structure for image sizes
Expand Down Expand Up @@ -473,7 +473,7 @@ public function filter_the_content( $content ) {
if ( preg_match( '#class=["|\']?[^"\']*size-([^"\'\s]+)[^"\']*["|\']?#i', $images['img_tag'][ $index ], $size ) ) {
$size = array_pop( $size );
if ( false === $width && false === $height && 'full' != $size && array_key_exists( $size, $image_sizes ) ) {
if ( false === $width && false === $height && 'full' !== $size && array_key_exists( $size, $image_sizes, true ) ) {
$width = (int) $image_sizes[ $size ]['width'];
$height = (int) $image_sizes[ $size ]['height'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,22 @@
<?php
foreach ( $social_links_array as $network_data ) {
$class = '';
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( $network_data['show_desktop'] == '0' ) {
$class .= 'obfx-hide-desktop-socials ';
}
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( $network_data['show_mobile'] == '0' ) {
$class .= 'obfx-hide-mobile-socials ';
}
?>
<li class="<?php echo esc_attr( $class ); ?>">
<a rel="tooltip" data-original-title="<?php echo esc_attr( __( 'Share on ', 'themeisle-companion' ) . $network_data['nicename'] ); ?>" class = "btn btn-just-icon btn-round btn-<?php echo esc_attr( $network_data['icon'] ); ?>" <?php echo ( isset( $network_data['target'] ) && $network_data['target'] != '0' ) ? 'target="_blank"' : ''; ?> href="<?php echo esc_url( $network_data['link'] ); ?>"> <i class="socicon-<?php echo esc_attr( $network_data['icon'] ); ?>"></i>
<a rel="tooltip" data-original-title="<?php echo esc_attr( __( 'Share on ', 'themeisle-companion' ) . $network_data['nicename'] ); ?>" class = "btn btn-just-icon btn-round btn-<?php echo esc_attr( $network_data['icon'] ); ?>"
<?php
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
echo ( isset( $network_data['target'] ) && $network_data['target'] != '0' ) ? 'target="_blank"' : '';
?>
href="<?php echo esc_url( $network_data['link'] ); ?>"> <i class="socicon-<?php echo esc_attr( $network_data['icon'] ); ?>"></i>
</a>
</li>
<?php } ?>
Expand Down
8 changes: 7 additions & 1 deletion obfx_modules/social-sharing/views/social-sharing-tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,22 @@
<?php
foreach ( $social_links_array as $network_data ) {
$class = '';
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( $network_data['show_desktop'] == '0' ) {
$class .= 'obfx-hide-desktop-socials ';
}
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
if ( $network_data['show_mobile'] == '0' ) {
$class .= 'obfx-hide-mobile-socials ';
}
?>
<li class="<?php echo esc_attr( $class ); ?>">
<a class = "<?php echo esc_attr( $network_data['icon'] ); ?>"
<?php echo ( isset( $network_data['target'] ) && $network_data['target'] != '0' ) ? 'target="_blank"' : ''; ?> href="<?php echo esc_url( $network_data['link'] ); ?>">
<?php
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
echo ( isset( $network_data['target'] ) && $network_data['target'] != '0' ) ? 'target="_blank"' : '';
?>
href="<?php echo esc_url( $network_data['link'] ); ?>">
<i class="socicon-<?php echo esc_attr( $network_data['icon'] ); ?>"></i>
<?php
if ( $show_name ) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "themeisle-companion",
"version": "2.8.0",
"version": "2.8.1",
"description": "Orbit Fox",
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<exclude name="WordPress.PHP.YodaConditions.NotYoda" />
<exclude name="WordPress.WhiteSpace.PrecisionAlignment.Found" />
<exclude name="Generic.Files.LineEndings.InvalidEOLChar" />
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.Found" />
</rule>
<rule ref="WordPress-Docs">

Expand Down
2 changes: 1 addition & 1 deletion themeisle-companion.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Plugin Name: Orbit Fox Companion
* Plugin URI: https://orbitfox.com/
* Description: This swiss-knife plugin comes with a quality template library, menu/sharing icons modules, Gutenberg blocks, and newly added Elementor/BeaverBuilder page builder widgets on each release.
* Version: 2.8.0
* Version: 2.8.1
* Author: Themeisle
* Author URI: https://orbitfox.com/
* License: GPL-2.0+
Expand Down

0 comments on commit f8ba942

Please sign in to comment.