public function __construct() { parent::__construct(); global $configDetails; $themeDetails = $this->getRequiredFieldsSingle('site_themes', "theme_status=? ORDER BY theme_id ASC LIMIT 0,1", $conditionValue = array('1'), 'theme_path'); if ($themeDetails['theme_path'] != '') { $theme_path = _output($themeDetails['theme_path']); } else { $theme_path = DEFAULT_THEME_PATH; } $this->urlBase = $configDetails['sitePath']; // site path from config file(config.php) $this->urlAssetsBase = $configDetails['sitePath'] . $theme_path; $this->urlImageBase = $configDetails['sitePath'] . $theme_path . $configDetails['imagesDirectory']; }
/** * Sends text/html email. */ function _emailSupport($toEmails, $subject = "GitHub synchronization failed") { global $output, $config, $hadErrors, $noemail, $testMode; $hadErrors = true; if ($noemail || empty($toEmails)) { _output('<br/>An error occured. '); return; } if (!is_array($toEmails)) { $toEmails = array($toEmails); } _output('<br/>Send email to support: ' . implode(', ', $toEmails)); if ($testMode) { return; } $from = $config->supportEmailFrom; $headers = "From: {$from}\r\n"; $headers .= "Content-Type: text/html\r\n"; foreach ($toEmails as $toEmail) { if (empty($from)) { $from = $toEmail; } mail($toEmail, $subject, $output, $headers); } }
function _output($data = '', $tab = '', $start = 0, $settings = array()) { static $start; $lengthColor = isset($settings['lengthColor']) ? $settings['lengthColor'] : 'grey'; $keyColor = isset($settings['keyColor']) ? $settings['keyColor'] : '#000'; $typeColor = isset($settings['typeColor']) ? $settings['typeColor'] : '#8C2300'; $stringColor = isset($settings['stringColor']) ? $settings['stringColor'] : 'red'; $numericColor = isset($settings['numericColor']) ? $settings['numericColor'] : 'green'; $output = ''; $eof = '<br>'; $tab = str_repeat(' ', $start); $lengthstyle = ' style="color:' . $lengthColor . '"'; $keystyle = ' style="color:' . $keyColor . '"'; $typestyle = ' style="color:' . $typeColor . '"'; $vartype = 'array'; if (is_object($data)) { $data = (array) $data; $vartype = 'object'; } if (!is_array($data)) { return $data . $eof; } else { foreach ($data as $k => $v) { if (is_object($v)) { $v = (array) $v; $vartype = 'object'; } if (!is_array($v)) { $valstyle = ' style="color:' . $numericColor . ';"'; $type = gettype($v); if ($type === 'string') { $v = "'" . $v . "'"; $valstyle = ' style="color:' . $stringColor . ';"'; $type = 'string'; } elseif ($type === 'boolean') { $v = $v === true ? 'true' : 'false'; $type = 'boolean'; } $output .= "{$tab}<span{$keystyle}>{$k}</span> => <span{$typestyle}>{$type}</span> <span{$valstyle}>{$v}</span> <span{$lengthstyle}>( length = " . strlen($v) . " )</span>,{$eof}"; } else { $output .= "{$tab}<span{$keystyle}>{$k}</span> => <span{$typestyle}>{$vartype}</span> {$eof} {$tab}( {$eof} " . _output($v, $tab, $start++) . " {$tab}), " . $eof; $start--; } } } return $output; }
/** * エラー処理 * * @param integer $status エラーコード * @return 無し */ function _error($status) { $obj = new stdClass(); $obj->error_cd = $status; _output($obj); return; }
/** * Show the timeline as is it * * @param array $atts * @since 0.1 */ function shortcode_timeline($atts = null) { $count = 0; $items = array(); $start_at_slide = !empty($atts) ? 0 : 1; $args = array('post_type' => 'timeline', 'orderby' => 'id', 'order' => 'ASC'); if (!empty($atts)) { $args['timeline-category'] = current($atts); } query_posts($args); if (have_posts()) { while (have_posts()) { the_post(); if (0 === $count) { $end_content = first_item(get_the_title(), get_the_content(), get_field('initial_date'), $atts); } $video = get_field('video'); $image = get_field('image'); $items[$count] = array('startDate' => date('Y,m,d', strtotime(get_field('initial_date'))), 'endDate' => date('Y,m,d', strtotime(get_field('final_date'))), 'headline' => get_the_title(), 'text' => get_the_content(), 'asset' => array('media' => parse_media($image, $video), 'credit' => get_field('media_credit'), 'caption' => get_field('media_caption'))); if (media_is_image($image)) { $items[$count]['asset']['thumbnail'] = $image['sizes']['thumbnail']; } $count++; } $end_content['timeline']['date'] = $items; $end_content = to_json($end_content); wp_reset_query(); _output($end_content, $start_at_slide); } else { printf('<div class="no-content"><h3>%s</h3></div>', __('Sorry, no items to show', 'redsuns-timeline')); } }