本文整理汇总了PHP中ThemeHelper类的典型用法代码示例。如果您正苦于以下问题:PHP ThemeHelper类的具体用法?PHP ThemeHelper怎么用?PHP ThemeHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ThemeHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPost
function getPost()
{
$data = new stdClass();
$categoryId = (int) get_query_var('cat');
if (is_tag()) {
$data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
$tagQuery = get_query_var('tag');
$tagData = get_tags(array('slug' => $tagQuery));
$data->post->post_title = esc_html($tagData[0]->name);
} elseif (is_category($categoryId)) {
$category = get_category($categoryId);
$data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
$data->post->post_title = ThemeHelper::esc_html($category->name);
} elseif (is_day()) {
$data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
$data->post->post_title = get_the_date();
} elseif (is_archive()) {
$data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
$data->post->post_title = single_month_title(' ', false);
} elseif (is_search()) {
$data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
$data->post->post_title = sprintf(__('Search result for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
} elseif (is_404()) {
$data->post = get_post(ThemeOption::getOption('page_404_page_id'));
$data->post->post_title = $data->post->post_title;
} else {
return false;
}
return $data;
}
示例2: createPagination
function createPagination($query)
{
global $wp_rewrite;
$total = $query->max_num_pages;
$current = max(1, ThemeHelper::getPageNumber());
$Validation = new ThemeValidation();
$pagination = array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'current' => $current, 'total' => $total, 'next_text' => __(' >', THEME_CONTEXT), 'prev_text' => __('< ', THEME_CONTEXT));
if ($wp_rewrite->using_permalinks()) {
$pagination['base'] = user_trailingslashit(trailingslashit(remove_query_arg('s', get_pagenum_link(1))) . 'page/%#%/', 'paged');
}
if (is_search()) {
$pagination['add_args'] = array('s' => urlencode(get_query_var('s')));
}
$html = paginate_links($pagination);
if ($Validation->isNotEmpty($html)) {
$html = '
<div class="theme-blog-pagination-box">
<div class="theme-blog-pagination">
' . $html . '
</div>
</div>
';
}
return $html;
}
示例3: theme_settings_form
public function theme_settings_form()
{
$settings = Setting::first();
$user = Auth::user();
$data = array('settings' => $settings, 'admin_user' => $user, 'theme_settings' => ThemeHelper::getThemeSettings());
return View::make('Theme::includes.settings', $data);
}
示例4: outputWP
function outputWP($format = false)
{
ob_start();
include locate_template($this->path);
$value = ob_get_clean();
if ($format) {
$value = ThemeHelper::formatCode($value);
}
return $value;
}
示例5: adminSaveMetaBox
function adminSaveMetaBox($postId)
{
if ($_POST) {
if (ThemeHelper::checkSavePost($postId, THEME_CONTEXT . '_meta_box_widget_area_noncename', 'adminSaveMetaBox') === false) {
return false;
}
$option = ThemeHelper::getPostOption('widget_area');
update_post_meta($postId, THEME_OPTION_PREFIX, $option);
}
}
示例6: index
public function index()
{
if (\Input::get('theme')) {
\Cookie::queue('theme', \Input::get('theme'), 100);
return Redirect::to('/')->withCookie(cookie('theme', \Input::get('theme'), 100));
}
$data = array('videos' => Video::where('active', '=', '1')->orderBy('created_at', 'DESC')->simplePaginate($this->videos_per_page), 'current_page' => 1, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'pagination_url' => '/videos', 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
//dd($data['videos']);
return View::make('Theme::home', $data);
}
示例7: index
public function index()
{
$search_value = Input::get('value');
if (empty($search_value)) {
return Redirect::to('/');
}
$videos = Video::where('active', '=', 1)->where('title', 'LIKE', '%' . $search_value . '%')->orderBy('created_at', 'desc')->get();
$posts = Post::where('active', '=', 1)->where('title', 'LIKE', '%' . $search_value . '%')->orderBy('created_at', 'desc')->get();
$data = array('videos' => $videos, 'posts' => $posts, 'search_value' => $search_value, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
return View::make('Theme::search-list', $data);
}
示例8: category
public function category($category)
{
$page = Input::get('page');
if (!empty($page)) {
$page = Input::get('page');
} else {
$page = 1;
}
$cat = PostCategory::where('slug', '=', $category)->first();
$data = array('posts' => Post::where('active', '=', '1')->where('post_category_id', '=', $cat->id)->orderBy('created_at', 'DESC')->simplePaginate($this->posts_per_page), 'current_page' => $page, 'category' => $cat, 'page_title' => 'Posts - ' . $cat->name, 'page_description' => 'Page ' . $page, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'pagination_url' => '/posts/category/' . $category, 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
return View::make('Theme::post-list', $data);
}
示例9: form
function form($instance)
{
$data = array();
if (is_array($instance['_data']['field'])) {
foreach ($instance['_data']['field'] as $value) {
ThemeHelper::removeUIndex($instance, $value);
ThemeHelper::removeUIndex($data['option'][$value], 'id', 'name', 'value');
$data['option'][$value]['id'] = $this->get_field_id($value);
$data['option'][$value]['name'] = $this->get_field_name($value);
$data['option'][$value]['value'] = $instance[$value];
}
}
$Template = new ThemeTemplate($data, THEME_PATH_TEMPLATE . 'admin/' . $instance['_data']['file']);
echo $Template->output(true);
}
示例10: import
function import()
{
$response = array('global' => array('error' => 1));
$Notice = new ThemeNotice();
$result = $this->download();
if ($result) {
$response['global']['error'] = 0;
} else {
$Notice->addError(ThemeHelper::getFormName('import_google_font', false), ThemeHelper::esc_html('Cannot import list of fonts'));
$response['local'] = $Notice->getError();
}
$response['global']['notice'] = $Notice->createHTML(THEME_PATH_TEMPLATE . 'notice.php');
echo json_encode($response);
exit;
}
示例11: show_favorites
public function show_favorites()
{
if (!Auth::guest()) {
$page = Input::get('page');
if (empty($page)) {
$page = 1;
}
$favorites = Favorite::where('user_id', '=', Auth::user()->id)->orderBy('created_at', 'desc')->get();
$favorite_array = array();
foreach ($favorites as $key => $fave) {
array_push($favorite_array, $fave->video_id);
}
$videos = Video::where('active', '=', '1')->whereIn('id', $favorite_array)->paginate(12);
$data = array('videos' => $videos, 'page_title' => ucfirst(Auth::user()->username) . '\'s Favorite Videos', 'current_page' => $page, 'page_description' => 'Page ' . $page, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'pagination_url' => '/favorites', 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
return View::make('Theme::video-list', $data);
} else {
return Redirect::to('videos');
}
}
示例12: start_el
function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
{
$this->iconClass = null;
if ($depth == 0) {
$this->icon = $object->icon;
$this->mega_menu_layout_column_index = 0;
$this->mega_menu_enable = $object->mega_menu_enable;
$this->mega_menu_layout = $object->mega_menu_layout;
if ($object->icon != '-1') {
$this->iconClass = 'pb-menu-icon pb-menu-icon-' . ThemeHelper::createHash($object->icon);
}
}
if ($this->mega_menu_enable == 1) {
if ($depth == 0 || $depth == 2) {
$output .= '<li class="' . join(' ', (array) $object->classes) . ($depth == 0 ? ' sf-mega-enable-1' : null) . ' ' . $this->iconClass . ' ' . '">';
}
if ($depth == 1) {
$Layout = new ThemeLayout();
$class = array('sf-mega-section', $Layout->getLayoutColumnCSSClass($this->mega_menu_layout, $this->mega_menu_layout_column_index, 'theme-layout-column-'));
$output .= '
<div' . ThemeHelper::createClassAttribute($class) . '>
';
$this->mega_menu_layout_column_index++;
}
if ($depth == 1) {
$output .= '
<span class="sf-mega-header">' . esc_html($object->title) . '</span>
';
} else {
$output .= '
<a href="' . esc_attr($object->url) . '"><span></span>' . $object->title . '</a>
';
}
} else {
$output .= '
<li class="' . join(' ', (array) $object->classes) . ($depth == 0 ? ' sf-mega-enable-0' : null) . ' ' . $this->iconClass . ' ' . '">
<a href="' . esc_attr($object->url) . '"><span></span>' . $object->title . '</a>
';
}
}
示例13: init
function init()
{
if (is_admin()) {
return;
}
if (ThemeOption::getOption('maintenance_mode_enable') != 1) {
return;
}
$user = wp_get_current_user();
if (in_array($user->data->ID, (array) ThemeOption::getOption('maintenance_mode_user_id'))) {
return;
}
$address = array_map('trim', mb_split("\n", ThemeOption::getOption('maintenance_mode_ip_address')));
if (in_array(ThemeHelper::getVisitorIP(), $address)) {
return;
}
$page = get_post((int) ThemeOption::getOption('maintenance_mode_post_id'));
if (is_null($page)) {
return;
}
add_action('wp_head', array($this, 'filterWPHead'));
}
示例14: ThemeValidation
$Validation = new ThemeValidation();
$WidgetArea = new ThemeWidgetArea();
$widgetAreaData = $WidgetArea->getWidgetAreaByPost($fable_parentPost->post, true, true);
$query = $Blog->getPost();
$postCount = count($query->posts);
if ($postCount) {
?>
<div class="theme-clear-fix">
<ul class="theme-reset-list theme-clear-fix theme-blog">
<?php
while ($query->have_posts()) {
$query->the_post();
$excerpt = apply_filters('the_content', get_the_excerpt());
$option = ThemeOption::getPostMeta($post);
ThemeHelper::removeUIndex($option, 'post_type');
$visibleOption = array();
$visibleOption['post_tag_visible'] = ThemeOption::getGlobalOption($post, 'post_tag_visible');
$visibleOption['post_author_visible'] = ThemeOption::getGlobalOption($post, 'post_author_visible');
$visibleOption['post_category_visible'] = ThemeOption::getGlobalOption($post, 'post_category_visible');
$visibleOption['post_comment_count_visible'] = ThemeOption::getGlobalOption($post, 'post_comment_count_visible') && comments_open(get_the_id());
?>
<li id="post-<?php
the_ID();
?>
" <?php
post_class('theme-clear-fix theme-post theme-post-type-' . (is_sticky() ? 'sticky' : $option['post_type']));
?>
>
<?php
$Post->formatPostDate($post->post_date, $day, $month, $year);
示例15: esc_html_e
?>
</h5>
<span class="to-legend"><?php
esc_html_e('Line height with selected unit.', THEME_DOMAIN);
?>
</span>
<div>
<input type="text" name="<?php
ThemeHelper::getFormName('font_h5_line_height');
?>
" id="<?php
ThemeHelper::getFormName('font_h5_line_height');
?>
" value="<?php
echo ThemeHelper::esc_attr($this->data['option']['font_h5_line_height']);
?>
" maxlength="255"/>
</div>
</li>
</ul>
<script type="text/javascript">
jQuery(document).ready(function($)
{
var element=$('.to').themeOptionElement();;
element.createGoogleFontAutocomplete('#<?php
ThemeHelper::getFormName('font_h5_family_google');
?>
');
});
</script>