Changeset 3148731
- Timestamp:
- 09/09/2024 01:43:35 PM (18 months ago)
- Location:
- dynamictags
- Files:
-
- 66 added
- 10 edited
-
tags/1.4.0 (added)
-
tags/1.4.0/.gitignore (added)
-
tags/1.4.0/Admin (added)
-
tags/1.4.0/Admin/js (added)
-
tags/1.4.0/Admin/js/main.js (added)
-
tags/1.4.0/LICENSE.txt (added)
-
tags/1.4.0/Lib (added)
-
tags/1.4.0/Lib/Activator.php (added)
-
tags/1.4.0/Lib/Deactivator.php (added)
-
tags/1.4.0/Lib/DynamicTags (added)
-
tags/1.4.0/Lib/DynamicTags.php (added)
-
tags/1.4.0/Lib/DynamicTags/AcfRepeater.php (added)
-
tags/1.4.0/Lib/DynamicTags/AreCommentsAllowed.php (added)
-
tags/1.4.0/Lib/DynamicTags/Cookies.php (added)
-
tags/1.4.0/Lib/DynamicTags/CurrentLanguage.php (added)
-
tags/1.4.0/Lib/DynamicTags/CurrentUrl.php (added)
-
tags/1.4.0/Lib/DynamicTags/CurrentUserCan.php (added)
-
tags/1.4.0/Lib/DynamicTags/Is404.php (added)
-
tags/1.4.0/Lib/DynamicTags/IsAuthorOfPost.php (added)
-
tags/1.4.0/Lib/DynamicTags/IsFeed.php (added)
-
tags/1.4.0/Lib/DynamicTags/IsFrontpage.php (added)
-
tags/1.4.0/Lib/DynamicTags/IsHome.php (added)
-
tags/1.4.0/Lib/DynamicTags/IsPostInCategory.php (added)
-
tags/1.4.0/Lib/DynamicTags/IsPostInList.php (added)
-
tags/1.4.0/Lib/DynamicTags/IsSingular.php (added)
-
tags/1.4.0/Lib/DynamicTags/NumberPostsQuery.php (added)
-
tags/1.4.0/Lib/DynamicTags/PodsExtended.php (added)
-
tags/1.4.0/Lib/DynamicTags/PostContent.php (added)
-
tags/1.4.0/Lib/DynamicTags/PostParent.php (added)
-
tags/1.4.0/Lib/DynamicTags/PostStatus.php (added)
-
tags/1.4.0/Lib/DynamicTags/PostType.php (added)
-
tags/1.4.0/Lib/DynamicTags/ServerVars.php (added)
-
tags/1.4.0/Lib/DynamicTags/Session.php (added)
-
tags/1.4.0/Lib/DynamicTags/UserAuthorImageUrl.php (added)
-
tags/1.4.0/Lib/DynamicTags/UserRole.php (added)
-
tags/1.4.0/Lib/DynamicTags/WidgetContent.php (added)
-
tags/1.4.0/Lib/DynamicTags/WooCommerceIsFeatured.php (added)
-
tags/1.4.0/Lib/ElementBase.php (added)
-
tags/1.4.0/Lib/I18n.php (added)
-
tags/1.4.0/Lib/Loader.php (added)
-
tags/1.4.0/Lib/Template.php (added)
-
tags/1.4.0/Lib/index.php (added)
-
tags/1.4.0/README.txt (added)
-
tags/1.4.0/autoload.php (added)
-
tags/1.4.0/composer.json (added)
-
tags/1.4.0/dynamic-tags.php (added)
-
tags/1.4.0/gulpfile.js (added)
-
tags/1.4.0/index.php (added)
-
tags/1.4.0/languages (added)
-
tags/1.4.0/languages/dynamic-tags-de_DE.mo (added)
-
tags/1.4.0/languages/dynamic-tags-de_DE.po (added)
-
tags/1.4.0/languages/dynamic-tags.pot (added)
-
tags/1.4.0/package-lock.json (added)
-
tags/1.4.0/package.json (added)
-
tags/1.4.0/uninstall.php (added)
-
tags/1.4.0/vendor (added)
-
tags/1.4.0/vendor/autoload.php (added)
-
tags/1.4.0/vendor/composer (added)
-
tags/1.4.0/vendor/composer/ClassLoader.php (added)
-
tags/1.4.0/vendor/composer/LICENSE (added)
-
tags/1.4.0/vendor/composer/autoload_classmap.php (added)
-
tags/1.4.0/vendor/composer/autoload_namespaces.php (added)
-
tags/1.4.0/vendor/composer/autoload_psr4.php (added)
-
tags/1.4.0/vendor/composer/autoload_real.php (added)
-
tags/1.4.0/vendor/composer/autoload_static.php (added)
-
tags/1.4.0/vendor/composer/installed.json (added)
-
trunk/Lib/DynamicTags/AcfRepeater.php (modified) (3 diffs)
-
trunk/Lib/DynamicTags/Cookies.php (modified) (2 diffs)
-
trunk/Lib/DynamicTags/PodsExtended.php (modified) (1 diff)
-
trunk/Lib/DynamicTags/PostParent.php (modified) (3 diffs)
-
trunk/Lib/DynamicTags/Session.php (modified) (2 diffs)
-
trunk/Lib/DynamicTags/UserRole.php (modified) (2 diffs)
-
trunk/Lib/DynamicTags/WidgetContent.php (modified) (3 diffs)
-
trunk/Lib/DynamicTags/WooCommerceIsFeatured.php (modified) (1 diff)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/dynamic-tags.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dynamictags/trunk/Lib/DynamicTags/AcfRepeater.php
r3145303 r3148731 59 59 'ids' => 'IDs', 60 60 'urls' => 'Urls', 61 'img' => __( 'Rendered <img>' ),62 'array' => __( 'Array (for use in gallery-widget)' ),61 'img' => __( 'Rendered <img>', 'dynamic-tags' ), 62 'array' => __( 'Array (for use in gallery-widget)', 'dynamic-tags' ), 63 63 ]; 64 64 … … 286 286 } 287 287 288 $has _option_page_location = in_array( $acfGroup['ID'], $optionsPageGroupsIds, true );289 $is _only_options_page = $has_option_page_location && 1 === count( $acfGroup['location'] );288 $hasOptionPageLocation = in_array( $acfGroup['ID'], $optionsPageGroupsIds, true ); 289 $isOnlyOptionsPage = $hasOptionPageLocation && 1 === count( $acfGroup['location'] ); 290 290 291 291 foreach ( $fields as $field ) { … … 303 303 } 304 304 // Use group ID for unique keys 305 if ( $has _option_page_location ) {305 if ( $hasOptionPageLocation ) { 306 306 $key = 'options:' . $field['name']; 307 307 $options[$key] = __( 'Options', 'elementor-pro' ) . ':' . $field['label']; 308 if ( $is _only_options_page ) {308 if ( $isOnlyOptionsPage ) { 309 309 continue; 310 310 } -
dynamictags/trunk/Lib/DynamicTags/Cookies.php
r2509935 r3148731 10 10 use ElementBase; 11 11 12 public function get_name() {12 public function get_name(): string { 13 13 return 'dynamic-tags-cookies'; 14 14 } 15 15 16 public function get_title() {16 public function get_title(): string { 17 17 return __( 'Cookies', 'dynamic-tags' ); 18 18 } 19 19 20 20 21 public function get_group() {21 public function get_group(): array { 22 22 return [ Module::SITE_GROUP ]; 23 23 } 24 24 25 public function get_categories() {25 public function get_categories(): array { 26 26 return [ Module::TEXT_CATEGORY ]; 27 27 } 28 28 29 protected function register_controls() {29 protected function register_controls(): void { 30 30 $this->add_control( 31 31 'CookieName', … … 39 39 ] 40 40 ); 41 42 $this->add_control( 43 'CustomCookieName', 44 [ 45 'label' => __( 'Custom Cookie Name', 'dynamic-tags' ), 46 'type' => Controls_Manager::TEXT, 47 'label_block' => true, 48 'default' => '', 49 ] 50 ); 41 51 } 42 52 43 public function render() {53 public function render(): void { 44 54 $settings = $this->get_settings(); 55 $customKey = $settings['CustomCookieName']; 56 if ( !empty( $customKey ) ) { 57 $value = filter_input( INPUT_COOKIE, $customKey ); 58 echo wp_kses_post( $value ); 59 return; 60 } 61 45 62 $key = $settings['CookieName']; 46 63 $value = filter_input( INPUT_COOKIE, $key ); -
dynamictags/trunk/Lib/DynamicTags/PodsExtended.php
r3145303 r3148731 9 9 use ElementorPro\Modules\DynamicTags\Pods\Tags\Pods_Text; 10 10 11 class PodsExtended extends Pods_Text { 12 use ElementBase; 11 if ( function_exists( 'pods_api' ) ) { 12 class PodsExtended extends Pods_Text { 13 use ElementBase; 13 14 14 public function get_name(): string { 15 return 'dynamic-tags-pods-extended'; 15 public function get_name(): string { 16 return 'dynamic-tags-pods-extended'; 17 } 18 19 public function get_title(): string { 20 return parent::get_title() . ' Extended'; 21 } 22 23 protected function get_supported_fields(): array { 24 $fields = parent::get_supported_fields(); 25 $fields[] = 'boolean'; 26 27 return $fields; 28 } 16 29 } 17 18 19 public function get_title(): string {20 return parent::get_title() . ' Extended';21 }22 23 24 protected function get_supported_fields() {25 $fields = parent::get_supported_fields();26 $fields[] = 'boolean';27 28 return $fields;29 }30 31 30 } -
dynamictags/trunk/Lib/DynamicTags/PostParent.php
r2509935 r3148731 4 4 5 5 use DynamicTags\Lib\ElementBase; 6 use Elementor\Controls_Manager; 6 7 use Elementor\Core\DynamicTags\Tag; 7 8 use ElementorPro\Modules\DynamicTags\Module; … … 14 15 use ElementBase; 15 16 16 public function get_name() {17 public function get_name(): string { 17 18 return 'dynamic-tags-post-parent'; 18 19 } 19 20 20 public function get_title() {21 public function get_title(): string { 21 22 return __( 'Post Parent', 'elementor-pro' ); 22 23 } 23 24 24 public function get_group() {25 public function get_group(): string { 25 26 return Module::POST_GROUP; 26 27 } 27 28 28 public function get_categories() {29 public function get_categories(): array { 29 30 return [ Module::TEXT_CATEGORY ]; 30 31 } 31 32 32 public function render() { 33 protected function register_controls(): void { 34 $this->add_control( 35 'output', 36 [ 37 'label' => __( 'Output', 'dynamic-tags' ), 38 'type' => Controls_Manager::SELECT, 39 'label_block' => true, 40 'default' => 'id', 41 'options' => [ 42 'id' => 'ID', 43 'post_title' => __('Post-Title', 'dynamic-tags'), 44 'post_name' => __('Post-Name', 'dynamic-tags'), 45 ], 46 ] 47 ); 48 } 49 50 public function render(): void { 33 51 $post = get_post(); 34 52 … … 37 55 } 38 56 39 echo $post->post_parent; 57 switch ($this->get_settings('output')) { 58 case 'post_title': 59 echo get_the_title($post->post_parent); 60 break; 61 case 'post_name': 62 $parent = get_post($post->post_parent); 63 echo !empty($parent) ? $parent->post_name : ''; 64 break; 65 case 'id': 66 default: 67 echo $post->post_parent; 68 break; 69 } 70 } 71 72 public function get_panel_template_setting_key(): string { 73 return 'output'; 40 74 } 41 75 } -
dynamictags/trunk/Lib/DynamicTags/Session.php
r2509935 r3148731 10 10 use ElementBase; 11 11 12 public function get_name() {12 public function get_name(): string { 13 13 return 'dynamic-tags-session'; 14 14 } 15 15 16 public function get_title() {16 public function get_title(): string { 17 17 return __( 'Session', 'dynamic-tags' ); 18 18 } 19 19 20 20 21 public function get_group() {21 public function get_group(): array { 22 22 return [ Module::SITE_GROUP ]; 23 23 } 24 24 25 public function get_categories() {25 public function get_categories(): array { 26 26 return [ Module::TEXT_CATEGORY ]; 27 27 } 28 28 29 protected function register_controls() {29 protected function register_controls(): void { 30 30 $this->add_control( 31 31 'SessionKey', … … 37 37 ] 38 38 ); 39 40 $this->add_control( 41 'CustomSessionKey', 42 [ 43 'label' => __( 'Custom Session Key', 'dynamic-tags' ), 44 'type' => Controls_Manager::TEXT, 45 'label_block' => true, 46 'default' => '', 47 ] 48 ); 39 49 } 40 50 41 public function render() {51 public function render(): void { 42 52 $settings = $this->get_settings(); 53 54 $customKey = $settings['CustomSessionKey']; 55 if ( !empty( $customKey ) ) { 56 $value = filter_var( $_SESSION[$customKey] ?? '' ); 57 echo wp_kses_post( $value ); 58 return; 59 } 60 43 61 $key = $settings['SessionKey']; 44 62 if ( empty( $key ) || empty( $_SESSION[$key] ) ) { -
dynamictags/trunk/Lib/DynamicTags/UserRole.php
r3145303 r3148731 58 58 ] 59 59 ); 60 61 $this->add_control( 62 'format', 63 [ 64 'label' => __( 'Format', 'dynamic-tags' ), 65 'type' => Controls_Manager::SELECT, 66 'label_block' => true, 67 'default' => 'plain', 68 'options' => [ 69 'plain' => 'Plain', 70 'human_readable' => 'Human readable', 71 'translated' => 'Translated', 72 ], 73 ] 74 ); 75 76 $this->add_control( 77 'addWrapper', 78 [ 79 'label' => __( 'Add wrapper around items', 'dynamic-tags' ), 80 'type' => Controls_Manager::SWITCHER, 81 'default' => 'no', 82 ] 83 ); 60 84 } 61 85 … … 78 102 $separator = $this->get_settings( 'separator' ) ?? ''; 79 103 $userInfo = get_userdata( $userId ); 80 $userRoles = implode( $separator, $userInfo->roles ); 104 105 106 switch ($this->get_settings('format')) { 107 case 'human_readable': 108 global $wp_roles; 109 $roles = $wp_roles->get_names(); 110 $rolesArray = []; 111 foreach ($userInfo->roles as $role) { 112 $rolesArray[] = $roles[$role]; 113 } 114 break; 115 case 'translated': 116 global $wp_roles; 117 $roles = $wp_roles->get_names(); 118 $rolesArray = []; 119 foreach ($userInfo->roles as $role) { 120 $rolesArray[] = translate_user_role($roles[$role]); 121 } 122 123 break; 124 case 'plain': 125 default: 126 $rolesArray = $userInfo->roles; 127 break; 128 } 129 130 if ($this->get_settings('addWrapper') === 'yes') { 131 foreach ($rolesArray as &$role) { 132 $role = '<span class="user-role">' . $role . '</span>'; 133 } 134 } 135 136 $userRoles = implode( $separator, $rolesArray ); 137 81 138 echo $userRoles; 82 139 } 83 140 141 public function get_panel_template_setting_key(): string { 142 return 'key'; 143 } 84 144 } -
dynamictags/trunk/Lib/DynamicTags/WidgetContent.php
r3145303 r3148731 52 52 53 53 $postList = []; 54 foreach ( $allPosts as $post) {55 $postList[$post->ID] = ( $post->post_title ?? $post->post_name) . " ($post->ID)";54 foreach ( $allPosts as $post ) { 55 $postList[$post->ID] = ( $post->post_title ?? $post->post_name ) . " ($post->ID)"; 56 56 } 57 57 … … 64 64 'options' => $postList, 65 65 'default' => '', 66 'render_type' => 'ui' 66 'render_type' => 'ui', 67 67 ] 68 68 ); 69 $this->add_control( 'post-id',70 [71 'label' => __( 'Post ID' ),72 'type' => Controls_Manager::TEXT,73 'label_block' => false,74 'default' => '',75 ]69 $this->add_control( 'post-id', 70 [ 71 'label' => __( 'Post ID', 'dynamic-tags' ), 72 'type' => Controls_Manager::TEXT, 73 'label_block' => false, 74 'default' => '', 75 ] 76 76 ); 77 77 $this->add_control( 78 78 'dynamic-tags-widget-id-select', 79 79 [ 80 'label' => __( 'Widget' ),80 'label' => __( 'Widget', 'dynamic-tags' ), 81 81 'type' => Controls_Manager::SELECT, 82 82 'label_block' => false, 83 83 'options' => [], 84 84 'default' => '', 85 'render_type' => 'ui' 85 'render_type' => 'ui', 86 86 ] 87 87 ); … … 89 89 'widget-id', 90 90 [ 91 'label' => __( 'Widget ID' ),91 'label' => __( 'Widget ID', 'dynamic-tags' ), 92 92 'type' => Controls_Manager::TEXT, 93 93 'label_block' => false, -
dynamictags/trunk/Lib/DynamicTags/WooCommerceIsFeatured.php
r2509935 r3148731 10 10 use ElementBase; 11 11 12 public function get_name() {12 public function get_name(): string { 13 13 return 'dynamic-tags-woocommerce-visibility'; 14 14 } 15 15 16 public function get_title() {16 public function get_title(): string { 17 17 return __( 'WooCommerce is a featured product', 'dynamic-tags' ); 18 18 } 19 19 20 public function get_categories() {20 public function get_categories(): array { 21 21 return [ Module::TEXT_CATEGORY ]; 22 22 } 23 23 24 protected function register_controls() {24 protected function register_controls(): void { 25 25 26 26 } 27 27 28 public function get_group() {28 public function get_group(): array { 29 29 if ( !class_exists( 'WooCommerce' ) ) { 30 return '';30 return []; 31 31 } 32 32 return [ Module::POST_GROUP ]; 33 33 } 34 34 35 public function render() {35 public function render(): void { 36 36 if ( !function_exists( 'wc_get_product' ) ) { 37 37 return; 38 38 } 39 $product = wc_get_product(); 40 echo $product->is_featured(); 39 $post = get_post(); 40 $product = wc_get_product( $post ); 41 if ( !empty( $product ) ) { 42 echo $product->is_featured(); 43 } 41 44 } 42 45 } -
dynamictags/trunk/README.txt
r3145303 r3148731 5 5 Requires at least: 5.0 6 6 Tested up to: 6.6 7 Stable tag: 1. 3.07 Stable tag: 1.4.0 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 54 54 55 55 == Changelog == 56 = 1.4.0 = 57 * Add singular/plural for post-types 58 * Add human-readable and translated for user-roles 59 * Add wrapper-option for user-role 60 * Fix possible error with woocommerce is-featured 61 * Post-Parent can now return title and name 62 56 63 = 1.3.0 = 57 64 * Add acf-repeater tag -
dynamictags/trunk/dynamic-tags.php
r3145303 r3148731 12 12 * Plugin URI: https://github.com/RTO-Websites/dynamic-tags/ 13 13 * Description: Dynamic Tags is an Elementor addon that adds some useful dynamic tags. 14 * Version: 1. 3.014 * Version: 1.4.0 15 15 * Author: RTO GmbH 16 16 * Author URI: https://www.rto.de … … 26 26 } 27 27 28 define( 'DynamicTags_VERSION', '1. 3.0' );28 define( 'DynamicTags_VERSION', '1.4.0' ); 29 29 30 30 define( 'DynamicTags_DIR', str_replace( '\\', '/', __DIR__ ) );
Note: See TracChangeset
for help on using the changeset viewer.