Пример #1
0
 function column_id($item)
 {
     $url = 'options-general.php?page=kcsb&id=' . $item['id'] . '&_wpnonce=' . wp_create_nonce("__kcsb__{$item['id']}") . '&action=';
     $actions = array('edit' => "<a href='" . admin_url("{$url}edit") . "'>" . __('Edit') . "</a>");
     if (isset($item['status']) && !$item['status']) {
         $actions['activate'] = "<a href='" . admin_url("{$url}activate") . "'>" . __('Activate') . "</a>";
     } else {
         $actions['deactivate'] = "<a href='" . admin_url("{$url}deactivate") . "'>" . __('Deactivate') . "</a>";
     }
     $actions['delete'] = "<a href='" . admin_url("{$url}delete") . "'>" . __('Delete') . "</a>";
     if ($item['type'] === 'plugin') {
         $values = kc_get_option($item['prefix']);
         if (false !== $values && !empty($values)) {
             $actions['empty'] = "<span class='trash'><a href='" . wp_nonce_url(admin_url("{$url}empty"), "__kcsb__{$item['id']}") . "' title='" . __('Delete setting value(s) from DB', 'kc-settings') . "'>" . __('Cleanup values', 'kc-settings') . "</a></span>";
         }
     }
     if (!isset($item['status']) || $item['status']) {
         $actions['export'] = "<a href='" . admin_url("{$url}export&amp;type={$item['type']}") . "'>" . __('Export', 'kc-settings') . "</a>";
     }
     return sprintf('%1$s %2$s', $item['id'], $this->row_actions($actions));
 }
Пример #2
0
/**
 * Settings field
 *
 * Generate HTML for settings field
 *
 * @param $args array
 * @return string HTML element
 *
 */
function _kc_field($args)
{
    if (empty($args['field']['attr'])) {
        $args['field']['attr'] = array();
    }
    extract($args, EXTR_OVERWRITE);
    $i_text = kcForm::$i_text;
    $field_types = array_merge($i_text, array('checkbox', 'radio', 'select', 'multiselect', 'multiinput', 'special', 'file', 'media', 'textarea', 'editor'));
    $type = !empty($field['type']) && in_array($field['type'], $field_types) ? $field['type'] : 'input';
    # setup the input id and name attributes, also get the current value from db
    switch ($mode) {
        # 0. Plugin / Theme
        case 'plugin':
            $name = "{$prefix}_settings[{$section}][{$field['id']}]";
            $id = "{$section}__{$field['id']}";
            $db_value = kc_get_option($prefix, $section, $field['id']);
            break;
            # 1. Attachment
        # 1. Attachment
        case 'attachment':
            $id = $field['id'];
            $name = "attachments[{$object_id}][{$id}]";
            $db_value = get_metadata('post', $object_id, "_{$id}", true);
            break;
            # 2. Subfields of multiinput field
        # 2. Subfields of multiinput field
        case 'subfield':
            extract($args['data'], EXTR_OVERWRITE);
            break;
            # 3. Menu item
        # 3. Menu item
        case 'menu_item':
            $id = "edit-menu-item-{$section}-{$field['id']}-{$object_id}";
            $name = "kc-postmeta[{$section}][{$field['id']}][{$object_id}]";
            $key = "_{$field['id']}";
            $db_value = isset($object_id) && $object_id != '' ? get_metadata('post', $object_id, $key, true) : null;
            break;
            # 4. Nav menu
        # 4. Nav menu
        case 'menu_nav':
            $id = "kc-menu_navmeta-{$section}-{$field['id']}";
            $name = "kc-termmeta[{$section}][{$field['id']}]";
            $key = $field['id'];
            $db_value = isset($object_id) && $object_id != '' ? get_metadata('term', $object_id, $key, true) : null;
            break;
            # 5. Others: post, term & user meta
        # 5. Others: post, term & user meta
        default:
            $id = $field['id'];
            $name = "kc-{$mode}meta[{$section}][{$id}]";
            $key = $mode == 'post' ? "_{$id}" : $id;
            $db_value = isset($object_id) && $object_id != '' ? get_metadata($mode, $object_id, $key, true) : null;
            break;
    }
    $desc_tag = isset($desc_tag) ? $desc_tag : 'p';
    $desc_class = $mode == 'attachment' ? 'help' : 'description';
    $desc = isset($field['desc']) && !empty($field['desc']) ? "<{$desc_tag} class='{$desc_class}'>{$field['desc']}</{$desc_tag}>" : null;
    # Let user filter the output of the setting field
    $output = $mode !== 'subfield' ? apply_filters('kc_settings_field_before', '', $section, $field) : '';
    # Special option with callback
    if ($type == 'special') {
        $args['field']['name'] = $name;
        $cb_args = isset($field['args']) ? $field['args'] : '';
        if (!empty($field['args']) && is_callable($field['args'])) {
            $cb_args = call_user_func_array($field['args'], array('args' => $args, 'db_value' => $db_value));
        }
        $output .= call_user_func_array($field['cb'], array('args' => $args, 'db_value' => $db_value, 'cb_args' => $cb_args));
        $output .= $desc;
    } elseif ($type == 'file') {
        $output .= _kc_field_file(array('parent' => $mode === 'post' || $mode === 'menu_item' ? $object_id : 0, 'field' => $field, 'id' => $id, 'name' => $name, 'db_value' => $db_value));
        $output .= "\t{$desc}\n";
    } elseif ($type == 'media') {
        $output .= _kc_field_media(array('parent' => $mode === 'post' || $mode === 'menu_item' ? $object_id : 0, 'field' => $field, 'id' => $id, 'name' => $name, 'db_value' => $db_value));
        $output .= "\t{$desc}\n";
    } elseif ($type == 'multiinput') {
        $field['_id'] = $id;
        $output .= _kc_field_multiinput($name, $db_value, $field);
        $output .= "\t{$desc}\n";
    } else {
        // Attributes
        $field_attr = wp_parse_args($field['attr'], array('name' => $name, 'class' => "kcs-{$type}"));
        if ($type == 'multiselect') {
            $type = 'select';
            $field_attr['multiple'] = 'true';
            $field_attr['name'] .= '[]';
        }
        if ($type == 'checkbox') {
            $field_attr['name'] .= '[]';
        }
        if (!in_array($type, array('checkbox', 'radio'))) {
            $field_attr['id'] = $id;
        }
        if ($mode === 'attachment') {
            $field_attr['id'] = $name;
        }
        if (in_array($type, array_merge($i_text, array('textarea')))) {
            $field_attr['class'] .= ' kcs-input';
            if ($mode == 'menu_item') {
                $field_attr['class'] .= ' widefat';
            }
        }
        $field_args = array('type' => $type, 'attr' => $field_attr, 'current' => $db_value);
        foreach (array('options', 'none', 'editor_settings', 'args') as $key) {
            if (!empty($field[$key])) {
                $field_args[$key] = $field[$key];
            }
        }
        $output .= "\t" . kcForm::field($field_args) . "\n";
        $output .= "\t{$desc}\n";
    }
    # Let user filter the output of the setting field
    if ($mode !== 'subfield') {
        $output = apply_filters('kc_settings_field_after', $output, $section, $field);
    }
    if (isset($args['echo']) && $args['echo'] === true) {
        echo $output;
    } else {
        return $output;
    }
}
Пример #3
0
?>
"><i class="fa fa-facebook"></i></a></li>
              <li><a href="<?php 
