Skip to content

Commit

Permalink
Version 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
themefuse committed Sep 15, 2014
1 parent 8adcb6b commit 679682f
Show file tree
Hide file tree
Showing 16 changed files with 126 additions and 171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,3 @@ function fw_ext_portfolio_get_sort_classes( $items, $taxonomy, $categories, $pre

return $classes;
}

function _fw_ext_portfolio_theme_action_set_posts_per_page( $query ) {
if( !$query->is_main_query() ) {
return;
}

if( isset( $query->query['post_type'] ) && $query->query['post_type'] != fw()->extensions->get('portfolio')->get_post_type_name()){
return;
}

$query->set( 'posts_per_page', -1 );
}
add_action( 'pre_get_posts', '_fw_ext_portfolio_theme_action_set_posts_per_page' );
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php if ( ! defined( 'FW' ) ) { die( 'Forbidden' ); }

/**
* Display all existing portfolio posts on the page (without pagination)
* Because in this theme we use the https://mixitup.kunkalabs.com/ plugin to display portfolio posts
* If your theme displays portfolio posts in a different way, feel free to change or remove this function
* @internal
* @param WP_Query $query
*/
function _fw_ext_portfolio_theme_action_set_posts_per_page( $query ) {
if (!$query->is_main_query()) {
return;
}

/**
* @var FW_Extension_Portfolio $portfolio
*/
$portfolio = fw()->extensions->get('portfolio');

$is_portfolio_taxonomy = $query->is_tax( $portfolio->get_taxonomy_name() );
$is_portfolio_archive = $query->is_archive()
&& isset( $query->query['post_type'] )
&& $query->query['post_type'] == $portfolio->get_post_type_name();

if ($is_portfolio_taxonomy || $is_portfolio_archive) {
$query->set( 'posts_per_page', -1 );
}
}
add_action( 'pre_get_posts', '_fw_ext_portfolio_theme_action_set_posts_per_page' );
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,28 @@

