classes/php5_classes/Category.class.php

Properties

Description

Holds the geoCategory class.

Classes

geoCategory

Properties

 
 
System  
No 
No 

Description

Utility class that holds various methods to do stuff with categories in the system.

Methods

addCategoryResult, addCategoryResults, appBottom_updateAllListingCounts, categoryIsExcludedFromListingType, getBasicInfo, getCategoryConfig, getCategoryLeveledValues, getExcludedCategoriesByListingType, getHeaderHtml, getInfo, getInstance, getListingCount, getName, getParent, getParents, getRandomBasicInfo, getTopParent, getTree, get_category_dropdown, hasChildren, isEnabled, new_ad_icon_use, normInfo, remove, setListingCategory, updateCategoryCountDelayed, updateListingCount,

addCategoryResult( array   $data, ) : n/a

Description

Add category data to local cache for use later in same page load. This mainly serves to greatly speed up SEO addon when there are a lot of category links on the page, so it doesn't have to re-look up data already retrieved.

Arguments

Name Type Description Default
$data array

The un-filtered results from DB for category. Must contain category_id, language_id, category_name, and description to be of any use.

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 5.1.2

addCategoryResults( array   $data, ) : n/a

Description

Allows adding multiple rows at once to local cache for use later. Basically just calls self::addCategoryResult() for each item in the array.

Arguments

Name Type Description Default
$data array

Array of category results

Return value

Type Description
n/a n/a

Tags

Name Description
since Version 5.1.2

appBottom_updateAllListingCounts( ) : n/a

Description

Used by app_bottom.php to update the listing counts for any categories that have had their listings updated

Return value

Type Description
n/a n/a

categoryIsExcludedFromListingType(   $category,   $listingType, ) : n/a

Arguments

Name Type Description Default
$category n/a
$listingType n/a

Return value

Type Description
n/a n/a

getBasicInfo( int   $category_id = 0, int   $language_id = 0, ) : array

Description

Get basic info about given category. As of version 7.4, will return false if category requested is disabled or any of it's parents are disabled.

Arguments

Name Type Description Default
$category_id int 0
$language_id int 0

Return value

Type Description
array

getCategoryConfig( int   $category_id, bool   $bubbleUpFields = false, ) : array

Description

Gets the categories' info for the given category.

Arguments

Name Type Description Default
$category_id int
$bubbleUpFields bool

if true, bubble up through parents' "what fields to use" settings

false

Return value

Type Description
array

getCategoryLeveledValues( int   $parent, int   $listing_types_allowed, int   $selected = 0, int   $page = 'all', int   $language_id = null, int   $level = null, ) : boolean|array

Description

Get catgory values, in an array format that is expected by the multi-level selection stuff. This allows the multi-level field selection stuff able to be used to select category as well.

Arguments

Name Type Description Default
$parent int
$listing_types_allowed int
$selected int 0
$page int 'all'
$language_id int null
$level int null

Return value

Type Description
boolean|array The array of values as needed to show in multi-level selection format, or false on error

getExcludedCategoriesByListingType(   $listingType, ) : n/a

Arguments

Name Type Description Default
$listingType n/a

Return value

Type Description
n/a n/a

getHeaderHtml( int   $catId, ) : string

Description

Gets the HTML to add to the header for the specific category

Arguments

Name Type Description Default
$catId int

Return value

Type Description
string

getInfo( int   $category_id, bool   $cleanName = false, ) : array|bool

Description

Gets info about a category

Arguments

Name Type Description Default
$category_id int
$cleanName bool

If true, will clean the category_name index

false

Return value

Type Description
array|bool Returns info about value, or false on error.

Tags

Name Description
since Version 7.4.0

getInstance( ) : \geoCategory

Description

Gets an instance of the geoCategory class.

Return value

Type Description
\geoCategory

getListingCount( int   $category_id, bool   $force_on_fly = false, bool   $ignore_filters = false, ) : bool|array

Description

Get the listing counts for the category requested.

Arguments

Name Type Description Default
$category_id int
$force_on_fly bool

