/** * @param G1_Shortcode_Attribute array $defined_attributes * @param array $passed_attributes * @return string */ protected function capture_attributes_warnings($defined_attributes, $passed_attributes = array()) { $warnings = array(); $available_attribute_names = array(); foreach ($defined_attributes as $defined_attribute) { $available_attribute_names[] = $defined_attribute->get_id(); $available_attribute_names = array_merge($available_attribute_names, $defined_attribute->get_id_aliases()); } if (is_array($passed_attributes)) { foreach ($passed_attributes as $id => $value) { if (!in_array($id, $available_attribute_names)) { $helpmode = new G1_Helpmode('wrong_shortcode_attribute', __('Wrong shortcode attribute:', 'g1_theme') . ' ' . $id, sprintf(__('Shortcode "%s" has no "%s" attribute', 'g1_theme'), $this->get_id(), $id), 'error'); $warnings[] = $helpmode->capture(); } } } return implode('', $warnings); }
/** * Renders sidebar. * */ function g1_sidebar_render($s = 'primary') { if (is_active_sidebar($s)) { dynamic_sidebar($s); return; } elseif (current_user_can('administrator')) { $helpmode = new G1_Helpmode('empty_sidebar_' . $s, __('Empty sidebar', 'g1_theme'), '<p>' . sprintf(__('The "%s" sidebar is empty.', 'g1_theme'), $s) . ' ' . sprintf(__('You should <a href="%s">add some widgets</a> to it.', 'g1_theme'), network_admin_url('widgets.php')) . '</p>', 'warning'); $helpmode->render(); } }
wp_list_comments(array('type' => 'pings', 'page' => 1, 'per_page' => $g1_pings_count, 'callback' => 'g1_wp_list_comments_callback')); ?> </ol> </div> <?php } ?> <?php if (comments_open()) { ?> <?php if (is_front_page()) { ?> <?php $g1_helpmode = new G1_Helpmode('hide_comments', __('Do you want to hide comments?', 'g1_theme'), '<ul>' . '<li>' . sprintf(__('When <a href="%s">editing this page</a> make sure the "Discussion" box is visible: configure your screen options in the top-right section of the WordPress Admin. Sometimes this box can be hidden.', 'g1_theme'), get_edit_post_link()) . '</li>' . '<li>' . __('Uncheck "Allow comments" and "Allow trackbacks and pingbacks on this page".', 'g1_theme') . '</li>' . '<li>' . __('Save changes', 'g1_theme') . '</li>' . '</ul>', 'warning'); $g1_helpmode->render(); ?> <?php } ?> <?php comment_form(); ?> <?php } ?> </section><!-- #comments --> <?php