$cfg = array(
'sidebar_positions' => array(
'full' => array(
'icon_url' => 'full.png',
'sidebars_number' => 0

),
'left' => array(
'icon_url' => 'left.png',
'sidebars_number' => 1

),
'right' => array(
'icon_url' => 'right.png',
'sidebars_number' => 1
),
'left_right' => array(
'icon_url' => 'left_right.png',
'sidebars_number' => 2
),
'full' => array(
'icon_url' => 'full.png',
'sidebars_number' => 0
),
'left' => array(
'icon_url' => 'left.png',
'sidebars_number' => 1
),
'right' => array(
'icon_url' => 'right.png',
'sidebars_number' => 1
),
'left_right' => array(
'icon_url' => 'left_right.png',
'sidebars_number' => 2
),
),

'dynamic_sidebar_args' => array(
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
),
);
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => array(
'icon' => 'video',
'html' => '<iframe width="420" height="236" src="//player.vimeo.com/video/101070863" frameborder="0" allowfullscreen></iframe>'
'html' => '<iframe width="420" height="236" src="https://player.vimeo.com/video/101070863" frameborder="0" allowfullscreen></iframe>'
),
),
'demo_wp_editor_2' => array(
Expand Down Expand Up @@ -512,7 +512,7 @@
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => array(
'icon' => 'video',
'html' => '<iframe width="420" height="315" src="//www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'
'html' => '<iframe width="420" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => array(
'icon' => 'video',
'html' => '<iframe width="420" height="236" src="//player.vimeo.com/video/101070863" frameborder="0" allowfullscreen></iframe>'
'html' => '<iframe width="420" height="236" src="https://player.vimeo.com/video/101070863" frameborder="0" allowfullscreen></iframe>'
),
),
'demo_wp_editor' => array(
Expand Down Expand Up @@ -511,7 +511,7 @@
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => array(
'icon' => 'video',
'html' => '<iframe width="420" height="315" src="//www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'
'html' => '<iframe width="420" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => array(
'icon' => 'video',
'html' => '<iframe width="420" height="315" src="//www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'
'html' => '<iframe width="420" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'
),
),
'demo_wp_editor' => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function form( $instance ) {
foreach ( $instance as $key => $value ) {
?>
<p>
<label><?php echo __( $titles[ $key ], "fw" ); ?></label>
<label><?php echo $titles[ $key ] ?></label>
<input class="widefat widget_social_link widget_link_field"
name="<?php echo $this->get_field_name( $key ) ?>" type="text"
value="<?php echo ( $instance[ $key ] === $titles[ $key ] ) ? '' : $instance[ $key ]; ?>"/>
Expand Down
11 changes: 11 additions & 0 deletions scratch-parent/framework/core/components/backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,24 @@ private function register_static()
return;
}

/**
* Register styles/scripts only in admin area, on frontend it's not allowed to use styles/scripts from framework backend core
* because they are meant to be used only in backend and can be changed in the future.
* If you want to use a style/script from framework backend core, copy it to your theme and enqueue as a theme style/script.
*/
if (!is_admin()) {
$this->static_registered = true;
return;
}

wp_register_script(
'fw-events',
FW_URI .'/static/js/fw-events.js',
array('backbone'),
fw()->manifest->get_version(),
true
);

wp_register_script(
'fw-ie-fixes',
FW_URI .'/static/js/ie-fixes.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,16 @@ function _admin_filter_change_updated_messages($messages)

$messages[$post_type] = array(
0 => '', // Unused. Messages start at index 1.
1 => sprintf(__($singular . ' updated. <a href="%s">View ' . strtolower($singular) . '</a>'), esc_url(get_permalink($post->ID))),
2 => __('Custom field updated.'),
3 => __('Custom field deleted.'),
4 => __($singular . ' updated.'),
5 => isset($_GET['revision']) ? sprintf(__($singular . ' restored to revision from %s'), wp_post_revision_title((int)$_GET['revision'], false)) : false,
6 => sprintf(__($singular . ' published. <a href="%s">View ' . strtolower($singular) . '</a>'), esc_url(get_permalink($post->ID))),
7 => __('Page saved.'),
8 => sprintf(__($singular . ' submitted. <a target="_blank" href="%s">Preview ' . strtolower($singular) . '</a>'), esc_url(add_query_arg('preview', 'true', get_permalink($post->ID)))),
9 => sprintf(__($singular . ' scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview ' . strtolower($singular) . '</a>'), date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)), esc_url(get_permalink($post->ID))),
10 => sprintf(__($singular . ' draft updated. <a target="_blank" href="%s">Preview ' . strtolower($singular) . '</a>'), esc_url(add_query_arg('preview', 'true', get_permalink($post->ID)))),
1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'fw'), $singular, esc_url(get_permalink($post->ID)), strtolower($singular)),
2 => __('Custom field updated.', 'fw'),
3 => __('Custom field deleted.', 'fw'),
4 => sprintf(__('%s updated.', 'fw'), $singular),
5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'fw'), $singular, wp_post_revision_title((int)$_GET['revision'], false)) : false,
6 => sprintf(__('%s published. <a href="%s">View %s</a>'), $singular, esc_url(get_permalink($post->ID)), strtolower($singular)),
7 => __('Page saved.', 'fw'),
8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>'), $singular, esc_url(add_query_arg('preview', 'true', get_permalink($post->ID))), strtolower($singular)),
9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>'), $singular, date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)), esc_url(get_permalink($post->ID)), strtolower($singular)),
10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>'), $singular, esc_url(add_query_arg('preview', 'true', get_permalink($post->ID))), strtolower($singular)),
);
}