echo kc_get_option("social", "social-media-settings", "twitter");
?>
"><i class="fa fa-twitter"></i></a></li>
              <li><a href="<?php 
echo kc_get_option("social", "social-media-settings", "pinterest");
?>
"><i class="fa fa-pinterest"></i></a></li>
              <li><a href="<?php 
echo kc_get_option("social", "social-media-settings", "youtube");
?>
"><i class="fa fa-youtube"></i></a></li>
              <li><a href="<?php 
echo kc_get_option("social", "social-media-settings", "tumblr");
?>
"><i class="fa fa-tumblr"></i></a></li>
            </ul>
          </div>

          <div class="recent_post_wrapper">

            <?php 
$args = array("post_type" => "post", "post_per_page" => 6);
?>
            <?php 
$postlist = get_posts($args);
?>
            <?php 
foreach ($postlist as $post) {
Пример #4
0
?>
"><i class="fa fa-twitter"></i></a>
        <a href="<?php 
echo kc_get_option('social', 'social-media-settings', 'tumblr');
?>
"><i class="fa fa-tumblr"></i></a>
        <a href="<?php 
echo kc_get_option('social', 'social-media-settings', 'youtube');
?>
"><i class="fa fa-youtube"></i></a>
        <a href="<?php 
echo kc_get_option('social', 'social-media-settings', 'pinterest');
?>
"><i class="fa fa-pinterest-p"></i></a>
        <a href="<?php 
echo kc_get_option('social', 'social-media-settings', 'ebay');
?>
"><i><img src="<?php 
echo esc_url(get_stylesheet_directory_uri());
?>
/images/eba.png" alt=""></i></a>
      </div>
    </div>
  </div>
</footer>


<script>
  jQuery(function () {
      
      
Пример #5
0
    /**
     * woocommerce_after_shop_loop hook
     *
     * @hooked woocommerce_pagination - 10
     */
    do_action('woocommerce_after_shop_loop');
    ?>

		<?php 
} elseif (!woocommerce_product_subcategories(array('before' => woocommerce_product_loop_start(false), 'after' => woocommerce_product_loop_end(false)))) {
    ?>

			<div class="row">
				<div class="col-md-10 col-md-offset-1">
					<h4><?php 
    echo kc_get_option('auction-extra-settings', 'auction-settings', 'no-product-message');
    ?>
</h4>
				</div>
			</div>

		<?php 
}
?>

	<?php 
/**
 * woocommerce_after_main_content hook
 *
 * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
 */