Skip to content

Commit

Permalink
Merge pull request #1761 from publishpress/release-v4.5.0
Browse files Browse the repository at this point in the history
Release v4.5.0
  • Loading branch information
olatechpro authored Sep 12, 2024
2 parents d1075f6 + 4ffcaa0 commit 948b853
Show file tree
Hide file tree
Showing 33 changed files with 3,788 additions and 3,144 deletions.
32 changes: 32 additions & 0 deletions common/css/publishpress-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,38 @@
font-style: normal;
}

.pp-title-tooltip {
cursor: help;
position: relative;
}

.pp-title-tooltip-text {
display: none;
position: absolute;
background-color: #3c434a;
color: #fff;
padding: 5px;
border-radius: 5px;
font-size: 12px;
white-space: nowrap;
z-index: 1000;
pointer-events: none;
box-shadow: 0px 4px 8px rgb(255, 255, 255);
}

.pp-title-tooltip-text::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
border-width: 5px;
border-style: solid;
border-color: #333 transparent transparent transparent;
box-shadow: -1px -1px 3px rgba(0, 0, 0, 0.1);
}


[class^="pp-icon-"]:before,
[class*=" pp-icon-"]:before {
font-family: "publishpress" !important;
Expand Down
44 changes: 44 additions & 0 deletions common/js/publishpress-admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
(function ($) {
'use strict';

/**
* All of the code for admin-facing JavaScript source
* should reside in this file.
*/

$(document).ready(function () {

initToolTips();
function initToolTips() {
$('.pp-title-tooltip').each(function() {
var $this = $(this);
var titleText = $this.attr('title');

if (titleText && titleText !== '') {
$this.removeAttr('title');

var $tooltip = $('<div class="pp-title-tooltip-text"></div>').text(titleText);
$('body').append($tooltip);

$this.hover(function() {
$tooltip.show();

// Adjust the tooltip position to account for the arrow
var tooltipTop = $this.offset().top - $tooltip.outerHeight() - 10; // Position 10px above the element
var tooltipLeft = $this.offset().left + ($this.outerWidth() / 2) - ($tooltip.outerWidth() / 2);

$tooltip.css({
top: tooltipTop + 'px',
left: tooltipLeft + 'px',
position: 'absolute'
});
}, function() {
$tooltip.hide();
});
}
});
}

});

})(jQuery);
97 changes: 97 additions & 0 deletions common/php/class-module.php
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ public function localize_post_data($localized_post_data, $post, $can_edit_post)
'post_id' => $post->ID,
'post_title' => $post_title,
'raw_title' => $post->post_title,
'filtered_title' => isset($post->filtered_title) ? $post->filtered_title : $post->post_title,
'post_status' => $post->post_status,
'status_label' => $this->get_post_status_friendly_name($post->post_status),
'can_edit_post' => $can_edit_post ? 1 : 0,
Expand Down Expand Up @@ -1177,5 +1178,101 @@ public function get_author_markup($post, $can_edit_post) {
}
}

public function get_publish_date_markup() {
ob_start();
?>
<div class="misc-pub-section curtime misc-pub-curtime">
<fieldset id="timestampdiv">
<?php $this->touch_time(); ?>
</fieldset>
</div>
<?php
$publish_date_markup = ob_get_clean();
return $publish_date_markup;
}

public function touch_time( $tab_index = 0, $multi = 0 ) {
global $wp_locale;

$tab_index_attribute = '';
if ( (int) $tab_index > 0 ) {
$tab_index_attribute = " tabindex=\"$tab_index\"";
}

$jj = current_time( 'd' );
$mm = current_time( 'm' );
$aa = current_time( 'Y' );
$hh = current_time( 'H' );
$mn = current_time( 'i' );
$ss = current_time( 's' );

$cur_jj = current_time( 'd' );
$cur_mm = current_time( 'm' );
$cur_aa = current_time( 'Y' );
$cur_hh = current_time( 'H' );
$cur_mn = current_time( 'i' );

$month = '<label><span class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'Month' ) .
'</span><select class="form-required" ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
for ( $i = 1; $i < 13; $i = $i + 1 ) {
$monthnum = zeroise( $i, 2 );
$monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
$month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>';
/* translators: 1: Month number (01, 02, etc.), 2: Month abbreviation. */
$month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $monthtext ) . "</option>\n";
}
$month .= '</select></label>';

$day = '<label><span class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'Day' ) .
'</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
$year = '<label><span class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'Year' ) .
'</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
$hour = '<label><span class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'Hour' ) .
'</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
$minute = '<label><span class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'Minute' ) .
'</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';

echo '<div class="timestamp-wrap">';
/* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */
printf( __( '%1$s %2$s, %3$s at %4$s:%5$s' ), $month, $day, $year, $hour, $minute );

echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';

if ( $multi ) {
return;
}

echo "\n\n";

$map = array(
'mm' => array( $mm, $cur_mm ),
'jj' => array( $jj, $cur_jj ),
'aa' => array( $aa, $cur_aa ),
'hh' => array( $hh, $cur_hh ),
'mn' => array( $mn, $cur_mn ),
);

foreach ( $map as $timeunit => $value ) {
list( $unit, $curr ) = $value;

echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $unit . '" />' . "\n";
$cur_timeunit = 'cur_' . $timeunit;
echo '<input type="hidden" id="' . $cur_timeunit . '" name="' . $cur_timeunit . '" value="' . $curr . '" />' . "\n";
}
?>
<?php
}


}
}
Loading

0 comments on commit 948b853

Please sign in to comment.