Expand Down Expand Up @@ -257,7 +257,7 @@ public function load_post_edit_options()
array(
'slider-sidebar-metabox' => array(
'context' => 'side',
'title' => __(ucfirst($this->get_name()) . ' Configuration', 'fw'),
'title' => __('Slider Configuration', 'fw'),
'type' => 'box',
'options' => array(
'populated' => array(
Expand All @@ -266,7 +266,7 @@ public function load_post_edit_options()
),
'title' => array(
'type' => 'text',
'label' => __(ucfirst($this->get_name()) . ' Title', 'fw'),
'label' => __('Slider Title', 'fw'),
'value' => $title_value,
'desc' => 'Choose a title for your slider only for internal use: Ex: "Homepage".'
)
Expand Down Expand Up @@ -319,7 +319,7 @@ public function load_post_new_options()
{
return array(
'general' => array(
'title' => __(ucfirst($this->get_name()) . ' Settings', 'fw'),
'title' => __('Slider Settings', 'fw'),
'type' => 'box',
'options' => array(
$this->get_name() => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ public function _init() {
* @internal
*/
public function _admin_action_add_settings_menu() {
add_options_page(
add_theme_page(
$this->name, __( 'Search Engines', 'fw' ),
'manage_options',
$this->get_name() . '-settings',
array( $this, 'get_settings_page' ) );
array( $this, 'get_settings_page' )
);
}

public function _admin_action_add_static() {
Expand Down
29 changes: 29 additions & 0 deletions scratch-parent/framework/extensions/sidebars/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

$cfg = array(
'sidebar_positions' => array(
'full' => array(
'icon_url' => 'full.png',
'sidebars_number' => 0
),
'left' => array(
'icon_url' => 'left.png',
'sidebars_number' => 1
),
'right' => array(
'icon_url' => 'right.png',
'sidebars_number' => 1
),
'left_right' => array(
'icon_url' => 'left_right.png',
'sidebars_number' => 2
),
),

'dynamic_sidebar_args' => array(
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
),
);
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,13 @@ public function get_label_grouped($type, $sub_type)
}

/**
* Retrive info about registered post_types or taxonomies
* Retrieve info about registered post_types or taxonomies
*/
protected function get_name_from_db($slug, $type_key, $is_singular)
{
$result = $slug;
$get_object = ($type_key === self::POST_TYPES_PREFIX ? 'get_post_type_object' : 'get_taxonomy' );
$obj = $get_object($slug);
$obj = call_user_func_array($get_object, array($slug));
if($obj) {
if($is_singular) {
//singular name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ public function render_sidebar($color)
}

/**
* Generate current page requirements and return array with avaible sidebars for current page
* Generate current page requirements and return array with available sidebars for current page
*/
public function get_current_page_preset(){
//check if current_page_preset doesn't get before
public function get_current_page_preset()
{
// check if current_page_preset doesn't get before
if ($this->current_page_preset !== null) {
return $this->current_page_preset;
}
Expand Down Expand Up @@ -125,7 +126,7 @@ public function get_current_page_preset(){

foreach($conditional_tags as $key => $cond_tag)
{
$function = null;
$function = null;
if (isset($cond_tag['conditional_tag']))
{
$function = isset($cond_tag['conditional_tag']['callback']) ? $cond_tag['conditional_tag']['callback'] : '';
Expand All @@ -150,7 +151,7 @@ public function get_current_page_preset(){
} else {
$function = $key;
if (is_callable($function)) {
if ($function()){
if (call_user_func($function)){
$data['type'] = $this->config->get_type_by_prefix(_FW_Extension_Sidebars_Config::CONDITIONAL_TAGS_PREFIX);
$data['sub_type'] = $key;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ public function __construct($sidebar)
foreach ($sidebar as $key => $value)
{
$method = 'set_' . $key;
if(method_exists($this, $method))
{
$this->$method($value);
if(method_exists($this, $method)) {
call_user_func_array(array($this, $method), array($value));
}

}
Expand Down
Loading

0 comments on commit 679682f

Please sign in to comment.