Plugin Directory

Changeset 2767123


Ignore:
Timestamp:
08/06/2022 04:09:09 AM (4 years ago)
Author:
ThemeFarmer
Message:

v 1.3.3

Location:
themefarmer-companion/trunk
Files:
12 added
3 edited

Legend:

Unmodified
Added
Removed
  • themefarmer-companion/trunk/inc/functions.php

    r2016334 r2767123  
    55    <div class="themefarmer-basic-icon-panel-overlay" style="display: none;">
    66        <div class="themefarmer-basic-icon-panel">
    7             <button type="button" class="media-modal-close"><span class="media-modal-icon">x<span class="screen-reader-text"><?php esc_html_e('Close media panel', 'themefarmer-companion'); ?></span></span></button>
     7            <button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php esc_html_e('Close media panel', 'themefarmer-companion'); ?></span></span></button>
    88            <div class="tf-icon-panel-title"><?php esc_html_e('Select Icon', 'themefarmer-companion'); ?></div>
    99            <div class="tf-icon-search-bar"><input type="search" id="tf-search-menu-icon" placeholder="<?php esc_html_e('Search Icon'); ?>"></div>
  • themefarmer-companion/trunk/readme.txt

    r2442002 r2767123  
    33Tags: ThemeFarmer Companion, ThemeFarmer, Slider, Testimonial, Team
    44Requires at least: 4.0
    5 Tested up to: 5.6
     5Tested up to: 6.0
    66Stable tag: trunk
    77Requires PHP: 5.4
  • themefarmer-companion/trunk/themefarmer-companion.php

    r2442002 r2767123  
    66Author URI: https://www.themefarmer.com/
    77Domain Path: /lang/
    8 Version: 1.3.2
     8Version: 1.3.3
    99Text Domain: themefarmer-companion
    1010
     
    3030define('THEMEFARMER_COMPANION_DIR', plugin_dir_path(__FILE__));
    3131define('THEMEFARMER_COMPANION_URI', plugin_dir_url(__FILE__));
    32 define('THEMEFARMER_COMPANION_VAR', '1.3.2');
     32define('THEMEFARMER_COMPANION_VAR', '1.3.3');
    3333
    3434function themefarmer_companion_init() {
     
    3838add_action('plugins_loaded', 'themefarmer_companion_init');
    3939
    40 function themefarmer_is_this_themefarmer_theme(){
    41     $theme = wp_get_theme();
     40function themefarmer_is_this_themefarmer_theme() {
     41    $theme     = wp_get_theme();
    4242    $tf_themes = array(
    4343        'Scope',
     
    5151}
    5252
    53 function themefarmer_is_this_themefarmer_theme2(){
    54     $theme = wp_get_theme();
     53function themefarmer_is_this_themefarmer_theme2() {
     54    $theme     = wp_get_theme();
    5555    $tf_themes = array(
    5656        'NewStore',
     
    8383}
    8484
    85 
    86 
    87 function themefarmer_companion_loader() {   
     85$theme = wp_get_theme();
     86if ($theme->name === 'StoreZ' || $theme->parent_theme === 'StoreZ') {
     87    if (!class_exists('ThemeFarmer_Load_Fields')) {
     88        require_once trailingslashit(THEMEFARMER_COMPANION_DIR) . 'fields/fields-init.php';
     89    }
     90    require_once trailingslashit(THEMEFARMER_COMPANION_DIR) . 'theme-files/storez-functions.php';
     91    require_once trailingslashit(THEMEFARMER_COMPANION_DIR) . 'inc/class-themefarmer-menu-icon-walker.php';
     92    if (class_exists('WooCommerce')) {
     93        require_once trailingslashit(THEMEFARMER_COMPANION_DIR) . 'inc/class-themefarmer-wc-widget-products.php';
     94    }
     95}
     96
     97function themefarmer_companion_loader() {
    8898    require_once trailingslashit(THEMEFARMER_COMPANION_DIR) . 'inc/functions.php';
    8999}
     
    106116    }
    107117
     118    if ($theme->name === 'StoreZ' || $theme->parent_theme === 'StoreZ') {
     119        define('THEMEFARMER_COMPANION_PRO_LINK', 'https://themefarmer.com/product/storez-pro/');
     120    }
     121
    108122}
    109123add_action('init', 'themefarmer_theme_releted_func_init');
     
    114128    }
    115129}
    116 
    117130
    118131function themefarmer_companion_front_scripts() {
     
    124137add_action('wp_enqueue_scripts', 'themefarmer_companion_front_scripts');
    125138
    126 
     139function themefarmer_companion_storez_activation() {
     140    $imgsDir = trailingslashit(THEMEFARMER_COMPANION_DIR) . 'theme-files/demos/storez/images/';
     141
     142    $uploadImgs = array(
     143        $imgsDir . 'logo.png',
     144        $imgsDir . 'banner1.jpg',
     145        $imgsDir . 'banner2.jpg',
     146        $imgsDir . 'banner3.jpg',
     147        $imgsDir . 'slide1-left-img.jpg',
     148        $imgsDir . 'slide2-left-img.jpg',
     149        $imgsDir . 'slide3-left-img.jpg',
     150    );
     151
     152    $parent_id = null;
     153    foreach ($uploadImgs as $imgUp) {
     154        $filename    = basename($imgUp);
     155        $upload_file = wp_upload_bits($filename, null, file_get_contents($imgUp));
     156        if (!$upload_file['error']) {
     157            $wp_filetype = wp_check_filetype($filename, null);
     158            $attachment  = array(
     159                'post_mime_type' => $wp_filetype['type'],
     160                'post_parent'    => $parent_id,
     161                'post_title'     => preg_replace('/\.[^.]+$/', '', $filename),
     162                'post_excerpt'   => '',
     163                'post_status'    => 'inherit',
     164            );
     165            $ImageId[] = $attachment_id = wp_insert_attachment($attachment, $upload_file['file'], $parent_id);
     166
     167            if (!is_wp_error($attachment_id)) {
     168                require_once ABSPATH . "wp-admin" . '/includes/image.php';
     169                $attachment_data = wp_generate_attachment_metadata($attachment_id, $upload_file['file']);
     170                wp_update_attachment_metadata($attachment_id, $attachment_data);
     171            }
     172        }
     173
     174    }
     175    update_option('storez_media_upload_ids', $ImageId);
     176}
    127177
    128178function themefarmer_companion_activation() {
    129     if (themefarmer_is_this_themefarmer_theme() || themefarmer_is_this_themefarmer_theme2()) {
     179    $theme = wp_get_theme();
     180    if (themefarmer_is_this_themefarmer_theme() || themefarmer_is_this_themefarmer_theme2() || $theme->name === 'StoreZ' || $theme->parent_theme === 'StoreZ') {
    130181
    131182        $front_page = get_option('show_on_front');
     
    166217    }
    167218
    168     if(themefarmer_is_this_themefarmer_theme2()){
    169         $page_home    = get_page_by_path('home');
    170         if (absint( $page_home ) > 0) {
    171             update_post_meta( $page_home, '_wp_page_template', 'templates/frontpage.php' );
     219    if (themefarmer_is_this_themefarmer_theme2() || $theme->name === 'StoreZ' || $theme->parent_theme === 'StoreZ') {
     220        $page_home = get_page_by_path('home');
     221        if (!empty($page_home) && absint($page_home->ID) > 0) {
     222            update_post_meta($page_home->ID, '_wp_page_template', 'templates/frontpage.php');
    172223        }
    173224    }
    174225
     226    if ($theme->name === 'StoreZ' || $theme->parent_theme === 'StoreZ') {
     227        themefarmer_companion_storez_activation();
     228    }
     229
    175230    flush_rewrite_rules();
    176231}
Note: See TracChangeset for help on using the changeset viewer.