Version Description
- Enhance: Show Latest News on Dashboard Widget
Download this release
Release Info
Developer | xpointer |
Plugin | CSS & JavaScript Toolbox |
Version | 7.1.2 |
Comparing to | |
See all releases |
Code changes from version 7.1.1 to 7.1.2
css-js-toolbox.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: CSS & JavaScript Toolbox
|
4 |
Plugin URI: http://css-javascript-toolbox.com/css-javascript-toolbox-free
|
5 |
Description: CJT Plugin for WordPress to easily add custom CSS and JavaScript to individual pages
|
6 |
-
Version: 7.1.
|
7 |
Author: Wipeout Media
|
8 |
Author URI: http://css-javascript-toolbox.com
|
9 |
License:
|
@@ -105,7 +105,7 @@ class CJTPlugin extends CJTHookableClass {
|
|
105 |
/**
|
106 |
*
|
107 |
*/
|
108 |
-
const VERSION = '7.1.
|
109 |
|
110 |
/**
|
111 |
*
|
3 |
Plugin Name: CSS & JavaScript Toolbox
|
4 |
Plugin URI: http://css-javascript-toolbox.com/css-javascript-toolbox-free
|
5 |
Description: CJT Plugin for WordPress to easily add custom CSS and JavaScript to individual pages
|
6 |
+
Version: 7.1.2
|
7 |
Author: Wipeout Media
|
8 |
Author URI: http://css-javascript-toolbox.com
|
9 |
License:
|
105 |
/**
|
106 |
*
|
107 |
*/
|
108 |
+
const VERSION = '7.1.2-CE' ;
|
109 |
|
110 |
/**
|
111 |
*
|
framework/wordpress/feed.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*/
|
5 |
+
|
6 |
+
/**
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
class CJT_Framework_Wordpress_Feed {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* put your comment there...
|
13 |
+
*
|
14 |
+
* @var mixed
|
15 |
+
*/
|
16 |
+
protected $feed;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* put your comment there...
|
20 |
+
*
|
21 |
+
* @var mixed
|
22 |
+
*/
|
23 |
+
protected $fields;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* put your comment there...
|
27 |
+
*
|
28 |
+
* @var mixed
|
29 |
+
*/
|
30 |
+
protected $path;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* put your comment there...
|
34 |
+
*
|
35 |
+
* @var mixed
|
36 |
+
*/
|
37 |
+
protected $site;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* put your comment there...
|
41 |
+
*
|
42 |
+
* @param mixed $site
|
43 |
+
* @param mixed $path
|
44 |
+
* @return CJT_Framework_Wordpress_Feed
|
45 |
+
*/
|
46 |
+
public function __construct($site, $path, $fields) {
|
47 |
+
# Initialize.
|
48 |
+
$this->site =& $site;
|
49 |
+
$this->path =& $path;
|
50 |
+
$this->fields = $fields;
|
51 |
+
# Request server => get raw XML feed
|
52 |
+
$feed = wp_remote_get("http://{$this->site}/{$this->path}");
|
53 |
+
if (gettype($feed) !== 'WP_Error') {
|
54 |
+
$this->feed = new SimpleXMLElement(wp_remote_retrieve_body($feed));
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* put your comment there...
|
60 |
+
*
|
61 |
+
* @param mixed $count
|
62 |
+
*/
|
63 |
+
public function getLatestItems($count) {
|
64 |
+
// Initialize.
|
65 |
+
$items = array();
|
66 |
+
// Read only items count specifed by $count param.
|
67 |
+
for ($currentIndex = 0; $currentIndex < $count; $currentIndex++) {
|
68 |
+
# Copy only title and link.
|
69 |
+
$xmlItem = $this->feed->channel->item[$currentIndex];
|
70 |
+
# Read fields.
|
71 |
+
$item = array();
|
72 |
+
foreach ($this->fields as $field) {
|
73 |
+
$item[$field] = (string) $xmlItem->$field;
|
74 |
+
}
|
75 |
+
# Add to list
|
76 |
+
$items[] = $item;
|
77 |
+
}
|
78 |
+
# Return items.
|
79 |
+
return $items;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* put your comment there...
|
84 |
+
*
|
85 |
+
*/
|
86 |
+
protected function getPath() {
|
87 |
+
return $this->path;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* put your comment there...
|
92 |
+
*
|
93 |
+
*/
|
94 |
+
public function getSite() {
|
95 |
+
return $this->site;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* put your comment there...
|
100 |
+
*
|
101 |
+
*/
|
102 |
+
public function isError() {
|
103 |
+
return !$this->feed;
|
104 |
+
}
|
105 |
+
|
106 |
+
} // End class.
|
models/statistics-metabox.php
CHANGED
@@ -55,36 +55,38 @@ class CJTStatisticsMetaboxModel {
|
|
55 |
* put your comment there...
|
56 |
*
|
57 |
*/
|
58 |
-
public function
|
59 |
// Initialize.
|
60 |
-
$
|
61 |
-
|
62 |
-
|
63 |
-
'scripts' => array(),
|
64 |
'time' => 0
|
65 |
));
|
66 |
// Only if cache is expires read feed from server.
|
67 |
-
if ((time() - $
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
$
|
76 |
-
for ($currentIndex = 0; $currentIndex < $count; $currentIndex++) {
|
77 |
-
// Copy only title and link.
|
78 |
-
$xmlItem = $feedDoc->channel->item[$currentIndex];
|
79 |
-
$items[] = array('title' => (string) $xmlItem->title, 'link' => (string) $xmlItem->link);
|
80 |
-
}
|
81 |
-
$latestScriptTransit['scripts'] =& $items;
|
82 |
-
// Hold cache time.
|
83 |
-
$latestScriptTransit['time'] = time();
|
84 |
-
update_option(self::CJT_LASTEST_SCRIPT_OPTION_NAME, $latestScriptTransit);
|
85 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
-
return $
|
88 |
}
|
89 |
|
90 |
/**
|
55 |
* put your comment there...
|
56 |
*
|
57 |
*/
|
58 |
+
public function getFeed() {
|
59 |
// Initialize.
|
60 |
+
$widgetTransitFeed = get_option(self::CJT_LASTEST_SCRIPT_OPTION_NAME, array(
|
61 |
+
'scripts' => array(array('title' => 'cjt-script.com', 'link' => 'http://' . cssJSToolbox::CJT_SCRTIPS_WEB_SITE_DOMAIN)),
|
62 |
+
'news' => array(array('title' => 'css-javascript-toolbox.com', 'link' => 'http://' . cssJSToolbox::CJT_WEB_SITE_DOMAIN)),
|
|
|
63 |
'time' => 0
|
64 |
));
|
65 |
// Only if cache is expires read feed from server.
|
66 |
+
if ((time() - $widgetTransitFeed['time']) > self::LATEST_SCRIPT_EXPIRES) {
|
67 |
+
# Get Latest Scripts/Packages from feed.
|
68 |
+
$scriptsFeed = new CJT_Framework_Wordpress_Feed(
|
69 |
+
cssJSToolbox::CJT_SCRTIPS_WEB_SITE_DOMAIN,
|
70 |
+
'forums/script-packages/user-scripts/feed/',
|
71 |
+
array('title', 'link')
|
72 |
+
);
|
73 |
+
if (!$scriptsFeed->isError()) {
|
74 |
+
$widgetTransitFeed['scripts'] = $scriptsFeed->getLatestItems(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
+
# Get latest news from news feed.
|
77 |
+
$newsFeed = new CJT_Framework_Wordpress_Feed(
|
78 |
+
cssJSToolbox::CJT_WEB_SITE_DOMAIN,
|
79 |
+
'category/news/feed/',
|
80 |
+
array('title', 'link', 'description')
|
81 |
+
);
|
82 |
+
if (!$newsFeed->isError()) {
|
83 |
+
$widgetTransitFeed['news'] = $newsFeed->getLatestItems(1);
|
84 |
+
}
|
85 |
+
# Store cache time.
|
86 |
+
$widgetTransitFeed['time'] = time();
|
87 |
+
update_option(self::CJT_LASTEST_SCRIPT_OPTION_NAME, $widgetTransitFeed);
|
88 |
}
|
89 |
+
return $widgetTransitFeed;
|
90 |
}
|
91 |
|
92 |
/**
|
readme.txt
CHANGED
@@ -7,7 +7,7 @@ License: GPLv2 or later
|
|
7 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
Requires at least: 3.9
|
9 |
Tested up to: 3.9.1
|
10 |
-
Stable tag: 7.1.
|
11 |
|
12 |
Easily add custom CSS, JavaScript, HTML and PHP code to unique CJT code blocks and assign them wherever you want.
|
13 |
|
@@ -127,6 +127,9 @@ Due to the overwhelming amount of emails we get for users requesting support for
|
|
127 |
27. Block Info Dialog
|
128 |
|
129 |
== Changelog ==
|
|
|
|
|
|
|
130 |
= 7.1.1 =
|
131 |
* Enhance: Add Statistics Dashboard Widget that shows few useful fields.
|
132 |
|
7 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
Requires at least: 3.9
|
9 |
Tested up to: 3.9.1
|
10 |
+
Stable tag: 7.1.2
|
11 |
|
12 |
Easily add custom CSS, JavaScript, HTML and PHP code to unique CJT code blocks and assign them wherever you want.
|
13 |
|
127 |
27. Block Info Dialog
|
128 |
|
129 |
== Changelog ==
|
130 |
+
= 7.1.2 =
|
131 |
+
* Enhance: Show Latest News on Dashboard Widget
|
132 |
+
|
133 |
= 7.1.1 =
|
134 |
* Enhance: Add Statistics Dashboard Widget that shows few useful fields.
|
135 |
|
views/dashboard/metabox/statistics/public/css/default.css
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
-
table#cjt-statcs-metabox {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
table#cjt-statcs-metabox strong {color: black;}
|
3 |
#cjt-statcs-metabox th {text-align: right;}
|
4 |
#cjt-statcs-metabox th {padding-bottom: 10px;}
|
5 |
div#cjt-statcs-metabox-info {padding-top: 14px;}
|
6 |
.latest-scripts {padding-left: 22px;}
|
7 |
-
.latest-scripts a {font-size: 13px;}
|
|
|
|
|
|
|
|
1 |
+
table#cjt-statcs-metabox {
|
2 |
+
width: 100%;
|
3 |
+
padding: 0 14px 8px;
|
4 |
+
border-bottom: 1px solid #eeeeee;
|
5 |
+
color: #999999;
|
6 |
+
font-size: 14px;
|
7 |
+
border-top: 1px solid #eeeeee;
|
8 |
+
}
|
9 |
table#cjt-statcs-metabox strong {color: black;}
|
10 |
#cjt-statcs-metabox th {text-align: right;}
|
11 |
#cjt-statcs-metabox th {padding-bottom: 10px;}
|
12 |
div#cjt-statcs-metabox-info {padding-top: 14px;}
|
13 |
.latest-scripts {padding-left: 22px;}
|
14 |
+
.latest-scripts a {font-size: 13px;}
|
15 |
+
|
16 |
+
#cjt-statcs-metabox-news {margin-left: 20px;}
|
17 |
+
.cjt_dw_latestnewstitle {color: #999999; font-size: 14px;}
|
18 |
+
.cjt_dw_description {color: black; margin-left: 31px;}
|
views/dashboard/metabox/statistics/tmpl/default.html.tmpl
CHANGED
@@ -1,6 +1,11 @@
|
|
1 |
<?php
|
2 |
|
|
|
3 |
?>
|
|
|
|
|
|
|
|
|
4 |
<table id="cjt-statcs-metabox">
|
5 |
<thead>
|
6 |
<tr>
|
@@ -34,8 +39,8 @@
|
|
34 |
</tr>
|
35 |
<tr>
|
36 |
<td class="latest-scripts" colspan="2">
|
37 |
-
<?php foreach ($this->
|
38 |
-
<em><?php echo cssJSToolbox::getText('Latest') ?>:</em> <a target="
|
39 |
<?php endforeach; ?>
|
40 |
</td>
|
41 |
</tr>
|
1 |
<?php
|
2 |
|
3 |
+
$latestNew = $this->feed['news'][0];
|
4 |
?>
|
5 |
+
<div id="cjt-statcs-metabox-news">
|
6 |
+
<span class="cjt_dw_latestnewstitle"><?php echo cssJSToolbox::getText('Latest News:') ?> <a target="_blank" href="<?php echo $latestNew['link'] ?>"><?php echo $latestNew['title'] ?></a></span>
|
7 |
+
<p class="cjt_dw_description"><?php echo $latestNew['description'] ?></p>
|
8 |
+
</div>
|
9 |
<table id="cjt-statcs-metabox">
|
10 |
<thead>
|
11 |
<tr>
|
39 |
</tr>
|
40 |
<tr>
|
41 |
<td class="latest-scripts" colspan="2">
|
42 |
+
<?php foreach ($this->feed['scripts'] as $item) : ?>
|
43 |
+
<em><?php echo cssJSToolbox::getText('Latest') ?>:</em> <a target="_blank" href="<?php echo $item['link'] ?>"><?php echo $item['title'] ?></a>
|
44 |
<?php endforeach; ?>
|
45 |
</td>
|
46 |
</tr>
|
views/dashboard/metabox/statistics/view.php
CHANGED
@@ -13,9 +13,9 @@ class CJTDashboardMetaboxStatisticsView extends CJTView {
|
|
13 |
|
14 |
protected $activeBlocks;
|
15 |
protected $activeMetaboxBlocks;
|
|
|
16 |
protected $inactiveBlocks;
|
17 |
protected $inactiveMetaboxBlocks;
|
18 |
-
protected $latestSripts;
|
19 |
protected $scriptsPackage;
|
20 |
protected $templates;
|
21 |
|
@@ -48,7 +48,7 @@ class CJTDashboardMetaboxStatisticsView extends CJTView {
|
|
48 |
$this->inactiveMetaboxBlocks = $model->getBlocksCount('inactive', 'Metabox');
|
49 |
$this->scriptsPackage = $model->getPackagesCount();
|
50 |
$this->templates = $model->getTemplatesCount();
|
51 |
-
$this->
|
52 |
// Display.
|
53 |
echo $this->getTemplate($tmpl);
|
54 |
}
|
13 |
|
14 |
protected $activeBlocks;
|
15 |
protected $activeMetaboxBlocks;
|
16 |
+
protected $feed;
|
17 |
protected $inactiveBlocks;
|
18 |
protected $inactiveMetaboxBlocks;
|
|
|
19 |
protected $scriptsPackage;
|
20 |
protected $templates;
|
21 |
|
48 |
$this->inactiveMetaboxBlocks = $model->getBlocksCount('inactive', 'Metabox');
|
49 |
$this->scriptsPackage = $model->getPackagesCount();
|
50 |
$this->templates = $model->getTemplatesCount();
|
51 |
+
$this->feed = $model->getFeed();
|
52 |
// Display.
|
53 |
echo $this->getTemplate($tmpl);
|
54 |
}
|