If true, will calculate count on the fly instead of retrieving count stored in DB

false
$ignore_filters bool

If true, query to "count" the listings will not start from the one with any browsing filters applied.

false

Return value

Type Description
bool|array Boolean false if problem, or an associative array containing listing counts for requested category.

Tags

Name Description
since Version 6.0.4

getName( int   $category_id, bool   $justTheName = false, ) : string

Description

Gets the name of the given category, already decoded.

Arguments

Name Type Description Default
$category_id int
$justTheName bool

if true, it acts like the method name sounds like, returning just the name.

false

Return value

Type Description
string

getParent( int   $categoryId, ) : int

Description

Gets the parent category ID for the given category. If it can't find the parent, or 0 is specified, will return 0. This is NOT efficient for running multiple times for same category, so use once and save info.

Arguments

Name Type Description Default
$categoryId int

Return value

Type Description
int The parent category ID.

Tags

Name Description
since Version 5.0.0

getParents( int   $category_id, bool   $use_bottom = false, bool   $cleanName = false, ) : boolean|array

Description

Get the parent values for the specified category ID in an array.

Arguments

Name Type Description Default
$category_id int
$use_bottom bool

If true, will also return the requested cat info as part of the array of parent values, handy for things like displaying the full breadcrumb.

false
$cleanName bool

If true, will clean the category_name value for each category

false

Return value

Type Description
boolean|array Returns an array with all the parent cat info, the array index is the parent cat level and the info is same as returned by {@see geoCategory::getInfo()}

Tags

Name Description
since Version 7.4.0

getRandomBasicInfo( ) : array

Description

return an array with a random category information

Return value

Type Description
array

getTopParent( int   $categoryId, ) : boolean|\number

Description

Gets the "top" parent ID for the given category ID by traveling up the category tree.

Arguments

Name Type Description Default
$categoryId int

Return value

Type Description
boolean|\number The top category ID or false if there was a problem.

Tags

Name Description
since Version 6.0.6

getTree( int   $category, ) : array

Description

Gets a tree for the given category. Alias of geoCategory->getParents($category,true,true)

Arguments

Name Type Description Default
$category int

Return value

Type Description
array

get_category_dropdown(   $name,   $category_id = 0,   $no_main = 0,   $css_control = 0,   $all_cat_text = '',   $return_type = 1,   $max_depth = -1, ) : \unknown_type

Description

Not currently used, we plan to move the same named method in site class here, but it's not done all the way yet.

Arguments

Name Type Description Default
$name n/a
$category_id n/a 0
$no_main n/a 0
$css_control n/a 0
$all_cat_text n/a ''
$return_type n/a 1
$max_depth n/a -1

Return value

Type Description
\unknown_type

hasChildren( int   $category_id, ) : bool

Description

Sees if the given category has any kids.

Arguments

Name Type Description Default
$category_id int

Return value

Type Description
bool

isEnabled( int   $category_id, ) : boolean

Description

Check if the given category and parent categories are enabled or not.

Arguments

Name Type Description Default
$category_id int

Return value

Type Description
boolean

Tags

Name Description
since Versio 7.4.0

new_ad_icon_use( int   $category_id = 0, ) : string

Description

Gets the HTML for new icon if there are new listings and setting is turned on, otherwise returns empty string.

Arguments

Name Type Description Default
$category_id int 0

Return value

Type Description
string

normInfo( array   $info, ) : array

Description

Normalize the info for a category, so that it has names that match leveled fields

Arguments

Name Type Description Default
$info array

Return value

Type Description
array

Tags

Name Description
since Version 7.4.0

remove( int   $categoryId, bool|int   $moveTo = null, bool   $recurse = false, ) : bool

Description

Removes a specified category and all sub-categories, and anything "attached".
But it can have the option to "move" listings to the parent instead of deleted. this does NOT re-count the parent category counts, it is up to calling caller to do that this is designed to be called multiple times. As of version 6.0.6, will automatically update listing counts for any categories where those might be affected by category removal

Arguments

