Version Description
(4 DEC 2018) =
* Fixed JS error in Admin (TypeError $ is not defined
)
* Fixed placement of mobile floating buttons.
* Fixed breakpoint transition for mobile buttons.
* Fixed option registration when Pro is temporarily deactivated.
* Updated cURL method so API requests are faster.
* Removed references to Open Share Count.
Download this release
Release Info
Developer | WarfarePlugins |
Plugin | WordPress Social Sharing Plugin – Social Warfare |
Version | 3.4.1 |
Comparing to | |
See all releases |
Code changes from version 3.4.0 to 3.4.1
- README.md +4 -13
- assets/css/admin-mobile.css +0 -0
- assets/css/admin-mobile.min.css +0 -0
- assets/css/admin-mobile.sass +0 -0
- assets/css/admin-options-page.css +0 -0
- assets/css/admin-options-page.min.css +0 -0
- assets/css/admin-options.min.css +0 -0
- assets/css/admin.css +0 -0
- assets/css/admin.min.css +0 -0
- assets/css/style.css +0 -0
- assets/css/style.min.css +0 -0
- assets/fonts/sw-icon-font.eot +0 -0
- assets/fonts/sw-icon-font.svg +0 -0
- assets/fonts/sw-icon-font.ttf +0 -0
- assets/fonts/sw-icon-font.woff +0 -0
- assets/images/admin-options-page/Thumbs.db +0 -0
- assets/images/admin-options-page/affiliate-300x150.jpg +0 -0
- assets/images/admin-options-page/measure-roi-300x150.jpg +0 -0
- assets/images/admin-options-page/new_share_counts.png +0 -0
- assets/images/admin-options-page/social-warfare-light.png +0 -0
- assets/images/admin-options-page/social-warfare-pro-light.png +0 -0
- assets/images/admin-options-page/socialwarfare-20x20.png +0 -0
- assets/images/admin-options-page/starter-guide-300x150.jpg +0 -0
- assets/images/img-placeholder-og.jpg +0 -0
- assets/images/img-placeholder-pin.jpg +0 -0
- assets/js/admin-options-page.js +0 -0
- assets/js/admin-options-page.min.js +0 -0
- assets/js/admin.js +61 -27
- assets/js/admin.min.js +1 -1
- assets/js/post-editor/.editorconfig +0 -0
- assets/js/post-editor/.eslintignore +0 -0
- assets/js/post-editor/.eslintrc.json +0 -0
- assets/js/post-editor/.gitignore +0 -0
- assets/js/post-editor/README.md +0 -0
- assets/js/post-editor/blocks.php +0 -0
- assets/js/post-editor/dist/blocks.build.js +0 -0
- assets/js/post-editor/dist/blocks.style.build.css +0 -0
- assets/js/post-editor/package-lock.json +0 -0
- assets/js/post-editor/package.json +0 -0
- assets/js/post-editor/src/block/click-to-tweet.js +185 -0
- assets/js/post-editor/src/block/pinterest.js +174 -0
- assets/js/post-editor/src/block/social-warfare.js +166 -0
- assets/js/post-editor/src/block/style.scss +160 -0
- assets/js/post-editor/src/blocks.js +14 -0
- assets/js/post-editor/src/common.scss +0 -0
- assets/js/script.js +15 -3
- assets/js/script.min.js +1 -1
- assets/js/sw-shortcode-generator.js +0 -0
- assets/js/sw-shortcode-generator.min.js +0 -0
- languages/social-warfare-da-DK.mo +0 -0
- languages/social-warfare-de_DE.mo +0 -0
- languages/social-warfare-en_US.mo +0 -0
- languages/social-warfare-es_ES.mo +0 -0
- languages/social-warfare-fr_FR.mo +0 -0
- languages/social-warfare-hy.mo +0 -0
- languages/social-warfare-it_IT.mo +0 -0
- languages/social-warfare-pt_BR.mo +0 -0
- languages/social-warfare-pt_PT.mo +0 -0
- languages/social-warfare-ru_RU.mo +0 -0
- languages/social-warfare-uk.mo +0 -0
- languages/social-warfare.pot +0 -0
- languages/social_warfare-el_EL.mo +0 -0
- languages/social_warfare-nl_NL.mo +0 -0
- lib/Social_Warfare.php +0 -0
- lib/Social_Warfare_Addon.php +0 -0
- lib/admin/SWP_Click_To_Tweet.php +0 -0
- lib/admin/SWP_Column.php +0 -0
- lib/admin/SWP_Settings_Link.php +0 -0
- lib/admin/SWP_Shortcode_Generator.php +0 -0
- lib/admin/SWP_Sidebar_Loader.php +0 -0
- lib/admin/SWP_User_Profile.php +0 -0
- lib/admin/assets/css/admin.css +0 -0
- lib/admin/assets/css/style1.css +0 -0
- lib/admin/assets/css/style2.css +0 -0
- lib/admin/assets/css/style3.css +0 -0
- lib/admin/assets/css/style4.css +0 -0
- lib/admin/assets/css/styles.css +0 -0
- lib/admin/assets/img/twitter-little-bird-button.png +0 -0
- lib/admin/assets/img/twitter-little-bird-white.png +0 -0
- lib/admin/assets/img/twitter-little-bird.png +0 -0
- lib/admin/assets/js/clickToTweet.js +0 -0
- lib/admin/assets/js/clickToTweet.min.js +0 -0
- lib/admin/assets/js/tmclicktotweet_plugin.js +0 -0
- lib/admin/swp_system_checker.php +0 -0
- lib/buttons-panel/SWP_Buttons_Panel.php +1 -1
- lib/buttons-panel/SWP_Buttons_Panel_Loader.php +128 -38
- lib/buttons-panel/SWP_Buttons_Panel_Shortcode.php +0 -0
- lib/buttons-panel/SWP_Buttons_Panel_Side.php +0 -0
- lib/buttons-panel/SWP_Buttons_Panel_Trait.php +20 -5
- lib/frontend-output/SWP_Header_Output.php +0 -0
- lib/frontend-output/SWP_Script.php +4 -2
- lib/frontend-output/SWP_Shortcode.php +0 -0
- lib/options/SWP_Option.php +0 -0
- lib/options/SWP_Option_Abstract.php +0 -0
- lib/options/SWP_Option_Icons.php +0 -0
- lib/options/SWP_Option_Select.php +0 -0
- lib/options/SWP_Option_Text.php +0 -0
- lib/options/SWP_Option_Textarea.php +0 -0
- lib/options/SWP_Option_Toggle.php +0 -0
- lib/options/SWP_Options_Page.php +0 -0
- lib/options/SWP_Options_Page_Section.php +0 -0
- lib/options/SWP_Options_Page_Tab.php +0 -0
- lib/options/SWP_Registration_Tab_Template.php +0 -0
- lib/options/SWP_Section_HTML.php +0 -0
- lib/options/SWP_User_Options.php +0 -0
- lib/social-networks/SWP_Facebook.php +0 -0
- lib/social-networks/SWP_Google_Plus.php +0 -0
- lib/social-networks/SWP_Linkedin.php +0 -0
- lib/social-networks/SWP_Mix.php +0 -0
- lib/social-networks/SWP_Pinterest.php +0 -0
- lib/social-networks/SWP_Social_Network.php +0 -0
- lib/social-networks/SWP_Social_Networks_Loader.php +0 -0
- lib/social-networks/SWP_Stumble_Upon.php +0 -0
- lib/social-networks/SWP_Twitter.php +0 -0
- lib/update-checker/.editorconfig +0 -0
- lib/update-checker/Puc/v4/Factory.php +0 -0
- lib/update-checker/Puc/v4p4/Autoloader.php +0 -0
- lib/update-checker/Puc/v4p4/DebugBar/Extension.php +0 -0
- lib/update-checker/Puc/v4p4/DebugBar/Panel.php +0 -0
- lib/update-checker/Puc/v4p4/DebugBar/PluginExtension.php +0 -0
- lib/update-checker/Puc/v4p4/DebugBar/PluginPanel.php +0 -0
- lib/update-checker/Puc/v4p4/DebugBar/ThemePanel.php +0 -0
- lib/update-checker/Puc/v4p4/Factory.php +0 -0
- lib/update-checker/Puc/v4p4/InstalledPackage.php +0 -0
- lib/update-checker/Puc/v4p4/Metadata.php +0 -0
- lib/update-checker/Puc/v4p4/OAuthSignature.php +0 -0
- lib/update-checker/Puc/v4p4/Plugin/Info.php +0 -0
- lib/update-checker/Puc/v4p4/Plugin/Package.php +0 -0
- lib/update-checker/Puc/v4p4/Plugin/Ui.php +0 -0
- lib/update-checker/Puc/v4p4/Plugin/Update.php +0 -0
- lib/update-checker/Puc/v4p4/Plugin/UpdateChecker.php +0 -0
- lib/update-checker/Puc/v4p4/Scheduler.php +0 -0
- lib/update-checker/Puc/v4p4/StateStore.php +0 -0
- lib/update-checker/Puc/v4p4/Theme/Package.php +0 -0
- lib/update-checker/Puc/v4p4/Theme/Update.php +0 -0
- lib/update-checker/Puc/v4p4/Theme/UpdateChecker.php +0 -0
- lib/update-checker/Puc/v4p4/Update.php +0 -0
- lib/update-checker/Puc/v4p4/UpdateChecker.php +0 -0
- lib/update-checker/Puc/v4p4/UpgraderStatus.php +0 -0
- lib/update-checker/Puc/v4p4/Utils.php +0 -0
- lib/update-checker/Puc/v4p4/Vcs/Api.php +0 -0
- lib/update-checker/Puc/v4p4/Vcs/BaseChecker.php +0 -0
- lib/update-checker/Puc/v4p4/Vcs/BitBucketApi.php +0 -0
- lib/update-checker/Puc/v4p4/Vcs/GitHubApi.php +0 -0
- lib/update-checker/Puc/v4p4/Vcs/GitLabApi.php +0 -0
- lib/update-checker/Puc/v4p4/Vcs/PluginUpdateChecker.php +0 -0
- lib/update-checker/Puc/v4p4/Vcs/Reference.php +0 -0
- lib/update-checker/Puc/v4p4/Vcs/ThemeUpdateChecker.php +0 -0
- lib/update-checker/README.md +0 -0
- lib/update-checker/composer.json +0 -0
- lib/update-checker/css/puc-debug-bar.css +0 -0
- lib/update-checker/examples/plugin.json +0 -0
- lib/update-checker/examples/theme.json +0 -0
- lib/update-checker/js/debug-bar.js +0 -0
- lib/update-checker/languages/plugin-update-checker-cs_CZ.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-cs_CZ.po +0 -0
- lib/update-checker/languages/plugin-update-checker-da_DK.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-da_DK.po +0 -0
- lib/update-checker/languages/plugin-update-checker-de_DE.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-de_DE.po +0 -0
- lib/update-checker/languages/plugin-update-checker-fa_IR.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-fa_IR.po +0 -0
- lib/update-checker/languages/plugin-update-checker-fr_CA.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-fr_CA.po +0 -0
- lib/update-checker/languages/plugin-update-checker-fr_FR.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-fr_FR.po +0 -0
- lib/update-checker/languages/plugin-update-checker-hu_HU.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-hu_HU.po +0 -0
- lib/update-checker/languages/plugin-update-checker-it_IT.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-it_IT.po +0 -0
- lib/update-checker/languages/plugin-update-checker-ja.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-ja.po +0 -0
- lib/update-checker/languages/plugin-update-checker-nl_BE.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-nl_BE.po +0 -0
- lib/update-checker/languages/plugin-update-checker-nl_NL.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-nl_NL.po +0 -0
- lib/update-checker/languages/plugin-update-checker-pt_BR.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-pt_BR.po +0 -0
- lib/update-checker/languages/plugin-update-checker-sv_SE.mo +0 -0
- lib/update-checker/languages/plugin-update-checker-sv_SE.po +0 -0
- lib/update-checker/languages/plugin-update-checker.pot +0 -0
- lib/update-checker/license.txt +0 -0
- lib/update-checker/plugin-update-checker.php +0 -0
- lib/update-checker/vendor/Parsedown.php +0 -0
- lib/update-checker/vendor/ParsedownLegacy.php +0 -0
- lib/update-checker/vendor/readme-parser.php +0 -0
- lib/utilities/SWP_CURL.php +19 -3
- lib/utilities/SWP_Compatibility.php +0 -0
- lib/utilities/SWP_Database_Migration.php +7 -1
- lib/utilities/SWP_Debug_Trait.php +0 -0
- lib/utilities/SWP_JSON_Cache_Handler.php +0 -0
- lib/utilities/SWP_Localization.php +0 -0
- lib/utilities/SWP_Notice.php +0 -0
- lib/utilities/SWP_Notice_Loader.php +0 -0
- lib/utilities/SWP_Permalink.php +0 -0
- lib/utilities/SWP_Post_Cache.php +1 -1
- lib/utilities/SWP_Post_Cache_Loader.php +0 -0
- lib/utilities/SWP_URL_Management.php +0 -0
- lib/utilities/SWP_Utility.php +3 -4
- lib/utilities/functions.php +0 -0
- lib/widgets/SWP_Popular_Posts_Widget.php +0 -0
- lib/widgets/SWP_Widget.php +0 -0
- readme.txt +10 -3
- social-warfare.php +2 -2
README.md
CHANGED
@@ -15,11 +15,7 @@ All WordPress coding standards should be followed. Anything not specifically def
|
|
15 |
### Variables and Class Names
|
16 |
All PHP and Javascript variables, functions and classes, and CSS classes and ID's should follow the following naming standards.
|
17 |
|
18 |
-
**PHP:** All names in PHP will use the Snake Case nomenclature. Independent
|
19 |
-
|
20 |
-
In regard to variable names, avoid abbreviations (i.e. $my_var should be $my_variable). The only exception is words or terms where the abbreviation or acronym is the commonly excepted usage of the word in regular speech (e.g. ID or ATM).
|
21 |
-
|
22 |
-
Avoid using id as a standalone variable name. Instead use a semantic identifier so it's clear to what the ID relates (e.g. $post_id).
|
23 |
|
24 |
Classes will be snake cased as well, but will also have the first letter of each word capitalized. Class names will also use the singular and never plural (e.g. My_Thing, not My_Things). The first letter will be capitalized on variables containing an instance of a class as well (e.g. $Class = new SWP_Class() ).
|
25 |
|
@@ -30,9 +26,7 @@ Line breaks in PHP will be used generously to make the code more easily readable
|
|
30 |
**CSS:** CSS selectors will use the snake_case nomenclature just as in our PHP code.
|
31 |
|
32 |
### Conditionals and Loops
|
33 |
-
No inline/same-line conditionals or loops will be used, nor will
|
34 |
-
|
35 |
-
Avoid wrapping large blocks of code inside of conditionals. Instead, use a conditional with a return to stop the method from running the undesired code.
|
36 |
|
37 |
### Style Guidelines for Docblocking Class Methods
|
38 |
Each file should begin with a docblock, as well as each function and class should be preceded with a docblock to explain it's purpose and functionality. There is no such thing as too much documentation on this project. The purpose is that any developer or even a non-developer should be able to easily browse each file and know exactly what is happening in that file.
|
@@ -84,11 +78,8 @@ Once you have completed step 1, you need to submit a ticket using the [contact f
|
|
84 |
|
85 |
Many tickets being posted here are issues that simply require adjusting a single setting to accomodate themes or plugins in certain ways. The support team is able to respond to these much, much more quickly than here in the developer's workspace. Since this is the case, any issues submitted without first going through the support team will be deleted. Otherwise it is a waste of both your time and ours.
|
86 |
|
87 |
-
#### 3.
|
88 |
-
|
89 |
-
In many cases we are already aware of the problem and may be able to provide a solution for you.
|
90 |
-
If this is not the case, the support team will let the developers know. From there the developers will determine when the bug or feature request can be addressed, and a new issue will be created in the appropriate milestone (which correlates to either the next or a future plugin update).
|
91 |
-
GitHub is public so that not only the support team, but also all users can view and track the progress of issues as well as commenting and participating in the conversation regarding each issue.
|
92 |
|
93 |
### Required Information: Provide this information WHILE submitting an issue
|
94 |
Once you've gone through support and you're ready to submit a GitHub issue, please **copy and paste the following information into your GitHub issue and fill out the blanks**:
|
15 |
### Variables and Class Names
|
16 |
All PHP and Javascript variables, functions and classes, and CSS classes and ID's should follow the following naming standards.
|
17 |
|
18 |
+
**PHP:** All names in PHP will use the Snake Case nomenclature. Independent function names will be preceded with the swp_ vendor prefix (e.g. swp_my_function_name). Methods and properties within classes do not require this prefix.
|
|
|
|
|
|
|
|
|
19 |
|
20 |
Classes will be snake cased as well, but will also have the first letter of each word capitalized. Class names will also use the singular and never plural (e.g. My_Thing, not My_Things). The first letter will be capitalized on variables containing an instance of a class as well (e.g. $Class = new SWP_Class() ).
|
21 |
|
26 |
**CSS:** CSS selectors will use the snake_case nomenclature just as in our PHP code.
|
27 |
|
28 |
### Conditionals and Loops
|
29 |
+
No inline/same-line conditionals or loops will be used, nor will we continue to use brace syntax. Rather we will use the colin/endif syntax.
|
|
|
|
|
30 |
|
31 |
### Style Guidelines for Docblocking Class Methods
|
32 |
Each file should begin with a docblock, as well as each function and class should be preceded with a docblock to explain it's purpose and functionality. There is no such thing as too much documentation on this project. The purpose is that any developer or even a non-developer should be able to easily browse each file and know exactly what is happening in that file.
|
78 |
|
79 |
Many tickets being posted here are issues that simply require adjusting a single setting to accomodate themes or plugins in certain ways. The support team is able to respond to these much, much more quickly than here in the developer's workspace. Since this is the case, any issues submitted without first going through the support team will be deleted. Otherwise it is a waste of both your time and ours.
|
80 |
|
81 |
+
#### 3. Create an Issue on GitHub
|
82 |
+
Only once you have completed the above steps should you submit an issue to GitHub. GitHub is the workspace of the development team. In the rare instances where the support team is unable to solve a particular issue, it will be brought here to be tracked and solved by the development team. GitHub is public so that not only the support team, but also all users can view and track the progress of issues as well as commenting and participating in the conversation regarding each issue.
|
|
|
|
|
|
|
83 |
|
84 |
### Required Information: Provide this information WHILE submitting an issue
|
85 |
Once you've gone through support and you're ready to submit a GitHub issue, please **copy and paste the following information into your GitHub issue and fill out the blanks**:
|
assets/css/admin-mobile.css
CHANGED
File without changes
|
assets/css/admin-mobile.min.css
CHANGED
File without changes
|
assets/css/admin-mobile.sass
CHANGED
File without changes
|
assets/css/admin-options-page.css
CHANGED
File without changes
|
assets/css/admin-options-page.min.css
CHANGED
File without changes
|
assets/css/admin-options.min.css
CHANGED
File without changes
|
assets/css/admin.css
CHANGED
File without changes
|
assets/css/admin.min.css
CHANGED
File without changes
|
assets/css/style.css
CHANGED
File without changes
|
assets/css/style.min.css
CHANGED
File without changes
|
assets/fonts/sw-icon-font.eot
CHANGED
File without changes
|
assets/fonts/sw-icon-font.svg
CHANGED
File without changes
|
assets/fonts/sw-icon-font.ttf
CHANGED
File without changes
|
assets/fonts/sw-icon-font.woff
CHANGED
File without changes
|
assets/images/admin-options-page/Thumbs.db
CHANGED
File without changes
|
assets/images/admin-options-page/affiliate-300x150.jpg
CHANGED
File without changes
|
assets/images/admin-options-page/measure-roi-300x150.jpg
CHANGED
File without changes
|
assets/images/admin-options-page/new_share_counts.png
CHANGED
File without changes
|
assets/images/admin-options-page/social-warfare-light.png
CHANGED
File without changes
|
assets/images/admin-options-page/social-warfare-pro-light.png
CHANGED
File without changes
|
assets/images/admin-options-page/socialwarfare-20x20.png
CHANGED
File without changes
|
assets/images/admin-options-page/starter-guide-300x150.jpg
CHANGED
File without changes
|
assets/images/img-placeholder-og.jpg
CHANGED
File without changes
|
assets/images/img-placeholder-pin.jpg
CHANGED
File without changes
|
assets/js/admin-options-page.js
CHANGED
File without changes
|
assets/js/admin-options-page.min.js
CHANGED
File without changes
|
assets/js/admin.js
CHANGED
@@ -135,7 +135,7 @@ if (window.location.href.indexOf("widgets.php") > -1) {
|
|
135 |
'use strict';
|
136 |
|
137 |
if (typeof jQuery != 'function') {
|
138 |
-
// moving here until we refactor and use $ agian.
|
139 |
console.log("Social Warfare requires jQuery, or jQuery as an alias of jQuery. Please make sure your theme provides access to jQuery before activating Social Warfare.");
|
140 |
return;
|
141 |
|
@@ -275,47 +275,30 @@ if (window.location.href.indexOf("widgets.php") > -1) {
|
|
275 |
|
276 |
jQuery(mediaList).css("height", height);
|
277 |
} else {
|
278 |
-
jQuery(mediaList).css("height", "initial")
|
279 |
}
|
280 |
})
|
281 |
}
|
282 |
|
283 |
-
/**
|
284 |
-
* The third party module used to create metaboxes (on the server) does not
|
285 |
-
* provide a way to organize the HTML.
|
286 |
-
*
|
287 |
-
* Our fix for this is to create a new parent container with the `data-type`
|
288 |
-
* attribute. The value of `data-type` represents the group of related
|
289 |
-
* functionality, such as 'heading', 'open-graph', or 'pinterest'.
|
290 |
-
*
|
291 |
-
* Then we move the related content (matched by CSS classnames) into the
|
292 |
-
* appropriate container using javascript.
|
293 |
-
*
|
294 |
-
* @see PHP social-warfare-pro\lib\admin\SWP_Meta_Box_Loader->before_meta_boxes()
|
295 |
-
*/
|
296 |
-
function setupMetaBox() {
|
297 |
-
putFieldsInContainers();
|
298 |
-
}
|
299 |
-
|
300 |
/**
|
301 |
* Creates the left, right, and full-width wraps for each container.
|
302 |
* @return {[type]} [description]
|
303 |
*/
|
304 |
function fillContainer(container) {
|
305 |
var positions = ['full-width', 'left', 'right'];
|
306 |
-
var type = jQuery(container).data(
|
307 |
|
308 |
positions.forEach(function(position) {
|
309 |
-
var className =
|
310 |
|
311 |
if (jQuery(container).find(className)) {
|
312 |
//* Only include child elements with the correct type.
|
313 |
var children = jQuery(container).find(className)
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
if (children.length) {
|
318 |
-
var wrap = jQuery(container).find(className +
|
319 |
jQuery(wrap).append(children);
|
320 |
}
|
321 |
}
|
@@ -366,13 +349,64 @@ if (window.location.href.indexOf("widgets.php") > -1) {
|
|
366 |
});
|
367 |
}
|
368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
function displayMetaBox() {
|
370 |
if (!jQuery(jQuery(".swpmb-media-list").length)) return;
|
|
|
371 |
clearInterval(window.initSWMetabox);
|
372 |
|
373 |
-
|
374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
jQuery('ul.swpmb-media-list').find(".swpmb-overlay").click(socialWarfareAdmin.resizeImageFields);
|
|
|
376 |
socialWarfareAdmin.addImageEditListeners()
|
377 |
|
378 |
jQuery("#social_warfare.postbox").show();
|
135 |
'use strict';
|
136 |
|
137 |
if (typeof jQuery != 'function') {
|
138 |
+
// moving here until we refactor and use $ agian.
|
139 |
console.log("Social Warfare requires jQuery, or jQuery as an alias of jQuery. Please make sure your theme provides access to jQuery before activating Social Warfare.");
|
140 |
return;
|
141 |
|
275 |
|
276 |
jQuery(mediaList).css("height", height);
|
277 |
} else {
|
278 |
+
jQuery(mediaList).css("height", "initial");
|
279 |
}
|
280 |
})
|
281 |
}
|
282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
/**
|
284 |
* Creates the left, right, and full-width wraps for each container.
|
285 |
* @return {[type]} [description]
|
286 |
*/
|
287 |
function fillContainer(container) {
|
288 |
var positions = ['full-width', 'left', 'right'];
|
289 |
+
var type = jQuery(container).data('type');
|
290 |
|
291 |
positions.forEach(function(position) {
|
292 |
+
var className = '.swpmb-' + position;
|
293 |
|
294 |
if (jQuery(container).find(className)) {
|
295 |
//* Only include child elements with the correct type.
|
296 |
var children = jQuery(container).find(className)
|
297 |
+
.filter(function(index, child) {
|
298 |
+
return jQuery(child).hasClass(type)
|
299 |
+
})
|
300 |
if (children.length) {
|
301 |
+
var wrap = jQuery(container).find(className + '-wrap');
|
302 |
jQuery(wrap).append(children);
|
303 |
}
|
304 |
}
|
349 |
});
|
350 |
}
|
351 |
|
352 |
+
//* This method exists ONLY for version 3.4.1 of Social Warfare.
|
353 |
+
//* The next version should have a more long-term sustainable way to manage
|
354 |
+
//* post-editor fields with dependencies.
|
355 |
+
function setTempConditionalField() {
|
356 |
+
jQuery('[field=#swp_twitter_use_open_graph]').click(function(event) {
|
357 |
+
var target = jQuery("#swp_twitter_use_open_graph");
|
358 |
+
|
359 |
+
if (target.attr('value') == 'true') {
|
360 |
+
jQuery('.swpmb-meta-container[data-type=twitter]').slideUp()
|
361 |
+
target.attr('value', 'true');
|
362 |
+
} else {
|
363 |
+
jQuery('.swpmb-meta-container[data-type=twitter]').slideDown()
|
364 |
+
target.attr('value', 'false');
|
365 |
+
}
|
366 |
+
|
367 |
+
socialWarfareAdmin.resizeImageFields();
|
368 |
+
});
|
369 |
+
}
|
370 |
+
|
371 |
+
|
372 |
+
/**
|
373 |
+
* The third party module used to create metaboxes (on the server) does not
|
374 |
+
* provide a way to organize the HTML.
|
375 |
+
*
|
376 |
+
* Our fix for this is to create a new parent container with the `data-type`
|
377 |
+
* attribute. The value of `data-type` represents the group of related
|
378 |
+
* functionality, such as 'heading', 'open-graph', or 'pinterest'.
|
379 |
+
*
|
380 |
+
* Then we move the related content (matched by CSS classnames) into the
|
381 |
+
* appropriate container using javascript.
|
382 |
+
*
|
383 |
+
* @see PHP social-warfare-pro\lib\admin\SWP_Meta_Box_Loader->before_meta_boxes()
|
384 |
+
*/
|
385 |
function displayMetaBox() {
|
386 |
if (!jQuery(jQuery(".swpmb-media-list").length)) return;
|
387 |
+
|
388 |
clearInterval(window.initSWMetabox);
|
389 |
|
390 |
+
putFieldsInContainers();
|
391 |
+
|
392 |
+
//* Metabox is loaded via Ajax, but we want to resize known images ASAP.
|
393 |
+
//* Even a couple extra times if need be.
|
394 |
+
setTimeout(socialWarfareAdmin.resizeImageFields, 600);
|
395 |
+
setTimeout(socialWarfareAdmin.resizeImageFields, 1400);
|
396 |
+
setTimeout(socialWarfareAdmin.resizeImageFields, 3000);
|
397 |
+
|
398 |
+
//* Begin Temp code only for 3.4.1
|
399 |
+
var status = jQuery("#swp_twitter_use_open_graph").val()
|
400 |
+
if (status == 'false') {
|
401 |
+
jQuery('.swpmb-meta-container[data-type=twitter]').slideDown()
|
402 |
+
} else {
|
403 |
+
jQuery('.swpmb-meta-container[data-type=twitter]').slideUp()
|
404 |
+
}
|
405 |
+
setTempConditionalField();
|
406 |
+
//* End Temp code
|
407 |
+
|
408 |
jQuery('ul.swpmb-media-list').find(".swpmb-overlay").click(socialWarfareAdmin.resizeImageFields);
|
409 |
+
jQuery("#social_warfare.ui-sortable-handle").click(socialWarfareAdmin.resizeImageFields); //* The open/close handle WP gives us. Images need to be resized if it was closed then opened.
|
410 |
socialWarfareAdmin.addImageEditListeners()
|
411 |
|
412 |
jQuery("#social_warfare.postbox").show();
|
assets/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function swpConditionalFields(){function e(e){return jQuery('select[name="'+e+'"]').val()}function t(e){return"true"===e&&(e=!0),"false"===e&&(e=!1),e}jQuery("[data-dep]").each(function(){var e=jQuery(this).data("dep"),i=JSON.parse(JSON.stringify(jQuery(this).data("dep_val")));if(-1===window.location.href.indexOf("page=social-warfare"))var a=jQuery(this).parents(".widgets-holder-wrap").find('[data-swp-name="'+e+'"]');else var a=jQuery('[name="'+e+'"]')[0];var r;void 0===a&&void 0===(a=jQuery('[name="'+e+'"]')[0])&&(a=jQuery("[fieldjQuery="+e+"]")[0]),r="checkbox"==jQuery(a).attr("type")?jQuery(a).prop("checked"):jQuery(a).val(),r=t(r),-1!==window.location.href.indexOf("page=social-warfare")?-1!==jQuery.inArray(r,i)&&jQuery(a).parent(".sw-grid").is(":visible")?jQuery(this).show():jQuery(this).hide():-1!==jQuery.inArray(r,i)||r===i?jQuery(this).show():jQuery(this).hide()}),!1===function(e){return jQuery('[name="'+e+'"]').prop("checked")}("float_style_source")&&"custom_color"===e("float_default_colors")||"custom_color_outlines"===e("float_default_colors")||"custom_color"===e("float_single_colors")||"custom_color_outlines"===e("float_single_colors")||"custom_color"===e("float_hover_colors")||"custom_color_outlines"===e("float_hover_colors")?jQuery(".sideCustomColor_wrapper").slideDown():jQuery(".sideCustomColor_wrapper").slideUp()}var socialWarfareAdmin=socialWarfareAdmin||{},swpWidget,widgetSubmit;if(window.location.href.indexOf("widgets.php")>-1)var widgetFinder=setInterval(function(){void 0!==swpWidget&&clearInterval(widgetFinder),swpWidget=jQuery("#widgets-right [id*=_swp_popular_posts_widget], [id*=_swp_popular_posts_widget].open")[0],widgetSubmit=jQuery(swpWidget).find("[idjQuery=savewidget]")[0],jQuery(swpWidget).on("click",swpConditionalFields),jQuery(widgetSubmit).on("click",function(){setTimeout(swpConditionalFields,600)})},50);!function(e,t,i){"use strict";function a(e,i){var a=t("#social_warfare #"+e),r=a.parent(),s=i-a.val().length;"swp_custom_tweet"==e&&(s-=t("#sample-permalink").text().length+1),s>=0?r.find(".swp_CountDown").removeClass("swp_red").addClass("swp_blue"):r.find(".swp_CountDown").removeClass("swp_blue").addClass("swp_red"),r.find(".counterNumber").text(s)}function r(){t(".swp-notice-cta").on("click",function(i){i.preventDefault();var a=i.target.getAttribute("href");"string"==typeof a&&a.length&&e.open(a);var r=t(this).parents(".swp-dismiss-notice");t.post({url:ajaxurl,data:{action:"dismiss",key:r.data("key"),timeframe:this.dataset.timeframe},success:function(e){(e=JSON.parse(e))&&r.slideUp(500)}})})}function s(e){e.preventDefault();var i=!("on"==t(this).attr("status")),a=t(this).attr("field"),r=t(a);i?(t(this).attr("status","on"),r.prop("checked",!0).prop("value",!0)):(t(this).attr("status","off"),r.prop("checked",!1).prop("value",!1))}function o(e){var i={top:"-25px",position:"relative"};t("#"+e).css("border-top-right-radius",0).parent().css(i)}function n(e,i){var a='<div class="swp_CountDown"><span class="counterNumber">'+-i+"</span></div>";o(e),t("#social_warfare #"+e).parent().prepend(a)}function l(
|
1 |
+
function swpConditionalFields(){function e(e){return jQuery('select[name="'+e+'"]').val()}function t(e){return"true"===e&&(e=!0),"false"===e&&(e=!1),e}jQuery("[data-dep]").each(function(){var e=jQuery(this).data("dep"),i=JSON.parse(JSON.stringify(jQuery(this).data("dep_val")));if(-1===window.location.href.indexOf("page=social-warfare"))var a=jQuery(this).parents(".widgets-holder-wrap").find('[data-swp-name="'+e+'"]');else var a=jQuery('[name="'+e+'"]')[0];var r;void 0===a&&void 0===(a=jQuery('[name="'+e+'"]')[0])&&(a=jQuery("[fieldjQuery="+e+"]")[0]),r="checkbox"==jQuery(a).attr("type")?jQuery(a).prop("checked"):jQuery(a).val(),r=t(r),-1!==window.location.href.indexOf("page=social-warfare")?-1!==jQuery.inArray(r,i)&&jQuery(a).parent(".sw-grid").is(":visible")?jQuery(this).show():jQuery(this).hide():-1!==jQuery.inArray(r,i)||r===i?jQuery(this).show():jQuery(this).hide()}),!1===function(e){return jQuery('[name="'+e+'"]').prop("checked")}("float_style_source")&&"custom_color"===e("float_default_colors")||"custom_color_outlines"===e("float_default_colors")||"custom_color"===e("float_single_colors")||"custom_color_outlines"===e("float_single_colors")||"custom_color"===e("float_hover_colors")||"custom_color_outlines"===e("float_hover_colors")?jQuery(".sideCustomColor_wrapper").slideDown():jQuery(".sideCustomColor_wrapper").slideUp()}var socialWarfareAdmin=socialWarfareAdmin||{},swpWidget,widgetSubmit;if(window.location.href.indexOf("widgets.php")>-1)var widgetFinder=setInterval(function(){void 0!==swpWidget&&clearInterval(widgetFinder),swpWidget=jQuery("#widgets-right [id*=_swp_popular_posts_widget], [id*=_swp_popular_posts_widget].open")[0],widgetSubmit=jQuery(swpWidget).find("[idjQuery=savewidget]")[0],jQuery(swpWidget).on("click",swpConditionalFields),jQuery(widgetSubmit).on("click",function(){setTimeout(swpConditionalFields,600)})},50);!function(e,t,i){"use strict";function a(e,i){var a=t("#social_warfare #"+e),r=a.parent(),s=i-a.val().length;"swp_custom_tweet"==e&&(s-=t("#sample-permalink").text().length+1),s>=0?r.find(".swp_CountDown").removeClass("swp_red").addClass("swp_blue"):r.find(".swp_CountDown").removeClass("swp_blue").addClass("swp_red"),r.find(".counterNumber").text(s)}function r(){t(".swp-notice-cta").on("click",function(i){i.preventDefault();var a=i.target.getAttribute("href");"string"==typeof a&&a.length&&e.open(a);var r=t(this).parents(".swp-dismiss-notice");t.post({url:ajaxurl,data:{action:"dismiss",key:r.data("key"),timeframe:this.dataset.timeframe},success:function(e){(e=JSON.parse(e))&&r.slideUp(500)}})})}function s(e){e.preventDefault();var i=!("on"==t(this).attr("status")),a=t(this).attr("field"),r=t(a);i?(t(this).attr("status","on"),r.prop("checked",!0).prop("value",!0)):(t(this).attr("status","off"),r.prop("checked",!1).prop("value",!1))}function o(e){var i={top:"-25px",position:"relative"};t("#"+e).css("border-top-right-radius",0).parent().css(i)}function n(e,i){var a='<div class="swp_CountDown"><span class="counterNumber">'+-i+"</span></div>";o(e),t("#social_warfare #"+e).parent().prepend(a)}function l(e){var i=["full-width","left","right"],a=t(e).data("type");i.forEach(function(i){var r=".swpmb-"+i;if(t(e).find(r)){var s=t(e).find(r).filter(function(e,i){return t(i).hasClass(a)});if(s.length){var o=t(e).find(r+"-wrap");t(o).append(s)}}})}function d(){t(".swpmb-meta-container[data-type]").map(function(e,i){var a=t(this).data("type");if(a){var r=t(".swpmb-field."+a);r.length&&t(this).append(r),l(i)}})}function p(){var e={swp_og_title:60,swp_og_description:150,swp_pinterest_description:500,swp_custom_tweet:280};Object.keys(e).map(function(i){var r=e[i];n(i,r),a(i,r),t("#social_warfare #"+i).on("input",function(){a(i,r)})})}function c(){t("[field=#swp_twitter_use_open_graph]").click(function(e){var i=t("#swp_twitter_use_open_graph");"true"==i.attr("value")?(t(".swpmb-meta-container[data-type=twitter]").slideUp(),i.attr("value","true")):(t(".swpmb-meta-container[data-type=twitter]").slideDown(),i.attr("value","false")),socialWarfareAdmin.resizeImageFields()})}function u(){if(t(t(".swpmb-media-list").length)){clearInterval(e.initSWMetabox),d(),setTimeout(socialWarfareAdmin.resizeImageFields,600),setTimeout(socialWarfareAdmin.resizeImageFields,1400),setTimeout(socialWarfareAdmin.resizeImageFields,3e3);"false"==t("#swp_twitter_use_open_graph").val()?t(".swpmb-meta-container[data-type=twitter]").slideDown():t(".swpmb-meta-container[data-type=twitter]").slideUp(),c(),t("ul.swpmb-media-list").find(".swpmb-overlay").click(socialWarfareAdmin.resizeImageFields),t("#social_warfare.ui-sortable-handle").click(socialWarfareAdmin.resizeImageFields),socialWarfareAdmin.addImageEditListeners(),t("#social_warfare.postbox").show()}}if("function"!=typeof t)return void console.log("Social Warfare requires jQuery, or jQuery as an alias of jQuery. Please make sure your theme provides access to jQuery before activating Social Warfare.");socialWarfareAdmin.linkLength=function(e){for(var t="",i=0;i<23;i++)t+="o";return e.replace(/(http:\/\/[\S]*)/g,t).length},socialWarfareAdmin.resizeImageFields=function(){t("ul.swpmb-media-list").each(function(e,i){if(t(i).is(":empty")){if(t(i).parents(".swpmb-field").attr("class").indexOf("pinterest")>0)var a=1.5*t(i).width();else var a=t(i).width()*(9/16);t(i).css("height",a)}else t(i).css("height","initial")})},socialWarfareAdmin.addImageEditListeners=function(){t(".swpmb-edit-media, .swpmb-remove-media").off(socialWarfareAdmin.resizeImageFields),t(".swpmb-edit-media, .swpmb-remove-media").on(socialWarfareAdmin.resizeImageFields)},t(document).ready(function(){r(),t("#social_warfare.postbox").length&&(p(),swpConditionalFields(),t(".sw-checkbox-toggle.swp-post-editor").click(s),t(".swp_popular_post_options select").on("change",swpConditionalFields),e.initSWMetabox=setInterval(u,10))})}(this,jQuery);
|
assets/js/post-editor/.editorconfig
CHANGED
File without changes
|
assets/js/post-editor/.eslintignore
CHANGED
File without changes
|
assets/js/post-editor/.eslintrc.json
CHANGED
File without changes
|
assets/js/post-editor/.gitignore
CHANGED
File without changes
|
assets/js/post-editor/README.md
CHANGED
File without changes
|
assets/js/post-editor/blocks.php
CHANGED
File without changes
|
assets/js/post-editor/dist/blocks.build.js
CHANGED
File without changes
|
assets/js/post-editor/dist/blocks.style.build.css
CHANGED
File without changes
|
assets/js/post-editor/package-lock.json
CHANGED
File without changes
|
assets/js/post-editor/package.json
CHANGED
File without changes
|
assets/js/post-editor/src/block/click-to-tweet.js
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import '../common.scss';
|
3 |
+
import './style.scss';
|
4 |
+
|
5 |
+
const { __ } = wp.i18n; // Import __() from wp.i18n
|
6 |
+
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
7 |
+
const { getCurrentPostId } = wp.data.select( 'core/editor' );
|
8 |
+
const Dashicon = wp.components.Dashicon;
|
9 |
+
|
10 |
+
const icon = <div className="swp-block-icon" style={ {color: '#429cd6'} }><Dashicon icon="twitter"/></div>
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Registers a new block provided a unique name and an object defining its
|
14 |
+
* behavior. Once registered, the block is made editor as an option to any
|
15 |
+
* editor interface where blocks are implemented.
|
16 |
+
*
|
17 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
18 |
+
* @param {string} name Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
19 |
+
* @param {Object} settings Block settings.
|
20 |
+
* @return {?WPBlock} The block, if it has been successfully
|
21 |
+
* registered; otherwise `undefined`.
|
22 |
+
*/
|
23 |
+
registerBlockType( 'social-warfare/click-to-tweet', {
|
24 |
+
title: __( 'Click To Tweet' ), // Block title.
|
25 |
+
icon: icon,
|
26 |
+
category: 'social-warfare', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
|
27 |
+
keywords: [
|
28 |
+
// Has a limit of 3 keywords.
|
29 |
+
__( 'twitter' ),
|
30 |
+
__( 'quote' ),
|
31 |
+
__( 'share' )
|
32 |
+
],
|
33 |
+
attributes: {
|
34 |
+
hasFocus: { type: 'boolean', defualt: false },
|
35 |
+
tweetText: { type: 'string', default: "" }, //* The text to display in the popup dialogue.
|
36 |
+
displayText: { type: 'string', default: "" }, //* The text to display in the post content CTT.
|
37 |
+
overLimit: { type: 'boolean', default: false }, //* If they are over the tweet limit.
|
38 |
+
},
|
39 |
+
|
40 |
+
/**
|
41 |
+
* The edit function describes the structure of your block in the context of the editor.
|
42 |
+
* This represents what the editor will render when the block is used.
|
43 |
+
*
|
44 |
+
* The "edit" property must be a valid function.
|
45 |
+
*
|
46 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
47 |
+
*/
|
48 |
+
edit: function( props ) {
|
49 |
+
const { tweetText, displayText, theme } = props.attributes;
|
50 |
+
const styles = ['Default', 'Send Her My Love', 'Roll With The Changes', 'Free Bird', 'Don\'t Stop Believin\'', 'Thunderstruck', 'Livin\' On A Prayer'];
|
51 |
+
const characterLimit = 280;
|
52 |
+
const color = props.attributes.overLimit ? "rgb(211, 66, 80)" : "";
|
53 |
+
const className = props.attributes.overLimit ? "over-limit" : "";
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Local method delcarations.
|
57 |
+
*/
|
58 |
+
const updateTweetText = ( event ) => {
|
59 |
+
const tweetText = event.target.value;
|
60 |
+
|
61 |
+
if ( !tweetText || !tweetText.length ) {
|
62 |
+
return props.setAttributes( { tweetText: '', overLimit: false } );
|
63 |
+
}
|
64 |
+
|
65 |
+
const overLimit = tweetText.length > characterLimit;
|
66 |
+
|
67 |
+
props.setAttributes( { overLimit, tweetText } );
|
68 |
+
}
|
69 |
+
|
70 |
+
const updateDisplayText = ( event ) => {
|
71 |
+
const displayText = event.target.value;
|
72 |
+
|
73 |
+
props.setAttributes( { displayText } );
|
74 |
+
}
|
75 |
+
|
76 |
+
const updateTheme = ( event ) => {
|
77 |
+
const index = event.target.value;
|
78 |
+
|
79 |
+
if ( parseInt(index) == 0 ) {
|
80 |
+
props.setAttributes( {theme: ''} );
|
81 |
+
} else {
|
82 |
+
props.setAttributes( {theme: index} );
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
const toggleFocus = ( event ) => {
|
87 |
+
props.setAttributes( {hasFocus: !props.attributes.hasFocus} );
|
88 |
+
}
|
89 |
+
|
90 |
+
//* Inactive state
|
91 |
+
if ( !props.attributes.hasFocus ) {
|
92 |
+
/**
|
93 |
+
* If no displayText is provided, fallback to use the tweetText.
|
94 |
+
* Else display a "no text provided" messaged.
|
95 |
+
*/
|
96 |
+
const text = props.attributes.displayText
|
97 |
+
? props.attributes.displayText
|
98 |
+
: props.attributes.tweetText
|
99 |
+
? props.attributes.tweetText
|
100 |
+
: "No Click To Tweet text is provided.";
|
101 |
+
|
102 |
+
return (
|
103 |
+
<div className={ `${props.className} click-to-tweet-block-wrap swp-inactive-block` }>
|
104 |
+
<div className="head" onClick={toggleFocus}>
|
105 |
+
{icon}
|
106 |
+
<div className="swp-preview">{text}</div>
|
107 |
+
<Dashicon className="swp-dashicon" icon="arrow-down" />
|
108 |
+
</div>
|
109 |
+
</div>
|
110 |
+
)
|
111 |
+
}
|
112 |
+
|
113 |
+
//* Active state
|
114 |
+
return (
|
115 |
+
<div className={ `${props.className} click-to-tweet-block-wrap swp-active-block` }>
|
116 |
+
<div className="head" onClick={toggleFocus}>
|
117 |
+
<div>
|
118 |
+
{icon}
|
119 |
+
<p className="swp-block-title">Click to Tweet</p>
|
120 |
+
</div>
|
121 |
+
<Dashicon className="swp-dashicon" icon="arrow-up" />
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<p>Inserts a <pre style={ {display: 'inline'} }>[click_to_tweet]</pre> shortcode. <a href="https://warfareplugins.com/support/click-to-tweet/">Learn more</a></p>
|
125 |
+
|
126 |
+
<p>Type your tweet as you want it to display <b><em>on Twitter</em></b>:</p>
|
127 |
+
|
128 |
+
<div style={ {width: "100%"} }>
|
129 |
+
<p className={`block-characters-remaining ${className}`} style={ {marginTop: -33}}>
|
130 |
+
{characterLimit - tweetText.length}
|
131 |
+
</p>
|
132 |
+
<textarea name="tweetText"
|
133 |
+
placeholder="Type your tweet. . . "
|
134 |
+
onChange={updateTweetText}
|
135 |
+
value={tweetText}
|
136 |
+
/>
|
137 |
+
</div>
|
138 |
+
|
139 |
+
<p>Type your quote as you want it to display <b><em>on the page</em></b>:</p>
|
140 |
+
|
141 |
+
<textarea name="displayText"
|
142 |
+
placeholder="Type your quote. . . "
|
143 |
+
onChange={updateDisplayText}
|
144 |
+
value={displayText}
|
145 |
+
/>
|
146 |
+
|
147 |
+
<p>Which theme would you like to use for this CTT?</p>
|
148 |
+
|
149 |
+
<select name="theme"
|
150 |
+
value={theme}
|
151 |
+
onChange={updateTheme}
|
152 |
+
>
|
153 |
+
{
|
154 |
+
styles.map( ( theme, index ) => <option value={index}>{theme}</option> )
|
155 |
+
}
|
156 |
+
</select>
|
157 |
+
</div>
|
158 |
+
);
|
159 |
+
},
|
160 |
+
|
161 |
+
/**
|
162 |
+
* The save function defines the way in which the different attributes should be combined
|
163 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
164 |
+
*
|
165 |
+
* The "save" property must be specified and must be a valid function.
|
166 |
+
*
|
167 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
168 |
+
*/
|
169 |
+
save: function( props ) {
|
170 |
+
let { tweetText, displayText } = props.attributes;
|
171 |
+
if ( !displayText ) {
|
172 |
+
displayText = tweetText;
|
173 |
+
}
|
174 |
+
|
175 |
+
const theme = props.attributes.theme ? `style${props.attributes.theme}` : '';
|
176 |
+
|
177 |
+
if (!tweetText) return;
|
178 |
+
|
179 |
+
return (
|
180 |
+
<div>
|
181 |
+
[click_to_tweet tweet="{tweetText}" quote="{displayText}" theme="{theme}"]
|
182 |
+
</div>
|
183 |
+
);
|
184 |
+
},
|
185 |
+
} );
|
assets/js/post-editor/src/block/pinterest.js
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import '../common.scss';
|
3 |
+
import './style.scss';
|
4 |
+
|
5 |
+
// Give the page 10 seconds to load before bailing.
|
6 |
+
const timeout = (+new Date) + 10000;
|
7 |
+
|
8 |
+
//* The socialWarfare object does not exist at the time this file is loaded, so wait for it first.
|
9 |
+
const checker = setInterval(() => {
|
10 |
+
if (+new Date > timeout) clearTimeout(checker);
|
11 |
+
if (!socialWarfare) return;
|
12 |
+
|
13 |
+
clearInterval(checker);
|
14 |
+
if ( !socialWarfare.addons || !socialWarfare.addons.includes('pro') ) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
const { __ } = wp.i18n; // Import __() from wp.i18n
|
19 |
+
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
20 |
+
const { getCurrentPostId } = wp.data.select( 'core/editor' );
|
21 |
+
const Dashicon = wp.components.Dashicon;
|
22 |
+
const icon = (<div className="swp-block-icon">
|
23 |
+
<svg version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" >
|
24 |
+
<g>
|
25 |
+
<path fill="#cd2029" d="M16,3.9C9.3,3.9,3.9,9.3,3.9,16c0,4.9,3,9.2,7.2,11.1c0-0.8,0-1.9,0.2-2.8c0.2-1,1.6-6.6,1.6-6.6
|
26 |
+
s-0.4-0.8-0.4-1.9c0-1.8,1-3.1,2.3-3.1c1.1,0,1.6,0.8,1.6,1.8c0,1.1-0.7,2.8-1.1,4.3c-0.3,1.3,0.6,2.3,1.9,2.3
|
27 |
+
c2.3,0,3.8-2.9,3.8-6.4c0-2.6-1.8-4.6-5-4.6c-3.7,0-5.9,2.7-5.9,5.8c0,1.1,0.3,1.8,0.8,2.4c0.2,0.3,0.3,0.4,0.2,0.7
|
28 |
+
c-0.1,0.2-0.2,0.8-0.2,1c-0.1,0.3-0.3,0.4-0.6,0.3c-1.7-0.7-2.5-2.5-2.5-4.6c0-3.4,2.9-7.5,8.6-7.5c4.6,0,7.6,3.3,7.6,6.9
|
29 |
+
c0,4.7-2.6,8.3-6.5,8.3c-1.3,0-2.5-0.7-2.9-1.5c0,0-0.7,2.8-0.9,3.3c-0.3,0.9-0.8,1.9-1.2,2.6c1.1,0.3,2.2,0.5,3.4,0.5
|
30 |
+
c6.7,0,12.1-5.4,12.1-12.1C28.1,9.3,22.7,3.9,16,3.9z"/>
|
31 |
+
</g>
|
32 |
+
</svg>
|
33 |
+
</div>);
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Registers a new block provided a unique name and an object defining its
|
37 |
+
* behavior. Once registered, the block is made editor as an option to any
|
38 |
+
* editor interface where blocks are implemented.
|
39 |
+
*
|
40 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
41 |
+
* @param {string} name Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
42 |
+
* @param {Object} settings Block settings.
|
43 |
+
* @return {?WPBlock} The block, if it has been successfully
|
44 |
+
* registered; otherwise `undefined`.
|
45 |
+
*/
|
46 |
+
registerBlockType( 'social-warfare/pinterest', {
|
47 |
+
title: __( 'Pinterest Image' ), // Block title.
|
48 |
+
icon: icon,
|
49 |
+
category: 'social-warfare', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
|
50 |
+
keywords: [
|
51 |
+
// Has a limit of 3 keywords.
|
52 |
+
__( 'share' ),
|
53 |
+
__( 'pin' ),
|
54 |
+
__( 'tailwind' ),
|
55 |
+
],
|
56 |
+
attributes: {
|
57 |
+
hasFocus: { type: 'boolean', defualt: false },
|
58 |
+
id: { type: 'number', default: 0},
|
59 |
+
width: { type: 'number', default: 0 },
|
60 |
+
height: { type: 'number', default: 0 },
|
61 |
+
className: { type: 'string', default: ''},
|
62 |
+
alignment: { type: 'string', default: ''},
|
63 |
+
},
|
64 |
+
|
65 |
+
/**
|
66 |
+
* The edit function describes the structure of your block in the context of the editor.
|
67 |
+
* This represents what the editor will render when the block is used.
|
68 |
+
*
|
69 |
+
* The "edit" property must be a valid function.
|
70 |
+
*
|
71 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
72 |
+
*/
|
73 |
+
edit: function( props ) {
|
74 |
+
const toggleFocus = ( event ) => {
|
75 |
+
props.setAttributes( { hasFocus: !props.attributes.hasFocus } );
|
76 |
+
}
|
77 |
+
|
78 |
+
const attributes = {
|
79 |
+
//* key: 'Display Text',
|
80 |
+
id: 'Post ID or Image ID',
|
81 |
+
width: 'Width (in pixels)',
|
82 |
+
height: 'Height (in pixels)',
|
83 |
+
className: 'Custom CSS class',
|
84 |
+
alignment: 'Alignment. You may enter one of: left, right, center'
|
85 |
+
}
|
86 |
+
|
87 |
+
const updateAttribute = ( event ) => {
|
88 |
+
props.setAttributes( { [event.target.name]: event.target.value } )
|
89 |
+
}
|
90 |
+
|
91 |
+
//* Inactive state
|
92 |
+
if ( !props.attributes.hasFocus ) {
|
93 |
+
|
94 |
+
//* Create the attribute="value" string for the shortcode.
|
95 |
+
const attributeString = Object.entries(props.attributes).reduce((string, [attr, value]) => {
|
96 |
+
if (!value.length || typeof value == 'undefined') return string;
|
97 |
+
return string += ` ${attr}="${value}"`
|
98 |
+
}, '');
|
99 |
+
|
100 |
+
return (
|
101 |
+
<div className={ `${props.className} pinterest-block-wrap swp-inactive-block` }>
|
102 |
+
<div className="head" onClick={toggleFocus}>
|
103 |
+
{icon}
|
104 |
+
<div className="swp-preview">[pinterest_image{attributeString}]</div>
|
105 |
+
<Dashicon className="swp-dashicon" icon="arrow-down" />
|
106 |
+
</div>
|
107 |
+
</div>
|
108 |
+
);
|
109 |
+
}
|
110 |
+
|
111 |
+
//* Active state
|
112 |
+
return (
|
113 |
+
<div className={ `${props.className} pinterest-block-wrap swp-active-block` }>
|
114 |
+
<div className="head" onClick={toggleFocus}>
|
115 |
+
<div>
|
116 |
+
{icon}
|
117 |
+
<p className="swp-block-title">Pinterest Image</p>
|
118 |
+
</div>
|
119 |
+
<Dashicon className="swp-dashicon" icon="arrow-up" />
|
120 |
+
</div>
|
121 |
+
<p>Inserts a <pre style={ {display: 'inline'} }>[pinterest_image]</pre> shortcode. Leave a field blank to use values based on your global settings.</p>
|
122 |
+
{
|
123 |
+
//* All attributes except `alignment`.
|
124 |
+
Object.entries(attributes).map(([name, displayText]) => {
|
125 |
+
if (name == 'alignment') return;
|
126 |
+
const className = name == 'width' || name == 'height' ? "swp-inner-block-50" : '';
|
127 |
+
|
128 |
+
return (
|
129 |
+
<div className={className}>
|
130 |
+
<p>{displayText}</p>
|
131 |
+
<input name={name}
|
132 |
+
type="text"
|
133 |
+
onChange={updateAttribute}
|
134 |
+
value={props.attributes[name] || ''}
|
135 |
+
/>
|
136 |
+
</div>
|
137 |
+
)
|
138 |
+
})
|
139 |
+
}
|
140 |
+
|
141 |
+
<div>
|
142 |
+
<p>Alignment</p>
|
143 |
+
<select name="alignment"
|
144 |
+
value={props.attributes.alignment ? props.attributes.alignment : ''}
|
145 |
+
onChange={updateAttribute}
|
146 |
+
>
|
147 |
+
<option value="">Default</option>
|
148 |
+
<option value="left">Left</option>
|
149 |
+
<option value="center">Center</option>
|
150 |
+
<option value="right">Right</option>
|
151 |
+
</select>
|
152 |
+
</div>
|
153 |
+
</div>
|
154 |
+
);
|
155 |
+
},
|
156 |
+
|
157 |
+
/**
|
158 |
+
* The save function defines the way in which the different attributes should be combined
|
159 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
160 |
+
*
|
161 |
+
* The "save" property must be specified and must be a valid function.
|
162 |
+
*
|
163 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
164 |
+
*/
|
165 |
+
save: function( props ) {
|
166 |
+
|
167 |
+
return (
|
168 |
+
<div>
|
169 |
+
[pinterest_image]
|
170 |
+
</div>
|
171 |
+
);
|
172 |
+
},
|
173 |
+
} );
|
174 |
+
}, 100)
|
assets/js/post-editor/src/block/social-warfare.js
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import './style.scss';
|
3 |
+
|
4 |
+
const { __ } = wp.i18n; // Import __() from wp.i18n
|
5 |
+
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
6 |
+
const Dashicon = wp.components.Dashicon;
|
7 |
+
const icon = (<div className="swp-block-icon">
|
8 |
+
<svg version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 32 32" enable-background="new 0 0 32 32">
|
9 |
+
<path fill="#ee464f" d="M8.6,9.9c0.2-0.8,1.8-4.2,5.5-6.3C8.1,4.5,3.5,9.7,3.5,15.9c0,1.6,0.3,3.2,0.9,4.6c0.2-0.2,0.5-0.3,0.8-0.3
|
10 |
+
l4.6-0.9c0.8-0.2,1.1,0.2,0.9,1c-0.5,1.8,0.5,2.9,2.3,2.9c1.8,0,3.6-1.1,3.7-2.1C17.1,17.8,5.5,18.5,8.6,9.9z M27.2,10.4
|
11 |
+
c-0.3,0.3-0.6,0.6-1.1,0.7L21.4,12c-0.8,0.2-1.1-0.2-0.9-0.9c0.3-1.5-0.6-2.5-2.4-2.5c-1.5,0-2.7,0.9-2.8,1.7
|
12 |
+
c-0.5,2.9,11.4,2.9,8.4,11.5c-0.3,0.8-2.3,4.6-6.8,6.6c6.5-0.4,11.7-5.8,11.7-12.4C28.5,14,28,12.1,27.2,10.4z"/>
|
13 |
+
</svg>
|
14 |
+
</div>);
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Registers a new block provided a unique name and an object defining its
|
18 |
+
* behavior. Once registered, the block is made editor as an option to any
|
19 |
+
* editor interface where blocks are implemented.
|
20 |
+
*
|
21 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
22 |
+
* @param {string} name Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
23 |
+
* @param {Object} settings Block settings.
|
24 |
+
* @return {?WPBlock} The block, if it has been successfully
|
25 |
+
* registered; otherwise `undefined`.
|
26 |
+
*/
|
27 |
+
registerBlockType( 'social-warfare/social-warfare', {
|
28 |
+
title: __( 'Social Warfare' ), // Block title.
|
29 |
+
icon: icon,
|
30 |
+
category: 'social-warfare', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
|
31 |
+
keywords: [
|
32 |
+
// Has a limit of 3 keywords.
|
33 |
+
__( 'share' ),
|
34 |
+
__( 'button' ),
|
35 |
+
__( 'tweet' )
|
36 |
+
],
|
37 |
+
attributes: {
|
38 |
+
hasFocus: { type: 'boolean', defualt: false }, //* Used only for editor to display either slim or full block.
|
39 |
+
useThisPost: { type: 'string', default: "this" }, //* Option to use share data from this post, or another post.
|
40 |
+
postID: { type: 'number', default: ''}, //* If ${useThisPost} == 'other', the ID of target post to fetch data from.
|
41 |
+
buttons: { type: 'string', default: '' }, //* A csv of valid networks to display in the shortcode.
|
42 |
+
},
|
43 |
+
|
44 |
+
/**
|
45 |
+
* The edit function describes the structure of your block in the context of the editor.
|
46 |
+
* This represents what the editor will render when the block is used.
|
47 |
+
*
|
48 |
+
* The "edit" property must be a valid function.
|
49 |
+
*
|
50 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
51 |
+
*/
|
52 |
+
edit: function( props ) {
|
53 |
+
const { useThisPost, buttons, postID } = props.attributes;
|
54 |
+
|
55 |
+
const toggleFocus = ( event ) => {
|
56 |
+
props.setAttributes( {hasFocus: !props.attributes.hasFocus} );
|
57 |
+
}
|
58 |
+
|
59 |
+
const updateAttributes = ( event ) => {
|
60 |
+
props.setAttributes( {[event.target.name]: event.target.value} );
|
61 |
+
}
|
62 |
+
|
63 |
+
const updateButtonsList = ( event ) => {
|
64 |
+
props.setAttributes( {buttons: event.target.value} );
|
65 |
+
}
|
66 |
+
|
67 |
+
const updatePostID = ( event ) => {
|
68 |
+
const postID = wp.data.select('core/editor').getCurrentPostId();
|
69 |
+
const value = event.target.value;
|
70 |
+
|
71 |
+
if ( value == '' ) {
|
72 |
+
props.setAttributes( { postID: "" } )
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
|
76 |
+
if ( isNaN( parseInt( value ) ) ) {
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
|
80 |
+
props.setAttributes( { postID: parseInt(value) } )
|
81 |
+
}
|
82 |
+
|
83 |
+
//* Inactive state
|
84 |
+
if ( !props.attributes.hasFocus ) {
|
85 |
+
const buttons = props.attributes.buttons && props.attributes.buttons.length
|
86 |
+
? `buttons="${props.attributes.buttons}"` : '';
|
87 |
+
|
88 |
+
const postID = props.attributes.useThisPost == "other"
|
89 |
+
? `id="${props.attributes.postID}"` : '';
|
90 |
+
|
91 |
+
return (
|
92 |
+
<div className={ `${props.className} social-warfare-block-wrap swp-inactive-block` }>
|
93 |
+
<div className="head" onClick={toggleFocus}>
|
94 |
+
{icon}
|
95 |
+
<div className="swp-preview">[social_warfare {buttons} {postID}]</div>
|
96 |
+
<Dashicon className="swp-dashicon" icon="arrow-down" />
|
97 |
+
</div>
|
98 |
+
</div>
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
//* Active state
|
103 |
+
return (
|
104 |
+
<div className={ `${props.className} social-warfare-block-wrap swp-active-block` }>
|
105 |
+
<div className="head" onClick={toggleFocus}>
|
106 |
+
<div>
|
107 |
+
{icon}
|
108 |
+
<p className="swp-block-title">Social Warfare Shortcode</p>
|
109 |
+
</div>
|
110 |
+
<Dashicon className="swp-dashicon" icon="arrow-down" />
|
111 |
+
</div>
|
112 |
+
|
113 |
+
<p>Inserts a <pre style={ {display: 'inline'} }>[social_warfare]</pre> shortcode. Leave a field blank to use values based on your global settings. <a href="https://warfareplugins.com/support/using-shortcodes-and-php-snippets/">Learn more</a></p>
|
114 |
+
|
115 |
+
<p>Should the buttons reflect this post, or a different post?</p>
|
116 |
+
|
117 |
+
<select name='useThisPost'
|
118 |
+
value={props.attributes.useThisPost == "other" ? "other" : "this"}
|
119 |
+
onChange={updateAttributes}
|
120 |
+
>
|
121 |
+
<option value="this">This post</option>
|
122 |
+
<option value="other">Another post</option>
|
123 |
+
</select>
|
124 |
+
|
125 |
+
{
|
126 |
+
props.attributes.useThisPost == "other" &&
|
127 |
+
<div>
|
128 |
+
<p>Which post should we fetch SW settings and shares from?</p>
|
129 |
+
<input type="text"
|
130 |
+
onChange ={updatePostID}
|
131 |
+
value={props.attributes.postID}
|
132 |
+
/>
|
133 |
+
</div>
|
134 |
+
}
|
135 |
+
|
136 |
+
<p>Which networks should we display? Leave blank to use your global settings. </p>
|
137 |
+
<input value={props.attributes.buttons}
|
138 |
+
type="text"
|
139 |
+
onChange={updateButtonsList}
|
140 |
+
/>
|
141 |
+
</div>
|
142 |
+
);
|
143 |
+
},
|
144 |
+
|
145 |
+
/**
|
146 |
+
* The save function defines the way in which the different attributes should be combined
|
147 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
148 |
+
*
|
149 |
+
* The "save" property must be specified and must be a valid function.
|
150 |
+
*
|
151 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
152 |
+
*/
|
153 |
+
save: function( props ) {
|
154 |
+
const buttons = props.attributes.buttons && props.attributes.buttons.length
|
155 |
+
? `buttons="${props.attributes.buttons}"` : '';
|
156 |
+
|
157 |
+
const postID = props.attributes.useThisPost == "other"
|
158 |
+
? `id="${props.attributes.postID}"` : '';
|
159 |
+
|
160 |
+
return (
|
161 |
+
<div>
|
162 |
+
[social_warfare {buttons} {postID}]
|
163 |
+
</div>
|
164 |
+
);
|
165 |
+
},
|
166 |
+
} );
|
assets/js/post-editor/src/block/style.scss
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[class*="-block-wrap"] {
|
2 |
+
font-family: "SF Pro Text", "Helvetica", sans-serif;
|
3 |
+
font-size: 13px;
|
4 |
+
}
|
5 |
+
|
6 |
+
[class*="-block-wrap"] .head {
|
7 |
+
width: 100%;
|
8 |
+
display: flex;
|
9 |
+
flex-flow: row nowrap;
|
10 |
+
align-items: center;
|
11 |
+
justify-content: space-between;
|
12 |
+
|
13 |
+
p {
|
14 |
+
font-weight: bold;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
[class*="-block-wrap"] input,
|
19 |
+
[class*="-block-wrap"] select,
|
20 |
+
[class*="-block-wrap"] textarea {
|
21 |
+
display: block;
|
22 |
+
width: 100%;
|
23 |
+
padding: 5px;
|
24 |
+
height: 42px;
|
25 |
+
border: 1px solid #e2e4e7
|
26 |
+
}
|
27 |
+
|
28 |
+
[class*="-block-wrap"] code {
|
29 |
+
display: block;
|
30 |
+
width: 100%;
|
31 |
+
padding: 5px;
|
32 |
+
height: 42px;
|
33 |
+
}
|
34 |
+
|
35 |
+
[class*="-block-wrap"] textarea {
|
36 |
+
height: 64px;
|
37 |
+
}
|
38 |
+
|
39 |
+
.swp-dashicon.dashicons-arrow-up,
|
40 |
+
.swp-dashicon.dashicons-arrow-down {
|
41 |
+
margin-right: 14px;
|
42 |
+
cursor: pointer;
|
43 |
+
}
|
44 |
+
|
45 |
+
.social-warfare-block-wrap input,
|
46 |
+
.social-warfare-block-wrap select {
|
47 |
+
width: 100%;
|
48 |
+
}
|
49 |
+
|
50 |
+
/* Common styles for SWP Gutenberg blocks. */
|
51 |
+
[class^="wp-block-social-warfare"] {
|
52 |
+
.head {
|
53 |
+
min-height: 55px;
|
54 |
+
}
|
55 |
+
|
56 |
+
svg {
|
57 |
+
width: 24px;
|
58 |
+
height: 24px;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
.swp-block-icon {
|
63 |
+
margin: 0 28px 0 14px;
|
64 |
+
font-size: 18px;
|
65 |
+
width: 32px;
|
66 |
+
height: 32px;
|
67 |
+
}
|
68 |
+
|
69 |
+
[class^="wp-block-social-warfare"] {
|
70 |
+
.head {
|
71 |
+
cursor: pointer;
|
72 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0); // transparent border to maintain same height.
|
73 |
+
transition: border 0.3s;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
.is-selected [class^="wp-block-social-warfare"].swp-active-block .head {
|
78 |
+
border-bottom: 1px solid #e2e4e7;
|
79 |
+
}
|
80 |
+
|
81 |
+
.swp-active-block {
|
82 |
+
height: 100%;
|
83 |
+
|
84 |
+
.swp-inner-block-50 {
|
85 |
+
width: 50%;
|
86 |
+
display: inline-block;
|
87 |
+
padding: 0 1px;
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
.head > div {
|
92 |
+
display: flex;
|
93 |
+
flex-flow: row no-wrap;
|
94 |
+
justify-content: center;
|
95 |
+
align-items: center;
|
96 |
+
}
|
97 |
+
|
98 |
+
.head .swp-block-icon,
|
99 |
+
.head .swp-block-title {
|
100 |
+
display: inline-block;
|
101 |
+
}
|
102 |
+
|
103 |
+
p {
|
104 |
+
margin: 25px 0 5px 0;
|
105 |
+
}
|
106 |
+
|
107 |
+
.head p {
|
108 |
+
margin: initial;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
.swp-inactive-block {
|
113 |
+
min-height: 50px;
|
114 |
+
display: flex;
|
115 |
+
flex-flow: row nowrap;
|
116 |
+
align-items: center;
|
117 |
+
|
118 |
+
/* The preview displayed when the block is not active. */
|
119 |
+
.swp-preview {
|
120 |
+
background: #F5F5F5;
|
121 |
+
width: 100%;
|
122 |
+
display: block;
|
123 |
+
font-family: 'SF Pro Text', 'Helvetica', sans-sans-serif;
|
124 |
+
font-size: 13px;
|
125 |
+
padding: 15px;
|
126 |
+
border-radius: 4px;
|
127 |
+
}
|
128 |
+
|
129 |
+
.swp-dashicon {
|
130 |
+
margin: 0 14px;
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
.click-to-tweet-block-wrap {
|
135 |
+
textarea[name="tweetText"] {
|
136 |
+
border-top-right-radius: 0px;
|
137 |
+
}
|
138 |
+
|
139 |
+
.block-characters-remaining {
|
140 |
+
font-size: 16px;
|
141 |
+
font-weight: normal;
|
142 |
+
color: white;
|
143 |
+
padding: 5px;
|
144 |
+
border-top-right-radius: 4px;
|
145 |
+
border-top-left-radius: 4px;
|
146 |
+
background: #30394F;
|
147 |
+
margin: 0;
|
148 |
+
float: right;
|
149 |
+
max-width: 200px;
|
150 |
+
padding: 5px 15px;
|
151 |
+
position: relative;
|
152 |
+
font-size: 13px;
|
153 |
+
transition: all 300ms;
|
154 |
+
}
|
155 |
+
|
156 |
+
.block-characters-remaining.over-limit {
|
157 |
+
background: #EE464F;
|
158 |
+
color: #fff;
|
159 |
+
}
|
160 |
+
}
|
assets/js/post-editor/src/blocks.js
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Gutenberg Blocks
|
3 |
+
*
|
4 |
+
* All blocks related JavaScript files should be imported here.
|
5 |
+
* You can create a new block folder in this dir and include code
|
6 |
+
* for that block here as well.
|
7 |
+
*
|
8 |
+
* All blocks should be included here since this is the file that
|
9 |
+
* Webpack is compiling as the input file.
|
10 |
+
*/
|
11 |
+
|
12 |
+
import './block/social-warfare.js';
|
13 |
+
import './block/click-to-tweet.js';
|
14 |
+
import './block/pinterest.js';
|
assets/js/post-editor/src/common.scss
ADDED
File without changes
|
assets/js/script.js
CHANGED
@@ -572,7 +572,8 @@ window.socialWarfare = window.socialWarfare || {};
|
|
572 |
var offset = $(this).offset();
|
573 |
|
574 |
//* Do not display floating buttons before the horizontal panel.
|
575 |
-
|
|
|
576 |
var theContent = $(".swp-content-locator").parent();
|
577 |
|
578 |
//* We are in sight of an "Above the content" panel.
|
@@ -712,6 +713,12 @@ window.socialWarfare = window.socialWarfare || {};
|
|
712 |
}
|
713 |
|
714 |
|
|
|
|
|
|
|
|
|
|
|
|
|
715 |
/**
|
716 |
* Toggle the display of a floating bar, depending on static panel visibility.
|
717 |
*
|
@@ -719,7 +726,12 @@ window.socialWarfare = window.socialWarfare || {};
|
|
719 |
*
|
720 |
*/
|
721 |
socialWarfare.toggleFloatingHorizontalPanel = function() {
|
722 |
-
if (!socialWarfare.
|
|
|
|
|
|
|
|
|
|
|
723 |
return;
|
724 |
}
|
725 |
|
@@ -754,7 +766,7 @@ window.socialWarfare = window.socialWarfare || {};
|
|
754 |
}
|
755 |
|
756 |
//* Update padding to be either initial values, or to use padding for floatingHorizontal panels.
|
757 |
-
|
758 |
}
|
759 |
|
760 |
|
572 |
var offset = $(this).offset();
|
573 |
|
574 |
//* Do not display floating buttons before the horizontal panel.
|
575 |
+
//* PHP json_encode() maps `true` to "1" and `false` to "".
|
576 |
+
if (typeof socialWarfare.floatBeforeContent != 'undefined' && "1" != socialWarfare.floatBeforeContent) {
|
577 |
var theContent = $(".swp-content-locator").parent();
|
578 |
|
579 |
//* We are in sight of an "Above the content" panel.
|
713 |
}
|
714 |
|
715 |
|
716 |
+
socialWarfare.hasReferencePanel = function() {
|
717 |
+
return typeof socialWarfare.panels.staticHorizontal != 'undefined' &&
|
718 |
+
socialWarfare.panels.staticHorizontal.length > 0
|
719 |
+
}
|
720 |
+
|
721 |
+
|
722 |
/**
|
723 |
* Toggle the display of a floating bar, depending on static panel visibility.
|
724 |
*
|
726 |
*
|
727 |
*/
|
728 |
socialWarfare.toggleFloatingHorizontalPanel = function() {
|
729 |
+
if (!socialWarfare.hasReferencePanel()) {
|
730 |
+
return;
|
731 |
+
}
|
732 |
+
|
733 |
+
// If there is no floating set, just bail.
|
734 |
+
if(!socialWarfare.panels.floatingHorizontal) {
|
735 |
return;
|
736 |
}
|
737 |
|
766 |
}
|
767 |
|
768 |
//* Update padding to be either initial values, or to use padding for floatingHorizontal panels.
|
769 |
+
$("body").css(paddingProp, newPadding);
|
770 |
}
|
771 |
|
772 |
|
assets/js/script.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
window.socialWarfare=window.socialWarfare||{},function(a,e,i){"use strict";if("function"!=typeof e){var e;return void console.log("Social Warfare requires jQuery, or $ as an alias of jQuery. Please make sure your theme provides access to jQuery before activating Social Warfare.")}e(document).ready(function(){socialWarfare.initPlugin(),e(a).resize(socialWarfare.onWindowResize)});var t;socialWarfare.onWindowResize=function(){clearTimeout(t),t=setTimeout(socialWarfare.initPlugin,100)},socialWarfare.paddingTop=parseInt(e("body").css("padding-top")),socialWarfare.paddingBottom=parseInt(e("body").css("padding-bottom")),socialWarfare.initPlugin=function(){e("body").css({paddingTop:socialWarfare.paddingTop,paddingBottom:socialWarfare.paddingBottom}),socialWarfare.establishPanels(),socialWarfare.establishBreakpoint(),(socialWarfare.panels.staticHorizontal||socialWarfare.panels.floatingSide||socialWarfare.panels.floatingHorizontal)&&(socialWarfare.createFloatHorizontalPanel(),socialWarfare.positionFloatSidePanel(),socialWarfare.activateHoverStates(),socialWarfare.handleButtonClicks(),socialWarfare.toggleFloatingButtons(),setTimeout(socialWarfare.checkListeners(0,5),2e3),e(a).scroll(socialWarfare.throttle(50,socialWarfare.toggleFloatingButtons)))},socialWarfare.establishPanels=function(){socialWarfare.panels={staticHorizontal:null,floatingSide:null,floatingHorizontal:null};var a=e(".swp_social_panel").not(".swp_social_panelSide"),i=e(".swp_social_panelSide");return a&&(socialWarfare.panels.staticHorizontal=a),i&&(socialWarfare.panels.floatingSide=i),socialWarfare.panels},socialWarfare.activateHoverStates=function(){socialWarfare.trigger("pre_activate_buttons"),e(".swp_social_panel:not(.swp_social_panelSide) .nc_tweetContainer").on("mouseenter",function(){if(!e(this).hasClass("swp_nohover")){socialWarfare.resetStaticPanel();var a=e(this).find(".swp_share").outerWidth(),i=e(this).find("i.sw").outerWidth(),t=e(this).width(),o=1+(a+35)/t;e(this).find(".iconFiller").width(a+i+25+"px"),e(this).css("flex",o+" 1 0%")}}),e(".swp_social_panel:not(.swp_social_panelSide)").on("mouseleave",socialWarfare.resetStaticPanel)},socialWarfare.resetStaticPanel=function(){e(".swp_social_panel:not(.swp_social_panelSide) .nc_tweetContainer:not(.swp_nohover) .iconFiller").removeAttr("style"),e(".swp_social_panel:not(.swp_social_panelSide) .nc_tweetContainer:not(.swp_nohover)").removeAttr("style")},socialWarfare.handleButtonClicks=function(){e(".nc_tweet, a.swp_CTT").off("click"),e(".nc_tweet, a.swp_CTT").on("click",function(i){if(e(this).hasClass("noPop"))return i;if(void 0===e(this).data("link"))return i;i.preventDefault();var t,o,r,s,n,l,c=e(this).data("link").replace("’","'");t=270,o=500,e(this).is(".pinterest, .buffer_link, .flipboard")&&(t=550,o=775),e(this).hasClass("nc_tweet")?l=e(this).parents(".nc_tweetContainer").data("network"):e(this).hasClass("swp_CTT")&&(l="ctt"),r=a.screenY+(a.innerHeight-t)/2,s=a.screenX+(a.innerWidth-o)/2,n="height="+t+",width="+o+",top="+r+",left="+s,a.open(c,l,n),socialWarfare.trackClick(l)})},socialWarfare.createFloatHorizontalPanel=function(){if(socialWarfare.panels.staticHorizontal.length){var a=socialWarfare.panels.staticHorizontal.data("float"),i=socialWarfare.panels.staticHorizontal.data("float-mobile"),t=socialWarfare.panels.staticHorizontal.data("float-color"),o=e('<div class="nc_wrapper" style="background-color:'+t+'"></div>'),r="";e(".nc_wrapper").length&&e(".nc_wrapper").remove(),"top"!=a&&"bottom"!=a&&"top"!=i&&"bottom"!=i||(r=socialWarfare.isMobile()?i:a,o.addClass(r).hide().appendTo("body"),socialWarfare.panels.floatingHorizontal=socialWarfare.panels.staticHorizontal.first().clone(),socialWarfare.panels.floatingHorizontal.addClass("nc_floater").appendTo(o),socialWarfare.updateFloatingHorizontalDimensions(),e(".swp_social_panel .swp_count").css({transition:"padding .1s linear"}))}},socialWarfare.updateFloatingHorizontalDimensions=function(){if(socialWarfare.panels.staticHorizontal.length&&socialWarfare.panels.floatingHorizontal){var a="100%",e=0,i=socialWarfare.panels.staticHorizontal,t=i.parent();t.hasClass("swp-hidden-panel-wrap")&&(t=t.parent()),void 0!==i.offset().left&&(e=i.offset().left),void 0!==i.width()&&(a=i.width()),0==e&&(e=t.offset().left),100!=a&&0!=a||(a=t.width()),socialWarfare.panels.floatingHorizontal.css({width:a,left:e})}},socialWarfare.staticPanelIsVisible=function(){var i=!1,t=e(a).scrollTop();return e(".swp_social_panel").not(".swp_social_panelSide, .nc_floater").each(function(o){var r=e(this).offset();if(void 0!==socialWarfare.floatBeforeContent&&0==socialWarfare.floatBeforeContent){var s=e(".swp-content-locator").parent();0===o&&s.length&&s.offset().top>t+e(a).height()&&(i=!0)}e(this).is(":visible")&&r.top+e(this).height()>t&&r.top<t+e(a).height()&&(i=!0)}),i},socialWarfare.toggleFloatingButtons=function(){var a=socialWarfare.panels.staticHorizontal.data("float");if(1==socialWarfare.isMobile())var a=socialWarfare.panels.staticHorizontal.data("float-mobile");return"none"==a?e(".nc_wrapper, .swp_social_panelSide").hide():socialWarfare.isMobile()?(socialWarfare.toggleMobileButtons(),void socialWarfare.toggleFloatingHorizontalPanel()):("right"!=a&&"left"!=a||socialWarfare.toggleFloatingVerticalPanel(),void("bottom"!=a&&"top"!=a||socialWarfare.toggleFloatingHorizontalPanel()))},socialWarfare.toggleMobileButtons=function(){socialWarfare.panels.floatingSide.hide();var a=socialWarfare.staticPanelIsVisible()?"collapse":"visible";e(".nc_wrapper").css("visibility",a)},socialWarfare.toggleFloatingVerticalPanel=function(){var a="",e=socialWarfare.panels.floatingSide.data("float"),i=socialWarfare.staticPanelIsVisible(),t="";if(socialWarfare.isMobile())return socialWarfare.panels.floatingSide.hide();socialWarfare.panels.floatingSide.show(),socialWarfare.panels.floatingSide&&socialWarfare.panels.floatingSide.length||(i=!!socialWarfare.isMobile()),"slide"==socialWarfare.panels.floatingSide.data("transition")?(a=-1!==e.indexOf("left")?"left":"right",t=i?"-150px":"5px",socialWarfare.panels.floatingSide.css(a,t)):i?socialWarfare.panels.floatingSide.css("opacity",1).fadeOut(300).css("opacity",0):socialWarfare.panels.floatingSide.css("opacity",0).fadeIn(300).css("display","flex").css("opacity",1)},socialWarfare.toggleFloatingHorizontalPanel=function(){if(socialWarfare.panels.staticHorizontal.length){var a=socialWarfare.panels.floatingHorizontal.first(),i=socialWarfare.isMobile()?e(a).data("float-mobile"):e(a).data("float"),t="bottom"==i?socialWarfare.paddingBottom:socialWarfare.paddingTop,o="padding-"+i;"off"!=i&&(socialWarfare.staticPanelIsVisible()?(e(".nc_wrapper").hide(),socialWarfare.isMobile()&&e("#wpadminbar").length&&e("#wpadminbar").css("top",0)):(t+=50,e(".nc_wrapper").show(),socialWarfare.isMobile()&&"top"==i&&e("#wpadminbar").length&&e("#wpadminbar").css("top",a.parent().height())),e("body").css(o,t))}},socialWarfare.positionFloatSidePanel=function(){var e,i,t,o=socialWarfare.panels.floatingSide;if(o&&o.length&&!o.hasClass("swp_side_top")&&!o.hasClass("swp_side_bottom")){if(e=o.outerHeight(),i=a.innerHeight,e>i)return o.css("top",0);t=(i-e)/2,o.css("top",t)}},e(a).on("load",function(){"undefined"!=typeof swpPinIt&&swpPinIt.enabled&&socialWarfare.enablePinterestSaveButtons(),a.clearCheckID=0}),socialWarfare.enablePinterestSaveButtons=function(){var i=socialWarfare.findPinterestBrowserSaveButtons();void 0!==i&&i&&socialWarfare.removePinterestBrowserSaveButtons(i),e(".swp-content-locator").parent().find("img").each(socialWarfare.renderPinterestSaveButton),e(".sw-pinit .sw-pinit-button").on("click",function(i){i.preventDefault(),a.open(e(this).attr("href"),"Pinterest","width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1"),socialWarfare.trackClick("pin_image")})},socialWarfare.renderPinterestSaveButton=function(){var a,i,t,o,r,s;if(a=e(this),!(void 0!=typeof swpPinIt.disableOnAnchors&&swpPinIt.disableOnAnchors&&e(a).parents().filter("a").length||a.outerHeight()<swpPinIt.minHeight||a.outerWidth()<swpPinIt.minWidth||a.hasClass("no_pin")||a.hasClass("no-pin"))){if(void 0!==swpPinIt.image_source){var n=new Image;n.src=swpPinIt.image_source,i=e(n).prop("src")}else a.data("media")?i=a.data("media"):e(this).data("lazy-src")?i=e(this).data("lazy-src"):a[0].src&&(i=a[0].src);i&&void 0!==i&&(void 0!==a.data("pin-description")?t=a.data("pin-description"):void 0!==swpPinIt.image_description?t=swpPinIt.image_description:a.attr("title")?t=a.attr("title"):a.attr("alt")&&(t=a.attr("alt")),s="http://pinterest.com/pin/create/bookmarklet/?media="+encodeURI(i)+"&url="+encodeURI(document.URL)+"&is_video=false&description="+encodeURIComponent(t),o=a.attr("class"),r=a.attr("style"),a.removeClass().attr("style","").wrap('<div class="sw-pinit" />'),a.after('<a href="'+s+'" class="sw-pinit-button sw-pinit-'+swpPinIt.vLocation+" sw-pinit-"+swpPinIt.hLocation+'">Save</a>'),a.parent(".sw-pinit").addClass(o).attr("style",r))}},socialWarfare.findPinterestBrowserSaveButtons=function(){var e,i,t,o,r;return e="rgb(189, 8, 28)",i="8675309",t="14px 14px",o=null,document.querySelectorAll("span").forEach(function(s,n){r=a.getComputedStyle(s),r.backgroundColor==e&&r.backgroundSize==t&&r.zIndex==i&&(o=s)}),o},socialWarfare.removePinterestBrowserSaveButtons=function(e){var i,t,o;i=e.nextSibling,void 0!==i&&"SPAN"==i.nodeName&&(t=a.getComputedStyle(i),o="24px",0===t.width.indexOf(o)&&0===t.height.indexOf(o)&&i.remove()),e.remove()},socialWarfare.fetchFacebookShares=function(){var a="https://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id="+swp_post_url,i=swp_post_recovery_url?"https://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id="+swp_post_recovery_url:"";e.when(e.get(a),e.get(i)).then(function(a,i){var t,o;t=socialWarfare.parseFacebookShares(a[0]),swp_post_recovery_url&&(t+=socialWarfare.parseFacebookShares(i[0]));var o={action:"swp_facebook_shares_update",post_id:swp_post_id,share_counts:t};e.post(swp_admin_ajax,o)})},socialWarfare.parseFacebookShares=function(a){var e=0;return void 0!==a.share&&(e+=parseInt(a.share.share_count),e+=parseInt(a.share.comment_count)),void 0!==a.og_object&&(e+=parseInt(a.og_object.likes.summary.total_count)),e},socialWarfare.throttle=function(a,e){function i(){function i(){o=+new Date,e.apply(r,n)}var r=this,s=+new Date-o,n=arguments;t&&clearTimeout(t),s>a?i():t=setTimeout(i,a-s)}var t=0,o=0;return socialWarfare.guid&&(i.guid=e.guid=e.guid||socialWarfareguid++),i},socialWarfare.trigger=function(i){e(a).trigger(e.Event(i))},socialWarfare.trackClick=function(a){!0===swpClickTracking&&("function"==typeof ga&&ga("send","event","social_media","swp_"+a+"_share"),"object"==typeof dataLayer&&dataLayer.push({event:"swp_"+a+"_share"}))},socialWarfare.checkListeners=function(a,i){if(!(a>i)){var t=e(".swp_social_panel");if(t.length>0&&t.find(".swp_pinterest"))return void socialWarfare.handleButtonClicks();setTimeout(function(){socialWarfare.checkListeners(++a,i)},2e3)}},socialWarfare.establishBreakpoint=function(){var a=e(".swp_social_panel");socialWarfare.breakpoint=1100,(a.length&&a.data("min-width")||0==a.data("min-width"))&&(socialWarfare.breakpoint=parseInt(a.data("min-width")))},socialWarfare.isMobile=function(){return e(a).width()<socialWarfare.breakpoint}}(this,jQuery);
|
1 |
+
window.socialWarfare=window.socialWarfare||{},function(a,e,i){"use strict";if("function"!=typeof e){var e;return void console.log("Social Warfare requires jQuery, or $ as an alias of jQuery. Please make sure your theme provides access to jQuery before activating Social Warfare.")}e(document).ready(function(){socialWarfare.initPlugin(),e(a).resize(socialWarfare.onWindowResize)});var t;socialWarfare.onWindowResize=function(){clearTimeout(t),t=setTimeout(socialWarfare.initPlugin,100)},socialWarfare.paddingTop=parseInt(e("body").css("padding-top")),socialWarfare.paddingBottom=parseInt(e("body").css("padding-bottom")),socialWarfare.initPlugin=function(){e("body").css({paddingTop:socialWarfare.paddingTop,paddingBottom:socialWarfare.paddingBottom}),socialWarfare.establishPanels(),socialWarfare.establishBreakpoint(),(socialWarfare.panels.staticHorizontal||socialWarfare.panels.floatingSide||socialWarfare.panels.floatingHorizontal)&&(socialWarfare.createFloatHorizontalPanel(),socialWarfare.positionFloatSidePanel(),socialWarfare.activateHoverStates(),socialWarfare.handleButtonClicks(),socialWarfare.toggleFloatingButtons(),setTimeout(socialWarfare.checkListeners(0,5),2e3),e(a).scroll(socialWarfare.throttle(50,socialWarfare.toggleFloatingButtons)))},socialWarfare.establishPanels=function(){socialWarfare.panels={staticHorizontal:null,floatingSide:null,floatingHorizontal:null};var a=e(".swp_social_panel").not(".swp_social_panelSide"),i=e(".swp_social_panelSide");return a&&(socialWarfare.panels.staticHorizontal=a),i&&(socialWarfare.panels.floatingSide=i),socialWarfare.panels},socialWarfare.activateHoverStates=function(){socialWarfare.trigger("pre_activate_buttons"),e(".swp_social_panel:not(.swp_social_panelSide) .nc_tweetContainer").on("mouseenter",function(){if(!e(this).hasClass("swp_nohover")){socialWarfare.resetStaticPanel();var a=e(this).find(".swp_share").outerWidth(),i=e(this).find("i.sw").outerWidth(),t=e(this).width(),o=1+(a+35)/t;e(this).find(".iconFiller").width(a+i+25+"px"),e(this).css("flex",o+" 1 0%")}}),e(".swp_social_panel:not(.swp_social_panelSide)").on("mouseleave",socialWarfare.resetStaticPanel)},socialWarfare.resetStaticPanel=function(){e(".swp_social_panel:not(.swp_social_panelSide) .nc_tweetContainer:not(.swp_nohover) .iconFiller").removeAttr("style"),e(".swp_social_panel:not(.swp_social_panelSide) .nc_tweetContainer:not(.swp_nohover)").removeAttr("style")},socialWarfare.handleButtonClicks=function(){e(".nc_tweet, a.swp_CTT").off("click"),e(".nc_tweet, a.swp_CTT").on("click",function(i){if(e(this).hasClass("noPop"))return i;if(void 0===e(this).data("link"))return i;i.preventDefault();var t,o,r,s,n,l,c=e(this).data("link").replace("’","'");t=270,o=500,e(this).is(".pinterest, .buffer_link, .flipboard")&&(t=550,o=775),e(this).hasClass("nc_tweet")?l=e(this).parents(".nc_tweetContainer").data("network"):e(this).hasClass("swp_CTT")&&(l="ctt"),r=a.screenY+(a.innerHeight-t)/2,s=a.screenX+(a.innerWidth-o)/2,n="height="+t+",width="+o+",top="+r+",left="+s,a.open(c,l,n),socialWarfare.trackClick(l)})},socialWarfare.createFloatHorizontalPanel=function(){if(socialWarfare.panels.staticHorizontal.length){var a=socialWarfare.panels.staticHorizontal.data("float"),i=socialWarfare.panels.staticHorizontal.data("float-mobile"),t=socialWarfare.panels.staticHorizontal.data("float-color"),o=e('<div class="nc_wrapper" style="background-color:'+t+'"></div>'),r="";e(".nc_wrapper").length&&e(".nc_wrapper").remove(),"top"!=a&&"bottom"!=a&&"top"!=i&&"bottom"!=i||(r=socialWarfare.isMobile()?i:a,o.addClass(r).hide().appendTo("body"),socialWarfare.panels.floatingHorizontal=socialWarfare.panels.staticHorizontal.first().clone(),socialWarfare.panels.floatingHorizontal.addClass("nc_floater").appendTo(o),socialWarfare.updateFloatingHorizontalDimensions(),e(".swp_social_panel .swp_count").css({transition:"padding .1s linear"}))}},socialWarfare.updateFloatingHorizontalDimensions=function(){if(socialWarfare.panels.staticHorizontal.length&&socialWarfare.panels.floatingHorizontal){var a="100%",e=0,i=socialWarfare.panels.staticHorizontal,t=i.parent();t.hasClass("swp-hidden-panel-wrap")&&(t=t.parent()),void 0!==i.offset().left&&(e=i.offset().left),void 0!==i.width()&&(a=i.width()),0==e&&(e=t.offset().left),100!=a&&0!=a||(a=t.width()),socialWarfare.panels.floatingHorizontal.css({width:a,left:e})}},socialWarfare.staticPanelIsVisible=function(){var i=!1,t=e(a).scrollTop();return e(".swp_social_panel").not(".swp_social_panelSide, .nc_floater").each(function(o){var r=e(this).offset();if(void 0!==socialWarfare.floatBeforeContent&&"1"!=socialWarfare.floatBeforeContent){var s=e(".swp-content-locator").parent();0===o&&s.length&&s.offset().top>t+e(a).height()&&(i=!0)}e(this).is(":visible")&&r.top+e(this).height()>t&&r.top<t+e(a).height()&&(i=!0)}),i},socialWarfare.toggleFloatingButtons=function(){var a=socialWarfare.panels.staticHorizontal.data("float");if(1==socialWarfare.isMobile())var a=socialWarfare.panels.staticHorizontal.data("float-mobile");return"none"==a?e(".nc_wrapper, .swp_social_panelSide").hide():socialWarfare.isMobile()?(socialWarfare.toggleMobileButtons(),void socialWarfare.toggleFloatingHorizontalPanel()):("right"!=a&&"left"!=a||socialWarfare.toggleFloatingVerticalPanel(),void("bottom"!=a&&"top"!=a||socialWarfare.toggleFloatingHorizontalPanel()))},socialWarfare.toggleMobileButtons=function(){socialWarfare.panels.floatingSide.hide();var a=socialWarfare.staticPanelIsVisible()?"collapse":"visible";e(".nc_wrapper").css("visibility",a)},socialWarfare.toggleFloatingVerticalPanel=function(){var a="",e=socialWarfare.panels.floatingSide.data("float"),i=socialWarfare.staticPanelIsVisible(),t="";if(socialWarfare.isMobile())return socialWarfare.panels.floatingSide.hide();socialWarfare.panels.floatingSide.show(),socialWarfare.panels.floatingSide&&socialWarfare.panels.floatingSide.length||(i=!!socialWarfare.isMobile()),"slide"==socialWarfare.panels.floatingSide.data("transition")?(a=-1!==e.indexOf("left")?"left":"right",t=i?"-150px":"5px",socialWarfare.panels.floatingSide.css(a,t)):i?socialWarfare.panels.floatingSide.css("opacity",1).fadeOut(300).css("opacity",0):socialWarfare.panels.floatingSide.css("opacity",0).fadeIn(300).css("display","flex").css("opacity",1)},socialWarfare.hasReferencePanel=function(){return void 0!==socialWarfare.panels.staticHorizontal&&socialWarfare.panels.staticHorizontal.length>0},socialWarfare.toggleFloatingHorizontalPanel=function(){if(socialWarfare.hasReferencePanel()&&socialWarfare.panels.floatingHorizontal){var a=socialWarfare.panels.floatingHorizontal.first(),i=socialWarfare.isMobile()?e(a).data("float-mobile"):e(a).data("float"),t="bottom"==i?socialWarfare.paddingBottom:socialWarfare.paddingTop,o="padding-"+i;"off"!=i&&(socialWarfare.staticPanelIsVisible()?(e(".nc_wrapper").hide(),socialWarfare.isMobile()&&e("#wpadminbar").length&&e("#wpadminbar").css("top",0)):(t+=50,e(".nc_wrapper").show(),socialWarfare.isMobile()&&"top"==i&&e("#wpadminbar").length&&e("#wpadminbar").css("top",a.parent().height())),e("body").css(o,t))}},socialWarfare.positionFloatSidePanel=function(){var e,i,t,o=socialWarfare.panels.floatingSide;if(o&&o.length&&!o.hasClass("swp_side_top")&&!o.hasClass("swp_side_bottom")){if(e=o.outerHeight(),i=a.innerHeight,e>i)return o.css("top",0);t=(i-e)/2,o.css("top",t)}},e(a).on("load",function(){"undefined"!=typeof swpPinIt&&swpPinIt.enabled&&socialWarfare.enablePinterestSaveButtons(),a.clearCheckID=0}),socialWarfare.enablePinterestSaveButtons=function(){var i=socialWarfare.findPinterestBrowserSaveButtons();void 0!==i&&i&&socialWarfare.removePinterestBrowserSaveButtons(i),e(".swp-content-locator").parent().find("img").each(socialWarfare.renderPinterestSaveButton),e(".sw-pinit .sw-pinit-button").on("click",function(i){i.preventDefault(),a.open(e(this).attr("href"),"Pinterest","width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1"),socialWarfare.trackClick("pin_image")})},socialWarfare.renderPinterestSaveButton=function(){var a,i,t,o,r,s;if(a=e(this),!(void 0!=typeof swpPinIt.disableOnAnchors&&swpPinIt.disableOnAnchors&&e(a).parents().filter("a").length||a.outerHeight()<swpPinIt.minHeight||a.outerWidth()<swpPinIt.minWidth||a.hasClass("no_pin")||a.hasClass("no-pin"))){if(void 0!==swpPinIt.image_source){var n=new Image;n.src=swpPinIt.image_source,i=e(n).prop("src")}else a.data("media")?i=a.data("media"):e(this).data("lazy-src")?i=e(this).data("lazy-src"):a[0].src&&(i=a[0].src);i&&void 0!==i&&(void 0!==a.data("pin-description")?t=a.data("pin-description"):void 0!==swpPinIt.image_description?t=swpPinIt.image_description:a.attr("title")?t=a.attr("title"):a.attr("alt")&&(t=a.attr("alt")),s="http://pinterest.com/pin/create/bookmarklet/?media="+encodeURI(i)+"&url="+encodeURI(document.URL)+"&is_video=false&description="+encodeURIComponent(t),o=a.attr("class"),r=a.attr("style"),a.removeClass().attr("style","").wrap('<div class="sw-pinit" />'),a.after('<a href="'+s+'" class="sw-pinit-button sw-pinit-'+swpPinIt.vLocation+" sw-pinit-"+swpPinIt.hLocation+'">Save</a>'),a.parent(".sw-pinit").addClass(o).attr("style",r))}},socialWarfare.findPinterestBrowserSaveButtons=function(){var e,i,t,o,r;return e="rgb(189, 8, 28)",i="8675309",t="14px 14px",o=null,document.querySelectorAll("span").forEach(function(s,n){r=a.getComputedStyle(s),r.backgroundColor==e&&r.backgroundSize==t&&r.zIndex==i&&(o=s)}),o},socialWarfare.removePinterestBrowserSaveButtons=function(e){var i,t,o;i=e.nextSibling,void 0!==i&&"SPAN"==i.nodeName&&(t=a.getComputedStyle(i),o="24px",0===t.width.indexOf(o)&&0===t.height.indexOf(o)&&i.remove()),e.remove()},socialWarfare.fetchFacebookShares=function(){var a="https://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id="+swp_post_url,i=swp_post_recovery_url?"https://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id="+swp_post_recovery_url:"";e.when(e.get(a),e.get(i)).then(function(a,i){var t,o;t=socialWarfare.parseFacebookShares(a[0]),swp_post_recovery_url&&(t+=socialWarfare.parseFacebookShares(i[0]));var o={action:"swp_facebook_shares_update",post_id:swp_post_id,share_counts:t};e.post(swp_admin_ajax,o)})},socialWarfare.parseFacebookShares=function(a){var e=0;return void 0!==a.share&&(e+=parseInt(a.share.share_count),e+=parseInt(a.share.comment_count)),void 0!==a.og_object&&(e+=parseInt(a.og_object.likes.summary.total_count)),e},socialWarfare.throttle=function(a,e){function i(){function i(){o=+new Date,e.apply(r,n)}var r=this,s=+new Date-o,n=arguments;t&&clearTimeout(t),s>a?i():t=setTimeout(i,a-s)}var t=0,o=0;return socialWarfare.guid&&(i.guid=e.guid=e.guid||socialWarfareguid++),i},socialWarfare.trigger=function(i){e(a).trigger(e.Event(i))},socialWarfare.trackClick=function(a){!0===swpClickTracking&&("function"==typeof ga&&ga("send","event","social_media","swp_"+a+"_share"),"object"==typeof dataLayer&&dataLayer.push({event:"swp_"+a+"_share"}))},socialWarfare.checkListeners=function(a,i){if(!(a>i)){var t=e(".swp_social_panel");if(t.length>0&&t.find(".swp_pinterest"))return void socialWarfare.handleButtonClicks();setTimeout(function(){socialWarfare.checkListeners(++a,i)},2e3)}},socialWarfare.establishBreakpoint=function(){var a=e(".swp_social_panel");socialWarfare.breakpoint=1100,(a.length&&a.data("min-width")||0==a.data("min-width"))&&(socialWarfare.breakpoint=parseInt(a.data("min-width")))},socialWarfare.isMobile=function(){return e(a).width()<socialWarfare.breakpoint}}(this,jQuery);
|
assets/js/sw-shortcode-generator.js
CHANGED
File without changes
|
assets/js/sw-shortcode-generator.min.js
CHANGED
File without changes
|
languages/social-warfare-da-DK.mo
CHANGED
File without changes
|
languages/social-warfare-de_DE.mo
CHANGED
File without changes
|
languages/social-warfare-en_US.mo
CHANGED
File without changes
|
languages/social-warfare-es_ES.mo
CHANGED
File without changes
|
languages/social-warfare-fr_FR.mo
CHANGED
File without changes
|
languages/social-warfare-hy.mo
CHANGED
File without changes
|
languages/social-warfare-it_IT.mo
CHANGED
File without changes
|
languages/social-warfare-pt_BR.mo
CHANGED
File without changes
|
languages/social-warfare-pt_PT.mo
CHANGED
File without changes
|
languages/social-warfare-ru_RU.mo
CHANGED
File without changes
|
languages/social-warfare-uk.mo
CHANGED
File without changes
|
languages/social-warfare.pot
CHANGED
File without changes
|
languages/social_warfare-el_EL.mo
CHANGED
File without changes
|
languages/social_warfare-nl_NL.mo
CHANGED
File without changes
|
lib/Social_Warfare.php
CHANGED
File without changes
|
lib/Social_Warfare_Addon.php
CHANGED
File without changes
|
lib/admin/SWP_Click_To_Tweet.php
CHANGED
File without changes
|
lib/admin/SWP_Column.php
CHANGED
File without changes
|
lib/admin/SWP_Settings_Link.php
CHANGED
File without changes
|
lib/admin/SWP_Shortcode_Generator.php
CHANGED
File without changes
|
lib/admin/SWP_Sidebar_Loader.php
CHANGED
File without changes
|
lib/admin/SWP_User_Profile.php
CHANGED
File without changes
|
lib/admin/assets/css/admin.css
CHANGED
File without changes
|
lib/admin/assets/css/style1.css
CHANGED
File without changes
|
lib/admin/assets/css/style2.css
CHANGED
File without changes
|
lib/admin/assets/css/style3.css
CHANGED
File without changes
|
lib/admin/assets/css/style4.css
CHANGED
File without changes
|
lib/admin/assets/css/styles.css
CHANGED
File without changes
|
lib/admin/assets/img/twitter-little-bird-button.png
CHANGED
File without changes
|
lib/admin/assets/img/twitter-little-bird-white.png
CHANGED
File without changes
|
lib/admin/assets/img/twitter-little-bird.png
CHANGED
File without changes
|
lib/admin/assets/js/clickToTweet.js
CHANGED
File without changes
|
lib/admin/assets/js/clickToTweet.min.js
CHANGED
File without changes
|
lib/admin/assets/js/tmclicktotweet_plugin.js
CHANGED
File without changes
|
lib/admin/swp_system_checker.php
CHANGED
File without changes
|
lib/buttons-panel/SWP_Buttons_Panel.php
CHANGED
@@ -393,7 +393,7 @@ class SWP_Buttons_Panel {
|
|
393 |
}
|
394 |
|
395 |
// If there is no content, this must be called directly via function or shortcode.
|
396 |
-
if ( empty( $this->content )
|
397 |
$this->location = 'above';
|
398 |
return;
|
399 |
}
|
393 |
}
|
394 |
|
395 |
// If there is no content, this must be called directly via function or shortcode.
|
396 |
+
if ( empty( $this->content ) ) {
|
397 |
$this->location = 'above';
|
398 |
return;
|
399 |
}
|
lib/buttons-panel/SWP_Buttons_Panel_Loader.php
CHANGED
@@ -40,6 +40,17 @@ class SWP_Buttons_panel_Loader {
|
|
40 |
public $options;
|
41 |
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* The class constructor.
|
45 |
*
|
@@ -75,7 +86,8 @@ class SWP_Buttons_panel_Loader {
|
|
75 |
// Hook into the template_redirect so that is_singular() conditionals will be ready
|
76 |
add_action( 'template_redirect', array( $this, 'activate_buttons' ) );
|
77 |
add_action( 'wp_footer', array( $this, 'floating_buttons' ) , 20 );
|
78 |
-
|
|
|
79 |
}
|
80 |
|
81 |
|
@@ -185,6 +197,59 @@ class SWP_Buttons_panel_Loader {
|
|
185 |
|
186 |
}
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
/**
|
189 |
* When floatingHorizontal buttons are desired, but not staticHorizontal
|
190 |
* exists, we need to create a staticHorizontal so the floaters have
|
@@ -195,7 +260,34 @@ class SWP_Buttons_panel_Loader {
|
|
195 |
* @return void The rendered HTML is echoed to the screen.
|
196 |
*
|
197 |
*/
|
198 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
global $post;
|
200 |
|
201 |
|
@@ -209,27 +301,44 @@ class SWP_Buttons_panel_Loader {
|
|
209 |
$float_location_post_type = SWP_Utility::get_option( 'float_location_' . $post->post_type );
|
210 |
$float_location = SWP_Utility::get_option( 'float_location' );
|
211 |
$location_post_type = SWP_Utility::get_option( 'location_' . $post->post_type );
|
212 |
-
|
213 |
-
|
214 |
$acceptable_locations = array( 'top', 'bottom' );
|
215 |
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
if ( false == $floating_panel && 'off' == $float_mobile && 'off' == $float_location_post_type ) {
|
223 |
-
return
|
224 |
}
|
225 |
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
if ( !is_singular() ) {
|
232 |
-
return
|
233 |
}
|
234 |
|
235 |
|
@@ -240,8 +349,8 @@ class SWP_Buttons_panel_Loader {
|
|
240 |
*
|
241 |
*/
|
242 |
if( !in_array( $float_location, $acceptable_locations )
|
243 |
-
|
244 |
-
return
|
245 |
}
|
246 |
|
247 |
/**
|
@@ -251,30 +360,11 @@ class SWP_Buttons_panel_Loader {
|
|
251 |
*
|
252 |
*/
|
253 |
if ( 'none' != $post_meta_enabled_static && 'none' != $location_post_type ) {
|
254 |
-
return
|
255 |
}
|
256 |
|
|
|
257 |
|
258 |
-
/**
|
259 |
-
* Bail out if the floating options are set to off on this specific post.
|
260 |
-
*
|
261 |
-
*/
|
262 |
-
if ( 'off' == $post_meta_enabled_floating ) {
|
263 |
-
return $content;
|
264 |
-
}
|
265 |
-
|
266 |
-
|
267 |
-
/**
|
268 |
-
* If all the checks above get passed, then we'll go ahead and create a
|
269 |
-
* static horizontal buttons panel, wrap it in a wrapper to make it
|
270 |
-
* invisible, and echo it to the screen.
|
271 |
-
*
|
272 |
-
*/
|
273 |
-
$staticHorizontal = new SWP_Buttons_Panel();
|
274 |
-
$html = '<div class="swp-hidden-panel-wrap" style="display: none; visibility: collapse; opacity: 0">';
|
275 |
-
$html .= $staticHorizontal->render_html();
|
276 |
-
$html .= '</div>';
|
277 |
-
return $content . $html;
|
278 |
}
|
279 |
|
280 |
|
40 |
public $options;
|
41 |
|
42 |
|
43 |
+
/**
|
44 |
+
* Content_Loaded
|
45 |
+
*
|
46 |
+
* A public method that we can check to see if the content hook has been
|
47 |
+
* processed or not.
|
48 |
+
*
|
49 |
+
* @var bool
|
50 |
+
*/
|
51 |
+
public $content_loaded = false;
|
52 |
+
|
53 |
+
|
54 |
/**
|
55 |
* The class constructor.
|
56 |
*
|
86 |
// Hook into the template_redirect so that is_singular() conditionals will be ready
|
87 |
add_action( 'template_redirect', array( $this, 'activate_buttons' ) );
|
88 |
add_action( 'wp_footer', array( $this, 'floating_buttons' ) , 20 );
|
89 |
+
add_filter( 'the_content', array( $this, 'add_static_panel_fallback_content' ) , 20 );
|
90 |
+
add_action( 'wp_footer', array( $this, 'add_static_panel_fallback_footer' ) , 20 );
|
91 |
}
|
92 |
|
93 |
|
197 |
|
198 |
}
|
199 |
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Add the hidden panel to the content if it is available. If the content()
|
203 |
+
* hook is not available, we will attempt later to add it to the footer.
|
204 |
+
*
|
205 |
+
* @since 3.4.2 | 04 DEC 2018 | Created
|
206 |
+
* @param string $content The post content to be modified
|
207 |
+
* @return string The modified post content
|
208 |
+
*
|
209 |
+
*/
|
210 |
+
public function add_static_panel_fallback_content( $content ) {
|
211 |
+
|
212 |
+
// Record that the post conent hook has indeed loaded.
|
213 |
+
$this->content_loaded = true;
|
214 |
+
|
215 |
+
// Bail if we don't need these fallback buttons.
|
216 |
+
if( false === $this->should_float_fallback_display() ) {
|
217 |
+
return $content;
|
218 |
+
}
|
219 |
+
|
220 |
+
// Generate the buttons and return the modified content.
|
221 |
+
return $this->generate_static_panel_fallback( $content );
|
222 |
+
}
|
223 |
+
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Add the static fallback buttons to the footer if the content() failed
|
227 |
+
* to get loaded in the above function.
|
228 |
+
*
|
229 |
+
* @since 3.4.2 | 04 DEC 2018 | Created
|
230 |
+
* @param void
|
231 |
+
* @return void
|
232 |
+
*
|
233 |
+
*/
|
234 |
+
public function add_static_panel_fallback_footer() {
|
235 |
+
|
236 |
+
|
237 |
+
// Bail if the content hook was successfully loaded.
|
238 |
+
if( true === $this->content_loaded ) {
|
239 |
+
return;
|
240 |
+
}
|
241 |
+
|
242 |
+
// Bail if we don't need these buttons.
|
243 |
+
if( false === $this->should_float_fallback_display() ) {
|
244 |
+
return;
|
245 |
+
}
|
246 |
+
|
247 |
+
// Generate the static panel fallback and echo it to the screen.
|
248 |
+
echo $this->generate_static_panel_fallback();
|
249 |
+
|
250 |
+
}
|
251 |
+
|
252 |
+
|
253 |
/**
|
254 |
* When floatingHorizontal buttons are desired, but not staticHorizontal
|
255 |
* exists, we need to create a staticHorizontal so the floaters have
|
260 |
* @return void The rendered HTML is echoed to the screen.
|
261 |
*
|
262 |
*/
|
263 |
+
public function generate_static_panel_fallback( $content = '' ) {
|
264 |
+
global $post;
|
265 |
+
|
266 |
+
|
267 |
+
/**
|
268 |
+
* If all the checks above get passed, then we'll go ahead and create a
|
269 |
+
* static horizontal buttons panel, wrap it in a wrapper to make it
|
270 |
+
* invisible, and echo it to the screen.
|
271 |
+
*
|
272 |
+
*/
|
273 |
+
$staticHorizontal = new SWP_Buttons_Panel();
|
274 |
+
$html = '<div class="swp-hidden-panel-wrap" style="display: none; visibility: collapse; opacity: 0">';
|
275 |
+
$html .= $staticHorizontal->render_html();
|
276 |
+
$html .= '</div>';
|
277 |
+
return $content . $html;
|
278 |
+
}
|
279 |
+
|
280 |
+
|
281 |
+
/**
|
282 |
+
* A method to determine if we need to output a set of hidden horizontal
|
283 |
+
* buttons that can be cloned into the floating buttons on the top or bottom.
|
284 |
+
*
|
285 |
+
* @since 3.4.2 | 04 NOV 2018
|
286 |
+
* @param void
|
287 |
+
* @return bool
|
288 |
+
*
|
289 |
+
*/
|
290 |
+
public function should_float_fallback_display() {
|
291 |
global $post;
|
292 |
|
293 |
|
301 |
$float_location_post_type = SWP_Utility::get_option( 'float_location_' . $post->post_type );
|
302 |
$float_location = SWP_Utility::get_option( 'float_location' );
|
303 |
$location_post_type = SWP_Utility::get_option( 'location_' . $post->post_type );
|
304 |
+
$post_meta_enabled_static = get_post_meta( $post->ID, 'swp_post_location', true);
|
305 |
+
$post_meta_enabled_floating = get_post_meta( $post->ID, 'swp_float_location', true );
|
306 |
$acceptable_locations = array( 'top', 'bottom' );
|
307 |
|
308 |
|
309 |
+
/**
|
310 |
+
* Bail out if the floating options are set to off on this specific post.
|
311 |
+
*
|
312 |
+
*/
|
313 |
+
if ( 'off' == $post_meta_enabled_floating ) {
|
314 |
+
return false;
|
315 |
+
}
|
316 |
+
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Autimatically be true if set to on for this post.
|
320 |
+
*
|
321 |
+
*/
|
322 |
+
if ( 'on' == $post_meta_enabled_floating ) {
|
323 |
+
return true;
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* We are only generating this if the user has floating buttons activated
|
328 |
+
* at least somewhere. If all floating options are off, just bail.
|
329 |
+
*
|
330 |
+
*/
|
331 |
if ( false == $floating_panel && 'off' == $float_mobile && 'off' == $float_location_post_type ) {
|
332 |
+
return false;
|
333 |
}
|
334 |
|
335 |
|
336 |
+
/**
|
337 |
+
* Do not print top/bottom floating buttons on blog pages.
|
338 |
+
*
|
339 |
+
*/
|
340 |
if ( !is_singular() ) {
|
341 |
+
return false;
|
342 |
}
|
343 |
|
344 |
|
349 |
*
|
350 |
*/
|
351 |
if( !in_array( $float_location, $acceptable_locations )
|
352 |
+
&& !in_array( $float_mobile, $acceptable_locations ) ) {
|
353 |
+
return false;
|
354 |
}
|
355 |
|
356 |
/**
|
360 |
*
|
361 |
*/
|
362 |
if ( 'none' != $post_meta_enabled_static && 'none' != $location_post_type ) {
|
363 |
+
return false;
|
364 |
}
|
365 |
|
366 |
+
return true;
|
367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
}
|
369 |
|
370 |
|
lib/buttons-panel/SWP_Buttons_Panel_Shortcode.php
CHANGED
File without changes
|
lib/buttons-panel/SWP_Buttons_Panel_Side.php
CHANGED
File without changes
|
lib/buttons-panel/SWP_Buttons_Panel_Trait.php
CHANGED
@@ -374,6 +374,17 @@ trait SWP_Buttons_Panel_Trait {
|
|
374 |
$post_setting = get_post_meta( $this->post_id, 'swp_float_location', true );
|
375 |
|
376 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
/**
|
378 |
* We don't use floating buttons on the home page or if we weren't able
|
379 |
* to generate a proper post_id.
|
@@ -493,6 +504,7 @@ trait SWP_Buttons_Panel_Trait {
|
|
493 |
protected function get_order_of_icons() {
|
494 |
global $swp_social_networks;
|
495 |
$default_buttons = SWP_Utility::get_option( 'order_of_icons' );
|
|
|
496 |
$order = array();
|
497 |
|
498 |
|
@@ -500,9 +512,13 @@ trait SWP_Buttons_Panel_Trait {
|
|
500 |
* If the icons are set to be manually sorted, then we simply use the
|
501 |
* order from the options page that the user has set.
|
502 |
*
|
|
|
|
|
|
|
|
|
503 |
*/
|
504 |
-
if (
|
505 |
-
|
506 |
}
|
507 |
|
508 |
|
@@ -711,15 +727,14 @@ trait SWP_Buttons_Panel_Trait {
|
|
711 |
return;
|
712 |
}
|
713 |
|
|
|
714 |
/**
|
715 |
* If it's not a set of floating buttons and it's not set to the left,
|
716 |
* then we attach the total shares on the right.
|
717 |
*
|
718 |
*/
|
|
|
719 |
|
720 |
-
else {
|
721 |
-
$this->inner_html = $buttons_html . $total_shares_html;
|
722 |
-
}
|
723 |
}
|
724 |
|
725 |
|
374 |
$post_setting = get_post_meta( $this->post_id, 'swp_float_location', true );
|
375 |
|
376 |
|
377 |
+
/**
|
378 |
+
* If the floaters are implicitly turned on at the post level, then that
|
379 |
+
* means the user wants them to float on this post regardless of the
|
380 |
+
* global settings.
|
381 |
+
*
|
382 |
+
*/
|
383 |
+
if( 'on' === $post_setting ) {
|
384 |
+
return $float_location;
|
385 |
+
}
|
386 |
+
|
387 |
+
|
388 |
/**
|
389 |
* We don't use floating buttons on the home page or if we weren't able
|
390 |
* to generate a proper post_id.
|
504 |
protected function get_order_of_icons() {
|
505 |
global $swp_social_networks;
|
506 |
$default_buttons = SWP_Utility::get_option( 'order_of_icons' );
|
507 |
+
$sort_method = SWP_Utility::get_option( 'order_of_icons_method' );
|
508 |
$order = array();
|
509 |
|
510 |
|
512 |
* If the icons are set to be manually sorted, then we simply use the
|
513 |
* order from the options page that the user has set.
|
514 |
*
|
515 |
+
* Adding a check for false, because this option is pro only and will
|
516 |
+
* return false if it is not available in core, and therefore will default
|
517 |
+
* to the manual sorting method.
|
518 |
+
*
|
519 |
*/
|
520 |
+
if ( 'manual' === $sort_method || false === $sort_method ) {
|
521 |
+
return $default_buttons;
|
522 |
}
|
523 |
|
524 |
|
727 |
return;
|
728 |
}
|
729 |
|
730 |
+
|
731 |
/**
|
732 |
* If it's not a set of floating buttons and it's not set to the left,
|
733 |
* then we attach the total shares on the right.
|
734 |
*
|
735 |
*/
|
736 |
+
$this->inner_html = $buttons_html . $total_shares_html;
|
737 |
|
|
|
|
|
|
|
738 |
}
|
739 |
|
740 |
|
lib/frontend-output/SWP_Header_Output.php
CHANGED
File without changes
|
lib/frontend-output/SWP_Script.php
CHANGED
@@ -52,8 +52,6 @@ class SWP_Script {
|
|
52 |
|
53 |
// Queue up our hook function
|
54 |
add_action( 'wp_footer' , array( $this, 'footer_functions' ) , 99 );
|
55 |
-
add_action( 'wp_footer' , array( $this, 'localize_variables' ) , 99 );
|
56 |
-
add_action( 'admin_footer' , array( $this, 'localize_variables' ) , 99 );
|
57 |
|
58 |
}
|
59 |
|
@@ -105,6 +103,8 @@ class SWP_Script {
|
|
105 |
true
|
106 |
);
|
107 |
|
|
|
|
|
108 |
}
|
109 |
|
110 |
|
@@ -142,6 +142,8 @@ class SWP_Script {
|
|
142 |
'swp_characters_remaining' => '',
|
143 |
)
|
144 |
);
|
|
|
|
|
145 |
}
|
146 |
|
147 |
|
52 |
|
53 |
// Queue up our hook function
|
54 |
add_action( 'wp_footer' , array( $this, 'footer_functions' ) , 99 );
|
|
|
|
|
55 |
|
56 |
}
|
57 |
|
103 |
true
|
104 |
);
|
105 |
|
106 |
+
$this->localize_variables();
|
107 |
+
|
108 |
}
|
109 |
|
110 |
|
142 |
'swp_characters_remaining' => '',
|
143 |
)
|
144 |
);
|
145 |
+
|
146 |
+
$this->localize_variables();
|
147 |
}
|
148 |
|
149 |
|
lib/frontend-output/SWP_Shortcode.php
CHANGED
File without changes
|
lib/options/SWP_Option.php
CHANGED
File without changes
|
lib/options/SWP_Option_Abstract.php
CHANGED
File without changes
|
lib/options/SWP_Option_Icons.php
CHANGED
File without changes
|
lib/options/SWP_Option_Select.php
CHANGED
File without changes
|
lib/options/SWP_Option_Text.php
CHANGED
File without changes
|
lib/options/SWP_Option_Textarea.php
CHANGED
File without changes
|
lib/options/SWP_Option_Toggle.php
CHANGED
File without changes
|
lib/options/SWP_Options_Page.php
CHANGED
File without changes
|
lib/options/SWP_Options_Page_Section.php
CHANGED
File without changes
|
lib/options/SWP_Options_Page_Tab.php
CHANGED
File without changes
|
lib/options/SWP_Registration_Tab_Template.php
CHANGED
File without changes
|
lib/options/SWP_Section_HTML.php
CHANGED
File without changes
|
lib/options/SWP_User_Options.php
CHANGED
File without changes
|
lib/social-networks/SWP_Facebook.php
CHANGED
File without changes
|
lib/social-networks/SWP_Google_Plus.php
CHANGED
File without changes
|
lib/social-networks/SWP_Linkedin.php
CHANGED
File without changes
|
lib/social-networks/SWP_Mix.php
CHANGED
File without changes
|
lib/social-networks/SWP_Pinterest.php
CHANGED
File without changes
|
lib/social-networks/SWP_Social_Network.php
CHANGED
File without changes
|
lib/social-networks/SWP_Social_Networks_Loader.php
CHANGED
File without changes
|
lib/social-networks/SWP_Stumble_Upon.php
CHANGED
File without changes
|
lib/social-networks/SWP_Twitter.php
CHANGED
File without changes
|
lib/update-checker/.editorconfig
CHANGED
File without changes
|
lib/update-checker/Puc/v4/Factory.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Autoloader.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/DebugBar/Extension.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/DebugBar/Panel.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/DebugBar/PluginExtension.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/DebugBar/PluginPanel.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/DebugBar/ThemePanel.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Factory.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/InstalledPackage.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Metadata.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/OAuthSignature.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Plugin/Info.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Plugin/Package.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Plugin/Ui.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Plugin/Update.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Plugin/UpdateChecker.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Scheduler.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/StateStore.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Theme/Package.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Theme/Update.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Theme/UpdateChecker.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Update.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/UpdateChecker.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/UpgraderStatus.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Utils.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Vcs/Api.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Vcs/BaseChecker.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Vcs/BitBucketApi.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Vcs/GitHubApi.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Vcs/GitLabApi.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Vcs/PluginUpdateChecker.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Vcs/Reference.php
CHANGED
File without changes
|
lib/update-checker/Puc/v4p4/Vcs/ThemeUpdateChecker.php
CHANGED
File without changes
|
lib/update-checker/README.md
CHANGED
File without changes
|
lib/update-checker/composer.json
CHANGED
File without changes
|
lib/update-checker/css/puc-debug-bar.css
CHANGED
File without changes
|
lib/update-checker/examples/plugin.json
CHANGED
File without changes
|
lib/update-checker/examples/theme.json
CHANGED
File without changes
|
lib/update-checker/js/debug-bar.js
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-cs_CZ.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-cs_CZ.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-da_DK.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-da_DK.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-de_DE.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-de_DE.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-fa_IR.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-fa_IR.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-fr_CA.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-fr_CA.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-fr_FR.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-fr_FR.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-hu_HU.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-hu_HU.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-it_IT.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-it_IT.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-ja.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-ja.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-nl_BE.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-nl_BE.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-nl_NL.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-nl_NL.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-pt_BR.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-pt_BR.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-sv_SE.mo
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker-sv_SE.po
CHANGED
File without changes
|
lib/update-checker/languages/plugin-update-checker.pot
CHANGED
File without changes
|
lib/update-checker/license.txt
CHANGED
File without changes
|
lib/update-checker/plugin-update-checker.php
CHANGED
File without changes
|
lib/update-checker/vendor/Parsedown.php
CHANGED
File without changes
|
lib/update-checker/vendor/ParsedownLegacy.php
CHANGED
File without changes
|
lib/update-checker/vendor/readme-parser.php
CHANGED
File without changes
|
lib/utilities/SWP_CURL.php
CHANGED
@@ -67,11 +67,27 @@ class SWP_CURL {
|
|
67 |
|
68 |
// execute the handles
|
69 |
$running = null;
|
|
|
70 |
do {
|
71 |
-
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
-
|
75 |
foreach ( $curly as $network => $content ) {
|
76 |
$result[ $network ] = curl_multi_getcontent( $content );
|
77 |
curl_multi_remove_handle( $mh, $content );
|
67 |
|
68 |
// execute the handles
|
69 |
$running = null;
|
70 |
+
|
71 |
do {
|
72 |
+
$mrc = curl_multi_exec($mh, $running);
|
73 |
+
}
|
74 |
+
|
75 |
+
while ($mrc == CURLM_CALL_MULTI_PERFORM);
|
76 |
+
|
77 |
+
|
78 |
+
while ($running && $mrc == CURLM_OK) {
|
79 |
+
if (curl_multi_select($mh) == -1) {
|
80 |
+
usleep(1);
|
81 |
+
}
|
82 |
+
|
83 |
+
do {
|
84 |
+
$mrc = curl_multi_exec($mh, $running);
|
85 |
+
}
|
86 |
+
|
87 |
+
while ($mrc == CURLM_CALL_MULTI_PERFORM);
|
88 |
+
}
|
89 |
|
90 |
+
// get content and remove handles
|
91 |
foreach ( $curly as $network => $content ) {
|
92 |
$result[ $network ] = curl_multi_getcontent( $content );
|
93 |
curl_multi_remove_handle( $mh, $content );
|
lib/utilities/SWP_Compatibility.php
CHANGED
File without changes
|
lib/utilities/SWP_Database_Migration.php
CHANGED
@@ -86,8 +86,14 @@ class SWP_Database_Migration {
|
|
86 |
foreach ( $meta as $key => $value ) {
|
87 |
|
88 |
//* Only print Social Warfare meta keys.
|
89 |
-
if (
|
90 |
|| ( strpos( $key, '_shares' ) > 0 ) && strpos( $key, '_') === 0 ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
unset( $meta[$key] );
|
92 |
}
|
93 |
}
|
86 |
foreach ( $meta as $key => $value ) {
|
87 |
|
88 |
//* Only print Social Warfare meta keys.
|
89 |
+
if ( ( strpos( $key, 'swp_' ) === 0
|
90 |
|| ( strpos( $key, '_shares' ) > 0 ) && strpos( $key, '_') === 0 ) ) {
|
91 |
+
$meta[$key] = $value[0];
|
92 |
+
}
|
93 |
+
|
94 |
+
else {
|
95 |
+
//* Everything comes in as an array, pull out the first value.
|
96 |
+
|
97 |
unset( $meta[$key] );
|
98 |
}
|
99 |
}
|
lib/utilities/SWP_Debug_Trait.php
CHANGED
File without changes
|
lib/utilities/SWP_JSON_Cache_Handler.php
CHANGED
File without changes
|
lib/utilities/SWP_Localization.php
CHANGED
File without changes
|
lib/utilities/SWP_Notice.php
CHANGED
File without changes
|
lib/utilities/SWP_Notice_Loader.php
CHANGED
File without changes
|
lib/utilities/SWP_Permalink.php
CHANGED
File without changes
|
lib/utilities/SWP_Post_Cache.php
CHANGED
@@ -559,7 +559,7 @@ class SWP_Post_Cache {
|
|
559 |
* for which to fetch share counts.
|
560 |
*
|
561 |
*/
|
562 |
-
if( true === SWP_Utility::get_option('
|
563 |
$this->permalinks[$key][] = SWP_Permalink::get_alt_permalink( $this->post_id );
|
564 |
}
|
565 |
|
559 |
* for which to fetch share counts.
|
560 |
*
|
561 |
*/
|
562 |
+
if( true === SWP_Utility::get_option('recover_shares') ) {
|
563 |
$this->permalinks[$key][] = SWP_Permalink::get_alt_permalink( $this->post_id );
|
564 |
}
|
565 |
|
lib/utilities/SWP_Post_Cache_Loader.php
CHANGED
File without changes
|
lib/utilities/SWP_URL_Management.php
CHANGED
File without changes
|
lib/utilities/SWP_Utility.php
CHANGED
@@ -73,8 +73,6 @@ class SWP_Utility {
|
|
73 |
* @return bool Whether or not the options were updated in the database.
|
74 |
*/
|
75 |
public static function store_settings() {
|
76 |
-
global $swp_user_options;
|
77 |
-
|
78 |
if ( !check_ajax_referer( 'swp_plugin_options_save', 'security', false ) ) {
|
79 |
wp_send_json_error( esc_html__( 'Security failed.', 'social-warfare' ) );
|
80 |
die;
|
@@ -87,6 +85,7 @@ class SWP_Utility {
|
|
87 |
die;
|
88 |
}
|
89 |
|
|
|
90 |
$settings = $data['settings'];
|
91 |
|
92 |
// Loop and check for checkbox values, convert them to boolean.
|
@@ -100,7 +99,7 @@ class SWP_Utility {
|
|
100 |
}
|
101 |
}
|
102 |
|
103 |
-
$new_settings = array_merge( $
|
104 |
|
105 |
echo json_encode( update_option( 'social_warfare_settings', $new_settings ) );
|
106 |
|
@@ -322,7 +321,7 @@ class SWP_Utility {
|
|
322 |
$options = get_option( 'social_warfare_settings', array() );
|
323 |
unset( $options[$key] );
|
324 |
|
325 |
-
return update_option( 'social_warfare_settings', $options);
|
326 |
}
|
327 |
|
328 |
/**
|
73 |
* @return bool Whether or not the options were updated in the database.
|
74 |
*/
|
75 |
public static function store_settings() {
|
|
|
|
|
76 |
if ( !check_ajax_referer( 'swp_plugin_options_save', 'security', false ) ) {
|
77 |
wp_send_json_error( esc_html__( 'Security failed.', 'social-warfare' ) );
|
78 |
die;
|
85 |
die;
|
86 |
}
|
87 |
|
88 |
+
$options = get_option( 'social_warfare_settings', array() );
|
89 |
$settings = $data['settings'];
|
90 |
|
91 |
// Loop and check for checkbox values, convert them to boolean.
|
99 |
}
|
100 |
}
|
101 |
|
102 |
+
$new_settings = array_merge( $options, $settings );
|
103 |
|
104 |
echo json_encode( update_option( 'social_warfare_settings', $new_settings ) );
|
105 |
|
321 |
$options = get_option( 'social_warfare_settings', array() );
|
322 |
unset( $options[$key] );
|
323 |
|
324 |
+
return update_option( 'social_warfare_settings', $options);
|
325 |
}
|
326 |
|
327 |
/**
|
lib/utilities/functions.php
CHANGED
File without changes
|
lib/widgets/SWP_Popular_Posts_Widget.php
CHANGED
File without changes
|
lib/widgets/SWP_Widget.php
CHANGED
File without changes
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: holas84, dustinwstout, webinator, warfareplugins, nutsandboltsmedia, cdegraff1, ckmahoney
|
3 |
Tags: sharing buttons, social media share, floating share buttons, facebook share, google plus share, linkedin share, pin it, pinterest save, mix button, tweet button, twitter share, click to tweet, social sharing buttons, social share, social sharing, social media sharing, wordpress social sharing plugin, social sharing plugin, share buttons, share counts
|
4 |
Requires at least: 3.5.1
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 3.4.
|
7 |
License: GNU General Public License v2.0 or later
|
8 |
|
9 |
The most beautiful, responsive, lightning fast social share buttons built to boost shares and drive more traffic without slowing down your site.
|
@@ -193,8 +193,15 @@ We have a growing archive of <a href="https://warfareplugins.com/support/" rel="
|
|
193 |
|
194 |
== Changelog ==
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
= 3.4.0 (27 NOV 2018) =
|
197 |
-
* Props to our Warfare Community beta testers- you guys rock!
|
198 |
* Added support for Gutenberg blocks Social Warfare and Click To Tweet (as of Gutenberg 4.5.1)
|
199 |
* Added option in Advanced tab to disable Gutenberg blocks.
|
200 |
* Added interactive components to the Admin sidebar.
|
2 |
Contributors: holas84, dustinwstout, webinator, warfareplugins, nutsandboltsmedia, cdegraff1, ckmahoney
|
3 |
Tags: sharing buttons, social media share, floating share buttons, facebook share, google plus share, linkedin share, pin it, pinterest save, mix button, tweet button, twitter share, click to tweet, social sharing buttons, social share, social sharing, social media sharing, wordpress social sharing plugin, social sharing plugin, share buttons, share counts
|
4 |
Requires at least: 3.5.1
|
5 |
+
Tested up to: 5.0.0
|
6 |
+
Stable tag: 3.4.1
|
7 |
License: GNU General Public License v2.0 or later
|
8 |
|
9 |
The most beautiful, responsive, lightning fast social share buttons built to boost shares and drive more traffic without slowing down your site.
|
193 |
|
194 |
== Changelog ==
|
195 |
|
196 |
+
= 3.4.1 (4 DEC 2018) =
|
197 |
+
* Fixed JS error in Admin (`TypeError $ is not defined`)
|
198 |
+
* Fixed placement of mobile floating buttons.
|
199 |
+
* Fixed breakpoint transition for mobile buttons.
|
200 |
+
* Fixed option registration when Pro is temporarily deactivated.
|
201 |
+
* Updated cURL method so API requests are faster.
|
202 |
+
* Removed references to Open Share Count.
|
203 |
+
|
204 |
= 3.4.0 (27 NOV 2018) =
|
|
|
205 |
* Added support for Gutenberg blocks Social Warfare and Click To Tweet (as of Gutenberg 4.5.1)
|
206 |
* Added option in Advanced tab to disable Gutenberg blocks.
|
207 |
* Added interactive components to the Admin sidebar.
|
social-warfare.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Social Warfare
|
4 |
* Plugin URI: https://warfareplugins.com
|
5 |
* Description: A plugin to maximize social shares and drive more traffic using the fastest and most intelligent share buttons on the market, calls to action via in-post click-to-tweets, popular posts widgets based on share popularity, link-shortening, Google Analytics and much, much more!
|
6 |
-
* Version: 3.4.
|
7 |
* Author: Warfare Plugins
|
8 |
* Author URI: https://warfareplugins.com
|
9 |
* Text Domain: social-warfare
|
@@ -16,7 +16,7 @@ defined( 'WPINC' ) || die;
|
|
16 |
* Define plugin constants for use throughout the plugin (Version and Directories)
|
17 |
*
|
18 |
*/
|
19 |
-
define( 'SWP_VERSION' , '3.4.
|
20 |
define( 'SWP_PLUGIN_FILE', __FILE__ );
|
21 |
define( 'SWP_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
|
22 |
define( 'SWP_PLUGIN_DIR', dirname( __FILE__ ) );
|
3 |
* Plugin Name: Social Warfare
|
4 |
* Plugin URI: https://warfareplugins.com
|
5 |
* Description: A plugin to maximize social shares and drive more traffic using the fastest and most intelligent share buttons on the market, calls to action via in-post click-to-tweets, popular posts widgets based on share popularity, link-shortening, Google Analytics and much, much more!
|
6 |
+
* Version: 3.4.1
|
7 |
* Author: Warfare Plugins
|
8 |
* Author URI: https://warfareplugins.com
|
9 |
* Text Domain: social-warfare
|
16 |
* Define plugin constants for use throughout the plugin (Version and Directories)
|
17 |
*
|
18 |
*/
|
19 |
+
define( 'SWP_VERSION' , '3.4.1' );
|
20 |
define( 'SWP_PLUGIN_FILE', __FILE__ );
|
21 |
define( 'SWP_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
|
22 |
define( 'SWP_PLUGIN_DIR', dirname( __FILE__ ) );
|