/** * Register and enqueue scripts and stylesheets */ function ppm_scripts() { wp_enqueue_style('bootstrap-style', get_template_directory_uri() . '/assets/css/bootstrap.min.css'); wp_enqueue_style('font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.min.css'); wp_enqueue_style('fancybox', get_template_directory_uri() . '/assets/css/jquery.fancybox.css'); wp_enqueue_style('print', get_template_directory_uri() . '/assets/css/print.css', '', '', 'print'); wp_enqueue_style('styles', get_template_directory_uri() . '/assets/css/styles.css'); wp_enqueue_script('bootstrap-script', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array('jquery'), false, true); wp_enqueue_script('jquery-mask', get_template_directory_uri() . '/assets/js/jquery.mask.min.js', array('jquery'), false, true); wp_enqueue_script('jquery-fancybox', get_template_directory_uri() . '/assets/js/jquery.fancybox.pack.js', array('jquery'), false, true); wp_enqueue_script('jquery.cycle2', get_template_directory_uri() . '/assets/js/jquery.cycle2.min.js', array('jquery'), false, true); wp_enqueue_script('jquery.cycle2.carousel', get_template_directory_uri() . '/assets/js/jquery.cycle2.carousel.min.js', array('jquery'), false, true); wp_enqueue_script('scripts', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), false, true); $creation_choices = get_field_object('field_5626c03dc0803'); $production_choices = get_field_object('field_5626d2f421b80'); $distribution_choices = get_field_object('field_5626d33421b81'); $clean_choices = []; foreach ($creation_choices['choices'] as $choice) { array_push($clean_choices, create_slug($choice)); } foreach ($production_choices['choices'] as $choice) { array_push($clean_choices, create_slug($choice)); } foreach ($distribution_choices['choices'] as $choice) { array_push($clean_choices, create_slug($choice)); } $creation_choices = $clean_choices; $ppm_settings = array('templatePath' => get_bloginfo('template_url'), 'creationChoices' => $creation_choices); wp_localize_script('scripts', 'ppmSettings', $ppm_settings); }
/** * Create a new Profile */ public function create() { if ($this->input->post()) { //helpers $stream = $this->input->post('stream_identifier'); $slug_profile = create_slug($this->input->post('profile_name')); $fieldlist = $this->get_stream_fields_list($stream); //we create a Pre helper file and an Post helper file for the new profile. //In the pre helper, we have a specific function for each field of the stream. write_file($this->helpers_dir . '/' . strtolower($slug_profile) . '_pre_helper.php', '<?php ' . $this->load->view('templates/pre_process', array('fields' => $fieldlist, 'slug_profile' => $slug_profile), true) . "\n?>"); $stream_obj = $this->streams->stream_obj($stream); write_file($this->helpers_dir . '/' . strtolower($slug_profile) . '_post_helper.php', '<?php ' . $this->load->view('templates/post_process', array('stream_obj' => $stream_obj, 'slug_profile' => $slug_profile), true) . "\n?>"); } // Get stream $stream = $this->streams->stream_obj($this->stream_slug, $this->namespace); $data->fields = $this->streams_m->get_stream_fields($stream->id); //we get the list of all the Streams existing in this Pyro Instance $data->stream_dropdown = $this->get_stream_dropdown_list(); // Processing the POST data $extra = array('title' => lang($this->namespace . ':title:' . $this->section . ':create'), 'success_message' => lang($this->namespace . ':messages:' . $this->section . ':create:success'), 'failure_message' => lang($this->namespace . ':messages:' . $this->section . ':create:error'), 'return' => 'admin/' . $this->namespace . '/' . $this->section . '/create_profile_step2/-id-'); // Skip these for now, this will be in step 2 $skip = array('xml_path_loop'); $this->streams->cp->entry_form($this->section, $this->namespace, 'new', null, false, $extra, $skip); // Build the template $this->template->set('page_title', lang($this->namespace . ':title:' . $this->section . ':create'))->build('admin/profiles/create', $data); }
public function add() { $post = $this->input->post(); if ($post) { #pr($post); $this->load->library('form_validation'); $this->form_validation->set_rules('cat_name', 'Category Name', 'trim|required|is_unique[category_master.cat_name]'); $this->form_validation->set_rules('cat_title', 'Category Description', 'trim|required'); if ($_FILES['cat_image']['error'] > 0) { $this->form_validation->set_rules('cat_image', 'Category Image', 'required'); } if ($_FILES['cat_image']['error'] == 0) { $config['overwrite'] = TRUE; $config['upload_path'] = DOC_ROOT_CATEGORY_IMG; $config['allowed_types'] = 'gif|jpg|png|bmp|jpeg'; $img_arr = explode('.', $_FILES['cat_image']['name']); $img_arr = array_reverse($img_arr); $config['file_name'] = $post['cat_image'] = time() . "_img." . $img_arr[0]; $this->load->library('upload', $config); if (!$this->upload->do_upload("cat_image")) { //$error['cat_image'] = $this->upload->display_errors(); $this->form_validation->set_rules('cat_image', 'Category Image', 'required'); } } if ($this->form_validation->run() !== false) { $data = array('cat_name' => $post['cat_name'], 'cat_slug' => create_slug($post['cat_name']), 'cat_title' => $post['cat_title'], 'cat_image' => $post['cat_image'], 'cat_active' => isset($post['cat_active']) ? 1 : 0, 'cat_created_date' => date('Y-m-d H:i:s'), 'cat_modified_date' => date('Y-m-d H:i:s'), 'cat_parent' => 0); $ret = $this->common_model->insertData(CATEGORY, $data); if ($ret > 0) { $ret = $this->common_model->addCategoryOrder($ret); $flash_arr = array('flash_type' => 'success', 'flash_msg' => 'Category added successfully.'); } else { $flash_arr = array('flash_type' => 'error', 'flash_msg' => 'An error occurred while processing.'); } $this->session->set_flashdata($flash_arr); redirect("admin/category"); } $data['error_msg'] = validation_errors(); } $data['view'] = "index"; $data['id'] = ''; $data['categories'] = $this->common_model->getCategoryArray(); $data['action'] = "add"; $data['order'] = json_decode(getSetting("cat_order", true), true); $this->load->view('admin/content', $data); }
/** * Validate changes to this locotype * @since Version 3.8.7 * @return true * @throws \Exception if $this->arrangement is empty */ public function validate() { if (empty($this->name)) { throw new Exception("Cannot validate changes to this loco type: name cannot be empty"); return false; } if (empty($this->slug)) { $proposal = create_slug($this->name); $proposal = substr($proposal, 0, 30); $query = "SELECT id FROM loco_type WHERE slug = ?"; $result = $this->db->fetchAll($query, $proposal); if (count($result)) { $proposal = $proposal . count($result); } $this->slug = $proposal; $this->url = sprintf("%s/type/%s", $this->Module->url, $this->slug); } return true; }
function get_potd() { $api_key = get_option('apod_api_key'); $default_status = get_option('apod_default_status'); $post_as = get_option('apod_post_as'); $response = wp_remote_get('https://api.data.gov/nasa/planetary/apod?api_key=' . $api_key . '&format=JSON'); $body = json_decode($response['body']); if (is_null($post_as) or $post_as == "") { $user_id = get_user_by('login', $post_as); } else { $user_id = '1'; } if (!is_numeric($user_id)) { $user_id = '1'; } $pGUID = 'apod-' . $body->date; if (getIDfromGUID($pGUID) > 0) { return; } $post_data = array('post_content' => $body->explanation, 'post_title' => $body->title, 'post_name' => create_slug($body->title), 'post_excerpt' => $body->explanation, 'post_status' => $default_status, 'post_author' => $user_id, 'guid' => $pGUID); $post_id = wp_insert_post($post_data); //insert the post, return the new post_id $imgGet = wp_remote_get($body->url); //grab our image $imgType = wp_remote_retrieve_header($imgGet, 'content-type'); //get our image type $imgMirror = wp_upload_bits(rawurldecode(basename($body->url)), '', wp_remote_retrieve_body($imgGet)); //upload image to wordpress $attachment = array('post_title' => preg_replace('/\\.[^.]+$/', '', basename($body->url)), 'post_mime_type' => $imgType, 'post_content' => '', 'post_status' => 'inherit', 'guid' => basename($body->url), 'post_author' => $user_id, 'post_type' => 'attachment'); require_once ABSPATH . 'wp-admin/includes/image.php'; $attach_id = wp_insert_attachment($attachment, $imgMirror['url'], $post_id); //insert the attachment and get the ID $attach_data = wp_generate_attachment_metadata($attach_id, $imgMirror['file']); //generate the meta-data for the image wp_update_attachment_metadata($attach_id, $attach_data); //update the images meta-data set_post_thumbnail($post_id, $attach_id); //set the image as featured for the new post }
public function update($data, $id) { $titles = strip_tags($this->clean($data['food_title'])); $ta = array(); $et = explode(" ", $titles); foreach ($et as $t) { if ($t != '') { array_push($ta, $t); } } $ft = join(" ", $ta); $f = join(" ", $ta); $arr = array(); $arr['title'] = $ft; //strip_tags($this->clean($data['title'])); $arr['description'] = $this->clean(htmlentities($data['food_description'])); $arr['recipe'] = strip_tags($data['food_recipe']); //$this->clean(strip_tags($data['food_recipe'])); $arr['category_ids'] = ''; //$this->clean($cids); $arr['price_single'] = isset($data['price_single']) && $data['price_single'] != '' ? $this->clean($data['price_single']) : 0.0; //price single $arr['price_discounted'] = isset($data['price_discounted']) && $data['price_discounted'] != '' ? $this->clean($data['price_discounted']) : 0.0; //price discounted $arr['price_bulk'] = isset($data['price_bulk']) && $data['price_bulk'] != '' ? $this->clean($data['price_bulk']) : 0.0; //price bulk $arr['template'] = $this->clean($data['food_template']); $arr['slug'] = create_slug($f); $arr['status'] = isset($data['food_status']) ? $this->clean($data['food_status']) : 0; $sql = $this->updates('food', $arr, 'food_id=' . $this->clean($id)); $query = $this->query($sql); if ($query) { return true; } else { return false; } }
} } else { echo "ERROR - Could not retrieve ID from the wp_posts table\n"; die; } // Delete current post meta data $stmt = $conn->prepare($deleteMetadataQuery); $stmt->bind_param("i", $id); $stmt->execute(); // Delete current post data $stmt = $conn->prepare($deletePostQuery); $stmt->bind_param("i", $id); $stmt->execute(); // Insert new post data $stmt = $conn->prepare($insertPostQuery); $stmt->bind_param("isssssssssssssssisissi", $authorId, $today, $todayGmt, $data[KEY_DESCRIPTION], $data[KEY_TITLE], $empty, $a = "publish", $b = "open", $c = "open", $empty, create_slug($data[KEY_TITLE]), $empty, $empty, $today, $todayGmt, $empty, $zero, $d = "http://www.tabletopdine.com/dev/?post_type=wg_merchant&p=" . $id, $zero, $e = "wg_merchant", $empty, $zero); $stmt->execute(); // Insert new post data for revision row $stmt = $conn->prepare($insertPostQuery); $stmt->bind_param("isssssssssssssssisissi", $authorId, $today, $todayGmt, $empty, $data[KEY_TITLE], $empty, $a = "inherit", $b = "open", $c = "open", $empty, $d = $id . "-revision-v1", $empty, $empty, $today, $todayGmt, $empty, $id, $e = "http://www.tabletopdine.com/dev/" . $id . "-revision-v-1", $zero, $f = "revision", $empty, $zero); $stmt->execute(); // Insert new post meta data $stmt = $conn->prepare($insertMetadataQuery); $stmt->bind_param("isiiisisisisisisisisisisis", $id, $data[KEY_EDIT_LOCK], $id, $data[KEY_EDIT_LAST], $id, $data[KEY_CONTACT_NAME], $id, $data[KEY_CONTACT_TITLE], $id, $data[KEY_CONTACT_STREET], $id, $data[KEY_CONTACT_CITY], $id, $data[KEY_CONTACT_STATE], $id, $data[KEY_CONTACT_POSTAL_CODE], $id, $data[KEY_CONTACT_COUNTRY], $id, $data[KEY_CONTACT_PHONE], $id, $data[KEY_WEBSITE], $id, $data[KEY_FACEBOOK] != null && is_string($data[KEY_FACEBOOK]) && strlen($data[KEY_FACEBOOK]) > 0 ? $data[KEY_FACEBOOK] : $facebook, $id, $data[KEY_TWITTER] != null && is_string($data[KEY_TWITTER]) && strlen($data[KEY_TWITTER]) > 0 ? $data[KEY_TWITTER] : $twitter); $stmt->execute(); // $stmt = $conn->prepare($thumbnailMetadataQuery); // $stmt->bind_param("isis", // $id, $data[KEY_WP_ATTACHED_FILE], // $id, $data[KEY_WP_ATTACHMENT_METADATA] // ); // $stmt->execute();
function upload_featured_image_from_url($post_id, $product_Arr) { // Add Featured Image to Post $image_url = $product_Arr->master_image->url; // Define the image URL here $upload_dir = wp_upload_dir(); // Set upload folder $image_data = file_get_contents($image_url); // Get image data $filename = basename($image_url); // Create image file name $info = pathinfo($filename); $ext = $info['extension']; $name = create_slug($product_Arr->name); $new_filename = 'square-' . $name . '.' . $ext; // Check folder permission and define file location if (wp_mkdir_p($upload_dir['path'])) { $file = $upload_dir['path'] . '/' . $new_filename; } else { $file = $upload_dir['basedir'] . '/' . $new_filename; } // Create the image file on the server file_put_contents($file, $image_data); // Check image file type $wp_filetype = wp_check_filetype($filename, null); // Set attachment data $attachment = array('post_mime_type' => $wp_filetype['type'], 'post_title' => sanitize_file_name($filename), 'post_content' => '', 'post_status' => 'inherit'); // Create the attachment $attach_id = wp_insert_attachment($attachment, $file, $post_id); // Include image.php require_once ABSPATH . 'wp-admin/includes/image.php'; // Define attachment metadata $attach_data = wp_generate_attachment_metadata($attach_id, $file); // Assign metadata to attachment wp_update_attachment_metadata($attach_id, $attach_data); // And finally assign featured image to post set_post_thumbnail($post_id, $attach_id); }
} } else { echo "ERROR - Could not retrieve ID from the wp_posts table\n"; die; } // Delete current post meta data $stmt = $conn->prepare($deleteMetadataQuery); $stmt->bind_param("i", $id); $stmt->execute(); // Delete current post data $stmt = $conn->prepare($deletePostQuery); $stmt->bind_param("i", $id); $stmt->execute(); // Insert new post data $stmt = $conn->prepare($insertPostQuery); $stmt->bind_param("isssssssssssssssisissi", $authorId, $today, $todayGmt, $data[KEY_DESCRIPTION] != null && is_string($data[KEY_DESCRIPTION]) && strlen($data[KEY_DESCRIPTION]) > 0 ? $data[KEY_DESCRIPTION] : $description, $data[KEY_TITLE], $empty, $a = "publish", $b = "open", $c = "open", $empty, create_slug($data[KEY_TITLE]), $empty, $empty, $today, $todayGmt, $empty, $zero, $d = "http://www.tabletopdine.com/dev/?post_type=wg_merchant&p=" . $id, $zero, $e = "wg_deal", $empty, $zero); $stmt->execute(); // Insert new post data for revision row $stmt = $conn->prepare($insertPostQuery); $stmt->bind_param("isssssssssssssssisissi", $authorId, $today, $todayGmt, $empty, $data[KEY_TITLE], $empty, $a = "inherit", $b = "open", $c = "open", $empty, $d = $id . "-revision-v1", $empty, $empty, $today, $todayGmt, $empty, $id, $e = "http://www.tabletopdine.com/dev/" . $id . "-revision-v-1", $zero, $f = "revision", $empty, $zero); $stmt->execute(); // Insert Image data for event $stmt = $conn->prepare($insertPostQuery); $stmt->bind_param("isssssssssssssssisissi", $authorId, $today, $todayGmt, $hash, $hash, $empty, $a = "inherit", $b = "open", $c = "open", $empty, $hash, $empty, $empty, $today, $todayGmt, $empty, $id, $d = "http://stuffpoint.com/food/image/235785-food-fast-food-combo.png", $zero, $e = "attachment", $f = "image/png", $zero); $stmt->execute(); // // Insert new post meta data $stmt = $conn->prepare($insertMetadataQuery); $stmt->bind_param("isididiiiiiiididisisisisisisiiisiiiiisisisisisisisisisisisisisis", $id, $data[KEY_EXPIRATION_DATE] != null && is_string($data[KEY_EXPIRATION_DATE]) && !empty($data[KEY_EXPIRATION_DATE]) ? $data[KEY_EXPIRATION_DATE] : $expiration, $id, $data[KEY_BASE_PRICE] != null && is_numeric($data[KEY_BASE_PRICE]) && $data[KEY_BASE_PRICE] > 0 ? $data[KEY_BASE_PRICE] : $zero, $id, $data[KEY_DYNAMIC_PRICE] != null && is_numeric($data[KEY_DYNAMIC_PRICE]) && $data[KEY_DYNAMIC_PRICE] > 0 ? $data[KEY_DYNAMIC_PRICE] : $zero, $id, $data[KEY_MIN_PURCHASES] != null && is_numeric($data[KEY_MIN_PURCHASES]) && $data[KEY_MIN_PURCHASES] > 0 ? $data[KEY_MIN_PURCHASES] : $one, $id, $data[KEY_MAX_PURCHASES] != null && is_numeric($data[KEY_MAX_PURCHASES]) && $data[KEY_MAX_PURCHASES] > 0 ? $data[KEY_MAX_PURCHASES] : $hundred, $id, $data[KEY_MAX_PURCHASES_PER_USER] != null && is_numeric($data[KEY_MAX_PURCHASES_PER_USER]) && $data[KEY_MAX_PURCHASES_PER_USER] > 0 ? $data[KEY_MAX_PURCHASES_PER_USER] : $one, $id, $data[KEY_VALUE] != null && is_numeric($data[KEY_VALUE]) && $data[KEY_VALUE] > 0 ? $data[KEY_VALUE] : $zero, $id, $data[KEY_AMOUNT_SAVED] != null && is_numeric($data[KEY_VALUE]) && $data[KEY_AMOUNT_SAVED] > 0 ? $data[KEY_VALUE] : $zero, $id, $data[KEY_HIGHLIGHTS] != null && is_string($data[KEY_HIGHLIGHTS]) && !empty($data[KEY_HIGHLIGHTS]) ? $data[KEY_HIGHLIGHTS] : $highlight, $id, $data[KEY_FINE_PRINT] != null && is_string($data[KEY_FINE_PRINT]) && !empty($data[KEY_FINE_PRINT]) ? $data[KEY_FINE_PRINT] : $finePrint, $id, $data[KEY_VOUCHER_EXPIRATION_DATE] != null && is_string($data[KEY_VOUCHER_EXPIRATION_DATE]) && !empty($data[KEY_VOUCHER_EXPIRATION_DATE]) ? $data[KEY_VOUCHER_EXPIRATION_DATE] : $expiration, $id, $data[KEY_VOUCHER_HOW_TO_USE], $id, $data[KEY_VOUCHER_MAP], $id, $data[KEY_VOUCHER_SERIAL_NUMBER] != null && is_string($data[KEY_VOUCHER_SERIAL_NUMBER]) && !empty($data[KEY_VOUCHER_SERIAL_NUMBER]) ? $data[KEY_VOUCHER_SERIAL_NUMBER] : $hash, $id, $data[KEY_MERCHANT_ID] != null && is_string($data[KEY_MERCHANT_ID]) && !empty($data[KEY_MERCHANT_ID]) ? $data[KEY_MERCHANT_ID] : $merchantId, $id, $data[KEY_VOUCHER_LOCATIONS], $id, $thumbId, $id, $zero, $id, $data[KEY_EDIT_LOCK], $id, $data[KEY_EDIT_LAST], $id, $data[KEY_REDIRECT_URL], $id, $data[KEY_TAXABLE], $id, $taxRate, $id, $data[KEY_SHIPPING], $id, $shippingMode, $id, $shippingDynPrice, $id, $data[KEY_RSS_EXCERPT], $id, $data[KEY_VOUCHER_ID_PREFIX], $id, $data[KEY_VOUCHER_LOGO], $id, $data[KEY_CAPTURE_BEFORE_EXPIRATION], $id, $data[KEY_PREVIEW_PRIVATE_KEY], $id, $data[KEY_FEATURED_CONTENT]); $stmt->execute(); // $stmt = $conn->prepare($thumbnailQuery); // $stmt->bind_param("isis",
?> secondary" title="<?php echo $pos2; ?> " /> <?php if ($pos2 == 'Defensa Central') { ?> <img src="<?php echo get_template_directory_uri(); ?> /img/pos_secondary.png" alt="<?php echo $pos2; ?> " class="<?php echo create_slug($pos2 . '2'); ?> secondary" title="<?php echo $pos2; ?> " /> <?php } ?> <?php } ?> <div class="player-positions-titles">
/** * Add Category * * @param array $data An array of data. * @uses format_uri * @return mixed Id on success. */ public function add_category($data) { if (isset($data['cat_uri']) && $data['cat_uri'] != '') { $data['cat_uri'] = create_slug($data['cat_uri']); } else { $data['cat_uri'] = create_slug($data['cat_name']); } if (isset($data['cat_parent']) && $data['cat_parent'] > 0) { $uri = $this->_get_cat_path($data['cat_parent']); $data['cat_uri'] = implode('/', $uri) . '/' . $data['cat_uri']; } $data['cat_uri'] = $this->_check_uri($data['cat_uri']); $this->db->insert('categories', $data); if ($this->db->affected_rows() == 0) { return FALSE; } $cat_id = $this->db->insert_id(); $this->events->trigger('categories_model/add_category', $cat_id); $this->cache->delete_all('categories_model'); return $cat_id; }
echo $mynl_newsletter[$i]['screenshot']; ?> " alt=""></a></div> <?php } else { ?> <img style="width:79px;" src="<?php echo base_url(); ?> assets/img/authornewsletter.png" alt=""></a></div> <?php } ?> <div class="review_detail"> <a class="name" href="<?php echo site_url('newsletter/specific') . "/" . create_slug($mynl_newsletter[$i]['newsletter_name'], 100) . "/" . $mynl_newsletter[$i]['newsletter_id']; ?> "><?php echo $mynl_newsletter[$i]['newsletter_name']; ?> </a><br/> <label style="color:#808080; float:left;"><?php echo _clang(AUTHOR_MK); ?> </label><span style="float: left; width: 315px;"><?php echo $mynl_newsletter[$i]['author_name']; ?> </span> <?php $get_rate = $this->newsletter_model->get_rate_by_user($mynl_newsletter[$i]['newsletter_id']); include "rating/rating_calculation.php";
/** * Create a URL slug * @since Version 3.8.7 */ private function createSlug() { $proposal = substr(create_slug($this->title), 0, 60); $result = $this->db->fetchAll("SELECT id FROM event WHERE slug = ?", $proposal); if (count($result)) { $proposal .= count($result); } $this->slug = $proposal; $this->commit(); }
include_once ABSPATH . WPINC . '/feed.php'; $termstring = $s; $dilarang = array("+-amazon"); $rss = fetch_feed('http://www.bing.com/search?q=' . urlencode($termstring) . '+"php"&go=&form=QBLH&filt=all&format=rss'); if (!is_wp_error($rss)) { // Checks that the object is created correctly $maxitems = $rss->get_item_quantity(3); $rss_items = $rss->get_items(0, $maxitems); } if ($maxitems == 0) { echo ''; } else { // Loop through each feed item and display each item as a hyperlink. foreach ($rss_items as $item) { $title = '' . htmlspecialchars(BannedKeyword(hilangkan_karakter($item->get_title()))) . ''; $title_arr = explode(" ", $title); $first_word = $title_arr[0]; $post_slug = create_slug($title); $permalinks = get_bloginfo("url") . "/" . strtolower($first_word) . "/" . $post_slug . ".pdf"; echo htmlspecialchars(BannedKeyword(hilangkan_karakter($item->get_title()))); ?> <?php echo strtolower(htmlspecialchars(BannedKeyword(hilangkan_karakter($item->get_content())))); ?> . <?php } } ?> </p> </div>
/** * Generate the URL slug * @since Version 3.7.5 * @param int $id * @param string $name * @return string */ public function createSlug($id = false, $name = false) { if (RP_DEBUG) { global $site_debug; $debug_timer_start = microtime(true); } // Assume ZendDB $find = array("(", ")", "-"); $replace = array(); foreach ($find as $item) { $replace[] = ""; } if (filter_var($id, FILTER_VALIDATE_INT) && !$name) { $name = $this->db->fetchOne("SELECT organisation_name FROM organisation WHERE organisation_id = ?", $id); } elseif (filter_var($id, FILTER_VALIDATE_INT) && is_string($name)) { // Do nothing } elseif (isset($this->name) && !empty($this->name)) { $name = $this->name; $id = $this->id; } else { return false; } $name = str_replace($find, $replace, $name); $proposal = create_slug($name); /** * Trim it if the slug is too long */ if (strlen($proposal) >= 256) { $proposal = substr($poposal, 0, 200); } /** * Check that we haven't used this slug already */ $result = $this->db->fetchAll("SELECT organisation_id FROM organisation WHERE organisation_slug = ? AND organisation_id != ?", array($proposal, $id)); if (count($result)) { $proposal .= count($result); } if (isset($this->slug)) { $this->slug = $proposal; } /** * Add this slug to the database */ $data = array("organisation_slug" => $proposal); $where = array("organisation_id = ?" => $id); $rs = $this->db->update("organisation", $data, $where); if (RP_DEBUG) { if ($rs === false) { $site_debug[] = "Zend_DB: FAILED create url slug for organisation ID " . $id . " in " . round(microtime(true) - $debug_timer_start, 5) . "s"; } else { $site_debug[] = "Zend_DB: SUCCESS create url slug for organisation ID " . $id . " in " . round(microtime(true) - $debug_timer_start, 5) . "s"; } } /** * Return it */ return $proposal; }
</div> </div> <hr> <?php if (!empty($subcategory)) { ?> <div class="col-lg-12"> <h3>Sub Categories</h3> <?php foreach ($subcategory as $cat) { if (@$cat['category']['cat_name'] != '') { ?> <div class="col-lg-3 col-sm-6 col-xs-4 subcategory-grid"> <a href="<?php echo base_url() . "classified/search?location=" . $_COOKIE['gujjucity'] . "&category=" . urlencode($pagecategory['cat_id'] . "-" . @$cat['category']['cat_id'] . "-") . "&q=" . create_slug(@$cat['category']['cat_name']); ?> "> <div class="thumbnail"> <img src="<?php echo image(category_img_path() . @$cat['category']['cat_image'], "cat_icon"); ?> " style="height:80px; width:80px;" /> <div class="caption"> <p class="subcategory-name" style="margin-bottom:2px;"><?php echo @$cat['category']['cat_name']; ?> </p> <p class="subcategory-name"><small><?php echo @$cat['category']['cat_ad_count']; ?>
/** * Create a URL slug * @since Version 3.8.7 */ private function createSlug() { $proposal = substr(create_slug($this->title), 0, 60); $result = $this->db->fetchAll("SELECT topic_id FROM nuke_bbtopics WHERE url_slug = ?", $proposal); if (count($result)) { $proposal .= count($result); } $this->url_slug = $proposal; }
</div> </div> </div> <?php } ?> </div> </div> </div> <!-- <div class="row"> <div class="col-md-3 col-sm-3 col-xs-6"> <div class="dashboard-div-wrapper bk-clr-one"> <a href="<?php echo site_url('app/' . create_slug($app->appname) . '-' . $app->id . '.html'); ?> "> <img class="img-responsive" src="<?php echo $app->appicon; ?> " /> </a> <div class="progress progress-striped active"> </div> <h5><?php echo $app->appname; ?> </h5> <br/> <a href="<?php
<div id="myTabContent" class="tab-content"> <div class="tab-pane active in" id="home"> <div class="form-group"> <label>Loại ứng dụng</label> <select name="apptype" class="form-control"> <option value="1">Youtube đơn lẻ</option> <option value="2">Youtube Channel </option> <option value="3">Youtube Playlist tổng hợp </option> <option value="4">Ứng dụng Wallpaper </option> <option value="5">Ứng dụng tin tức</option> </select> </div> <div class="form-group"> <label>pakage name</label> <input name="pakageapp" type="text" disabled value="<?php echo "com.vietadmob." . trim(create_slug($this->session->userdata('admin_name'))); ?> " class="form-control"> </div> <div class="form-group"> <label>Icon ứng dụng</label> <input name="appicon" type="file"> </div> <div class="form-group"> <label>Tên ứng dụng </label> <input name="appname" type="text" class="form-control""> </div> <div class="form-group"> <label>Giới thiệu</label> <textarea name="appdesc"></textarea> </div>
/** * Make a region slug * @since Version 3.8.7 * @param string $region * @return string */ public function makeRegionSlug($region = false) { if (!$region && isset($this->region) && !empty($this->region)) { $region = $this->region; } if (!$region) { return false; } return create_slug($region); }
<?php foreach ($relate_blog as $blog) { ?> <div class="widget-blog-item media"> <div class="pull-left"> <div class="date"> <span class="month"><?php echo $blog->blog_date; ?> </span> </div> </div> <div class="media-body"> <a href="<?php echo site_url('blog-' . create_slug($blog->blog_title) . '-' . $blog->id . '.html'); ?> "><h5><?php echo $blog->blog_title; ?> </h5></a> </div> </div> <?php } ?> </div> </div> <!-- End Popular Posts -->
/** * Generate the URL slug for this news article * @since Version 3.7.5 * @param int $story_id * @return string */ public function createSlug($story_id = false) { if (RP_DEBUG) { global $site_debug; $debug_timer_start = microtime(true); } // Assume ZendDB $find = array("(", ")", "-", "?", "!", "#", "\$", "%", "^", "&", "*", "+", "="); $replace = array(); foreach ($find as $item) { $replace[] = ""; } if ($story_id) { $title = $this->db->fetchOne("SELECT title FROM nuke_stories WHERE sid = ?", $story_id); } elseif (isset($this->title) && !empty($this->title)) { $title = $this->title; $story_id = $this->id; } else { return false; } $name = str_replace($find, $replace, $title); $proposal = create_slug($name); /** * Trim it if the slug is too long */ if (strlen($proposal) >= 256) { $proposal = substr($poposal, 0, 200); } /** * Check that we haven't used this slug already */ $result = $this->db_readonly->fetchAll("SELECT sid FROM nuke_stories WHERE slug = ? AND sid != ?", array($proposal, $story_id)); if (count($result)) { $proposal .= count($result); } if (isset($this->slug)) { $this->slug = $proposal; } /** * Add this slug to the database */ $data = array("slug" => $proposal); $where = array("sid = ?" => $story_id); $rs = $this->db->update("nuke_stories", $data, $where); if (RP_DEBUG) { if ($rs === false) { $site_debug[] = "Zend_DB: FAILED create url slug for story ID " . $story_id . " in " . round(microtime(true) - $debug_timer_start, 5) . "s"; } else { $site_debug[] = "Zend_DB: SUCCESS create url slug for story ID " . $story_id . " in " . round(microtime(true) - $debug_timer_start, 5) . "s"; } } /** * Return it */ return $proposal; }
<!-- container --> </div> <!-- the_filter--> </div> <!-- the_filter--> <!-- filter_portfolio --> <div class="container"> <div class="row portfolio isotope"> <!--span3--> <?php for ($cm = 0; $cm < count($campaign); $cm++) { ?> <div class="span4 <?php echo create_slug($campaign[$cm]["category_name"]); ?> "> <div class="bximg"> <div class="portfolio-content"> <div class="content"> <h4><?php echo $campaign[$cm]["title"]; ?> </h4> <h6><?php echo get_excerpt($campaign[$cm]["description"], 200, '...'); ?> </h6> <h6>Price: <?php echo $campaign[$cm]["price"];
/** * Create a URL slug * @since Version 3.9 */ private function createSlug() { $proposal = create_slug($this->name); $result = $this->db->fetchAll("SELECT id FROM timetable_points WHERE slug = ?", $proposal); if (count($result)) { $proposal .= count($result); } $this->slug = $proposal; }
/** * Create a URL slug if the create_slug() function doesn't exist * @since Version 3.9.1 * @param string $string * @return string */ public static function create_slug($string) { if (function_exists("create_slug")) { return create_slug($string); } $find = array("(", ")", "-"); $replace = array_fill(0, count($find), ""); $string = str_replace($find, $replace, $string); $slug = strtolower(preg_replace('/[^A-Za-z0-9-]+/', '-', trim($string))); return $slug; }
/** * Return the parent name * */ function setSlug() { //reasons to return if (strlen(trim($this->slug)) > 0) { return false; } //loading libraries require_once EBOOK_EVERY . DS . 'utilities' . DS . 'slug.php'; $this->slug = create_slug($this->name()); return $this->slug(); }
public function create_draft($extra = null) { $this->load->helper(array("MY_string")); $this->load->model('Routes_model'); if (!empty($extra)) { $this->_default_fields['extra'] = serialize($extra); } unset($this->_default_fields['product_id']); $this->_default_fields['status'] = "D"; $this->_default_fields['is_gc'] = "1"; $this->_default_fields['avail_since'] = Date("Y-m-d H:i:s"); $this->_default_fields['cate_id'] = 1; $this->_default_fields['id_art'] = $extra['id_art']; $this->_default_fields['id_template'] = $extra['id_template']; $this->_default_fields['price'] = isset($extra['price']) ? $extra['price'] : 0; //$this->_default_fields['color']=isset($extra['color'])?$extra['color']:""; //list price is min_price of template $this->_default_fields['min_price'] = $this->get_template_price($extra['id_template']); $this->_default_fields['color'] = $this->get_color($extra['id_template']); $this->_default_fields['user_id'] = $this->current_user->id; $this->db->insert($this->_table, $this->_default_fields); // save product code // $insert_id = $this->db->insert_id(); if (empty($insert_id)) { return; } $productcode = sprintf("%04d%09d", $this->current_user->id, $insert_id); $data = array('product_code' => $productcode); $this->db->where('product_id', $insert_id); $this->db->update($this->_table, $data); $lang[CURRENT_LANGUAGE]['product'] = isset($extra['name']) ? $extra['name'] : ""; $lang[CURRENT_LANGUAGE]['full_description'] = isset($extra['description']) ? htmlentities($extra['description']) : ""; // $slug = $lang[CURRENT_LANGUAGE]['product']; $slug = create_slug($slug); $slug = $this->Routes_model->validate_slug($slug); $route['keyword'] = $slug; $route['entity'] = 'product'; $route['query'] = 'home/product/' . $insert_id; $route['oid'] = $insert_id; $route_id = $this->Routes_model->save($route); $lang[CURRENT_LANGUAGE]['slugurl'] = $slug; $lang[CURRENT_LANGUAGE]['slug_id'] = $route_id; // slug url; if ($insert_id) { $this->save_lang($insert_id, CURRENT_LANGUAGE, $lang[CURRENT_LANGUAGE]); } return $this->get_product_draft($insert_id); }
/** * Validate the topic * @since Version 3.5 * @return boolean */ public function validate() { if (empty($this->title)) { throw new \Exception("Cannot validate news topic - no title provided"); return false; } if (empty($this->alias)) { $this->alias = create_slug($this->title); if ($this->id > 0) { $result = $this->db_readonly->fetchAll("SELECT topicname FROM nuke_topics WHERE topicname = ? AND topicid != ?", array($this->alias, $this->id)); } else { $result = $this->db_readonly->fetchAll("SELECT topicname FROM nuke_topics WHERE topicname = ?", $this->alias); } if (count($result)) { $this->alias .= count($result); } } if (empty($this->alias)) { throw new \Exception("Cannot validate news topic - no alias / permalink provided"); return false; } return true; }
function requestapp() { if ($this->session->userdata('admin_id') == null) { redirect('admincp/login'); } else { $data['list_menu'] = $this->modules_model->list_all_active(); if (isset($_REQUEST['btt_submit'])) { $apptype = null; $appid = $this->input->post('apptype'); if ($appid == 1) { $apptype == "Youtube đơn lẻ"; } elseif ($appid == 2) { $apptype == "Youtube Channel"; } elseif ($appid == 3) { $apptype == "Youtube Playlist tổng hợp "; } elseif ($appid == 4) { $apptype == "Ứng dụng Wallpaper"; } elseif ($appid == 5) { $apptype == "Ứng dụng tin tức"; } $pakageapp = "com.vietadmob." . trim(create_slug($this->session->userdata('admin_name'))); $appicon = $this->do_upload_image('./uploads/apps/', 'appicon'); $appname = $this->input->post('appname'); $appdesc = $this->input->post('appdesc'); $this->load->model('app_model'); $userid = $this->session->userdata('admin_id'); $result = $this->app_model->insert_request_app($userid, $appid, $appname, $apptype, $pakageapp, $appicon, $appdesc); if ($result != null | $result != 0) { $content = $pakageapp . "<br/>" . $apptype . "<br/>" . $appname; $title_mail = "Yeu cau Ung dung Mobile - Vietadmob.com"; $this->sendemail('*****@*****.**', $content, $title_mail); redirect('admincp/listrequestapp'); } else { redirect('admincp/requestapp/error'); } } $this->load->view('admincp/dashboard', $data); } }
<?php } } ?> <?php if (have_rows('timeline_sections')) { $timelineNav = ''; $timelineSections = ''; while (have_rows('timeline_sections')) { the_row(); $sectionTitle = get_sub_field('section_title'); $sectionNavTitle = get_sub_field('section_nav_title'); $sectionContent = get_sub_field('section_content'); $timelineNav .= '<li><a href="#' . create_slug($sectionNavTitle) . '">' . $sectionNavTitle . '</a></li>'; $timelineSections .= '<section id="' . create_slug($sectionNavTitle) . '" class="section-block section-anchor">'; $timelineSections .= ' <div class="container">'; $timelineSections .= ' <div class="section-title">'; $timelineSections .= ' <h1>' . $sectionTitle . '</h1>'; $timelineSections .= ' </div>'; $timelineSections .= ' <div class="section-content">'; $timelineSections .= $sectionContent; $timelineSections .= ' </div>'; $timelineSections .= ' </div>'; $timelineSections .= '</section>'; } ?> <div id="timeline-wrapper"> <nav id="anchor-nav" class="section-header"> <div class="container">