Skip to content

Commit

Permalink
mastadon logo change and php checker fix
Browse files Browse the repository at this point in the history
  • Loading branch information
josevarghese committed Apr 15, 2024
1 parent a54cab8 commit 45dbcc0
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 32 deletions.
2 changes: 1 addition & 1 deletion admin/class-super-web-share-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function save_meta_data( $post_id ) {
* If this is an autosave, SuperWebShare settings won't be saved.
* Condition: when post value not exists
*/
if ( empty($_POST) || empty( $_POST['post_type'] ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || (isset($_POST[ 'action' ]) && $_POST[ 'action'] == "inline-save" ) ) {
if ( empty($_POST) || empty( $_POST['post_type'] ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || (isset($_POST[ 'action' ]) && $_POST[ 'action'] == "inline-save" ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
return $post_id;
}

Expand Down
34 changes: 17 additions & 17 deletions admin/functions-super-web-share-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,15 +567,6 @@ function superwebshare_register_settings_fallback() {
'superwebshare_fallback_settings_section' // Page slug.
);

// Fall-back social media icons.
add_settings_field(
'fallback_social_networks', // ID.
__( 'Choose Social Platforms', 'super-web-share' ), // Title.
'superwebshare_fallback_social_networks_cb', // CB.
'superwebshare_fallback_settings_section', // Page slug.
'superwebshare_fallback_settings_section' // Settings Section ID.
);

// Description.
add_settings_field(
'superwebshare_inline_description_share', // ID.
Expand All @@ -594,11 +585,11 @@ function superwebshare_register_settings_fallback() {
'superwebshare_fallback_settings_section' // Settings Section ID.
);

// Option to change the fallback popup title - Since 2.4.
// Since 2.1 for layout selection for fallback.
add_settings_field(
'superwebshare_fallback_title', // ID.
__( 'Title for fallback modal', 'super-web-share' ), // Title.
'superwebshare_fallback_title_cb', // CB.
'superwebshare_fallback_modal_layout', // ID.
__( 'Fallback layout', 'super-web-share' ), // Title.
'superwebshare_fallback_modal_layout_cb', // CB.
'superwebshare_fallback_settings_section', // Page slug.
'superwebshare_fallback_settings_section' // Settings Section ID.
);
Expand All @@ -612,11 +603,11 @@ function superwebshare_register_settings_fallback() {
'superwebshare_fallback_settings_section' // Settings Section ID.
);

// Since 2.1 for layout selection for fallback.
// Option to change the fallback popup title - Since 2.4.
add_settings_field(
'superwebshare_fallback_modal_layout', // ID.
__( 'Fallback layout', 'super-web-share' ), // Title.
'superwebshare_fallback_modal_layout_cb', // CB.
'superwebshare_fallback_title', // ID.
__( 'Title for fallback modal', 'super-web-share' ), // Title.
'superwebshare_fallback_title_cb', // CB.
'superwebshare_fallback_settings_section', // Page slug.
'superwebshare_fallback_settings_section' // Settings Section ID.
);
Expand All @@ -630,6 +621,15 @@ function superwebshare_register_settings_fallback() {
'superwebshare_fallback_settings_section' // Settings Section ID.
);

// Fall-back social media icons.
add_settings_field(
'fallback_social_networks', // ID.
__( 'Choose Social Platforms', 'super-web-share' ), // Title.
'superwebshare_fallback_social_networks_cb', // CB.
'superwebshare_fallback_settings_section', // Page slug.
'superwebshare_fallback_settings_section' // Settings Section ID.
);

// Since 2.4 - Disable native share on desktop to forcefully show the fallback.
add_settings_field(
'superwebshare_fallback_show_fallback_on_desktop', // ID.
Expand Down
10 changes: 7 additions & 3 deletions admin/js/super-web-share-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ jQuery(document).ready(function ($) {
});

function SuperWebShareRighTLeft() {
var x = document.getElementById("superwebshare_settings[floating_position]").value;
document.getElementById("rightleft").innerHTML = " " + x;
const floatingPosition = document.getElementById("superwebshare_settings[floating_position]");
document.getElementById("rightleft").innerHTML = " " + (floatingPosition && floatingPosition.value);
}

jQuery(document).ready(function ($) {
Expand Down Expand Up @@ -90,6 +90,9 @@ jQuery(document).ready(function ($) {
});

function generateNetworkSortList() {
if (!sortingContainer) {
return false;
}
sortingContainer.innerHTML = "";
let topIndex = 0;
networksObj.forEach((network) => {
Expand Down Expand Up @@ -290,7 +293,8 @@ jQuery(document).ready(function ($) {
const $socialNetworksChoose = $(".sws-social-networks-wrap");
const $networkChooseToggle = $(".social-networks-choose-toggle");
const netWorkText = $networkChooseToggle.html();
$networkChooseToggle.click(function () {
$networkChooseToggle.click(function (e) {
e.preventDefault();
$socialNetworksChoose.slideToggle(function () {
$networkChooseToggle.html(
$socialNetworksChoose.is(":hidden") ? netWorkText : $networkChooseToggle.attr("data-close-text")
Expand Down
2 changes: 1 addition & 1 deletion admin/js/super-web-share-admin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions includes/class-super-web-share-icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,17 @@ class Super_Web_Share_Icons {
'stock-width' => '1',
),
'icon-mastodon' => array(
'd' => 'M955,590v-252c0-53.5-22.2-80.5-66.6-80.5c-49.3,0-73.6,31.9-73.6,95.1v138.1H713.5V352.6
c0-63.2-24.3-95.1-73.6-95.1c-44.4,0-66.6,27.1-66.6,80.5v252H470.5V329.7c0-52.8,13.2-95.1,40.3-126.3
c27.8-31.2,64.6-47.2,109.7-47.2c52.1,0,91.6,20.1,118,61.1l25.7,43l25.7-43c26.4-40.3,65.9-61.1,118-61.1c18.7,0,35.4,2.8,50.7,8.3
c-34-79.8-113.2-138.1-203.4-151.3C736.4,10.4,665.6,0,501.1,0h-1.4c-163.8,0-199.2,10.4-218,13.2c-107.6,16-206.2,91.6-230.5,200.6
c-11.1,53.5-12.5,112.5-10.4,167.3c2.8,77.7,3.5,156.2,10.4,233.9c4.9,51.4,13.2,102.7,25.7,153.4c22.9,93,114.5,170.8,204.8,202
c96.5,33.3,199.9,38.2,299.9,16c11.1-2.8,21.5-5.6,32.6-9c24.3-7.6,52.8-16,73.6-31.2l0.7-0.7v-0.7v-75.7v-0.7l-0.7-0.7l-0.7-0.7
h-0.7c-63.9,15.3-129.1,22.9-194.4,22.9c-112.5,0-143-53.5-151.3-75.7c-6.9-19.4-11.1-39.6-13.2-59.7v-0.7l0.7-0.7l0.7-0.7h0.7
c62.5,15.3,127,22.9,190.9,22.9c15.3,0,31.2,0,46.5-0.7c64.6-2.1,133.3-4.9,197.1-17.4c1.4,0,3.5-0.7,4.9-0.7
c84-16,164.5-61.1,194.4-165.2H955V590z M285.9,338.1c-31.2,0-56.2-25-56.2-56.9c0-31.2,25-56.9,56.2-56.9s56.2,25,56.2,56.9
C342.1,312.4,317.1,338.1,285.9,338.1z',
'd' => 'M972.6,221.4C958,113.9,862.8,29.3,750,12.9C731,10.1,658.9,0,491.9,0h-1.2C323.6,0,287.7,10.1,268.7,12.9
c-109.6,16-209.8,92-234.1,200.8C23,267.2,21.7,326.5,23.9,381c3.1,78.1,3.7,156,10.9,233.8c5,51.7,13.7,102.9,26,153.4
c23.1,93.2,116.6,170.7,208.2,202.3c98.1,33,203.5,38.5,304.6,15.8c11.1-2.5,22.1-5.5,33-8.9c24.5-7.7,53.3-16.3,74.5-31.4
c0.3-0.2,0.5-0.5,0.7-0.8c0.2-0.3,0.3-0.7,0.3-1v-75.4c0-0.3-0.1-0.7-0.2-1c-0.1-0.3-0.4-0.6-0.6-0.8c-0.3-0.2-0.6-0.3-0.9-0.4
c-0.3-0.1-0.7-0.1-1,0c-64.7,15.2-131.1,22.8-197.6,22.7c-114.5,0-145.3-53.5-154.2-75.8c-7.1-19.2-11.6-39.3-13.4-59.7
c0-0.3,0-0.7,0.2-1c0.1-0.3,0.4-0.6,0.6-0.8c0.3-0.2,0.6-0.4,0.9-0.4c0.3-0.1,0.7-0.1,1,0c63.7,15.1,128.9,22.7,194.4,22.7
c15.7,0,31.5,0,47.2-0.4c65.9-1.8,135.3-5.1,200.1-17.6c1.6-0.3,3.2-0.6,4.6-1c102.2-19.3,199.5-79.9,209.4-233.5
c0.4-6,1.3-63.3,1.3-69.6C973.7,431.1,980.6,301.2,972.6,221.4z M815.3,604.5H707.9V345.4c0-54.5-23.1-82.4-70.1-82.4
c-51.6,0-77.5,32.9-77.5,97.9v141.8H453.5V361c0-65-25.9-97.9-77.5-97.9c-46.7,0-70,27.8-70.1,82.4v259.1H198.5V337.6
c0-54.5,14.1-97.9,42.4-130c29.2-32,67.5-48.5,115-48.5c55,0,96.6,20.8,124.3,62.4l26.7,44.2l26.8-44.2
c27.7-41.6,69.3-62.4,124.2-62.4c47.5,0,85.8,16.5,115,48.5c28.3,32.1,42.4,75.4,42.4,130L815.3,604.5z',
'fill' => 'currentColor',
'stock-width' => '1',
),
Expand Down

0 comments on commit 45dbcc0

Please sign in to comment.