core = Ai_Robot::get_instance(); $this->generate_nonce(); } /** * Combine Data and pass to JS * * @since 1.0.0 * @return array */ public function get_options_data() { $data = $this->admin_js_defaults(); $data = apply_filters( 'ai_robot_data', $data ); return $data; } /** * Generate nonce * * @since 1.0.0 */ public function generate_nonce() { $this->_nonce = wp_create_nonce( 'ai-robot' ); } /** * Get current generated nonce * * @since 1.0.0 * @return string */ public function get_nonce() { return $this->_nonce; } /** * Return published pages * * @since 1.8 * * @return mixed */ public function get_pages() { $args = array( 'sort_order' => 'DESC', 'sort_column' => 'ID', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'child_of' => 0, 'parent' => -1, 'exclude_tree' => '', 'number' => '', 'offset' => 0, 'post_type' => 'page', 'post_status' => 'publish' ); $pages = get_pages($args); return $pages; } /** * Default Admin properties * * @since 1.0.0 * @return array */ public function admin_js_defaults() { return array( 'ajaxurl' => ai_robot_ajax_url(), '_ajax_nonce' => $this->get_nonce(), 'wizard_url' => admin_url( 'admin.php?page=ai-robot-campaign-wizard' ), 'integrations_url' => admin_url( 'admin.php?page=ai-robot-integrations' ), 'campaigns_url' => admin_url( 'admin.php?page=ai-robot-campaign' ) ); } } endif;