| @@ -19,9 +19,10 @@ | ||
| 19 | 19 | |
| 20 | 20 | function save_fields($data, $post) |
| 21 | 21 | { |
| 22 | 22 | $data = parent::save_fields($data, $post); |
| 23 | - if (! isset($post['active']) && ! is_null($post) ) | |
| 23 | + | |
| 24 | + if (! isset($post['active']) && ! is_null($post) && count($post) > 0 ) | |
| 24 | 25 | { |
| 25 | 26 | $data[$this->blockname]['active'] = 0; |
| 26 | 27 | } |
| 27 | 28 | |
| @@ -95,10 +96,54 @@ | ||
| 95 | 96 | $active->name = $active->id; |
| 96 | 97 | $active->value = '1'; |
| 97 | 98 | $active->checked = checked( $this->getValue('active'), 1, false); |
| 98 | 99 | |
| 99 | - $admin->addField($active, 'start','end'); | |
| 100 | + $admin->addField($active, 'start','end', false); | |
| 100 | 101 | |
| 102 | + $notactive = new maxField('spacer'); | |
| 103 | + $notactive->id = 'general_notactive'; | |
| 104 | + $notactive->label = __('Warning:', 'mbsocial'); | |
| 105 | + $notactive->name = $notactive->id; | |
| 106 | + $notactive->content = '<b class="red">'. __('Social Share is not active. It will not show up anywhere on the frontend!', 'mbsocial') . '</b>'; | |
| 107 | + $notactive->conditional = htmlentities(json_encode(array('target' => 'active', 'values' => 'unchecked'))); | |
| 108 | + | |
| 109 | + $admin->addField($notactive, 'start', 'end', false); | |
| 110 | + | |
| 111 | + if ( Install::isPRO() ) { | |
| 112 | + $deskhide = new maxField('spacer'); | |
| 113 | + $deskhide->id = 'deskhide'; | |
| 114 | + $deskhide->name = $deskhide->id; | |
| 115 | + $deskhide->label = __('Desktop', 'mbsocial'); | |
| 116 | + $deskhide->content = 'Shown'; | |
| 117 | + $deskhide->conditional = htmlentities(json_encode(array('target' => 'show_desktop', 'values' => 'checked'))); | |
| 118 | + | |
| 119 | + $deskshow = new maxField('spacer'); | |
| 120 | + $deskshow->id = 'deskshow'; | |
| 121 | + $deskshow->name = $deskshow->id; | |
| 122 | + $deskshow->label = __('Desktop', 'mbsocial'); | |
| 123 | + $deskshow->content = '<b class="red">Hidden</b>'; | |
| 124 | + $deskshow->conditional = htmlentities(json_encode(array('target' => 'show_desktop', 'values' => 'unchecked'))); | |
| 125 | + | |
| 126 | + $admin->addField($deskhide, 'start', '', false ); | |
| 127 | + $admin->addField($deskshow, '', 'end', false); | |
| 128 | + | |
| 129 | + $mobhide = new maxField('spacer'); | |
| 130 | + $mobhide->id = 'mobhide'; | |
| 131 | + $mobhide->name = $mobhide->id; | |
| 132 | + $mobhide->label = __('Mobile', 'mbsocial'); | |
| 133 | + $mobhide->content = 'Shown'; | |
| 134 | + $mobhide->conditional = htmlentities(json_encode(array('target' => 'show_mobile', 'values' => 'checked'))); | |
| 135 | + | |
| 136 | + $mobshow = new maxField('spacer'); | |
| 137 | + $mobshow->id = 'mobshow'; | |
| 138 | + $mobshow->name = $mobshow->id; | |
| 139 | + $mobshow->label = __('Mobile', 'mbsocial'); | |
| 140 | + $mobshow->content = '<b class="red">Hidden</b>'; | |
| 141 | + $mobshow->conditional = htmlentities(json_encode(array('target' => 'show_mobile', 'values' => 'unchecked'))); | |
| 142 | + | |
| 143 | + $admin->addField($mobhide, 'start', '', false); | |
| 144 | + $admin->addField($mobshow, '', 'end', false); | |
| 145 | + } // IsPro | |
| 101 | 146 | |
| 102 | 147 | $admin->display_fields(); |
| 103 | 148 | ?> |
| 104 | 149 | </div> |