PHP : Get all Timezones

<?php

$tzlist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);

foreach($tzlist as $val){

$date = new DateTime(date(‘Y-m-d H:i:s’), new DateTimeZone($val));
$tz[] = $date->format(‘P’);
echo $val .” == “. $date->format(‘P’);

}

//print_r(array_unique($tz));

$date = new DateTime(date(‘Y/m/j H:i:s’), new DateTimeZone(‘Asia/Kolkata’));
echo $date->format(‘Y/m/j H:i:sP’) . “<br/>”;

$timezone  = “+05:30”;
echo gmdate(“Y/m/j H:i:s”, time() + 3600*($timezone+date(“I”)));

WordPress : Custom roles Users in post author drop down

// Filter to fix the Post Author Dropdown
function author_override( $output ) {
    global $post, $user_ID;

    // return if this isn't the theme author override dropdown
    if (!preg_match('/post_author_override/', $output)) return $output;

    // return if we've already replaced the list (end recursion)
    if (preg_match ('/post_author_override_replaced/', $output)) return $output;

    // replacement call to wp_dropdown_users
      $output = wp_dropdown_users(array(
        'echo' => 0,
        'name' => 'post_author_override_replaced',
        'selected' => empty($post->ID) ? $user_ID : $post->post_author,
        'include_selected' => true
      ));

      // put the original name back
      $output = preg_replace('/post_author_override_replaced/', 'post_author_override', $output);

    return $output;
}
add_filter('wp_dropdown_users', 'author_override');

ZF2 : get HTML of View

protected function hasGridPdfRequest() {
$param = $this->params()->fromQuery(‘pdf’, “”);

if (trim($param) == “download”) {
$session = new \Zend\Session\Container(‘session’);

$viewRenderer = $this->getServiceLocator()->get(‘Zend\View\Renderer\RendererInterface’);
$layoutViewModel = $this->layout();
$layoutViewModel->setTemplate(‘layout/pdflayout’);
$route = ConstantFunction::getCurrentRoute();
$data = array();

if (isset($session->gridpdf[$route][‘sql’]) && trim($session->gridpdf[$route][‘sql’]) != “”) {
$connection = $this->getEntityManager()->getConnection();
$sql = isset($session->gridpdf[$route][‘sql’]) ? $session->gridpdf[$route][‘sql’] : “”;
$param = !empty($session->gridpdf[$route][‘param’]) ? $session->gridpdf[$route][‘param’] : array();
$data = $connection->executeQuery($sql, $param)->fetchAll();
}
$viewModel = new ViewModel(array(
‘data’ => $data
));

$viewModel->setTemplate($this->pdfPath);

//            $layoutViewModel->setVariables(array(
//                ‘content’ => $viewRenderer->render($viewModel),
//            ));
//
//            $htmlOutput = $viewRenderer->render($layoutViewModel);
$htmlOutput = $viewRenderer->render($viewModel);
return $this->downloadPdf($htmlOutput);
}