Skip to content

Commit

Permalink
Update to 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdesign committed Mar 5, 2024
1 parent 7d6067d commit 5eda87d
Show file tree
Hide file tree
Showing 26 changed files with 234 additions and 1,073 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
basedir=".">

<property name="VERSION"
value="2.0.0" />
value="2.0.1" />
<property name="JOOMLA"
value="4.0" />

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jupwa",
"sideEffects": true,
"version": "1.6",
"version": "1.7",
"description": "JUPWA",
"private": true,
"scripts": {
Expand All @@ -24,6 +24,7 @@
"@swc/core": "^1.4.2",
"babel-loader": "^9.1.3",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.10.0",
"cssnano": "^6.0.5",
"cssnano-preset-advanced": "^6.0.5",
Expand Down
22 changes: 1 addition & 21 deletions packages/plg_jupwa_content/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use JUPWA\Helpers\Images;
use JUPWA\Helpers\OG;
use JUPWA\Helpers\Schema;
use JUPWA\Helpers\Video;

defined('_JEXEC') or die;

Expand Down Expand Up @@ -63,7 +62,6 @@ public function onJUPWAArticleSchema($article, $params): void
Schema::article_news($option);
Schema::article($option);
Schema::article_blogposting($option);
Schema::youtube($option);
}

/**
Expand Down Expand Up @@ -107,11 +105,6 @@ public function onJUPWAArticleOG($article, $params): void
'params' => $params,
'article' => $article
]);

OG::tagYouTube([
'params' => $params,
'youtube' => $this->youtube($article)
]);
}
}
}
Expand All @@ -135,8 +128,7 @@ public function onJUPWAArticleTwitter($article, $params): void
'image' => $this->image($article, $params)->image,
'image_width' => $this->image($article, $params)->width,
'image_height' => $this->image($article, $params)->height,
'description' => $this->core($article)->description,
'youtube' => $this->youtube($article)
'description' => $this->core($article)->description
]);
}
}
Expand Down Expand Up @@ -169,18 +161,6 @@ private function image($article, $params)
return Images::display($default_image);
}

/**
* @param $article
*
* @return string
*
* @since 1.0
*/
private function youtube($article): string
{
return Video::YouTube($article);
}

/**
* @param $article
*
Expand Down
15 changes: 0 additions & 15 deletions packages/plg_jupwa_content/content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,6 @@

</fieldset>

<fieldset name="JUPWA_OG">

<field name="ogvideo_youtube"
type="radio"
layout="joomla.form.field.radio.switcher"
default="1"
label="PLG_JUPWA_CONTENT_OGVIDEO_YOUTUBE"
showon="og:1"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

</fieldset>

</fieldset>

</fields>
Expand Down
3 changes: 3 additions & 0 deletions packages/plg_jupwa_jshopping/jshopping.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public function __construct(&$subject, $config)
}

/**
* @param $params
*
* @return void
*
* @throws \Exception
Expand Down Expand Up @@ -200,6 +202,7 @@ public function onJUPWATwitter($params): void
/**
* @return false|object
*
* @throws \Exception
* @since 1.0
*/
private function image($params): object|bool
Expand Down
45 changes: 18 additions & 27 deletions packages/plg_jupwa_seblod/seblod.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,24 +346,18 @@ private function seblod($id, $attr = null): bool|array
$registry->loadString($cck->{'options_' . $client});
$this->loaded[ $contentType . '_' . $client . '_options' ] = $registry->toArray();

if(isset($this->loaded[ $contentType . '_' . $client . '_options' ][ 'metadesc' ]))
if(isset($this->loaded[ $contentType . '_' . $client . '_options' ][ 'metadesc' ]) && $this->loaded[ $contentType . '_' . $client . '_options' ][ 'metadesc' ] != '' && $this->loaded[ $contentType . '_' . $client . '_options' ][ 'metadesc' ][ 0 ] == '{')
{
if($this->loaded[ $contentType . '_' . $client . '_options' ][ 'metadesc' ] != '' && $this->loaded[ $contentType . '_' . $client . '_options' ][ 'metadesc' ][ 0 ] == '{')
{
$descriptions = json_decode($this->loaded[ $contentType . '_' . $client . '_options' ][ 'metadesc' ]);
$lang_tag = $lang->getTag();
$this->loaded[ $contentType . '_' . $client . '_options' ][ 'metadesc' ] = (isset($descriptions->$lang_tag)) ? $descriptions->$lang_tag : '';
}
$descriptions = json_decode($this->loaded[ $contentType . '_' . $client . '_options' ][ 'metadesc' ]);
$lang_tag = $lang->getTag();
$this->loaded[ $contentType . '_' . $client . '_options' ][ 'metadesc' ] = (isset($descriptions->$lang_tag)) ? $descriptions->$lang_tag : '';
}

