コード例 #1
0
 public static function check_page_template($display, $meta_box)
 {
     if (!isset($meta_box['show_on']['key']) || 'page-template' !== $meta_box['show_on']['key']) {
         return $display;
     }
     $object_id = rrze_Meta_Box::get_object_id();
     if (!$object_id || rrze_Meta_Box::get_object_type() !== 'post') {
         return false;
     }
     $current_template = get_post_meta($object_id, '_wp_page_template', true);
     if ($current_template && in_array($current_template, (array) $meta_box['show_on']['value'])) {
         return true;
     }
     return false;
 }
コード例 #2
0
 public function select_timezone()
 {
     $this->field->args['default'] = $this->field->args('default') ? $this->field->args('default') : rrze_Meta_Box::timezone_string();
     $meta_value = $this->field->escaped_value();
     return '<select name="' . $this->_name() . '" id="' . $this->_id() . '">' . wp_timezone_choice($meta_value) . '</select>';
 }
コード例 #3
0
 public function field_timezone_offset()
 {
     return rrze_Meta_Box::timezone_offset($this->field_timezone());
 }
コード例 #4
0
 public function text_datetime_timestamp_timezone($value)
 {
     $test = is_array($value) ? array_filter($value) : '';
     if (empty($test)) {
         return '';
     }
     $tzstring = null;
     if (is_array($value) && array_key_exists('timezone', $value)) {
         $tzstring = $value['timezone'];
     }
     if (empty($tzstring)) {
         $tzstring = rrze_Meta_Box::timezone_string();
     }
     $offset = rrze_Meta_Box::timezone_offset($tzstring, true);
     if (substr($tzstring, 0, 3) === 'UTC') {
         $tzstring = timezone_name_from_abbr('', $offset, 0);
     }
     $value = new DateTime($value['date'] . ' ' . $value['time'], new DateTimeZone($tzstring));
     $value = serialize($value);
     return $value;
 }
コード例 #5
0
 public static function set_object_type($object_type)
 {
     return self::$object_type = $object_type;
 }