Name Type Description Default
$categoryId int
$moveTo bool|int

If true, will move all listings in category being removed to the parent category. If an int, will move listings to specified value used as category id to move to.

null
$recurse bool

Used internally for whether this is recursive call or not, param added inversion 6.0.6

false

Return value

Type Description
bool

setListingCategory(   $listing_id,   $category_id, ) : n/a

Arguments

Name Type Description Default
$listing_id n/a
$category_id n/a

Return value

Type Description
n/a n/a

updateCategoryCountDelayed( int   $category_id, ) : n/a

Description

Add a category to the list of categories to have their counts updated at the end of page execution.
This is particularly useful for use in "bulk" routines, as it ensures each category will only be recounted a single time

Arguments

Name Type Description Default
$category_id int

Return value

Type Description
n/a n/a

updateListingCount( int   $category_id, bool   $count_parents = true, ) : n/a

Description

Update the listing count on the given category ID.

Arguments

Name Type Description Default
$category_id int
$count_parents bool

If false, will not count parent categories - param added in version 6.0.5

true

Return value

Type Description
n/a n/a

Properties

$_updateCountsAtBottom,

Array  private  static $_updateCountsAtBottom = array()

Keep track of categories set by setListingCategory(), then update all their counts in app_bottom


Documentation was generated by phpDocumentor 2.2.0 .

