Plugin Directory

Changeset 2390989


Ignore:
Timestamp:
09/30/2020 02:18:28 PM (5 years ago)
Author:
hqtheme
Message:

Filesystem class added in library

Location:
hqtheme-extra
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • hqtheme-extra/tags/1.0.2/hqtheme-extra.php

    r2387736 r2390989  
    55 * Plugin URI:        https://hqtheme.net/hqtheme/?utm_source=wp-admin&utm_medium=link&utm_campaign=default&utm_term=hqtheme-extra&utm_content=plugin-uri
    66 * Description:       HQTheme Extra adds extras for HQTheme - Ready sites one click import
    7  * Version:           1.0.1
     7 * Version:           1.0.2
    88 * Requires at least: 5.3
    99 * Requires PHP:      7.2
     
    5757 * @var string
    5858 */
    59 const VERSION = '1.0.1';
     59const VERSION = '1.0.2';
    6060
    6161// Load Autoloader
  • hqtheme-extra/tags/1.0.2/inc/demos/import-log.php

    r2387081 r2390989  
    5050        // Get user credentials for WP file-system API.
    5151        $import = wp_nonce_url(admin_url('themes.php?page=hqtheme-ready-sites'), 'hqt-import');
    52         $creds = request_filesystem_credentials($import, '', false, false, null);
     52        $creds = \request_filesystem_credentials($import, '', false, false, null);
    5353        if (false === $creds) {
    5454            return;
  • hqtheme-extra/tags/1.0.2/inc/dependencies.php

    r2387736 r2390989  
    6969                        $install_url = wp_nonce_url(self_admin_url('update.php?action=install-theme&theme=' . $theme_wordpress_repo_slug), 'install-theme_' . $theme_wordpress_repo_slug);
    7070                        $message = '<h3>' . $required_recommended . ' Theme - HQTheme</h3>'
    71                                 . '<p>' . sprintf(_x('<b>%s</b> works best with <b>%s</b>. That\'s why we recommed <a href="%s" target="_blank">%s</a>. <br>Learn more about HQTheme <a href="%s" target="_blank" >here</a>.', 'theme dependency', 'hqtheme-enhancer-pro'), $this->currnet_plugin_name, 'HQTheme', $theme_details_link, 'HQTheme', $theme_details_link) . '</p>';
    72                         $message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s %s</a>', $install_url, _x('Install', 'theme dependency', 'hqtheme-enhancer-pro'), 'HQTheme') . '</p>';
     71                                . '<p>' . sprintf(_x('<b>%s</b> works best with <b>%s</b>. That\'s why we recommed <a href="%s" target="_blank">%s</a>. <br>Learn more about HQTheme <a href="%s" target="_blank" >here</a>.', 'theme dependency', 'hqtheme-extra'), $this->currnet_plugin_name, 'HQTheme', $theme_details_link, 'HQTheme', $theme_details_link) . '</p>';
     72                        $message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s %s</a>', $install_url, _x('Install', 'theme dependency', 'hqtheme-extra'), 'HQTheme') . '</p>';
    7373                        Admin_Notifications::instance()->add_notice('theme-install', 'info', $message, $allow_dismis);
    7474                    }
  • hqtheme-extra/tags/1.0.2/inc/hqlib/field/base.php

    r2387736 r2390989  
    262262            $data = \HQLib\hq_get_option($field_id, '', $this->default_value, 'theme_mods', false);
    263263        } else if ('post_meta' === $storage) {
    264             $data = \HQLib\get_post_meta($field_id, '', $this->default_value, false);
     264            $post_id = get_the_ID();
     265            $data = \HQLib\get_post_meta($post_id, $field_id, '', $this->default_value, false);
    265266        } else if ('tax_meta' === $storage) {
    266267            $term_id = isset($_REQUEST['tag_ID']) ? sanitize_key($_REQUEST['tag_ID']) : false;
  • hqtheme-extra/tags/1.0.2/inc/hqlib/helper.php

    r2387081 r2390989  
    206206            foreach ($terms as $term) {
    207207                $result[] = [
    208                     'value' => $term->slug,
     208                    'value' => $term->term_id,
    209209                    'label' => $term->name,
    210210                ];
  • hqtheme-extra/tags/1.0.2/inc/hqlib/hqlib.php

    r2387736 r2390989  
    120120 * @return any
    121121 */
    122 function get_post_meta($key = null, $group = null, $default = false, $add_prefix = true) {
    123     global $post;
    124 
    125     if (!$post->ID) {
    126         return $default;
     122function get_post_meta($post_id = null, $key = null, $group = null, $default = false, $add_prefix = true) {
     123    if (!$post_id) {
     124        global $post;
     125
     126        if (!$post->ID) {
     127            return $default;
     128        }
     129        $post_id = $post->ID;
    127130    }
    128131
    129132    if ($group) {
    130133        $group = \HQLib\HQLIB_PREFIX . $group;
    131         $options = \get_post_meta($post->ID, $group, false);
     134        $options = \get_post_meta($post_id, $group, false);
    132135        if (empty($key)) {
    133136            return $options;
     
    137140            $key = empty($key) ? '' : \HQLib\HQLIB_PREFIX . $key;
    138141        }
    139         return \get_post_meta($post->ID, $key, true);
     142        return \get_post_meta($post_id, $key, true);
    140143    }
    141144
     
    182185
    183186/**
     187 * Get terms objects list
     188 *
     189 * @param  [type]  $taxonomy
     190 * @param  boolean $child_of_current
     191 * @return [type]
     192 */
     193function get_terms_objects($taxonomy = null, $child_of_current = false, $custom_args = array()) {
     194
     195    if (!$taxonomy) {
     196        return array();
     197    }
     198
     199    if (!is_array($custom_args)) {
     200        $custom_args = array();
     201    }
     202
     203    $args = array_merge(array('taxonomy' => $taxonomy), $custom_args);
     204
     205    if ($child_of_current && is_tax($taxonomy)) {
     206        $args['child_of'] = get_queried_object_id();
     207    }
     208
     209    return \get_terms($args);
     210}
     211
     212/**
     213 * Get terms of passed taxonomy for options list
     214 *
     215 * @param  [type]  $taxonomy
     216 * @param  boolean $child_of_current
     217 * @return [type]
     218 */
     219function get_terms_for_options($taxonomy = null, $child_of_current = false, $custom_args = array()) {
     220
     221    $terms = \HQLib\get_terms_objects($taxonomy, $child_of_current, $custom_args);
     222    return wp_list_pluck($terms, 'name', 'term_id');
     223}
     224
     225/**
    184226 * Get global option
    185227 * @param string $key
  • hqtheme-extra/tags/1.0.2/inc/hqlib/utils.php

    r2387081 r2390989  
    8080        }
    8181
    82         return apply_filters('hqt/utils/get_public_post_types', $posts);
     82        return apply_filters('hqt/utils/get_public_posts', $posts);
    8383    }
    8484
  • hqtheme-extra/tags/1.0.2/readme.txt

    r2387736 r2390989  
    55Tested up to: 5.5
    66Requires PHP: 7.2
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GPL v2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414HQTheme Extra adds extra features to HQTheme and our plugins. For now it adds one click demo import for HQTheme. Our common library used by all our products is also part of HQTheme Extra.  In future versions more features will be added.
    15 Learn more on our website: [HQTheme.net](https://hqtheme.net)
     15Learn more on our website: [HQTheme.net](https://hqtheme.net?utm_source=wporg&utm_medium=link&utm_campaign=default&utm_term=extra&utm_content=description)
    1616
    1717
     
    5252* Initial Public Release!
    5353
    54 = 1.0.0 - 2020-09-24 =
     54= 1.0.1 - 2020-09-24 =
    5555* Group options for terms and meta
    5656* Remove theme recommendation
     57
     58= 1.0.2- 2020-09-30 =
     59* Filesystem class added in library
     60* get_terms_objects and get_terms_for_options added in library
  • hqtheme-extra/trunk/hqtheme-extra.php

    r2387736 r2390989  
    55 * Plugin URI:        https://hqtheme.net/hqtheme/?utm_source=wp-admin&utm_medium=link&utm_campaign=default&utm_term=hqtheme-extra&utm_content=plugin-uri
    66 * Description:       HQTheme Extra adds extras for HQTheme - Ready sites one click import
    7  * Version:           1.0.1
     7 * Version:           1.0.2
    88 * Requires at least: 5.3
    99 * Requires PHP:      7.2
     
    5757 * @var string
    5858 */
    59 const VERSION = '1.0.1';
     59const VERSION = '1.0.2';
    6060
    6161// Load Autoloader
  • hqtheme-extra/trunk/inc/demos/import-log.php

    r2387081 r2390989  
    5050        // Get user credentials for WP file-system API.
    5151        $import = wp_nonce_url(admin_url('themes.php?page=hqtheme-ready-sites'), 'hqt-import');
    52         $creds = request_filesystem_credentials($import, '', false, false, null);
     52        $creds = \request_filesystem_credentials($import, '', false, false, null);
    5353        if (false === $creds) {
    5454            return;
  • hqtheme-extra/trunk/inc/dependencies.php

    r2387736 r2390989  
    6969                        $install_url = wp_nonce_url(self_admin_url('update.php?action=install-theme&theme=' . $theme_wordpress_repo_slug), 'install-theme_' . $theme_wordpress_repo_slug);
    7070                        $message = '<h3>' . $required_recommended . ' Theme - HQTheme</h3>'
    71                                 . '<p>' . sprintf(_x('<b>%s</b> works best with <b>%s</b>. That\'s why we recommed <a href="%s" target="_blank">%s</a>. <br>Learn more about HQTheme <a href="%s" target="_blank" >here</a>.', 'theme dependency', 'hqtheme-enhancer-pro'), $this->currnet_plugin_name, 'HQTheme', $theme_details_link, 'HQTheme', $theme_details_link) . '</p>';
    72                         $message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s %s</a>', $install_url, _x('Install', 'theme dependency', 'hqtheme-enhancer-pro'), 'HQTheme') . '</p>';
     71                                . '<p>' . sprintf(_x('<b>%s</b> works best with <b>%s</b>. That\'s why we recommed <a href="%s" target="_blank">%s</a>. <br>Learn more about HQTheme <a href="%s" target="_blank" >here</a>.', 'theme dependency', 'hqtheme-extra'), $this->currnet_plugin_name, 'HQTheme', $theme_details_link, 'HQTheme', $theme_details_link) . '</p>';
     72                        $message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s %s</a>', $install_url, _x('Install', 'theme dependency', 'hqtheme-extra'), 'HQTheme') . '</p>';
    7373                        Admin_Notifications::instance()->add_notice('theme-install', 'info', $message, $allow_dismis);
    7474                    }
  • hqtheme-extra/trunk/inc/hqlib/field/base.php

    r2387736 r2390989  
    262262            $data = \HQLib\hq_get_option($field_id, '', $this->default_value, 'theme_mods', false);
    263263        } else if ('post_meta' === $storage) {
    264             $data = \HQLib\get_post_meta($field_id, '', $this->default_value, false);
     264            $post_id = get_the_ID();
     265            $data = \HQLib\get_post_meta($post_id, $field_id, '', $this->default_value, false);
    265266        } else if ('tax_meta' === $storage) {
    266267            $term_id = isset($_REQUEST['tag_ID']) ? sanitize_key($_REQUEST['tag_ID']) : false;
  • hqtheme-extra/trunk/inc/hqlib/helper.php

    r2387081 r2390989  
    206206            foreach ($terms as $term) {
    207207                $result[] = [
    208                     'value' => $term->slug,
     208                    'value' => $term->term_id,
    209209                    'label' => $term->name,
    210210                ];
  • hqtheme-extra/trunk/inc/hqlib/hqlib.php

    r2387736 r2390989  
    120120 * @return any
    121121 */
    122 function get_post_meta($key = null, $group = null, $default = false, $add_prefix = true) {
    123     global $post;
    124 
    125     if (!$post->ID) {
    126         return $default;
     122function get_post_meta($post_id = null, $key = null, $group = null, $default = false, $add_prefix = true) {
     123    if (!$post_id) {
     124        global $post;
     125
     126        if (!$post->ID) {
     127            return $default;
     128        }
     129        $post_id = $post->ID;
    127130    }
    128131
    129132    if ($group) {
    130133        $group = \HQLib\HQLIB_PREFIX . $group;
    131         $options = \get_post_meta($post->ID, $group, false);
     134        $options = \get_post_meta($post_id, $group, false);
    132135        if (empty($key)) {
    133136            return $options;
     
    137140            $key = empty($key) ? '' : \HQLib\HQLIB_PREFIX . $key;
    138141        }
    139         return \get_post_meta($post->ID, $key, true);
     142        return \get_post_meta($post_id, $key, true);
    140143    }
    141144
     
    182185
    183186/**
     187 * Get terms objects list
     188 *
     189 * @param  [type]  $taxonomy
     190 * @param  boolean $child_of_current
     191 * @return [type]
     192 */
     193function get_terms_objects($taxonomy = null, $child_of_current = false, $custom_args = array()) {
     194
     195    if (!$taxonomy) {
     196        return array();
     197    }
     198
     199    if (!is_array($custom_args)) {
     200        $custom_args = array();
     201    }
     202
     203    $args = array_merge(array('taxonomy' => $taxonomy), $custom_args);
     204
     205    if ($child_of_current && is_tax($taxonomy)) {
     206        $args['child_of'] = get_queried_object_id();
     207    }
     208
     209    return \get_terms($args);
     210}
     211
     212/**
     213 * Get terms of passed taxonomy for options list
     214 *
     215 * @param  [type]  $taxonomy
     216 * @param  boolean $child_of_current
     217 * @return [type]
     218 */
     219function get_terms_for_options($taxonomy = null, $child_of_current = false, $custom_args = array()) {
     220
     221    $terms = \HQLib\get_terms_objects($taxonomy, $child_of_current, $custom_args);
     222    return wp_list_pluck($terms, 'name', 'term_id');
     223}
     224
     225/**
    184226 * Get global option
    185227 * @param string $key
  • hqtheme-extra/trunk/inc/hqlib/utils.php

    r2387081 r2390989  
    8080        }
    8181
    82         return apply_filters('hqt/utils/get_public_post_types', $posts);
     82        return apply_filters('hqt/utils/get_public_posts', $posts);
    8383    }
    8484
  • hqtheme-extra/trunk/readme.txt

    r2387736 r2390989  
    55Tested up to: 5.5
    66Requires PHP: 7.2
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GPL v2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414HQTheme Extra adds extra features to HQTheme and our plugins. For now it adds one click demo import for HQTheme. Our common library used by all our products is also part of HQTheme Extra.  In future versions more features will be added.
    15 Learn more on our website: [HQTheme.net](https://hqtheme.net)
     15Learn more on our website: [HQTheme.net](https://hqtheme.net?utm_source=wporg&utm_medium=link&utm_campaign=default&utm_term=extra&utm_content=description)
    1616
    1717
     
    5252* Initial Public Release!
    5353
    54 = 1.0.0 - 2020-09-24 =
     54= 1.0.1 - 2020-09-24 =
    5555* Group options for terms and meta
    5656* Remove theme recommendation
     57
     58= 1.0.2- 2020-09-30 =
     59* Filesystem class added in library
     60* get_terms_objects and get_terms_for_options added in library
Note: See TracChangeset for help on using the changeset viewer.