function cjtheme_insert_question() { global $wpdb; $errors = null; parse_str($_POST['data'], $postdata); if ($postdata['question'] == '') { $errors[] = __('Please enter some content to ask.', 'cjtheme'); } if ($postdata['category'] == '') { $errors[] = __('You must select a category for this question.', 'cjtheme'); } if (!is_null($errors)) { $return['errors'] = cjtheme_show_message('error', implode('<br>', $errors)); } else { // $post_title = cjtheme_trim_text($postdata['question'], '60'); $post_title = $postdata['question']; $question_data = array('post_title' => $post_title, 'post_name' => sanitize_title($post_title), 'post_content' => esc_textarea($postdata['question']), 'post_type' => 'questions', 'post_status' => 'publish'); $post_id = wp_insert_post($question_data); wp_set_post_terms($post_id, $postdata['category'], 'qna_type'); //$return['success'] = $postdata['current_url'].'#question-'.$post_id; $return['success'] = get_permalink($post_id); } echo json_encode($return); die; }
function cjtheme_price_finder_get_price() { global $wpdb; $api_url = cjtheme_get_option('api_url'); parse_str($_POST['formdata'], $formdata); $api_url = $api_url . 'get-price/' . $formdata['brands'] . '/' . $formdata['models']; $data = wp_remote_get($api_url); $data = json_decode($data['body']); if (!$data->error) { $display[] = '<div class="table-responsive">'; $display[] = '<table class="table table-striped table-hover">'; $display[] = '<thead>'; $display[] = '<tr>'; $display[] = '<th width="200px">Variant Name</th>'; $display[] = '<th width="200px" class="textcenter">Fuel</th>'; $display[] = '<th width="200px" class="textcenter">Delhi</th>'; $display[] = '<th width="200px" class="textcenter">Mumbai</th>'; $display[] = '<th width="200px" class="textcenter">Chennai</th>'; $display[] = '<th width="200px" class="textcenter">Bangolore</th>'; $display[] = '<th width="200px" class="textcenter">Chandigarh</th>'; $display[] = '</tr>'; $display[] = '</thead>'; $display[] = '<tbody>'; foreach ($data->models as $key => $value) { foreach ($value as $key => $ovalue) { $delhipric = $ovalue->delhipric > 0 ? '₹ ' . cjtheme_inr($ovalue->delhipric) : '--'; $mumpric = $ovalue->mumpric > 0 ? '₹ ' . cjtheme_inr($ovalue->mumpric) : '--'; $chennaipric = $ovalue->chennaipric > 0 ? '₹ ' . cjtheme_inr($ovalue->chennaipric) : '--'; $bangalorepric = $ovalue->bangalorepric > 0 ? '₹ ' . cjtheme_inr($ovalue->bangalorepric) : '--'; $chdpric = $ovalue->chdpric > 0 ? '₹ ' . cjtheme_inr($ovalue->chdpric) : '--'; $display[] = '<tr>'; $display[] = '<td width="200px">' . $ovalue->name . '</td>'; $display[] = '<td width="200px" class="textcenter">' . $ovalue->type . '</td>'; $display[] = '<td width="200px" class="textcenter">' . $delhipric . '</td>'; $display[] = '<td width="200px" class="textcenter">' . $mumpric . '</td>'; $display[] = '<td width="200px" class="textcenter">' . $chennaipric . '</td>'; $display[] = '<td width="200px" class="textcenter">' . $bangalorepric . '</td>'; $display[] = '<td width="200px" class="textcenter">' . $chdpric . '</td>'; $display[] = '</tr>'; } } $display[] = '</tbody>'; $display[] = '</table>'; $display[] = '</div>'; } else { $display[] = cjtheme_show_message('warning', 'No data found.'); } echo implode('', $display); die; }
<?php if (is_single()) { ?> <div class="single-gap"></div> <?php } ?> </div><!-- /.questions-extra-buttons --> <?php } else { ?> <div> <?php echo cjtheme_show_message('warning', '<i>No questions found.</i>'); ?> </div> <?php } ?> </div><!-- /.questions-loop --> </div><!-- /.section-content --> </section><!-- /#latest-questions --> </div> </div><!-- /.row --> </div><!-- /.container-fluid --> </div><!-- /#content --> <?php get_footer();
<?php /** * @package CSSJockey WordPress Framework * @author Mohit Aneja (cssjockey.com) * @version FW-20150208 */ $help_support_value[] = '<a href="' . cjtheme_item_info('quick_start_guide_url') . '" target="_blank">' . __('Quick Start Guide', 'cjtheme') . '</a>'; $help_support_value[] = '<a href="' . cjtheme_item_info('documentation_url') . '" target="_blank">' . __('Documentation', 'cjtheme') . '</a>'; $help_support_value[] = '<a href="' . cjtheme_item_info('support_forum_url') . '" target="_blank">' . __('Support Fourm', 'cjtheme') . '</a>'; if (isset($_REQUEST['cjmsg']) && $_REQUEST['cjmsg'] == 'pc-no-match') { echo cjtheme_show_message('error', sprintf(__('Could not reset your license for this installation. <br><a target="_blank" href="%s">Click here</a> to create a support ticket.', 'cjtheme'), cjtheme_item_info('support_forum_url'))); } $cjtheme_purchase_code = ''; $eon = sha1('cjtheme_verify_epc' . site_url()); $eov = get_option($eon); if ($eov != '') { $cjtheme_purchase_code = array('type' => 'info', 'id' => 'cjtheme_purchase_code', 'label' => __('Purchase code', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => '<span class="btn btn-success btn-sm" style=" margin-right: 10px;"><i class="fa fa-check-circle"></i> ' . __('Verified & Active', 'cjtheme') . '</span>' . sprintf('<a href="%s" class="btn btn-danger btn-sm cj-confirm" data-confirm="%s">Reset License</a>', cjtheme_string(cjtheme_callback_url('core_welcome')) . 'cjtheme_action=reset-license', __("Are you sure?\nThis will reset your license for this installation.\nYou may use this license again on any installation.", 'cjtheme')), 'options' => ''); } else { $cjtheme_purchase_code = array('type' => 'info', 'id' => 'cjtheme_purchase_code', 'label' => __('Purchase code', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => '<span class="label label-danger" style="padding:5px 10px; font-size:14px; font-weight:normal;"><i class="fa fa-times-circle"></i> ' . __('Not Verified', 'cjtheme') . '</span>', 'options' => ''); } if (cjtheme_is_local()) { $cjtheme_purchase_code = array('type' => 'info', 'id' => 'cjtheme_purchase_code', 'label' => __('Purchase code', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => '<span class="label label-default" style="padding:5px 10px; font-size:14px; font-weight:normal;"><i class="fa fa-info-circle"></i> ' . __('Local Server', 'cjtheme') . '</span><span class="margin-10-left italic red">' . __('You will be asked to validate your purchase code to use this product on live server.', 'cjtheme') . '</span>', 'options' => ''); } if (cjtheme_item_info('item_id') == 'NA') { $cjtheme_purchase_code = null; $contribute = null; } else { $contribute = array('type' => 'info', 'id' => 'contribute', 'label' => __('Contribute', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => sprintf(__('<p>You can contribute to support further development and new features for this product.</p> <p><a target="_blank" class="btn btn-danger" href="%s">Contribute</a></p>', 'cjtheme'), 'http://cssjockey.com/contribute'), 'options' => ''); } $localization_string = sprintf(__('You can download <a class="bold" target="_blank" href="%s">Loco Translate WordPress Plugin (FREE)</a> to easily create language files within your WordPress dashboard without using Poedit software.', 'cjtheme'), 'https://wordpress.org/plugins/loco-translate/');
<?php global $cjtheme_item_vars; /** * @package CSSJockey WordPress Framework * @author Mohit Aneja (cssjockey.com) * @version FW-20150208 */ if (!isset($cjtheme_item_vars['localize_variables'])) { echo '<div class="margin-25-top margin-15-right">'; echo cjtheme_show_message('error', __('Dropdown key language strings not found in item_setup.php. Specify an array $cjtheme_item_vars["localize_variables"]', 'cjtheme')); echo '</div>'; die; } ?> <div class="wrap"> <h2><?php echo sprintf(__('%s Settings', 'cjtheme'), ucwords(cjtheme_item_info('item_name'))); ?> </h2> <nav class="cjtheme-dropdown clearfix"> <ul> <li class="home"><a href="<?php echo cjtheme_callback_url('core_welcome'); ?> " title=""><i class="fa fa-home"></i></a> <ul> <!-- <li><a href="<?php echo cjtheme_callback_url('core_maintenance_mode');
<?php global $wp_roles; $menu_locations = get_registered_nav_menus(); $saved_menus = cjtheme_navigation_menus(); $roles = $wp_roles->role_names; $roles['non-user'] = __('Visitor', 'cjtheme'); $cjtheme_role_menus = cjtheme_get_option('cjtheme_role_menus'); if (isset($_POST['cjtheme_save_menus'])) { cjtheme_update_option('cjtheme_role_menus', $_POST['data']); $location = cjtheme_string(cjtheme_callback_url()) . 'msg=saved'; wp_safe_redirect($location); exit; } if (isset($_GET['msg']) && $_GET['msg'] == 'saved') { echo cjtheme_show_message('success', __('Menu options saved successfully.', 'cjtheme')); } ?> <form action="" method="post"> <table width="100%" cellpadding="0" cellspacing="0"> <thead> <tr> <th colspan="3"><h2 class="main-heading"><?php _e('Role Based Menus', 'cjtheme'); ?> </h2></th> </tr> <tr> <td width="15%"><?php _e('User Role', 'cjtheme'); ?>
$cjtheme_upgrade_errors[] = __('Envato API Key is required.', 'cjtheme'); } elseif ($_POST['cjtheme_envato_purchase_code'] == '') { $cjtheme_upgrade_errors[] = __('Envato Item Purchase Code is required.', 'cjtheme'); } else { $url = 'http://marketplace.envato.com/api/v3/cssjockey/c2u03ax2x2iwd6hbxfxt1ixmn5sqi74w/verify-purchase:' . $_POST['cjtheme_envato_purchase_code'] . '.json'; $response = wp_remote_get($url); if (is_wp_error($response)) { $cjtheme_upgrade_errors[] = $response->get_error_message(); } else { $response = json_decode($response['body']); foreach ($response as $key => $value) { if (!isset($value->item_id)) { $cjtheme_upgrade_errors[] = __('Could not verify purchase, please try again.', 'cjtheme'); } else { update_option('cjtheme_envato_item_id', $value->item_id); } } } } if (!is_null($cjtheme_upgrade_errors)) { echo cjtheme_show_message('error', implode('<br>', $cjtheme_upgrade_errors)); } else { update_option('cjtheme_envato_username', $_POST['cjtheme_envato_username']); update_option('cjtheme_envato_api_key', $_POST['cjtheme_envato_api_key']); update_option('cjtheme_envato_purchase_code', $_POST['cjtheme_envato_purchase_code']); } } $cjtheme_form_options['envato_api_info'] = array(array('type' => 'sub-heading', 'id' => 'envato_info_heading', 'label' => '', 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => sprintf(__('%s ~ Verify Purchase', 'cjtheme'), cjtheme_item_info('item_name')), 'options' => ''), array('type' => 'text', 'id' => 'cjtheme_envato_username', 'label' => __('Envato Username', 'cjtheme'), 'info' => __('Specify your envato username here', 'cjtheme'), 'suffix' => '', 'prefix' => '', 'default' => get_option('cjtheme_envato_username'), 'options' => ''), array('type' => 'text', 'id' => 'cjtheme_envato_api_key', 'label' => __('Envato API Key', 'cjtheme'), 'info' => __('Specify your envato API Key here.<br>You can create or get your API Key from Envato Profile >> Settings >> API Keys.', 'cjtheme'), 'suffix' => '', 'prefix' => '', 'default' => get_option('cjtheme_envato_api_key'), 'options' => ''), array('type' => 'text', 'id' => 'cjtheme_envato_purchase_code', 'label' => __('Purchase Code', 'cjtheme'), 'info' => __('Enter your item purchase code here.<br>You can download your purchase from Envato Profile >> Downloads Page', 'cjtheme'), 'suffix' => '', 'prefix' => '', 'default' => get_option('cjtheme_envato_purchase_code'), 'options' => ''), array('type' => 'submit', 'id' => 'save_envato_info', 'label' => __('Verify Purchase', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => '', 'options' => '')); echo '<form action="" method="post">'; cjtheme_admin_form_raw($cjtheme_form_options['envato_api_info']); echo '</form>';