Skip to content

Commit 46dbef0

Browse files
committed
Updated to v2.3
1 parent e4fca85 commit 46dbef0

File tree

3 files changed

+28
-30
lines changed

3 files changed

+28
-30
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ There is no demo or showcase available for this extension. But all the K2 extens
3535
### REQUIREMENTS
3636
This is a K2 plugin for Joomla and the only basic requirements to use it are:
3737

38-
- K2 v2.5.x or newer installed
38+
- K2 v2.6.x or newer installed
3939
- Joomla 2.5 or 3.x installed
4040

4141

@@ -46,14 +46,14 @@ This is a Joomla extension developed by JoomlaWorks and released under the GNU/G
4646
### ADDITIONAL INFO
4747
Some helpful links:
4848

49-
- K2 - http://getk2.org
50-
- Joomla - http://www.joomla.org
49+
- K2 - https://getk2.org
50+
- Joomla - https://www.joomla.org
5151

5252
If you want to provide feedback for this Joomla plugin, you may use the GitHub issue tracker here: https://github.com/getk2/k2-example-plugin/issues
5353

5454

5555
## DOWNLOAD
56-
You can grab the latest release here: http://goo.gl/WQpl1I (v2.2)
56+
You can grab the latest release here: https://github.com/getk2/k2-example-plugin/archive/master.zip
5757

5858
To install this Joomla plugin, download the file in your computer and then head over to the Joomla installer and choose to upload the file you just downloaded.
5959

example.php

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* @version 2.2
3+
* @version 2.3
44
* @package Example K2 Plugin (K2 plugin)
55
* @author JoomlaWorks - http://www.joomlaworks.net
66
* @copyright Copyright (c) 2006 - 2014 JoomlaWorks Ltd. All rights reserved.
@@ -31,48 +31,48 @@ public function __construct(&$subject, $params)
3131

3232
/**
3333
* Below we list all available FRONTEND events, to trigger K2 plugins.
34-
* Watch the different prefix "onK2" instead of just "on" as used in Joomla! already.
34+
* Watch the different prefix "onK2" instead of just "on" as used in Joomla already.
3535
* Most functions are empty to showcase what is available to trigger and output. A few are used to actually output some code for example reasons.
3636
*/
3737

3838
public function onK2PrepareContent(&$item, &$params, $limitstart)
3939
{
40-
$mainframe = JFactory::getApplication();
40+
$app = JFactory::getApplication();
4141
//$item->text = 'It works! '.$item->text;
4242
}
4343

4444
public function onK2AfterDisplay(&$item, &$params, $limitstart)
4545
{
46-
$mainframe = JFactory::getApplication();
46+
$app = JFactory::getApplication();
4747
return '';
4848
}
4949

5050
public function onK2BeforeDisplay(&$item, &$params, $limitstart)
5151
{
52-
$mainframe = JFactory::getApplication();
52+
$app = JFactory::getApplication();
5353
return '';
5454
}
5555

5656
public function onK2AfterDisplayTitle(&$item, &$params, $limitstart)
5757
{
58-
$mainframe = JFactory::getApplication();
58+
$app = JFactory::getApplication();
5959
return '';
6060
}
6161

6262
public function onK2BeforeDisplayContent(&$item, &$params, $limitstart)
6363
{
64-
$mainframe = JFactory::getApplication();
64+
$app = JFactory::getApplication();
6565
return '';
6666
}
6767

6868
// Event to display (in the frontend) the YouTube URL as entered in the item form
6969
public function onK2AfterDisplayContent(&$item, &$params, $limitstart)
7070
{
71-
$mainframe = JFactory::getApplication();
71+
$app = JFactory::getApplication();
7272

7373
// Get the output of the K2 plugin fields (the data entered by your site maintainers)
7474
$plugins = new K2Parameter($item->plugins, '', $this->pluginName);
75-
75+
7676
$videoURL = $plugins->get('videoURL_item');
7777

7878
// Check if we have a value entered
@@ -86,47 +86,45 @@ public function onK2AfterDisplayContent(&$item, &$params, $limitstart)
8686

8787
$output = '
8888
<p>'.JText::_('Video rendered using the "Example K2 Plugin".').'</p>
89-
<object width="'.$this->params->get('width').'" height="'.$this->params->get('height').'">
90-
<param name="movie" value="http://www.youtube.com/v/'.$video_id.'&hl=en&fs=1"></param>
91-
<param name="allowFullScreen" value="true"></param>
92-
<param name="allowscriptaccess" value="always"></param>
93-
<embed src="http://www.youtube.com/v/'.$video_id.'&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'.$this->params->get('width').'" height="'.$this->params->get('height').'"></embed>
94-
</object>
89+
<iframe width="'.$this->params->get('width').'" height="'.$this->params->get('height').'" src="https://www.youtube.com/embed/'.$video_id.'?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
9590
';
96-
9791
return $output;
9892
}
9993

10094
// Event to display (in the frontend) the YouTube URL as entered in the category form
10195
public function onK2CategoryDisplay(&$category, &$params, $limitstart)
10296
{
103-
$mainframe = JFactory::getApplication();
97+
$app = JFactory::getApplication();
10498

10599
// Get the output of the K2 plugin fields (the data entered by your site maintainers)
106100
$plugins = new K2Parameter($category->plugins, '', $this->pluginName);
107101

108102
$output = $plugins->get('videoURL_cat');
109-
110103
return $output;
111104
}
112105

113106
// Event to display (in the frontend) the YouTube URL as entered in the user form
114107
public function onK2UserDisplay(&$user, &$params, $limitstart)
115108
{
116-
$mainframe = JFactory::getApplication();
109+
$app = JFactory::getApplication();
117110

118111
// Get the output of the K2 plugin fields (the data entered by your site maintainers)
119112
$plugins = new K2Parameter($user->plugins, '', $this->pluginName);
120113

121114
$output = $plugins->get('videoURL_user');
122-
123115
return $output;
124116
}
125117

126-
// Event to replace default commenting system
127-
public function K2CommentsBlock(&$item, &$params, $limitstart)
118+
// Events to replace default commenting system
119+
public function onK2CommentsCounter(&$item, &$params, $limitstart)
120+
{
121+
$app = JFactory::getApplication();
122+
return '';
123+
}
124+
125+
public function onK2CommentsBlock(&$item, &$params, $limitstart)
128126
{
129-
$mainframe = JFactory::getApplication();
127+
$app = JFactory::getApplication();
130128
return '';
131129
}
132130
} // END CLASS

example.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<extension version="2.5" type="plugin" group="k2" method="upgrade">
33
<name>Example K2 Plugin</name>
44
<author>JoomlaWorks</author>
5-
<creationDate>June 5th, 2014</creationDate>
6-
<copyright>Copyright (c) 2006 - 2014 JoomlaWorks Ltd. All rights reserved.</copyright>
5+
<creationDate>February 8th, 2018</creationDate>
6+
<copyright>Copyright (c) 2006 - 2018 JoomlaWorks Ltd. All rights reserved.</copyright>
77
<authorEmail>[email protected]</authorEmail>
88
<authorUrl>www.joomlaworks.net</authorUrl>
9-
<version>2.2</version>
9+
<version>2.3</version>
1010
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
1111
<description>An example K2 plugin to extend item, category and user forms in K2 with a URL inputbox for YouTube videos. The plugin will convert the YouTube URL you enter in K2 backends forms into a functional video player in the frontend.</description>
1212
<files>

0 commit comments

Comments
 (0)