Namespaces

  • global

    Packages

    • Default
      • ExampleAddon
        • addon_example_admin
          In charge of doing stuff on the admin side, this is optional.
        • addon_example_info
          Required class for addons, this is the Addon information class, used by the addon system to determine what the addon can do. Also contains info about the addon that can be viewed in the addon management page in the admin.
        • addon_example_pages
          Addon page class, used by the addon system to display pages on the client side.
        • addon_example_setup
          This class is not required. If it, and the function for a particular routine exist, then that function will be called IN ADDITION TO the automated routines of the addon framework.
        • addon_example_tags
          Expects one function for each tag. Function name should be the same as the tag name. Can also have a constructor if anything needs to be constructed.
        • addon_example_util
          This is where to put functions that the main part of the addon will use.
        • eWidgetOrderItem
          This order item is designed to allow users on your site to purchase an eWidget.
      • System
        • DataAccess
          This is the main Database access object.
        • Singleton
          Singleton method class
        • _templateOrderItem
          Developers: use this file as a template to create a new order item.
        • _templatePaymentGateway
          This is the "developer template" payment gateway handler, a developer could use this file as a starting point for creating a new payment gateway in the system.
        • geoAPI
          The main system class for receiving and handling remote API calls, this acts as a translation layer between the communication with the "outside" and each API call.
        • geoAddon
          This is the class that handles anything and everything to do with addons.
        • geoArrayTools
          Utility functions for manipulating arrays
        • geoBrowse
          Contains functions common to browsing listings
        • geoBrowsingFilter
          System for activating, storing, and deactivating browsing filters.
        • geoCJAX
          Class that wraps the CJAX_FRAMEWORK, used to get the CJAX class.
        • geoCache
          This is the main part of the Geo cache system, it does all the "low level" stuff like writing files and escaping cache data.
        • geoCacheModule
          Part of Geo Cache system, specifically tuned to work best with cacheing module data (which will be an array).
        • geoCachePage
          Cache system specifically tuned to work best with cacheing output of pages and modules
        • geoCacheSetting
          Part of Geo Cache system, specifically tuned to work best with cacheing site-wide key=value type settings.
        • geoCacheText
          Part of Geo Cache system, this part specifically tuned to work best with cacheing language specific messages.
        • geoCalendar
          Holds utility method(s) for manipulating stuff dealing with calendar selector.
        • geoCart
          This class is behind the cart, loading all the order items and such and displaying, and processing all the different pages.
        • geoCategory
          Utility class that holds various methods to do stuff with categories in the system.
        • geoCombineResources
          This class helps to combine CSS and JS files, minify them, and optionally compress them.
        • geoCron
          This is the cron job backend, it handles all the communication and security and all that.
        • geoCrypt
          Class to use for encrypting information that needs to be able to be retrieved later.
        • geoDate
          Holds utility method(s) for manipulating stuff dealing with dates.
        • geoEmail
          Class that sends out e-mails.
        • geoFields
          Class that holds settings information for fields to use.
        • geoFieldsField
          A mini object to hold data about a specific field.
        • geoFile
          As the name implies, this is used for file-based utility methods.
        • geoFilter
          A few utility methods, good for filtering stuff.
        • geoFormatString
          Used to display a message nice and pretty, we'll probably be getting rid of this class though so don't go crazy using it.
        • geoHTML
          Class to generate chunks of HTML that are very common, used the most in the admin panel.
        • geoImage
          This class is responsible for a lot of the image processing, along with other aspects like generating the image tag for thumbnails.
        • geoInvoice
          This is the invoice object representing an invoice in the system.
        • geoLeveledField
          Class for doing common things with leveled fields.
        • geoListing
          A listing object, basically a container object for particular listing.
        • geoListingDisplay
          This is basically a container that is responsible for helping to display {listing .
        • geoListingFeed
          Class that helps to render RSS or other types of feeds based on list of listings.
        • geoMaster
          This is dedicated class for getting the value of, and setting, the various "master switches" within the software. Since this is meant as an easy way to get the values of master switches, most of the methods are static.
        • geoNumber
          Utility functions relating to number conversion/manipulation/validation ect.
        • geoOrder
          The geoOrder object, an object representation of an order in the system.
        • geoOrderItem
          The class that all order items must extend.
        • geoPC
          Used for login credential validation, password hashing, etc. along with software licensing.
        • geoPagination
          Utility functions useful for generating pagination of a results page such as when browing ads or searching
        • geoPaymentGateway
          This class should be extended by each different payment gateway, this will have some default functions that each gateway will inherit, and also has a few final static methods used by the system to affect all order items.
        • geoPlanItem
          A container to hold settings for a particular order item type, according to price plan ID, and optionally category ID for category specific settings.
        • geoRecurringBilling
          The geoRecurringBilling object, an object representation of a recurring billing in the system.
        • geoRegion
          Stuff for regions and sub-regions.
        • geoRegistry
          Handy little object, can be used to set registry type settings.
        • geoSearchUtils
          Class for search utilities.
        • geoSellerBuyer
          Handles back-end for the seller/buyer payment gateways, to allow the buyer to more easily pay the seller for a won auction. This handles the underlying system, but the actual work is done by individual seller/buyer gateways, for instance the Paypal buy-now functionality.
        • geoSession
          Manages session storage and session cookies for user sessions.
        • geoString
          Utility functions relating to languages and string manipulation.
        • geoStringData
          This class is to store accented chars, to be used by {@link geoString::removeAccents()}, mainly to keep the String.class.php file un-cluttered.
        • geoTable
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableRow
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableRowset
          NOT FULLY IMPLEMENTED! Do not use this class yet as it is not finished and may change drastically before we are done with it, or may even be removed.
        • geoTableSelect
          Class used to generate a select query, useful when multiple areas want to affect a single query, for instance when generating a search query and there are addons involved.
        • geoTables
          Used to hold database table names, used throughout the code.
        • geoTemplate
          Template object that extends the Smarty class (a 3rd party library) to enable using templates to display things.
        • geoTransaction
          This is the object used for a transaction in the order and invoice system.
        • geoUser
          An object representative of a certain user in the system.
        • geoUserRating
          Store, retrieve, and display inter-user ratings
        • geoUtil
          Misc utility functions
        • geoView
          As the name implies, this is used for creating the page view. It does take a little setup (like any class), the setup is normally done in the display_page method in geoSite, or display_page in geoAdmin if displaying a page in the admin.
        • iApiTransport
          Interface for API Transports, a transport must implement this interface for the system to use it.
        • iOrderItem
          You cannot have abstract static functions, so instead need to have an interface to force the given static functions to be defined.
        • metaDbTables
          Used so that old locations that use the old name geoTables will still work.