WordPress.org

Ready to get started?Download WordPress

Forums

Social Sharing Toolkit
[PHP Notice: Undefined index: enable] small fix suggest (2 posts)

  1. Carsten Bach
    Member
    Posted 1 year ago #

    Hi,

    I noticed, that your Plugin throws many, many PHP notices on undefined array indexes and I'm not happy about this "log-spamming".

    Maybe you could change Lines 599 and 615 in your social_sharing_toolkit.php to use isset on theese indexex to avoid PHP noticing!

    Line 599
    if ( isset($this->options['mr_social_sharing_'.$type.'buttons'][$button]['enable']) && $this->options['mr_social_sharing_'.$type.'buttons'][$button]['enable'] == 1) {

    Line 615
    if ( isset($this->options['mr_social_sharing_follow_buttons'][$button]['enable']) && $this->options['mr_social_sharing_follow_buttons'][$button]['enable'] == 1) {

    http://wordpress.org/extend/plugins/social-sharing-toolkit/

  2. Kojichan
    Member
    Posted 1 year ago #

    I was actually coming here to post the same suggestion. I'm trying to debug something else, and am overwhelmed with log spam from this.

    Here are a few other replacements I found in addition to Carsten Bach's, separated by file in numerical Line order.

    social_sharing_toolkit.php
    Line 336, replace with:
    if ( isset( $this->options['mr_social_sharing_bitly']['enable'] ) && $this->options['mr_social_sharing_bitly']['enable'] == 1) { echo ' checked="checked"';}

    Line 353:
    if ( isset( $this->options['mr_social_sharing_opengraph']['enable'] ) && $this->options['mr_social_sharing_opengraph']['enable'] == 1) { echo ' checked="checked"';}

    Line 395:
    if ( isset( $this->options['mr_social_sharing_'.$button_type.'buttons'][$button]['enable'] ) && $this->options['mr_social_sharing_'.$button_type.'buttons'][$button]['enable'] == 1) { echo ' checked="checked"';}

    Line 642:
    if ( isset( $this->options['mr_social_sharing_'.$type.'buttons'][$button]['enable'] ) && $this->options['mr_social_sharing_'.$type.'buttons'][$button]['enable'] == 1) {

    Line 660:
    if ( isset( $this->options['mr_social_sharing_follow_buttons'][$button]['enable'] ) && $this->options['mr_social_sharing_follow_buttons'][$button]['enable'] == 1) {

    Line 701, replace with:
    if ( isset( $this->options['mr_social_sharing_opengraph']['enable'] ) && $this->options['mr_social_sharing_opengraph']['enable'] == 1) {

    includes/share.widget.php
    Line 16:
    if ( ( isset( $this->options['mr_social_sharing_pinterest']['default_image'] ) && $this->options['mr_social_sharing_pinterest']['default_image'] != '' ) && ( isset( $this->options['mr_social_sharing_pinterest']['fixed_image'] ) && $this->options['mr_social_sharing_pinterest']['fixed_image'] == 1) ) {

    These are just the ones that I encountered on my site. There may be more unaccounted for in functions that weren't being used at the time.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic