2021-08-20 19:07:26 +00:00
|
|
|
<?php
|
2021-09-02 20:43:05 +00:00
|
|
|
/**
|
|
|
|
* @brief postExpired, a plugin for Dotclear 2
|
2022-11-20 20:43:32 +00:00
|
|
|
*
|
2021-09-02 20:43:05 +00:00
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
2022-11-20 20:43:32 +00:00
|
|
|
*
|
2021-09-02 20:43:05 +00:00
|
|
|
* @author Jean-Christian Denis and Contributors
|
2022-11-20 20:43:32 +00:00
|
|
|
*
|
2021-09-02 20:43:05 +00:00
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2021-08-20 19:07:26 +00:00
|
|
|
if (!defined('DC_RC_PATH')) {
|
2021-08-20 19:36:46 +00:00
|
|
|
return null;
|
2021-08-20 19:07:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Encode Expired Date settings
|
|
|
|
*
|
|
|
|
* This is saved into post_meta as meta_id value,
|
|
|
|
* so this must be less than 255 caracters.
|
2022-11-20 20:43:32 +00:00
|
|
|
*
|
2021-08-20 19:07:26 +00:00
|
|
|
* @param array $in Array of options
|
|
|
|
* @return string "Serialized" options
|
|
|
|
*/
|
|
|
|
function encodePostExpired($in)
|
|
|
|
{
|
2022-11-20 20:43:32 +00:00
|
|
|
$out = [];
|
|
|
|
foreach ($in as $k => $v) {
|
2021-08-20 19:36:46 +00:00
|
|
|
$out[] = $k . '|' . $v;
|
|
|
|
}
|
2021-08-20 19:07:26 +00:00
|
|
|
|
2021-08-20 19:36:46 +00:00
|
|
|
return implode(';', $out);
|
2021-08-20 19:07:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decode Expired Date settings
|
2022-11-20 20:43:32 +00:00
|
|
|
*
|
2021-08-20 19:07:26 +00:00
|
|
|
* @param string $in "Serialized" options
|
|
|
|
* @return array Array of options
|
|
|
|
*/
|
|
|
|
function decodePostExpired($in)
|
|
|
|
{
|
2022-11-20 20:43:32 +00:00
|
|
|
$out = [];
|
|
|
|
foreach (explode(';', $in) as $v) {
|
|
|
|
$v = explode('|', $v);
|
2021-08-20 19:36:46 +00:00
|
|
|
$out[$v[0]] = $v[1];
|
|
|
|
}
|
2021-08-20 19:07:26 +00:00
|
|
|
|
2021-08-20 19:36:46 +00:00
|
|
|
return $out;
|
2022-11-20 20:43:32 +00:00
|
|
|
}
|