/** * This function loads a page wich need to be in page folder in caller plugin root directory. * * @param string $page The name of the page in page's folder to be loaded. * @param array $vars An array of values to be passed to the page * * @return all the page required */ function deyan_load_page($page, $vars = array()) { $dir = elgg_get_plugins_path(); $plugin = elgg_get_calling_plugin_id(); $dir .= $plugin; $dir .= "/pages/$page.php"; return require_once $dir; }
/** * Get the name of the most recent plugin to be called in the * call stack (or the plugin that owns the current page, if any). * * i.e., if the last plugin was in /mod/foobar/, get_plugin_name would return foo_bar. * * @deprecated 1.8 Use elgg_get_calling_plugin_id() * * @param boolean $mainfilename If set to true, this will instead determine the * context from the main script filename called by * the browser. Default = false. * * @return string|false Plugin name, or false if no plugin name was called */ function get_plugin_name($mainfilename = false) { elgg_deprecated_notice('get_plugin_name() is deprecated by elgg_get_calling_plugin_id()', 1.8); return elgg_get_calling_plugin_id($mainfilename); }
/** * Returns the \ElggPlugin entity of the last plugin called. * * @return ElggPlugin|false * @since 1.8.0 * @access private * @deprecated 1.9 */ function elgg_get_calling_plugin_entity() { elgg_deprecated_notice("elgg_get_calling_plugin_entity() is deprecated.", 1.9); $plugin_id = elgg_get_calling_plugin_id(); if ($plugin_id) { return elgg_get_plugin_from_id($plugin_id); } return false; }
/** * Returns entities based upon plugin settings. * Takes all the options for {@see elgg_get_entities_from_private_settings()} * in addition to the ones below. * * @param array $options Array in the format: * * plugin_id => NULL|STR The plugin id. Defaults to calling plugin * * plugin_user_setting_names => NULL|ARR private setting names * * plugin_user_setting_values => NULL|ARR metadata values * * plugin_user_setting_name_value_pairs => NULL|ARR ( * name => 'name', * value => 'value', * 'operand' => '=', * ) * Currently if multiple values are sent via * an array (value => array('value1', 'value2') * the pair's operand will be forced to "IN". * * plugin_user_setting_name_value_pairs_operator => NULL|STR The operator to use for combining * (name = value) OPERATOR (name = value); default AND * * @return mixed int If count, int. If not count, array. false on errors. */ function elgg_get_entities_from_plugin_user_settings(array $options = array()) { // if they're passing it don't bother if (!isset($options['plugin_id'])) { $options['plugin_id'] = elgg_get_calling_plugin_id(); } $singulars = array('plugin_user_setting_name', 'plugin_user_setting_value', 'plugin_user_setting_name_value_pair'); $options = elgg_normalise_plural_options_array($options, $singulars); // rewrite plugin_user_setting_name_* to the right PS ones. $map = array('plugin_user_setting_names' => 'private_setting_names', 'plugin_user_setting_values' => 'private_setting_values', 'plugin_user_setting_name_value_pairs' => 'private_setting_name_value_pairs', 'plugin_user_setting_name_value_pairs_operator' => 'private_setting_name_value_pairs_operator'); foreach ($map as $plugin => $private) { if (!isset($options[$plugin])) { continue; } if (isset($options[$private])) { if (!is_array($options[$private])) { $options[$private] = array($options[$private]); } $options[$private] = array_merge($options[$private], $options[$plugin]); } else { $options[$private] = $options[$plugin]; } } $plugin_id = $options['plugin_id']; $prefix = elgg_namespace_plugin_private_setting('user_setting', '', $plugin_id); $options['private_setting_name_prefix'] = $prefix; return elgg_get_entities_from_private_settings($options); }
/** * Returns entities based upon plugin user settings. * Takes all the options for {@link elgg_get_entities_from_private_settings()} * in addition to the ones below. * * @param array $options Array in the format: * * plugin_id => STR The plugin id. Required. * * plugin_user_setting_names => null|ARR private setting names * * plugin_user_setting_values => null|ARR metadata values * * plugin_user_setting_name_value_pairs => null|ARR ( * name => 'name', * value => 'value', * 'operand' => '=', * ) * Currently if multiple values are sent via * an array (value => array('value1', 'value2') * the pair's operand will be forced to "IN". * * plugin_user_setting_name_value_pairs_operator => null|STR The operator to use for combining * (name = value) OPERATOR (name = value); default AND * * @return mixed int If count, int. If not count, array. false on errors. */ function getEntitiesFromUserSettings(array $options = array()) { if (!isset($options['plugin_id'])) { elgg_deprecated_notice("'plugin_id' is now required for elgg_get_entities_from_plugin_user_settings()", 1.9); $options['plugin_id'] = elgg_get_calling_plugin_id(); } $singulars = array('plugin_user_setting_name', 'plugin_user_setting_value', 'plugin_user_setting_name_value_pair'); $options = _elgg_normalize_plural_options_array($options, $singulars); // rewrite plugin_user_setting_name_* to the right PS ones. $map = array('plugin_user_setting_names' => 'private_setting_names', 'plugin_user_setting_values' => 'private_setting_values', 'plugin_user_setting_name_value_pairs' => 'private_setting_name_value_pairs', 'plugin_user_setting_name_value_pairs_operator' => 'private_setting_name_value_pairs_operator'); foreach ($map as $plugin => $private) { if (!isset($options[$plugin])) { continue; } if (isset($options[$private])) { if (!is_array($options[$private])) { $options[$private] = array($options[$private]); } $options[$private] = array_merge($options[$private], $options[$plugin]); } else { $options[$private] = $options[$plugin]; } } $prefix = _elgg_namespace_plugin_private_setting('user_setting', '', $options['plugin_id']); $options['private_setting_name_prefix'] = $prefix; return elgg_get_entities_from_private_settings($options); }
/** * Register a Icon Library in $CONFIG * * @return void */ function deyan_register_iconlib($iconlib) { $icons = elgg_get_config('iconlibs'); $icons[$iconlib] = elgg_get_calling_plugin_id(); elgg_set_config('iconlibs', $icons); }
/** * Registers a theme in $CONFIG * * @return void * */ function deyan_register_theme($theme) { $themes = elgg_get_config('themes'); $themes[$theme] = elgg_get_calling_plugin_id(); elgg_set_config('themes', $themes); }
* Website: http://socia.us * */ $sociaRoller = elgg_get_entities(array('type' => 'object', 'subtype' => 'sociaRollerSettings', 'limit' => '1')); $sociaRollerValues = array_shift(array_values($sociaRoller)); $variables = socia_roller_variables(); $patterns = range(1, 20); foreach ($patterns as $pattern) { echo ".socia_pattern-{$pattern} { background:url({$CONFIG->url}mod/socia_roller/graphics/patterns/{$pattern}.png); }\r\n"; } echo ".socia_pattern-0 { background-image:none; }\r\n"; $pixels = array('font-size', 'line-height', 'height', 'margin-top', 'margin-left', 'margin-bottom', 'margin-right', 'top', 'left', 'bottom', 'right', 'padding', 'padding-top', 'padding-left', 'padding-right', 'padding-bottom', 'border-top-right-radius', 'border-top-left-radius', 'border-bottom-right-radius', 'border-bottom-left-radius', 'border-radius', 'border-width'); $colors = array('color', 'background-color', 'border-color'); foreach ($variables as $key => $value) { $property = $sociaRollerValues->{$key}; echo elgg_get_calling_plugin_id(); foreach ($value['divs'] as $div => $attribute) { if (in_array($attribute, $pixels)) { echo $div . "{" . $attribute . ":" . $property . "px;}\r\n"; echo $div . ":hover {" . $attribute . ":" . $property . "px;}\r\n"; } elseif (in_array($attribute, $colors)) { echo $div . "{" . $attribute . ": #" . $property . ";}\r\n"; echo $div . ":hover {" . $attribute . ": #" . $property . ";}\r\n"; } elseif ($attribute == 'div') { switch ($property) { case "yes": echo $div . " { display:block; }\r\n"; break; case "no": echo $div . " { display:none; }\r\n"; break;