_code; } public function getType() { return $this->_type; } public function getSubtype() { return $this->_subtype; } public function getName() { return $this->_name; } public function getDesc() { return $this->_desc; } public function getSettings() { return $this->_settings; } public function getSublabel() { return $this->_sublabel; } public function getOrder() { return $this->_order; } public function getVariables() { return $this->_variables; } public function getResults( $t, $v, $s = 0 ) { return $this->_results; } public function setBlock( $block ) { $this->_block = $block; $this->_id = $block ? WaicUtils::getArrayValue($block, 'id', 0, 1) : 0; } public function getId() { return $this->_id; } public function getParams() { if (is_null($this->_params)) { $this->_params = $this->_block ? WaicUtils::getArrayValue(WaicUtils::getArrayValue($this->_block, 'data', array(), 2), 'settings', array(), 2) : array(); } return $this->_params; } public function getParam( $key, $def = '', $typ = 0 ) { $params = $this->getParams(); return WaicUtils::getArrayValue($this->getParams(), $key, $def, $typ); } public function replaceVariables( $str, $variables ) { preg_match_all('/\{\{(.*?)\}\}/', $str, $matches); if (empty($matches[1])) { return $str; } foreach ($matches[1] as $var) { $replace = false; $parts = explode('.', $var); if (count($parts) == 2) { $node = $parts[0];// . '#' . $step; $variable = $parts[1]; if (isset($variables[$node]) && isset($variables[$node][$variable])) { $replace = $variables[$node][$variable]; if (is_array($replace)) { $replace = implode(',', $replace); } } } $str = str_replace('{{' . $var . '}}', $replace, $str); } return $str; } public function controlIdsArray( $ids ) { if (!empty($ids) && is_array($ids)) { foreach ($ids as $k => $id) { $ids[$k] = (int) $id; } } return $ids; } public function getDTVariables() { if (empty($this->_dtVars)) { $this->_dtVars = array( 'date' => __('Date', 'ai-copilot-content-generator'), 'time' => __('Time', 'ai-copilot-content-generator'), ); } return $this->_dtVars; } public function getPostVariables() { if (empty($this->_postVars)) { $this->_postVars = array( 'post_ID' => __('Post ID', 'ai-copilot-content-generator'), 'post_title' => __('Post Title', 'ai-copilot-content-generator'), 'post_status' => __('Post Status', 'ai-copilot-content-generator'), 'post_content' => __('Post Content', 'ai-copilot-content-generator'), 'post_excerpt' => __('Post Excerpt', 'ai-copilot-content-generator'), 'post_categories' => __('Post Categories', 'ai-copilot-content-generator'), 'post_tags' => __('Post Tags', 'ai-copilot-content-generator'), 'post_date' => __('Post Date', 'ai-copilot-content-generator'), 'post_modified' => __('Post Modified', 'ai-copilot-content-generator'), 'post_meta' => __('Post Meta Keys *', 'ai-copilot-content-generator'), ); } return $this->_postVars; } public function getUserVariables() { if (empty($this->_userVars)) { $this->_userVars = array( 'user_ID' => __('User ID', 'ai-copilot-content-generator'), 'user_login' => __('User Login', 'ai-copilot-content-generator'), 'user_email' => __('User Email', 'ai-copilot-content-generator'), 'user_url' => __('User Url', 'ai-copilot-content-generator'), 'user_nicename' => __('User Nicename', 'ai-copilot-content-generator'), 'display_name' => __('Display Name', 'ai-copilot-content-generator'), 'user_registered' => __('User Registered', 'ai-copilot-content-generator'), 'user_roles' => __('User Roles', 'ai-copilot-content-generator'), 'user_caps' => __('User Сapabilities', 'ai-copilot-content-generator'), 'user_meta' => __('User Meta Keys *', 'ai-copilot-content-generator'), ); } return $this->_userVars; } public function getOrderVariables() { if (empty($this->_orderVars)) { $this->_orderVars = array( 'order_ID' => __('Order ID', 'ai-copilot-content-generator'), 'order_status' => __('Order Status', 'ai-copilot-content-generator'), 'order_currency' => __('Order Currency', 'ai-copilot-content-generator'), 'order_total' => __('Order Total', 'ai-copilot-content-generator'), 'order_subtotal' => __('Order Subtotal', 'ai-copilot-content-generator'), 'order_discount_total' => __('Order Discount Total', 'ai-copilot-content-generator'), 'order_shipping_total' => __('Order Shipping Total', 'ai-copilot-content-generator'), 'order_item_count' => __('Item Count', 'ai-copilot-content-generator'), 'order_products' => __('Order Products (ids)', 'ai-copilot-content-generator'), 'order_categories' => __('Order Categories (ids)', 'ai-copilot-content-generator'), 'order_tags' => __('Order Tags (ids)', 'ai-copilot-content-generator'), 'order_shipping_method' => __('Shipping Method', 'ai-copilot-content-generator'), 'order_payment_method' => __('Order Payment Method', 'ai-copilot-content-generator'), 'order_date_created' => __('Order Date Created', 'ai-copilot-content-generator'), 'order_date_paid' => __('Order Date Paid', 'ai-copilot-content-generator'), 'order_date_completed' => __('Order Date Completed', 'ai-copilot-content-generator'), 'customer_id' => __('Customer ID', 'ai-copilot-content-generator'), 'billing_email' => __('Billing Email', 'ai-copilot-content-generator'), 'billing_first_name' => __('Billing First Name', 'ai-copilot-content-generator'), 'billing_last_name' => __('Billing Last Name', 'ai-copilot-content-generator'), ); } return $this->_orderVars; } }