if(isset($this->loaded[ $contentType . '_' . $client . '_options' ][ 'title' ]))
if(isset($this->loaded[ $contentType . '_' . $client . '_options' ][ 'title' ]) && $this->loaded[ $contentType . '_' . $client . '_options' ][ 'title' ] != '' && $this->loaded[ $contentType . '_' . $client . '_options' ][ 'title' ][ 0 ] == '{')
{
if($this->loaded[ $contentType . '_' . $client . '_options' ][ 'title' ] != '' && $this->loaded[ $contentType . '_' . $client . '_options' ][ 'title' ][ 0 ] == '{')
{
$titles = json_decode($this->loaded[ $contentType . '_' . $client . '_options' ][ 'title' ]);
$lang_tag = $lang->getTag();
$this->loaded[ $contentType . '_' . $client . '_options' ][ 'title' ] = (isset($titles->$lang_tag)) ? $titles->$lang_tag : '';
}
$titles = json_decode($this->loaded[ $contentType . '_' . $client . '_options' ][ 'title' ]);
$lang_tag = $lang->getTag();
$this->loaded[ $contentType . '_' . $client . '_options' ][ 'title' ] = (isset($titles->$lang_tag)) ? $titles->$lang_tag : '';
}
}

Expand Down Expand Up @@ -431,13 +425,13 @@ private function cck($cck_id): mixed
*/
private function client($context, $cck, $article, $property): bool|string
{
if($context == 'text')
if($context === 'text')
{
$client = 'intro';
}
elseif($context == 'com_finder.indexer')
elseif($context === 'com_finder.indexer')
{
if($cck->indexed == 'none')
if($cck->indexed === 'none')
{
$article->$property = '';

Expand All @@ -446,18 +440,15 @@ private function client($context, $cck, $article, $property): bool|string

$client = (empty($cck->indexed)) ? 'intro' : $cck->indexed;
}
elseif($cck->storage_location != '')
{
$properties = [ 'contexts' ];
$properties = JCck::callFunc('plgCCK_Storage_Location' . $cck->storage_location, 'getStaticProperties', $properties);
$client = (in_array($context, $properties[ 'contexts' ])) ? 'content' : 'intro';
}
else
{
if($cck->storage_location != '')
{
$properties = [ 'contexts' ];
$properties = JCck::callFunc('plgCCK_Storage_Location' . $cck->storage_location, 'getStaticProperties', $properties);
$client = (in_array($context, $properties[ 'contexts' ])) ? 'content' : 'intro';
}
else
{
$client = 'intro';
}
$client = 'intro';
}

return $client;
Expand Down
2 changes: 1 addition & 1 deletion packages/plg_system_jupwa/jupwa.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public function onAfterDispatch(): void
if($this->params->get('usepwainstall') == 1)
{
$wa = $doc->getWebAssetManager();
$jupwa_install_version = '1.6';
$jupwa_install_version = '1.7';

$wa->registerAndUseScript('jupwa', Uri::root() . 'media/jupwa/js/jupwa.' . $jupwa_install_version . '.js', [ 'version' => false ], [
'defer' => 'defer',
Expand Down
19 changes: 0 additions & 19 deletions packages/plg_system_jupwa/language/en-GB.plg_system_jupwa.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,7 @@ PLG_JUPWA_PRECNCT_TWITTER="Speeding up Twitter"
PLG_JUPWA_PRECONNECT_CUSTOM="Adding domains to the preconnect tag to speed up services (For example: https//site.com)"
PLG_JUPWA_PRELOAD_CUSTOM="Adding statics to the preload tag to speed up loading (For example: /app/logo.svg)"
COM_PLUGINS_PRELOAD_FIELDSET_LABEL="Preloading with HTML5 preload link"
PLG_JUPWA_COMS_INT_SEBLOD="Integration with Seblod"
PLG_JUPWA_INTEGRATION_SEBLOD="Enter the name of the photo, video and gallery fields, separated by commas and spaces. For example: art_image, news_image, blog_image"
PLG_JUPWA_SEBLOD_INTRO="Fields for introductory text separated by commas"
PLG_JUPWA_SEBLOD_IMAGES="Comma separated image fields"
PLG_JUPWA_SEBLOD_GALLERY="Image fields from Field X with comma separated picture fields"
PLG_JUPWA_SEBLOD_VIDEO="Comma separated fields for images from YouTube or Vimeo"
PLG_JUPWA_SEBLOD_PLACE="Field: place"
PLG_JUPWA_SEBLOD_ADDRESS="Field: address"
PLG_JUPWA_SEBLOD_CITY="Field: city"
PLG_JUPWA_SEBLOD_REGION="Field: region / area / state / province"
PLG_JUPWA_SEBLOD_COUNTRY="Field: country"
PLG_JUPWA_SEBLOD_ZIP="Field: zip code"
PLG_JUPWA_SEBLOD_PRICE="Field: price"
PLG_JUPWA_SEBLOD_CURRENCY="Field: currency"
PLG_JUPWA_SEBLOD_STARTDATE="Field: start date"
PLG_JUPWA_SEBLOD_ENDDATE="Field: end date"
PLG_JUPWA_SEBLOD_PERFORMER="Field: organiser"
PLG_JUPWA_SEBLOD_BRAND="Field: the brand"
PLG_JUPWA_INTEGRATION_SEBLOD_EVENTS="Scheme for Events"
COM_PLUGINS_SCHEMA_SEARCH_FIELDSET_LABEL="Schema.org for search"
PLG_JUPWA_SCHEMA_USE_SEARCH="Use the scheme to search for"
PLG_JUPWA_SCHEMA_SEARCH_QUERY="Link for search. For example: <code>https://example.com/search?q=</code>"
Expand Down Expand Up @@ -116,7 +98,6 @@ PLG_JUPWA_WATERMARK_POS_L="Left"
PLG_JUPWA_WATERMARK_POS_R="Right"
PLG_JUPWA_WATERMARK_POS_C="Center"
PLG_JUPWA_OG="Use OG-tags"
PLG_JUPWA_OGVIDEO_YOUTUBE="Add support for embedding videos from YouTube via the og:video tag"
COM_PLUGINS_JUPWA_OG_TW_FIELDSET_LABEL="Twitter"
PLG_JUPWA_TW="Include tags for the Twitter card"
PLG_JUPWA_TWSITE="The name of the website on Twitter. For example: @Ukraine"
Expand Down
53 changes: 0 additions & 53 deletions packages/plg_system_jupwa/libraries/src/Classes/SeblodAPI.php

This file was deleted.

4 changes: 3 additions & 1 deletion packages/plg_system_jupwa/libraries/src/Data/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class Data
'site' => ''
]
];

public static string $workbox = 'https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox-sw.js';

public static array $preconnect = [
Expand Down Expand Up @@ -226,6 +226,8 @@ class Data
'https://s.ytimg.com',
'https://yt3.ggpht.com',
'https://fonts.gstatic.com',
'https://play.google.com',
'https://jnn-pa.googleapis.com',
],
'facebook' => [ 'https://graph.facebook.com' ],
'twitter' => [ 'https://dn.api.twitter.com' ],
Expand Down
38 changes: 0 additions & 38 deletions packages/plg_system_jupwa/libraries/src/Helpers/OG.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,44 +65,6 @@ public static function tag(array $option = [], array $parameters = []): void
}
}

/**
*
* @param array $option
*
* @return void
*
* @throws \Exception
* @since 1.0
*/
public static function tagYouTube(array $option = []): void
{
$app = Factory::getApplication();
$doc = $app->getDocument();

if(isset($option[ 'params' ]) && $option[ 'params' ]->get('ogvideo_youtube') == 1 && $option[ 'params' ]->get('og') == 1)
{
if(preg_match_all('#(youtube.com)/embed/([0-9A-Za-z-_]+)#i', $option[ 'youtube' ], $match) || preg_match_all('#(youtube.com)/watch\?v=([0-9A-Za-z-_]+)#i', $option[ 'youtube' ], $match))
{
$doc->setMetaData('og:video:url', 'https://' . $match[ 0 ][ 0 ], 'property');
$doc->setMetaData('og:video:secure_url', 'https://' . $match[ 0 ][ 0 ], 'property');
$doc->setMetaData('og:video:type', 'text/html', 'property');
$doc->setMetaData('og:video:width', '640', 'property');
$doc->setMetaData('og:video:height', '480', 'property');
$doc->setMetaData('_og:video', 'https://' . str_replace([
'/embed/',
'/watch?v='
], '/v/', $match[ 0 ][ 0 ]), 'property');
$doc->setMetaData('_og:video:secure_url', 'https://' . str_replace([
'/embed/',
'/watch?v='
], '/v/', $match[ 0 ][ 0 ]), 'property');
$doc->setMetaData('_og:video:type', 'application/x-shockwave-flash', 'property');
$doc->setMetaData('_og:video:width', '640', 'property');
$doc->setMetaData('_og:video:height', '480', 'property');
}
}
}

/**
*
* @param array $option
Expand Down
Loading

0 comments on commit 5eda87d

Please sign in to comment.