/** * @$FRAMEWORK_PATH penguin framework files path * @$options add your option for admin panel * @$posts add your post page for admin panel * @$update check theme version for update */ static function start($options = array(), $metas = array(), $posts = array(), $posts_columns = array(), $megamenu = true) { //when framework had start then will don't run again. if (Penguin::$INIT) { return; } Penguin::$INIT = true; Penguin::$FRAMEWORK_MSG = array(0 => 'Please input your purchase code active license!', 1 => 'Your purchase code error!', 2 => 'You used too more site with the same purchase code, please purchase more license!', 3 => 'Penguin Framework', 4 => 'version', 5 => __('You had back all setting to default value complete!', Penguin::$THEME_NAME), 6 => __('Setting Complete!', Penguin::$THEME_NAME), 7 => __('Reset to default', Penguin::$THEME_NAME), 8 => __('Save Changes', Penguin::$THEME_NAME), 9 => __('Notice: you had select back all setting to default value!', Penguin::$THEME_NAME), 10 => __('have no any php file for show', Penguin::$THEME_NAME), 11 => __('have no any content for this page', Penguin::$THEME_NAME), 12 => __('Paste the export code into the import text area field in your new site option and press "Import" button.', Penguin::$THEME_NAME), 13 => __('Import Options', Penguin::$THEME_NAME), 14 => __('Export Options', Penguin::$THEME_NAME), 15 => __('Upload', Penguin::$THEME_NAME), 16 => __('You have no add any element for meta', Penguin::$THEME_NAME), 17 => __('Add Field', Penguin::$THEME_NAME), 18 => __('Delete All', Penguin::$THEME_NAME), 19 => __('Custom Field Config Error', Penguin::$THEME_NAME), 20 => __('Add Image', Penguin::$THEME_NAME)); if (count($options) > 0) { new PenguinOption($options); } if (count($metas) > 0) { new PenguinMeta($metas); } if (count($posts) > 0) { new PenguinPost($posts); } if (count($posts_columns) > 0) { new PenguinPostColumns($posts_columns); } if ($megamenu) { new PenguinMegaMenu(); } }
<?php require 'Bird.php'; require 'Penguin.php'; $penguin = new Penguin(false, 2); //echo $bird->legCount; //echo $penguin->foo(); if ($penguin->canFly()) { // can fly }
<?php /** * Created by PhpStorm. * User: R.McDonald * Date: 3/23/2015 * Time: 9:20 PM */ //======================USING OBJECT=============================== require 'Bird.php'; require 'Pigeon.php'; require 'Penguin.php'; $pigeon = new Pigeon(true, 2); $penguin = new Penguin(true, 2); echo 'Will Never' . '<br>'; echo $pigeon->getLegCount() . " Wats Wrong" . '<br>'; if ($pigeon->canFly()) { echo 'Can Fly'; } $penguin->foo();
function addSelect($item) { global $penguin_options; ?> <select id="<?php echo $item['property']; ?> " name="<?php echo $this->option_name . '[' . $item['property'] . ']'; ?> " class="penguin-select" > <?php $k = 0; if (Penguin::check_key_value('option_array', $item) != "") { $array = explode("|", $item['option_array']); $item['options'] = array(Penguin::check_key_value('default_option', $item)); if (count($array) > 0) { $item['options'] = array_merge($item['options'], $array); foreach ($item['options'] as $option) { $option = str_replace("+", " ", $option); } } } foreach ($item['options'] as $option) { if ($option == "") { continue; } ?> <option value="<?php echo $k; ?> " <?php echo intval($this->getCurrentValue($item)) == $k ? " selected='selected'" : " "; ?> > <?php echo esc_html(__($option, Penguin::$THEME_NAME)); ?> </option> <?php $k++; } ?> </select> <?php }
<?php //error_reporting(E_ERROR); if (empty($_POST["username"]) or empty($_POST["password"])) { echo "Please fill in all fields"; } else { $username = $_POST["username"]; $password = $_POST["password"]; spl_autoload_register(function ($strClass) { require_once sprintf('Penguin/%s.php', $strClass); }); $objPenguin = new Penguin(); global $itemid; $objPenguin->addListener("jr", function ($packet) use($objPenguin) { $objPenguin->addItem($_POST["itemid"]); }); $objPenguin->addListener("ai", function ($packet) { echo "Successfully added item ", "\n"; die; }); $objPenguin->addListener("e", function ($packet) use($objPenguin) { die($objPenguin->arrErrors[$packet[3]]["Description"]); }); try { $objPenguin->login($username, $password); $objPenguin->joinServer('Sled'); } catch (ConnectionException $objException) { die; } $objPenguin->joinRoom(805); while (true) {
Penguin::$MEGAMEN_STYLE = 'iconleft'; break; case 4: Penguin::$MEGAMEN_STYLE = 'titleleft'; break; case 5: Penguin::$MEGAMEN_STYLE = 'fullborder'; break; case 6: Penguin::$MEGAMEN_STYLE = '3d'; break; } } else { Penguin::$MEGAMEN_STYLE = 'default'; } Penguin::start($optionsConfig, $metasConfig, $postsConfig, $postsColumnsConfig, true); // here need custom return value function Penguin_Custom_Posts_Columns_Value($type, $column_name, $id) { /* start */ if ($type == 'portfolio') { if ($column_name == 'portfolio-type') { switch (intval(penguin_get_post_meta_key($column_name, $id))) { case 0: _e('Image', 'ROEN'); break; case 1: _e('Gallery', 'ROEN'); break; case 2: _e('Video', 'ROEN');
<?php spl_autoload_register(function ($strClass) { require_once sprintf('Penguin/%s.php', $strClass); }); $objPenguin = new Penguin(); // Proxy settings //$objPenguin->setProxy("127.0.0.1", 9050); try { $objPenguin->login('Username', 'Password'); $objPenguin->joinServer('Sled'); } catch (ConnectionException $objException) { die; } $objPenguin->joinRoom(100); while (true) { $strData = $objPenguin->recv(); if (XTParser::IsValid($strData)) { echo $strData, chr(10); } }
class GrandChildClass extends ChildClass{ public function __construct(){ //explicitly call the parent constructor to ensure it is run parent::__construct(); } public function runAncestorClassDoSomething02(){ //access the top level class function by using the class name ParentClass::doSomething02(); } } $child = new ChildClass(); $child->doSomething01(); //access all public and protected members of the parent class $child->doSomething02(); //override parent class members $child->runParentClassDoSomething02(); </code></pre> </ol> <span> <?php echo "<h3>Instantiate a Penguin that inherits from Bird...</h3>"; require_once "Penguin.php"; $emperor = new Penguin("Black", "Squak"); echo "<h3>Run a function unique to Penguins...</h3>"; $emperor->swim(); echo "<h3>Run a Penguin function the overrides the parent...</h3>"; $emperor->fly(); ?> </span> </body> </html>
{ public function __construct($id) { $this->getPenguinFromDb($id); } public function getPenguinFromDb($id) { // elegant and robust database code goes here } public function __get($field) { if ($field == 'name') { return $this->username; } } public function __set($field, $value) { if ($field == 'name') { $this->username = $value; } } public function __call($method, $args) { echo "unknown method " . $method; echo "<pre>"; print_r($args); return false; } } $p = new Penguin(1); $p->test(2, 3);
<?php spl_autoload_register(function ($strClass) { require_once sprintf('Penguin/%s.php', $strClass); }); $mixTarget = 'Tails25'; // Change this to your target's player id or username $objPenguin = new Penguin(); $objPenguin->addListener('sp', function ($arrPacket) use($objPenguin, &$mixTarget) { $intPlayer = $arrPacket[3]; $intX = $arrPacket[4]; $intY = $arrPacket[5]; if (isset($objPenguin->arrRoom[$intPlayer])) { $objPenguin->arrRoom[$intPlayer]->setX($intX); $objPenguin->arrRoom[$intPlayer]->setY($intY); } if ($intPlayer == $mixTarget) { $objPenguin->sendPosition($intX, $intY); } }); $objPenguin->addListener('pbn', function ($arrPacket) use(&$mixTarget) { $mixTarget = $arrPacket[4]; }); $objPenguin->addListener('bf', function ($arrPacket) use($objPenguin) { $intRoom = $arrPacket[3]; if ($intRoom == -1) { echo 'Target is offline', chr(10), die; } $objPenguin->joinRoom($intRoom); }); $objPenguin->addListener('rp', function ($arrPacket) use($objPenguin, &$mixTarget) {
function getDefaultData($item) { $default_data = Penguin::check_key_value($item['name'], $this->custom_data); if ($default_data != '') { return $default_data[0]; } else { if (isset($item['default'])) { return $item['default']; } } return ''; }