diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/.distignore b/wp-content/upgrade-temp-backup/plugins/activitypub/.distignore
new file mode 100644
index 00000000..871e8074
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/.distignore
@@ -0,0 +1,41 @@
+.DS_Store
+.editorconfig
+.git
+.gitignore
+.github
+.travis.yml
+.codeclimate.yml
+.data
+.svnignore
+.wordpress-org
+.php_cs
+Gruntfile.js
+LINGUAS
+Makefile
+README.md
+readme.md
+CODE_OF_CONDUCT.md
+FEDERATION.md
+SECURITY.md
+LICENSE.md
+_site
+_config.yml
+bin
+composer.json
+composer.lock
+docker-compose.yml
+docker-compose-test.yml
+Dockerfile
+gulpfile.js
+package.json
+node_modules
+npm-debug.log
+phpcs.xml
+package.json
+package-lock.json
+phpunit.xml
+phpunit.xml.dist
+tests
+node_modules
+vendor
+src
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/LICENSE b/wp-content/upgrade-temp-backup/plugins/activitypub/LICENSE
new file mode 100644
index 00000000..644800f2
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/LICENSE
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) 2019 Matthias Pfefferle
+Copyright (c) 2023 Automattic
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/activitypub.php b/wp-content/upgrade-temp-backup/plugins/activitypub/activitypub.php
new file mode 100644
index 00000000..abab5f09
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/activitypub.php
@@ -0,0 +1,214 @@
+)|(?<= %s %s %s %s %s %s ' . __( 'The following Template Tags are available:', 'activitypub' ) . ' ' . __( 'You may also use any Shortcode normally available to you on your site, however be aware that Shortcodes may significantly increase the size of your content depending on what they do.', 'activitypub' ) . ' ' . __( 'Note: the old Template Tags are now deprecated and automatically converted to the new ones.', 'activitypub' ) . ' ' . \wp_kses( \__( 'Let me know if you miss a Template Tag.', 'activitypub' ), 'activitypub' ) . '
)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' );
+\defined( 'ACTIVITYPUB_USERNAME_REGEXP' ) || \define( 'ACTIVITYPUB_USERNAME_REGEXP', '(?:([A-Za-z0-9_-]+)@((?:[A-Za-z0-9_-]+\.)+[A-Za-z]+))' );
+\defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "[ap_title]\n\n[ap_content]\n\n[ap_hashtags]\n\n[ap_shortlink]" );
+\defined( 'ACTIVITYPUB_AUTHORIZED_FETCH' ) || \define( 'ACTIVITYPUB_AUTHORIZED_FETCH', false );
+\defined( 'ACTIVITYPUB_DISABLE_REWRITES' ) || \define( 'ACTIVITYPUB_DISABLE_REWRITES', false );
+
+\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
+\define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
+\define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );
+\define( 'ACTIVITYPUB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
+
+/**
+ * Initialize REST routes.
+ */
+function rest_init() {
+ Rest\Users::init();
+ Rest\Outbox::init();
+ Rest\Inbox::init();
+ Rest\Followers::init();
+ Rest\Following::init();
+ Rest\Webfinger::init();
+ Rest\Server::init();
+ Rest\Collection::init();
+
+ // load NodeInfo endpoints only if blog is public
+ if ( is_blog_public() ) {
+ Rest\NodeInfo::init();
+ }
+}
+\add_action( 'rest_api_init', __NAMESPACE__ . '\rest_init' );
+
+/**
+ * Initialize plugin.
+ */
+function plugin_init() {
+ \add_action( 'init', array( __NAMESPACE__ . '\Migration', 'init' ) );
+ \add_action( 'init', array( __NAMESPACE__ . '\Activitypub', 'init' ) );
+ \add_action( 'init', array( __NAMESPACE__ . '\Activity_Dispatcher', 'init' ) );
+ \add_action( 'init', array( __NAMESPACE__ . '\Handler', 'init' ) );
+ \add_action( 'init', array( __NAMESPACE__ . '\Admin', 'init' ) );
+ \add_action( 'init', array( __NAMESPACE__ . '\Hashtag', 'init' ) );
+ \add_action( 'init', array( __NAMESPACE__ . '\Mention', 'init' ) );
+ \add_action( 'init', array( __NAMESPACE__ . '\Health_Check', 'init' ) );
+ \add_action( 'init', array( __NAMESPACE__ . '\Scheduler', 'init' ) );
+
+ if ( site_supports_blocks() ) {
+ \add_action( 'init', array( __NAMESPACE__ . '\Blocks', 'init' ) );
+ }
+
+ $debug_file = __DIR__ . '/includes/debug.php';
+ if ( \WP_DEBUG && file_exists( $debug_file ) && is_readable( $debug_file ) ) {
+ require_once $debug_file;
+ Debug::init();
+ }
+
+ require_once __DIR__ . '/integration/class-webfinger.php';
+ Integration\Webfinger::init();
+
+ require_once __DIR__ . '/integration/class-nodeinfo.php';
+ Integration\Nodeinfo::init();
+}
+\add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_init' );
+
+/**
+ * Class Autoloader
+ */
+\spl_autoload_register(
+ function ( $full_class ) {
+ $base_dir = __DIR__ . '/includes/';
+ $base = 'Activitypub\\';
+
+ if ( strncmp( $full_class, $base, strlen( $base ) ) === 0 ) {
+ $maybe_uppercase = str_replace( $base, '', $full_class );
+ $class = strtolower( $maybe_uppercase );
+ // All classes should be capitalized. If this is instead looking for a lowercase method, we ignore that.
+ if ( $maybe_uppercase === $class ) {
+ return;
+ }
+
+ if ( false !== strpos( $class, '\\' ) ) {
+ $parts = explode( '\\', $class );
+ $class = array_pop( $parts );
+ $sub_dir = implode( '/', $parts );
+ $base_dir = $base_dir . $sub_dir . '/';
+ }
+
+ $filename = 'class-' . strtr( $class, '_', '-' );
+ $file = $base_dir . $filename . '.php';
+
+ if ( file_exists( $file ) && is_readable( $file ) ) {
+ require_once $file;
+ } else {
+ // translators: %s is the class name
+ \wp_die( sprintf( esc_html__( 'Required class not found or not readable: %s', 'activitypub' ), esc_html( $full_class ) ) );
+ }
+ }
+ }
+);
+
+/**
+ * Add plugin settings link
+ */
+function plugin_settings_link( $actions ) {
+ $settings_link = array();
+ $settings_link[] = \sprintf(
+ '%2s',
+ \menu_page_url( 'activitypub', false ),
+ \__( 'Settings', 'activitypub' )
+ );
+
+ return \array_merge( $settings_link, $actions );
+}
+\add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), __NAMESPACE__ . '\plugin_settings_link' );
+
+\register_activation_hook(
+ __FILE__,
+ array(
+ __NAMESPACE__ . '\Activitypub',
+ 'activate',
+ )
+);
+
+\register_deactivation_hook(
+ __FILE__,
+ array(
+ __NAMESPACE__ . '\Activitypub',
+ 'deactivate',
+ )
+);
+
+\register_uninstall_hook(
+ __FILE__,
+ array(
+ __NAMESPACE__ . '\Activitypub',
+ 'uninstall',
+ )
+);
+
+/**
+ * Only load code that needs BuddyPress to run once BP is loaded and initialized.
+ */
+add_action(
+ 'bp_include',
+ function() {
+ require_once __DIR__ . '/integration/class-buddypress.php';
+ Integration\Buddypress::init();
+ },
+ 0
+);
+
+/**
+ * `get_plugin_data` wrapper
+ *
+ * @return array The plugin metadata array
+ */
+function get_plugin_meta( $default_headers = array() ) {
+ if ( ! $default_headers ) {
+ $default_headers = array(
+ 'Name' => 'Plugin Name',
+ 'PluginURI' => 'Plugin URI',
+ 'Version' => 'Version',
+ 'Description' => 'Description',
+ 'Author' => 'Author',
+ 'AuthorURI' => 'Author URI',
+ 'TextDomain' => 'Text Domain',
+ 'DomainPath' => 'Domain Path',
+ 'Network' => 'Network',
+ 'RequiresWP' => 'Requires at least',
+ 'RequiresPHP' => 'Requires PHP',
+ 'UpdateURI' => 'Update URI',
+ );
+ }
+
+ return \get_file_data( __FILE__, $default_headers, 'plugin' );
+}
+
+/**
+ * Plugin Version Number used for caching.
+ */
+function get_plugin_version() {
+ $meta = get_plugin_meta( array( 'Version' => 'Version' ) );
+
+ return $meta['Version'];
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/assets/css/activitypub-admin.css b/wp-content/upgrade-temp-backup/plugins/activitypub/assets/css/activitypub-admin.css
new file mode 100644
index 00000000..07aadcad
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/assets/css/activitypub-admin.css
@@ -0,0 +1,199 @@
+.activitypub-settings {
+ max-width: 800px;
+ margin: 0 auto;
+}
+
+.settings_page_activitypub .notice {
+ max-width: 800px;
+ margin: auto;
+ margin: 0px auto 30px;
+}
+
+.settings_page_activitypub .wrap {
+ padding-left: 22px;
+}
+
+.activitypub-settings-header {
+ text-align: center;
+ margin: 0 0 1rem;
+ background: #fff;
+ border-bottom: 1px solid #dcdcde;
+}
+
+.activitypub-settings-title-section {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ clear: both;
+ padding-top: 8px;
+}
+
+.settings_page_activitypub #wpcontent {
+ padding-left: 0;
+}
+
+.activitypub-settings-tabs-wrapper {
+ display: -ms-inline-grid;
+ -ms-grid-columns: auto auto auto;
+ vertical-align: top;
+ display: inline-grid;
+ grid-template-columns: auto auto auto;
+}
+
+.activitypub-settings-tab.active {
+ box-shadow: inset 0 -3px #3582c4;
+ font-weight: 600;
+}
+
+.activitypub-settings-tab {
+ display: block;
+ text-decoration: none;
+ color: inherit;
+ padding: .5rem 1rem 1rem;
+ margin: 0 1rem;
+ transition: box-shadow .5s ease-in-out;
+}
+
+.wp-header-end {
+ visibility: hidden;
+ margin: -2px 0 0;
+}
+
+summary {
+ cursor: pointer;
+ text-decoration: underline;
+ color: #2271b1;
+}
+
+.activitypub-settings-accordion {
+ border: 1px solid #c3c4c7;
+}
+
+.activitypub-settings-accordion-heading {
+ margin: 0;
+ border-top: 1px solid #c3c4c7;
+ font-size: inherit;
+ line-height: inherit;
+ font-weight: 600;
+ color: inherit;
+}
+
+.activitypub-settings-accordion-heading:first-child {
+ border-top: none;
+}
+
+.activitypub-settings-accordion-panel {
+ margin: 0;
+ padding: 1em 1.5em;
+ background: #fff;
+}
+
+.activitypub-settings-accordion-trigger {
+ background: #fff;
+ border: 0;
+ color: #2c3338;
+ cursor: pointer;
+ display: flex;
+ font-weight: 400;
+ margin: 0;
+ padding: 1em 3.5em 1em 1.5em;
+ min-height: 46px;
+ position: relative;
+ text-align: left;
+ width: 100%;
+ align-items: center;
+ justify-content: space-between;
+ -webkit-user-select: auto;
+ user-select: auto;
+}
+
+.activitypub-settings-accordion-trigger {
+ color: #2c3338;
+ cursor: pointer;
+ font-weight: 400;
+ text-align: left;
+}
+
+.activitypub-settings-accordion-trigger .title {
+ pointer-events: none;
+ font-weight: 600;
+ flex-grow: 1;
+}
+
+.activitypub-settings-accordion-trigger .icon,
+.activitypub-settings-accordion-viewed .icon {
+ border: solid #50575e medium;
+ border-width: 0 2px 2px 0;
+ height: .5rem;
+ pointer-events: none;
+ position: absolute;
+ right: 1.5em;
+ top: 50%;
+ transform: translateY(-70%) rotate(45deg);
+ width: .5rem;
+}
+
+.activitypub-settings-accordion-trigger[aria-expanded="true"] .icon {
+ transform: translateY(-30%) rotate(-135deg);
+}
+
+.activitypub-settings-accordion-trigger:active,
+.activitypub-settings-accordion-trigger:hover {
+ background: #f6f7f7;
+}
+
+.activitypub-settings-accordion-trigger:focus {
+ color: #1d2327;
+ border: none;
+ box-shadow: none;
+ outline-offset: -1px;
+ outline: 2px solid #2271b1;
+ background-color: #f6f7f7;
+}
+
+.activitypub-settings
+input.blog-user-identifier {
+ text-align: right;
+}
+
+.activitypub-settings
+.header-image {
+ width: 100%;
+ height: 80px;
+ position: relative;
+ display: block;
+ margin-bottom: 40px;
+ background-image: rgb(168,165,175);
+ background-image: linear-gradient(180deg, red, yellow);
+ background-size: cover;
+}
+
+.activitypub-settings
+.logo {
+ height: 80px;
+ width: 80px;
+ position: relative;
+ top: 40px;
+ left: 40px;
+}
+
+.settings_page_activitypub .box {
+ border: 1px solid #c3c4c7;
+ background-color: #fff;
+ padding: 1em 1.5em;
+ margin-bottom: 1.5em;
+}
+
+.settings_page_activitypub .activitypub-welcome-page .box label {
+ font-weight: bold;
+}
+
+.settings_page_activitypub .activitypub-welcome-page input {
+ font-size: 20px;
+ width: 95%;
+}
+
+.settings_page_activitypub .plugin-recommendations {
+ border-bottom: none;
+ margin-bottom: 0;
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/assets/img/mp.jpg b/wp-content/upgrade-temp-backup/plugins/activitypub/assets/img/mp.jpg
new file mode 100644
index 00000000..05964b49
Binary files /dev/null and b/wp-content/upgrade-temp-backup/plugins/activitypub/assets/img/mp.jpg differ
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/assets/img/wp-logo.png b/wp-content/upgrade-temp-backup/plugins/activitypub/assets/img/wp-logo.png
new file mode 100644
index 00000000..b48f08e8
Binary files /dev/null and b/wp-content/upgrade-temp-backup/plugins/activitypub/assets/img/wp-logo.png differ
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/assets/js/activitypub-admin.js b/wp-content/upgrade-temp-backup/plugins/activitypub/assets/js/activitypub-admin.js
new file mode 100644
index 00000000..f6a75afe
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/assets/js/activitypub-admin.js
@@ -0,0 +1,20 @@
+jQuery( function( $ ) {
+ // Accordion handling in various areas.
+ $( '.activitypub-settings-accordion' ).on( 'click', '.activitypub-settings-accordion-trigger', function() {
+ var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
+
+ if ( isExpanded ) {
+ $( this ).attr( 'aria-expanded', 'false' );
+ $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
+ } else {
+ $( this ).attr( 'aria-expanded', 'true' );
+ $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
+ }
+ } );
+
+ $(document).on( 'wp-plugin-install-success', function( event, response ) {
+ setTimeout( function() {
+ $( '.activate-now' ).removeClass( 'thickbox open-plugin-details-modal' );
+ }, 1200 );
+ } );
+} );
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/build/follow-me/block.json b/wp-content/upgrade-temp-backup/plugins/activitypub/build/follow-me/block.json
new file mode 100644
index 00000000..8dcb824d
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/build/follow-me/block.json
@@ -0,0 +1,47 @@
+{
+ "$schema": "https://schemas.wp.org/trunk/block.json",
+ "name": "activitypub/follow-me",
+ "apiVersion": 3,
+ "version": "1.0.0",
+ "title": "Follow me on the Fediverse",
+ "category": "widgets",
+ "description": "Display your Fediverse profile so that visitors can follow you.",
+ "textdomain": "activitypub",
+ "icon": "groups",
+ "supports": {
+ "html": false,
+ "color": {
+ "gradients": true,
+ "link": true,
+ "__experimentalDefaultControls": {
+ "background": true,
+ "text": true,
+ "link": true
+ }
+ },
+ "__experimentalBorder": {
+ "radius": true,
+ "width": true,
+ "color": true,
+ "style": true
+ },
+ "typography": {
+ "fontSize": true,
+ "__experimentalDefaultControls": {
+ "fontSize": true
+ }
+ }
+ },
+ "attributes": {
+ "selectedUser": {
+ "type": "string",
+ "default": "site"
+ }
+ },
+ "editorScript": "file:./index.js",
+ "viewScript": "file:./view.js",
+ "style": [
+ "file:./style-index.css",
+ "wp-components"
+ ]
+}
\ No newline at end of file
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/build/follow-me/index.asset.php b/wp-content/upgrade-temp-backup/plugins/activitypub/build/follow-me/index.asset.php
new file mode 100644
index 00000000..760f4336
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/build/follow-me/index.asset.php
@@ -0,0 +1 @@
+ array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '6aeec6336fd28aa836a7');
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/build/follow-me/index.js b/wp-content/upgrade-temp-backup/plugins/activitypub/build/follow-me/index.js
new file mode 100644
index 00000000..1320f15d
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/build/follow-me/index.js
@@ -0,0 +1 @@
+(()=>{"use strict";var e,t={843:(e,t,n)=>{const r=window.wp.blocks,o=window.wp.element,l=window.wp.primitives,a=(0,o.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,o.createElement)(l.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"}));function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;thttps://example.com/yourusername
or yourusername@example.com
)","activitypub"),{code:(0,o.createElement)("code",null)})),(0,o.createElement)("div",{className:"apfmd__button-group"},(0,o.createElement)("input",{type:"text",value:E,onKeyDown:e=>{"Enter"===e?.code&&x()},onChange:e=>k(e.target.value)}),(0,o.createElement)(u.Button,{onClick:x},m))))}function z(e){let{selectedUser:t,style:n,backgroundColor:r,id:l,useId:a=!1,profileData:c=!1}=e;const[i,s]=(0,o.useState)(C()),u="site"===t?0:t,p=function(e){return E(".apfmd__button-group .components-button",_(e?.elements?.link?.color?.text)||"#111","#fff",_(e?.elements?.link?.[":hover"]?.color?.text)||"#333")}(n),m=a?{id:l}:{};function v(e){s(C(e))}return(0,o.useEffect)((()=>{if(c)return v(c);(function(e){const t={headers:{Accept:"application/activity+json"},path:`/${O}/users/${e}`};return d()(t)})(u).then(v)}),[u,c]),(0,o.createElement)("div",m,(0,o.createElement)(k,{selector:`#${l}`,style:n,backgroundColor:r}),(0,o.createElement)(S,{profile:i,userId:u,popupStyles:p}))}(0,r.registerBlockType)("activitypub/follow-me",{edit:function(e){let{attributes:t,setAttributes:n}=e;const r=(0,i.useBlockProps)({className:"activitypub-follow-me-block-wrapper"}),l=function(){const e=m?.users?(0,p.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,o.useMemo)((()=>{if(!e)return[];const t=m?.site?[{label:(0,s.__)("Whole Site","activitypub"),value:"site"}]:[];return e.reduce(((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e)),t)}),[e])}(),{selectedUser:a}=t;return(0,o.useEffect)((()=>{l.length&&(l.find((e=>{let{value:t}=e;return t===a}))||n({selectedUser:l[0].value}))}),[a,l]),(0,o.createElement)("div",r,l.length>1&&(0,o.createElement)(i.InspectorControls,{key:"setting"},(0,o.createElement)(u.PanelBody,{title:(0,s.__)("Followers Options","activitypub")},(0,o.createElement)(u.SelectControl,{label:(0,s.__)("Select User","activitypub"),value:t.selectedUser,options:l,onChange:e=>n({selectedUser:e})}))),(0,o.createElement)(z,c({},t,{id:r.id})))},save:()=>null,icon:a})}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var l=n[e]={exports:{}};return t[e](l,l.exports,r),l.exports}r.m=t,e=[],r.O=(t,n,o,l)=>{if(!n){var a=1/0;for(u=0;uhttps://example.com/yourusername
or yourusername@example.com
)","activitypub"),{code:(0,o.createElement)("code",null)})),(0,o.createElement)("div",{className:"apfmd__button-group"},(0,o.createElement)("input",{type:"text",value:k,onKeyDown:e=>{"Enter"===e?.code&&x()},onChange:e=>O(e.target.value)}),(0,o.createElement)(u.Button,{onClick:x},b))))}function S(e){let{selectedUser:t,style:r,backgroundColor:n,id:l,useId:a=!1,profileData:c=!1}=e;const[u,s]=(0,o.useState)(k()),p="site"===t?0:t,m=function(e){return _(".apfmd__button-group .components-button",b(e?.elements?.link?.color?.text)||"#111","#fff",b(e?.elements?.link?.[":hover"]?.color?.text)||"#333")}(r),d=a?{id:l}:{};function v(e){s(k(e))}return(0,o.useEffect)((()=>{if(c)return v(c);(function(e){const t={headers:{Accept:"application/activity+json"},path:`/${E}/users/${e}`};return i()(t)})(p).then(v)}),[p,c]),(0,o.createElement)("div",d,(0,o.createElement)(h,{selector:`#${l}`,style:r,backgroundColor:n}),(0,o.createElement)(O,{profile:u,userId:p,popupStyles:m}))}let $=1;a()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follow-me-block-wrapper"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,o.render)((0,o.createElement)(S,n({},t,{id:"activitypub-follow-me-block-"+$++,useId:!0})),e)}))}))}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var l=r[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,r,o,l)=>{if(!r){var a=1/0;for(s=0;s' . esc_html( $attrs['title'] ) . '
';
+ }
+ $html .= '';
+ foreach ( $follower_data['followers'] as $follower ) {
+ $html .= '
+
+ %s
+ /
+ @%s
+
+ %s
+ ';
+
+ $data = $follower->to_array();
+
+ return sprintf(
+ $template,
+ esc_url( $data['url'] ),
+ esc_attr( $data['name'] ),
+ esc_attr( $data['icon']['url'] ),
+ esc_html( $data['name'] ),
+ esc_html( $data['preferredUsername'] ),
+ $external_svg
+ );
+ }
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-debug.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-debug.php
new file mode 100644
index 00000000..36f8bda5
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-debug.php
@@ -0,0 +1,36 @@
+post_content, $match ) ) {
+ $tags = \implode( ', ', $match[1] );
+
+ \wp_add_post_tags( $post->post_parent, $tags );
+ }
+
+ return $id;
+ }
+
+ /**
+ * Filter to replace the #tags in the content with links
+ *
+ * @param string $the_content the post-content
+ *
+ * @return string the filtered post-content
+ */
+ public static function the_content( $the_content ) {
+ // small protection against execution timeouts: limit to 1 MB
+ if ( mb_strlen( $the_content ) > MB_IN_BYTES ) {
+ return $the_content;
+ }
+ $tag_stack = array();
+ $protected_tags = array(
+ 'pre',
+ 'code',
+ 'textarea',
+ 'style',
+ 'a',
+ );
+ $content_with_links = '';
+ $in_protected_tag = false;
+ foreach ( wp_html_split( $the_content ) as $chunk ) {
+ if ( preg_match( '#^$#i', $chunk, $m ) ) {
+ $content_with_links .= $chunk;
+ continue;
+ }
+
+ if ( preg_match( '#^<(/)?([a-z-]+)\b[^>]*>$#i', $chunk, $m ) ) {
+ $tag = strtolower( $m[2] );
+ if ( '/' === $m[1] ) {
+ // Closing tag.
+ $i = array_search( $tag, $tag_stack );
+ // We can only remove the tag from the stack if it is in the stack.
+ if ( false !== $i ) {
+ $tag_stack = array_slice( $tag_stack, 0, $i );
+ }
+ } else {
+ // Opening tag, add it to the stack.
+ $tag_stack[] = $tag;
+ }
+
+ // If we're in a protected tag, the tag_stack contains at least one protected tag string.
+ // The protected tag state can only change when we encounter a start or end tag.
+ $in_protected_tag = array_intersect( $tag_stack, $protected_tags );
+
+ // Never inspect tags.
+ $content_with_links .= $chunk;
+ continue;
+ }
+
+ if ( $in_protected_tag ) {
+ // Don't inspect a chunk inside an inspected tag.
+ $content_with_links .= $chunk;
+ continue;
+ }
+
+ // Only reachable when there is no protected tag in the stack.
+ $content_with_links .= \preg_replace_callback( '/' . ACTIVITYPUB_HASHTAGS_REGEXP . '/i', array( '\Activitypub\Hashtag', 'replace_with_links' ), $chunk );
+ }
+
+ return $content_with_links;
+ }
+
+ /**
+ * A callback for preg_replace to build the term links
+ *
+ * @param array $result the preg_match results
+ * @return string the final string
+ */
+ public static function replace_with_links( $result ) {
+ $tag = $result[1];
+ $tag_object = \get_term_by( 'name', $tag, 'post_tag' );
+
+ if ( $tag_object ) {
+ $link = \get_term_link( $tag_object, 'post_tag' );
+ return \sprintf( '#%s', $link, $tag );
+ }
+
+ return '#' . $tag;
+ }
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-health-check.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-health-check.php
new file mode 100644
index 00000000..74a6f9ec
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-health-check.php
@@ -0,0 +1,377 @@
+ \__( 'Author URL test', 'activitypub' ),
+ 'test' => array( self::class, 'test_author_url' ),
+ );
+ }
+
+ $tests['direct']['activitypub_test_webfinger'] = array(
+ 'label' => __( 'WebFinger Test', 'activitypub' ),
+ 'test' => array( self::class, 'test_webfinger' ),
+ );
+
+ $tests['direct']['activitypub_test_system_cron'] = array(
+ 'label' => __( 'System Cron Test', 'activitypub' ),
+ 'test' => array( self::class, 'test_system_cron' ),
+ );
+
+ return $tests;
+ }
+
+ /**
+ * Author URL tests
+ *
+ * @return array
+ */
+ public static function test_author_url() {
+ $result = array(
+ 'label' => \__( 'Author URL accessible', 'activitypub' ),
+ 'status' => 'good',
+ 'badge' => array(
+ 'label' => \__( 'ActivityPub', 'activitypub' ),
+ 'color' => 'green',
+ ),
+ 'description' => \sprintf(
+ '
%s
was replaced, this is often done by plugins.',
+ 'activitypub'
+ ),
+ $author_url
+ )
+ );
+ }
+
+ // try to access author URL
+ $response = \wp_remote_get(
+ $author_url,
+ array(
+ 'headers' => array( 'Accept' => 'application/activity+json' ),
+ 'redirection' => 0,
+ )
+ );
+
+ if ( \is_wp_error( $response ) ) {
+ return new WP_Error(
+ 'author_url_not_accessible',
+ \sprintf(
+ // translators: %s: Author URL
+ \__(
+ 'Your author URL %s
is not accessible. Please check your WordPress setup or permalink structure. If the setup seems fine, maybe check if a plugin might restrict the access.',
+ 'activitypub'
+ ),
+ $author_url
+ )
+ );
+ }
+
+ $response_code = \wp_remote_retrieve_response_code( $response );
+
+ // check for redirects
+ if ( \in_array( $response_code, array( 301, 302, 307, 308 ), true ) ) {
+ return new WP_Error(
+ 'author_url_not_accessible',
+ \sprintf(
+ // translators: %s: Author URL
+ \__(
+ 'Your author URL %s
is redirecting to another page, this is often done by SEO plugins like "Yoast SEO".',
+ 'activitypub'
+ ),
+ $author_url
+ )
+ );
+ }
+
+ // check if response is JSON
+ $body = \wp_remote_retrieve_body( $response );
+
+ if ( ! \is_string( $body ) || ! \is_array( \json_decode( $body, true ) ) ) {
+ return new WP_Error(
+ 'author_url_not_accessible',
+ \sprintf(
+ // translators: %s: Author URL
+ \__(
+ 'Your author URL %s
does not return valid JSON for application/activity+json
. Please check if your hosting supports alternate Accept
headers.',
+ 'activitypub'
+ ),
+ $author_url
+ )
+ );
+ }
+
+ return true;
+ }
+
+ /**
+ * Check if WebFinger endpoint is accessible and profile request returns correct JSON
+ *
+ * @return boolean|WP_Error
+ */
+ public static function is_webfinger_endpoint_accessible() {
+ $user = \wp_get_current_user();
+
+ if ( ! is_user_type_disabled( 'blog' ) ) {
+ $account = get_webfinger_resource( $user->ID );
+ } elseif ( ! is_user_type_disabled( 'user' ) ) {
+ $account = get_webfinger_resource( Users::BLOG_USER_ID );
+ } else {
+ $account = '';
+ }
+
+ $url = Webfinger::resolve( $account );
+ if ( \is_wp_error( $url ) ) {
+ $allowed = array( 'code' => array() );
+ $not_accessible = wp_kses(
+ // translators: %s: Author URL
+ \__(
+ 'Your WebFinger endpoint %s
is not accessible. Please check your WordPress setup or permalink structure.',
+ 'activitypub'
+ ),
+ $allowed
+ );
+ $invalid_response = wp_kses(
+ // translators: %s: Author URL
+ \__(
+ 'Your WebFinger endpoint %s
does not return valid JSON for application/jrd+json
.',
+ 'activitypub'
+ ),
+ $allowed
+ );
+
+ $health_messages = array(
+ 'webfinger_url_not_accessible' => \sprintf(
+ $not_accessible,
+ $url->get_error_data()
+ ),
+ 'webfinger_url_invalid_response' => \sprintf(
+ // translators: %s: Author URL
+ $invalid_response,
+ $url->get_error_data()
+ ),
+ );
+ $message = null;
+ if ( isset( $health_messages[ $url->get_error_code() ] ) ) {
+ $message = $health_messages[ $url->get_error_code() ];
+ }
+ return new WP_Error(
+ $url->get_error_code(),
+ $message,
+ $url->get_error_data()
+ );
+ }
+
+ return true;
+ }
+
+ /**
+ * Retrieve the URL to the author page for the user with the ID provided.
+ *
+ * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
+ *
+ * @param int $author_id Author ID.
+ * @param string $author_nicename Optional. The author's nicename (slug). Default empty.
+ *
+ * @return string The URL to the author's page.
+ */
+ public static function get_author_posts_url( $author_id, $author_nicename = '' ) {
+ global $wp_rewrite;
+ $auth_id = (int) $author_id;
+ $link = $wp_rewrite->get_author_permastruct();
+
+ if ( empty( $link ) ) {
+ $file = home_url( '/' );
+ $link = $file . '?author=' . $auth_id;
+ } else {
+ if ( '' === $author_nicename ) {
+ $user = get_userdata( $author_id );
+ if ( ! empty( $user->user_nicename ) ) {
+ $author_nicename = $user->user_nicename;
+ }
+ }
+ $link = str_replace( '%author%', $author_nicename, $link );
+ $link = home_url( user_trailingslashit( $link ) );
+ }
+
+ return $link;
+ }
+
+ /**
+ * Static function for generating site debug data when required.
+ *
+ * @param array $info The debug information to be added to the core information page.
+ * @return array The filtered information
+ */
+ public static function debug_information( $info ) {
+ $info['activitypub'] = array(
+ 'label' => __( 'ActivityPub', 'activitypub' ),
+ 'fields' => array(
+ 'webfinger' => array(
+ 'label' => __( 'WebFinger Resource', 'activitypub' ),
+ 'value' => Webfinger::get_user_resource( wp_get_current_user()->ID ),
+ 'private' => true,
+ ),
+ 'author_url' => array(
+ 'label' => __( 'Author URL', 'activitypub' ),
+ 'value' => get_author_posts_url( wp_get_current_user()->ID ),
+ 'private' => true,
+ ),
+ 'plugin_version' => array(
+ 'label' => __( 'Plugin Version', 'activitypub' ),
+ 'value' => get_plugin_version(),
+ 'private' => true,
+ ),
+ ),
+ );
+
+ return $info;
+ }
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-http.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-http.php
new file mode 100644
index 00000000..79519b3b
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-http.php
@@ -0,0 +1,131 @@
+ 100,
+ 'limit_response_size' => 1048576,
+ 'redirection' => 3,
+ 'user-agent' => "$user_agent; ActivityPub",
+ 'headers' => array(
+ 'Accept' => 'application/activity+json',
+ 'Content-Type' => 'application/activity+json',
+ 'Digest' => $digest,
+ 'Signature' => $signature,
+ 'Date' => $date,
+ ),
+ 'body' => $body,
+ );
+
+ $response = \wp_safe_remote_post( $url, $args );
+ $code = \wp_remote_retrieve_response_code( $response );
+
+ if ( $code >= 400 ) {
+ $response = new WP_Error( $code, __( 'Failed HTTP Request', 'activitypub' ), array( 'status' => $code ) );
+ }
+
+ \do_action( 'activitypub_safe_remote_post_response', $response, $url, $body, $user_id );
+
+ return $response;
+ }
+
+ /**
+ * Send a GET Request with the needed HTTP Headers
+ *
+ * @param string $url The URL endpoint
+ * @param int $user_id The WordPress User-ID
+ *
+ * @return array|WP_Error The GET Response or an WP_ERROR
+ */
+ public static function get( $url ) {
+ \do_action( 'activitypub_pre_http_get', $url );
+
+ $date = \gmdate( 'D, d M Y H:i:s T' );
+ $signature = Signature::generate_signature( Users::APPLICATION_USER_ID, 'get', $url, $date );
+
+ $wp_version = \get_bloginfo( 'version' );
+
+ /**
+ * Filter the HTTP headers user agent.
+ *
+ * @param string $user_agent The user agent string.
+ */
+ $user_agent = \apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version . '; ' . \get_bloginfo( 'url' ) );
+
+ $args = array(
+ 'timeout' => apply_filters( 'activitypub_remote_get_timeout', 100 ),
+ 'limit_response_size' => 1048576,
+ 'redirection' => 3,
+ 'user-agent' => "$user_agent; ActivityPub",
+ 'headers' => array(
+ 'Accept' => 'application/activity+json',
+ 'Content-Type' => 'application/activity+json',
+ 'Signature' => $signature,
+ 'Date' => $date,
+ ),
+ );
+
+ $response = \wp_safe_remote_get( $url, $args );
+ $code = \wp_remote_retrieve_response_code( $response );
+
+ if ( $code >= 400 ) {
+ $response = new WP_Error( $code, __( 'Failed HTTP Request', 'activitypub' ), array( 'status' => $code ) );
+ }
+
+ \do_action( 'activitypub_safe_remote_get_response', $response, $url );
+
+ return $response;
+ }
+
+ /**
+ * Check for URL for Tombstone.
+ *
+ * @param string $url The URL to check.
+ *
+ * @return bool True if the URL is a tombstone.
+ */
+ public static function is_tombstone( $url ) {
+ \do_action( 'activitypub_pre_http_is_tombstone', $url );
+
+ $response = \wp_safe_remote_get( $url );
+ $code = \wp_remote_retrieve_response_code( $response );
+
+ if ( in_array( (int) $code, array( 404, 410 ), true ) ) {
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-mention.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-mention.php
new file mode 100644
index 00000000..beb62468
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-mention.php
@@ -0,0 +1,173 @@
+ MB_IN_BYTES ) {
+ return $the_content;
+ }
+ $tag_stack = array();
+ $protected_tags = array(
+ 'pre',
+ 'code',
+ 'textarea',
+ 'style',
+ 'a',
+ );
+ $content_with_links = '';
+ $in_protected_tag = false;
+ foreach ( wp_html_split( $the_content ) as $chunk ) {
+ if ( preg_match( '#^$#i', $chunk, $m ) ) {
+ $content_with_links .= $chunk;
+ continue;
+ }
+
+ if ( preg_match( '#^<(/)?([a-z-]+)\b[^>]*>$#i', $chunk, $m ) ) {
+ $tag = strtolower( $m[2] );
+ if ( '/' === $m[1] ) {
+ // Closing tag.
+ $i = array_search( $tag, $tag_stack );
+ // We can only remove the tag from the stack if it is in the stack.
+ if ( false !== $i ) {
+ $tag_stack = array_slice( $tag_stack, 0, $i );
+ }
+ } else {
+ // Opening tag, add it to the stack.
+ $tag_stack[] = $tag;
+ }
+
+ // If we're in a protected tag, the tag_stack contains at least one protected tag string.
+ // The protected tag state can only change when we encounter a start or end tag.
+ $in_protected_tag = array_intersect( $tag_stack, $protected_tags );
+
+ // Never inspect tags.
+ $content_with_links .= $chunk;
+ continue;
+ }
+
+ if ( $in_protected_tag ) {
+ // Don't inspect a chunk inside an inspected tag.
+ $content_with_links .= $chunk;
+ continue;
+ }
+
+ // Only reachable when there is no protected tag in the stack.
+ $content_with_links .= \preg_replace_callback( '/@' . ACTIVITYPUB_USERNAME_REGEXP . '/', array( self::class, 'replace_with_links' ), $chunk );
+ }
+
+ return $content_with_links;
+ }
+
+ /**
+ * A callback for preg_replace to build the user links
+ *
+ * @param array $result the preg_match results
+ *
+ * @return string the final string
+ */
+ public static function replace_with_links( $result ) {
+ $metadata = get_remote_metadata_by_actor( $result[0] );
+
+ if ( ! empty( $metadata ) && ! is_wp_error( $metadata ) && ! empty( $metadata['url'] ) ) {
+ $username = ltrim( $result[0], '@' );
+ if ( ! empty( $metadata['name'] ) ) {
+ $username = $metadata['name'];
+ }
+ if ( ! empty( $metadata['preferredUsername'] ) ) {
+ $username = $metadata['preferredUsername'];
+ }
+ return \sprintf( '@%s', esc_url( $metadata['url'] ), esc_html( $username ) );
+ }
+
+ return $result[0];
+ }
+
+ /**
+ * Get the Inboxes for the mentioned Actors
+ *
+ * @param array $mentioned The list of Actors that were mentioned
+ *
+ * @return array The list of Inboxes
+ */
+ public static function get_inboxes( $mentioned ) {
+ $inboxes = array();
+
+ foreach ( $mentioned as $actor ) {
+ $inbox = self::get_inbox_by_mentioned_actor( $actor );
+
+ if ( ! is_wp_error( $inbox ) && $inbox ) {
+ $inboxes[] = $inbox;
+ }
+ }
+
+ return $inboxes;
+ }
+
+ /**
+ * Get the inbox from the Remote-Profile of a mentioned Actor
+ *
+ * @param string $actor The Actor-URL
+ *
+ * @return string The Inbox-URL
+ */
+ public static function get_inbox_by_mentioned_actor( $actor ) {
+ $metadata = get_remote_metadata_by_actor( $actor );
+
+ if ( \is_wp_error( $metadata ) ) {
+ return $metadata;
+ }
+
+ if ( isset( $metadata['endpoints'] ) && isset( $metadata['endpoints']['sharedInbox'] ) ) {
+ return $metadata['endpoints']['sharedInbox'];
+ }
+
+ if ( \array_key_exists( 'inbox', $metadata ) ) {
+ return $metadata['inbox'];
+ }
+
+ return new WP_Error( 'activitypub_no_inbox', \__( 'No "Inbox" found', 'activitypub' ), $metadata );
+ }
+
+ /**
+ * Extract the mentions from the post_content.
+ *
+ * @param array $mentions The already found mentions.
+ * @param string $post_content The post content.
+ *
+ * @return mixed The discovered mentions.
+ */
+ public static function extract_mentions( $mentions, $post_content ) {
+ \preg_match_all( '/@' . ACTIVITYPUB_USERNAME_REGEXP . '/i', $post_content, $matches );
+ foreach ( $matches[0] as $match ) {
+ $link = Webfinger::resolve( $match );
+ if ( ! is_wp_error( $link ) ) {
+ $mentions[ $match ] = $link;
+ }
+ }
+ return $mentions;
+ }
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-migration.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-migration.php
new file mode 100644
index 00000000..adebb7e9
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-migration.php
@@ -0,0 +1,200 @@
+ 'ID' ) ) as $user_id ) {
+ $followers = get_user_meta( $user_id, 'activitypub_followers', true );
+
+ if ( $followers ) {
+ foreach ( $followers as $actor ) {
+ Followers::add_follower( $user_id, $actor );
+ }
+ }
+ }
+
+ Activitypub::flush_rewrite_rules();
+ }
+
+ /**
+ * Updates the custom template to use shortcodes instead of the deprecated templates.
+ *
+ * @return void
+ */
+ private static function migrate_from_0_16() {
+ // Get the custom template.
+ $old_content = \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT );
+
+ // If the old content exists but is a blank string, we're going to need a flag to updated it even
+ // after setting it to the default contents.
+ $need_update = false;
+
+ // If the old contents is blank, use the defaults.
+ if ( '' === $old_content ) {
+ $old_content = ACTIVITYPUB_CUSTOM_POST_CONTENT;
+ $need_update = true;
+ }
+
+ // Set the new content to be the old content.
+ $content = $old_content;
+
+ // Convert old templates to shortcodes.
+ $content = \str_replace( '%title%', '[ap_title]', $content );
+ $content = \str_replace( '%excerpt%', '[ap_excerpt]', $content );
+ $content = \str_replace( '%content%', '[ap_content]', $content );
+ $content = \str_replace( '%permalink%', '[ap_permalink type="html"]', $content );
+ $content = \str_replace( '%shortlink%', '[ap_shortlink type="html"]', $content );
+ $content = \str_replace( '%hashtags%', '[ap_hashtags]', $content );
+ $content = \str_replace( '%tags%', '[ap_hashtags]', $content );
+
+ // Store the new template if required.
+ if ( $content !== $old_content || $need_update ) {
+ \update_option( 'activitypub_custom_post_content', $content );
+ }
+ }
+
+ /**
+ * Clear the cache after updating to 1.3.0
+ *
+ * @return void
+ */
+ private static function migrate_from_1_2_0() {
+ $user_ids = get_users(
+ array(
+ 'fields' => 'ID',
+ 'capability__in' => array( 'publish_posts' ),
+ )
+ );
+
+ foreach ( $user_ids as $user_id ) {
+ wp_cache_delete( sprintf( Followers::CACHE_KEY_INBOXES, $user_id ), 'activitypub' );
+ }
+ }
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-scheduler.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-scheduler.php
new file mode 100644
index 00000000..11f40daf
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-scheduler.php
@@ -0,0 +1,169 @@
+post_type, $post_types, true ) ) {
+ return;
+ }
+
+ $type = false;
+
+ if ( 'publish' === $new_status && 'publish' !== $old_status ) {
+ $type = 'Create';
+ } elseif ( 'publish' === $new_status ) {
+ $type = 'Update';
+ } elseif ( 'trash' === $new_status ) {
+ $type = 'Delete';
+ }
+
+ if ( ! $type ) {
+ return;
+ }
+
+ \wp_schedule_single_event(
+ \time(),
+ 'activitypub_send_activity',
+ array( $post, $type )
+ );
+
+ \wp_schedule_single_event(
+ \time(),
+ sprintf(
+ 'activitypub_send_%s_activity',
+ \strtolower( $type )
+ ),
+ array( $post )
+ );
+ }
+
+ /**
+ * Update followers
+ *
+ * @return void
+ */
+ public static function update_followers() {
+ $number = 5;
+
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
+ $number = 50;
+ }
+
+ $followers = Followers::get_outdated_followers( $number );
+
+ foreach ( $followers as $follower ) {
+ $meta = get_remote_metadata_by_actor( $follower->get_id(), false );
+
+ if ( empty( $meta ) || ! is_array( $meta ) || is_wp_error( $meta ) ) {
+ Followers::add_error( $follower->get__id(), $meta );
+ } else {
+ $follower->from_array( $meta );
+ $follower->update();
+ }
+ }
+ }
+
+ /**
+ * Cleanup followers
+ *
+ * @return void
+ */
+ public static function cleanup_followers() {
+ $number = 5;
+
+ if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
+ $number = 50;
+ }
+
+ $followers = Followers::get_faulty_followers( $number );
+
+ foreach ( $followers as $follower ) {
+ $meta = get_remote_metadata_by_actor( $follower->get_url(), false );
+
+ if ( is_tombstone( $meta ) ) {
+ $follower->delete();
+ } elseif ( empty( $meta ) || ! is_array( $meta ) || is_wp_error( $meta ) ) {
+ if ( $follower->count_errors() >= 5 ) {
+ $follower->delete();
+ } else {
+ Followers::add_error( $follower->get__id(), $meta );
+ }
+ } else {
+ $follower->reset_errors();
+ }
+ }
+ }
+
+ /**
+ * Schedule migration if DB-Version is not up to date.
+ *
+ * @return void
+ */
+ public static function schedule_migration() {
+ if ( ! \wp_next_scheduled( 'activitypub_schedule_migration' ) && ! Migration::is_latest_version() ) {
+ \wp_schedule_single_event( \time(), 'activitypub_schedule_migration' );
+ }
+ }
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-shortcodes.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-shortcodes.php
new file mode 100644
index 00000000..491a6add
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-shortcodes.php
@@ -0,0 +1,584 @@
+ID );
+
+ if ( ! $tags ) {
+ return '';
+ }
+
+ $hash_tags = array();
+
+ foreach ( $tags as $tag ) {
+ $hash_tags[] = \sprintf(
+ '%s',
+ \esc_url( \get_tag_link( $tag ) ),
+ esc_hashtag( $tag->name )
+ );
+ }
+
+ return \implode( ' ', $hash_tags );
+ }
+
+ /**
+ * Generates output for the 'ap_title' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The post title.
+ */
+ public static function title( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ return \wp_strip_all_tags( \get_the_title( $item->ID ), true );
+ }
+
+ /**
+ * Generates output for the 'ap_excerpt' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The post excerpt.
+ */
+ public static function excerpt( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ $atts = shortcode_atts(
+ array( 'length' => ACTIVITYPUB_EXCERPT_LENGTH ),
+ $atts,
+ $tag
+ );
+
+ $excerpt_length = intval( $atts['length'] );
+
+ if ( 0 === $excerpt_length ) {
+ $excerpt_length = ACTIVITYPUB_EXCERPT_LENGTH;
+ }
+
+ $excerpt = \get_post_field( 'post_excerpt', $item );
+
+ if ( '' === $excerpt ) {
+
+ $content = \get_post_field( 'post_content', $item );
+
+ // An empty string will make wp_trim_excerpt do stuff we do not want.
+ if ( '' !== $content ) {
+ $excerpt = \strip_shortcodes( $content );
+
+ /** This filter is documented in wp-includes/post-template.php */
+ $excerpt = \apply_filters( 'the_content', $excerpt );
+ $excerpt = \str_replace( ']]>', ']]>', $excerpt );
+ }
+ }
+
+ // Strip out any remaining tags.
+ $excerpt = \wp_strip_all_tags( $excerpt );
+
+ /** This filter is documented in wp-includes/formatting.php */
+ $excerpt_more = \apply_filters( 'excerpt_more', ' [...]' );
+ $excerpt_more_len = strlen( $excerpt_more );
+
+ // We now have a excerpt, but we need to check it's length, it may be longer than we want for two reasons:
+ //
+ // * The user has entered a manual excerpt which is longer that what we want.
+ // * No manual excerpt exists so we've used the content which might be longer than we want.
+ //
+ // Either way, let's trim it up if we need too. Also, don't forget to take into account the more indicator
+ // as part of the total length.
+ //
+
+ // Setup a variable to hold the current excerpts length.
+ $current_excerpt_length = strlen( $excerpt );
+
+ // Setup a variable to keep track of our target length.
+ $target_excerpt_length = $excerpt_length - $excerpt_more_len;
+
+ // Setup a variable to keep track of the current max length.
+ $current_excerpt_max = $target_excerpt_length;
+
+ // This is a loop since we can't calculate word break the string after 'the_excpert' filter has run (we would break
+ // all kinds of html tags), so we have to cut the excerpt down a bit at a time until we hit our target length.
+ while ( $current_excerpt_length > $target_excerpt_length && $current_excerpt_max > 0 ) {
+ // Trim the excerpt based on wordwrap() positioning.
+ // Note: we're using
as the linebreak just in case there are any newlines existing in the excerpt from the user.
+ // There won't be any
left after we've run wp_strip_all_tags() in the code above, so they're
+ // safe to use here. It won't be included in the final excerpt as the substr() will trim it off.
+ $excerpt = substr( $excerpt, 0, strpos( wordwrap( $excerpt, $current_excerpt_max, '
' ), '
' ) );
+
+ // If something went wrong, or we're in a language that wordwrap() doesn't understand,
+ // just chop it off and don't worry about breaking in the middle of a word.
+ if ( strlen( $excerpt ) > $excerpt_length - $excerpt_more_len ) {
+ $excerpt = substr( $excerpt, 0, $current_excerpt_max );
+ }
+
+ // Add in the more indicator.
+ $excerpt = $excerpt . $excerpt_more;
+
+ // Run it through the excerpt filter which will add some html tags back in.
+ $excerpt_filtered = apply_filters( 'the_excerpt', $excerpt );
+
+ // Now set the current excerpt length to this new filtered length.
+ $current_excerpt_length = strlen( $excerpt_filtered );
+
+ // Check to see if we're over the target length.
+ if ( $current_excerpt_length > $target_excerpt_length ) {
+ // If so, remove 20 characters from the current max and run the loop again.
+ $current_excerpt_max = $current_excerpt_max - 20;
+ }
+ }
+
+ return \apply_filters( 'the_excerpt', $excerpt );
+ }
+
+ /**
+ * Generates output for the 'ap_content' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The post content.
+ */
+ public static function content( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ // prevent inception
+ remove_shortcode( 'ap_content' );
+
+ $atts = shortcode_atts(
+ array( 'apply_filters' => 'yes' ),
+ $atts,
+ $tag
+ );
+
+ $content = \get_post_field( 'post_content', $item );
+
+ if ( 'yes' === $atts['apply_filters'] ) {
+ $content = \apply_filters( 'the_content', $content );
+ } else {
+ $content = do_blocks( $content );
+ $content = wptexturize( $content );
+ $content = wp_filter_content_tags( $content );
+ }
+
+ // replace script and style elements
+ $content = \preg_replace( '@<(script|style)[^>]*?>.*?\\1>@si', '', $content );
+ $content = strip_shortcodes( $content );
+ $content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) );
+
+ add_shortcode( 'ap_content', array( 'Activitypub\Shortcodes', 'content' ) );
+
+ return $content;
+ }
+
+ /**
+ * Generates output for the 'ap_permalink' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The post permalink.
+ */
+ public static function permalink( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ $atts = shortcode_atts(
+ array(
+ 'type' => 'url',
+ ),
+ $atts,
+ $tag
+ );
+
+ if ( 'url' === $atts['type'] ) {
+ return \esc_url( \get_permalink( $item->ID ) );
+ }
+
+ return \sprintf(
+ '%1$s',
+ \esc_url( \get_permalink( $item->ID ) )
+ );
+ }
+
+ /**
+ * Generates output for the 'ap_shortlink' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The post shortlink.
+ */
+ public static function shortlink( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ $atts = shortcode_atts(
+ array(
+ 'type' => 'url',
+ ),
+ $atts,
+ $tag
+ );
+
+ if ( 'url' === $atts['type'] ) {
+ return \esc_url( \wp_get_shortlink( $item->ID ) );
+ }
+
+ return \sprintf(
+ '%1$s',
+ \esc_url( \wp_get_shortlink( $item->ID ) )
+ );
+ }
+
+ /**
+ * Generates output for the 'ap_image' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string
+ */
+ public static function image( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ $atts = shortcode_atts(
+ array(
+ 'type' => 'full',
+ ),
+ $atts,
+ $tag
+ );
+
+ $size = 'full';
+
+ if ( in_array(
+ $atts['type'],
+ array( 'thumbnail', 'medium', 'large', 'full' ),
+ true
+ ) ) {
+ $size = $atts['type'];
+ }
+
+ $image = \get_the_post_thumbnail_url( $item->ID, $size );
+
+ if ( ! $image ) {
+ return '';
+ }
+
+ return \esc_url( $image );
+ }
+
+ /**
+ * Generates output for the 'ap_hashcats' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The post categories as hashtags.
+ */
+ public static function hashcats( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ $categories = \get_the_category( $item->ID );
+
+ if ( ! $categories ) {
+ return '';
+ }
+
+ $hash_tags = array();
+
+ foreach ( $categories as $category ) {
+ $hash_tags[] = \sprintf(
+ '%s',
+ \esc_url( \get_category_link( $category ) ),
+ esc_hashtag( $category->name )
+ );
+ }
+
+ return \implode( ' ', $hash_tags );
+ }
+
+ /**
+ * Generates output for the 'ap_author' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The author name.
+ */
+ public static function author( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ $author_id = \get_post_field( 'post_author', $item->ID );
+ $name = \get_the_author_meta( 'display_name', $author_id );
+
+ if ( ! $name ) {
+ return '';
+ }
+
+ return wp_strip_all_tags( $name );
+ }
+
+ /**
+ * Generates output for the 'ap_authorurl' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The author URL.
+ */
+ public static function authorurl( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ $author_id = \get_post_field( 'post_author', $item->ID );
+ $url = \get_the_author_meta( 'user_url', $author_id );
+
+ if ( ! $url ) {
+ return '';
+ }
+
+ return \esc_url( $url );
+ }
+
+ /**
+ * Generates output for the 'ap_blogurl' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The site URL.
+ */
+ public static function blogurl( $atts, $content, $tag ) {
+ return \esc_url( \get_bloginfo( 'url' ) );
+ }
+
+ /**
+ * Generates output for the 'ap_blogname' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string
+ */
+ public static function blogname( $atts, $content, $tag ) {
+ return \wp_strip_all_tags( \get_bloginfo( 'name' ) );
+ }
+
+ /**
+ * Generates output for the 'ap_blogdesc' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The site description.
+ */
+ public static function blogdesc( $atts, $content, $tag ) {
+ return \wp_strip_all_tags( \get_bloginfo( 'description' ) );
+ }
+
+ /**
+ * Generates output for the 'ap_date' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The post date.
+ */
+ public static function date( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ $datetime = \get_post_datetime( $item );
+ $dateformat = \get_option( 'date_format' );
+ $timeformat = \get_option( 'time_format' );
+
+ $date = $datetime->format( $dateformat );
+
+ if ( ! $date ) {
+ return '';
+ }
+
+ return $date;
+ }
+
+ /**
+ * Generates output for the 'ap_time' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The post time.
+ */
+ public static function time( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ $datetime = \get_post_datetime( $item );
+ $dateformat = \get_option( 'date_format' );
+ $timeformat = \get_option( 'time_format' );
+
+ $date = $datetime->format( $timeformat );
+
+ if ( ! $date ) {
+ return '';
+ }
+
+ return $date;
+ }
+
+ /**
+ * Generates output for the 'ap_datetime' Shortcode
+ *
+ * @param array $atts The Shortcode attributes.
+ * @param string $content The ActivityPub post-content.
+ * @param string $tag The tag/name of the Shortcode.
+ *
+ * @return string The post date/time.
+ */
+ public static function datetime( $atts, $content, $tag ) {
+ $item = self::get_item();
+
+ if ( ! $item ) {
+ return '';
+ }
+
+ $datetime = \get_post_datetime( $item );
+ $dateformat = \get_option( 'date_format' );
+ $timeformat = \get_option( 'time_format' );
+
+ $date = $datetime->format( $dateformat . ' @ ' . $timeformat );
+
+ if ( ! $date ) {
+ return '';
+ }
+
+ return $date;
+ }
+
+ /**
+ * Get a WordPress item to federate.
+ *
+ * Checks if item (WP_Post) is "public", a supported post type
+ * and not password protected.
+ *
+ * @return null|WP_Post The WordPress item.
+ */
+ protected static function get_item() {
+ $post = \get_post();
+
+ if ( ! $post ) {
+ return null;
+ }
+
+ if ( 'publish' !== \get_post_status( $post ) ) {
+ return null;
+ }
+
+ if ( \post_password_required( $post ) ) {
+ return null;
+ }
+
+ if ( ! \in_array( \get_post_type( $post ), \get_post_types_by_support( 'activitypub' ), true ) ) {
+ return null;
+ }
+
+ return $post;
+ }
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-signature.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-signature.php
new file mode 100644
index 00000000..d021cf0e
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-signature.php
@@ -0,0 +1,499 @@
+ 'sha512',
+ 'private_key_bits' => 2048,
+ 'private_key_type' => \OPENSSL_KEYTYPE_RSA,
+ );
+
+ $key = \openssl_pkey_new( $config );
+ $priv_key = null;
+
+ \openssl_pkey_export( $key, $priv_key );
+
+ $detail = \openssl_pkey_get_details( $key );
+
+ // check if keys are valid
+ if (
+ empty( $priv_key ) || ! is_string( $priv_key ) ||
+ ! isset( $detail['key'] ) || ! is_string( $detail['key'] )
+ ) {
+ return array(
+ 'private_key' => null,
+ 'public_key' => null,
+ );
+ }
+
+ $key_pair = array(
+ 'private_key' => $priv_key,
+ 'public_key' => $detail['key'],
+ );
+
+ // persist keys
+ \add_option( $option_key, $key_pair );
+
+ return $key_pair;
+ }
+
+ /**
+ * Return the option key for a given user.
+ *
+ * @param int $user_id The WordPress User ID.
+ *
+ * @return string The option key.
+ */
+ protected static function get_signature_options_key_for( $user_id ) {
+ $id = $user_id;
+
+ if ( $user_id > 0 ) {
+ $user = \get_userdata( $user_id );
+ // sanatize username because it could include spaces and special chars
+ $id = sanitize_title( $user->user_login );
+ }
+
+ return 'activitypub_keypair_for_' . $id;
+ }
+
+ /**
+ * Check if there is a legacy key pair
+ *
+ * @param int $user_id The WordPress User ID.
+ *
+ * @return array|bool The key pair or false.
+ */
+ protected static function check_legacy_key_pair_for( $user_id ) {
+ switch ( $user_id ) {
+ case 0:
+ $public_key = \get_option( 'activitypub_blog_user_public_key' );
+ $private_key = \get_option( 'activitypub_blog_user_private_key' );
+ break;
+ case -1:
+ $public_key = \get_option( 'activitypub_application_user_public_key' );
+ $private_key = \get_option( 'activitypub_application_user_private_key' );
+ break;
+ default:
+ $public_key = \get_user_meta( $user_id, 'magic_sig_public_key', true );
+ $private_key = \get_user_meta( $user_id, 'magic_sig_private_key', true );
+ break;
+ }
+
+ if ( ! empty( $public_key ) && is_string( $public_key ) && ! empty( $private_key ) && is_string( $private_key ) ) {
+ return array(
+ 'private_key' => $private_key,
+ 'public_key' => $public_key,
+ );
+ }
+
+ return false;
+ }
+
+ /**
+ * Generates the Signature for a HTTP Request
+ *
+ * @param int $user_id The WordPress User ID.
+ * @param string $http_method The HTTP method.
+ * @param string $url The URL to send the request to.
+ * @param string $date The date the request is sent.
+ * @param string $digest The digest of the request body.
+ *
+ * @return string The signature.
+ */
+ public static function generate_signature( $user_id, $http_method, $url, $date, $digest = null ) {
+ $user = Users::get_by_id( $user_id );
+ $key = self::get_private_key_for( $user->get__id() );
+
+ $url_parts = \wp_parse_url( $url );
+
+ $host = $url_parts['host'];
+ $path = '/';
+
+ // add path
+ if ( ! empty( $url_parts['path'] ) ) {
+ $path = $url_parts['path'];
+ }
+
+ // add query
+ if ( ! empty( $url_parts['query'] ) ) {
+ $path .= '?' . $url_parts['query'];
+ }
+
+ $http_method = \strtolower( $http_method );
+
+ if ( ! empty( $digest ) ) {
+ $signed_string = "(request-target): $http_method $path\nhost: $host\ndate: $date\ndigest: $digest";
+ } else {
+ $signed_string = "(request-target): $http_method $path\nhost: $host\ndate: $date";
+ }
+
+ $signature = null;
+ \openssl_sign( $signed_string, $signature, $key, \OPENSSL_ALGO_SHA256 );
+ $signature = \base64_encode( $signature ); // phpcs:ignore
+
+ $key_id = $user->get_url() . '#main-key';
+
+ if ( ! empty( $digest ) ) {
+ return \sprintf( 'keyId="%s",algorithm="rsa-sha256",headers="(request-target) host date digest",signature="%s"', $key_id, $signature );
+ } else {
+ return \sprintf( 'keyId="%s",algorithm="rsa-sha256",headers="(request-target) host date",signature="%s"', $key_id, $signature );
+ }
+ }
+
+ /**
+ * Verifies the http signatures
+ *
+ * @param WP_REST_Request|array $request The request object or $_SERVER array.
+ *
+ * @return mixed A boolean or WP_Error.
+ */
+ public static function verify_http_signature( $request ) {
+ if ( is_object( $request ) ) { // REST Request object
+ // check if route starts with "index.php"
+ if ( str_starts_with( $request->get_route(), '/index.php' ) || ! rest_get_url_prefix() ) {
+ $route = $request->get_route();
+ } else {
+ $route = '/' . rest_get_url_prefix() . '/' . ltrim( $request->get_route(), '/' );
+ }
+
+ // fix route for subdirectory installs
+ $path = \wp_parse_url( \get_home_url(), PHP_URL_PATH );
+
+ if ( \is_string( $path ) ) {
+ $path = trim( $path, '/' );
+ }
+
+ if ( $path ) {
+ $route = '/' . $path . $route;
+ }
+
+ $headers = $request->get_headers();
+ $headers['(request-target)'][0] = strtolower( $request->get_method() ) . ' ' . $route;
+ } else {
+ $request = self::format_server_request( $request );
+ $headers = $request['headers']; // $_SERVER array
+ $headers['(request-target)'][0] = strtolower( $headers['request_method'][0] ) . ' ' . $headers['request_uri'][0];
+ }
+
+ if ( ! isset( $headers['signature'] ) ) {
+ return new WP_Error( 'activitypub_signature', __( 'Request not signed', 'activitypub' ), array( 'status' => 401 ) );
+ }
+
+ if ( array_key_exists( 'signature', $headers ) ) {
+ $signature_block = self::parse_signature_header( $headers['signature'][0] );
+ } elseif ( array_key_exists( 'authorization', $headers ) ) {
+ $signature_block = self::parse_signature_header( $headers['authorization'][0] );
+ }
+
+ if ( ! isset( $signature_block ) || ! $signature_block ) {
+ return new WP_Error( 'activitypub_signature', __( 'Incompatible request signature. keyId and signature are required', 'activitypub' ), array( 'status' => 401 ) );
+ }
+
+ $signed_headers = $signature_block['headers'];
+ if ( ! $signed_headers ) {
+ $signed_headers = array( 'date' );
+ }
+
+ $signed_data = self::get_signed_data( $signed_headers, $signature_block, $headers );
+ if ( ! $signed_data ) {
+ return new WP_Error( 'activitypub_signature', __( 'Signed request date outside acceptable time window', 'activitypub' ), array( 'status' => 401 ) );
+ }
+
+ $algorithm = self::get_signature_algorithm( $signature_block );
+ if ( ! $algorithm ) {
+ return new WP_Error( 'activitypub_signature', __( 'Unsupported signature algorithm (only rsa-sha256 and hs2019 are supported)', 'activitypub' ), array( 'status' => 401 ) );
+ }
+
+ if ( \in_array( 'digest', $signed_headers, true ) && isset( $body ) ) {
+ if ( is_array( $headers['digest'] ) ) {
+ $headers['digest'] = $headers['digest'][0];
+ }
+ $digest = explode( '=', $headers['digest'], 2 );
+ if ( 'SHA-256' === $digest[0] ) {
+ $hashalg = 'sha256';
+ }
+ if ( 'SHA-512' === $digest[0] ) {
+ $hashalg = 'sha512';
+ }
+
+ if ( \base64_encode( \hash( $hashalg, $body, true ) ) !== $digest[1] ) { // phpcs:ignore
+ return new WP_Error( 'activitypub_signature', __( 'Invalid Digest header', 'activitypub' ), array( 'status' => 401 ) );
+ }
+ }
+
+ $public_key = self::get_remote_key( $signature_block['keyId'] );
+
+ if ( \is_wp_error( $public_key ) ) {
+ return $public_key;
+ }
+
+ $verified = \openssl_verify( $signed_data, $signature_block['signature'], $public_key, $algorithm ) > 0;
+
+ if ( ! $verified ) {
+ return new WP_Error( 'activitypub_signature', __( 'Invalid signature', 'activitypub' ), array( 'status' => 401 ) );
+ }
+ return $verified;
+ }
+
+ /**
+ * Get public key from key_id
+ *
+ * @param string $key_id The URL to the public key.
+ *
+ * @return WP_Error|string The public key or WP_Error.
+ */
+ public static function get_remote_key( $key_id ) { // phpcs:ignore
+ $actor = get_remote_metadata_by_actor( strip_fragment_from_url( $key_id ) ); // phpcs:ignore
+ if ( \is_wp_error( $actor ) ) {
+ return new WP_Error(
+ 'activitypub_no_remote_profile_found',
+ __( 'No Profile found or Profile not accessible', 'activitypub' ),
+ array( 'status' => 401 )
+ );
+ }
+ if ( isset( $actor['publicKey']['publicKeyPem'] ) ) {
+ return \rtrim( $actor['publicKey']['publicKeyPem'] ); // phpcs:ignore
+ }
+ return new WP_Error(
+ 'activitypub_no_remote_key_found',
+ __( 'No Public-Key found', 'activitypub' ),
+ array( 'status' => 401 )
+ );
+ }
+
+ /**
+ * Gets the signature algorithm from the signature header
+ *
+ * @param array $signature_block
+ *
+ * @return string The signature algorithm.
+ */
+ public static function get_signature_algorithm( $signature_block ) {
+ if ( $signature_block['algorithm'] ) {
+ switch ( $signature_block['algorithm'] ) {
+ case 'rsa-sha-512':
+ return 'sha512'; //hs2019 https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures-12
+ default:
+ return 'sha256';
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Parses the Signature header
+ *
+ * @param string $signature The signature header.
+ *
+ * @return array signature parts
+ */
+ public static function parse_signature_header( $signature ) {
+ $parsed_header = array();
+ $matches = array();
+
+ if ( \preg_match( '/keyId="(.*?)"/ism', $signature, $matches ) ) {
+ $parsed_header['keyId'] = trim( $matches[1] );
+ }
+ if ( \preg_match( '/created=([0-9]*)/ism', $signature, $matches ) ) {
+ $parsed_header['(created)'] = trim( $matches[1] );
+ }
+ if ( \preg_match( '/expires=([0-9]*)/ism', $signature, $matches ) ) {
+ $parsed_header['(expires)'] = trim( $matches[1] );
+ }
+ if ( \preg_match( '/algorithm="(.*?)"/ism', $signature, $matches ) ) {
+ $parsed_header['algorithm'] = trim( $matches[1] );
+ }
+ if ( \preg_match( '/headers="(.*?)"/ism', $signature, $matches ) ) {
+ $parsed_header['headers'] = \explode( ' ', trim( $matches[1] ) );
+ }
+ if ( \preg_match( '/signature="(.*?)"/ism', $signature, $matches ) ) {
+ $parsed_header['signature'] = \base64_decode( preg_replace( '/\s+/', '', trim( $matches[1] ) ) ); // phpcs:ignore
+ }
+
+ if ( ( $parsed_header['signature'] ) && ( $parsed_header['algorithm'] ) && ( ! $parsed_header['headers'] ) ) {
+ $parsed_header['headers'] = array( 'date' );
+ }
+
+ return $parsed_header;
+ }
+
+ /**
+ * Gets the header data from the included pseudo headers
+ *
+ * @param array $signed_headers The signed headers.
+ * @param array $signature_block (pseudo-headers)
+ * @param array $headers (http headers)
+ *
+ * @return string signed headers for comparison
+ */
+ public static function get_signed_data( $signed_headers, $signature_block, $headers ) {
+ $signed_data = '';
+ // This also verifies time-based values by returning false if any of these are out of range.
+ foreach ( $signed_headers as $header ) {
+ if ( 'host' === $header ) {
+ if ( isset( $headers['x_original_host'] ) ) {
+ $signed_data .= $header . ': ' . $headers['x_original_host'][0] . "\n";
+ continue;
+ }
+ }
+ if ( '(request-target)' === $header ) {
+ $signed_data .= $header . ': ' . $headers[ $header ][0] . "\n";
+ continue;
+ }
+ if ( str_contains( $header, '-' ) ) {
+ $signed_data .= $header . ': ' . $headers[ str_replace( '-', '_', $header ) ][0] . "\n";
+ continue;
+ }
+ if ( '(created)' === $header ) {
+ if ( ! empty( $signature_block['(created)'] ) && \intval( $signature_block['(created)'] ) > \time() ) {
+ // created in future
+ return false;
+ }
+ }
+ if ( '(expires)' === $header ) {
+ if ( ! empty( $signature_block['(expires)'] ) && \intval( $signature_block['(expires)'] ) < \time() ) {
+ // expired in past
+ return false;
+ }
+ }
+ if ( 'date' === $header ) {
+ // allow a bit of leeway for misconfigured clocks.
+ $d = new DateTime( $headers[ $header ][0] );
+ $d->setTimeZone( new DateTimeZone( 'UTC' ) );
+ $c = $d->format( 'U' );
+
+ $dplus = time() + ( 3 * HOUR_IN_SECONDS );
+ $dminus = time() - ( 3 * HOUR_IN_SECONDS );
+
+ if ( $c > $dplus || $c < $dminus ) {
+ // time out of range
+ return false;
+ }
+ }
+ $signed_data .= $header . ': ' . $headers[ $header ][0] . "\n";
+ }
+ return \rtrim( $signed_data, "\n" );
+ }
+
+ /**
+ * Generates the digest for a HTTP Request
+ *
+ * @param string $body The body of the request.
+ *
+ * @return string The digest.
+ */
+ public static function generate_digest( $body ) {
+ $digest = \base64_encode( \hash( 'sha256', $body, true ) ); // phpcs:ignore
+ return "SHA-256=$digest";
+ }
+
+ /**
+ * Formats the $_SERVER to resemble the WP_REST_REQUEST array,
+ * for use with verify_http_signature()
+ *
+ * @param array $_SERVER The $_SERVER array.
+ *
+ * @return array $request The formatted request array.
+ */
+ public static function format_server_request( $server ) {
+ $request = array();
+ foreach ( $server as $param_key => $param_val ) {
+ $req_param = strtolower( $param_key );
+ if ( 'REQUEST_URI' === $req_param ) {
+ $request['headers']['route'][] = $param_val;
+ } else {
+ $header_key = str_replace(
+ 'http_',
+ '',
+ $req_param
+ );
+ $request['headers'][ $header_key ][] = \wp_unslash( $param_val );
+ }
+ }
+ return $request;
+ }
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-webfinger.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-webfinger.php
new file mode 100644
index 00000000..75f7ff69
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/class-webfinger.php
@@ -0,0 +1,208 @@
+get_resource();
+ }
+
+ /**
+ * Resolve a WebFinger resource
+ *
+ * @param string $resource The WebFinger resource
+ *
+ * @return string|WP_Error The URL or WP_Error
+ */
+ public static function resolve( $resource ) {
+ if ( ! $resource ) {
+ return null;
+ }
+
+ if ( ! preg_match( '/^@?' . ACTIVITYPUB_USERNAME_REGEXP . '$/i', $resource, $m ) ) {
+ return null;
+ }
+
+ $transient_key = 'activitypub_resolve_' . ltrim( $resource, '@' );
+
+ $link = \get_transient( $transient_key );
+ if ( $link ) {
+ return $link;
+ }
+
+ $url = \add_query_arg( 'resource', 'acct:' . ltrim( $resource, '@' ), 'https://' . $m[2] . '/.well-known/webfinger' );
+ if ( ! \wp_http_validate_url( $url ) ) {
+ $response = new WP_Error( 'invalid_webfinger_url', null, $url );
+ \set_transient( $transient_key, $response, HOUR_IN_SECONDS ); // Cache the error for a shorter period.
+ return $response;
+ }
+
+ // try to access author URL
+ $response = \wp_remote_get(
+ $url,
+ array(
+ 'headers' => array( 'Accept' => 'application/jrd+json' ),
+ 'redirection' => 2,
+ 'timeout' => 2,
+ )
+ );
+
+ if ( \is_wp_error( $response ) ) {
+ $link = new WP_Error( 'webfinger_url_not_accessible', null, $url );
+ \set_transient( $transient_key, $link, HOUR_IN_SECONDS ); // Cache the error for a shorter period.
+ return $link;
+ }
+
+ $body = \wp_remote_retrieve_body( $response );
+ $body = \json_decode( $body, true );
+
+ if ( empty( $body['links'] ) ) {
+ $link = new WP_Error( 'webfinger_url_invalid_response', null, $url );
+ \set_transient( $transient_key, $link, HOUR_IN_SECONDS ); // Cache the error for a shorter period.
+ return $link;
+ }
+
+ foreach ( $body['links'] as $link ) {
+ if ( 'self' === $link['rel'] && 'application/activity+json' === $link['type'] ) {
+ \set_transient( $transient_key, $link['href'], WEEK_IN_SECONDS );
+ return $link['href'];
+ }
+ }
+
+ $link = new WP_Error( 'webfinger_url_no_activitypub', null, $body );
+ \set_transient( $transient_key, $link, HOUR_IN_SECONDS ); // Cache the error for a shorter period.
+ return $link;
+ }
+
+ /**
+ * Convert a URI string to an identifier and its host.
+ * Automatically adds acct: if it's missing.
+ *
+ * @param string $url The URI (acct:, mailto:, http:, https:)
+ *
+ * @return WP_Error|array Error reaction or array with
+ * identifier and host as values
+ */
+ public static function get_identifier_and_host( $url ) {
+ // remove leading @
+ $url = ltrim( $url, '@' );
+
+ if ( ! preg_match( '/^([a-zA-Z+]+):/', $url, $match ) ) {
+ $identifier = 'acct:' . $url;
+ $scheme = 'acct';
+ } else {
+ $identifier = $url;
+ $scheme = $match[1];
+ }
+
+ $host = null;
+
+ switch ( $scheme ) {
+ case 'acct':
+ case 'mailto':
+ case 'xmpp':
+ if ( strpos( $identifier, '@' ) !== false ) {
+ $host = substr( $identifier, strpos( $identifier, '@' ) + 1 );
+ }
+ break;
+ default:
+ $host = wp_parse_url( $identifier, PHP_URL_HOST );
+ break;
+ }
+
+ if ( empty( $host ) ) {
+ return new WP_Error( 'invalid_identifier', __( 'Invalid Identifier', 'activitypub' ) );
+ }
+
+ return array( $identifier, $host );
+ }
+
+ /**
+ * Get the WebFinger data for a given URI
+ *
+ * @param string $identifier The Identifier: ' .
+ '
' .
+ '[ap_title]
[ap_content apply_filters="yes"]
apply_filters
you can decide if filters (apply_filters( \'the_content\', $content )
) should be applied or not (default is yes
). The values can be yes
or no
. apply_filters
attribute is optional.', 'activitypub' ), array( 'code' => array() ) ) . '[ap_excerpt length="400"]
the_excerpt
if that is set). If no excerpt is provided, will truncate at length
(optional, default = 400).', 'activitypub' ), array( 'code' => array() ) ) . '[ap_permalink type="url"]
type
can be either: url
or html
(an <a /> tag). type
attribute is optional.', 'activitypub' ), array( 'code' => array() ) ) . '[ap_shortlink type="url"]
type
can be either url
or html
(an <a /> tag). I can recommend Hum, to prettify the Shortlinks. type
attribute is optional.', 'activitypub' ), array( 'code' => array() ) ) . '[ap_hashtags]
[ap_hashcats]
[ap_image type=full]
thumbnail
, medium
, large
, full
. type
attribute is optional.', 'activitypub' ), array( 'code' => array() ) ) . '[ap_author]
[ap_authorurl]
[ap_date]
[ap_time]
[ap_datetime]
[ap_blogurl]
[ap_blogname]
[ap_blogdesc]
' . \__( 'Fediverse', 'activitypub' ) . '
' . \__( 'The Fediverse is a new word made of two words: "federation" + "universe"', 'activitypub' ) . '
' . + '' . \__( 'It is a federated social network running on free open software on a myriad of computers across the globe. Many independent servers are interconnected and allow people to interact with one another. There\'s no one central site: you choose a server to register. This ensures some decentralization and sovereignty of data. Fediverse (also called Fedi) has no built-in advertisements, no tricky algorithms, no one big corporation dictating the rules. Instead we have small cozy communities of like-minded people. Welcome!', 'activitypub' ) . '
' . + '' . \__( 'For more informations please visit fediverse.party', 'activitypub' ) . '
' . + '' . \__( 'ActivityPub is a decentralized social networking protocol based on the ActivityStreams 2.0 data format. ActivityPub is an official W3C recommended standard published by the W3C Social Web Working Group. It provides a client to server API for creating, updating and deleting content, as well as a federated server to server API for delivering notifications and subscribing to content.', 'activitypub' ) . '
' . + '' . \__( 'WebFinger is used to discover information about people or other entities on the Internet that are identified by a URI using standard Hypertext Transfer Protocol (HTTP) methods over a secure transport. A WebFinger resource returns a JavaScript Object Notation (JSON) object describing the entity that is queried. The JSON object is referred to as the JSON Resource Descriptor (JRD).', 'activitypub' ) . '
' . + '' . \__( 'For a person, the type of information that might be discoverable via WebFinger includes a personal profile address, identity service, telephone number, or preferred avatar. For other entities on the Internet, a WebFinger resource might return JRDs containing link relations that enable a client to discover, for example, that a printer can print in color on A4 paper, the physical location of a server, or other static information.', 'activitypub' ) . '
' . + '' . \__( 'On Mastodon [and other Plattforms], user profiles can be hosted either locally on the same website as yours, or remotely on a completely different website. The same username may be used on a different domain. Therefore, a Mastodon user\'s full mention consists of both the username and the domain, in the form @username@domain
. In practical terms, @user@example.com
is not the same as @user@example.org
. If the domain is not included, Mastodon will try to find a local user named @username
. However, in order to deliver to someone over ActivityPub, the @username@domain
mention is not enough – mentions must be translated to an HTTPS URI first, so that the remote actor\'s inbox and outbox can be found. (This paragraph is copied from the Mastodon Documentation)', 'activitypub' ) . '
' . \__( 'For more informations please visit webfinger.net', 'activitypub' ) . '
' . + '' . \__( 'NodeInfo is an effort to create a standardized way of exposing metadata about a server running one of the distributed social networks. The two key goals are being able to get better insights into the user base of distributed social networking and the ability to build tools that allow users to choose the best fitting software and server for their needs.', 'activitypub' ) . '
' . + '' . \__( 'For more informations please visit nodeinfo.diaspora.software', 'activitypub' ) . '
', + ) +); + +\get_current_screen()->set_help_sidebar( + '' . \__( 'For more information:', 'activitypub' ) . '
' . + '' . \__( 'Get support', 'activitypub' ) . '
' . + '' . \__( 'Report an issue', 'activitypub' ) . '
' +); diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-application-user.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-application-user.php new file mode 100644 index 00000000..cf4d9cc4 --- /dev/null +++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-application-user.php @@ -0,0 +1,72 @@ + 404 ) + ); + } + + $object = new static(); + $object->_id = $user_id; + + return $object; + } + + /** + * Get the type of the object. + * + * If the Blog is in "single user" mode, return "Person" insted of "Group". + * + * @return string The type of the object. + */ + public function get_type() { + if ( is_single_user() ) { + return 'Person'; + } else { + return 'Group'; + } + } + + /** + * Get the User-Name. + * + * @return string The User-Name. + */ + public function get_name() { + return \wp_strip_all_tags( + \html_entity_decode( + \get_bloginfo( 'name' ), + \ENT_QUOTES, + 'UTF-8' + ) + ); + } + + /** + * Get the User-Description. + * + * @return string The User-Description. + */ + public function get_summary() { + return \wpautop( + \wp_kses( + \get_bloginfo( 'description' ), + 'default' + ) + ); + } + + /** + * Get the User-Url. + * + * @return string The User-Url. + */ + public function get_url() { + return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_preferred_username() ); + } + + /** + * Returns the User-URL with @-Prefix for the username. + * + * @return string The User-URL with @-Prefix for the username. + */ + public function get_at_url() { + return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_preferred_username() ); + } + + /** + * Generate a default Username. + * + * @return string The auto-generated Username. + */ + public static function get_default_username() { + // check if domain host has a subdomain + $host = \wp_parse_url( \get_home_url(), \PHP_URL_HOST ); + $host = \preg_replace( '/^www\./i', '', $host ); + + /** + * Filter the default blog username. + * + * @param string $host The default username. + */ + return apply_filters( 'activitypub_default_blog_username', $host ); + } + + /** + * Get the preferred User-Name. + * + * @return string The User-Name. + */ + public function get_preferred_username() { + $username = \get_option( 'activitypub_blog_user_identifier' ); + + if ( $username ) { + return $username; + } + + return self::get_default_username(); + } + + /** + * Get the User-Icon. + * + * @return array The User-Icon. + */ + public function get_icon() { + // try site icon first + $icon_id = get_option( 'site_icon' ); + + // try custom logo second + if ( ! $icon_id ) { + $icon_id = get_theme_mod( 'custom_logo' ); + } + + $icon_url = false; + + if ( $icon_id ) { + $icon = wp_get_attachment_image_src( $icon_id, 'full' ); + if ( $icon ) { + $icon_url = $icon[0]; + } + } + + if ( ! $icon_url ) { + // fallback to default icon + $icon_url = plugins_url( '/assets/img/wp-logo.png', ACTIVITYPUB_PLUGIN_FILE ); + } + + return array( + 'type' => 'Image', + 'url' => esc_url( $icon_url ), + ); + } + + /** + * Get the User-Header-Image. + * + * @return array|null The User-Header-Image. + */ + public function get_header_image() { + if ( \has_header_image() ) { + return array( + 'type' => 'Image', + 'url' => esc_url( \get_header_image() ), + ); + } + + return null; + } + + public function get_published() { + $first_post = new WP_Query( + array( + 'orderby' => 'date', + 'order' => 'ASC', + 'number' => 1, + ) + ); + + if ( ! empty( $first_post->posts[0] ) ) { + $time = \strtotime( $first_post->posts[0]->post_date_gmt ); + } else { + $time = \time(); + } + + return \gmdate( 'Y-m-d\TH:i:s\Z', $time ); + } + + public function get_attachment() { + return array(); + } + + public function get_canonical_url() { + return \home_url(); + } + + public function get_moderators() { + if ( is_single_user() || 'Group' !== $this->get_type() ) { + return null; + } + + return get_rest_url_by_path( 'collections/moderators' ); + } + + public function get_attributed_to() { + if ( is_single_user() || 'Group' !== $this->get_type() ) { + return null; + } + + return get_rest_url_by_path( 'collections/moderators' ); + } + + public function get_posting_restricted_to_mods() { + if ( 'Group' === $this->get_type() ) { + return true; + } + + return null; + } +} diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-follower.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-follower.php new file mode 100644 index 00000000..b2833e9c --- /dev/null +++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-follower.php @@ -0,0 +1,366 @@ +_id, 'activitypub_errors' ); + } + + /** + * Get the Summary. + * + * @return int The Summary. + */ + public function get_summary() { + if ( isset( $this->summary ) ) { + return $this->summary; + } + + return ''; + } + + /** + * Getter for URL attribute. + * + * Falls back to ID, if no URL is set. This is relevant for + * Plattforms like Lemmy, where the ID is the URL. + * + * @return string The URL. + */ + public function get_url() { + if ( $this->url ) { + return $this->url; + } + + return $this->id; + } + + /** + * Reset (delete) all errors. + * + * @return void + */ + public function reset_errors() { + delete_post_meta( $this->_id, 'activitypub_errors' ); + } + + /** + * Count the errors. + * + * @return int The number of errors. + */ + public function count_errors() { + $errors = $this->get_errors(); + + if ( is_array( $errors ) && ! empty( $errors ) ) { + return count( $errors ); + } + + return 0; + } + + /** + * Return the latest error message. + * + * @return string The error message. + */ + public function get_latest_error_message() { + $errors = $this->get_errors(); + + if ( is_array( $errors ) && ! empty( $errors ) ) { + return reset( $errors ); + } + + return ''; + } + + /** + * Update the current Follower-Object. + * + * @return void + */ + public function update() { + $this->save(); + } + + /** + * Validate the current Follower-Object. + * + * @return boolean True if the verification was successful. + */ + public function is_valid() { + // the minimum required attributes + $required_attributes = array( + 'id', + 'preferredUsername', + 'inbox', + 'publicKey', + 'publicKeyPem', + ); + + foreach ( $required_attributes as $attribute ) { + if ( ! $this->get( $attribute ) ) { + return false; + } + } + + return true; + } + + /** + * Save the current Follower-Object. + * + * @return int|WP_Error The Post-ID or an WP_Error. + */ + public function save() { + if ( ! $this->is_valid() ) { + return new WP_Error( 'activitypub_invalid_follower', __( 'Invalid Follower', 'activitypub' ), array( 'status' => 400 ) ); + } + + if ( ! $this->get__id() ) { + global $wpdb; + + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching + $post_id = $wpdb->get_var( + $wpdb->prepare( + "SELECT ID FROM $wpdb->posts WHERE guid=%s", + esc_sql( $this->get_id() ) + ) + ); + + if ( $post_id ) { + $post = get_post( $post_id ); + $this->set__id( $post->ID ); + } + } + + $args = array( + 'ID' => $this->get__id(), + 'guid' => esc_url_raw( $this->get_id() ), + 'post_title' => wp_strip_all_tags( sanitize_text_field( $this->get_name() ) ), + 'post_author' => 0, + 'post_type' => Followers::POST_TYPE, + 'post_name' => esc_url_raw( $this->get_id() ), + 'post_excerpt' => sanitize_text_field( wp_kses( $this->get_summary(), 'user_description' ) ), + 'post_status' => 'publish', + 'meta_input' => $this->get_post_meta_input(), + ); + + $post_id = wp_insert_post( $args ); + $this->_id = $post_id; + + return $post_id; + } + + /** + * Upsert the current Follower-Object. + * + * @return int|WP_Error The Post-ID or an WP_Error. + */ + public function upsert() { + return $this->save(); + } + + /** + * Delete the current Follower-Object. + * + * Beware that this os deleting a Follower for ALL users!!! + * + * To delete only the User connection (unfollow) + * @see \Activitypub\Rest\Followers::remove_follower() + * + * @return void + */ + public function delete() { + wp_delete_post( $this->_id ); + } + + /** + * Update the post meta. + * + * @return void + */ + protected function get_post_meta_input() { + $meta_input = array(); + $meta_input['activitypub_inbox'] = $this->get_shared_inbox(); + $meta_input['activitypub_actor_json'] = $this->to_json(); + + return $meta_input; + } + + /** + * Get the icon. + * + * Sets a fallback to better handle API and HTML outputs. + * + * @return array The icon. + */ + public function get_icon() { + if ( isset( $this->icon['url'] ) ) { + return $this->icon; + } + + return array( + 'type' => 'Image', + 'mediaType' => 'image/jpeg', + 'url' => ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg', + ); + } + + /** + * Get Name. + * + * Tries to extract a name from the URL or ID if not set. + * + * @return string The name. + */ + public function get_name() { + if ( $this->name ) { + return $this->name; + } elseif ( $this->preferred_username ) { + return $this->preferred_username; + } + + return $this->extract_name_from_uri(); + } + + /** + * The preferred Username. + * + * Tries to extract a name from the URL or ID if not set. + * + * @return string The preferred Username. + */ + public function get_preferred_username() { + if ( $this->preferred_username ) { + return $this->preferred_username; + } + + return $this->extract_name_from_uri(); + } + + /** + * Get the Icon URL (Avatar) + * + * @return string The URL to the Avatar. + */ + public function get_icon_url() { + $icon = $this->get_icon(); + + if ( ! $icon ) { + return ''; + } + + if ( is_array( $icon ) ) { + return $icon['url']; + } + + return $icon; + } + + /** + * Get the shared inbox, with a fallback to the inbox. + * + * @return string|null The URL to the shared inbox, the inbox or null. + */ + public function get_shared_inbox() { + if ( ! empty( $this->get_endpoints()['sharedInbox'] ) ) { + return $this->get_endpoints()['sharedInbox']; + } elseif ( ! empty( $this->get_inbox() ) ) { + return $this->get_inbox(); + } + + return null; + } + + /** + * Convert a Custom-Post-Type input to an Activitypub\Model\Follower. + * + * @return string The JSON string. + * + * @return array Activitypub\Model\Follower + */ + public static function init_from_cpt( $post ) { + $actor_json = get_post_meta( $post->ID, 'activitypub_actor_json', true ); + $object = self::init_from_json( $actor_json ); + $object->set__id( $post->ID ); + $object->set_id( $post->guid ); + $object->set_name( $post->post_title ); + $object->set_summary( $post->post_excerpt ); + $object->set_published( gmdate( 'Y-m-d H:i:s', strtotime( $post->post_date ) ) ); + $object->set_updated( gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) ) ); + + return $object; + } + + /** + * Infer a shortname from the Actor ID or URL. Used only for fallbacks, + * we will try to use what's supplied. + * + * @return string Hopefully the name of the Follower. + */ + protected function extract_name_from_uri() { + // prefer the URL, but fall back to the ID. + if ( $this->url ) { + $name = $this->url; + } else { + $name = $this->id; + } + + if ( \filter_var( $name, FILTER_VALIDATE_URL ) ) { + $name = \rtrim( $name, '/' ); + $path = \wp_parse_url( $name, PHP_URL_PATH ); + + if ( $path ) { + if ( \strpos( $name, '@' ) !== false ) { + // expected: https://example.com/@user (default URL pattern) + $name = \preg_replace( '|^/@?|', '', $path ); + } else { + // expected: https://example.com/users/user (default ID pattern) + $parts = \explode( '/', $path ); + $name = \array_pop( $parts ); + } + } + } elseif ( + \is_email( $name ) || + \strpos( $name, 'acct' ) === 0 || + \strpos( $name, '@' ) === 0 + ) { + // expected: user@example.com or acct:user@example (WebFinger) + $name = \ltrim( $name, '@' ); + $name = \ltrim( $name, 'acct:' ); + $parts = \explode( '@', $name ); + $name = $parts[0]; + } + + return $name; + } +} diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-post.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-post.php new file mode 100644 index 00000000..d967ad9a --- /dev/null +++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-post.php @@ -0,0 +1,131 @@ +post = $post; + $this->object = Post_Transformer::transform( $post )->to_object(); + } + + /** + * Returns the User ID. + * + * @return int the User ID. + */ + public function get_user_id() { + return apply_filters( 'activitypub_post_user_id', $this->post->post_author, $this->post ); + } + + /** + * Converts this Object into an Array. + * + * @return array the array representation of a Post. + */ + public function to_array() { + return \apply_filters( 'activitypub_post', $this->object->to_array(), $this->post ); + } + + /** + * Returns the Actor of this Object. + * + * @return string The URL of the Actor. + */ + public function get_actor() { + $user = User_Factory::get_by_id( $this->get_user_id() ); + + return $user->get_url(); + } + + /** + * Converts this Object into a JSON String + * + * @return string + */ + public function to_json() { + return \wp_json_encode( $this->to_array(), \JSON_HEX_TAG | \JSON_HEX_AMP | \JSON_HEX_QUOT ); + } + + /** + * Returns the URL of an Activity Object + * + * @return string + */ + public function get_url() { + return $this->object->get_url(); + } + + /** + * Returns the ID of an Activity Object + * + * @return string + */ + public function get_id() { + return $this->object->get_id(); + } + + /** + * Returns a list of Image Attachments + * + * @return array + */ + public function get_attachments() { + return $this->object->get_attachment(); + } + + /** + * Returns a list of Tags, used in the Post + * + * @return array + */ + public function get_tags() { + return $this->object->get_tag(); + } + + /** + * Returns the as2 object-type for a given post + * + * @return string the object-type + */ + public function get_object_type() { + return $this->object->get_type(); + } + + /** + * Returns the content for the ActivityPub Item. + * + * @return string the content + */ + public function get_content() { + return $this->object->get_content(); + } +} diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-user.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-user.php new file mode 100644 index 00000000..95c83d73 --- /dev/null +++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/model/class-user.php @@ -0,0 +1,300 @@ + + */ + protected $resource; + + /** + * Restrict posting to mods + * + * @see https://join-lemmy.org/docs/contributors/05-federation.html + * + * @var boolean + */ + protected $posting_restricted_to_mods = null; + + public static function from_wp_user( $user_id ) { + if ( is_user_disabled( $user_id ) ) { + return new WP_Error( + 'activitypub_user_not_found', + \__( 'User not found', 'activitypub' ), + array( 'status' => 404 ) + ); + } + + $object = new static(); + $object->_id = $user_id; + + return $object; + } + + /** + * Get the User-ID. + * + * @return string The User-ID. + */ + public function get_id() { + return $this->get_url(); + } + + /** + * Get the User-Name. + * + * @return string The User-Name. + */ + public function get_name() { + return \esc_attr( \get_the_author_meta( 'display_name', $this->_id ) ); + } + + /** + * Get the User-Description. + * + * @return string The User-Description. + */ + public function get_summary() { + $description = get_user_meta( $this->_id, 'activitypub_user_description', true ); + if ( empty( $description ) ) { + $description = get_user_meta( $this->_id, 'description', true ); + } + return \wpautop( \wp_kses( $description, 'default' ) ); + } + + /** + * Get the User-Url. + * + * @return string The User-Url. + */ + public function get_url() { + return \esc_url( \get_author_posts_url( $this->_id ) ); + } + + /** + * Returns the User-URL with @-Prefix for the username. + * + * @return string The User-URL with @-Prefix for the username. + */ + public function get_at_url() { + return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_username() ); + } + + public function get_preferred_username() { + return \esc_attr( \get_the_author_meta( 'login', $this->_id ) ); + } + + public function get_icon() { + $icon = \esc_url( + \get_avatar_url( + $this->_id, + array( 'size' => 120 ) + ) + ); + + return array( + 'type' => 'Image', + 'url' => $icon, + ); + } + + public function get_image() { + if ( \has_header_image() ) { + $image = \esc_url( \get_header_image() ); + return array( + 'type' => 'Image', + 'url' => $image, + ); + } + + return null; + } + + public function get_published() { + return \gmdate( 'Y-m-d\TH:i:s\Z', \strtotime( \get_the_author_meta( 'registered', $this->_id ) ) ); + } + + public function get_public_key() { + return array( + 'id' => $this->get_id() . '#main-key', + 'owner' => $this->get_id(), + 'publicKeyPem' => Signature::get_public_key_for( $this->get__id() ), + ); + } + + /** + * Returns the Inbox-API-Endpoint. + * + * @return string The Inbox-Endpoint. + */ + public function get_inbox() { + return get_rest_url_by_path( sprintf( 'users/%d/inbox', $this->get__id() ) ); + } + + /** + * Returns the Outbox-API-Endpoint. + * + * @return string The Outbox-Endpoint. + */ + public function get_outbox() { + return get_rest_url_by_path( sprintf( 'users/%d/outbox', $this->get__id() ) ); + } + + /** + * Returns the Followers-API-Endpoint. + * + * @return string The Followers-Endpoint. + */ + public function get_followers() { + return get_rest_url_by_path( sprintf( 'users/%d/followers', $this->get__id() ) ); + } + + /** + * Returns the Following-API-Endpoint. + * + * @return string The Following-Endpoint. + */ + public function get_following() { + return get_rest_url_by_path( sprintf( 'users/%d/following', $this->get__id() ) ); + } + + /** + * Returns the Featured-API-Endpoint. + * + * @return string The Featured-Endpoint. + */ + public function get_featured() { + return get_rest_url_by_path( sprintf( 'users/%d/collections/featured', $this->get__id() ) ); + } + + /** + * Extend the User-Output with Attachments. + * + * @return array The extended User-Output. + */ + public function get_attachment() { + $array = array(); + + $array[] = array( + 'type' => 'PropertyValue', + 'name' => \__( 'Blog', 'activitypub' ), + 'value' => \html_entity_decode( + '' . \wp_parse_url( \home_url( '/' ), \PHP_URL_HOST ) . '', + \ENT_QUOTES, + 'UTF-8' + ), + ); + + $array[] = array( + 'type' => 'PropertyValue', + 'name' => \__( 'Profile', 'activitypub' ), + 'value' => \html_entity_decode( + '' . \wp_parse_url( \get_author_posts_url( $this->get__id() ), \PHP_URL_HOST ) . '', + \ENT_QUOTES, + 'UTF-8' + ), + ); + + if ( \get_the_author_meta( 'user_url', $this->get__id() ) ) { + $array[] = array( + 'type' => 'PropertyValue', + 'name' => \__( 'Website', 'activitypub' ), + 'value' => \html_entity_decode( + '' . \wp_parse_url( \get_the_author_meta( 'user_url', $this->get__id() ), \PHP_URL_HOST ) . '', + \ENT_QUOTES, + 'UTF-8' + ), + ); + } + + return $array; + } + + /** + * Returns a user@domain type of identifier for the user. + * + * @return string The Webfinger-Identifier. + */ + public function get_resource() { + return $this->get_preferred_username() . '@' . \wp_parse_url( \home_url(), \PHP_URL_HOST ); + } + + public function get_canonical_url() { + return $this->get_url(); + } + + public function get_streams() { + return null; + } + + public function get_tag() { + return array(); + } + + public function get_indexable() { + if ( \get_option( 'blog_public', 1 ) ) { + return true; + } else { + return false; + } + } +} diff --git a/wp-content/upgrade-temp-backup/plugins/activitypub/includes/peer/class-followers.php b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/peer/class-followers.php new file mode 100644 index 00000000..e0e6ddba --- /dev/null +++ b/wp-content/upgrade-temp-backup/plugins/activitypub/includes/peer/class-followers.php @@ -0,0 +1,34 @@ +[\w\-\.]+)/collections/tags', + array( + array( + 'methods' => WP_REST_Server::READABLE, + 'callback' => array( self::class, 'tags_get' ), + 'args' => self::request_parameters(), + 'permission_callback' => '__return_true', + ), + ) + ); + + \register_rest_route( + ACTIVITYPUB_REST_NAMESPACE, + '/users/(?P+ + | +
+
+ get_resource() ) ); ?> + |
+
---|---|
+ + | ++ + + | + +
Saved Options!
Could not save Options!
'.cau_getChangelogUrl( $log_item__type, $log_item__name_f, $log_item__slug ).'
'.cau_getChangelogUrl( $type[$key], $pluginNames[$key], $plugslug[$key] ).'
'.$log_item__version.'
'.$log_item__type.'
'.$log_item__date.'
'.$log_item__method.'
'. $pluginVersion[$key] .'
'. $thisType .'
'. $pluginDatesF[$key] .'
'. $method[$key] .'
+
0?Number.EPSILON:s.score;c*=Math.pow(u,g)}r.score=c,this._log(r)}}},{key:"_sort",value:function(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn)}},{key:"_format",value:function(e){var t=[];if(this.options.verbose){var n=[];this._log("\n\nOutput:\n\n",JSON.stringify(e,(function(e,t){if("object"===a(t)&&null!==t){if(-1!==n.indexOf(t))return;n.push(t)}return t}),2)),n=null}var o=[];this.options.includeMatches&&o.push((function(e,t){var n=e.output;t.matches=[];for(var a=0,o=n.length;a =P;q-=1){var j=q-1,A=n[e.charAt(j)];if(A&&(w[j]=1),z[q]=(z[q+1]<<1|1)&A,0!==B&&(z[q]|=(S[q+1]|S[q])<<1|1|S[q+1]),z[q]&L&&(I=a(t,{errors:B,currentLocation:j,expectedLocation:y,distance:p}))<=v){if(v=I,(_=j)<=y)break;P=Math.max(1,2*y-_)}}if(a(t,{errors:B+1,currentLocation:y,expectedLocation:y,distance:p})>v)break;S=z}var H={isMatch:_>=0,score:0===I?.001:I};return f&&(H.matchedIndices=o(w,b)),H}},function(e,t){e.exports=function(e,t){var n=t.errors,a=void 0===n?0:n,o=t.currentLocation,r=void 0===o?0:o,i=t.expectedLocation,l=void 0===i?0:i,c=t.distance,p=void 0===c?100:c,s=a/e.length,d=Math.abs(l-r);return p?s+d/p:d?1:s}},function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],a=-1,o=-1,r=0,i=e.length;r=t&&n.push([a,o]),a=-1)}return e[r-1]&&r-a>=t&&n.push([a,r-1]),n}},function(e,t){e.exports=function(e){for(var t={},n=e.length,a=0;a Previous post title Author name Next post title Author name Previous post title Date Next post title Date Previous Next Comments number Comments number Author Name Date Semper blandit suspendisse faucibus metus lobortis morbi magna vivamus per risus fermentum dapibus imperdiet praesent magnis. Company Name +1 000 000 0000 © Company Name Your Company Name PH +1 000 000 0000 24 M Drive © Your Copyright Message Author name Post date Category Post author name Date Category COMMENTS Post date Terms Post date Category Date Author name Post date Category Date %s Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pulvinar ligula augue, quis bibendum tellus scelerisque venenatis. Pellentesque porta nisi mi. In hac habitasse platea dictumst. Etiam risus elit, molestie non volutpat ac, pellentesque sed eros. Nunc leo odio, sodales non tortor at, porttitor posuere dui.
+
+
+
+
+
+
+
+
+
+ %1$s %3$s %1$s %2$s %1$s %2$s
+ {{{ data.description }}} {{{ data.description }}} ';
+ printf(
+ wp_kses(
+ /* translators: URL to Jetpack support doc regarding the primary user. */
+ __( "Learn more about the connection owner and what will break if you do not have one.", 'jetpack-connection' ),
+ array(
+ 'a' => array(
+ 'href' => true,
+ 'target' => true,
+ 'rel' => true,
+ ),
+ )
+ ),
+ esc_url( Redirect::get_url( 'jetpack-support-primary-user' ) )
+ );
+ echo ' ';
+ printf(
+ wp_kses(
+ /* translators: URL to contact Jetpack support. */
+ __( 'As always, feel free to contact our support team if you have any questions.', 'jetpack-connection' ),
+ array(
+ 'a' => array(
+ 'href' => true,
+ 'target' => true,
+ 'rel' => true,
+ ),
+ )
+ ),
+ esc_url( Redirect::get_url( 'jetpack-contact-support' ) )
+ );
+ echo '
+ get_non_admin_contact_admin_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+
+
+
+ get_first_step_header_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+
+ get_confirm_safe_mode_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+
+ get_first_step_fix_connection_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+
+ get_migrate_site_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+
+ get_start_fresh_action_explanation(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+
+ get_unsure_prompt(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+ To enhance the speed of your site, with this plan you will need to optimize CSS by using the Manual Critical CSS generation feature whenever you: It’s essential to regenerate Critical CSS to optimize your site speed whenever your HTML or CSS structure changes. Being on top of this can be tedious and time-consuming. Boost’s cloud service can automatically detect when your site needs the Critical CSS regenerated, and perform this function behind the scenes without requiring you to monitor it manually. Paid customers get dedicated email support from our world-class Happiness Engineers to help with any issue. All other questions are handled by our team as quickly as we are able to go through the WordPress support forum. ' . $content . ' Your IP address
+
+ %s ';
+ $result['description'] .= "  ";
+ $result['description'] .= wp_kses( $threat, array( 'a' => array( 'href' => array() ) ) ); // Only allow a href HTML tags.
+ $result['description'] .= ' ';
+ $result['description'] .= sprintf(
+ wp_kses(
+ /* translators: Link to Jetpack Protect. */
+ __( 'See Protect overview page for more information.', 'jetpack-protect' ),
+ array(
+ 'a' => array( 'href' => array() ),
+ )
+ ),
+ esc_url( admin_url( 'admin.php?page=jetpack-protect' ) )
+ );
+ $result['description'] .= 'Hello World
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"993a41e4","isGrid":true,"gridId":"fe8855c5","paddingTop":"40","paddingRight":"40","paddingBottom":"40","paddingLeft":"40","paddingSyncUnits":true,"backgroundColor":"#000000","textColor":"#ffffff","linkColor":"#ffffff","linkColorHover":"#e3e3e3","bgImage":{"id":"","image":{"url":"#dynamic-background-image"}},"bgOptions":{"selector":"pseudo-element","opacity":0.4,"overlay":false,"position":"center center","size":"cover","repeat":"no-repeat","attachment":""},"isDynamic":true,"gpDynamicImageBg":"featured-image","gpDynamicSource":"next-post","gpRemoveContainerCondition":"no-next-post"} --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"49c8845f","element":"p","backgroundColor":"#cf2e2e","showAdvancedTypography":true,"fontSize":14,"textTransform":"uppercase","paddingTop":"5","paddingRight":"10","paddingBottom":"5","paddingLeft":"10","inlineWidth":true} --\x3e Hello World
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- /wp:generateblocks/grid --\x3e \x3c!-- /wp:generateblocks/container --\x3e',meta:[{key:"_generate_hook",value:"generate_after_do_template_part"},{key:"_generate_hook_priority",value:"1"},{key:"_generate_disable_post_navigation",value:!0},{key:"_generate_use_archive_navigation_container",value:!1}]},template_4:{label:(0,l._x)("Two columns with arrows","label","gp-premium"),thumbnail:"post-navigation-arrows-2.jpg",content:'\x3c!-- wp:generateblocks/container {"uniqueId":"96f5f0fa","innerContainer":"full","paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","paddingSyncUnits":true,"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/grid {"uniqueId":"4785bcc3","columns":2,"horizontalGap":0,"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"5287d6da","isGrid":true,"gridId":"4785bcc3","paddingTop":"30","paddingRight":"0","paddingBottom":"25","paddingLeft":"25","backgroundColor":"#ffffff","isDynamic":true,"gpRemoveContainerCondition":"no-previous-post","opacities":[],"textShadows":[{"state":"normal","target":"self","customSelector":"","color":"#000000","colorOpacity":0.5,"xOffset":5,"yOffset":5,"blur":10}]} --\x3e \x3c!-- wp:generateblocks/grid {"uniqueId":"261aea9d","columns":2,"horizontalGap":0,"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"eb3b7005","isGrid":true,"gridId":"261aea9d","width":75,"paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","alignment":"left","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"0a2d5bfc","element":"h3","alignment":"left","textColor":"#000000","linkColor":"#000000","gpDynamicTextType":"title","gpDynamicLinkType":"single-post","gpDynamicTextReplace":"Hello World","gpDynamicSource":"previous-post"} --\x3e Hello World
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"164ae39e","element":"p","showAdvancedTypography":true,"fontSize":14,"marginBottom":"0","hasIcon":true,"gpDynamicTextType":"comments-number","gpDynamicLinkType":"comments","gpDynamicTextReplace":"Comments number","gpDynamicSource":"previous-post"} --\x3e Hello World
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- /wp:generateblocks/grid --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"8ebf8dbe","element":"p","alignment":"right","textColor":"#ffffff","linkColor":"#ffffff","showAdvancedTypography":true,"fontSize":14,"marginBottom":"0","hasIcon":true,"gpDynamicTextType":"comments-number","gpDynamicLinkType":"comments","gpDynamicTextReplace":"Comments number","gpDynamicSource":"next-post"} --\x3e Hello World
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"ce9878f4","isGrid":true,"gridId":"7bdd6853","width":25,"widthTablet":50,"widthMobile":50,"paddingTop":"30","paddingRight":"30","paddingBottom":"30","paddingLeft":"30","paddingSyncUnits":true,"paddingTopMobile":"10","paddingRightMobile":"10","paddingBottomMobile":"10","paddingLeftMobile":"10","marginLeft":"10","marginLeftTablet":"0","marginLeftMobile":"0","borderRadiusBottomLeft":"10","borderRadiusTopLeft":"10","borderRadiusTopLeftTablet":"0","borderRadiusBottomLeftMobile":"5","borderRadiusTopLeftMobile":"0","backgroundColor":"#ffffff","zindex":1,"alignment":"center","isDynamic":true,"gpDynamicImageBg":"featured-image","gpDynamicSource":"next-post","gpRemoveContainerCondition":"no-next-post"} --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"9d97a37f","element":"h3","alignment":"right","backgroundColor":"#ffffff","textColor":"#000000","linkColor":"#000000","showAdvancedTypography":true,"fontSize":25,"fontSizeMobile":17,"marginRight":"-4","marginBottom":"0","marginUnit":"em","marginRightMobile":"-3","paddingTop":"10","paddingRight":"10","paddingBottom":"10","paddingLeft":"10","paddingSyncUnits":true,"borderRadiusTopRight":"10","borderRadiusBottomRight":"10","borderRadiusTopRightMobile":"5","borderRadiusBottomRightMobile":"5","borderRadiusBottomLeftMobile":"5","borderRadiusTopLeftMobile":"5","gpDynamicTextType":"title","gpDynamicLinkType":"single-post","gpDynamicTextReplace":"Hello World","gpDynamicSource":"next-post"} --\x3e Hello World
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"6c856070","isGrid":true,"gridId":"7bdd6853","width":25,"widthTablet":50,"widthMobile":50,"paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","borderRadiusTopRight":"10","borderRadiusBottomRight":"10","borderRadiusTopRightTablet":"0","borderRadiusTopRightMobile":"0","borderRadiusBottomRightMobile":"5","bgImage":{"id":"","image":{"url":"https://generatepress.local/wp-content/plugins/gp-premium/elements/assets/admin/background-image-fallback.jpg"}},"verticalAlignment":"center","isDynamic":true,"gpDynamicImageBg":"featured-image","gpDynamicSource":"next-post","gpRemoveContainerCondition":"no-next-post"} --\x3e \x3c!-- wp:generateblocks/button-container {"uniqueId":"ad40b681","alignment":"right","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/button {"uniqueId":"139d60e4","hasUrl":true,"hasIcon":true,"removeText":true,"backgroundColor":"#b5b5b5","textColor":"#ffffff","backgroundColorHover":"#222222","textColorHover":"#ffffff","borderColor":"#f9f9f9","marginRight":"-1.5","marginLeft":"1.5","marginUnit":"em","paddingTop":"15","paddingRight":"15","paddingBottom":"15","paddingLeft":"15","borderSizeTop":"7","borderSizeRight":"7","borderSizeBottom":"7","borderSizeLeft":"7","borderRadiusTopRight":"100","borderRadiusBottomRight":"100","borderRadiusBottomLeft":"100","borderRadiusTopLeft":"100","borderRadiusUnit":"%","iconSizeMobile":0.8,"gpDynamicLinkType":"single-post","gpDynamicSource":"next-post","opacities":[],"transitions":[],"boxShadows":[],"transforms":[],"textShadows":[],"filters":[]} --\x3e \x3c!-- /wp:generateblocks/button --\x3e \x3c!-- /wp:generateblocks/button-container --\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- /wp:generateblocks/grid --\x3e \x3c!-- /wp:generateblocks/container --\x3e',meta:[{key:"_generate_hook",value:"generate_after_do_template_part"},{key:"_generate_hook_priority",value:"1"},{key:"_generate_disable_post_navigation",value:!0},{key:"_generate_use_archive_navigation_container",value:!1}]}},Re={basic_1:{label:(0,l._x)("Inline with avatar","label","gp-premium"),thumbnail:"post-meta-inline.jpg",content:'\x3c!-- wp:generateblocks/container {"uniqueId":"8a25fc79","paddingTop":"15","paddingRight":"0","paddingBottom":"15","paddingLeft":"0","marginTop":"20","marginBottom":"20","borderSizeTop":"1","borderSizeBottom":"1","borderColor":"#e8edf0","showAdvancedTypography":true,"fontSize":14,"isDynamic":true,"gpInlinePostMeta":true} --\x3e \x3c!-- wp:generatepress/dynamic-image {"imageType":"author-avatar","avatarRounded":true} /--\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"3fb4928a","element":"div","marginLeft":"10","paddingRight":"10","inlineWidth":true,"gpDynamicTextType":"post-author","gpDynamicLinkType":"author-archives","gpDynamicTextReplace":"Author Name"} --\x3e Reach out to us for a consultation.
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"41582601","element":"p","textColor":"#ffffff","paddingRight":"100","paddingRightTablet":"0"} --\x3e
Address Here
Address Here
East Hampton, NY 11937Post Title
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"1ed16867","paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","showAdvancedTypography":true,"fontSize":14,"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/grid {"uniqueId":"27f5a324","columns":2,"verticalAlignment":"center","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"dc72dc13","isGrid":true,"gridId":"10064c4d","widthMobile":50,"paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","isDynamic":true,"gpInlinePostMeta":true} --\x3e \x3c!-- wp:generatepress/dynamic-image {"imageType":"author-avatar","avatarRounded":true} /--\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"c7b33e8b","element":"p","marginBottom":"0","marginLeft":"10","gpDynamicTextType":"post-author","gpDynamicLinkType":"author-archives","gpDynamicTextReplace":"Author name"} --\x3e Title
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generatepress/dynamic-content {"contentType":"post-excerpt","excerptLength":25,"useThemeMoreLink":false} /--\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"fed802f7","paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","paddingSyncUnits":true,"marginTop":"20","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/grid {"uniqueId":"ee363d21","columns":2,"horizontalGap":0,"verticalAlignment":"flex-end","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"74fcc8db","isGrid":true,"gridId":"b23efd25","width":66.66,"widthMobile":66.66,"paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","marginTop":"15","isDynamic":true,"gpInlinePostMeta":true} --\x3e \x3c!-- wp:generatepress/dynamic-image {"imageType":"author-avatar","avatarSize":35,"avatarRounded":true} /--\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"33ed7660","paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","marginLeft":"10","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"2def9732","element":"p","borderColor":"","showAdvancedTypography":true,"fontSize":15,"marginBottom":"0","borderSizeRight":"0","gpDynamicTextType":"post-author","gpDynamicTextReplace":"Post author name"} --\x3e Title
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generateblocks/button-container {"uniqueId":"3413b754","alignment":"right","marginTop":"300","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/button {"uniqueId":"95f40917","hasUrl":true,"backgroundColor":"#ffffff","textColor":"#000000","backgroundColorHover":"#ffffff","backgroundColorHoverOpacity":0.75,"textColorHover":"#000000","borderColor":"#ffffff","borderColorHover":"#ffffff","showAdvancedTypography":true,"fontWeight":"700","fontSize":12,"textTransform":"uppercase","paddingTop":"10","paddingRight":"20","paddingBottom":"10","paddingLeft":"20","borderSizeTop":"1","borderSizeRight":"1","borderSizeBottom":"1","borderSizeLeft":"1","borderRadiusTopRight":"8","borderRadiusBottomRight":"8","borderRadiusBottomLeft":"8","borderRadiusTopLeft":"8","gpDynamicLinkType":"single-post"} --\x3e Read More \x3c!-- /wp:generateblocks/button --\x3e \x3c!-- /wp:generateblocks/button-container --\x3e \x3c!-- /wp:generateblocks/container --\x3e',meta:[{key:"_generate_block_element_editor_width_unit",value:"px"},{key:"_generate_block_element_editor_width",value:"500"},{key:"_generate_use_theme_post_container",value:!1}]},template_4:{label:(0,l._x)("Layout with slanted shape divider","label","gp-premim"),thumbnail:"content-template-slant.jpg",content:'\x3c!-- wp:generateblocks/container {"uniqueId":"0af7ec3a","paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","paddingSyncUnits":true,"borderSizeTop":"0","borderSizeRight":"0","borderSizeBottom":"0","borderSizeLeft":"0","borderColor":"#000000","isDynamic":true} --\x3e \x3c!-- wp:generatepress/dynamic-image {"imageType":"featured-image","imageSize":"large"} /--\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"cc5683f8","paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","paddingSyncUnits":true,"marginTop":"0","marginBottom":"0","zindex":1,"showAdvancedTypography":true,"fontSize":14,"shapeDividers":[{"shape":"gb-angle-1","color":"#ffffff","colorOpacity":1,"location":"bottom","height":50,"heightTablet":"","heightMobile":"","width":100,"widthTablet":"","widthMobile":"","flipHorizontally":false,"zindex":""}],"isDynamic":true} /--\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"7f6bf8cd","paddingTop":"0","paddingRight":"25","paddingBottom":"15","paddingLeft":"25","marginTop":"0","marginRight":"0","marginBottom":"0","marginLeft":"0","backgroundColor":"#ffffff","zindex":1,"showAdvancedTypography":true,"shapeDividers":[],"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"7fd9c317","element":"p","showAdvancedTypography":true,"fontSize":14,"marginBottom":"5","gpDynamicTextType":"post-date","gpDynamicTextReplace":"Post date","gpDynamicDateUpdated":true} --\x3e Hello World
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generatepress/dynamic-content {"contentType":"post-excerpt","excerptLength":25,"useThemeMoreLink":false} /--\x3e \x3c!-- wp:generateblocks/button-container {"uniqueId":"bc9ef703","alignment":"right","marginTop":"15","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/button {"uniqueId":"120ee35e","hasUrl":true,"backgroundColor":"","textColor":"#000000","backgroundColorHover":"#222222","textColorHover":"#ffffff","showAdvancedTypography":true,"fontWeight":"700","textTransform":"uppercase","paddingTop":"15","paddingRight":"20","paddingBottom":"15","paddingLeft":"20","gpDynamicLinkType":"single-post"} --\x3e Read More \x3c!-- /wp:generateblocks/button --\x3e \x3c!-- /wp:generateblocks/button-container --\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- /wp:generateblocks/container --\x3e',meta:[{key:"_generate_block_element_editor_width_unit",value:"px"},{key:"_generate_block_element_editor_width",value:"500"},{key:"_generate_use_theme_post_container",value:!1}]},template_5:{label:(0,l._x)("Layout with centered content","label","gp-premim"),thumbnail:"content-template-centered.jpg",content:'\x3c!-- wp:generatepress/dynamic-image {"imageType":"featured-image","imageSize":"large"} /--\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"5a785d21","paddingTop":"25","paddingRight":"25","paddingBottom":"25","paddingLeft":"25","paddingSyncUnits":true,"backgroundColor":"#ffffff","alignment":"center","showAdvancedTypography":true,"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"82629d5c","linkColor":"#000000","showAdvancedTypography":true,"fontWeight":"700","fontSize":25,"gpDynamicTextType":"title","gpDynamicLinkType":"single-post","gpDynamicTextReplace":"Hello World"} --\x3e Hello World
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generatepress/dynamic-content {"contentType":"post-excerpt","excerptLength":15,"useThemeMoreLink":false} /--\x3e \x3c!-- wp:generateblocks/button-container {"uniqueId":"ad806696","alignment":"center","marginTop":"20","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/button {"uniqueId":"a1b8a609","hasUrl":true,"backgroundColor":"#cf2e2e","textColor":"#ffffff","backgroundColorHover":"#222222","textColorHover":"#ffffff","showAdvancedTypography":true,"fontSize":15,"textTransform":"uppercase","paddingTop":"8","paddingRight":"20","paddingBottom":"8","paddingLeft":"20","borderRadiusTopRight":"50","borderRadiusBottomRight":"50","borderRadiusBottomLeft":"50","borderRadiusTopLeft":"50","gpDynamicLinkType":"single-post"} --\x3e Read more \x3c!-- /wp:generateblocks/button --\x3e \x3c!-- /wp:generateblocks/button-container --\x3e \x3c!-- /wp:generateblocks/container --\x3e',meta:[{key:"_generate_block_element_editor_width_unit",value:"px"},{key:"_generate_block_element_editor_width",value:"500"},{key:"_generate_use_theme_post_container",value:!1}]},template_6:{label:(0,l._x)("Layout with borders","label","gp-premim"),thumbnail:"content-template-borders.jpg",content:'\x3c!-- wp:generateblocks/container {"uniqueId":"0af4cc7c","paddingTop":"5","paddingRight":"5","paddingBottom":"5","paddingLeft":"5","paddingSyncUnits":true,"borderSizeTop":"1","borderSizeRight":"1","borderSizeBottom":"1","borderSizeLeft":"1","borderRadiusTopRight":"2","borderRadiusBottomRight":"2","borderRadiusBottomLeft":"2","borderRadiusTopLeft":"2","borderColor":"#b6b6b6","backgroundColor":"#ffffff","isDynamic":true} --\x3e \x3c!-- wp:generatepress/dynamic-image {"imageType":"featured-image","imageSize":"large"} /--\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"b69b5c43","paddingTop":"30","paddingRight":"30","paddingBottom":"30","paddingLeft":"30","paddingSyncUnits":true,"showAdvancedTypography":true,"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"8dfa4238","element":"p","textColor":"#0693e3","showAdvancedTypography":true,"fontWeight":"700","fontSize":14,"textTransform":"uppercase","marginBottom":"5","className":"dynamic-term-class","gpDynamicTextType":"terms","gpDynamicLinkType":"term-archives","gpDynamicTextReplace":"Terms","gpDynamicTextTaxonomy":"category"} --\x3e Hello World
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generatepress/dynamic-content {"contentType":"post-excerpt","excerptLength":25,"useThemeMoreLink":false} /--\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"d5dadc43","paddingTop":"15","paddingRight":"10","paddingBottom":"10","paddingLeft":"10","borderSizeTop":"1","borderColor":"#b6b6b6","showAdvancedTypography":true,"fontSize":14,"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/grid {"uniqueId":"3da68acd","columns":2,"verticalAlignment":"center","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"2c30b1f9","isGrid":true,"gridId":"3da68acd","widthMobile":50,"paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"fc06eba3","element":"p","textColor":"#b6b6b6","showAdvancedTypography":true,"fontSize":14,"marginBottom":"0","gpDynamicTextType":"post-date","gpDynamicTextReplace":"Post date","gpDynamicTextTaxonomy":"category","gpDynamicDateUpdated":true} --\x3e Title
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generatepress/dynamic-content {"contentType":"post-excerpt","excerptLength":20} /--\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- /wp:generateblocks/grid --\x3e \x3c!-- /wp:generateblocks/container --\x3e',meta:[{key:"_generate_block_element_editor_width_unit",value:"px"},{key:"_generate_block_element_editor_width",value:"800"},{key:"_generate_use_theme_post_container",value:!0}]}},Ee={template_1:{label:(0,l._x)("Default next and previous buttons","label","gp-premium"),thumbnail:"archive-navigation-buttons-2.jpg",content:'\x3c!-- wp:generateblocks/container {"uniqueId":"fb6c192f","paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","paddingSyncUnits":true,"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/grid {"uniqueId":"fe27e101","columns":2,"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"af38c5d0","isGrid":true,"gridId":"fe27e101","widthMobile":50,"paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/button-container {"uniqueId":"9396ea35","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/button {"uniqueId":"aa4ef21a","hasUrl":true,"hasIcon":true,"backgroundColor":"","textColor":"","backgroundColorHover":"","textColorHover":"","className":"button","gpDynamicLinkType":"previous-posts"} --\x3e \x3c!-- /wp:generateblocks/button --\x3e \x3c!-- /wp:generateblocks/button-container --\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"4f3ab895","isGrid":true,"gridId":"fe27e101","widthMobile":50,"paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/button-container {"uniqueId":"8fcd7911","alignment":"right","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/button {"uniqueId":"84010058","hasUrl":true,"hasIcon":true,"iconLocation":"right","backgroundColor":"","textColor":"","backgroundColorHover":"","textColorHover":"","iconPaddingRight":"","iconPaddingLeft":"0.5","className":"button","gpDynamicLinkType":"next-posts"} --\x3e \x3c!-- /wp:generateblocks/button --\x3e \x3c!-- /wp:generateblocks/button-container --\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- /wp:generateblocks/grid --\x3e \x3c!-- /wp:generateblocks/container --\x3e',meta:[{key:"_generate_hook",value:"generate_after_main_content"},{key:"_generate_hook_priority",value:"20"},{key:"_generate_disable_archive_navigation",value:!0},{key:"_generate_use_archive_navigation_container",value:!0}]},template_2:{label:(0,l._x)("Rounded buttons with icon","label","gp-premium"),thumbnail:"archive-navigation-buttons-1.jpg",content:'\x3c!-- wp:generateblocks/container {"uniqueId":"5edb5029","paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","paddingSyncUnits":true,"isDynamic":true} --\x3e \x3c!-- wp:generateblocks/button-container {"uniqueId":"c7866401","alignment":"center","isDynamic":true} --\x3e \x3c!-- wp:generateblocks/button {"uniqueId":"4c23c469","hasUrl":true,"hasIcon":true,"removeText":true,"ariaLabel":"Previous page","backgroundColor":"#ffffff","textColor":"#000000","backgroundColorHover":"#222222","textColorHover":"#ffffff","borderColor":"#000000","marginTop":"5","marginRight":"5","marginBottom":"5","marginLeft":"5","paddingTop":"20","paddingRight":"20","paddingBottom":"20","paddingLeft":"20","borderSizeTop":"1","borderSizeRight":"1","borderSizeBottom":"1","borderSizeLeft":"1","borderRadiusTopRight":"100","borderRadiusBottomRight":"100","borderRadiusBottomLeft":"100","borderRadiusTopLeft":"100","gpDynamicLinkType":"previous-posts"} --\x3e \x3c!-- /wp:generateblocks/button --\x3e \x3c!-- wp:generateblocks/button {"uniqueId":"55622f43","hasUrl":true,"hasIcon":true,"removeText":true,"ariaLabel":"Next page","backgroundColor":"#ffffff","textColor":"#000000","backgroundColorHover":"#222222","textColorHover":"#ffffff","borderColor":"#000000","marginTop":"5","marginRight":"5","marginBottom":"5","marginLeft":"5","paddingTop":"20","paddingRight":"20","paddingBottom":"20","paddingLeft":"20","borderSizeTop":"1","borderSizeRight":"1","borderSizeBottom":"1","borderSizeLeft":"1","borderRadiusTopRight":"100","borderRadiusBottomRight":"100","borderRadiusBottomLeft":"100","borderRadiusTopLeft":"100","gpDynamicLinkType":"next-posts"} --\x3e \x3c!-- /wp:generateblocks/button --\x3e \x3c!-- /wp:generateblocks/button-container --\x3e \x3c!-- /wp:generateblocks/container --\x3e',meta:[{key:"_generate_hook",value:"generate_after_main_content"},{key:"_generate_hook_priority",value:"20"},{key:"_generate_disable_archive_navigation",value:!0},{key:"_generate_use_archive_navigation_container",value:!1}]}},Oe={template_1:{label:(0,l._x)("Basic single post page hero","label","gp-premium"),thumbnail:"page-hero-basic.jpg",content:'\x3c!-- wp:generateblocks/container {"uniqueId":"8b6d1c4b","paddingTop":"150","paddingBottom":"150","backgroundColor":"#000000","textColor":"#ffffff","linkColor":"#ffffff","bgImage":{"id":"","image":{"url":"#dynamic-background-image"}},"bgOptions":{"selector":"pseudo-element","opacity":0.3,"overlay":false,"position":"center center","size":"cover","repeat":"no-repeat","attachment":""},"alignment":"center","isDynamic":true,"gpDynamicImageBg":"featured-image"} --\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"62a8b2cc","element":"h1","showAdvancedTypography":true,"fontSize":50,"gpDynamicTextType":"title","gpDynamicTextReplace":"Page Title"} --\x3e Page Title
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"f49b9f49","paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","paddingSyncUnits":true,"isDynamic":true,"gpInlinePostMeta":true,"gpInlinePostMetaJustify":"center"} --\x3e \x3c!-- wp:generatepress/dynamic-image {"imageType":"author-avatar","avatarRounded":true} /--\x3e \x3c!-- wp:generateblocks/headline {"uniqueId":"2e715b13","element":"p","marginBottom":"0","marginLeft":"10","gpDynamicTextType":"post-author","gpDynamicTextReplace":"Author name"} --\x3e Title
\x3c!-- /wp:generateblocks/headline --\x3e \x3c!-- wp:generatepress/dynamic-content {"contentType":"post-excerpt","useThemeMoreLink":false} /--\x3e \x3c!-- /wp:generateblocks/container --\x3e \x3c!-- wp:generateblocks/container {"uniqueId":"4e92c4e8","isGrid":true,"gridId":"fde86e48","width":55,"widthTablet":40,"minHeight":400,"minHeightMobile":250,"paddingTop":"0","paddingRight":"0","paddingBottom":"0","paddingLeft":"0","bgImage":{"id":"","image":{"url":"#dynamic-background-image"}},"bgOptions":{"selector":"element","opacity":1,"overlay":false,"position":"center center","size":"cover","repeat":"no-repeat","attachment":""},"isDynamic":true,"gpDynamicImageBg":"featured-image","gpUseFallbackImageBg":true} /--\x3e \x3c!-- /wp:generateblocks/grid --\x3e \x3c!-- /wp:generateblocks/container --\x3e',meta:[{key:"_generate_hook",value:"generate_after_header"},{key:"_generate_disable_title",value:!0},{key:"_generate_disable_featured_image",value:!0},{key:"_generate_disable_primary_post_meta",value:!0}]}},Pe=window.wp.plugins,Me=window.wp.editPost,ze=window.wp.data,qe=window.wp.domReady,je=n.n(qe);function Ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function He(e){for(var t=1;t' ).show();
+ }
+ } );
+
+ frame.open();
+ } );
+
+ $( '.remove-field' ).on( 'click', function() {
+ var _this = $( this ),
+ container = _this.closest( '.media-container' );
+
+ _this.hide();
+ container.find( '.media-field' ).val( '' );
+ container.find( '.gp-media-preview' ).empty();
+ } );
+
+ $( '#_generate_hero_background_image' ).on( 'change', function() {
+ var _this = $( this );
+
+ if ( '' !== _this.val() ) {
+ $( '.requires-background-image' ).show();
+ } else {
+ $( '.requires-background-image' ).hide();
+ }
+
+ if ( 'featured-image' === _this.val() ) {
+ $( '.image-text' ).text( elements.fallback_image );
+ }
+
+ if ( 'custom-image' === _this.val() ) {
+ $( '.image-text' ).text( elements.custom_image );
+ }
+ } );
+
+ // Responsive controls in our settings.
+ $( '.responsive-controls a' ).on( 'click', function( e ) {
+ e.preventDefault();
+
+ var _this = $( this ),
+ control = _this.attr( 'data-control' ),
+ controlArea = _this.closest( '.generate-element-row-content' );
+
+ controlArea.find( '.padding-container' ).hide();
+ controlArea.find( '.padding-container.' + control ).show();
+ _this.siblings().removeClass( 'is-selected' );
+ _this.addClass( 'is-selected' );
+ } );
+
+ $( '#_generate_site_header_merge' ).on( 'change', function() {
+ var _this = $( this );
+
+ if ( '' !== _this.val() ) {
+ $( '.requires-header-merge' ).show();
+
+ if ( $( '#_generate_navigation_colors' ).is( ':checked' ) ) {
+ $( '.requires-navigation-colors' ).show();
+ }
+
+ if ( $( '#_generate_hero_full_screen' ).is( ':checked' ) ) {
+ $( '.requires-full-screen' ).show();
+ }
+ } else {
+ $( '.requires-header-merge' ).hide();
+ $( '.requires-navigation-colors' ).hide();
+ $( '.requires-full-screen' ).hide();
+ }
+ } );
+
+ $( '#_generate_navigation_colors' ).on( 'change', function() {
+ var _this = $( this );
+
+ if ( _this.is( ':checked' ) ) {
+ $( '.requires-navigation-colors' ).show();
+ } else {
+ $( '.requires-navigation-colors' ).hide();
+ }
+ } );
+
+ $( '#_generate_hero_full_screen' ).on( 'change', function() {
+ var _this = $( this );
+
+ if ( _this.is( ':checked' ) ) {
+ $( '.requires-full-screen' ).show();
+ } else {
+ $( '.requires-full-screen' ).hide();
+ }
+ } );
+
+ $( '#_generate_hero_background_parallax' ).on( 'change', function() {
+ var _this = $( this );
+
+ if ( _this.is( ':checked' ) ) {
+ $( '#_generate_hero_background_position' ).val( '' ).change();
+ $( '#_generate_hero_background_position option[value="left center"]' ).attr( 'disabled', true );
+ $( '#_generate_hero_background_position option[value="left bottom"]' ).attr( 'disabled', true );
+ $( '#_generate_hero_background_position option[value="right center"]' ).attr( 'disabled', true );
+ $( '#_generate_hero_background_position option[value="right bottom"]' ).attr( 'disabled', true );
+ $( '#_generate_hero_background_position option[value="center center"]' ).attr( 'disabled', true );
+ $( '#_generate_hero_background_position option[value="center bottom"]' ).attr( 'disabled', true );
+ } else {
+ $( '#_generate_hero_background_position option[value="left center"]' ).attr( 'disabled', false );
+ $( '#_generate_hero_background_position option[value="left bottom"]' ).attr( 'disabled', false );
+ $( '#_generate_hero_background_position option[value="right center"]' ).attr( 'disabled', false );
+ $( '#_generate_hero_background_position option[value="right bottom"]' ).attr( 'disabled', false );
+ $( '#_generate_hero_background_position option[value="center center"]' ).attr( 'disabled', false );
+ $( '#_generate_hero_background_position option[value="center bottom"]' ).attr( 'disabled', false );
+ }
+ } );
+} );
diff --git a/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/assets/admin/spinner.gif b/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/assets/admin/spinner.gif
new file mode 100644
index 00000000..209d10b6
Binary files /dev/null and b/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/assets/admin/spinner.gif differ
diff --git a/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/assets/js/parallax.js b/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/assets/js/parallax.js
new file mode 100644
index 00000000..a4540e52
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/assets/js/parallax.js
@@ -0,0 +1,17 @@
+function generate_parallax_element( selector, context ) {
+ context = context || document;
+ var elements = context.querySelectorAll( selector );
+ return Array.prototype.slice.call( elements );
+}
+
+window.addEventListener( "scroll", function() {
+ var scrolledHeight= window.pageYOffset;
+ generate_parallax_element( ".page-hero" ).forEach( function( el, index, array ) {
+ var limit = el.offsetTop + el.offsetHeight;
+ if( scrolledHeight > el.offsetTop && scrolledHeight <= limit ) {
+ el.style.backgroundPositionY = ( scrolledHeight - el.offsetTop ) / hero.parallax + "px";
+ } else {
+ el.style.backgroundPositionY = "0";
+ }
+ });
+});
diff --git a/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/assets/js/parallax.min.js b/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/assets/js/parallax.min.js
new file mode 100644
index 00000000..f1918424
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/assets/js/parallax.min.js
@@ -0,0 +1 @@
+function generate_parallax_element(e,o){var t=(o=o||document).querySelectorAll(e);return Array.prototype.slice.call(t)}window.addEventListener("scroll",function(){var r=window.pageYOffset;generate_parallax_element(".page-hero").forEach(function(e,o,t){var a=e.offsetTop+e.offsetHeight;r>e.offsetTop&&r<=a?e.style.backgroundPositionY=(r-e.offsetTop)/hero.parallax+"px":e.style.backgroundPositionY="0"})});
diff --git a/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/class-block-elements.php b/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/class-block-elements.php
new file mode 100644
index 00000000..98fa6ba8
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/class-block-elements.php
@@ -0,0 +1,1785 @@
+ true,
+ )
+ )
+ );
+
+ $parent_elements = get_posts(
+ array(
+ 'post_type' => 'gp_elements',
+ 'post_parent' => 0,
+ 'no_found_rows' => true,
+ 'post_status' => 'publish',
+ 'numberposts' => 100,
+ 'fields' => 'ids',
+ 'exclude' => array( get_the_ID() ),
+ 'meta_query' => array(
+ array(
+ 'key' => '_generate_block_type',
+ 'value' => 'content-template',
+ 'compare' => '=',
+ ),
+ ),
+ )
+ );
+
+ $parent_elements_data = array();
+
+ foreach ( (array) $parent_elements as $element ) {
+ $parent_elements_data[] = array(
+ 'label' => get_the_title( $element ),
+ 'id' => $element,
+ );
+ }
+
+ $image_sizes = get_intermediate_image_sizes();
+ $image_sizes = array_diff( $image_sizes, array( '1536x1536', '2048x2048' ) );
+ $image_sizes[] = 'full';
+
+ $containerWidth = function_exists( 'generate_get_option' ) ? generate_get_option( 'container_width' ) : 1100;
+ $rightSidebarWidth = apply_filters( 'generate_right_sidebar_width', '25' );
+ $leftSidebarWidth = apply_filters( 'generate_left_sidebar_width', '25' );
+
+ $containerWidth = floatval( $containerWidth );
+ $leftSidebarWidth = '0.' . $leftSidebarWidth;
+ $rightSidebarWidth = '0.' . $rightSidebarWidth;
+
+ $leftSidebarWidth = $containerWidth - ( $containerWidth * $leftSidebarWidth );
+ $rightSidebarWidth = $containerWidth - ( $containerWidth * $rightSidebarWidth );
+
+ $leftSidebarWidth = $containerWidth - $leftSidebarWidth;
+ $rightSidebarWidth = $containerWidth - $rightSidebarWidth;
+
+ $contentWidth = $containerWidth - $rightSidebarWidth;
+
+ wp_localize_script(
+ 'gp-premium-block-elements',
+ 'gpPremiumBlockElements',
+ array(
+ 'isBlockElement' => 'gp_elements' === get_post_type(),
+ 'taxonomies' => $taxonomies,
+ 'rightSidebarWidth' => $rightSidebarWidth,
+ 'leftSidebarWidth' => $leftSidebarWidth,
+ 'contentWidth' => $contentWidth,
+ 'hooks' => GeneratePress_Elements_Helper::get_available_hooks(),
+ 'excerptLength' => apply_filters( 'excerpt_length', 55 ), // phpcs:ignore -- Core filter.
+ 'isGenerateBlocksActive' => function_exists( 'generateblocks_load_plugin_textdomain' ),
+ 'isGenerateBlocksInstalled' => file_exists( WP_PLUGIN_DIR . '/generateblocks/plugin.php' ) ? true : false,
+ 'isGenerateBlocksProActive' => function_exists( 'generateblocks_pro_init' ),
+ 'installLink' => wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=generateblocks' ), 'install-plugin_generateblocks' ),
+ 'activateLink' => wp_nonce_url( 'plugins.php?action=activate&plugin=generateblocks/plugin.php&plugin_status=all&paged=1&s', 'activate-plugin_generateblocks/plugin.php' ),
+ 'imageSizes' => $image_sizes,
+ 'imageSizeDimensions' => $this->get_image_Sizes(),
+ 'featuredImagePlaceholder' => GP_PREMIUM_DIR_URL . 'elements/assets/admin/featured-image-placeholder.png',
+ 'authorImagePlaceholder' => GP_PREMIUM_DIR_URL . 'elements/assets/admin/author-image-placeholder.png',
+ 'bgImageFallback' => GP_PREMIUM_DIR_URL . 'elements/assets/admin/background-image-fallback.jpg',
+ 'templateImageUrl' => 'https://gpsites.co/files/element-library',
+ 'parentElements' => $parent_elements_data,
+ )
+ );
+
+ wp_enqueue_style(
+ 'gp-premium-block-elements',
+ GP_PREMIUM_DIR_URL . 'dist/block-elements.css',
+ array( 'wp-edit-blocks' ),
+ filemtime( GP_PREMIUM_DIR_PATH . 'dist/block-elements.css' )
+ );
+ }
+
+ /**
+ * Add our block category.
+ *
+ * @param array $categories The existing categories.
+ */
+ public function add_block_category( $categories ) {
+ return array_merge(
+ array(
+ array(
+ 'slug' => 'generatepress',
+ 'title' => __( 'GeneratePress', 'gp-premium' ),
+ ),
+ ),
+ $categories
+ );
+ }
+
+ /**
+ * Register our dynamic blocks.
+ */
+ public function register_dynamic_blocks() {
+ if ( ! function_exists( 'register_block_type' ) ) {
+ return;
+ }
+
+ register_block_type(
+ 'generatepress/dynamic-content',
+ array(
+ 'render_callback' => array( $this, 'do_dynamic_content_block' ),
+ 'attributes' => array(
+ 'contentType' => array(
+ 'type' => 'string',
+ 'default' => '',
+ ),
+ 'excerptLength' => array(
+ 'type' => 'number',
+ 'default' => apply_filters( 'excerpt_length', 55 ), // phpcs:ignore -- Core filter.
+ ),
+ 'useThemeMoreLink' => array(
+ 'type' => 'boolean',
+ 'defaut' => true,
+ ),
+ 'customMoreLink' => array(
+ 'type' => 'string',
+ 'default' => '',
+ ),
+ ),
+ )
+ );
+
+ register_block_type(
+ 'generatepress/dynamic-image',
+ array(
+ 'render_callback' => array( $this, 'do_dynamic_image_block' ),
+ 'attributes' => array(
+ 'imageType' => array(
+ 'type' => 'string',
+ 'default' => '',
+ ),
+ 'imageSource' => array(
+ 'type' => 'string',
+ 'default' => 'current-post',
+ ),
+ 'customField' => array(
+ 'type' => 'string',
+ 'default' => '',
+ ),
+ 'gpDynamicSourceInSameTerm' => array(
+ 'type' => 'boolean',
+ 'default' => false,
+ ),
+ 'gpDynamicSourceInSameTermTaxonomy' => array(
+ 'tyoe' => 'string',
+ 'default' => 'category',
+ ),
+ 'imageSize' => array(
+ 'type' => 'string',
+ 'default' => 'full',
+ ),
+ 'linkTo' => array(
+ 'type' => 'string',
+ 'default' => '',
+ ),
+ 'linkToCustomField' => array(
+ 'type' => 'string',
+ 'default' => '',
+ ),
+ 'imageWidth' => array(
+ 'type' => 'number',
+ 'default' => null,
+ ),
+ 'imageHeight' => array(
+ 'type' => 'number',
+ 'default' => null,
+ ),
+ 'avatarSize' => array(
+ 'type' => 'number',
+ 'default' => 30,
+ ),
+ 'avatarRounded' => array(
+ 'type' => 'boolean',
+ 'default' => false,
+ ),
+ ),
+ )
+ );
+ }
+
+ /**
+ * Do our dynamic content block.
+ *
+ * @param array $attributes The attributes from this block.
+ */
+ public function do_dynamic_content_block( $attributes ) {
+ if ( empty( $attributes['contentType'] ) ) {
+ return;
+ }
+
+ if ( 'post-content' === $attributes['contentType'] ) {
+ return $this->do_content_block();
+ }
+
+ if ( 'post-excerpt' === $attributes['contentType'] ) {
+ return $this->do_excerpt_block( $attributes );
+ }
+
+ if ( 'term-description' === $attributes['contentType'] ) {
+ return sprintf(
+ '
',
+ $image,
+ ! empty( $attributes['imageWidth'] ) ? absint( $attributes['imageWidth'] ) : '',
+ ! empty( $attributes['imageHeight'] ) ? absint( $attributes['imageHeight'] ) : ''
+ )
+ );
+ }
+
+ if ( ! empty( $image_output ) ) {
+ if ( ! empty( $attributes['linkTo'] ) ) {
+ if ( 'single-post' === $attributes['linkTo'] ) {
+ $image_output = sprintf(
+ '%s',
+ esc_url( get_permalink( $id ) ),
+ $image_output
+ );
+ }
+
+ if ( 'custom-field' === $attributes['linkTo'] ) {
+ $custom_field = get_post_meta( $id, $attributes['linkToCustomField'], true );
+
+ if ( $custom_field ) {
+ $image_output = sprintf(
+ '%s',
+ esc_url( $custom_field ),
+ $image_output
+ );
+ }
+ }
+ }
+
+ return $image_output;
+ }
+ }
+ }
+
+ if ( 'author-avatar' === $attributes['imageType'] ) {
+ global $post;
+ $author_id = $post->post_author;
+ $size = ! empty( $attributes['avatarSize'] ) ? $attributes['avatarSize'] : 30;
+ $image_alt = apply_filters( 'generate_dynamic_author_image_alt', __( 'Photo of author', 'gp-premium' ) );
+
+ $classes = array(
+ 'dynamic-author-image',
+ );
+
+ if ( ! empty( $attributes['avatarRounded'] ) ) {
+ $classes[] = 'dynamic-author-image-rounded';
+ }
+
+ $avatar = get_avatar(
+ $author_id,
+ $size,
+ '',
+ esc_attr( $image_alt ),
+ array(
+ 'class' => implode( ' ', $classes ),
+ )
+ );
+
+ if ( $avatar ) {
+ return $avatar;
+ }
+ }
+ }
+
+ /**
+ * Get our dynamic URL.
+ *
+ * @param string $link_type The kind of link to add.
+ * @param string $source The source of the dynamic data.
+ * @param array $block The block we're working with.
+ */
+ public function get_dynamic_url( $link_type, $source, $block ) {
+ $id = $this->get_source_id( $source, $block['attrs'] );
+ $author_id = $this->get_author_id( $source, $block['attrs'] );
+ $url = '';
+
+ if ( 'single-post' === $link_type ) {
+ $url = get_permalink( $id );
+ }
+
+ if ( isset( $block['attrs']['gpDynamicLinkCustomField'] ) ) {
+ if ( 'post-meta' === $link_type ) {
+ $url = get_post_meta( $id, $block['attrs']['gpDynamicLinkCustomField'], true );
+ }
+
+ if ( 'user-meta' === $link_type ) {
+ $url = $this->get_user_data( $author_id, $block['attrs']['gpDynamicLinkCustomField'] );
+ }
+
+ if ( 'term-meta' === $link_type ) {
+ $url = get_term_meta( get_queried_object_id(), $block['attrs']['gpDynamicLinkCustomField'], true );
+ }
+ }
+
+ if ( 'author-archives' === $link_type ) {
+ $url = get_author_posts_url( $author_id );
+ }
+
+ if ( 'comments' === $link_type ) {
+ $url = get_comments_link( $id );
+ }
+
+ if ( 'next-posts' === $link_type ) {
+ global $paged, $wp_query;
+
+ $max_page = 0;
+
+ if ( ! $max_page ) {
+ $max_page = $wp_query->max_num_pages;
+ }
+
+ $paged_num = isset( $paged ) && $paged ? $paged : 1;
+ $nextpage = (int) $paged_num + 1;
+
+ if ( ! is_single() && ( $nextpage <= $max_page ) ) {
+ $url = next_posts( $max_page, false );
+ }
+ }
+
+ if ( 'previous-posts' === $link_type ) {
+ global $paged;
+
+ if ( ! is_single() && (int) $paged > 1 ) {
+ $url = previous_posts( false );
+ }
+ }
+
+ return apply_filters( 'generate_dynamic_element_url', $url, $link_type, $source, $block );
+ }
+
+ /**
+ * Wrap our dynamic text in a link.
+ *
+ * @param string $text The text to wrap.
+ * @param string $link_type The kind of link to add.
+ * @param string $source The source of the dynamic data.
+ * @param array $block The block we're working with.
+ */
+ public function add_dynamic_link( $text, $link_type, $source, $block ) {
+ if ( 'generateblocks/headline' === $block['blockName'] ) {
+ $url = $this->get_dynamic_url( $link_type, $source, $block );
+
+ if ( ! $url ) {
+ return $text;
+ }
+
+ return sprintf(
+ '%s',
+ esc_url( $url ),
+ $text
+ );
+ }
+
+ if ( 'generateblocks/button' === $block['blockName'] ) {
+ $url = $this->get_dynamic_url( $link_type, $source, $block );
+
+ // Since this is a button, we want to scrap the whole block if we don't have a link.
+ if ( ! $url ) {
+ return '';
+ }
+
+ $dynamic_url = sprintf(
+ 'href="%s"',
+ esc_url( $url )
+ );
+
+ return str_replace( 'href="#"', $dynamic_url, $text );
+ }
+ }
+
+ /**
+ * Get user data.
+ *
+ * @since 2.0.0
+ * @param int $author_id The ID of the user.
+ * @param string $field The field to look up.
+ */
+ public function get_user_data( $author_id, $field ) {
+ $data = get_user_meta( $author_id, $field, true );
+
+ if ( ! $data ) {
+ $user_data_names = array(
+ 'user_nicename',
+ 'user_email',
+ 'user_url',
+ 'display_name',
+ );
+
+ if ( in_array( $field, $user_data_names ) ) {
+ $user_data = get_userdata( $author_id );
+
+ if ( $user_data ) {
+ switch ( $field ) {
+ case 'user_nicename':
+ $data = $user_data->user_nicename;
+ break;
+
+ case 'user_email':
+ $data = $user_data->user_email;
+ break;
+
+ case 'user_url':
+ $data = $user_data->user_url;
+ break;
+
+ case 'display_name':
+ $data = $user_data->display_name;
+ break;
+ }
+ }
+ }
+ }
+
+ return $data;
+ }
+
+ /**
+ * Add the dynamic bits to our blocks.
+ *
+ * @param string $block_content The block content.
+ * @param array $block The block info.
+ */
+ public function render_blocks( $block_content, $block ) {
+ if ( 'gp_elements' === get_post_type() || is_admin() ) {
+ return $block_content;
+ }
+
+ if ( 'generateblocks/headline' === $block['blockName'] || 'generateblocks/button' === $block['blockName'] ) {
+ if ( ! empty( $block['attrs']['gpDynamicTextType'] ) && ! empty( $block['attrs']['gpDynamicTextReplace'] ) ) {
+ $text_to_replace = $block['attrs']['gpDynamicTextReplace'];
+ $text_type = $block['attrs']['gpDynamicTextType'];
+ $link_type = ! empty( $block['attrs']['gpDynamicLinkType'] ) ? $block['attrs']['gpDynamicLinkType'] : '';
+ $source = ! empty( $block['attrs']['gpDynamicSource'] ) ? $block['attrs']['gpDynamicSource'] : 'current-post';
+ $id = $this->get_source_id( $source, $block['attrs'] );
+
+ if ( ! $id ) {
+ return '';
+ }
+
+ if ( 'title' === $text_type ) {
+ $post_title = get_the_title( $id );
+
+ if ( ! in_the_loop() ) {
+ if ( is_tax() || is_category() || is_tag() ) {
+ $post_title = get_queried_object()->name;
+ } elseif ( is_post_type_archive() ) {
+ $post_title = post_type_archive_title( '', false );
+ } elseif ( is_archive() && function_exists( 'get_the_archive_title' ) ) {
+ $post_title = get_the_archive_title();
+
+ if ( is_author() ) {
+ $post_title = get_the_author();
+ }
+ } elseif ( is_home() ) {
+ $page_for_posts = get_option( 'page_for_posts' );
+
+ if ( ! empty( $page_for_posts ) ) {
+ $post_title = get_the_title( $page_for_posts );
+ } else {
+ $post_title = __( 'Blog', 'gp-premium' );
+ }
+ }
+ }
+
+ $post_title = apply_filters( 'generate_dynamic_element_text', $post_title, $block );
+
+ if ( $link_type ) {
+ $post_title = $this->add_dynamic_link( $post_title, $link_type, $source, $block );
+ }
+
+ if ( ! empty( $block['attrs']['gpDynamicTextBefore'] ) ) {
+ $post_title = $block['attrs']['gpDynamicTextBefore'] . $post_title;
+ }
+
+ $post_title = apply_filters( 'generate_dynamic_element_text_output', $post_title, $block );
+ $block_content = str_replace( $text_to_replace, $post_title, $block_content );
+ }
+
+ if ( 'post-date' === $text_type ) {
+ $updated_time = get_the_modified_time( 'U', $id );
+ $published_time = get_the_time( 'U', $id ) + 1800;
+
+ $post_date = sprintf(
+ '',
+ esc_attr( get_the_date( 'c', $id ) ),
+ esc_html( get_the_date( '', $id ) )
+ );
+
+ $is_updated_date = isset( $block['attrs']['gpDynamicDateType'] ) && 'updated-date' === $block['attrs']['gpDynamicDateType'];
+
+ if ( ! empty( $block['attrs']['gpDynamicDateUpdated'] ) || $is_updated_date ) {
+ if ( $updated_time > $published_time ) {
+ $post_date = sprintf(
+ '',
+ esc_attr( get_the_modified_date( 'c', $id ) ),
+ esc_html( get_the_modified_date( '', $id ) )
+ );
+ } elseif ( $is_updated_date ) {
+ // If we're showing the updated date but no updated date exists, don't display anything.
+ return '';
+ }
+ }
+
+ $post_date = apply_filters( 'generate_dynamic_element_text', $post_date, $block );
+
+ if ( $link_type ) {
+ $post_date = $this->add_dynamic_link( $post_date, $link_type, $source, $block );
+ }
+
+ $before_text = '';
+
+ if ( ! empty( $block['attrs']['gpDynamicTextBefore'] ) ) {
+ $before_text = $block['attrs']['gpDynamicTextBefore'];
+ }
+
+ // Use the updated date before text if we're set to replace the published date with updated date.
+ if ( ! empty( $block['attrs']['gpDynamicUpdatedDateBefore'] ) && ! empty( $block['attrs']['gpDynamicDateUpdated'] ) && $updated_time > $published_time ) {
+ $before_text = $block['attrs']['gpDynamicUpdatedDateBefore'];
+ }
+
+ if ( ! empty( $before_text ) ) {
+ $post_date = $before_text . $post_date;
+ }
+
+ $post_date = apply_filters( 'generate_dynamic_element_text_output', $post_date, $block );
+ $block_content = str_replace( $text_to_replace, $post_date, $block_content );
+ }
+
+ if ( 'post-author' === $text_type ) {
+ $author_id = $this->get_author_id( $source, $block['attrs'] );
+ $post_author = get_the_author_meta( 'display_name', $author_id );
+ $post_author = apply_filters( 'generate_dynamic_element_text', $post_author, $block );
+
+ if ( empty( $post_author ) ) {
+ return '';
+ }
+
+ if ( $link_type ) {
+ $post_author = $this->add_dynamic_link( $post_author, $link_type, $source, $block );
+ }
+
+ if ( ! empty( $block['attrs']['gpDynamicTextBefore'] ) ) {
+ $post_author = $block['attrs']['gpDynamicTextBefore'] . $post_author;
+ }
+
+ $post_author = apply_filters( 'generate_dynamic_element_text_output', $post_author, $block );
+ $block_content = str_replace( $text_to_replace, $post_author, $block_content );
+ }
+
+ if ( 'terms' === $text_type && 'generateblocks/headline' === $block['blockName'] ) {
+ if ( ! empty( $block['attrs']['gpDynamicTextTaxonomy'] ) ) {
+ $terms = get_the_terms( $id, $block['attrs']['gpDynamicTextTaxonomy'] );
+
+ if ( is_wp_error( $terms ) ) {
+ return $block_content;
+ }
+
+ $term_items = array();
+
+ foreach ( (array) $terms as $term ) {
+ if ( ! isset( $term->name ) ) {
+ continue;
+ }
+
+ if ( 'term-archives' === $link_type ) {
+ $term_link = get_term_link( $term, $block['attrs']['gpDynamicTextTaxonomy'] );
+
+ if ( ! is_wp_error( $term_link ) ) {
+ $term_items[] = sprintf(
+ '%2$s',
+ esc_url( get_term_link( $term, $block['attrs']['gpDynamicTextTaxonomy'] ) ),
+ $term->name,
+ $term->slug
+ );
+ }
+ } else {
+ $term_items[] = sprintf(
+ '%1$s',
+ $term->name,
+ $term->slug
+ );
+ }
+ }
+
+ if ( empty( $term_items ) ) {
+ return '';
+ }
+
+ $sep = isset( $block['attrs']['gpDynamicTextTaxonomySeparator'] ) ? $block['attrs']['gpDynamicTextTaxonomySeparator'] : ', ';
+ $term_output = implode( $sep, $term_items );
+
+ if ( ! empty( $block['attrs']['gpDynamicTextBefore'] ) ) {
+ $term_output = $block['attrs']['gpDynamicTextBefore'] . $term_output;
+ }
+
+ $term_output = apply_filters( 'generate_dynamic_element_text_output', $term_output, $block );
+ $block_content = str_replace( $text_to_replace, $term_output, $block_content );
+ } else {
+ return '';
+ }
+ }
+
+ if ( 'comments-number' === $text_type ) {
+ if ( ! post_password_required( $id ) && ( comments_open( $id ) || get_comments_number( $id ) ) ) {
+ if ( ! isset( $block['attrs']['gpDynamicNoCommentsText'] ) ) {
+ $block['attrs']['gpDynamicNoCommentsText'] = __( 'No Comments', 'gp-premium' );
+ }
+
+ if ( '' === $block['attrs']['gpDynamicNoCommentsText'] && get_comments_number( $id ) < 1 ) {
+ return '';
+ }
+
+ $comments_text = get_comments_number_text(
+ $block['attrs']['gpDynamicNoCommentsText'],
+ ! empty( $block['attrs']['gpDynamicSingleCommentText'] ) ? $block['attrs']['gpDynamicSingleCommentText'] : __( '1 Comment', 'gp-premium' ),
+ ! empty( $block['attrs']['gpDynamicMultipleCommentsText'] ) ? $block['attrs']['gpDynamicMultipleCommentsText'] : __( '% Comments', 'gp-premium' )
+ );
+
+ $comments_text = apply_filters( 'generate_dynamic_element_text', $comments_text, $block );
+
+ if ( '' === $comments_text ) {
+ return '';
+ }
+
+ if ( $link_type ) {
+ $comments_text = $this->add_dynamic_link( $comments_text, $link_type, $source, $block );
+ }
+
+ if ( ! empty( $block['attrs']['gpDynamicTextBefore'] ) ) {
+ $comments_text = $block['attrs']['gpDynamicTextBefore'] . $comments_text;
+ }
+
+ $comments_text = apply_filters( 'generate_dynamic_element_text_output', $comments_text, $block );
+ $block_content = str_replace( $text_to_replace, $comments_text, $block_content );
+ } else {
+ return '';
+ }
+ }
+
+ if ( 'post-meta' === $text_type || 'term-meta' === $text_type || 'user-meta' === $text_type ) {
+ if ( ! empty( $block['attrs']['gpDynamicTextCustomField'] ) ) {
+ $custom_field = get_post_meta( $id, $block['attrs']['gpDynamicTextCustomField'], true );
+
+ if ( 'term-meta' === $text_type ) {
+ $custom_field = get_term_meta( get_queried_object_id(), $block['attrs']['gpDynamicTextCustomField'], true );
+ }
+
+ if ( 'user-meta' === $text_type ) {
+ $author_id = $this->get_author_id( $source, $block['attrs'] );
+ $custom_field = $this->get_user_data( $author_id, $block['attrs']['gpDynamicTextCustomField'] );
+ }
+
+ $custom_field = apply_filters( 'generate_dynamic_element_text', $custom_field, $block );
+
+ if ( $custom_field ) {
+ if ( $link_type ) {
+ $custom_field = $this->add_dynamic_link( $custom_field, $link_type, $source, $block );
+ }
+
+ if ( ! empty( $block['attrs']['gpDynamicTextBefore'] ) ) {
+ $custom_field = $block['attrs']['gpDynamicTextBefore'] . $custom_field;
+ }
+
+ $custom_field = apply_filters( 'generate_dynamic_element_text_output', $custom_field, $block );
+ $block_content = str_replace( $text_to_replace, $custom_field, $block_content );
+ } else {
+ $block_content = '';
+ }
+ } else {
+ $block_content = '';
+ }
+ }
+ }
+ }
+
+ if ( 'generateblocks/button' === $block['blockName'] ) {
+ $link_type = ! empty( $block['attrs']['gpDynamicLinkType'] ) ? $block['attrs']['gpDynamicLinkType'] : '';
+
+ if ( ! empty( $link_type ) && 'term-archives' !== $link_type ) {
+ $source = ! empty( $block['attrs']['gpDynamicSource'] ) ? $block['attrs']['gpDynamicSource'] : 'current-post';
+ $id = $this->get_source_id( $source, $block['attrs'] );
+
+ if ( ! $id ) {
+ return '';
+ }
+
+ if ( $link_type ) {
+ $block_content = $this->add_dynamic_link( $block_content, $link_type, $source, $block );
+ }
+ }
+
+ if ( ! empty( $block['attrs']['gpDynamicTextType'] ) && ! empty( $block['attrs']['gpDynamicTextReplace'] ) ) {
+ $text_to_replace = $block['attrs']['gpDynamicTextReplace'];
+ $text_type = $block['attrs']['gpDynamicTextType'];
+ $link_type = ! empty( $block['attrs']['gpDynamicLinkType'] ) ? $block['attrs']['gpDynamicLinkType'] : '';
+ $source = ! empty( $block['attrs']['gpDynamicSource'] ) ? $block['attrs']['gpDynamicSource'] : 'current-post';
+ $id = $this->get_source_id( $source, $block['attrs'] );
+
+ if ( ! $id ) {
+ return '';
+ }
+
+ if ( 'terms' === $text_type ) {
+ if ( ! empty( $block['attrs']['gpDynamicTextTaxonomy'] ) ) {
+ $terms = get_the_terms( $id, $block['attrs']['gpDynamicTextTaxonomy'] );
+
+ if ( is_wp_error( $terms ) ) {
+ return '';
+ }
+
+ $term_buttons = array();
+
+ foreach ( (array) $terms as $term ) {
+ if ( ! isset( $term->name ) ) {
+ continue;
+ }
+
+ $term_button = str_replace( $text_to_replace, $term->name, $block_content );
+
+ if ( isset( $term->slug ) ) {
+ $term_button = str_replace( 'dynamic-term-class', 'post-term-item term-' . $term->slug, $term_button );
+ }
+
+ if ( 'term-archives' === $link_type ) {
+ $term_link = get_term_link( $term, $block['attrs']['gpDynamicTextTaxonomy'] );
+
+ if ( ! is_wp_error( $term_link ) ) {
+ $term_url = sprintf(
+ 'href="%s"',
+ esc_url( $term_link )
+ );
+
+ $term_button = str_replace( 'href="#"', $term_url, $term_button );
+ }
+ }
+
+ $term_buttons[] = $term_button;
+ }
+
+ if ( empty( $term_buttons ) ) {
+ return '';
+ }
+
+ $block_content = implode( '', $term_buttons );
+ } else {
+ return '';
+ }
+ }
+ }
+ }
+
+ if ( 'generateblocks/container' === $block['blockName'] ) {
+ if ( ! empty( $block['attrs']['gpRemoveContainerCondition'] ) ) {
+ $in_same_term = ! empty( $block['attrs']['gpAdjacentPostInSameTerm'] ) ? true : false;
+ $term_taxonomy = ! empty( $block['attrs']['gpAdjacentPostInSameTermTax'] ) ? $block['attrs']['gpAdjacentPostInSameTermTax'] : 'category';
+
+ if ( 'no-next-post' === $block['attrs']['gpRemoveContainerCondition'] ) {
+ $next_post = get_next_post( $in_same_term, '', $term_taxonomy );
+
+ if ( ! is_object( $next_post ) ) {
+ if ( ! empty( $block['attrs']['isGrid'] ) && ! empty( $block['attrs']['uniqueId'] ) ) {
+ return '';
+ } else {
+ return '';
+ }
+ }
+ }
+
+ if ( 'no-previous-post' === $block['attrs']['gpRemoveContainerCondition'] ) {
+ $previous_post = get_previous_post( $in_same_term, '', $term_taxonomy );
+
+ if ( ! is_object( $previous_post ) ) {
+ if ( ! empty( $block['attrs']['isGrid'] ) && ! empty( $block['attrs']['uniqueId'] ) ) {
+ return '';
+ } else {
+ return '';
+ }
+ }
+ }
+
+ if ( 'no-featured-image' === $block['attrs']['gpRemoveContainerCondition'] ) {
+ if ( ! has_post_thumbnail() ) {
+ return '';
+ }
+ }
+
+ if ( 'no-post-meta' === $block['attrs']['gpRemoveContainerCondition'] && ! empty( $block['attrs']['gpRemoveContainerConditionPostMeta'] ) ) {
+ $post_meta_check = get_post_meta( get_the_ID(), $block['attrs']['gpRemoveContainerConditionPostMeta'], true );
+
+ if ( ! $post_meta_check ) {
+ return '';
+ }
+ }
+ } elseif ( ! empty( $block['attrs']['url'] ) && ! empty( $block['attrs']['gpDynamicLinkType'] ) ) {
+ $source = ! empty( $block['attrs']['gpDynamicSource'] ) ? $block['attrs']['gpDynamicSource'] : 'current-post';
+
+ $id = $this->get_source_id( $source, $block['attrs'] );
+
+ if ( ! $id ) {
+ return '';
+ }
+ }
+ }
+
+ return $block_content;
+ }
+
+ /**
+ * Set the featured image as a GB background.
+ *
+ * @param string $url The current URL.
+ * @param array $settings The current settings.
+ */
+ public function set_background_image_url( $url, $settings ) {
+ if ( ! empty( $settings['gpDynamicImageBg'] ) ) {
+ $custom_field = '';
+ $source = ! empty( $settings['gpDynamicSource'] ) ? $settings['gpDynamicSource'] : 'current-post';
+ $id = $this->get_source_id( $source, $settings );
+
+ if ( ! $id ) {
+ return '';
+ }
+
+ if ( 'post-meta' === $settings['gpDynamicImageBg'] ) {
+ $custom_field = get_post_meta( $id, $settings['gpDynamicImageCustomField'], true );
+ }
+
+ if ( 'term-meta' === $settings['gpDynamicImageBg'] ) {
+ $custom_field = get_term_meta( get_queried_object_id(), $settings['gpDynamicImageCustomField'], true );
+ }
+
+ if ( 'user-meta' === $settings['gpDynamicImageBg'] ) {
+ $author_id = $this->get_author_id( $source, $settings );
+ $custom_field = $this->get_user_data( $author_id, $settings['gpDynamicImageCustomField'] );
+ }
+
+ if ( 'featured-image' === $settings['gpDynamicImageBg'] && has_post_thumbnail( $id ) ) {
+ $image_size = ! empty( $settings['bgImageSize'] ) ? $settings['bgImageSize'] : 'full';
+ $url = get_the_post_thumbnail_url( $id, $image_size );
+ } elseif ( ! empty( $custom_field ) ) {
+ if ( is_numeric( $custom_field ) ) {
+ $image_size = ! empty( $settings['bgImageSize'] ) ? $settings['bgImageSize'] : 'full';
+ $url = wp_get_attachment_image_url( $custom_field, $image_size );
+ } else {
+ $url = $custom_field;
+ }
+ } elseif ( empty( $settings['gpUseFallbackImageBg'] ) ) {
+ $url = '';
+ }
+ }
+
+ return $url;
+ }
+
+ /**
+ * Set the attributes for our main Container wrapper.
+ *
+ * @param array $attributes The existing attributes.
+ * @param array $settings The settings for the block.
+ */
+ public function set_container_attributes( $attributes, $settings ) {
+ if ( ! empty( $settings['bgImage'] ) && in_the_loop() ) {
+ if ( ! empty( $settings['gpDynamicImageBg'] ) ) {
+ $custom_field = '';
+ $source = ! empty( $settings['gpDynamicSource'] ) ? $settings['gpDynamicSource'] : 'current-post';
+ $id = $this->get_source_id( $source, $settings );
+
+ if ( ! $id ) {
+ return $attributes;
+ }
+
+ if ( 'post-meta' === $settings['gpDynamicImageBg'] ) {
+ $custom_field = get_post_meta( $id, $settings['gpDynamicImageCustomField'], true );
+ }
+
+ if ( 'term-meta' === $settings['gpDynamicImageBg'] ) {
+ $custom_field = get_term_meta( get_queried_object_id(), $settings['gpDynamicImageCustomField'], true );
+ }
+
+ if ( 'user-meta' === $settings['gpDynamicImageBg'] ) {
+ $author_id = $this->get_author_id( $source, $settings );
+ $custom_field = $this->get_user_data( $author_id, $settings['gpDynamicImageCustomField'] );
+ }
+
+ if ( 'featured-image' === $settings['gpDynamicImageBg'] && has_post_thumbnail( $id ) ) {
+ $image_size = ! empty( $settings['bgImageSize'] ) ? $settings['bgImageSize'] : 'full';
+ $url = get_the_post_thumbnail_url( $id, $image_size );
+ } elseif ( ! empty( $custom_field ) ) {
+ if ( is_numeric( $custom_field ) ) {
+ $image_size = ! empty( $settings['bgImageSize'] ) ? $settings['bgImageSize'] : 'full';
+ $url = wp_get_attachment_image_url( $custom_field, $image_size );
+ } else {
+ $url = $custom_field;
+ }
+ } elseif ( ! empty( $settings['gpUseFallbackImageBg'] ) ) {
+ if ( isset( $settings['bgImage']['id'] ) ) {
+ $image_size = ! empty( $settings['bgImageSize'] ) ? $settings['bgImageSize'] : 'full';
+ $image_src = wp_get_attachment_image_src( $settings['bgImage']['id'], $image_size );
+
+ if ( is_array( $image_src ) ) {
+ $url = $image_src[0];
+ } else {
+ $url = $settings['bgImage']['image']['url'];
+ }
+ } else {
+ $url = $settings['bgImage']['image']['url'];
+ }
+ }
+
+ if ( ! empty( $url ) ) {
+ $attributes['style'] = '--background-url:url(' . esc_url( $url ) . ')';
+ $attributes['class'] .= ' gb-has-dynamic-bg';
+ } else {
+ $attributes['class'] .= ' gb-no-dynamic-bg';
+ }
+ }
+ }
+
+ if ( ! empty( $settings['gpInlinePostMeta'] ) ) {
+ $attributes['class'] .= ' inline-post-meta-area';
+ }
+
+ return $attributes;
+ }
+
+ /**
+ * Set GenerateBlocks defaults.
+ *
+ * @param array $defaults The current defaults.
+ */
+ public function set_defaults( $defaults ) {
+ $defaults['container']['gpInlinePostMeta'] = false;
+ $defaults['container']['gpInlinePostMetaJustify'] = '';
+ $defaults['container']['gpInlinePostMetaJustifyTablet'] = '';
+ $defaults['container']['gpInlinePostMetaJustifyMobile'] = '';
+ $defaults['container']['gpDynamicImageBg'] = '';
+ $defaults['container']['gpDynamicImageCustomField'] = '';
+ $defaults['container']['gpDynamicLinkType'] = '';
+ $defaults['container']['gpDynamicSource'] = 'current-post';
+ $defaults['container']['gpDynamicSourceInSameTerm'] = false;
+ $defaults['headline']['gpDynamicTextTaxonomy'] = '';
+ $defaults['headline']['gpDynamicTextTaxonomySeparator'] = ', ';
+
+ return $defaults;
+ }
+
+ /**
+ * Generate our CSS for our options.
+ *
+ * @param string $name Name of the block.
+ * @param array $settings Our available settings.
+ * @param object $css Current desktop CSS object.
+ * @param object $desktop_css Current desktop-only CSS object.
+ * @param object $tablet_css Current tablet CSS object.
+ * @param object $tablet_only_css Current tablet-only CSS object.
+ * @param object $mobile_css Current mobile CSS object.
+ */
+ public function generate_css( $name, $settings, $css, $desktop_css, $tablet_css, $tablet_only_css, $mobile_css ) {
+ if ( 'container' === $name ) {
+ if ( ! empty( $settings['bgImage'] ) ) {
+ if ( 'element' === $settings['bgOptions']['selector'] ) {
+ $css->set_selector( '.gb-container-' . $settings['uniqueId'] . '.gb-has-dynamic-bg' );
+ } elseif ( 'pseudo-element' === $settings['bgOptions']['selector'] ) {
+ $css->set_selector( '.gb-container-' . $settings['uniqueId'] . '.gb-has-dynamic-bg:before' );
+ }
+
+ $css->add_property( 'background-image', 'var(--background-url)' );
+
+ if ( 'element' === $settings['bgOptions']['selector'] ) {
+ $css->set_selector( '.gb-container-' . $settings['uniqueId'] . '.gb-no-dynamic-bg' );
+ } elseif ( 'pseudo-element' === $settings['bgOptions']['selector'] ) {
+ $css->set_selector( '.gb-container-' . $settings['uniqueId'] . '.gb-no-dynamic-bg:before' );
+ }
+
+ $css->add_property( 'background-image', 'none' );
+ }
+
+ if ( ! empty( $settings['gpInlinePostMeta'] ) ) {
+ $css->set_selector( '.gb-container-' . $settings['uniqueId'] . '.inline-post-meta-area > .gb-inside-container' );
+ $css->add_property( 'display', 'flex' );
+ $css->add_property( 'align-items', 'center' );
+ $css->add_property( 'justify-content', $settings['gpInlinePostMetaJustify'] );
+
+ $tablet_css->set_selector( '.gb-container-' . $settings['uniqueId'] . '.inline-post-meta-area > .gb-inside-container' );
+ $tablet_css->add_property( 'justify-content', $settings['gpInlinePostMetaJustifyTablet'] );
+
+ $mobile_css->set_selector( '.gb-container-' . $settings['uniqueId'] . '.inline-post-meta-area > .gb-inside-container' );
+ $mobile_css->add_property( 'justify-content', $settings['gpInlinePostMetaJustifyMobile'] );
+ }
+ }
+ }
+
+ /**
+ * Set the attributes for our main Container wrapper.
+ *
+ * @param array $attributes The existing attributes.
+ * @param array $settings The settings for the block.
+ */
+ public function set_dynamic_container_url( $attributes, $settings ) {
+ $link_type = ! empty( $settings['gpDynamicLinkType'] ) ? $settings['gpDynamicLinkType'] : '';
+
+ if (
+ $link_type &&
+ isset( $settings['url'] ) &&
+ isset( $settings['linkType'] ) &&
+ '' !== $settings['url'] &&
+ ( 'wrapper' === $settings['linkType'] || 'hidden-link' === $settings['linkType'] )
+ ) {
+ if ( ! empty( $link_type ) ) {
+ $source = ! empty( $settings['gpDynamicSource'] ) ? $settings['gpDynamicSource'] : 'current-post';
+ $id = $this->get_source_id( $source, $settings );
+
+ if ( ! $id ) {
+ return $attributes;
+ }
+
+ if ( 'post' === $link_type ) {
+ $attributes['href'] = esc_url( get_permalink( $id ) );
+ }
+
+ if ( 'post-meta' === $link_type ) {
+ if ( ! empty( $settings['gpDynamicLinkCustomField'] ) ) {
+ $custom_field = get_post_meta( $id, $settings['gpDynamicLinkCustomField'], true );
+
+ if ( $custom_field ) {
+ $attributes['href'] = esc_url( $custom_field );
+ }
+ }
+ }
+ }
+ }
+
+ return $attributes;
+ }
+
+ /**
+ * Get our needed source ID.
+ *
+ * @param string $source The source attribute.
+ * @param array $attributes All block attributes.
+ */
+ public function get_source_id( $source, $attributes = array() ) {
+ $id = get_the_ID();
+
+ if ( 'next-post' === $source ) {
+ $in_same_term = ! empty( $attributes['gpDynamicSourceInSameTerm'] ) ? true : false;
+ $term_taxonomy = ! empty( $attributes['gpDynamicSourceInSameTermTaxonomy'] ) ? $attributes['gpDynamicSourceInSameTermTaxonomy'] : 'category';
+ $next_post = get_next_post( $in_same_term, '', $term_taxonomy );
+
+ if ( ! is_object( $next_post ) ) {
+ return false;
+ }
+
+ $id = $next_post->ID;
+ }
+
+ if ( 'previous-post' === $source ) {
+ $in_same_term = ! empty( $attributes['gpDynamicSourceInSameTerm'] ) ? true : false;
+ $term_taxonomy = ! empty( $attributes['gpDynamicSourceInSameTermTaxonomy'] ) ? $attributes['gpDynamicSourceInSameTermTaxonomy'] : 'category';
+ $previous_post = get_previous_post( $in_same_term, '', $term_taxonomy );
+
+ if ( ! is_object( $previous_post ) ) {
+ return false;
+ }
+
+ $id = $previous_post->ID;
+ }
+
+ return apply_filters( 'generate_dynamic_element_source_id', $id, $source, $attributes );
+ }
+
+ /**
+ * Get our author ID.
+ *
+ * @param string $source The source attribute.
+ * @param array $attributes All block attributes.
+ */
+ public function get_author_id( $source, $attributes ) {
+ global $post;
+ $post_info = $post;
+
+ if ( 'next-post' === $source ) {
+ $in_same_term = ! empty( $attributes['gpDynamicSourceInSameTerm'] ) ? true : false;
+ $term_taxonomy = ! empty( $attributes['gpDynamicSourceInSameTermTaxonomy'] ) ? $attributes['gpDynamicSourceInSameTermTaxonomy'] : 'category';
+ $next_post = get_next_post( $in_same_term, '', $term_taxonomy );
+
+ if ( ! is_object( $next_post ) ) {
+ return '';
+ }
+
+ $post_info = $next_post;
+ }
+
+ if ( 'previous-post' === $source ) {
+ $in_same_term = ! empty( $attributes['gpDynamicSourceInSameTerm'] ) ? true : false;
+ $term_taxonomy = ! empty( $attributes['gpDynamicSourceInSameTermTaxonomy'] ) ? $attributes['gpDynamicSourceInSameTermTaxonomy'] : 'category';
+ $previous_post = get_previous_post( $in_same_term, '', $term_taxonomy );
+
+ if ( ! is_object( $previous_post ) ) {
+ return '';
+ }
+
+ $post_info = $previous_post;
+ }
+
+ if ( isset( $post_info->post_author ) ) {
+ return $post_info->post_author;
+ }
+ }
+
+ /**
+ * Register our post meta.
+ */
+ public function register_meta() {
+ register_meta(
+ 'post',
+ '_generate_block_element_editor_width',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'sanitize_int' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_block_element_editor_width_unit',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => 'sanitize_text_field',
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_block_type',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => 'sanitize_text_field',
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_hook',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => 'sanitize_text_field',
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_custom_hook',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'sanitize_custom_hook' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_hook_priority',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'sanitize_int' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_post_meta_location',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'sanitize_text_field' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_post_loop_item_tagname',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'sanitize_text_field' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_disable_primary_post_meta',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'boolean',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'rest_sanitize_boolean' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_disable_secondary_post_meta',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'boolean',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'rest_sanitize_boolean' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_disable_title',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'boolean',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'rest_sanitize_boolean' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_disable_featured_image',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'boolean',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'rest_sanitize_boolean' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_use_theme_post_container',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'boolean',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'rest_sanitize_boolean' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_use_archive_navigation_container',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'boolean',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'rest_sanitize_boolean' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_disable_post_navigation',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'boolean',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'rest_sanitize_boolean' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_disable_archive_navigation',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'boolean',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'rest_sanitize_boolean' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_post_loop_item_display',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'sanitize_text_field' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_post_loop_item_display_tax',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'sanitize_text_field' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_post_loop_item_display_term',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'sanitize_text_field' ),
+ )
+ );
+
+ register_meta(
+ 'post',
+ '_generate_post_loop_item_display_post_meta',
+ array(
+ 'object_subtype' => 'gp_elements',
+ 'type' => 'string',
+ 'show_in_rest' => true,
+ 'auth_callback' => '__return_true',
+ 'single' => true,
+ 'sanitize_callback' => array( $this, 'sanitize_text_field' ),
+ )
+ );
+ }
+
+ /**
+ * Sanitize our custom hook field.
+ *
+ * @param string $value The value to sanitize.
+ */
+ public function sanitize_custom_hook( $value ) {
+ $not_allowed = array(
+ 'muplugins_loaded',
+ 'registered_taxonomy',
+ 'plugins_loaded',
+ 'setup_theme',
+ 'after_setup_theme',
+ 'init',
+ 'widgets_init',
+ 'wp_loaded',
+ 'pre_get_posts',
+ 'wp',
+ 'template_redirect',
+ 'get_header',
+ 'wp_enqueue_scripts',
+ 'the_post',
+ 'dynamic_sidebar',
+ 'get_footer',
+ 'get_sidebar',
+ 'wp_print_footer_scripts',
+ 'shutdown',
+ );
+
+ if ( in_array( $value, $not_allowed ) ) {
+ return '';
+ }
+
+ return sanitize_key( $value );
+ }
+
+ /**
+ * Sanitize number values that can be empty.
+ *
+ * @param int $value The value to sanitize.
+ */
+ public function sanitize_int( $value ) {
+ if ( ! is_numeric( $value ) ) {
+ return '';
+ }
+
+ return absint( $value );
+ }
+
+ /**
+ * Get our image size names and dimensions.
+ */
+ public function get_image_sizes() {
+ global $_wp_additional_image_sizes;
+
+ $default_image_sizes = get_intermediate_image_sizes();
+
+ foreach ( $default_image_sizes as $size ) {
+ $image_sizes[ $size ]['width'] = intval( get_option( "{$size}_size_w" ) );
+ $image_sizes[ $size ]['height'] = intval( get_option( "{$size}_size_h" ) );
+ $image_sizes[ $size ]['crop'] = get_option( "{$size}_crop" ) ? get_option( "{$size}_crop" ) : false;
+ }
+
+ if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) {
+ $image_sizes = array_merge( $image_sizes, $_wp_additional_image_sizes );
+ }
+
+ return $image_sizes;
+ }
+
+ /**
+ * Add front-end CSS.
+ */
+ public function frontend_css() {
+ require_once GP_LIBRARY_DIRECTORY . 'class-make-css.php';
+ $css = new GeneratePress_Pro_CSS();
+
+ $css->set_selector( '.dynamic-author-image-rounded' );
+ $css->add_property( 'border-radius', '100%' );
+
+ $css->set_selector( '.dynamic-featured-image, .dynamic-author-image' );
+ $css->add_property( 'vertical-align', 'middle' );
+
+ $css->set_selector( '.one-container.blog .dynamic-content-template:not(:last-child), .one-container.archive .dynamic-content-template:not(:last-child)' );
+ $css->add_property( 'padding-bottom', '0px' );
+
+ $css->set_selector( '.dynamic-entry-excerpt > p:last-child' );
+ $css->add_property( 'margin-bottom', '0px' );
+
+ wp_add_inline_style( 'generate-style', $css->css_output() );
+ }
+}
+
+GeneratePress_Block_Elements::get_instance();
diff --git a/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/class-block.php b/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/class-block.php
new file mode 100644
index 00000000..051d8e43
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/class-block.php
@@ -0,0 +1,469 @@
+post_id = $post_id;
+ $this->type = get_post_meta( $post_id, '_generate_block_type', true );
+ $has_content_template_condition = get_post_meta( $post_id, '_generate_post_loop_item_display', true );
+
+ // Take over the $post_id temporarily if this is a child block.
+ // This allows us to inherit the parent block Display Rules.
+ if ( 'content-template' === $this->type && $has_content_template_condition ) {
+ $parent_block = wp_get_post_parent_id( $post_id );
+
+ if ( ! empty( $parent_block ) ) {
+ $this->has_parent = true;
+ $post_id = $parent_block;
+ }
+ }
+
+ $display_conditions = get_post_meta( $post_id, '_generate_element_display_conditions', true ) ? get_post_meta( $post_id, '_generate_element_display_conditions', true ) : array();
+ $exclude_conditions = get_post_meta( $post_id, '_generate_element_exclude_conditions', true ) ? get_post_meta( $post_id, '_generate_element_exclude_conditions', true ) : array();
+ $user_conditions = get_post_meta( $post_id, '_generate_element_user_conditions', true ) ? get_post_meta( $post_id, '_generate_element_user_conditions', true ) : array();
+
+ $display = apply_filters(
+ 'generate_block_element_display',
+ GeneratePress_Conditions::show_data(
+ $display_conditions,
+ $exclude_conditions,
+ $user_conditions
+ ),
+ $post_id
+ );
+
+ /**
+ * Simplify filter name.
+ *
+ * @since 2.0.0
+ */
+ $display = apply_filters(
+ 'generate_element_display',
+ $display,
+ $post_id
+ );
+
+ // Restore our actual post ID if it's been changed.
+ if ( 'content-template' === $this->type && $has_content_template_condition ) {
+ $post_id = $this->post_id;
+ }
+
+ if ( $display ) {
+ global $generate_elements;
+
+ $generate_elements[ $post_id ] = array(
+ 'is_block_element' => true,
+ 'type' => $this->type,
+ 'id' => $post_id,
+ );
+
+ $hook = get_post_meta( $post_id, '_generate_hook', true );
+ $custom_hook = get_post_meta( $post_id, '_generate_custom_hook', true );
+ $priority = get_post_meta( $post_id, '_generate_hook_priority', true );
+
+ if ( '' === $priority ) {
+ $priority = 10;
+ }
+
+ switch ( $this->type ) {
+ case 'site-header':
+ $hook = 'generate_header';
+ break;
+
+ case 'site-footer':
+ $hook = 'generate_footer';
+ break;
+
+ case 'right-sidebar':
+ $hook = 'generate_before_right_sidebar_content';
+ break;
+
+ case 'left-sidebar':
+ $hook = 'generate_before_left_sidebar_content';
+ break;
+
+ case 'content-template':
+ $hook = 'generate_before_do_template_part';
+ break;
+
+ case 'loop-template':
+ $hook = 'generate_before_main_content';
+ break;
+
+ case 'search-modal':
+ $hook = 'generate_inside_search_modal';
+ break;
+ }
+
+ if ( 'custom' === $hook && $custom_hook ) {
+ $hook = $custom_hook;
+ }
+
+ if ( 'post-meta-template' === $this->type ) {
+ $post_meta_location = get_post_meta( $post_id, '_generate_post_meta_location', true );
+
+ if ( '' === $post_meta_location || 'after-post-title' === $post_meta_location ) {
+ $hook = 'generate_after_entry_title';
+
+ if ( is_page() ) {
+ $hook = 'generate_after_page_title';
+ }
+ } elseif ( 'before-post-title' === $post_meta_location ) {
+ $hook = 'generate_before_entry_title';
+
+ if ( is_page() ) {
+ $hook = 'generate_before_page_title';
+ }
+ } elseif ( 'after-content' === $post_meta_location ) {
+ $hook = 'generate_after_content';
+ }
+ }
+
+ if ( ! $hook ) {
+ return;
+ }
+
+ if ( 'generate_header' === $hook ) {
+ remove_action( 'generate_header', 'generate_construct_header' );
+ }
+
+ if ( 'generate_footer' === $hook ) {
+ remove_action( 'generate_footer', 'generate_construct_footer' );
+ }
+
+ if ( 'content-template' === $this->type && ! $this->has_parent ) {
+ add_filter( 'generate_do_template_part', array( $this, 'do_template_part' ) );
+ }
+
+ if ( 'loop-template' === $this->type ) {
+ add_filter( 'generate_has_default_loop', '__return_false' );
+ add_filter( 'generate_blog_columns', '__return_false' );
+ add_filter( 'option_generate_blog_settings', array( $this, 'filter_blog_settings' ) );
+ add_filter( 'post_class', array( $this, 'post_classes' ) );
+ }
+
+ if ( 'search-modal' === $this->type ) {
+ remove_action( 'generate_inside_search_modal', 'generate_do_search_fields' );
+ }
+
+ add_action( 'wp', array( $this, 'remove_elements' ), 100 );
+ add_action( esc_attr( $hook ), array( $this, 'build_hook' ), absint( $priority ) );
+ add_filter( 'generateblocks_do_content', array( $this, 'do_block_content' ) );
+ }
+ }
+
+ /**
+ * Disable our post loop items if needed.
+ *
+ * @param boolean $do Whether to display the default post loop item or not.
+ */
+ public function do_template_part( $do ) {
+ if ( GeneratePress_Elements_Helper::should_render_content_template( $this->post_id ) ) {
+ return false;
+ }
+
+ return $do;
+ }
+
+ /**
+ * Tell GenerateBlocks about our block element content so it can build CSS.
+ *
+ * @since 1.11.0
+ * @param string $content The existing content.
+ */
+ public function do_block_content( $content ) {
+ if ( has_blocks( $this->post_id ) ) {
+ $block_element = get_post( $this->post_id );
+
+ if ( ! $block_element || 'gp_elements' !== $block_element->post_type ) {
+ return $content;
+ }
+
+ if ( 'publish' !== $block_element->post_status || ! empty( $block_element->post_password ) ) {
+ return $content;
+ }
+
+ $content .= $block_element->post_content;
+ }
+
+ return $content;
+ }
+
+ /**
+ * Remove existing sidebar widgets.
+ *
+ * @since 1.11.0
+ * @param array $widgets The existing widgets.
+ */
+ public function remove_sidebar_widgets( $widgets ) {
+ if ( 'right-sidebar' === $this->type ) {
+ unset( $widgets['sidebar-1'] );
+ }
+
+ if ( 'left-sidebar' === $this->type ) {
+ unset( $widgets['sidebar-2'] );
+ }
+
+ return $widgets;
+ }
+
+ /**
+ * Filter some of our blog settings.
+ *
+ * @param array $settings Existing blog settings.
+ */
+ public function filter_blog_settings( $settings ) {
+ if ( 'loop-template' === $this->type ) {
+ $settings['infinite_scroll'] = false;
+ $settings['read_more_button'] = false;
+ }
+
+ return $settings;
+ }
+
+ /**
+ * Add class to our loop template item posts.
+ *
+ * @param array $classes Post classes.
+ */
+ public function post_classes( $classes ) {
+ if ( 'loop-template' === $this->type && is_main_query() ) {
+ $classes[] = 'is-loop-template-item';
+ }
+
+ return $classes;
+ }
+
+ /**
+ * Remove existing elements.
+ *
+ * @since 2.0.0
+ */
+ public function remove_elements() {
+ if ( 'right-sidebar' === $this->type || 'left-sidebar' === $this->type ) {
+ add_filter( 'sidebars_widgets', array( $this, 'remove_sidebar_widgets' ) );
+ add_filter( 'generate_show_default_sidebar_widgets', '__return_false' );
+ }
+
+ if ( 'page-hero' === $this->type ) {
+ $disable_title = get_post_meta( $this->post_id, '_generate_disable_title', true );
+ $disable_featured_image = get_post_meta( $this->post_id, '_generate_disable_featured_image', true );
+ $disable_primary_post_meta = get_post_meta( $this->post_id, '_generate_disable_primary_post_meta', true );
+
+ if ( $disable_title ) {
+ if ( is_singular() ) {
+ add_filter( 'generate_show_title', '__return_false' );
+ }
+
+ remove_action( 'generate_archive_title', 'generate_archive_title' );
+ remove_filter( 'get_the_archive_title', 'generate_filter_the_archive_title' );
+
+ // WooCommerce removal.
+ if ( class_exists( 'WooCommerce' ) ) {
+ remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
+ add_filter( 'woocommerce_show_page_title', '__return_false' );
+ remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description' );
+ remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description' );
+ }
+ }
+
+ if ( $disable_primary_post_meta ) {
+ remove_action( 'generate_after_entry_title', 'generate_post_meta' );
+ }
+
+ if ( $disable_featured_image && is_singular() ) {
+ remove_action( 'generate_after_entry_header', 'generate_blog_single_featured_image' );
+ remove_action( 'generate_before_content', 'generate_blog_single_featured_image' );
+ remove_action( 'generate_after_header', 'generate_blog_single_featured_image' );
+ remove_action( 'generate_before_content', 'generate_featured_page_header_inside_single' );
+ remove_action( 'generate_after_header', 'generate_featured_page_header' );
+ }
+ }
+
+ if ( 'post-meta-template' === $this->type ) {
+ $post_meta_location = get_post_meta( $this->post_id, '_generate_post_meta_location', true );
+ $disable_primary_post_meta = get_post_meta( $this->post_id, '_generate_disable_primary_post_meta', true );
+ $disable_secondary_post_meta = get_post_meta( $this->post_id, '_generate_disable_secondary_post_meta', true );
+
+ if ( '' === $post_meta_location || 'after-post-title' === $post_meta_location || 'custom' === $post_meta_location ) {
+ if ( $disable_primary_post_meta ) {
+ remove_action( 'generate_after_entry_title', 'generate_post_meta' );
+ }
+ } elseif ( 'before-post-title' === $post_meta_location || 'custom' === $post_meta_location ) {
+ if ( $disable_primary_post_meta ) {
+ remove_action( 'generate_after_entry_title', 'generate_post_meta' );
+ }
+ } elseif ( 'after-content' === $post_meta_location || 'custom' === $post_meta_location ) {
+ if ( $disable_secondary_post_meta ) {
+ remove_action( 'generate_after_entry_content', 'generate_footer_meta' );
+ }
+ }
+ }
+
+ if ( 'post-navigation-template' === $this->type ) {
+ $disable_post_navigation = get_post_meta( $this->post_id, '_generate_disable_post_navigation', true );
+
+ if ( $disable_post_navigation ) {
+ add_filter( 'generate_footer_entry_meta_items', array( $this, 'disable_post_navigation' ) );
+ }
+ }
+
+ if ( 'archive-navigation-template' === $this->type ) {
+ $disable_archive_navigation = get_post_meta( $this->post_id, '_generate_disable_archive_navigation', true );
+
+ if ( $disable_archive_navigation ) {
+ remove_action( 'generate_after_loop', 'generate_do_post_navigation' );
+ }
+ }
+ }
+
+ /**
+ * Disable post navigation.
+ *
+ * @param array $items The post meta items.
+ */
+ public function disable_post_navigation( $items ) {
+ return array_diff( $items, array( 'post-navigation' ) );
+ }
+
+ /**
+ * Builds the HTML structure for Page Headers.
+ *
+ * @since 1.11.0
+ */
+ public function build_hook() {
+ $post_id = $this->post_id;
+
+ if ( 'content-template' === $this->type ) {
+ // Check for child templates if this isn't already one.
+ if ( ! $this->has_parent ) {
+ $children = get_posts(
+ array(
+ 'post_type' => 'gp_elements',
+ 'post_parent' => $post_id,
+ 'order' => 'ASC',
+ 'orderby' => 'menu_order',
+ 'no_found_rows' => true,
+ 'post_status' => 'publish',
+ 'numberposts' => 20,
+ 'fields' => 'ids',
+ )
+ );
+
+ if ( ! empty( $children ) ) {
+ // Loop through any child templates and overwrite $post_id if applicable.
+ foreach ( (array) $children as $child_id ) {
+ if ( GeneratePress_Elements_Helper::should_render_content_template( $child_id ) ) {
+ $post_id = $child_id;
+ break;
+ }
+ }
+ } else {
+ // No children, check if parent should render.
+ if ( ! GeneratePress_Elements_Helper::should_render_content_template( $post_id ) ) {
+ return;
+ }
+ }
+ } else {
+ // No children, check if template should render.
+ if ( ! GeneratePress_Elements_Helper::should_render_content_template( $post_id ) ) {
+ return;
+ }
+ }
+
+ // Don't display child elements - they will replace the parent element if applicable.
+ if ( $this->has_parent ) {
+ return;
+ }
+
+ $tag_name_value = get_post_meta( $post_id, '_generate_post_loop_item_tagname', true );
+ $use_theme_container = get_post_meta( $post_id, '_generate_use_theme_post_container', true );
+
+ if ( $tag_name_value ) {
+ $tag_name = $tag_name_value;
+ } else {
+ $tag_name = 'article';
+ }
+
+ printf(
+ '<%s id="%s" class="%s">',
+ esc_attr( $tag_name ),
+ 'post-' . get_the_ID(),
+ implode( ' ', get_post_class( 'dynamic-content-template' ) ) // phpcs:ignore -- No escaping needed.
+ );
+
+ if ( $use_theme_container ) {
+ echo '
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+ />
+
+ >
+
+
+
+
+
+
+ />
+
+
+
+
+
+
+
+
+ />
+
+
+
+
+
+
+
+
+
+ DISALLOW_FILE_EDIT'
+ );
+ ?>
+
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+ />
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+ />
+
+ >
+
+
+
+
+ ?
+
+
+ />
+
+ >
+
+
+
+
+ ?
+
+
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ?
+
+
+
+
+ >
+
+
+
+
+ ?
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+ />
+
+ >
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ />
+
+
+
+
+
+
+
+
+ />
+
+
+
+
+
+
+
+
+ />
+
+
+
+
+
+
+
+
+ />
+
+
+
+
+
+
+
+
+ />
+
+
+
+
+
+
+
+
+ />
+
+
+
+
+
+
+
+
+ />
+
+
+
+
+
+
+
+
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ px
+
+
';
+
+ if ( 'custom' === $hook_location ) {
+ $custom_hook = get_post_meta( $post_id, '_generate_custom_hook', true );
+ echo '' . esc_html( $custom_hook ) . '';
+ } else {
+ echo '' . esc_html( $hook_location ) . '';
+ }
+ }
+ }
+ }
+
+ if ( 'header' === $type ) {
+ echo esc_html__( 'Header', 'gp-premium' );
+ }
+
+ if ( 'hook' === $type ) {
+ echo esc_html__( 'Hook', 'gp-premium' );
+
+ if ( $hook_location ) {
+ echo '
';
+
+ if ( 'custom' === $hook_location ) {
+ $custom_hook = get_post_meta( $post_id, '_generate_custom_hook', true );
+ echo '' . esc_html( $custom_hook ) . '';
+ } else {
+ echo '' . esc_html( $hook_location ) . '';
+ }
+ }
+ }
+
+ if ( 'layout' === $type ) {
+ echo esc_html__( 'Layout', 'gp-premium' );
+ }
+ break;
+
+ case 'location':
+ $location = get_post_meta( $post_id, '_generate_element_display_conditions', true );
+ $parent_block = wp_get_post_parent_id( $post_id );
+
+ if ( $location ) {
+ foreach ( (array) $location as $data ) {
+ echo esc_html( GeneratePress_Conditions::get_saved_label( $data ) );
+ echo '
';
+ }
+ } elseif ( ! empty( $parent_block ) ) {
+ echo esc_html__( 'Inherit from parent', 'gp-premium' );
+ } else {
+ echo esc_html__( 'Not set', 'gp-premium' );
+ }
+ break;
+
+ case 'exclusions':
+ $location = get_post_meta( $post_id, '_generate_element_exclude_conditions', true );
+
+ if ( $location ) {
+ foreach ( (array) $location as $data ) {
+ echo esc_html( GeneratePress_Conditions::get_saved_label( $data ) );
+ echo '
';
+ }
+ }
+ break;
+
+ case 'users':
+ $users = get_post_meta( $post_id, '_generate_element_user_conditions', true );
+
+ if ( $users ) {
+ foreach ( (array) $users as $data ) {
+ if ( strpos( $data, ':' ) !== false ) {
+ $data = substr( $data, strpos( $data, ':' ) + 1 );
+ }
+
+ $return = ucwords( str_replace( '_', ' ', $data ) );
+
+ echo esc_html( $return ) . '
';
+ }
+ }
+ break;
+ }
+ }
+
+ /**
+ * Create our admin menu item.
+ *
+ * @since 1.7
+ */
+ public function menu_item() {
+ add_submenu_page(
+ 'themes.php',
+ esc_html__( 'Elements', 'gp-premium' ),
+ esc_html__( 'Elements', 'gp-premium' ),
+ apply_filters( 'generate_elements_admin_menu_capability', 'manage_options' ),
+ 'edit.php?post_type=gp_elements'
+ );
+ }
+
+ /**
+ * Make sure our admin menu item is highlighted.
+ *
+ * @since 1.7
+ */
+ public function fix_current_item() {
+ global $parent_file, $submenu_file, $post_type;
+
+ if ( 'gp_elements' === $post_type ) {
+ $parent_file = 'themes.php'; // phpcs:ignore
+ $submenu_file = 'edit.php?post_type=gp_elements'; // phpcs:ignore
+ }
+ }
+
+ /**
+ * Add scripts to the edit/post area of Elements.
+ *
+ * @since 1.11.0
+ * @param string $hook The current hook for the page.
+ */
+ public function admin_scripts( $hook ) {
+ if ( ! function_exists( 'get_current_screen' ) ) {
+ return;
+ }
+
+ $current_screen = get_current_screen();
+
+ if ( 'edit.php' === $hook || 'post.php' === $hook ) {
+ if ( 'gp_elements' === $current_screen->post_type ) {
+ wp_enqueue_script( 'generate-elements', plugin_dir_url( __FILE__ ) . 'assets/admin/elements.js', array( 'jquery' ), GP_PREMIUM_VERSION, true );
+ wp_enqueue_style( 'generate-elements', plugin_dir_url( __FILE__ ) . 'assets/admin/elements.css', array(), GP_PREMIUM_VERSION );
+ }
+ }
+ }
+
+ /**
+ * Build the Add New Element modal.
+ *
+ * @since 1.11.0
+ */
+ public function element_modal() {
+ if ( ! function_exists( 'get_current_screen' ) ) {
+ return;
+ }
+
+ $current_screen = get_current_screen();
+
+ if ( 'edit-gp_elements' === $current_screen->id || 'gp_elements' === $current_screen->id ) {
+ ?>
+
+ 'gp_elements',
+ 'no_found_rows' => true,
+ 'post_status' => 'publish',
+ 'numberposts' => 500, // phpcs:ignore
+ 'fields' => 'ids',
+ 'suppress_filters' => false,
+ );
+
+ $custom_args = apply_filters(
+ 'generate_elements_custom_args',
+ array(
+ 'order' => 'ASC',
+ )
+ );
+
+ $args = array_merge( $args, $custom_args );
+
+ // Prevent Polylang from altering the query.
+ if ( function_exists( 'pll_get_post_language' ) ) {
+ $args['lang'] = '';
+ }
+
+ $posts = get_posts( $args );
+
+ foreach ( $posts as $post_id ) {
+ $post_id = apply_filters( 'generate_element_post_id', $post_id );
+ $type = get_post_meta( $post_id, '_generate_element_type', true );
+
+ if ( 'hook' === $type ) {
+ new GeneratePress_Hook( $post_id );
+ }
+
+ if ( 'header' === $type && ! GeneratePress_Hero::$instances ) {
+ new GeneratePress_Hero( $post_id );
+ }
+
+ if ( 'layout' === $type ) {
+ new GeneratePress_Site_Layout( $post_id );
+ }
+
+ if ( 'block' === $type ) {
+ new GeneratePress_Block_Element( $post_id );
+ }
+ }
+}
+
+add_filter( 'generate_dashboard_tabs', 'generate_elements_dashboard_tab' );
+/**
+ * Add the Sites tab to our Dashboard tabs.
+ *
+ * @since 1.6
+ *
+ * @param array $tabs Existing tabs.
+ * @return array New tabs.
+ */
+function generate_elements_dashboard_tab( $tabs ) {
+ $screen = get_current_screen();
+
+ $tabs['Elements'] = array(
+ 'name' => __( 'Elements', 'gp-premium' ),
+ 'url' => admin_url( 'edit.php?post_type=gp_elements' ),
+ 'class' => 'edit-gp_elements' === $screen->id ? 'active' : '',
+ );
+
+ return $tabs;
+}
+
+add_filter( 'generate_dashboard_screens', 'generate_elements_dashboard_screen' );
+/**
+ * Add the Sites tab to our Dashboard screens.
+ *
+ * @since 2.1.0
+ *
+ * @param array $screens Existing screens.
+ * @return array New screens.
+ */
+function generate_elements_dashboard_screen( $screens ) {
+ $screens[] = 'edit-gp_elements';
+
+ return $screens;
+}
+
+add_filter( 'generate_element_post_id', 'generate_elements_ignore_languages' );
+/**
+ * Disable Polylang elements if their language doesn't match.
+ * We disable their automatic quering so Elements with no language display by default.
+ *
+ * @since 1.8
+ *
+ * @param int $post_id The current post ID.
+ * @return bool|int
+ */
+function generate_elements_ignore_languages( $post_id ) {
+ if ( function_exists( 'pll_get_post_language' ) && function_exists( 'pll_current_language' ) ) {
+ $language = pll_get_post_language( $post_id, 'locale' );
+ $disable = get_post_meta( $post_id, '_generate_element_ignore_languages', true );
+
+ if ( $disable ) {
+ return $post_id;
+ }
+
+ if ( $language && $language !== pll_current_language( 'locale' ) ) { // phpcs:ignore -- Using Yoda check I am.
+ return false;
+ }
+ }
+
+ return $post_id;
+}
+
+add_action( 'save_post_wp_block', 'generate_elements_wp_block_update', 10, 2 );
+/**
+ * Regenerate the GenerateBlocks CSS file when a re-usable block is saved.
+ *
+ * @since 1.11.0
+ * @param int $post_id The post ID.
+ * @param object $post The post object.
+ */
+function generate_elements_wp_block_update( $post_id, $post ) {
+ $is_autosave = wp_is_post_autosave( $post_id );
+ $is_revision = wp_is_post_revision( $post_id );
+
+ if ( $is_autosave || $is_revision || ! current_user_can( 'edit_post', $post_id ) ) {
+ return $post_id;
+ }
+
+ if ( isset( $post->post_content ) ) {
+ if ( strpos( $post->post_content, 'wp:generateblocks' ) !== false ) {
+ global $wpdb;
+
+ $option = get_option( 'generateblocks_dynamic_css_posts', array() );
+
+ $posts = $wpdb->get_col( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_generateblocks_reusable_blocks'" );
+
+ foreach ( (array) $posts as $id ) {
+ $display_conditions = get_post_meta( $id, '_generate_element_display_conditions', true );
+
+ if ( $display_conditions ) {
+ foreach ( (array) $display_conditions as $condition ) {
+ if ( 'general:site' === $condition['rule'] ) {
+ $option = array();
+ break;
+ }
+
+ if ( $condition['object'] && isset( $option[ $condition['object'] ] ) ) {
+ unset( $option[ $condition['object'] ] );
+ }
+ }
+ }
+ }
+
+ update_option( 'generateblocks_dynamic_css_posts', $option );
+ }
+ }
+
+}
+
+add_filter( 'generate_do_block_element_content', 'generate_add_block_element_content_filters' );
+/**
+ * Apply content filters to our block elements.
+ *
+ * @since 1.11.0
+ * @param string $content The block element content.
+ */
+function generate_add_block_element_content_filters( $content ) {
+ $content = shortcode_unautop( $content );
+ $content = do_shortcode( $content );
+
+ if ( function_exists( 'wp_filter_content_tags' ) ) {
+ $content = wp_filter_content_tags( $content );
+ } elseif ( function_exists( 'wp_make_content_images_responsive' ) ) {
+ $content = wp_make_content_images_responsive( $content );
+ }
+
+ return $content;
+}
+
+add_action( 'admin_bar_menu', 'generate_add_elements_admin_bar', 100 );
+/**
+ * Add the Elementd admin bar item.
+ *
+ * @since 2.0.0
+ */
+function generate_add_elements_admin_bar() {
+ $current_user_can = 'manage_options';
+
+ if ( apply_filters( 'generate_elements_metabox_ajax_allow_editors', false ) ) {
+ $current_user_can = 'edit_posts';
+ }
+
+ if ( ! current_user_can( $current_user_can ) ) {
+ return;
+ }
+
+ global $wp_admin_bar;
+ global $generate_elements;
+
+ $title = __( 'Elements', 'gp-premium' );
+ $count = ! empty( $generate_elements ) ? count( $generate_elements ) : 0;
+
+ // Prevent "Entire Site" Elements from being counted on non-edit pages in the admin.
+ if ( is_admin() && function_exists( 'get_current_screen' ) ) {
+ $screen = get_current_screen();
+
+ if ( ! isset( $screen->is_block_editor ) || ! $screen->is_block_editor ) {
+ $count = 0;
+ }
+
+ if ( 'edit' !== $screen->parent_base ) {
+ $count = 0;
+ }
+ }
+
+ if ( $count > 0 ) {
+ $title = sprintf(
+ /* translators: Active Element count. */
+ __( 'Elements (%s)', 'gp-premium' ),
+ $count
+ );
+ }
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'id' => 'gp_elements-menu',
+ 'title' => $title,
+ 'href' => esc_url( admin_url( 'edit.php?post_type=gp_elements' ) ),
+ )
+ );
+
+ if ( ! empty( $generate_elements ) ) {
+ // Prevent "Entire Site" Elements from being counted on non-edit pages in the admin.
+ if ( is_admin() && function_exists( 'get_current_screen' ) ) {
+ $screen = get_current_screen();
+
+ if ( ! isset( $screen->is_block_editor ) || ! $screen->is_block_editor ) {
+ return;
+ }
+
+ if ( 'edit' !== $screen->parent_base ) {
+ return;
+ }
+ }
+
+ foreach ( (array) $generate_elements as $key => $data ) {
+ $label = GeneratePress_Elements_Helper::get_element_type_label( $data['type'] );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'id' => 'element-' . absint( $data['id'] ),
+ 'parent' => 'gp_elements-menu',
+ 'title' => get_the_title( $data['id'] ) . ' (' . $label . ')',
+ 'href' => get_edit_post_link( $data['id'] ),
+ )
+ );
+ }
+ }
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/gp-premium/general/class-external-file-css.php b/wp-content/upgrade-temp-backup/plugins/gp-premium/general/class-external-file-css.php
new file mode 100644
index 00000000..9f59b66c
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/gp-premium/general/class-external-file-css.php
@@ -0,0 +1,449 @@
+register_control_type( 'GeneratePress_Action_Button_Control' );
+ }
+
+ $wp_customize->add_setting(
+ 'generate_settings[css_print_method]',
+ array(
+ 'default' => $defaults['css_print_method'],
+ 'type' => 'option',
+ 'sanitize_callback' => 'generate_premium_sanitize_choices',
+ )
+ );
+
+ $wp_customize->add_control(
+ 'generate_settings[css_print_method]',
+ array(
+ 'type' => 'select',
+ 'label' => __( 'Dynamic CSS Print Method', 'gp-premium' ),
+ 'description' => __( 'Generating your dynamic CSS in an external file offers significant performance advantages.', 'gp-premium' ),
+ 'section' => 'generate_general_section',
+ 'choices' => array(
+ 'inline' => __( 'Inline Embedding', 'gp-premium' ),
+ 'file' => __( 'External File', 'gp-premium' ),
+ ),
+ 'settings' => 'generate_settings[css_print_method]',
+ )
+ );
+
+ $wp_customize->add_control(
+ new GeneratePress_Action_Button_Control(
+ $wp_customize,
+ 'generate_regenerate_external_css_file',
+ array(
+ 'section' => 'generate_general_section',
+ 'data_type' => 'regenerate_external_css',
+ 'nonce' => esc_html( wp_create_nonce( 'generatepress_regenerate_css_file' ) ),
+ 'label' => __( 'Regenerate CSS File', 'gp-premium' ),
+ 'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
+ 'active_callback' => 'generate_is_using_external_css_file_callback',
+ )
+ )
+ );
+ }
+
+ /**
+ * Set our CSS Print Method.
+ *
+ * @param string $method The existing method.
+ */
+ public function set_print_method( $method ) {
+ if ( ! function_exists( 'generate_get_option' ) ) {
+ return $method;
+ }
+
+ return generate_get_option( 'css_print_method' );
+ }
+
+ /**
+ * Determine if we're using file mode or inline mode.
+ */
+ public function mode() {
+ $mode = generate_get_css_print_method();
+
+ if ( 'file' === $mode && $this->needs_update() ) {
+ $data = get_option( 'generatepress_dynamic_css_data', array() );
+
+ if ( ! isset( $data['updated_time'] ) ) {
+ // No time set, so set the current time minus 5 seconds so the file is still generated.
+ $data['updated_time'] = time() - 5;
+ update_option( 'generatepress_dynamic_css_data', $data );
+ }
+
+ // Only allow processing 1 file every 5 seconds.
+ $current_time = (int) time();
+ $last_time = (int) $data['updated_time'];
+
+ if ( 5 <= ( $current_time - $last_time ) ) {
+
+ // Attempt to write to the file.
+ $mode = ( $this->can_write() && $this->make_css() ) ? 'file' : 'inline';
+
+ // Does again if the file exists.
+ if ( 'file' === $mode ) {
+ $mode = ( file_exists( $this->file( 'path' ) ) ) ? 'file' : 'inline';
+ }
+ }
+ }
+
+ return $mode;
+ }
+
+ /**
+ * Set things up.
+ */
+ public function init() {
+ if ( 'file' === $this->mode() ) {
+ add_filter( 'generate_using_dynamic_css_external_file', '__return_true' );
+ add_filter( 'generate_dynamic_css_skip_cache', '__return_true', 20 );
+
+ // Remove inline CSS in GP < 3.0.0.
+ if ( ! function_exists( 'generate_get_dynamic_css' ) && function_exists( 'generate_enqueue_dynamic_css' ) ) {
+ remove_action( 'wp_enqueue_scripts', 'generate_enqueue_dynamic_css', 50 );
+ }
+ }
+ }
+
+ /**
+ * Enqueue the dynamic CSS.
+ */
+ public function enqueue_dynamic_css() {
+ if ( 'file' === $this->mode() ) {
+ wp_enqueue_style( 'generatepress-dynamic', esc_url( $this->file( 'uri' ) ), array( 'generate-style' ), null ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
+
+ // Move the child theme after our dynamic stylesheet.
+ if ( is_child_theme() && wp_style_is( 'generate-child', 'enqueued' ) ) {
+ wp_dequeue_style( 'generate-child' );
+ wp_enqueue_style( 'generate-child' );
+ }
+
+ // Re-add no-cache CSS in GP < 3.0.0.
+ if ( ! function_exists( 'generate_get_dynamic_css' ) && function_exists( 'generate_no_cache_dynamic_css' ) ) {
+ $nocache_css = generate_no_cache_dynamic_css();
+
+ if ( function_exists( 'generate_do_icon_css' ) ) {
+ $nocache_css .= generate_do_icon_css();
+ }
+
+ wp_add_inline_style( 'generate-style', wp_strip_all_tags( $nocache_css ) );
+ }
+ }
+ }
+
+ /**
+ * Make our CSS.
+ */
+ public function make_css() {
+ $content = '';
+
+ if ( function_exists( 'generate_get_dynamic_css' ) ) {
+ $content = generate_get_dynamic_css();
+ } elseif ( function_exists( 'generate_base_css' ) && function_exists( 'generate_font_css' ) && function_exists( 'generate_advanced_css' ) && function_exists( 'generate_spacing_css' ) ) {
+ $content = generate_base_css() . generate_font_css() . generate_advanced_css() . generate_spacing_css();
+ }
+
+ $content = apply_filters( 'generate_external_dynamic_css_output', $content );
+
+ if ( ! $content ) {
+ return false;
+ }
+
+ $filesystem = generate_premium_get_wp_filesystem();
+
+ if ( ! $filesystem ) {
+ return false;
+ }
+
+ // Take care of domain mapping.
+ if ( defined( 'DOMAIN_MAPPING' ) && DOMAIN_MAPPING ) {
+ if ( function_exists( 'domain_mapping_siteurl' ) && function_exists( 'get_original_url' ) ) {
+ $mapped_domain = domain_mapping_siteurl( false );
+ $original_domain = get_original_url( 'siteurl' );
+
+ $content = str_replace( $original_domain, $mapped_domain, $content );
+ }
+ }
+
+ if ( is_writable( $this->file( 'path' ) ) || ( ! file_exists( $this->file( 'path' ) ) && is_writable( dirname( $this->file( 'path' ) ) ) ) ) {
+ $chmod_file = 0644;
+
+ if ( defined( 'FS_CHMOD_FILE' ) ) {
+ $chmod_file = FS_CHMOD_FILE;
+ }
+
+ if ( ! $filesystem->put_contents( $this->file( 'path' ), wp_strip_all_tags( $content ), $chmod_file ) ) {
+
+ // Fail!
+ return false;
+
+ } else {
+
+ $this->update_saved_time();
+
+ // Success!
+ return true;
+
+ }
+ }
+ }
+
+ /**
+ * Determines if the CSS file is writable.
+ */
+ public function can_write() {
+ global $blog_id;
+
+ // Get the upload directory for this site.
+ $upload_dir = wp_get_upload_dir();
+
+ // If this is a multisite installation, append the blogid to the filename.
+ $css_blog_id = ( is_multisite() && $blog_id > 1 ) ? '_blog-' . $blog_id : null;
+
+ $file_name = '/style' . $css_blog_id . '.min.css';
+ $folder_path = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'generatepress';
+
+ // Does the folder exist?
+ if ( file_exists( $folder_path ) ) {
+ // Folder exists, but is the folder writable?
+ if ( ! is_writable( $folder_path ) ) {
+ // Folder is not writable.
+ // Does the file exist?
+ if ( ! file_exists( $folder_path . $file_name ) ) {
+ // File does not exist, therefore it can't be created
+ // since the parent folder is not writable.
+ return false;
+ } else {
+ // File exists, but is it writable?
+ if ( ! is_writable( $folder_path . $file_name ) ) {
+ // Nope, it's not writable.
+ return false;
+ }
+ }
+ } else {
+ // The folder is writable.
+ // Does the file exist?
+ if ( file_exists( $folder_path . $file_name ) ) {
+ // File exists.
+ // Is it writable?
+ if ( ! is_writable( $folder_path . $file_name ) ) {
+ // Nope, it's not writable.
+ return false;
+ }
+ }
+ }
+ } else {
+ // Can we create the folder?
+ // returns true if yes and false if not.
+ return wp_mkdir_p( $folder_path );
+ }
+
+ // all is well!
+ return true;
+ }
+
+ /**
+ * Gets the css path or url to the stylesheet
+ *
+ * @param string $target path/url.
+ */
+ public function file( $target = 'path' ) {
+ global $blog_id;
+
+ // Get the upload directory for this site.
+ $upload_dir = wp_get_upload_dir();
+
+ // If this is a multisite installation, append the blogid to the filename.
+ $css_blog_id = ( is_multisite() && $blog_id > 1 ) ? '_blog-' . $blog_id : null;
+
+ $file_name = 'style' . $css_blog_id . '.min.css';
+ $folder_path = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'generatepress';
+
+ // The complete path to the file.
+ $file_path = $folder_path . DIRECTORY_SEPARATOR . $file_name;
+
+ // Get the URL directory of the stylesheet.
+ $css_uri_folder = $upload_dir['baseurl'];
+
+ $css_uri = trailingslashit( $css_uri_folder ) . 'generatepress/' . $file_name;
+
+ // Take care of domain mapping.
+ if ( defined( 'DOMAIN_MAPPING' ) && DOMAIN_MAPPING ) {
+ if ( function_exists( 'domain_mapping_siteurl' ) && function_exists( 'get_original_url' ) ) {
+ $mapped_domain = domain_mapping_siteurl( false );
+ $original_domain = get_original_url( 'siteurl' );
+ $css_uri = str_replace( $original_domain, $mapped_domain, $css_uri );
+ }
+ }
+
+ $css_uri = set_url_scheme( $css_uri );
+
+ if ( 'path' === $target ) {
+ return $file_path;
+ } elseif ( 'url' === $target || 'uri' === $target ) {
+ $timestamp = ( file_exists( $file_path ) ) ? '?ver=' . filemtime( $file_path ) : '';
+ return $css_uri . $timestamp;
+ }
+ }
+
+ /**
+ * Update the our updated file time.
+ */
+ public function update_saved_time() {
+ $data = get_option( 'generatepress_dynamic_css_data', array() );
+ $data['updated_time'] = time();
+
+ update_option( 'generatepress_dynamic_css_data', $data );
+ }
+
+ /**
+ * Delete the saved time.
+ */
+ public function delete_saved_time() {
+ $data = get_option( 'generatepress_dynamic_css_data', array() );
+
+ if ( isset( $data['updated_time'] ) ) {
+ unset( $data['updated_time'] );
+ }
+
+ update_option( 'generatepress_dynamic_css_data', $data );
+ }
+
+ /**
+ * Update our plugin/theme versions.
+ */
+ public function update_versions() {
+ $data = get_option( 'generatepress_dynamic_css_data', array() );
+
+ $data['theme_version'] = GENERATE_VERSION;
+ $data['plugin_version'] = GP_PREMIUM_VERSION;
+
+ update_option( 'generatepress_dynamic_css_data', $data );
+ }
+
+ /**
+ * Do we need to update the CSS file?
+ */
+ public function needs_update() {
+ $data = get_option( 'generatepress_dynamic_css_data', array() );
+ $update = false;
+
+ // If there's no updated time, needs update.
+ // The time is set in mode().
+ if ( ! isset( $data['updated_time'] ) ) {
+ $update = true;
+ }
+
+ // If we haven't set our versions, do so now.
+ if ( ! isset( $data['theme_version'] ) && ! isset( $data['plugin_version'] ) ) {
+ $update = true;
+ $this->update_versions();
+
+ // Bail early so we don't check undefined versions below.
+ return $update;
+ }
+
+ // Version numbers have changed, needs update.
+ if ( (string) GENERATE_VERSION !== (string) $data['theme_version'] || (string) GP_PREMIUM_VERSION !== (string) $data['plugin_version'] ) {
+ $update = true;
+ $this->update_versions();
+ }
+
+ return $update;
+ }
+
+ /**
+ * Regenerate the CSS file.
+ */
+ public function regenerate_css_file() {
+ check_ajax_referer( 'generatepress_regenerate_css_file', '_nonce' );
+
+ if ( ! current_user_can( 'manage_options' ) ) {
+ wp_send_json_error( __( 'Security check failed.', 'gp-premium' ) );
+ }
+
+ $this->delete_saved_time();
+
+ wp_send_json_success();
+ }
+}
+
+GeneratePress_External_CSS_File::get_instance();
diff --git a/wp-content/upgrade-temp-backup/plugins/gp-premium/general/enqueue-scripts.php b/wp-content/upgrade-temp-backup/plugins/gp-premium/general/enqueue-scripts.php
new file mode 100644
index 00000000..a9108a61
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/gp-premium/general/enqueue-scripts.php
@@ -0,0 +1,81 @@
+ $data ) {
+ $type = esc_html( GeneratePress_Elements_Helper::get_element_type_label( $data['type'] ) );
+
+ $active_elements[] = array(
+ 'type' => $type,
+ 'name' => get_the_title( $data['id'] ),
+ 'url' => get_edit_post_link( $data['id'] ),
+ );
+ }
+ }
+
+ $post_type_is_public = false;
+
+ if ( get_post_type() ) {
+ $post_type = get_post_type_object( get_post_type() );
+
+ if ( is_object( $post_type ) && ! empty( $post_type->public ) ) {
+ $post_type_is_public = true;
+ }
+ }
+
+ wp_localize_script(
+ 'gp-premium-editor',
+ 'gpPremiumEditor',
+ array(
+ 'isBlockElement' => 'gp_elements' === get_post_type(),
+ 'activeElements' => $active_elements,
+ 'elementsUrl' => esc_url( admin_url( 'edit.php?post_type=gp_elements' ) ),
+ 'postTypeIsPublic' => $post_type_is_public,
+ )
+ );
+
+ wp_enqueue_style(
+ 'gp-premium-editor',
+ GP_PREMIUM_DIR_URL . 'dist/editor.css',
+ array( 'wp-edit-blocks' ),
+ filemtime( GP_PREMIUM_DIR_PATH . 'dist/editor.css' )
+ );
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/gp-premium/general/icons.php b/wp-content/upgrade-temp-backup/plugins/gp-premium/general/icons.php
new file mode 100644
index 00000000..1b587f4c
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/gp-premium/general/icons.php
@@ -0,0 +1,87 @@
+
+ smooth-scroll
class.', 'gp-premium' ),
+ 'section' => 'generate_general_section',
+ )
+ );
+}
diff --git a/wp-content/upgrade-temp-backup/plugins/gp-premium/gp-premium.php b/wp-content/upgrade-temp-backup/plugins/gp-premium/gp-premium.php
new file mode 100644
index 00000000..30f0beef
--- /dev/null
+++ b/wp-content/upgrade-temp-backup/plugins/gp-premium/gp-premium.php
@@ -0,0 +1,307 @@
+=' ) && ! defined( 'GENERATE_DISABLE_SITE_LIBRARY' ) ) {
+ require_once GP_PREMIUM_DIR_PATH . 'site-library/class-site-library-rest.php';
+ require_once GP_PREMIUM_DIR_PATH . 'site-library/class-site-library-helper.php';
+}
+
+if ( is_admin() ) {
+ require_once GP_PREMIUM_DIR_PATH . 'inc/deprecated-admin.php';
+
+ if ( generatepress_is_module_active( 'generate_package_site_library', 'GENERATE_SITE_LIBRARY' ) && version_compare( PHP_VERSION, '5.4', '>=' ) && ! defined( 'GENERATE_DISABLE_SITE_LIBRARY' ) ) {
+ require_once GP_PREMIUM_DIR_PATH . 'site-library/class-site-library.php';
+ }
+}
+
+if ( ! function_exists( 'generate_premium_updater' ) ) {
+ add_action( 'admin_init', 'generate_premium_updater', 0 );
+ /**
+ * Set up the updater
+ **/
+ function generate_premium_updater() {
+ if ( ! class_exists( 'GeneratePress_Premium_Plugin_Updater' ) ) {
+ include GP_PREMIUM_DIR_PATH . 'library/class-plugin-updater.php';
+ }
+
+ $license_key = get_option( 'gen_premium_license_key' );
+
+ $edd_updater = new GeneratePress_Premium_Plugin_Updater(
+ 'https://generatepress.com',
+ __FILE__,
+ array(
+ 'version' => GP_PREMIUM_VERSION,
+ 'license' => trim( $license_key ),
+ 'item_name' => 'GP Premium',
+ 'author' => 'Tom Usborne',
+ 'url' => home_url(),
+ 'beta' => apply_filters( 'generate_premium_beta_tester', false ),
+ )
+ );
+ }
+}
+
+add_filter( 'edd_sl_plugin_updater_api_params', 'generate_premium_set_updater_api_params', 10, 3 );
+/**
+ * Add the GeneratePress version to our updater params.
+ *
+ * @param array $api_params The array of data sent in the request.
+ * @param array $api_data The array of data set up in the class constructor.
+ * @param string $plugin_file The full path and filename of the file.
+ */
+function generate_premium_set_updater_api_params( $api_params, $api_data, $plugin_file ) {
+ /*
+ * Make sure $plugin_file matches your plugin's file path. You should have a constant for this
+ * or can use __FILE__ if this code goes in your plugin's main file.
+ */
+ if ( __FILE__ === $plugin_file ) {
+ // Dynamically retrieve the current version number.
+ $api_params['generatepress_version'] = defined( 'GENERATE_VERSION' ) ? GENERATE_VERSION : '';
+ }
+
+ return $api_params;
+}
+
+if ( ! function_exists( 'generate_premium_setup' ) ) {
+ add_action( 'after_setup_theme', 'generate_premium_setup' );
+ /**
+ * Add useful functions to GP Premium
+ **/
+ function generate_premium_setup() {
+ // This used to be in the theme but the WP.org review team asked for it to be removed.
+ // Not wanting people to have broken shortcodes in their widgets on update, I added it into premium.
+ add_filter( 'widget_text', 'do_shortcode' );
+ }
+}
+
+if ( ! function_exists( 'generate_premium_theme_information' ) ) {
+ add_action( 'admin_notices', 'generate_premium_theme_information' );
+ /**
+ * Checks whether there's a theme update available and lets you know.
+ * Also checks to see if GeneratePress is the active theme. If not, tell them.
+ *
+ * @since 1.2.95
+ **/
+ function generate_premium_theme_information() {
+ $theme = wp_get_theme();
+
+ if ( 'GeneratePress' === $theme->name || 'generatepress' === $theme->template ) {
+
+ // Get our information on updates.
+ // @see https://developer.wordpress.org/reference/functions/wp_prepare_themes_for_js/.
+ $updates = array();
+ if ( current_user_can( 'update_themes' ) ) {
+ $updates_transient = get_site_transient( 'update_themes' );
+ if ( isset( $updates_transient->response ) ) {
+ $updates = $updates_transient->response;
+ }
+ }
+
+ $screen = get_current_screen();
+
+ // If a GeneratePress update exists, and we're not on the themes page.
+ // No need to tell people an update exists on the themes page, WP does that for us.
+ if ( isset( $updates['generatepress'] ) && 'themes' !== $screen->base ) {
+ printf(
+ '
';
+ $html .= '
+
+
+ $key ) {
+ if ( 'activated' === get_option( $key ) ) {
+ $data['modules'][ $name ] = $key;
+ }
+ }
+
+ // Site options.
+ $data['site_options']['nav_menu_locations'] = get_theme_mod( 'nav_menu_locations' );
+ $data['site_options']['custom_logo'] = wp_get_attachment_url( get_theme_mod( 'custom_logo' ) );
+ $data['site_options']['show_on_front'] = get_option( 'show_on_front' );
+ $data['site_options']['page_on_front'] = get_option( 'page_on_front' );
+ $data['site_options']['page_for_posts'] = get_option( 'page_for_posts' );
+
+ // Page header.
+ $data['site_options']['page_header_global_locations'] = get_option( 'generate_page_header_global_locations' );
+ $data['site_options']['page_headers'] = generate_sites_export_page_headers();
+
+ // Elements.
+ $data['site_options']['element_locations'] = generate_sites_export_elements_location();
+ $data['site_options']['element_exclusions'] = generate_sites_export_elements_exclusion();
+
+ // Custom CSS.
+ if ( function_exists( 'wp_get_custom_css_post' ) ) {
+ $data['custom_css'] = wp_get_custom_css_post()->post_content;
+ }
+
+ // WooCommerce.
+ if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
+ $data['site_options']['woocommerce_shop_page_id'] = get_option( 'woocommerce_shop_page_id' );
+ $data['site_options']['woocommerce_cart_page_id'] = get_option( 'woocommerce_cart_page_id' );
+ $data['site_options']['woocommerce_checkout_page_id'] = get_option( 'woocommerce_checkout_page_id' );
+ $data['site_options']['woocommerce_myaccount_page_id'] = get_option( 'woocommerce_myaccount_page_id' );
+ $data['site_options']['woocommerce_single_image_width'] = get_option( 'woocommerce_single_image_width' );
+ $data['site_options']['woocommerce_thumbnail_image_width'] = get_option( 'woocommerce_thumbnail_image_width' );
+ $data['site_options']['woocommerce_thumbnail_cropping'] = get_option( 'woocommerce_thumbnail_cropping' );
+ $data['site_options']['woocommerce_shop_page_display'] = get_option( 'woocommerce_shop_page_display' );
+ $data['site_options']['woocommerce_category_archive_display'] = get_option( 'woocommerce_category_archive_display' );
+ $data['site_options']['woocommerce_default_catalog_orderby'] = get_option( 'woocommerce_default_catalog_orderby' );
+ }
+
+ // Elementor.
+ if ( is_plugin_active( 'elementor/elementor.php' ) ) {
+ $data['site_options']['elementor_container_width'] = get_option( 'elementor_container_width' );
+ $data['site_options']['elementor_cpt_support'] = get_option( 'elementor_cpt_support' );
+ $data['site_options']['elementor_css_print_method'] = get_option( 'elementor_css_print_method' );
+ $data['site_options']['elementor_default_generic_fonts'] = get_option( 'elementor_default_generic_fonts' );
+ $data['site_options']['elementor_disable_color_schemes'] = get_option( 'elementor_disable_color_schemes' );
+ $data['site_options']['elementor_disable_typography_schemes'] = get_option( 'elementor_disable_typography_schemes' );
+ $data['site_options']['elementor_editor_break_lines'] = get_option( 'elementor_editor_break_lines' );
+ $data['site_options']['elementor_exclude_user_roles'] = get_option( 'elementor_exclude_user_roles' );
+ $data['site_options']['elementor_global_image_lightbox'] = get_option( 'elementor_global_image_lightbox' );
+ $data['site_options']['elementor_page_title_selector'] = get_option( 'elementor_page_title_selector' );
+ $data['site_options']['elementor_scheme_color'] = get_option( 'elementor_scheme_color' );
+ $data['site_options']['elementor_scheme_color-picker'] = get_option( 'elementor_scheme_color-picker' );
+ $data['site_options']['elementor_scheme_typography'] = get_option( 'elementor_scheme_typography' );
+ $data['site_options']['elementor_space_between_widgets'] = get_option( 'elementor_space_between_widgets' );
+ $data['site_options']['elementor_stretched_section_container'] = get_option( 'elementor_stretched_section_container' );
+ $data['site_options']['elementor_load_fa4_shim'] = get_option( 'elementor_load_fa4_shim' );
+ $data['site_options']['elementor_active_kit'] = get_option( 'elementor_active_kit' );
+ }
+
+ // Beaver Builder.
+ if ( is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) || is_plugin_active( 'bb-plugin/fl-builder.php' ) ) {
+ $data['site_options']['_fl_builder_enabled_icons'] = get_option( '_fl_builder_enabled_icons' );
+ $data['site_options']['_fl_builder_enabled_modules'] = get_option( '_fl_builder_enabled_modules' );
+ $data['site_options']['_fl_builder_post_types'] = get_option( '_fl_builder_post_types' );
+ $data['site_options']['_fl_builder_color_presets'] = get_option( '_fl_builder_color_presets' );
+ $data['site_options']['_fl_builder_services'] = get_option( '_fl_builder_services' );
+ $data['site_options']['_fl_builder_settings'] = get_option( '_fl_builder_settings' );
+ $data['site_options']['_fl_builder_user_access'] = get_option( '_fl_builder_user_access' );
+ $data['site_options']['_fl_builder_enabled_templates'] = get_option( '_fl_builder_enabled_templates' );
+ }
+
+ // Menu Icons.
+ if ( is_plugin_active( 'menu-icons/menu-icons.php' ) ) {
+ $data['site_options']['menu-icons'] = get_option( 'menu-icons' );
+ }
+
+ // Ninja Forms.
+ if ( is_plugin_active( 'ninja-forms/ninja-forms.php' ) ) {
+ $data['site_options']['ninja_forms_settings'] = get_option( 'ninja_forms_settings' );
+ }
+
+ // Social Warfare.
+ if ( is_plugin_active( 'social-warfare/social-warfare.php' ) ) {
+ $data['site_options']['socialWarfareOptions'] = get_option( 'socialWarfareOptions' );
+ }
+
+ // Elements Plus.
+ if ( is_plugin_active( 'elements-plus/elements-plus.php' ) ) {
+ $data['site_options']['elements_plus_settings'] = get_option( 'elements_plus_settings' );
+ }
+
+ // Ank Google Map.
+ if ( is_plugin_active( 'ank-google-map/ank-google-map.php' ) ) {
+ $data['site_options']['ank_google_map'] = get_option( 'ank_google_map' );
+ }
+
+ // GP Social Share.
+ if ( is_plugin_active( 'gp-social-share-svg/gp-social-share.php' ) ) {
+ $data['site_options']['gp_social_settings'] = get_option( 'gp_social_settings' );
+ }
+
+ // Active plugins.
+ $active_plugins = get_option( 'active_plugins' );
+ $all_plugins = get_plugins();
+
+ $ignore = apply_filters(
+ 'generate_sites_ignore_plugins',
+ array(
+ 'gp-premium/gp-premium.php',
+ 'widget-importer-exporter/widget-importer-exporter.php',
+ )
+ );
+
+ foreach ( $ignore as $plugin ) {
+ unset( $all_plugins[ $plugin ] );
+ }
+
+ $activated_plugins = array();
+
+ foreach ( $active_plugins as $p ) {
+ if ( isset( $all_plugins[ $p ] ) ) {
+ $activated_plugins[ $all_plugins[ $p ]['Name'] ] = $p;
+ }
+ }
+
+ $data['plugins'] = $activated_plugins;
+
+ return $data;
+
+}
+
+/**
+ * Get our sites from the site server.
+ *
+ * @since 1.12.0'
+ * @deprecated 2.0.0
+ */
+function generate_get_sites_from_library() {
+ $remote_sites = get_transient( 'generatepress_sites' );
+ $trusted_authors = get_transient( 'generatepress_sites_trusted_providers' );
+
+ if ( empty( $remote_sites ) ) {
+ $sites = array();
+
+ $data = wp_safe_remote_get( 'https://gpsites.co/wp-json/wp/v2/sites?per_page=100' );
+
+ if ( is_wp_error( $data ) ) {
+ set_transient( 'generatepress_sites', 'no results', 5 * MINUTE_IN_SECONDS );
+ return;
+ }
+
+ $data = json_decode( wp_remote_retrieve_body( $data ), true );
+
+ if ( ! is_array( $data ) ) {
+ set_transient( 'generatepress_sites', 'no results', 5 * MINUTE_IN_SECONDS );
+ return;
+ }
+
+ foreach ( (array) $data as $site ) {
+ $sites[ $site['name'] ] = array(
+ 'name' => $site['name'],
+ 'directory' => $site['directory'],
+ 'preview_url' => $site['preview_url'],
+ 'author_name' => $site['author_name'],
+ 'author_url' => $site['author_url'],
+ 'description' => $site['description'],
+ 'page_builder' => $site['page_builder'],
+ 'min_version' => $site['min_version'],
+ 'uploads_url' => $site['uploads_url'],
+ 'plugins' => $site['plugins'],
+ 'documentation' => $site['documentation'],
+ );
+ }
+
+ $sites = apply_filters( 'generate_add_sites', $sites );
+
+ set_transient( 'generatepress_sites', $sites, 24 * HOUR_IN_SECONDS );
+ }
+
+ if ( empty( $trusted_authors ) ) {
+ $trusted_authors = wp_safe_remote_get( 'https://gpsites.co/wp-json/sites/site' );
+
+ if ( is_wp_error( $trusted_authors ) || empty( $trusted_authors ) ) {
+ set_transient( 'generatepress_sites_trusted_providers', 'no results', 5 * MINUTE_IN_SECONDS );
+ return;
+ }
+
+ $trusted_authors = json_decode( wp_remote_retrieve_body( $trusted_authors ), true );
+
+ $authors = array();
+ foreach ( (array) $trusted_authors['trusted_author'] as $author ) {
+ $authors[] = $author;
+ }
+
+ set_transient( 'generatepress_sites_trusted_providers', $authors, 24 * HOUR_IN_SECONDS );
+ }
+}
+
+/**
+ * Fetch our sites and trusted authors. Stores them in their own transients.
+ * We use current_screen instead of admin_init so we can check what admin page we're on.
+ *
+ * @since 1.6
+ * @deprecated 2.0.0
+ */
+function generatepress_sites_init() {
+ $screen = get_current_screen();
+
+ if ( 'appearance_page_generate-options' === $screen->id || 'appearance_page_generatepress-site-library' === $screen->id ) {
+ generate_get_sites_from_library();
+ }
+}
+
+/**
+ * Initiate our Sites once everything has loaded.
+ * We use current_screen instead of admin_init so we can check what admin page we're on.
+ *
+ * @since 1.6
+ * @deprecated 2.0.0
+ */
+function generatepress_sites_output() {
+ if ( ! class_exists( 'GeneratePress_Site' ) ) {
+ return; // Bail if we don't have the needed class.
+ }
+
+ $sites = get_transient( 'generatepress_sites' );
+
+ if ( empty( $sites ) || ! is_array( $sites ) ) {
+ add_action( 'generate_inside_sites_container', 'generatepress_sites_no_results_error' );
+ return;
+ }
+
+ if ( apply_filters( 'generate_sites_randomize', false ) ) {
+ shuffle( $sites );
+ }
+
+ foreach ( $sites as $site ) {
+ new GeneratePress_Site( $site );
+ }
+}
+
+/**
+ * Show an error message when no sites exist.
+ *
+ * @since 1.8.2
+ * @deprecated 2.0.0
+ */
+function generatepress_sites_no_results_error() {
+ printf(
+ '
+
+ ',
+ $this->slug,
+ $file,
+ in_array( $this->name, $this->get_active_plugins(), true ) ? 'active' : 'inactive'
+ );
+
+ echo ' ';
+ }
+
+ /**
+ * Gets the plugins active in a multisite network.
+ *
+ * @return array
+ */
+ private function get_active_plugins() {
+ $active_plugins = (array) get_option( 'active_plugins' );
+ $active_network_plugins = (array) get_site_option( 'active_sitewide_plugins' );
+
+ return array_merge( $active_plugins, array_keys( $active_network_plugins ) );
+ }
+
+ /**
+ * Updates information on the "View version x.x details" page with custom data.
+ *
+ * @uses api_request()
+ *
+ * @param mixed $_data
+ * @param string $_action
+ * @param object $_args
+ * @return object $_data
+ */
+ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
+
+ if ( 'plugin_information' !== $_action ) {
+
+ return $_data;
+
+ }
+
+ if ( ! isset( $_args->slug ) || ( $_args->slug !== $this->slug ) ) {
+
+ return $_data;
+
+ }
+
+ $to_send = array(
+ 'slug' => $this->slug,
+ 'is_ssl' => is_ssl(),
+ 'fields' => array(
+ 'banners' => array(),
+ 'reviews' => false,
+ 'icons' => array(),
+ ),
+ );
+
+ // Get the transient where we store the api request for this plugin for 24 hours
+ $edd_api_request_transient = $this->get_cached_version_info();
+
+ //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
+ if ( empty( $edd_api_request_transient ) ) {
+
+ $api_response = $this->api_request( 'plugin_information', $to_send );
+
+ // Expires in 3 hours
+ $this->set_version_info_cache( $api_response );
+
+ if ( false !== $api_response ) {
+ $_data = $api_response;
+ }
+ } else {
+ $_data = $edd_api_request_transient;
+ }
+
+ // Convert sections into an associative array, since we're getting an object, but Core expects an array.
+ if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
+ $_data->sections = $this->convert_object_to_array( $_data->sections );
+ }
+
+ // Convert banners into an associative array, since we're getting an object, but Core expects an array.
+ if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
+ $_data->banners = $this->convert_object_to_array( $_data->banners );
+ }
+
+ // Convert icons into an associative array, since we're getting an object, but Core expects an array.
+ if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
+ $_data->icons = $this->convert_object_to_array( $_data->icons );
+ }
+
+ // Convert contributors into an associative array, since we're getting an object, but Core expects an array.
+ if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
+ $_data->contributors = $this->convert_object_to_array( $_data->contributors );
+ }
+
+ if ( ! isset( $_data->plugin ) ) {
+ $_data->plugin = $this->name;
+ }
+
+ return $_data;
+ }
+
+ /**
+ * Convert some objects to arrays when injecting data into the update API
+ *
+ * Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
+ * decoding, they are objects. This method allows us to pass in the object and return an associative array.
+ *
+ * @since 3.6.5
+ *
+ * @param stdClass $data
+ *
+ * @return array
+ */
+ private function convert_object_to_array( $data ) {
+ if ( ! is_array( $data ) && ! is_object( $data ) ) {
+ return array();
+ }
+ $new_data = array();
+ foreach ( $data as $key => $value ) {
+ $new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
+ }
+
+ return $new_data;
+ }
+
+ /**
+ * Disable SSL verification in order to prevent download update failures
+ *
+ * @param array $args
+ * @param string $url
+ * @return object $array
+ */
+ public function http_request_args( $args, $url ) {
+
+ if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
+ $args['sslverify'] = $this->verify_ssl();
+ }
+ return $args;
+
+ }
+
+ /**
+ * Calls the API and, if successfull, returns the object delivered by the API.
+ *
+ * @uses get_bloginfo()
+ * @uses wp_remote_post()
+ * @uses is_wp_error()
+ *
+ * @param string $_action The requested action.
+ * @param array $_data Parameters for the API action.
+ * @return false|object|void
+ */
+ private function api_request( $_action, $_data ) {
+ $data = array_merge( $this->api_data, $_data );
+
+ if ( $data['slug'] !== $this->slug ) {
+ return;
+ }
+
+ // Don't allow a plugin to ping itself
+ if ( trailingslashit( home_url() ) === $this->api_url ) {
+ return false;
+ }
+
+ if ( $this->request_recently_failed() ) {
+ return false;
+ }
+
+ return $this->get_version_from_remote();
+ }
+
+ /**
+ * Determines if a request has recently failed.
+ *
+ * @since 1.9.1
+ *
+ * @return bool
+ */
+ private function request_recently_failed() {
+ $failed_request_details = get_option( $this->failed_request_cache_key );
+
+ // Request has never failed.
+ if ( empty( $failed_request_details ) || ! is_numeric( $failed_request_details ) ) {
+ return false;
+ }
+
+ /*
+ * Request previously failed, but the timeout has expired.
+ * This means we're allowed to try again.
+ */
+ if ( time() > $failed_request_details ) {
+ delete_option( $this->failed_request_cache_key );
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Logs a failed HTTP request for this API URL.
+ * We set a timestamp for 1 hour from now. This prevents future API requests from being
+ * made to this domain for 1 hour. Once the timestamp is in the past, API requests
+ * will be allowed again. This way if the site is down for some reason we don't bombard
+ * it with failed API requests.
+ *
+ * @see EDD_SL_Plugin_Updater::request_recently_failed
+ *
+ * @since 1.9.1
+ */
+ private function log_failed_request() {
+ update_option( $this->failed_request_cache_key, strtotime( '+1 hour' ) );
+ }
+
+ /**
+ * If available, show the changelog for sites in a multisite install.
+ */
+ public function show_changelog() {
+
+ if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' !== $_REQUEST['edd_sl_action'] ) {
+ return;
+ }
+
+ if ( empty( $_REQUEST['plugin'] ) ) {
+ return;
+ }
+
+ if ( empty( $_REQUEST['slug'] ) || $this->slug !== $_REQUEST['slug'] ) {
+ return;
+ }
+
+ if ( ! current_user_can( 'update_plugins' ) ) {
+ wp_die( esc_html__( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), esc_html__( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
+ }
+
+ $version_info = $this->get_repo_api_data();
+ if ( isset( $version_info->sections ) ) {
+ $sections = $this->convert_object_to_array( $version_info->sections );
+ if ( ! empty( $sections['changelog'] ) ) {
+ echo '';
+ echo ' %current_year%
to update year automatically.', 'gp-premium' );
+ $this->json[ 'copyright' ] = __( '%copy%
to include the copyright symbol.', 'gp-premium' );
+ $this->json[ 'html' ] = __( 'HTML is allowed.', 'gp-premium' );
+ $this->json[ 'shortcodes' ] = __( 'Shortcodes are allowed.', 'gp-premium' );
+ }
+ /**
+ * Render the control's content.
+ *
+ * Allows the content to be overriden without having to rewrite the wrapper.
+ *
+ * @since 10/16/2012
+ * @return void
+ */
+ public function content_template() {
+ ?>
+
+ json[ 'link' ] = $this->get_link();
+ $this->json[ 'value' ] = $this->value();
+ $this->json[ 'id' ] = $this->id;
+ $this->json[ 'default_value' ] = $this->default_value;
+ $this->json[ 'reset_title' ] = esc_attr__( 'Reset','generate-spacing' );
+ $this->json[ 'unit' ] = $this->unit;
+ $this->json[ 'edit_field' ] = $this->edit_field;
+ }
+
+ public function content_template() {
+ ?>
+
+
+ <# if ( '' !== data.default_value ) { #> <# } #>
+ json[ 'link' ] = $this->get_link();
+ $this->json[ 'value' ] = absint( $this->value() );
+ $this->json[ 'description' ] = esc_html( $this->description );
+ }
+
+ public function content_template() {
+ ?>
+
+ type ) {
+ default:
+ case 'text' : ?>
+
+ label ) ) echo '' . esc_html( $this->label ) . '';
+ if ( ! empty( $this->description ) ) echo '' . esc_html( $this->description ) . '';
+ if ( ! empty( $this->areas ) ) :
+ echo '';
+ foreach ( $this->areas as $value => $label ) :
+ echo '' . esc_html( $label ) . '';
+ endforeach;
+ endif;
+ break;
+
+ case 'line' :
+ echo '
';
+ break;
+ }
+ }
+}
+endif;
+
+if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Backgrounds_Customize_Control' ) ) :
+/*
+ * @deprecated 1.3
+ */
+class Generate_Backgrounds_Customize_Control extends WP_Customize_Control {
+ public function render() {}
+}
+endif;
+
+if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Backgrounds_Customize_Misc_Control' ) ) :
+/*
+ * No longer used
+ * Kept for back compat purposes
+ * @deprecated 1.2.95
+ */
+class Generate_Backgrounds_Customize_Misc_Control extends WP_Customize_Control {
+ public function render() {}
+}
+endif;
+
+if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Blog_Customize_Control' ) ) :
+/**
+ * Add our number input field for the featured image width
+ * @deprecated 1.3
+ */
+class Generate_Blog_Customize_Control extends WP_Customize_Control {
+ public $type = 'gp-post-image-size';
+ public $placeholder = '';
+
+ public function enqueue() {
+ wp_enqueue_script( 'gp-blog-customizer', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/blog-customizer.js', array( 'customize-controls' ), GENERATE_BLOG_VERSION, true );
+ }
+
+ public function to_json() {
+ parent::to_json();
+ $this->json[ 'link' ] = $this->get_link();
+ $this->json[ 'value' ] = $this->value();
+ $this->json[ 'placeholder' ] = $this->placeholder;
+ }
+ public function content_template() {
+ ?>
+
+ json[ 'link' ] = $this->get_link();
+ $this->json[ 'value' ] = $this->value();
+ $this->json[ 'placeholder' ] = $this->placeholder;
+ }
+ public function content_template() {
+ ?>
+
+ json[ 'text' ] = __( 'Apply image sizes','page-header' );
+ }
+
+ public function content_template() {
+ ?>
+ {{{ data.text }}}
+ json[ 'link' ] = $this->get_link();
+ $this->json[ 'value' ] = $this->value();
+ $this->json[ 'id' ] = $this->id;
+ }
+
+ public function content_template() {
+ ?>
+
+
+
+
+
+ json['description'] = $this->description;
+ $this->json['notice'] = $this->notice;
+ }
+
+ public function content_template() {
+ ?>
+ <# if ( data.notice ) { #>
+ '),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}}),this.$selection.on("keydown",function(a){!b.isOpen()&&a.which>=48&&a.which<=90&&b.open()}),b.on("focus",function(){e.focusOnSearch()})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},d.prototype.selectionContainer=function(){return a('
'),e},n.prototype.bind=function(e,t){var i=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){i.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!i.isDisabled()){var t=r(this).parent(),n=l.GetData(t[0],"data");i.trigger("unselect",{originalEvent:e,data:n})}})},n.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},n.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},n.prototype.selectionContainer=function(){return r('
{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t
+ get_non_admin_notice_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+
+
+
+ get_first_step_header_lead(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+
+
+
+ get_second_step_header_lead(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
+
+
successfully disconnected.","jetpack-my-jetpack"),{br:u().createElement("br",null)})),n&&u().createElement(u().Fragment,null,u().createElement("p",null,__("We’re sorry to see you go. Here at Jetpack, we’re always striving to provide the best experience for our customers. Please take our short survey (2 minutes, promise).","jetpack-my-jetpack")),u().createElement("p",null,u().createElement(c.Button,{variant:"primary",onClick:i,className:"jp-connection__disconnect-dialog__btn-back-to-wp"},__("Help us improve","jetpack-my-jetpack"))),u().createElement("a",{className:"jp-connection__disconnect-dialog__link jp-connection__disconnect-dialog__link--bold",href:"#",onClick:t},__("No thank you","jetpack-my-jetpack"))),!n&&u().createElement(u().Fragment,null,u().createElement("p",null,u().createElement(c.Button,{variant:"primary",onClick:t,className:"jp-connection__disconnect-dialog__btn-back-to-wp"},__("Back to my website","jetpack-my-jetpack"))))))};d.propTypes={onExit:o().func,onProvideFeedback:o().func,canProvideFeedback:o().bool};const m=d},9015:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var a=n(6895),c=n(5609),r=n(9307),i=n(5736),s=n(5162),o=n.n(s),l=n(9196),u=n.n(l),p=n(7879);const __=i.__,d=e=>{const{title:t,isDisconnecting:n,onDisconnect:i,disconnectError:s,disconnectStepComponent:o,connectedPlugins:d,disconnectingPlugin:m,closeModal:g,context:h,trackModalClick:v}=e,f=(0,l.useCallback)((()=>v("jetpack_disconnect_dialog_click_learn_about")),[v]),k=(0,l.useCallback)((()=>v("jetpack_disconnect_dialog_click_support")),[v]),y=(0,l.useCallback)((()=>{v("jetpack_disconnect_dialog_click_stay_connected"),g()}),[v,g]),E=(0,l.useCallback)((e=>{v("jetpack_disconnect_dialog_click_disconnect"),i(e)}),[v,i]),w=(0,l.useCallback)((e=>{"Escape"!==e.key||n||y()}),[y,n]);(0,l.useEffect)((()=>(document.addEventListener("keydown",w,!1),()=>{document.removeEventListener("keydown",w,!1)})),[]);return u().createElement(u().Fragment,null,u().createElement("div",{className:"jp-connection__disconnect-dialog__content"},u().createElement("h1",{id:"jp-connection__disconnect-dialog__heading"},t),u().createElement(p.Z,{connectedPlugins:d,disconnectingPlugin:m}),o,(()=>{if(!(d&&Object.keys(d).filter((e=>e!==m)).length)&&!o)return u().createElement("div",{className:"jp-connection__disconnect-dialog__step-copy"},u().createElement("p",{className:"jp-connection__disconnect-dialog__large-text"},__("Jetpack is currently powering multiple products on your site.","jetpack-my-jetpack"),u().createElement("br",null),__("Once you disconnect Jetpack, these will no longer work.","jetpack-my-jetpack")))})()),u().createElement("div",{className:"jp-connection__disconnect-dialog__actions"},u().createElement("div",{className:"jp-row"},u().createElement("div",{className:"lg-col-span-8 md-col-span-9 sm-col-span-4"},u().createElement("p",null,(0,r.createInterpolateElement)(__("Need help? Learn more about the
Thanks for your input on how we can improve Jetpack.","jetpack-my-jetpack"),{br:u().createElement("br",null)})),u().createElement(c.Button,{variant:"primary",onClick:t,className:"jp-connection__disconnect-dialog__btn-back-to-wp"},__("Back to my website","jetpack-my-jetpack"))))};d.PropTypes={onExit:o().func,assetBaseUrl:o().string};const m=d},6336:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var a=n(5609),c=n(5736),r=n(5162),i=n.n(r),s=n(9196),o=n.n(s),l=n(4372);const __=c.__,u=e=>{const{onSubmit:t,isSubmittingFeedback:n}=e,[c,r]=(0,s.useState)(),[i,u]=(0,s.useState)(),p=[{id:"troubleshooting",answerText:__("Troubleshooting - I'll be reconnecting afterwards.","jetpack-my-jetpack")},{id:"not-working",answerText:__("I can't get it to work.","jetpack-my-jetpack")},{id:"slowed-down-site",answerText:__("It slowed down my site.","jetpack-my-jetpack")},{id:"buggy",answerText:__("It's buggy.","jetpack-my-jetpack")},{id:"what-does-it-do",answerText:__("I don't know what it does.","jetpack-my-jetpack")}],d="another-reason",m=(0,s.useCallback)((()=>{t(c,c===d?i:"")}),[t,d,i,c]),g=(0,s.useCallback)((e=>{const t=e.target.value;e.stopPropagation(),u(t)}),[u]),h=e=>e===c?"jp-connect__disconnect-survey-card--selected":"",v=(0,s.useCallback)(((e,t)=>{switch(t.key){case"Enter":case"Space":case"Spacebar":case" ":r(e)}}),[r]);return o().createElement(o().Fragment,null,o().createElement("div",{className:"jp-connection__disconnect-dialog__survey"},p.map((e=>o().createElement(l.Z,{id:e.id,onClick:r,onKeyDown:v,className:"card jp-connect__disconnect-survey-card "+h(e.id)},o().createElement("p",{className:"jp-connect__disconnect-survey-card__answer"},e.answerText)))),o().createElement(l.Z,{id:d,key:d,onClick:r,onKeyDown:v,className:"card jp-connect__disconnect-survey-card "+h(d)},o().createElement("p",{className:"jp-connect__disconnect-survey-card__answer"},__("Other:","jetpack-my-jetpack")," ",o().createElement("input",{placeholder:__("share your experience","jetpack-my-jetpack"),className:"jp-connect__disconnect-survey-card__input",type:"text",value:i,onChange:g,maxLength:1e3})))),o().createElement("p",null,o().createElement(a.Button,{disabled:!c||n,variant:"primary",onClick:m,className:"jp-connection__disconnect-dialog__btn-back-to-wp"},n?__("Submitting…","jetpack-my-jetpack"):__("Submit Feedback","jetpack-my-jetpack",0))))};u.PropTypes={onSubmit:i().func,isSubmittingFeedback:i().bool};const p=u},4372:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var a=n(9196),c=n.n(a);n(9823);const r=e=>{const{id:t,onClick:n,onKeyDown:r,children:i,className:s}=e,o=(0,a.useCallback)((()=>{n(t)}),[t,n]),l=(0,a.useCallback)((e=>{r(t,e)}),[t,r]);return c().createElement("div",{tabIndex:"0",role:"button",onClick:o,onKeyDown:l,className:"card jp-connect__disconnect-survey-card "+s},i)}},8137:(e,t,n)=>{"use strict";n.d(t,{Z:()=>b});var a=n(5106),c=n(6895),r=n(526),i=n(5609),s=n(9307),o=n(5736),l=n(1074),u=n(6936),p=n(5381),d=n(5235),m=n.n(d),g=n(5162),h=n.n(g),v=n(9196),f=n.n(v),k=n(6168);n(7664);const __=o.__,y=e=>{const{title:t,apiRoot:n,apiNonce:r,connectedPlugins:s,onDisconnected:o,context:l,connectedUser:u,connectedSiteId:p,isOpen:d,onClose:m}=e,[g,h]=(0,v.useState)(!1),y=(0,v.useCallback)((e=>{e&&e.preventDefault(),h(!0)}),[h]),b=(0,v.useCallback)((e=>{e&&e.preventDefault(),h(!1)}),[h]);return f().createElement(f().Fragment,null,d&&f().createElement(f().Fragment,null,f().createElement(i.Modal,{title:"",contentLabel:t,aria:{labelledby:"jp-connection__manage-dialog__heading"},shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,isDismissible:!1,className:"jp-connection__manage-dialog"},f().createElement("div",{className:"jp-connection__manage-dialog__content"},f().createElement("h1",{id:"jp-connection__manage-dialog__heading"},t),f().createElement(a.ZP,{className:"jp-connection__manage-dialog__large-text"},__("At least one user must be connected for your Jetpack products to work properly.","jetpack-my-jetpack")),f().createElement(E,{title:__("Transfer ownership to another admin","jetpack-my-jetpack"),link:(0,c.Z)("calypso-settings-manage-connection",{site:window?.myJetpackInitialState?.siteSuffix}),key:"transfer",action:"transfer"}),f().createElement(E,{title:__("Disconnect Jetpack","jetpack-my-jetpack"),onClick:y,key:"disconnect",action:"disconnect"})),f().createElement(w,{onClose:m})),f().createElement(k.Z,{apiRoot:n,apiNonce:r,onDisconnected:o,connectedPlugins:s,connectedSiteId:p,connectedUser:u,isOpen:g,onClose:b,context:l})))},E=e=>{let{title:t,onClick:n=(()=>null),link:a="#",action:c}=e;return f().createElement("div",{className:"jp-connection__manage-dialog__action-card card"},f().createElement("div",{className:"jp-connection__manage-dialog__action-card__card-content"},f().createElement("a",{href:a,className:m()("jp-connection__manage-dialog__action-card__card-headline",c),onClick:n},t,f().createElement(l.Z,{icon:"disconnect"===c?u.Z:p.Z,className:"jp-connection__manage-dialog__action-card__icon"}))))},w=e=>{let{onClose:t}=e;return f().createElement("div",{className:"jp-row jp-connection__manage-dialog__actions"},f().createElement("div",{className:"jp-connection__manage-dialog__text-wrap lg-col-span-9 md-col-span-7 sm-col-span-3"},f().createElement(a.ZP,null,(0,s.createInterpolateElement)(__("Need help? Learn more about the
+
',
+ 'jetpack-my-jetpack'
+ ),
+ ),
+ ),
+ self::UPGRADED_TIER_SLUG => array(
+ 'included' => true,
+ 'description' => __( 'Automatically updated', 'jetpack-my-jetpack' ),
+ 'info' => array(
+ 'title' => __( 'Automatic Critical CSS regeneration', 'jetpack-my-jetpack' ),
+ 'content' => __(
+ '%2$s
has been flagged for potential security violations. You can unlock your login by sending yourself a special link via email. Learn More
+
+
+
+