initial commit
This commit is contained in:
commit
30a7fdd198
88
CHANGELOG
Normal file
88
CHANGELOG
Normal file
@ -0,0 +1,88 @@
|
||||
enhancePostContent xxxx.xx.xx
|
||||
===========================================================
|
||||
* Not added priority on filters for replacement order
|
||||
* Not added priority on lists of filters for replacement order
|
||||
* Not added auto-find post title in content
|
||||
|
||||
enhancePostContent 2013.11.08
|
||||
===========================================================
|
||||
* Switch to Dotclear 2.6 (admin styles and settings)
|
||||
* Add dashboard icon
|
||||
* Add widget options (content_only and class)
|
||||
* Fix records list pager
|
||||
|
||||
enhancePostContent 2013.06.25
|
||||
===========================================================
|
||||
* Fixed widget compatibility for php 5.4
|
||||
|
||||
enhancePostContent 2013.05.11
|
||||
===========================================================
|
||||
* Fixed bug with Twitter replacement and wiki synthax of blockquote
|
||||
* Fixed page title
|
||||
|
||||
enhancePostContent 2011.06.03
|
||||
===========================================================
|
||||
* Added 'feeds pages'
|
||||
|
||||
enhancePostContent 0.9 - 2010-06-06
|
||||
===========================================================
|
||||
* Switched to DC 2.2
|
||||
|
||||
enhancePostContent 0.8.1 - 2010-03-31
|
||||
===========================================================
|
||||
* Fixed some l10n
|
||||
* Added option for default list order
|
||||
|
||||
enhancePostContent 0.8 - 2010-03-31
|
||||
===========================================================
|
||||
* Added admin lists sortable
|
||||
* Added pager for admin lists
|
||||
* Added update on records
|
||||
* Changed title of HTML tag on links replacement
|
||||
* Removed empty CSS from head
|
||||
* Enhanced admin pages
|
||||
|
||||
enhancePostContent 0.7 - 2010-01-12
|
||||
===========================================================
|
||||
* Moved lists from setting to a new database
|
||||
|
||||
enhancePostContent 0.6 - 2010-01-09
|
||||
===========================================================
|
||||
* Fixed HTML tags to use standard tags.
|
||||
* Fixed CSS class names
|
||||
* Changed settings management
|
||||
* Added widget (only for post page)
|
||||
* Added some post enhancement
|
||||
|
||||
enhancePostContent 0.5 - 2009-12-28
|
||||
===========================================================
|
||||
* Added support of comment content
|
||||
* Added support of word replacement
|
||||
* Added option for case sensitive
|
||||
* Added option for plural
|
||||
* Changed class from post-xxx to epc-xxx
|
||||
* Changed names from acronyme to acronym
|
||||
* Changed acronym html tag from <span> to <acronym>
|
||||
* Changed all settings management
|
||||
|
||||
enhancePostContent 0.4 - 2009-12-24
|
||||
===========================================================
|
||||
* Merry Christmas!
|
||||
* enhanced filters
|
||||
* Added support of entry excerpt
|
||||
* Added support of custom ignored HTML tags
|
||||
* Added some help
|
||||
|
||||
enhancePostContent 0.3 - 2009-12-21
|
||||
===========================================================
|
||||
* Fixed filter with punctuation (slow hack)
|
||||
* Added word-to-link filter
|
||||
|
||||
enhancePostContent 0.2 - 2009-12-12
|
||||
===========================================================
|
||||
* Fixed case sensitive definition
|
||||
* Prepared DC 2.2
|
||||
|
||||
enhancePostContent 0.1 - 2009-10-17
|
||||
===========================================================
|
||||
* First release
|
339
LICENSE
Normal file
339
LICENSE
Normal file
@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
30
README.md
Normal file
30
README.md
Normal file
@ -0,0 +1,30 @@
|
||||
# README
|
||||
|
||||
## WHAT IS ENHANCEPOSTCONTENT ?
|
||||
|
||||
"Enhance Post Content" is a plugin for the open-source
|
||||
web publishing software called Dotclear.
|
||||
|
||||
It help to filter post content and extract or
|
||||
show inline more info about words and expressions such as
|
||||
atgs, acronyms, abbreviations, definition, citation, link, etc...
|
||||
|
||||
## REQUIREMENTS
|
||||
|
||||
enhancePostContent requires:
|
||||
|
||||
* admin permissions to set up plugin
|
||||
* content admin permissions to manage fitlers
|
||||
* Dotclear 2.6
|
||||
|
||||
## USAGE
|
||||
|
||||
First install enhancePostContent, manualy from a zip package or from
|
||||
Dotaddict repository. (See Dotclear's documentation to know how do this)
|
||||
|
||||
Go to ''plugins manager'', expand enhancePostContent information then
|
||||
go to ''configure plugin'', fill in form.
|
||||
|
||||
Once it's done you can manage filters from menu
|
||||
''Enhance Post Content'' on sidebar or you can add dashboard icon,
|
||||
you should also add widgets.
|
62
_admin.php
Normal file
62
_admin.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/_widgets.php';
|
||||
|
||||
# Admin menu
|
||||
$_menu['Blog']->addItem(
|
||||
__('Enhance post content'),
|
||||
'plugin.php?p=enhancePostContent',
|
||||
'index.php?pf=enhancePostContent/icon.png',
|
||||
preg_match(
|
||||
'/plugin.php\?p=enhancePostContent(&.*)?$/',
|
||||
$_SERVER['REQUEST_URI']
|
||||
),
|
||||
$core->auth->check('contentadmin', $core->blog->id)
|
||||
);
|
||||
|
||||
$core->addBehavior(
|
||||
'adminDashboardFavorites',
|
||||
array('epcAdminBehaviors', 'adminDashboardFavorites')
|
||||
);
|
||||
|
||||
class epcAdminBehaviors
|
||||
{
|
||||
public static function adminDashboardFavorites($core, $favs)
|
||||
{
|
||||
$favs->register('enhancePostContent', array(
|
||||
'title' => __('Enhance post content'),
|
||||
'url' => 'plugin.php?p=enhancePostContent',
|
||||
'small-icon' => 'index.php?pf=enhancePostContent/icon.png',
|
||||
'large-icon' => 'index.php?pf=enhancePostContent/icon-big.png',
|
||||
'permissions' => $core->auth->check('contentadmin', $core->blog->id),
|
||||
'active_cb' => array(
|
||||
'epcAdminBehaviors',
|
||||
'adminDashboardFavoritesActive'
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public static function adminDashboardFavoritesActive($request, $params)
|
||||
{
|
||||
return $request == 'plugin.php'
|
||||
&& isset($params['p'])
|
||||
&& $params['p'] == 'enhancePostContent';
|
||||
}
|
||||
}
|
131
_config.php
Normal file
131
_config.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_CONTEXT_MODULE')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$redir = empty($_REQUEST['redir']) ?
|
||||
$list->getURL().'#plugins' : $_REQUEST['redir'];
|
||||
|
||||
# -- Form combos --
|
||||
$sortby_combo = array(
|
||||
__('Date') => 'epc_upddt',
|
||||
__('Key') => 'epc_key',
|
||||
__('Value') => 'epc_value',
|
||||
__('ID') => 'epc_id'
|
||||
);
|
||||
|
||||
$order_combo = array(
|
||||
__('Ascending') => 'asc',
|
||||
__('Descending') => 'desc'
|
||||
);
|
||||
|
||||
# -- Get settings --
|
||||
$core->blog->settings->addNamespace('enhancePostContent');
|
||||
$s = $core->blog->settings->enhancePostContent;
|
||||
$active = (boolean) $s->enhancePostContent_active;
|
||||
$list_sortby = (string) $s->enhancePostContent_list_sortby;
|
||||
$list_order = (string) $s->enhancePostContent_list_order;
|
||||
$list_nb = (integer) $s->enhancePostContent_list_nb;
|
||||
$_filters = libEPC::blogFilters();
|
||||
$allowedtplvalues = libEPC::blogAllowedTplValues();
|
||||
$allowedpubpages = libEPC::blogAllowedPubPages();
|
||||
|
||||
# -- Set settings --
|
||||
if (!empty($_POST['save'])) {
|
||||
|
||||
try {
|
||||
$active = !empty($_POST['active']);
|
||||
$list_sortby = in_array($_POST['list_sortby'], $sortby_combo) ?
|
||||
$_POST['list_sortby'] : 'epc_id';
|
||||
$list_order = in_array($_POST['list_order'], $order_combo) ?
|
||||
$_POST['list_order'] : 'desc';
|
||||
$list_nb = isset($_POST['list_nb']) && $_POST['list_nb'] > 0 ?
|
||||
$_POST['list_nb'] : 20;
|
||||
|
||||
$s->put('enhancePostContent_active', $active);
|
||||
$s->put('enhancePostContent_list_sortby', $list_sortby);
|
||||
$s->put('enhancePostContent_list_order', $list_order);
|
||||
$s->put('enhancePostContent_list_nb', $list_nb);
|
||||
|
||||
$allowedtplvalues = libEPC::explode($_POST['allowedtplvalues']);
|
||||
$allowedpubpages = libEPC::explode($_POST['allowedpubpages']);
|
||||
|
||||
$s->put(
|
||||
'enhancePostContent_allowedtplvalues',
|
||||
serialize($allowedtplvalues)
|
||||
);
|
||||
$s->put(
|
||||
'enhancePostContent_allowedpubpages',
|
||||
serialize($allowedpubpages)
|
||||
);
|
||||
|
||||
$core->blog->triggerBlog();
|
||||
|
||||
dcPage::addSuccessNotice(
|
||||
__('Configuration has been successfully updated.')
|
||||
);
|
||||
http::redirect(
|
||||
$list->getURL('module=enhancePostContent&conf=1&redir='.
|
||||
$list->getRedir())
|
||||
);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
# -- Display form --
|
||||
echo '
|
||||
|
||||
<div class="fieldset">
|
||||
<h4>'.__('General').'</h4>
|
||||
<p>'.__('This enable public widgets and contents filter.').'</p>
|
||||
|
||||
<p><label class="classic" for="active">'.
|
||||
form::checkbox('active', 1, $active).
|
||||
__('Enable plugin').'</label></p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="fieldset">
|
||||
<h4>'.__('Record list').'</h4>
|
||||
<p>'.__('This is the default order of records lists.').'</p>
|
||||
|
||||
<p><label for="list_sortby">'.__('Order by:').'</label>'.
|
||||
form::combo('list_sortby', $sortby_combo, $list_sortby).'</p>
|
||||
|
||||
<p><label for="list_order">'.__('Sort:').'</label>'.
|
||||
form::combo('list_order', $order_combo, $list_order).'</p>
|
||||
|
||||
<p><label for="list_nb">'.__('Records per page:').'</label>'.
|
||||
form::field('list_nb', 3, 3, $list_nb).'</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="fieldset">
|
||||
<h4>'.__('Extra').'</h4>
|
||||
<p>'.__('This is a special feature to edit list of allowed template values and public pages where this plugin works.').'</p>
|
||||
|
||||
<p><label for="allowedtplvalues">'.__('Allowed DC template values:').'</label>'.
|
||||
form::field('allowedtplvalues', 100,0, libEPC::implode($allowedtplvalues)).'</p>
|
||||
<p class="form-note">'.__('Use "readable_name1:template_value1;readable_name2:template_value2;" like "entry content:EntryContent;entry excerpt:EntryExcerpt;".').'</p>
|
||||
|
||||
<p><label for="allowedpubpages">'.__('Allowed public pages:').'</label>'.
|
||||
form::field('allowedpubpages', 100, 0, libEPC::implode($allowedpubpages)).'</p>
|
||||
<p class="form-note">'.__('Use "readable_name1:template_page1;readable_name2:template_page2;" like "post page:post.html;home page:home.html;".').'</p>
|
||||
|
||||
</div>';
|
36
_define.php
Normal file
36
_define.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->registerModule(
|
||||
/* Name */
|
||||
"Enhance post content",
|
||||
/* Description*/
|
||||
"Add features to words in post content",
|
||||
/* Author */
|
||||
"Jean-Christian Denis",
|
||||
/* Version */
|
||||
'2013.11.08',
|
||||
array(
|
||||
'permissions' => 'contentadmin',
|
||||
'type' => 'plugin',
|
||||
'dc_min' => '2.6',
|
||||
'support' => 'http://jcd.lv/q=enhancePostContent',
|
||||
'details' => 'http://plugins.dotaddict.org/dc2/details/enhancePostContent'
|
||||
)
|
||||
);
|
105
_install.php
Normal file
105
_install.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$dc_min = '2.6';
|
||||
$mod_id = 'enhancePostContent';
|
||||
$new_version = $core->plugins->moduleInfo($mod_id, 'version');
|
||||
$old_version = $core->getVersion($mod_id);
|
||||
|
||||
if (version_compare($old_version, $new_version, '>=')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
# Check Dotclear version
|
||||
if (!method_exists('dcUtils', 'versionsCompare')
|
||||
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
|
||||
throw new Exception(sprintf(
|
||||
'%s requires Dotclear %s', $mod_id, $dc_min
|
||||
));
|
||||
}
|
||||
|
||||
# Database
|
||||
$s = new dbStruct($core->con, $core->prefix);
|
||||
$s->epc
|
||||
->epc_id ('bigint', 0, false)
|
||||
->blog_id ('varchar', 32, false)
|
||||
->epc_type('varchar', 32, false, "'epc'")
|
||||
->epc_filter('varchar', 64, false)
|
||||
->epc_key('varchar', 255, false)
|
||||
->epc_value('text', 0, false)
|
||||
->epc_upddt('timestamp', 0, false, 'now()')
|
||||
|
||||
->primary('pk_epc', 'epc_id')
|
||||
->index('idx_epc_blog_id', 'btree', 'blog_id')
|
||||
->index('idx_epc_type', 'btree', 'epc_type')
|
||||
->index('idx_epc_filter', 'btree', 'epc_filter')
|
||||
->index('idx_epc_key', 'btree', 'epc_key');
|
||||
|
||||
$si = new dbStruct($core->con, $core->prefix);
|
||||
$changes = $si->synchronize($s);
|
||||
$s = null;
|
||||
|
||||
# Settings
|
||||
$core->blog->settings->addNamespace($mod_id);
|
||||
$s = $core->blog->settings->enhancePostContent;
|
||||
|
||||
$s->put('enhancePostContent_active', false,'boolean', 'Enable enhancePostContent', false, true);
|
||||
$s->put('enhancePostContent_list_sortby', 'epc_key', 'string', 'Admin records list field order', false, true);
|
||||
$s->put('enhancePostContent_list_order', 'desc', 'string', 'Admin records list order', false, true);
|
||||
$s->put('enhancePostContent_list_nb', 20, 'integer', 'Admin records list nb per page', false, true);
|
||||
$s->put('enhancePostContent_allowedtplvalues', serialize(libEPC::defaultAllowedTplValues()), 'string', 'List of allowed template values', false, true);
|
||||
$s->put('enhancePostContent_allowedpubpages', serialize(libEPC::defaultAllowedPubPages()), 'string', 'List of allowed template pages', false, true);
|
||||
|
||||
# Filters settings
|
||||
$filters = libEPC::defaultFilters();
|
||||
foreach($filters as $name => $filter) {
|
||||
# Only editable options
|
||||
$opt = array(
|
||||
'nocase' => $filter['nocase'],
|
||||
'plural' => $filter['plural'],
|
||||
'style' => $filter['style'],
|
||||
'notag' => $filter['notag'],
|
||||
'tplValues' => $filter['tplValues'],
|
||||
'pubPages' => $filter['pubPages']
|
||||
);
|
||||
$s->put('enhancePostContent_'.$name, serialize($opt), 'string', 'Settings for '.$name, false, true);
|
||||
# only tables
|
||||
if (isset($filter['list'])) {
|
||||
$s->put('enhancePostContent_'.$name.'List', serialize($filter['list']), 'string', 'List for '.$name, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
# Move old filters lists from settings to database
|
||||
if ($old_version && version_compare('0.6.6', $old_version, '>=')) {
|
||||
include_once dirname(__FILE__).'/inc/lib.epc.update.php';
|
||||
}
|
||||
|
||||
# Version
|
||||
$core->setVersion($mod_id, $new_version);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
return false;
|
23
_prepend.php
Normal file
23
_prepend.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$d = dirname(__FILE__).'/inc/';
|
||||
|
||||
$__autoload['libEPC'] = $d.'lib.epc.php';
|
||||
$__autoload['epcRecords'] = $d.'lib.epc.records.php';
|
112
_public.php
Normal file
112
_public.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
require dirname(__FILE__).'/_widgets.php';
|
||||
|
||||
$core->blog->settings->addNamespace('enhancePostContent');
|
||||
|
||||
if ($core->blog->settings->enhancePostContent->enhancePostContent_active) {
|
||||
|
||||
$core->addBehavior(
|
||||
'publicHeadContent',
|
||||
array('publicEnhancePostContent', 'publicHeadContent')
|
||||
);
|
||||
$core->addBehavior(
|
||||
'publicBeforeContentFilter',
|
||||
array('publicEnhancePostContent', 'publicContentFilter')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup DC_PLUGIN_ENHANCEPOSTCONTENT
|
||||
* @brief Filter posts content - public methods.
|
||||
* @since 2.6
|
||||
*/
|
||||
class publicEnhancePostContent
|
||||
{
|
||||
/**
|
||||
* Add filters CSS to page header
|
||||
*
|
||||
* @param dcCore $core dcCore instance
|
||||
*/
|
||||
public static function publicHeadContent(dcCore $core)
|
||||
{
|
||||
$filters = libEPC::blogFilters();
|
||||
|
||||
foreach($filters as $name => $filter) {
|
||||
|
||||
if (empty($filter['class'])
|
||||
|| empty($filter['style'])
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$res = '';
|
||||
foreach($filter['class'] as $k => $class) {
|
||||
$style = html::escapeHTML(trim($filter['style'][$k]));
|
||||
if ('' != $style) {
|
||||
$res .= $class." {".$style."} ";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($res)) {
|
||||
echo
|
||||
"\n<!-- CSS for enhancePostContent ".$name." --> \n".
|
||||
"<style type=\"text/css\"> ".$res."</style> \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter template blocks content
|
||||
*
|
||||
* @param dcCore $core dcCore instance
|
||||
* @param string $tag Tempalte block name
|
||||
* @param array $args Tempalte Block arguments
|
||||
*/
|
||||
public static function publicContentFilter(dcCore $core, $tag, $args)
|
||||
{
|
||||
$filters = libEPC::blogFilters();
|
||||
$records = new epcRecords($core);
|
||||
|
||||
foreach($filters as $name => $filter) {
|
||||
|
||||
if (!isset($filter['publicContentFilter'])
|
||||
|| !is_callable($filter['publicContentFilter'])
|
||||
|| !libEPC::testContext($tag,$args,$filter)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($filter['has_list']) {
|
||||
$filter['list'] = $records->getRecords(array(
|
||||
'epc_filter' => $name)
|
||||
);
|
||||
if ($filter['list']->isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
call_user_func_array(
|
||||
$filter['publicContentFilter'],
|
||||
array($core, $filter, $tag, $args)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
59
_uninstall.php
Normal file
59
_uninstall.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')){return;}
|
||||
|
||||
$this->addUserAction(
|
||||
/* type */ 'settings',
|
||||
/* action */ 'delete_all',
|
||||
/* ns */ 'enhancePostContent',
|
||||
/* description */ __('delete all settings')
|
||||
);
|
||||
|
||||
$this->addUserAction(
|
||||
/* type */ 'plugins',
|
||||
/* action */ 'delete',
|
||||
/* ns */ 'enhancePostContent',
|
||||
/* description */ __('delete plugin files')
|
||||
);
|
||||
|
||||
$this->addUserAction(
|
||||
/* type */ 'versions',
|
||||
/* action */ 'delete',
|
||||
/* ns */ 'enhancePostContent',
|
||||
/* description */ __('delete the version number')
|
||||
);
|
||||
|
||||
|
||||
$this->addDirectAction(
|
||||
/* type */ 'settings',
|
||||
/* action */ 'delete_all',
|
||||
/* ns */ 'enhancePostContent',
|
||||
/* description */ sprintf(__('delete all %s settings'),'enhancePostContent')
|
||||
);
|
||||
|
||||
$this->addDirectAction(
|
||||
/* type */ 'plugins',
|
||||
/* action */ 'delete',
|
||||
/* ns */ 'enhancePostContent',
|
||||
/* description */ sprintf(__('delete %s plugin files'),'enhancePostContent')
|
||||
);
|
||||
|
||||
$this->addDirectAction(
|
||||
/* type */ 'versions',
|
||||
/* action */ 'delete',
|
||||
/* ns */ 'enhancePostContent',
|
||||
/* description */ sprintf(__('delete %s version number'),'enhancePostContent')
|
||||
);
|
||||
?>
|
221
_widgets.php
Normal file
221
_widgets.php
Normal file
@ -0,0 +1,221 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$core->addBehavior(
|
||||
'initWidgets',
|
||||
array('enhancePostContentWidget', 'adminContentList')
|
||||
);
|
||||
|
||||
/**
|
||||
* @ingroup DC_PLUGIN_ENHANCEPOSTCONTENT
|
||||
* @brief Filter posts content - widgets methods.
|
||||
* @since 2.6
|
||||
*/
|
||||
class enhancePostContentWidget
|
||||
{
|
||||
/**
|
||||
* Admin part for widget that show extracted content
|
||||
*
|
||||
* @param dcWidgets $w dcWidgets instance
|
||||
*/
|
||||
public static function adminContentList($w)
|
||||
{
|
||||
global $core;
|
||||
|
||||
$w->create(
|
||||
'epclist',
|
||||
__('Enhance post content'),
|
||||
array('enhancePostContentWidget', 'publicContentList'),
|
||||
null,
|
||||
__('List filtered contents.')
|
||||
);
|
||||
# Title
|
||||
$w->epclist->setting(
|
||||
'title',
|
||||
__('Title:'),
|
||||
__('In this article'),
|
||||
'text'
|
||||
);
|
||||
# Text
|
||||
$w->epclist->setting(
|
||||
'text',
|
||||
__('Description:'),
|
||||
'',
|
||||
'text'
|
||||
);
|
||||
# Type
|
||||
$filters = libEPC::blogFilters();
|
||||
$types = array();
|
||||
foreach($filters as $name => $filter)
|
||||
{
|
||||
if (!isset($filter['widgetListFilter'])
|
||||
|| !is_callable($filter['widgetListFilter'])
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$types[__($name)] = $name;
|
||||
}
|
||||
$w->epclist->setting(
|
||||
'type',
|
||||
__('Type:'),
|
||||
'Definition',
|
||||
'combo',
|
||||
$types
|
||||
);
|
||||
# Content
|
||||
$contents = libEPC::defaultAllowedWidgetValues();
|
||||
foreach($contents as $k => $v) {
|
||||
$w->epclist->setting(
|
||||
'content'.$v['id'],
|
||||
sprintf(__('Enable filter on %s'), __($k)),
|
||||
1,
|
||||
'check'
|
||||
);
|
||||
}
|
||||
# Case sensitive
|
||||
$w->epclist->setting(
|
||||
'nocase',
|
||||
__('Search case insensitive'),
|
||||
0,
|
||||
'check'
|
||||
);
|
||||
# Plural
|
||||
$w->epclist->setting(
|
||||
'plural',
|
||||
__('Search also plural'),
|
||||
0,
|
||||
'check'
|
||||
);
|
||||
# Show count
|
||||
$w->epclist->setting(
|
||||
'show_total',
|
||||
__('Show the number of appearance'),
|
||||
1,
|
||||
'check'
|
||||
);
|
||||
# widget option - content only
|
||||
$w->epclist->setting(
|
||||
'content_only',
|
||||
__('Content only'),
|
||||
0,
|
||||
'check'
|
||||
);
|
||||
# widget option - additionnal CSS
|
||||
$w->epclist->setting(
|
||||
'class',
|
||||
__('CSS class:'),
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Public part for widget that show extracted content
|
||||
*
|
||||
* @param dcWidget $w dcWidget instance
|
||||
*/
|
||||
public static function publicContentList($w)
|
||||
{
|
||||
global $core, $_ctx;
|
||||
|
||||
$core->blog->settings->addNamespace('enhancePostContent');
|
||||
|
||||
# Page
|
||||
if (!$core->blog->settings->enhancePostContent->enhancePostContent_active
|
||||
|| !in_array($_ctx->current_tpl,array('post.html','page.html'))
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
# Content
|
||||
$content = '';
|
||||
$allowedwidgetvalues = libEPC::defaultAllowedWidgetValues();
|
||||
foreach($allowedwidgetvalues as $k => $v) {
|
||||
|
||||
$ns = 'content'.$v['id'];
|
||||
if ($w->$ns && is_callable($v['callback'])) {
|
||||
|
||||
$content .= call_user_func_array(
|
||||
$v['callback'],
|
||||
array($core,$w)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($content)) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
# Filter
|
||||
$list = array();
|
||||
$filters = libEPC::blogFilters();
|
||||
|
||||
if (isset($filters[$w->type])
|
||||
&& isset($filters[$w->type]['widgetListFilter'])
|
||||
&& is_callable($filters[$w->type]['widgetListFilter'])
|
||||
) {
|
||||
$filters[$w->type]['nocase'] = $w->nocase;
|
||||
$filters[$w->type]['plural'] = $w->plural;
|
||||
|
||||
if ($filters[$w->type]['has_list']) {
|
||||
$records = new epcRecords($core);
|
||||
$filters[$w->type]['list'] = $records->getRecords(
|
||||
array('epc_filter' => $w->type)
|
||||
);
|
||||
}
|
||||
|
||||
call_user_func_array(
|
||||
$filters[$w->type]['widgetListFilter'],
|
||||
array($core, $filters[$w->type], $content, $w, &$list)
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($list)) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
# Parse result
|
||||
$res = '';
|
||||
foreach($list as $line) {
|
||||
if (empty($line['matches'][0]['match'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$res .=
|
||||
'<li>'.$line['matches'][0]['match'].
|
||||
($w->show_total ? ' ('.$line['total'].')' : '').
|
||||
'</li>';
|
||||
}
|
||||
|
||||
if (empty($res)) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return
|
||||
($w->content_only ? '' : '<div class="epc-widgetlist'.
|
||||
($w->class ? ' '.html::escapeHTML($w->class) : '').'"">').
|
||||
($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : '').
|
||||
($w->text ? '<p>'.html::escapeHTML($w->text).'</p>' : '').
|
||||
'<ul>'.$res.'</ul>'.
|
||||
($w->content_only ? '' : '</div>');
|
||||
}
|
||||
}
|
BIN
icon-big.png
Normal file
BIN
icon-big.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
800
inc/lib.epc.php
Normal file
800
inc/lib.epc.php
Normal file
@ -0,0 +1,800 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
# l10n
|
||||
__('Tag');__('Search');__('Acronym');__('Abbreviation');__('Definition');
|
||||
__('Citation');__('Link');__('Replace');__('Update');__('Twitter');
|
||||
__('entry excerpt');__('entry content');__('comment content');
|
||||
__('home page');__('post page');__('category page');__('search results page');
|
||||
__('atom feeds');__('RSS feeds');
|
||||
|
||||
class libEPC
|
||||
{
|
||||
#
|
||||
# Default definition
|
||||
#
|
||||
|
||||
public static function defaultAllowedTplValues()
|
||||
{
|
||||
return array(
|
||||
'entry excerpt' => 'EntryExcerpt',
|
||||
'entry content' => 'EntryContent',
|
||||
'comment content' => 'CommentContent',
|
||||
);
|
||||
}
|
||||
|
||||
public static function blogAllowedTplValues()
|
||||
{
|
||||
global $core;
|
||||
$core->blog->settings->addNamespace('enhancePostContent');
|
||||
$allowedtplvalues = self::defaultAllowedTplValues();
|
||||
$rs = @unserialize($core->blog->settings->enhancePostContent->enhancePostContent_allowedtplvalues);
|
||||
return is_array($rs) ? $rs : $allowedtplvalues;
|
||||
}
|
||||
|
||||
public static function defaultAllowedWidgetValues()
|
||||
{
|
||||
global $core;
|
||||
|
||||
$rs = array(
|
||||
'entry excerpt' => array(
|
||||
'id' => 'entryexcerpt',
|
||||
'callback' => array('libEPC','widgetContentEntryExcerpt')
|
||||
),
|
||||
'entry content' => array(
|
||||
'id' => 'entrycontent',
|
||||
'callback' => array('libEPC','widgetContentEntryContent')
|
||||
),
|
||||
'comment content' => array(
|
||||
'id' => 'commentcontent',
|
||||
'callback' => array('libEPC','widgetContentCommentContent')
|
||||
)
|
||||
);
|
||||
|
||||
$core->callBehavior('enhancePostContentAllowedWidgetValues',$rs);
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public static function defaultAllowedPubPages()
|
||||
{
|
||||
return array(
|
||||
'home page' => 'home.html',
|
||||
'post page' => 'post.html',
|
||||
'category page' => 'category.html',
|
||||
'search results page' => 'search.html',
|
||||
'atom feeds' => 'atom.xml',
|
||||
'RSS feeds' => 'rss2.xml'
|
||||
);
|
||||
}
|
||||
|
||||
public static function blogAllowedPubPages()
|
||||
{
|
||||
global $core;
|
||||
$core->blog->settings->addNamespace('enhancePostContent');
|
||||
$allowedpubpages = self::defaultAllowedPubPages();
|
||||
$rs = @unserialize($core->blog->settings->enhancePostContent->enhancePostContent_allowedpubpages);
|
||||
return is_array($rs) ? $rs : $allowedpubpages;
|
||||
}
|
||||
|
||||
public static function defaultFilters()
|
||||
{
|
||||
global $core;
|
||||
|
||||
$filters = array(
|
||||
'Tag' => array(
|
||||
'id' => 'tag',
|
||||
'publicContentFilter' => array('libEPC','publicContentFilterTag'),
|
||||
'widgetListFilter' => array('libEPC','widgetListTag'),
|
||||
|
||||
'help' => __('Highlight tags of your blog.'),
|
||||
'has_list' => false,
|
||||
'htmltag' => 'a',
|
||||
'class' => array('a.epc-tag'),
|
||||
'replace' => '<a class="epc-tag" href="%s" title="'.__('Tag').'">%s</a>',
|
||||
'widget' => '<a href="%s" title="'.__('Tag').'">%s</a>',
|
||||
|
||||
'nocase' => false,
|
||||
'plural' => false,
|
||||
'limit' => 0,
|
||||
'style' => array('text-decoration: none; border-bottom: 3px double #CCCCCC;'),
|
||||
'notag' => 'a,h1,h2,h3',
|
||||
'tplValues' => array('EntryContent'),
|
||||
'pubPages' => array('post.html')
|
||||
),
|
||||
'Search' => array(
|
||||
'id' => 'search',
|
||||
'publicContentFilter' => array('libEPC','publicContentFilterSearch'),
|
||||
|
||||
'help' => __('Highlight searched words.'),
|
||||
'has_list' => false,
|
||||
'htmltag' => '',
|
||||
'class' => array('span.epc-search'),
|
||||
'replace' => '<span class="epc-search" title="'.__('Search').'">%s</span>',
|
||||
|
||||
'nocase' => true,
|
||||
'plural' => true,
|
||||
'limit' => 0,
|
||||
'style' => array('color: #FFCC66;'),
|
||||
'notag' => 'h1,h2,h3',
|
||||
'tplValues' => array('EntryContent'),
|
||||
'pubPages' => array('search.html')
|
||||
),
|
||||
'Acronym' => array(
|
||||
'id' => 'acronym',
|
||||
'publicContentFilter' => array('libEPC','publicContentFilterAcronym'),
|
||||
'widgetListFilter' => array('libEPC','widgetListAcronym'),
|
||||
|
||||
'help' => __('Explain some acronyms. First term of the list is the acornym and second term the explanation.'),
|
||||
'has_list' => true,
|
||||
'htmltag' => 'acronym',
|
||||
'class' => array('acronym.epc-acronym'),
|
||||
'replace' => '<acronym class="epc-acronym" title="%s">%s</acronym>',
|
||||
'widget' => '<acronym title="%s">%s</acronym>',
|
||||
|
||||
'nocase' => false,
|
||||
'plural' => false,
|
||||
'limit' => 0,
|
||||
'style' => array('font-weight: bold;'),
|
||||
'notag' => 'a,acronym,abbr,dfn,h1,h2,h3',
|
||||
'tplValues' => array('EntryContent'),
|
||||
'pubPages' => array('post.html'),
|
||||
),
|
||||
'Abbreviation' => array(
|
||||
'id' => 'abbreviation',
|
||||
'publicContentFilter' => array('libEPC','publicContentFilterAbbreviation'),
|
||||
'widgetListFilter' => array('libEPC','widgetListAbbreviation'),
|
||||
|
||||
'help' => __('Explain some abbreviation. First term of the list is the abbreviation and second term the explanation.'),
|
||||
'has_list' => true,
|
||||
'htmltag' => 'a',
|
||||
'class' => array('abbr.epc-abbr'),
|
||||
'replace' => '<abbr class="epc-abbr" title="%s">%s</abbr>',
|
||||
'widget' => '<abbr title="%s">%s</abbr>',
|
||||
|
||||
'nocase' => false,
|
||||
'plural' => false,
|
||||
'limit' => 0,
|
||||
'style' => array('font-weight: bold;'),
|
||||
'notag' => 'a,acronym,abbr,dfn,h1,h2,h3',
|
||||
'tplValues' => array('EntryContent'),
|
||||
'pubPages' => array('post.html'),
|
||||
),
|
||||
'Definition' => array(
|
||||
'id' => 'definition',
|
||||
'publicContentFilter' => array('libEPC','publicContentFilterDefinition'),
|
||||
'widgetListFilter' => array('libEPC','widgetListDefinition'),
|
||||
|
||||
'help' => __('Explain some definition. First term of the list is the sample to define and second term the explanation.'),
|
||||
'has_list' => true,
|
||||
'htmltag' => 'dfn',
|
||||
'class' => array('dfn.epc-dfn'),
|
||||
'replace' => '<dfn class="epc-dfn" title="%s">%s</dfn>',
|
||||
'widget' => '<dfn class="epc-dfn" title="%s">%s</dfn>',
|
||||
|
||||
'nocase' => false,
|
||||
'plural' => false,
|
||||
'limit' => 0,
|
||||
'style' => array('font-weight: bold;'),
|
||||
'notag' => 'a,acronym,abbr,dfn,h1,h2,h3',
|
||||
'tplValues' => array('EntryContent'),
|
||||
'pubPages' => array('post.html'),
|
||||
),
|
||||
'Citation' => array(
|
||||
'id' => 'citation',
|
||||
'publicContentFilter' => array('libEPC','publicContentFilterCitation'),
|
||||
'widgetListFilter' => array('libEPC','widgetListCitation'),
|
||||
|
||||
'help' => __('Highlight citation of people. First term of the list is the citation and second term the author.'),
|
||||
'has_list' => true,
|
||||
'htmltag' => 'cite',
|
||||
'class' => array('cite.epc-cite'),
|
||||
'replace' => '<cite class="epc-cite" title="%s">%s</cite>',
|
||||
'widget' => '<cite title="%s">%s</cite>',
|
||||
|
||||
'nocase' => true,
|
||||
'plural' => false,
|
||||
'limit' => 0,
|
||||
'style' => array('font-style: italic;'),
|
||||
'notag' => 'a,h1,h2,h3',
|
||||
'tplValues' => array('EntryContent'),
|
||||
'pubPages' => array('post.html'),
|
||||
),
|
||||
'Link' => array(
|
||||
'id' => 'link',
|
||||
'publicContentFilter' => array('libEPC','publicContentFilterLink'),
|
||||
'widgetListFilter' => array('libEPC','widgetListLink'),
|
||||
|
||||
'help' => __('Link some words. First term of the list is the term to link and second term the link.'),
|
||||
'has_list' => true,
|
||||
'htmltag' => 'a',
|
||||
'class' => array('a.epc-link'),
|
||||
'replace' => '<a class="epc-link" title="%s" href="%s">%s</a>',
|
||||
'widget' => '<a title="%s" href="%s">%s</a>',
|
||||
|
||||
'nocase' => false,
|
||||
'plural' => false,
|
||||
'limit' => 0,
|
||||
'style' => array('text-decoration: none; font-style: italic; color: #0000FF;'),
|
||||
'notag' => 'a,h1,h2,h3',
|
||||
'tplValues' => array('EntryContent'),
|
||||
'pubPages' => array('post.html'),
|
||||
),
|
||||
'Replace' => array(
|
||||
'id' => 'replace',
|
||||
'publicContentFilter' => array('libEPC','publicContentFilterReplace'),
|
||||
|
||||
'help' => __('Replace some text. First term of the list is the text to replace and second term the replacement.'),
|
||||
'has_list' => true,
|
||||
'htmltag' => '',
|
||||
'class' => array('span.epc-replace'),
|
||||
'replace' => '<span class="epc-replace">%s</span>',
|
||||
|
||||
'nocase' => true,
|
||||
'plural' => true,
|
||||
'limit' => 0,
|
||||
'style' => array('font-style: italic;'),
|
||||
'notag' => 'h1,h2,h3',
|
||||
'tplValues' => array('EntryContent'),
|
||||
'pubPages' => array('post.html'),
|
||||
),
|
||||
'Update' => array(
|
||||
'id' => 'update',
|
||||
'publicContentFilter' => array('libEPC','publicContentFilterUpdate'),
|
||||
|
||||
'help' => __('Update and show terms. First term of the list is the term to update and second term the new term.'),
|
||||
'has_list' => true,
|
||||
'htmltag' => 'del,ins',
|
||||
'class' => array('del.epc-update','ins.epc-update'),
|
||||
'replace' => '<del class="epc-update">%s</del> <ins class="epc-update">%s</ins>',
|
||||
|
||||
'nocase' => true,
|
||||
'plural' => true,
|
||||
'limit' => 0,
|
||||
'style' => array('text-decoration: line-through;','font-style: italic;'),
|
||||
'notag' => 'h1,h2,h3',
|
||||
'tplValues' => array('EntryContent'),
|
||||
'pubPages' => array('post.html'),
|
||||
),
|
||||
'Twitter' => array(
|
||||
'id' => 'twitter',
|
||||
'publicContentFilter' => array('libEPC','publicContentFilterTwitter'),
|
||||
|
||||
'help' => __('Add link to twitter user page. Every word started with "@" will be considered as twitter user.'),
|
||||
'has_list' => false,
|
||||
'htmltag' => 'a',
|
||||
'class' => array('a.epc-twitter'),
|
||||
'replace' => '<a class="epc-twitter" title="'.__("View this user's twitter page").'" href="%s">%s</a>',
|
||||
|
||||
'nocase' => false,
|
||||
'plural' => false,
|
||||
'limit' => 0,
|
||||
'style' => array('text-decoration: none; font-weight: bold; font-style: italic; color: #0000FF;'),
|
||||
'notag' => 'a,h1,h2,h3',
|
||||
'tplValues' => array('EntryContent'),
|
||||
'pubPages' => array('post.html')
|
||||
)
|
||||
);
|
||||
|
||||
$core->callBehavior('enhancePostContentDefaultFilters',$filters);
|
||||
|
||||
return $filters;
|
||||
}
|
||||
|
||||
public static function blogFilters($one=null)
|
||||
{
|
||||
global $core;
|
||||
$core->blog->settings->addNamespace('enhancePostContent');
|
||||
$filters = self::defaultFilters();
|
||||
|
||||
foreach($filters as $name => $filter)
|
||||
{
|
||||
# Parse filters options
|
||||
$ns = 'enhancePostContent_'.$name;
|
||||
$opt[$name] = @unserialize($core->blog->settings->enhancePostContent->$ns);
|
||||
|
||||
if (!is_array($opt[$name]))
|
||||
{
|
||||
$opt[$name] = array();
|
||||
}
|
||||
if (isset($opt[$name]['nocase']))
|
||||
{
|
||||
$filters[$name]['nocase'] = (boolean) $opt[$name]['nocase'];
|
||||
}
|
||||
if (isset($opt[$name]['plural']))
|
||||
{
|
||||
$filters[$name]['plural'] = (boolean) $opt[$name]['plural'];
|
||||
}
|
||||
if (isset($opt[$name]['limit']))
|
||||
{
|
||||
$filters[$name]['limit'] = abs((integer) $opt[$name]['limit']);
|
||||
}
|
||||
if (isset($opt[$name]['style']) && is_array($opt[$name]['style']))
|
||||
{
|
||||
$filters[$name]['style'] = (array) $opt[$name]['style'];
|
||||
}
|
||||
if (isset($opt[$name]['notag']))
|
||||
{
|
||||
$filters[$name]['notag'] = (string) $opt[$name]['notag'];
|
||||
}
|
||||
if (isset($opt[$name]['tplValues']))
|
||||
{
|
||||
$filters[$name]['tplValues'] = (array) $opt[$name]['tplValues'];
|
||||
}
|
||||
if (isset($opt[$name]['pubPages']))
|
||||
{
|
||||
$filters[$name]['pubPages'] = (array) $opt[$name]['pubPages'];
|
||||
}
|
||||
}
|
||||
|
||||
$core->callBehavior('enhancePostContentBlogFilters',$filters);
|
||||
|
||||
return $filters;
|
||||
}
|
||||
|
||||
public static function testContext($tag,$args,$opt)
|
||||
{
|
||||
return
|
||||
isset($opt['pubPages'])
|
||||
&& is_array($opt['pubPages'])
|
||||
&& in_array($GLOBALS['_ctx']->current_tpl,$opt['pubPages'])
|
||||
&& isset($opt['tplValues'])
|
||||
&& is_array($opt['tplValues'])
|
||||
&& in_array($tag,$opt['tplValues'])
|
||||
&& $args[0] != '' //content
|
||||
&& !$args[2] // remove html
|
||||
;
|
||||
}
|
||||
|
||||
public static function replaceString($p,$r,$s,$filter,$before='\b',$after='\b')
|
||||
{
|
||||
# Limit
|
||||
if ($filter['limit'] > 0)
|
||||
{
|
||||
$l = isset($GLOBALS['epcFilterLimit'][$filter['id']][$p]) ? $GLOBALS['epcFilterLimit'][$filter['id']][$p] : $filter['limit'];
|
||||
if ($l < 1) return $s;
|
||||
} else {
|
||||
$l = -1;
|
||||
}
|
||||
# Case sensitive
|
||||
$i = $filter['nocase'] ? 'i' : '';
|
||||
# Plural
|
||||
$x = $filter['plural'] ? $p.'s|'.$p : $p;
|
||||
# Mark words
|
||||
$s = preg_replace('#('.$before.')('.$x.')('.$after.')#s'.$i,'$1ççççç$2ççççç$3',$s,-1,$count);
|
||||
# Nothing to parse
|
||||
if (!$count) return $s;
|
||||
# Remove words that are into unwanted html tags
|
||||
$tags = '';
|
||||
$ignore_tags = array_merge(self::decodeTags($filter['htmltag']),self::decodeTags($filter['notag']));
|
||||
if (is_array($ignore_tags) && !empty($ignore_tags))
|
||||
{
|
||||
$tags = implode('|',$ignore_tags);
|
||||
}
|
||||
if (!empty($tags))
|
||||
{
|
||||
$s = preg_replace_callback('#(<('.$tags.')[^>]*?>)(.*?)(</\\2>)#s',array('libEPC','removeTags'),$s);
|
||||
}
|
||||
# Remove words inside html tag (class, title, alt, href, ...)
|
||||
$s = preg_replace('#(ççççç('.$p.'(s|))ççççç)(?=[^<]+>)#s'.$i,'$2$4',$s);
|
||||
# Replace words by what you want (with limit)
|
||||
$s = preg_replace('#ççççç('.$p.'(s|))ççççç#s'.$i,$r,$s,$l,$count);
|
||||
# update limit
|
||||
$GLOBALS['epcFilterLimit'][$filter['id']][$p] = $l - $count;
|
||||
# Clean rest
|
||||
return $s = preg_replace('#ççççç(.*?)ççççç#s','$1',$s);
|
||||
}
|
||||
|
||||
public static function matchString($p,$r,$s,$filter,$before='\b',$after='\b')
|
||||
{
|
||||
# Case sensitive
|
||||
$i = $filter['nocase'] ? 'i' : '';
|
||||
# Plural
|
||||
$x = $filter['plural'] ? $p.'s|'.$p : $p;
|
||||
# Mark words
|
||||
$t = preg_match_all('#'.$before.'('.$x.')'.$after.'#s'.$i,$s,$matches);
|
||||
# Nothing to parse
|
||||
if (!$t) return array('total'=>0,'matches'=>array());
|
||||
|
||||
# Build array
|
||||
$m = array();
|
||||
$loop=0;
|
||||
foreach($matches[1] as $match)
|
||||
{
|
||||
$m[$loop]['key'] = $match;
|
||||
$m[$loop]['match'] = preg_replace('#('.$p.'(s|))#s'.$i,$r,$match,-1,$count);
|
||||
$m[$loop]['num'] = $count;
|
||||
$loop++;
|
||||
}
|
||||
return array('total'=>$t,'matches'=>$m);
|
||||
}
|
||||
|
||||
public static function quote($s)
|
||||
{
|
||||
return preg_quote($s,'#');
|
||||
}
|
||||
|
||||
public static function removeTags($m)
|
||||
{
|
||||
return $m[1].preg_replace('#ççççç(?!ççççç)#s','$1',$m[3]).$m[4];
|
||||
}
|
||||
|
||||
public static function decodeTags($t)
|
||||
{
|
||||
return preg_match_all('#([A-Za-z0-9]+)#',(string) $t, $m) ? $m[1] : array();
|
||||
}
|
||||
|
||||
public static function implode($a)
|
||||
{
|
||||
if (is_string($a)) return $a;
|
||||
if (!is_array($a)) return array();
|
||||
|
||||
$r = '';
|
||||
foreach($a as $k => $v)
|
||||
{
|
||||
$r .= $k.':'.$v.';';
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
public static function explode($s)
|
||||
{
|
||||
if (is_array($s)) return $s;
|
||||
if (!is_string($s)) return '';
|
||||
|
||||
$r = array();
|
||||
$s = explode(';',(string) $s);
|
||||
if (!is_array($s)) return array();
|
||||
|
||||
foreach($s as $cpl)
|
||||
{
|
||||
$cur = explode(':',$cpl);
|
||||
|
||||
if (!is_array($cur) || !isset($cur[1])) continue;
|
||||
|
||||
$key = html::escapeHTML(trim($cur[0]));
|
||||
$val = html::escapeHTML(trim($cur[1]));
|
||||
|
||||
if (empty($key) || empty($val)) continue;
|
||||
|
||||
$r[$key] = $val;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
#
|
||||
# Widgets
|
||||
#
|
||||
|
||||
public static function widgetContentEntryExcerpt($core,$w)
|
||||
{
|
||||
global $_ctx;
|
||||
if (!$_ctx->exists('posts')) return;
|
||||
|
||||
$res = '';
|
||||
while ($_ctx->posts->fetch())
|
||||
{
|
||||
$res .= $_ctx->posts->post_excerpt;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function widgetContentEntryContent()
|
||||
{
|
||||
global $_ctx;
|
||||
if (!$_ctx->exists('posts')) return;
|
||||
|
||||
$res = '';
|
||||
while ($_ctx->posts->fetch())
|
||||
{
|
||||
$res .= $_ctx->posts->post_content;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function widgetContentCommentContent()
|
||||
{
|
||||
global $core, $_ctx;
|
||||
if (!$_ctx->exists('posts')) return;
|
||||
|
||||
$res = '';
|
||||
$post_ids = array();
|
||||
while ($_ctx->posts->fetch())
|
||||
{
|
||||
$comments = $core->blog->getComments(array('post_id'=>$_ctx->posts->post_id));
|
||||
while ($comments->fetch())
|
||||
{
|
||||
$res .= $comments->getContent();
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
#
|
||||
# Filters
|
||||
#
|
||||
|
||||
public static function publicContentFilterTag($core,$filter,$tag,$args)
|
||||
{
|
||||
if (!$core->plugins->moduleExists('tags')) return;
|
||||
|
||||
$metas = $core->meta->getMetadata(array('meta_type'=>'tag'));
|
||||
|
||||
while($metas->fetch())
|
||||
{
|
||||
$k = $metas->meta_id;
|
||||
$args[0] = self::replaceString(
|
||||
$k,
|
||||
sprintf($filter['replace'],$core->blog->url.$core->url->getBase('tag').'/'.$k,'\\1'),
|
||||
$args[0],
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function widgetListTag($core,$filter,$content,$w,&$list)
|
||||
{
|
||||
if (!$core->plugins->moduleExists('tags')) return;
|
||||
|
||||
$metas = $core->meta->getMetadata(array('meta_type'=>'tag'));
|
||||
|
||||
while($metas->fetch())
|
||||
{
|
||||
$k = $metas->meta_id;
|
||||
$list[] = self::matchString(
|
||||
$k,
|
||||
sprintf($filter['widget'],$core->blog->url.$core->url->getBase('tag').'/'.$k,'\\1'),
|
||||
$content,
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function publicContentFilterSearch($core,$filter,$tag,$args)
|
||||
{
|
||||
if (!isset($GLOBALS['_search'])) return;
|
||||
|
||||
$searchs = explode(' ',$GLOBALS['_search']);
|
||||
|
||||
foreach($searchs as $k => $v)
|
||||
{
|
||||
$args[0] = self::replaceString(
|
||||
$v,
|
||||
sprintf($filter['replace'],'\\1'),
|
||||
$args[0],
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function publicContentFilterAcronym($core,$filter,$tag,$args)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$args[0] = self::replaceString(
|
||||
$k,
|
||||
sprintf($filter['replace'],__($v),'\\1'),
|
||||
$args[0],
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function widgetListAcronym($core,$filter,$content,$w,&$list)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$list[] = self::matchString(
|
||||
$k,
|
||||
sprintf($filter['widget'],__($v),'\\1'),
|
||||
$content,
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function publicContentFilterAbbreviation($core,$filter,$tag,$args)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$args[0] = self::replaceString(
|
||||
$k,
|
||||
sprintf($filter['replace'],__($v),'\\1'),
|
||||
$args[0],
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function widgetListAbbreviation($core,$filter,$content,$w,&$list)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$list[] = self::matchString(
|
||||
$k,
|
||||
sprintf($filter['widget'],__($v),'\\1'),
|
||||
$content,
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function publicContentFilterDefinition($core,$filter,$tag,$args)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$args[0] = self::replaceString(
|
||||
$k,
|
||||
sprintf($filter['replace'],__($v),'\\1'),
|
||||
$args[0],
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function widgetListDefinition($core,$filter,$content,$w,&$list)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$list[] = self::matchString(
|
||||
$k,
|
||||
sprintf($filter['widget'],__($v),'\\1'),
|
||||
$content,
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function publicContentFilterCitation($core,$filter,$tag,$args)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$args[0] = self::replaceString(
|
||||
$k,
|
||||
sprintf($filter['replace'],__($v),'\\1'),
|
||||
$args[0],
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function widgetListCitation($core,$filter,$content,$w,&$list)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$list[] = self::matchString(
|
||||
$k,
|
||||
sprintf($filter['widget'],__($v),'\\1'),
|
||||
$content,
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function publicContentFilterLink($core,$filter,$tag,$args)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$args[0] = self::replaceString(
|
||||
$k,
|
||||
sprintf($filter['replace'],'\\1',$v,'\\1'),
|
||||
$args[0],
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function widgetListLink($core,$filter,$content,$w,&$list)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$list[] = self::matchString(
|
||||
$k,
|
||||
sprintf($filter['widget'],$v,$v,'\\1'),
|
||||
$content,
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function publicContentFilterReplace($core,$filter,$tag,$args)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$args[0] = self::replaceString(
|
||||
$k,
|
||||
sprintf($filter['replace'],$v,'\\2'),
|
||||
$args[0],
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function publicContentFilterUpdate($core,$filter,$tag,$args)
|
||||
{
|
||||
while($filter['list']->fetch())
|
||||
{
|
||||
$k = $filter['list']->epc_key;
|
||||
$v = $filter['list']->epc_value;
|
||||
|
||||
$args[0] = self::replaceString(
|
||||
$k,
|
||||
sprintf($filter['replace'],'\\1',$v),
|
||||
$args[0],
|
||||
$filter
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static function publicContentFilterTwitter($core,$filter,$tag,$args)
|
||||
{
|
||||
$args[0] = self::replaceString(
|
||||
'[A-Za-z0-9_]{2,}',
|
||||
sprintf($filter['replace'],'http://twitter.com/\\1','\\1'),
|
||||
$args[0],
|
||||
$filter,
|
||||
'[^@]@','\b'
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
?>
|
225
inc/lib.epc.records.php
Normal file
225
inc/lib.epc.records.php
Normal file
@ -0,0 +1,225 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
class epcRecords
|
||||
{
|
||||
public $core;
|
||||
public $con;
|
||||
public $table;
|
||||
public $blog;
|
||||
|
||||
public function __construct($core)
|
||||
{
|
||||
$this->core = $core;
|
||||
$this->con = $core->con;
|
||||
$this->table = $core->prefix.'epc';
|
||||
$this->blog = $core->con->escape($core->blog->id);
|
||||
}
|
||||
|
||||
public function getRecords($params,$count_only=false)
|
||||
{
|
||||
if ($count_only)
|
||||
{
|
||||
$strReq = 'SELECT count(E.epc_id) ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$content_req = '';
|
||||
if (!empty($params['columns']) && is_array($params['columns']))
|
||||
{
|
||||
$content_req .= implode(', ',$params['columns']).', ';
|
||||
}
|
||||
$strReq =
|
||||
'SELECT E.epc_id, E.blog_id, E.epc_type, E.epc_upddt, '.
|
||||
$content_req.
|
||||
'E.epc_filter, E.epc_key, E.epc_value ';
|
||||
}
|
||||
|
||||
$strReq .=
|
||||
'FROM '.$this->table.' E ';
|
||||
|
||||
if (!empty($params['from']))
|
||||
{
|
||||
$strReq .= $params['from'].' ';
|
||||
}
|
||||
|
||||
$strReq .= "WHERE E.blog_id = '".$this->blog."' ";
|
||||
|
||||
if (isset($params['epc_type']))
|
||||
{
|
||||
if (is_array($params['epc_type']) && !empty($params['epc_type']))
|
||||
{
|
||||
$strReq .= 'AND E.epc_type '.$this->con->in($params['epc_type']);
|
||||
}
|
||||
elseif ($params['epc_type'] != '')
|
||||
{
|
||||
$strReq .= "AND E.epc_type = '".$this->con->escape($params['epc_type'])."' ";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$strReq .= "AND E.epc_type = 'epc' ";
|
||||
}
|
||||
|
||||
if (isset($params['epc_filter']))
|
||||
{
|
||||
if (is_array($params['epc_filter']) && !empty($params['epc_filter']))
|
||||
{
|
||||
$strReq .= 'AND E.epc_filter '.$this->con->in($params['epc_filter']);
|
||||
}
|
||||
elseif ($params['epc_filter'] != '')
|
||||
{
|
||||
$strReq .= "AND E.epc_filter = '".$this->con->escape($params['epc_filter'])."' ";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($params['epc_id']))
|
||||
{
|
||||
if (is_array($params['epc_id']))
|
||||
{
|
||||
array_walk($params['epc_id'],create_function('&$v,$k','if($v!==null){$v=(integer)$v;}'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$params['epc_id'] = array((integer) $params['epc_id']);
|
||||
}
|
||||
$strReq .= 'AND E.epc_id '.$this->con->in($params['epc_id']);
|
||||
}
|
||||
|
||||
if (!empty($params['sql']))
|
||||
{
|
||||
$strReq .= $params['sql'].' ';
|
||||
}
|
||||
|
||||
if (!$count_only)
|
||||
{
|
||||
if (!empty($params['order']))
|
||||
{
|
||||
$strReq .= 'ORDER BY '.$this->con->escape($params['order']).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
$strReq .= 'ORDER BY E.epc_key ASC ';
|
||||
}
|
||||
}
|
||||
|
||||
if (!$count_only && !empty($params['limit']))
|
||||
{
|
||||
$strReq .= $this->con->limit($params['limit']);
|
||||
}
|
||||
|
||||
return $this->con->select($strReq);
|
||||
}
|
||||
|
||||
public function addRecord($cur)
|
||||
{
|
||||
$this->con->writeLock($this->table);
|
||||
|
||||
try
|
||||
{
|
||||
$cur->epc_id = $this->getNextId();
|
||||
$cur->blog_id = $this->blog;
|
||||
$cur->epc_upddt = date('Y-m-d H:i:s');
|
||||
|
||||
$this->getCursor($cur);
|
||||
|
||||
$cur->insert();
|
||||
$this->con->unlock();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->con->unlock();
|
||||
throw $e;
|
||||
}
|
||||
$this->trigger();
|
||||
|
||||
# --BEHAVIOR-- enhancePostContentAfterAddRecord
|
||||
$this->core->callBehavior('enhancePostContentAfterAddRecord',$cur);
|
||||
|
||||
return $cur->epc_id;
|
||||
}
|
||||
|
||||
public function updRecord($id,$cur)
|
||||
{
|
||||
$id = (integer) $id;
|
||||
|
||||
if (empty($id))
|
||||
{
|
||||
throw new Exception(__('No such record ID'));
|
||||
}
|
||||
|
||||
$cur->epc_upddt = date('Y-m-d H:i:s');
|
||||
|
||||
$cur->update("WHERE epc_id = ".$id." AND blog_id = '".$this->blog."' ");
|
||||
$this->trigger();
|
||||
|
||||
# --BEHAVIOR-- enhancePostContentAfterUpdRecord
|
||||
$this->core->callBehavior('enhancePostContentAfterUpdRecord',$cur,$id);
|
||||
}
|
||||
|
||||
public function delRecord($id)
|
||||
{
|
||||
$id = (integer) $id;
|
||||
|
||||
if (empty($id)) {
|
||||
throw new Exception(__('No such record ID'));
|
||||
}
|
||||
|
||||
# --BEHAVIOR-- enhancePostContentBeforeDelRecord
|
||||
$this->core->callBehavior('enhancePostContentbeforeDelRecord',$id);
|
||||
|
||||
$this->con->execute(
|
||||
'DELETE FROM '.$this->table.' '.
|
||||
'WHERE epc_id = '.$id.' '.
|
||||
"AND blog_id = '".$this->blog."' "
|
||||
);
|
||||
|
||||
$this->trigger();
|
||||
}
|
||||
|
||||
private function getNextId()
|
||||
{
|
||||
return $this->con->select(
|
||||
'SELECT MAX(epc_id) FROM '.$this->table.' '
|
||||
)->f(0) + 1;
|
||||
}
|
||||
|
||||
public function openCursor()
|
||||
{
|
||||
return $this->con->openCursor($this->table);
|
||||
}
|
||||
|
||||
private function getCursor($cur,$epc_id=null)
|
||||
{
|
||||
if ($cur->epc_key == '')
|
||||
{
|
||||
throw new Exception(__('No record key'));
|
||||
}
|
||||
if ($cur->epc_value == '')
|
||||
{
|
||||
throw new Exception(__('No record value'));
|
||||
}
|
||||
if ($cur->epc_filter == '')
|
||||
{
|
||||
throw new Exception(__('No record filter'));
|
||||
}
|
||||
$epc_id = is_int($epc_id) ? $epc_id : $cur->epc_id;
|
||||
}
|
||||
|
||||
private function trigger()
|
||||
{
|
||||
$this->core->blog->triggerBlog();
|
||||
}
|
||||
}
|
||||
?>
|
44
inc/lib.epc.update.php
Normal file
44
inc/lib.epc.update.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
# This file only update old filters lists from settings to database
|
||||
|
||||
$f = $core->con->select("SELECT * FROM ".$core->prefix."setting WHERE setting_ns='enhancePostContent' AND blog_id IS NOT NULL ");
|
||||
|
||||
while ($f->fetch())
|
||||
{
|
||||
if (preg_match('#enhancePostContent_(.*?)List#',$f->setting_id,$m))
|
||||
{
|
||||
$curlist = @unserialize($f->setting_value);
|
||||
if (is_array($curlist))
|
||||
{
|
||||
foreach($curlist as $k => $v)
|
||||
{
|
||||
$cur = $core->con->openCursor($core->prefix.'epc');
|
||||
$core->con->writeLock($core->prefix.'epc');
|
||||
|
||||
$cur->epc_id = $core->con->select('SELECT MAX(epc_id) FROM '.$core->prefix.'epc'.' ')->f(0) + 1;
|
||||
$cur->blog_id = $f->blog_id;
|
||||
$cur->epc_filter = $m[1];
|
||||
$cur->epc_key = $k;
|
||||
$cur->epc_value = $v;
|
||||
|
||||
$cur->insert();
|
||||
$core->con->unlock();
|
||||
}
|
||||
}
|
||||
$core->con->execute("DELETE FROM ".$core->prefix."setting WHERE setting_id='".$f->setting_id."' AND setting_ns='enhancePostContent' AND blog_id='".$f->blog_id."' ");
|
||||
}
|
||||
}
|
||||
?>
|
441
index.php
Normal file
441
index.php
Normal file
@ -0,0 +1,441 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
dcPage::check('contentadmin');
|
||||
|
||||
$core->blog->settings->addNamespace('enhancePostContent');
|
||||
$s = $core->blog->settings->enhancePostContent;
|
||||
|
||||
# -- Prepare queries and object --
|
||||
|
||||
$_filters = libEPC::blogFilters();
|
||||
$filters_id = array();
|
||||
foreach($_filters as $name => $filter) {
|
||||
$filters_id[$filter['id']] = $name;
|
||||
}
|
||||
|
||||
$action = isset($_POST['action']) ? $_POST['action'] : '';
|
||||
$default_part = isset($_REQUEST['part']) ? $_REQUEST['part'] : key($filters_id);
|
||||
|
||||
$records = new epcRecords($core);
|
||||
|
||||
# -- Action --
|
||||
|
||||
if (!empty($action)) {
|
||||
# --BEHAVIOR-- enhancePostContentAdminSave
|
||||
$core->callBehavior('enhancePostContentAdminSave',$core);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
# Update filter settings
|
||||
if ($action == 'savefiltersetting'
|
||||
&& isset($filters_id[$default_part])
|
||||
) {
|
||||
# Parse filters options
|
||||
$name = $filters_id[$default_part];
|
||||
$f = array(
|
||||
'nocase' => !empty($_POST['filter_nocase']),
|
||||
'plural' => !empty($_POST['filter_plural']),
|
||||
'limit' => abs((integer) $_POST['filter_limit']),
|
||||
'style' => (array) $_POST['filter_style'],
|
||||
'notag' => (string) $_POST['filter_notag'],
|
||||
'tplValues' => (array) $_POST['filter_tplValues'],
|
||||
'pubPages' => (array) $_POST['filter_pubPages']
|
||||
);
|
||||
|
||||
$s->put('enhancePostContent_'.$name, serialize($f));
|
||||
|
||||
$core->blog->triggerBlog();
|
||||
|
||||
dcPage::addSuccessNotice(
|
||||
__('Filter successfully updated.')
|
||||
);
|
||||
http::redirect(
|
||||
$p_url.'part='.$default_part.'#setting'
|
||||
);
|
||||
}
|
||||
|
||||
# Add new filter record
|
||||
if ($action == 'savenewrecord'
|
||||
&& isset($filters_id[$default_part])
|
||||
&& !empty($_POST['new_key'])
|
||||
&& !empty($_POST['new_value'])
|
||||
) {
|
||||
$cur = $records->openCursor();
|
||||
$cur->epc_filter = $filters_id[$default_part];
|
||||
$cur->epc_key = html::escapeHTML($_POST['new_key']);
|
||||
$cur->epc_value = html::escapeHTML($_POST['new_value']);
|
||||
$records->addRecord($cur);
|
||||
|
||||
$core->blog->triggerBlog();
|
||||
|
||||
dcPage::addSuccessNotice(
|
||||
__('Filter successfully updated.')
|
||||
);
|
||||
http::redirect(
|
||||
$p_url.'&part='.$default_part.'#record'
|
||||
);
|
||||
}
|
||||
|
||||
# Update filter records
|
||||
if ($action == 'saveupdaterecords'
|
||||
&& isset($filters_id[$default_part])
|
||||
&& $_filters[$filters_id[$default_part]]['has_list']
|
||||
) {
|
||||
foreach($_POST['epc_id'] as $k => $id) {
|
||||
|
||||
$k = abs((integer) $k);
|
||||
$id = abs((integer) $id);
|
||||
|
||||
if (empty($_POST['epc_key'][$k])
|
||||
|| empty($_POST['epc_value'][$k])
|
||||
) {
|
||||
$records->delRecord($id);
|
||||
}
|
||||
elseif ($_POST['epc_key'][$k] != $_POST['epc_old_key'][$k]
|
||||
|| $_POST['epc_value'][$k] != $_POST['epc_old_value'][$k]
|
||||
) {
|
||||
$cur = $records->openCursor();
|
||||
$cur->epc_filter = $filters_id[$default_part];
|
||||
$cur->epc_key = html::escapeHTML($_POST['epc_key'][$k]);
|
||||
$cur->epc_value = html::escapeHTML($_POST['epc_value'][$k]);
|
||||
$records->updRecord($id,$cur);
|
||||
}
|
||||
}
|
||||
|
||||
$core->blog->triggerBlog();
|
||||
|
||||
$redir = !empty($_REQUEST['redir']) ?
|
||||
$_REQUEST['redir'] :
|
||||
$p_url.'&part='.$default_part.'#record';
|
||||
|
||||
dcPage::addSuccessNotice(
|
||||
__('Filter successfully updated.')
|
||||
);
|
||||
http::redirect(
|
||||
$redir
|
||||
);
|
||||
}
|
||||
}
|
||||
catch(Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
# -- Prepare page --
|
||||
|
||||
$breadcrumb = array(
|
||||
html::escapeHTML($core->blog->name) => '',
|
||||
__('Enhance post content') => $p_url
|
||||
);
|
||||
$top_menu = array();
|
||||
|
||||
foreach($filters_id as $id => $name) {
|
||||
|
||||
$active = '';
|
||||
if ($default_part == $id) {
|
||||
$breadcrumb[__($filters_id[$default_part])] = '';
|
||||
$active = ' class="active"';
|
||||
}
|
||||
|
||||
$top_menu[] =
|
||||
'<a'.$active.' href="'.$p_url.'&part='.$id.'">'.__($name).'</a>';
|
||||
}
|
||||
|
||||
# -- Display page --
|
||||
|
||||
# Headers
|
||||
echo '
|
||||
<html><head><title>'.__('Enhance post content').'</title>'.
|
||||
dcPage::jsLoad('js/_posts_list.js').
|
||||
dcPage::jsToolbar().
|
||||
dcPage::jsPageTabs().
|
||||
|
||||
# --BEHAVIOR-- enhancePostContentAdminHeader
|
||||
$core->callBehavior('enhancePostContentAdminHeader',$core).'
|
||||
|
||||
</head><body>'.
|
||||
|
||||
# Title
|
||||
dcPage::breadcrumb($breadcrumb).
|
||||
dcPage::notices().
|
||||
|
||||
# Filters list
|
||||
'<ul class="pseudo-tabs">'.
|
||||
'<li>'.implode('</li><li>', $top_menu).'</li>'.
|
||||
'</ul>';
|
||||
|
||||
# Filter content
|
||||
if (isset($filters_id[$default_part])) {
|
||||
|
||||
$name = $filters_id[$default_part];
|
||||
$filter = $_filters[$name];
|
||||
|
||||
# Filter title and description
|
||||
echo '
|
||||
<h3>'.__($filters_id[$default_part]).'</h3>
|
||||
<p>'.$filter['help'].'</p>';
|
||||
|
||||
# Filter settings
|
||||
echo '
|
||||
<div class="multi-part" id="setting" title="'.__('Settings').'">
|
||||
<form method="post" action="'.$p_url.'&part='.$default_part.'&tab=setting"><div>';
|
||||
|
||||
echo
|
||||
'<div class="two-boxes odd">
|
||||
<h4>'.__('Pages to be filtered').'</h4>';
|
||||
|
||||
foreach(libEPC::blogAllowedPubPages() as $k => $v) {
|
||||
echo '
|
||||
<p><label for="filter_pubPages'.$v.'">'.
|
||||
form::checkbox(
|
||||
array('filter_pubPages[]', 'filter_pubPages'.$v),
|
||||
$v,
|
||||
in_array($v,$filter['pubPages'])
|
||||
).
|
||||
__($k).'</label></p>';
|
||||
}
|
||||
|
||||
echo
|
||||
'</div>';
|
||||
|
||||
echo
|
||||
'<div class="two-boxes even">
|
||||
<h4>'.__('Filtering').'</h4>
|
||||
|
||||
<p><label for="filter_nocase">'.
|
||||
form::checkbox('filter_nocase', '1', $filter['nocase']).
|
||||
__('Case insensitive').'</label></p>
|
||||
|
||||
<p><label for="filter_plural">'.
|
||||
form::checkbox('filter_plural', '1', $filter['plural']).
|
||||
__('Also use the plural').'</label></p>
|
||||
|
||||
<p><label for="filter_limit">'.
|
||||
__('Limit the number of replacement to:').'</label>'.
|
||||
form::field('filter_limit', 4, 10, html::escapeHTML($filter['limit'])).'
|
||||
</p>
|
||||
<p class="form-note">'.__('Leave it blank or set it to 0 for no limit').'</p>
|
||||
|
||||
</div>';
|
||||
|
||||
echo
|
||||
'<div class="two-boxes odd">
|
||||
<h4>'.__('Contents to be filtered').'</h4>';
|
||||
|
||||
foreach(libEPC::blogAllowedTplValues() as $k => $v) {
|
||||
echo '
|
||||
<p><label for="filter_tplValues'.$v.'">'.
|
||||
form::checkbox(
|
||||
array('filter_tplValues[]', 'filter_tplValues'.$v),
|
||||
$v,
|
||||
in_array($v,$filter['tplValues'])
|
||||
).
|
||||
__($k).'</label></p>';
|
||||
}
|
||||
|
||||
echo
|
||||
'</div>';
|
||||
|
||||
echo
|
||||
'<div class="two-boxes even">
|
||||
<h4>'.__('Style').'</h4>';
|
||||
|
||||
foreach($filter['class'] as $k => $v) {
|
||||
echo '
|
||||
<p><label for="filter_style'.$k.'">'.
|
||||
sprintf(__('Class "%s":'),$v).'</label>'.
|
||||
form::field(
|
||||
array('filter_style[]', 'filter_style'.$k),
|
||||
60,
|
||||
255,
|
||||
html::escapeHTML($filter['style'][$k])
|
||||
).
|
||||
'</p>';
|
||||
}
|
||||
|
||||
echo '
|
||||
<p class="form-note">'.sprintf(__('The inserted HTML tag looks like: %s'), html::escapeHTML(str_replace('%s', '...', $filter['replace']))).'</p>
|
||||
|
||||
<p><label for="filter_notag">'.__('Ignore HTML tags:').'</label>'.
|
||||
form::field('filter_notag', 60, 255, html::escapeHTML($filter['notag'])).'
|
||||
</p>
|
||||
<p class="form-note">'.__('This is the list of HTML tags where content will be ignored.').' '.
|
||||
(empty($filter['htmltag']) ? '' : sprintf(__('Tag "%s" always be ignored.'), $filter['htmltag'])).'</p>
|
||||
|
||||
</div>';
|
||||
|
||||
echo '</div>
|
||||
<div class="clear">
|
||||
<p>'.
|
||||
$core->formNonce().
|
||||
form::hidden(array('action'), 'savefiltersetting').'
|
||||
<input type="submit" name="save" value="'.__('Save').'" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>';
|
||||
|
||||
# Filter records list
|
||||
if ($filter['has_list']) {
|
||||
|
||||
$sortby_combo = array(
|
||||
'epc_upddt',
|
||||
'epc_key',
|
||||
'epc_value',
|
||||
'epc_id'
|
||||
);
|
||||
|
||||
$order_combo = array(
|
||||
'asc',
|
||||
'desc'
|
||||
);
|
||||
|
||||
$sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : (string) $s->enhancePostContent_list_sortby;
|
||||
$order = !empty($_GET['order']) ? $_GET['order'] : (string) $s->enhancePostContent_list_order;
|
||||
$page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1;
|
||||
$nb = !empty($_GET['nb']) && (integer) $_GET['nb'] > 0 ? (integer) $_GET['nb'] : (integer) $s->enhancePostContent_list_nb;
|
||||
|
||||
$params = array();
|
||||
$params['epc_filter'] = $name;
|
||||
$params['limit'] = array((($page-1)*$nb), $nb);
|
||||
|
||||
if ($sortby !== '' && in_array($sortby, $sortby_combo)) {
|
||||
if ($order !== '' && in_array($order, $order_combo)) {
|
||||
$params['order'] = $sortby.' '.$order;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$list = $records->getRecords($params);
|
||||
$counter = $records->getRecords($params, true);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$core->error->add($e->getMessage());
|
||||
}
|
||||
|
||||
$pager_url = $p_url.
|
||||
'&nb='.$nb.
|
||||
'&sortby=%s'.
|
||||
'&order='.($order == 'desc' ? 'desc' : 'asc').
|
||||
'&page=%s'.
|
||||
'&part='.$default_part.
|
||||
'#record';
|
||||
|
||||
$pager = new pager($page, $counter->f(0), $nb, 10);
|
||||
$pager->html_prev = __('«prev.');
|
||||
$pager->html_next = __('next»');
|
||||
$pager->base_url = sprintf($pager_url, $sortby,'%s');
|
||||
$pager->var_page = 'page';
|
||||
|
||||
echo '
|
||||
<div class="multi-part" id="record" title="'.__('Records').'">';
|
||||
|
||||
if ($core->error->flag() || $list->isEmpty()) {
|
||||
echo '<p>'.__('No record').'</p>';
|
||||
}
|
||||
else {
|
||||
echo '
|
||||
<form action="'.$pager_url.'" method="post">
|
||||
<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>
|
||||
<table>
|
||||
<thead><tr>
|
||||
<th><a href="'.sprintf($pager_url, 'epc_key', $page).'">'
|
||||
.__('Key').'</a></th>
|
||||
<th><a href="'.sprintf($pager_url, 'epc_value', $page).'">'.
|
||||
__('Value').'</a></th>
|
||||
<th><a href="'.sprintf($pager_url, 'epc_upddt', $page).'">'.
|
||||
__('Date').'</a></th>
|
||||
</tr></thead>
|
||||
<tbody>';
|
||||
|
||||
while($list->fetch()) {
|
||||
echo '
|
||||
<tr class="line">
|
||||
<td class="nowrap">'.
|
||||
form::hidden(array('epc_id[]'), $list->epc_id).
|
||||
form::hidden(array('epc_old_key[]'), html::escapeHTML($list->epc_key)).
|
||||
form::hidden(array('epc_old_value[]'), html::escapeHTML($list->epc_value)).
|
||||
form::field(array('epc_key[]'), 30, 225, html::escapeHTML($list->epc_key), '').'</td>
|
||||
<td class="maximal">'.
|
||||
form::field(array('epc_value[]'), 90, 225, html::escapeHTML($list->epc_value), 'maximal').'</td>
|
||||
<td class="nowrap">'.
|
||||
dt::dt2str(__('%Y-%m-%d %H:%M'), $list->epc_upddt,$core->auth->getInfo('user_tz')).'</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="form-note">'.__('In order to remove a record, leave empty its key or value.').'</p>
|
||||
<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>
|
||||
|
||||
<div class="clear">
|
||||
<p>'.
|
||||
$core->formNonce().
|
||||
form::hidden(array('redir'), sprintf($pager_url, $sortby, $page)).
|
||||
form::hidden(array('action'), 'saveupdaterecords').'
|
||||
<input type="submit" name="save" value="'.__('Save').'" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</form>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
# New record
|
||||
echo '
|
||||
<div class="multi-part" id="newrecord" title="'.__('New record').'">
|
||||
<form action="'.$p_url.'&part='.$default_part.'&tab=setting" method="post">'.
|
||||
|
||||
'<p><label for="new_key">'.__('Key:').'</label>'.
|
||||
form::field('new_key', 60, 255).
|
||||
'</p>'.
|
||||
|
||||
'<p><label for="new_value">'.__('Value:').'</label>'.
|
||||
form::field('new_value', 60, 255).
|
||||
'</p>
|
||||
|
||||
<p class="clear">'.
|
||||
form::hidden(array('action'), 'savenewrecord').
|
||||
$core->formNonce().'
|
||||
<input type="submit" name="save" value="'.__('Save').'" />
|
||||
</p>
|
||||
</form>
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
# --BEHAVIOR-- enhancePostContentAdminPage
|
||||
$core->callBehavior('enhancePostContentAdminPage',$core);
|
||||
|
||||
dcPage::helpBlock('enhancePostContent');
|
||||
|
||||
# Footers
|
||||
echo
|
||||
'<hr class="clear"/><p class="right modules">
|
||||
<a class="module-config" '.
|
||||
'href="plugins.php?module=enhancePostContent&conf=1&redir='.
|
||||
urlencode('plugin.php?p=enhancePostContent').'">'.__('Configuration').'</a> -
|
||||
enhancePostContent - '.$core->plugins->moduleInfo('enhancePostContent', 'version').'
|
||||
<img alt="'.__('enhancePostContent').'" src="index.php?pf=enhancePostContent/icon.png" />
|
||||
</p>
|
||||
</body></html>';
|
19
locales/en/help/help.html
Normal file
19
locales/en/help/help.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>enhancePostContent</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>If you want some help or contribute to the plugin enhancePostContent, follow these links.</p>
|
||||
<ul>
|
||||
<li><a href="http://forum.dotclear.org/viewtopic.php?id=40876">Post on Dotclear's forum</a></li>
|
||||
<li><a href="http://lab.dotclear.org/wiki/plugin/enhancePostContent" title="Lab">SVN repository</a></li>
|
||||
<li><a href="https://bitbucket.org/JcDenis/enhancePostContent">HG repository</a></li>
|
||||
<li><a href="http://jcd.lv/q=enhancePostContent" title="Blog">Post on author's blog</a></li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
18
locales/en/resources.php
Normal file
18
locales/en/resources.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')) { return; }
|
||||
|
||||
$__resources['help']['enhancePostContent'] = dirname(__FILE__).'/help/help.html';
|
||||
?>
|
20
locales/fr/help/help.html
Normal file
20
locales/fr/help/help.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>enhancePostContent</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h3>Support</h3>
|
||||
<p>Si vous souhaitez plus d'aide ou apporter votre contribution à cette extension, voici quelques liens utiles.</p>
|
||||
<ul>
|
||||
<li><a href="http://forum.dotclear.org/viewtopic.php?id=40876">Sujet sur le forum Dotclear</a></li>
|
||||
<li><a href="http://lab.dotclear.org/wiki/plugin/enhancePostContent">Dépôt svn</a></li>
|
||||
<li><a href="https://bitbucket.org/JcDenis/enhancePostContent">Dépôt hg</a></li>
|
||||
<li><a href="http://jcd.lv/q=enhancePostContent">Billet dédié sur le blog de l'auteur</a></li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
215
locales/fr/main.lang.php
Normal file
215
locales/fr/main.lang.php
Normal file
@ -0,0 +1,215 @@
|
||||
<?php
|
||||
// Language: Français
|
||||
// Module: enhancePostContent - 2013.11.08
|
||||
// Date: 2013-11-09 05:21:09
|
||||
// Translated with dcTranslater - 2013.05.11
|
||||
|
||||
#_admin.php:24
|
||||
#_admin.php:44
|
||||
#_widgets.php:43
|
||||
#index.php:145
|
||||
#index.php:165
|
||||
$GLOBALS['__l10n']['Enhance post content'] = 'Amélioration du contenu';
|
||||
|
||||
#_config.php:26
|
||||
#index.php:361
|
||||
$GLOBALS['__l10n']['Key'] = 'Clé';
|
||||
|
||||
#_config.php:79
|
||||
$GLOBALS['__l10n']['Configuration has been successfully updated.'] = 'La configuration a été mise à jour avec succés.';
|
||||
|
||||
#_config.php:96
|
||||
$GLOBALS['__l10n']['This enable public widgets and contents filter.'] = 'Ceci active les widgets et le filtrage du contenu en partie public.';
|
||||
|
||||
#_config.php:100
|
||||
$GLOBALS['__l10n']['Enable plugin'] = 'Activer le plugin';
|
||||
|
||||
#_config.php:105
|
||||
$GLOBALS['__l10n']['Record list'] = 'Listes d\'enregistrements';
|
||||
|
||||
#_config.php:106
|
||||
$GLOBALS['__l10n']['This is the default order of records lists.'] = 'Ceci est l\'ordre de trie par défaut des listes d\'enregistrements.';
|
||||
|
||||
#_config.php:114
|
||||
$GLOBALS['__l10n']['Records per page:'] = 'Enregistrements par page :';
|
||||
|
||||
#_config.php:121
|
||||
$GLOBALS['__l10n']['This is a special feature to edit list of allowed template values and public pages where this plugin works.'] = 'Ceci est une option spéciale pour modifier les listes des balises de template et des pages publiques ou le plugin sera actif.';
|
||||
|
||||
#_config.php:123
|
||||
$GLOBALS['__l10n']['Allowed DC template values:'] = 'Autoriser les balises de template :';
|
||||
|
||||
#_config.php:125
|
||||
$GLOBALS['__l10n']['Use "readable_name1:template_value1;readable_name2:template_value2;" like "entry content:EntryContent;entry excerpt:EntryExcerpt;".'] = 'Utiliser "titre1:valeur_de_template1;titre2:valeur_de_template2;" exemple "entry content:EntreyContent;entry excerpt:EntreyExcerpt;".';
|
||||
|
||||
#_config.php:127
|
||||
$GLOBALS['__l10n']['Allowed public pages:'] = 'Autoriser les pages publiques :';
|
||||
|
||||
#_config.php:129
|
||||
$GLOBALS['__l10n']['Use "readable_name1:template_page1;readable_name2:template_page2;" like "post page:post.html;home page:home.html;".'] = 'Utiliser "titre1:page_de_template1;titre2:page_de_template2;" comme "post page:post.html;home page:home.html;".';
|
||||
|
||||
#_widgets.php:46
|
||||
$GLOBALS['__l10n']['List filtered contents.'] = 'Liste les contenus filtrés.';
|
||||
|
||||
#_widgets.php:52
|
||||
$GLOBALS['__l10n']['In this article'] = 'Dans cet article';
|
||||
|
||||
#_widgets.php:87
|
||||
$GLOBALS['__l10n']['Enable filter on %s'] = 'Autoriser le filtrage sur %s';
|
||||
|
||||
#_widgets.php:95
|
||||
$GLOBALS['__l10n']['Search case insensitive'] = 'Recherche insensible à la casse';
|
||||
|
||||
#_widgets.php:102
|
||||
$GLOBALS['__l10n']['Search also plural'] = 'Recherche également le pluriel';
|
||||
|
||||
#_widgets.php:109
|
||||
$GLOBALS['__l10n']['Show the number of appearance'] = 'Afficher le nombre d\'occurence';
|
||||
|
||||
#inc/lib.epc.php:16
|
||||
$GLOBALS['__l10n']['Acronym'] = 'Acronyme';
|
||||
|
||||
#inc/lib.epc.php:16
|
||||
$GLOBALS['__l10n']['Abbreviation'] = 'Abréviation';
|
||||
|
||||
#inc/lib.epc.php:16
|
||||
$GLOBALS['__l10n']['Definition'] = 'Définition';
|
||||
|
||||
#inc/lib.epc.php:17
|
||||
$GLOBALS['__l10n']['Citation'] = 'Citation';
|
||||
|
||||
#inc/lib.epc.php:17
|
||||
$GLOBALS['__l10n']['Replace'] = 'Remplacement';
|
||||
|
||||
#inc/lib.epc.php:18
|
||||
$GLOBALS['__l10n']['entry excerpt'] = 'le résumé du billet';
|
||||
|
||||
#inc/lib.epc.php:18
|
||||
$GLOBALS['__l10n']['entry content'] = 'le contenu du billet';
|
||||
|
||||
#inc/lib.epc.php:18
|
||||
$GLOBALS['__l10n']['comment content'] = 'le contenu des commentaires';
|
||||
|
||||
#inc/lib.epc.php:19
|
||||
$GLOBALS['__l10n']['home page'] = 'la page d\'accueil';
|
||||
|
||||
#inc/lib.epc.php:19
|
||||
$GLOBALS['__l10n']['post page'] = 'la page du billet';
|
||||
|
||||
#inc/lib.epc.php:19
|
||||
$GLOBALS['__l10n']['category page'] = 'la page de catégorie';
|
||||
|
||||
#inc/lib.epc.php:19
|
||||
$GLOBALS['__l10n']['search results page'] = 'la page des résultats de recherche';
|
||||
|
||||
#inc/lib.epc.php:20
|
||||
$GLOBALS['__l10n']['atom feeds'] = 'les flux Atom';
|
||||
|
||||
#inc/lib.epc.php:20
|
||||
$GLOBALS['__l10n']['RSS feeds'] = 'les flux RSS';
|
||||
|
||||
#inc/lib.epc.php:101
|
||||
$GLOBALS['__l10n']['Highlight tags of your blog.'] = 'Met en avant les Tags de votre blog';
|
||||
|
||||
#inc/lib.epc.php:120
|
||||
$GLOBALS['__l10n']['Highlight searched words.'] = 'Met en avant les mots recherchés';
|
||||
|
||||
#inc/lib.epc.php:139
|
||||
$GLOBALS['__l10n']['Explain some acronyms. First term of the list is the acornym and second term the explanation.'] = 'Explique des acronymes. Le premier terme de la liste est l\'acronyme et les second terme l\'explication.';
|
||||
|
||||
#inc/lib.epc.php:159
|
||||
$GLOBALS['__l10n']['Explain some abbreviation. First term of the list is the abbreviation and second term the explanation.'] = 'Explique des abréviations. Le premier terme de la liste est l\'abréviation et le second terme l\'explication.';
|
||||
|
||||
#inc/lib.epc.php:179
|
||||
$GLOBALS['__l10n']['Explain some definition. First term of the list is the sample to define and second term the explanation.'] = 'Explique des définitions. Le premier terme de la liste est la chaine à expliquer et le second terme est la définition.';
|
||||
|
||||
#inc/lib.epc.php:199
|
||||
$GLOBALS['__l10n']['Highlight citation of people. First term of the list is the citation and second term the author.'] = 'Met en avant les citation des gens. Le premier terme est la citation et le second terme est l\'auteur.';
|
||||
|
||||
#inc/lib.epc.php:219
|
||||
$GLOBALS['__l10n']['Link some words. First term of the list is the term to link and second term the link.'] = 'Ajouter des liens. Le premier terme de la liste est le texte à lier et le second terme est l\'adresse de lien.';
|
||||
|
||||
#inc/lib.epc.php:238
|
||||
$GLOBALS['__l10n']['Replace some text. First term of the list is the text to replace and second term the replacement.'] = 'Remplace du texte. Le premier terme de la liste est le terme à remplacer et le second le nouveau terme.';
|
||||
|
||||
#inc/lib.epc.php:256
|
||||
$GLOBALS['__l10n']['Update and show terms. First term of the list is the term to update and second term the new term.'] = 'Met à jour du contenu. Le premier terme de la liste est l\'ancien texte et le second le nouveau texte.';
|
||||
|
||||
#inc/lib.epc.php:274
|
||||
$GLOBALS['__l10n']['Add link to twitter user page. Every word started with "@" will be considered as twitter user.'] = 'Ajouter un lien vers une page Twitter. Chaque mot commençant par "@" sera considéré comme un nom de compte Twitter';
|
||||
|
||||
#inc/lib.epc.php:278
|
||||
$GLOBALS['__l10n']['View this user\'s twitter page'] = 'Voir la page Twitter de cet utilisateur';
|
||||
|
||||
#index.php:68
|
||||
#index.php:90
|
||||
#index.php:130
|
||||
$GLOBALS['__l10n']['Filter successfully updated.'] = 'Filtre mis à jour.';
|
||||
|
||||
#index.php:197
|
||||
$GLOBALS['__l10n']['Settings'] = 'Paramètres';
|
||||
|
||||
#index.php:202
|
||||
$GLOBALS['__l10n']['Pages to be filtered'] = 'Pages à filtrer';
|
||||
|
||||
#index.php:220
|
||||
$GLOBALS['__l10n']['Filtering'] = 'Filtrage';
|
||||
|
||||
#index.php:224
|
||||
$GLOBALS['__l10n']['Case insensitive'] = 'Insensible à la casse';
|
||||
|
||||
#index.php:228
|
||||
$GLOBALS['__l10n']['Also use the plural'] = 'Utiliser également le pluriel';
|
||||
|
||||
#index.php:231
|
||||
$GLOBALS['__l10n']['Limit the number of replacement to:'] = 'Limiter le nombre de remplacement à :';
|
||||
|
||||
#index.php:234
|
||||
$GLOBALS['__l10n']['Leave it blank or set it to 0 for no limit'] = 'Laisser vide ou mettre à 0 pour aucune limite';
|
||||
|
||||
#index.php:240
|
||||
$GLOBALS['__l10n']['Contents to be filtered'] = 'Contenus à filtrer';
|
||||
|
||||
#index.php:258
|
||||
$GLOBALS['__l10n']['Style'] = 'Style';
|
||||
|
||||
#index.php:263
|
||||
$GLOBALS['__l10n']['Class "%s":'] = 'Class CSS "%s" :';
|
||||
|
||||
#index.php:274
|
||||
$GLOBALS['__l10n']['The inserted HTML tag looks like: %s'] = 'Le code HTML de la balise est le suivant: %s';
|
||||
|
||||
#index.php:276
|
||||
$GLOBALS['__l10n']['Ignore HTML tags:'] = 'Ignorer les balises HTML :';
|
||||
|
||||
#index.php:279
|
||||
$GLOBALS['__l10n']['This is the list of HTML tags where content will be ignored.'] = 'Ceci est la liste des balises HTML dont le contenu sera ignoré.';
|
||||
|
||||
#index.php:280
|
||||
$GLOBALS['__l10n']['Tag "%s" always be ignored.'] = 'Les balises "%s" seront toujours ignorées.';
|
||||
|
||||
#index.php:343
|
||||
$GLOBALS['__l10n']['«prev.'] = 'préc.';
|
||||
|
||||
#index.php:344
|
||||
$GLOBALS['__l10n']['next»'] = 'suiv.';
|
||||
|
||||
#index.php:349
|
||||
$GLOBALS['__l10n']['Records'] = 'Enregistrements';
|
||||
|
||||
#index.php:352
|
||||
$GLOBALS['__l10n']['No record'] = 'Pas d\'enregistrement';
|
||||
|
||||
#index.php:387
|
||||
$GLOBALS['__l10n']['In order to remove a record, leave empty its key or value.'] = 'Pour retirer un enregistrement, laisser vide sa clé ou sa valeur.';
|
||||
|
||||
#index.php:406
|
||||
$GLOBALS['__l10n']['New record'] = 'Nouvel enregistrement';
|
||||
|
||||
#index.php:409
|
||||
$GLOBALS['__l10n']['Key:'] = 'Clé :';
|
||||
|
||||
#index.php:413
|
||||
$GLOBALS['__l10n']['Value:'] = 'Valeur :';
|
||||
|
||||
?>
|
291
locales/fr/main.po
Normal file
291
locales/fr/main.po
Normal file
@ -0,0 +1,291 @@
|
||||
# Language: Français
|
||||
# Module: enhancePostContent - 2013.11.08
|
||||
# Date: 2013-11-09 05:21:10
|
||||
# Translated with translater 2013.05.11
|
||||
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Project-Id-Version: enhancePostContent 2013.11.08\n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: 2013-11-09T05:21:10+00:00\n"
|
||||
"Last-Translator: Jean-Christian Denis\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: _admin.php:24
|
||||
#: _admin.php:44
|
||||
#: _widgets.php:43
|
||||
#: index.php:145
|
||||
#: index.php:165
|
||||
msgid "Enhance post content"
|
||||
msgstr "Amélioration du contenu"
|
||||
|
||||
#: _config.php:26
|
||||
#: index.php:361
|
||||
msgid "Key"
|
||||
msgstr "Clé"
|
||||
|
||||
#: _config.php:79
|
||||
msgid "Configuration has been successfully updated."
|
||||
msgstr "La configuration a été mise à jour avec succés."
|
||||
|
||||
#: _config.php:96
|
||||
msgid "This enable public widgets and contents filter."
|
||||
msgstr "Ceci active les widgets et le filtrage du contenu en partie public."
|
||||
|
||||
#: _config.php:100
|
||||
msgid "Enable plugin"
|
||||
msgstr "Activer le plugin"
|
||||
|
||||
#: _config.php:105
|
||||
msgid "Record list"
|
||||
msgstr "Listes d'enregistrements"
|
||||
|
||||
#: _config.php:106
|
||||
msgid "This is the default order of records lists."
|
||||
msgstr "Ceci est l'ordre de trie par défaut des listes d'enregistrements."
|
||||
|
||||
#: _config.php:114
|
||||
msgid "Records per page:"
|
||||
msgstr "Enregistrements par page :"
|
||||
|
||||
#: _config.php:121
|
||||
msgid "This is a special feature to edit list of allowed template values and public pages where this plugin works."
|
||||
msgstr "Ceci est une option spéciale pour modifier les listes des balises de template et des pages publiques ou le plugin sera actif."
|
||||
|
||||
#: _config.php:123
|
||||
msgid "Allowed DC template values:"
|
||||
msgstr "Autoriser les balises de template :"
|
||||
|
||||
#: _config.php:125
|
||||
msgid "Use \"readable_name1:template_value1;readable_name2:template_value2;\" like \"entry content:EntryContent;entry excerpt:EntryExcerpt;\"."
|
||||
msgstr "Utiliser \"titre1:valeur_de_template1;titre2:valeur_de_template2;\" exemple \"entry content:EntreyContent;entry excerpt:EntreyExcerpt;\"."
|
||||
|
||||
#: _config.php:127
|
||||
msgid "Allowed public pages:"
|
||||
msgstr "Autoriser les pages publiques :"
|
||||
|
||||
#: _config.php:129
|
||||
msgid "Use \"readable_name1:template_page1;readable_name2:template_page2;\" like \"post page:post.html;home page:home.html;\"."
|
||||
msgstr "Utiliser \"titre1:page_de_template1;titre2:page_de_template2;\" comme \"post page:post.html;home page:home.html;\"."
|
||||
|
||||
#: _widgets.php:46
|
||||
msgid "List filtered contents."
|
||||
msgstr "Liste les contenus filtrés."
|
||||
|
||||
#: _widgets.php:52
|
||||
msgid "In this article"
|
||||
msgstr "Dans cet article"
|
||||
|
||||
#: _widgets.php:87
|
||||
msgid "Enable filter on %s"
|
||||
msgstr "Autoriser le filtrage sur %s"
|
||||
|
||||
#: _widgets.php:95
|
||||
msgid "Search case insensitive"
|
||||
msgstr "Recherche insensible à la casse"
|
||||
|
||||
#: _widgets.php:102
|
||||
msgid "Search also plural"
|
||||
msgstr "Recherche également le pluriel"
|
||||
|
||||
#: _widgets.php:109
|
||||
msgid "Show the number of appearance"
|
||||
msgstr "Afficher le nombre d'occurence"
|
||||
|
||||
#: inc/lib.epc.php:16
|
||||
msgid "Acronym"
|
||||
msgstr "Acronyme"
|
||||
|
||||
#: inc/lib.epc.php:16
|
||||
msgid "Abbreviation"
|
||||
msgstr "Abréviation"
|
||||
|
||||
#: inc/lib.epc.php:16
|
||||
msgid "Definition"
|
||||
msgstr "Définition"
|
||||
|
||||
#: inc/lib.epc.php:17
|
||||
msgid "Citation"
|
||||
msgstr "Citation"
|
||||
|
||||
#: inc/lib.epc.php:17
|
||||
msgid "Replace"
|
||||
msgstr "Remplacement"
|
||||
|
||||
#: inc/lib.epc.php:18
|
||||
msgid "entry excerpt"
|
||||
msgstr "le résumé du billet"
|
||||
|
||||
#: inc/lib.epc.php:18
|
||||
msgid "entry content"
|
||||
msgstr "le contenu du billet"
|
||||
|
||||
#: inc/lib.epc.php:18
|
||||
msgid "comment content"
|
||||
msgstr "le contenu des commentaires"
|
||||
|
||||
#: inc/lib.epc.php:19
|
||||
msgid "home page"
|
||||
msgstr "la page d'accueil"
|
||||
|
||||
#: inc/lib.epc.php:19
|
||||
msgid "post page"
|
||||
msgstr "la page du billet"
|
||||
|
||||
#: inc/lib.epc.php:19
|
||||
msgid "category page"
|
||||
msgstr "la page de catégorie"
|
||||
|
||||
#: inc/lib.epc.php:19
|
||||
msgid "search results page"
|
||||
msgstr "la page des résultats de recherche"
|
||||
|
||||
#: inc/lib.epc.php:20
|
||||
msgid "atom feeds"
|
||||
msgstr "les flux Atom"
|
||||
|
||||
#: inc/lib.epc.php:20
|
||||
msgid "RSS feeds"
|
||||
msgstr "les flux RSS"
|
||||
|
||||
#: inc/lib.epc.php:101
|
||||
msgid "Highlight tags of your blog."
|
||||
msgstr "Met en avant les Tags de votre blog"
|
||||
|
||||
#: inc/lib.epc.php:120
|
||||
msgid "Highlight searched words."
|
||||
msgstr "Met en avant les mots recherchés"
|
||||
|
||||
#: inc/lib.epc.php:139
|
||||
msgid "Explain some acronyms. First term of the list is the acornym and second term the explanation."
|
||||
msgstr "Explique des acronymes. Le premier terme de la liste est l'acronyme et les second terme l'explication."
|
||||
|
||||
#: inc/lib.epc.php:159
|
||||
msgid "Explain some abbreviation. First term of the list is the abbreviation and second term the explanation."
|
||||
msgstr "Explique des abréviations. Le premier terme de la liste est l'abréviation et le second terme l'explication."
|
||||
|
||||
#: inc/lib.epc.php:179
|
||||
msgid "Explain some definition. First term of the list is the sample to define and second term the explanation."
|
||||
msgstr "Explique des définitions. Le premier terme de la liste est la chaine à expliquer et le second terme est la définition."
|
||||
|
||||
#: inc/lib.epc.php:199
|
||||
msgid "Highlight citation of people. First term of the list is the citation and second term the author."
|
||||
msgstr "Met en avant les citation des gens. Le premier terme est la citation et le second terme est l'auteur."
|
||||
|
||||
#: inc/lib.epc.php:219
|
||||
msgid "Link some words. First term of the list is the term to link and second term the link."
|
||||
msgstr "Ajouter des liens. Le premier terme de la liste est le texte à lier et le second terme est l'adresse de lien."
|
||||
|
||||
#: inc/lib.epc.php:238
|
||||
msgid "Replace some text. First term of the list is the text to replace and second term the replacement."
|
||||
msgstr "Remplace du texte. Le premier terme de la liste est le terme à remplacer et le second le nouveau terme."
|
||||
|
||||
#: inc/lib.epc.php:256
|
||||
msgid "Update and show terms. First term of the list is the term to update and second term the new term."
|
||||
msgstr "Met à jour du contenu. Le premier terme de la liste est l'ancien texte et le second le nouveau texte."
|
||||
|
||||
#: inc/lib.epc.php:274
|
||||
msgid "Add link to twitter user page. Every word started with \"@\" will be considered as twitter user."
|
||||
msgstr "Ajouter un lien vers une page Twitter. Chaque mot commençant par \"@\" sera considéré comme un nom de compte Twitter"
|
||||
|
||||
#: inc/lib.epc.php:278
|
||||
msgid "View this user's twitter page"
|
||||
msgstr "Voir la page Twitter de cet utilisateur"
|
||||
|
||||
#: index.php:68
|
||||
#: index.php:90
|
||||
#: index.php:130
|
||||
msgid "Filter successfully updated."
|
||||
msgstr "Filtre mis à jour."
|
||||
|
||||
#: index.php:197
|
||||
msgid "Settings"
|
||||
msgstr "Paramètres"
|
||||
|
||||
#: index.php:202
|
||||
msgid "Pages to be filtered"
|
||||
msgstr "Pages à filtrer"
|
||||
|
||||
#: index.php:220
|
||||
msgid "Filtering"
|
||||
msgstr "Filtrage"
|
||||
|
||||
#: index.php:224
|
||||
msgid "Case insensitive"
|
||||
msgstr "Insensible à la casse"
|
||||
|
||||
#: index.php:228
|
||||
msgid "Also use the plural"
|
||||
msgstr "Utiliser également le pluriel"
|
||||
|
||||
#: index.php:231
|
||||
msgid "Limit the number of replacement to:"
|
||||
msgstr "Limiter le nombre de remplacement à :"
|
||||
|
||||
#: index.php:234
|
||||
msgid "Leave it blank or set it to 0 for no limit"
|
||||
msgstr "Laisser vide ou mettre à 0 pour aucune limite"
|
||||
|
||||
#: index.php:240
|
||||
msgid "Contents to be filtered"
|
||||
msgstr "Contenus à filtrer"
|
||||
|
||||
#: index.php:258
|
||||
msgid "Style"
|
||||
msgstr "Style"
|
||||
|
||||
#: index.php:263
|
||||
msgid "Class \"%s\":"
|
||||
msgstr "Class CSS \"%s\" :"
|
||||
|
||||
#: index.php:274
|
||||
msgid "The inserted HTML tag looks like: %s"
|
||||
msgstr "Le code HTML de la balise est le suivant: %s"
|
||||
|
||||
#: index.php:276
|
||||
msgid "Ignore HTML tags:"
|
||||
msgstr "Ignorer les balises HTML :"
|
||||
|
||||
#: index.php:279
|
||||
msgid "This is the list of HTML tags where content will be ignored."
|
||||
msgstr "Ceci est la liste des balises HTML dont le contenu sera ignoré."
|
||||
|
||||
#: index.php:280
|
||||
msgid "Tag \"%s\" always be ignored."
|
||||
msgstr "Les balises \"%s\" seront toujours ignorées."
|
||||
|
||||
#: index.php:343
|
||||
msgid "«prev."
|
||||
msgstr "préc."
|
||||
|
||||
#: index.php:344
|
||||
msgid "next»"
|
||||
msgstr "suiv."
|
||||
|
||||
#: index.php:349
|
||||
msgid "Records"
|
||||
msgstr "Enregistrements"
|
||||
|
||||
#: index.php:352
|
||||
msgid "No record"
|
||||
msgstr "Pas d'enregistrement"
|
||||
|
||||
#: index.php:387
|
||||
msgid "In order to remove a record, leave empty its key or value."
|
||||
msgstr "Pour retirer un enregistrement, laisser vide sa clé ou sa valeur."
|
||||
|
||||
#: index.php:406
|
||||
msgid "New record"
|
||||
msgstr "Nouvel enregistrement"
|
||||
|
||||
#: index.php:409
|
||||
msgid "Key:"
|
||||
msgstr "Clé :"
|
||||
|
||||
#: index.php:413
|
||||
msgid "Value:"
|
||||
msgstr "Valeur :"
|
||||
|
18
locales/fr/resources.php
Normal file
18
locales/fr/resources.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
||||
#
|
||||
# This file is part of enhancePostContent, a plugin for Dotclear 2.
|
||||
#
|
||||
# Copyright (c) 2009-2013 Jean-Christian Denis and contributors
|
||||
# contact@jcdenis.fr http://jcd.lv
|
||||
#
|
||||
# Licensed under the GPL version 2.0 license.
|
||||
# A copy of this license is available in LICENSE file or at
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
#
|
||||
# -- END LICENSE BLOCK ------------------------------------
|
||||
|
||||
if (!defined('DC_RC_PATH')) { return; }
|
||||
|
||||
$__resources['help']['enhancePostContent'] = dirname(__FILE__).'/help/help.html';
|
||||
?>
|
Loading…
Reference in New Issue
Block a user